mirror of
https://github.com/directus/directus.git
synced 2026-04-25 03:00:53 -04:00
5
.changeset/curvy-islands-smash.md
Normal file
5
.changeset/curvy-islands-smash.md
Normal file
@@ -0,0 +1,5 @@
|
||||
---
|
||||
'@directus/api': patch
|
||||
---
|
||||
|
||||
Optimized the file imports
|
||||
@@ -1,5 +1,5 @@
|
||||
import type { Knex } from 'knex';
|
||||
import { getDatabaseVersion } from '../../../../database/index.js';
|
||||
import { getDatabaseVersion } from '../../../index.js';
|
||||
import { SchemaHelper } from '../types.js';
|
||||
|
||||
export class SchemaHelperMySQL extends SchemaHelper {
|
||||
|
||||
@@ -2,7 +2,7 @@ import type { Item, Query, SchemaOverview } from '@directus/types';
|
||||
import { toArray } from '@directus/utils';
|
||||
import type { Knex } from 'knex';
|
||||
import { clone, cloneDeep, isNil, merge, pick, uniq } from 'lodash-es';
|
||||
import { getHelpers } from '../database/helpers/index.js';
|
||||
import { getHelpers } from './helpers/index.js';
|
||||
import env from '../env.js';
|
||||
import { PayloadService } from '../services/payload.js';
|
||||
import type { AST, FieldNode, FunctionFieldNode, M2ONode, NestedCollectionNode } from '../types/ast.js';
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import type { Request, Response } from 'express';
|
||||
import { beforeEach, expect, test, vi } from 'vitest';
|
||||
import extractToken from '../../src/middleware/extract-token.js';
|
||||
import '../../src/types/express.d.ts';
|
||||
import extractToken from './extract-token.js';
|
||||
import '../types/express.d.ts';
|
||||
|
||||
let mockRequest: Partial<Request & { token?: string }>;
|
||||
let mockResponse: Partial<Response>;
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import type { Request, Response } from 'express';
|
||||
import { beforeEach, expect, test, vi } from 'vitest';
|
||||
import '../../src/types/express.d.ts';
|
||||
import '../types/express.d.ts';
|
||||
import { InvalidPayloadError } from '../errors/invalid-payload.js';
|
||||
import { validateBatch } from './validate-batch.js';
|
||||
|
||||
|
||||
@@ -14,8 +14,8 @@ import { systemCollectionRows } from '../database/system-data/collections/index.
|
||||
import emitter from '../emitter.js';
|
||||
import env from '../env.js';
|
||||
import { ForbiddenError, InvalidPayloadError } from '../errors/index.js';
|
||||
import { FieldsService } from '../services/fields.js';
|
||||
import { ItemsService } from '../services/items.js';
|
||||
import { FieldsService } from './fields.js';
|
||||
import { ItemsService } from './items.js';
|
||||
import type {
|
||||
AbstractServiceOptions,
|
||||
ActionEventParams,
|
||||
|
||||
@@ -15,8 +15,8 @@ import getDatabase, { getSchemaInspector } from '../database/index.js';
|
||||
import { systemFieldRows } from '../database/system-data/fields/index.js';
|
||||
import emitter from '../emitter.js';
|
||||
import { ForbiddenError, InvalidPayloadError } from '../errors/index.js';
|
||||
import { ItemsService } from '../services/items.js';
|
||||
import { PayloadService } from '../services/payload.js';
|
||||
import { ItemsService } from './items.js';
|
||||
import { PayloadService } from './payload.js';
|
||||
import type { AbstractServiceOptions, ActionEventParams, MutationOptions } from '../types/index.js';
|
||||
import getDefaultValue from '../utils/get-default-value.js';
|
||||
import getLocalType from '../utils/get-local-type.js';
|
||||
|
||||
@@ -5,8 +5,8 @@ import { MockClient, Tracker, createTracker, type RawQuery } from 'knex-mock-cli
|
||||
import { cloneDeep } from 'lodash-es';
|
||||
import type { MockedFunction } from 'vitest';
|
||||
import { afterEach, beforeAll, beforeEach, describe, expect, it, vi } from 'vitest';
|
||||
import { getDatabaseClient } from '../../src/database/index.js';
|
||||
import { ItemsService } from '../../src/services/index.js';
|
||||
import { getDatabaseClient } from '../database/index.js';
|
||||
import { ItemsService } from './index.js';
|
||||
import { sqlFieldFormatter, sqlFieldList } from '../__utils__/items-utils.js';
|
||||
import { systemSchema, userSchema } from '../__utils__/schemas.js';
|
||||
import { InvalidPayloadError } from '../errors/index.js';
|
||||
|
||||
@@ -3,9 +3,9 @@ import knex from 'knex';
|
||||
import { MockClient, Tracker, createTracker } from 'knex-mock-client';
|
||||
import type { MockedFunction } from 'vitest';
|
||||
import { afterEach, beforeAll, beforeEach, describe, expect, it, vi } from 'vitest';
|
||||
import type { Helpers } from '../../src/database/helpers/index.js';
|
||||
import { getHelpers } from '../../src/database/helpers/index.js';
|
||||
import { PayloadService } from '../../src/services/index.js';
|
||||
import type { Helpers } from '../database/helpers/index.js';
|
||||
import { getHelpers } from '../database/helpers/index.js';
|
||||
import { PayloadService } from './index.js';
|
||||
|
||||
vi.mock('../../src/database/index', () => ({
|
||||
getDatabaseClient: vi.fn().mockReturnValue('postgres'),
|
||||
|
||||
@@ -2,8 +2,8 @@ import type { PermissionsAction, Query } from '@directus/types';
|
||||
import type Keyv from 'keyv';
|
||||
import { clearSystemCache, getCache } from '../cache.js';
|
||||
import { appAccessMinimalPermissions } from '../database/system-data/app-access-permissions/index.js';
|
||||
import type { QueryOptions } from '../services/items.js';
|
||||
import { ItemsService } from '../services/items.js';
|
||||
import type { QueryOptions } from './items.js';
|
||||
import { ItemsService } from './items.js';
|
||||
import type { AbstractServiceOptions, Item, MutationOptions, PrimaryKey } from '../types/index.js';
|
||||
import { filterItems } from '../utils/filter-items.js';
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@ import knex from 'knex';
|
||||
import { createTracker, MockClient, Tracker } from 'knex-mock-client';
|
||||
import type { MockedFunction } from 'vitest';
|
||||
import { afterEach, beforeAll, beforeEach, describe, expect, it, vi } from 'vitest';
|
||||
import { CollectionsService, FieldsService, RelationsService, SpecificationService } from '../../src/services/index.js';
|
||||
import { CollectionsService, FieldsService, RelationsService, SpecificationService } from './index.js';
|
||||
import type { Collection } from '../types/index.js';
|
||||
|
||||
class Client_PG extends MockClient {}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import type { RequestHandler, Request, Response } from 'express';
|
||||
import '../../src/types/express.d.ts';
|
||||
import '../types/express.d.ts';
|
||||
import asyncHandler from './async-handler.js';
|
||||
import { expect, vi, test } from 'vitest';
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { calculateFieldDepth } from '../../src/utils/calculate-field-depth.js';
|
||||
import { calculateFieldDepth } from './calculate-field-depth.js';
|
||||
import { test, expect } from 'vitest';
|
||||
|
||||
test('Calculates basic depth', () => {
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { filterItems } from '../../src/utils/filter-items.js';
|
||||
import { filterItems } from './filter-items.js';
|
||||
import { describe, test, expect } from 'vitest';
|
||||
|
||||
const items = [
|
||||
|
||||
@@ -7,7 +7,7 @@ import type { Accountability, PermissionsAction, Query, SchemaOverview } from '@
|
||||
import type { Knex } from 'knex';
|
||||
import { cloneDeep, isEmpty, mapKeys, omitBy, uniq } from 'lodash-es';
|
||||
import type { AST, FieldNode, FunctionFieldNode, NestedCollectionNode } from '../types/index.js';
|
||||
import { getRelationType } from '../utils/get-relation-type.js';
|
||||
import { getRelationType } from './get-relation-type.js';
|
||||
|
||||
type GetASTOptions = {
|
||||
accountability?: Accountability | null;
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { describe, expect, vi, test } from 'vitest';
|
||||
import { getAuthProviders } from '../../src/utils/get-auth-providers.js';
|
||||
import { getAuthProviders } from './get-auth-providers.js';
|
||||
|
||||
let factoryEnv: { [k: string]: any } = {};
|
||||
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
import type { DeepPartial } from '@directus/types';
|
||||
import { expect, test } from 'vitest';
|
||||
import { InvalidQueryError } from '../errors/index.js';
|
||||
import type { ColPathProps } from '../utils/get-column-path.js';
|
||||
import { getColumnPath } from '../utils/get-column-path.js';
|
||||
import type { ColPathProps } from './get-column-path.js';
|
||||
import { getColumnPath } from './get-column-path.js';
|
||||
|
||||
/*
|
||||
{
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { getConfigFromEnv } from '../../src/utils/get-config-from-env.js';
|
||||
import { getConfigFromEnv } from './get-config-from-env.js';
|
||||
import { describe, test, expect, vi } from 'vitest';
|
||||
|
||||
vi.mock('../../src/env', () => {
|
||||
|
||||
@@ -9,7 +9,7 @@ import env from '../env.js';
|
||||
import logger from '../logger.js';
|
||||
import { RolesService } from '../services/roles.js';
|
||||
import { UsersService } from '../services/users.js';
|
||||
import { mergePermissions } from '../utils/merge-permissions.js';
|
||||
import { mergePermissions } from './merge-permissions.js';
|
||||
import { mergePermissionsForShare } from './merge-permissions-for-share.js';
|
||||
|
||||
export async function getPermissions(accountability: Accountability, schema: SchemaOverview) {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import type { DeepPartial, Relation } from '@directus/types';
|
||||
import { describe, expect, it } from 'vitest';
|
||||
import { getRelationInfo } from '../../src/utils/get-relation-info.js';
|
||||
import { getRelationInfo } from './get-relation-info.js';
|
||||
|
||||
describe('getRelationInfo', () => {
|
||||
it('Errors on suspiciously long implicit $FOLLOW', () => {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import type { Relation } from '@directus/types';
|
||||
import { expect, test } from 'vitest';
|
||||
import { getRelationType } from '../../src/utils/get-relation-type.js';
|
||||
import { getRelationType } from './get-relation-type.js';
|
||||
|
||||
test('Returns null if no relation object is included', () => {
|
||||
const result = getRelationType({ relation: null, collection: null, field: 'test' });
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { stringByteSize } from '../../src/utils/get-string-byte-size.js';
|
||||
import { stringByteSize } from './get-string-byte-size.js';
|
||||
import { test, expect } from 'vitest';
|
||||
|
||||
test('Returns correct byte size for given input string', () => {
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import isDirectusJWT from '../../src/utils/is-directus-jwt.js';
|
||||
import isDirectusJWT from './is-directus-jwt.js';
|
||||
import jwt from 'jsonwebtoken';
|
||||
import { test, expect } from 'vitest';
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import jwt from 'jsonwebtoken';
|
||||
import { expect, test, vi } from 'vitest';
|
||||
import type { DirectusTokenPayload } from '../../src/types/index.js';
|
||||
import { verifyAccessJWT, verifyJWT } from '../../src/utils/jwt.js';
|
||||
import type { DirectusTokenPayload } from '../types/index.js';
|
||||
import { verifyAccessJWT, verifyJWT } from './jwt.js';
|
||||
import { TokenExpiredError, InvalidTokenError } from '../errors/index.js';
|
||||
import { ServiceUnavailableError } from '../errors/index.js';
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import type { SchemaOverview } from '@directus/types';
|
||||
import { v4 as uuid } from 'uuid';
|
||||
import { describe, expect, it } from 'vitest';
|
||||
import { validateKeys } from '../../src/utils/validate-keys.js';
|
||||
import { validateKeys } from './validate-keys.js';
|
||||
|
||||
const schema: SchemaOverview = {
|
||||
collections: {
|
||||
|
||||
Reference in New Issue
Block a user