Patch Tuesday 🐸 (#18260)

* Update `@directus/api` deps (minor)

 @aws-sdk/client-ses          3.292.0  →   3.316.0
 @godaddy/terminus             4.11.2  →    4.12.0
 @rollup/plugin-alias           4.0.3  →     4.0.4
 @rollup/plugin-node-resolve   15.0.1  →    15.0.2
 @types/node                  18.15.3  →  18.15.11
 @vitest/coverage-c8           0.29.3  →    0.30.1
 axios                          1.3.4  →     1.3.6
 fs-extra                      11.1.0  →    11.1.1
 helmet                         6.0.1  →     6.1.5
 ioredis                        5.3.1  →     5.3.2
 joi                           17.8.4  →    17.9.1
 liquidjs                      10.6.1  →    10.7.0
 marked                        4.2.12  →     4.3.0
 nanoid                         3.3.4  →     3.3.6
 rollup                        3.19.1  →    3.20.6
 sharp                         0.31.3  →    0.32.0
 vitest                        0.29.3  →    0.30.1
 vm2                           3.9.16  →    3.9.17

* Update `@directus/api` deps (major)

 @rollup/plugin-alias     4.0.4  →     5.0.0
 @types/inquirer          8.2.6  →     9.0.3
 @types/node           18.15.11  →  18.15.12
 camelcase                6.3.0  →     7.0.1
 chalk                    4.1.2  →     5.2.0
 commander                9.5.0  →    10.0.1
 execa                    5.1.1  →     7.1.1
 icc                      2.0.0  →     3.0.0
 inquirer                 8.2.5  →     9.1.5
 ~ldapjs                   2.3.3  →     3.0.2~
 nanoid                   3.3.6  →     4.0.2
 ~openapi3-ts              3.2.0  →     4.1.1~
 ora                      5.4.1  →     6.3.0
 strip-bom-stream         4.0.0  →     5.0.0
 tedious                 15.1.3  →    16.0.0
 typescript               4.9.5  →     5.0.4

* Update `@directus/app` deps

 @babel/core                             7.21.3  →    7.21.4
 @babel/preset-env                       7.20.2  →    7.21.4
 @fortawesome/fontawesome-svg-core        6.3.0  →     6.4.0
 @fortawesome/free-brands-svg-icons       6.3.0  →     6.4.0
 @fullcalendar/core                       6.1.4  →     6.1.5
 @fullcalendar/daygrid                    6.1.4  →     6.1.5
 @fullcalendar/interaction                6.1.4  →     6.1.5
 @fullcalendar/list                       6.1.4  →     6.1.5
 @fullcalendar/timegrid                   6.1.4  →     6.1.5
 @pinia/testing                          0.0.15  →    0.0.16
 @popperjs/core                          2.11.6  →    2.11.7
 @storybook/addon-actions            7.0.0-rc.4  →     7.0.6
 @storybook/addon-backgrounds        7.0.0-rc.4  →     7.0.6
 @storybook/addon-docs               7.0.0-rc.4  →     7.0.6
 @storybook/addon-essentials         7.0.0-rc.4  →     7.0.6
 @storybook/addon-links              7.0.0-rc.4  →     7.0.6
 @storybook/addon-mdx-gfm            7.0.0-rc.4  →     7.0.6
 @storybook/addon-measure            7.0.0-rc.4  →     7.0.6
 @storybook/addon-outline            7.0.0-rc.4  →     7.0.6
 @storybook/client-api               7.0.0-rc.4  →     7.0.6
 @storybook/client-logger            7.0.0-rc.4  →     7.0.6
 @storybook/vue3                     7.0.0-rc.4  →     7.0.6
 @storybook/vue3-vite                7.0.0-rc.4  →     7.0.6
 @types/diff                              5.0.2  →     5.0.3
 @types/dompurify                         3.0.0  →     3.0.2
 @types/lodash                         4.14.191  →  4.14.194
 @vitejs/plugin-vue                       4.0.0  →     4.1.0
 @vue/test-utils                          2.3.1  →     2.3.2
 apexcharts                              3.37.1  →    3.39.0
 axios                                    1.3.4  →     1.3.6
 dompurify                                3.0.1  →     3.0.2
 happy-dom                                8.9.0  →     9.8.4
 marked                                  4.2.12  →     4.3.0
 nanoid                                   4.0.1  →     4.0.2
 pinia                                   2.0.33  →    2.0.34
 sass                                    1.59.3  →    1.62.0
 storybook                           7.0.0-rc.4  →     7.0.6
 typescript                               4.9.5  →     5.0.4
 vite                                     4.1.4  →     4.2.2
 vitest                                  0.29.3  →    0.30.1
 webpack                                 5.76.2  →    5.80.0

* Update root deps

* Update `@directus/composables` deps

* Update `@directus/constant` deps

* Update `create-directus-extension` deps

* Update `@directus/exceptions` deps

* tsconfig workaround: ignoreDeprecations

* Update `@directus/extensions-sdk` deps

* Update `@directus/schema` deps

* Update `@directus/storage` deps

* Update `@directus/storage-driver-azure` deps

* Update `@directus/storage-driver-cloudinary` deps

* Update `@directus/storage-driver-gcs` deps

* Update `@directus/storage-driver-local` deps

* Update `@directus/storage-driver-s3` deps

* Update `@directus/types` deps

* Update `@directus/update-check` deps

* Update `@directus/utils` deps

* tsconfig workaround in schema: ignoreDeprecations

* tsconfig workaround in remaining packages: ignoreDeprecations

* Update `tests-blackbox` deps

* Revert "tsconfig workaround: ignoreDeprecations"

This reverts commit 5d97da55e3.

* Revert tsconfig override

* Update tsconfig

* Fix imports in @directus/utils

* Fix imports in composables

* Fix imports in extensions-sdk

* Fix imports in @directus/api

* Move RateLimiterAbstract to types import as well

* Bump pnpm to 8.3.1

* Update `docs` deps

> [...] the @vueuse/head package will be deprecated. If you're setting up this package on a new project, you should use the @unhead/vue package directly [...]

* Remove obselete dep `concurrently` from extensions-sdk

Co-authored-by: Azri Kahar <42867097+azrikahar@users.noreply.github.com>

* New day, new updates

Also forgot to include minor updates of deps in `tests-blackbox` in previous
commit

* Fix `api` tests

---------

Co-authored-by: Rijk van Zanten <rijkvanzanten@me.com>
Co-authored-by: Azri Kahar <42867097+azrikahar@users.noreply.github.com>
This commit is contained in:
Pascal Jufer
2023-04-21 18:59:27 +02:00
committed by GitHub
parent c51a8bc4c3
commit 17afb9a3bc
101 changed files with 3671 additions and 4007 deletions

View File

@@ -1,5 +1,10 @@
import type { Mock } from 'vitest';
import { vi } from 'vitest';
export const getCache = vi.fn().mockReturnValue({ cache: undefined, systemCache: undefined, lockCache: undefined });
export const flushCaches = vi.fn();
export const clearSystemCache = vi.fn();
export const setSystemCache = vi.fn();
export const getCache: Mock = vi
.fn()
.mockReturnValue({ cache: undefined, systemCache: undefined, lockCache: undefined });
export const flushCaches: Mock = vi.fn();
export const clearSystemCache: Mock = vi.fn();
export const setSystemCache: Mock = vi.fn();

View File

@@ -1,5 +1,6 @@
import cookieParser from 'cookie-parser';
import express, { Request, RequestHandler, Response } from 'express';
import type { Request, RequestHandler, Response } from 'express';
import express from 'express';
import type { ServerResponse } from 'http';
import { merge } from 'lodash-es';
import { readFile } from 'node:fs/promises';

View File

@@ -4,7 +4,8 @@ import { parseJSON } from '@directus/utils';
import express, { Router } from 'express';
import flatten from 'flat';
import jwt from 'jsonwebtoken';
import { Client, errors, generators, Issuer } from 'openid-client';
import type { Client } from 'openid-client';
import { errors, generators, Issuer } from 'openid-client';
import { getAuthProvider } from '../../auth.js';
import getDatabase from '../../database/index.js';
import emitter from '../../emitter.js';

View File

@@ -4,7 +4,8 @@ import { parseJSON } from '@directus/utils';
import express, { Router } from 'express';
import flatten from 'flat';
import jwt from 'jsonwebtoken';
import { Client, errors, generators, Issuer } from 'openid-client';
import type { Client } from 'openid-client';
import { errors, generators, Issuer } from 'openid-client';
import { getAuthProvider } from '../../auth.js';
import getDatabase from '../../database/index.js';
import emitter from '../../emitter.js';

View File

@@ -1,6 +1,7 @@
import type { SchemaOverview } from '@directus/types';
import { getSimpleHash } from '@directus/utils';
import Keyv, { Options } from 'keyv';
import type { Options } from 'keyv';
import Keyv from 'keyv';
import env from './env.js';
import logger from './logger.js';
import { getMessenger } from './messenger.js';

View File

@@ -1,5 +1,5 @@
import chalk from 'chalk';
import execa from 'execa';
import { execa } from 'execa';
import inquirer from 'inquirer';
import Joi from 'joi';
import type { Knex } from 'knex';
@@ -8,7 +8,8 @@ import { v4 as uuid } from 'uuid';
import runMigrations from '../../../database/migrations/run.js';
import runSeed from '../../../database/seeds/run.js';
import { generateHash } from '../../../utils/generate-hash.js';
import createDBConnection, { Credentials } from '../../utils/create-db-connection.js';
import type { Credentials } from '../../utils/create-db-connection.js';
import createDBConnection from '../../utils/create-db-connection.js';
import createEnv from '../../utils/create-env/index.js';
import { defaultAdminRole, defaultAdminUser } from '../../utils/defaults.js';
import { drivers, getDriverForClient } from '../../utils/drivers.js';

View File

@@ -6,11 +6,12 @@ import { load as loadYaml } from 'js-yaml';
import path from 'path';
import getDatabase, { isInstalled, validateDatabaseConnection } from '../../../database/index.js';
import logger from '../../../logger.js';
import { DiffKind, Snapshot } from '../../../types/index.js';
import type { Snapshot } from '../../../types/index.js';
import { DiffKind } from '../../../types/index.js';
import { isNestedMetaUpdate } from '../../../utils/apply-diff.js';
import { applySnapshot } from '../../../utils/apply-snapshot.js';
import { getSnapshot } from '../../../utils/get-snapshot.js';
import { getSnapshotDiff } from '../../../utils/get-snapshot-diff.js';
import { getSnapshot } from '../../../utils/get-snapshot.js';
export async function apply(snapshotPath: string, options?: { yes: boolean; dryRun: boolean }): Promise<void> {
const filename = path.resolve(process.cwd(), snapshotPath);

View File

@@ -11,7 +11,8 @@ import logger from '../logger.js';
import useCollection from '../middleware/use-collection.js';
import { AssetsService } from '../services/assets.js';
import { PayloadService } from '../services/payload.js';
import { TransformationMethods, TransformationParams } from '../types/assets.js';
import type { TransformationParams } from '../types/assets.js';
import { TransformationMethods } from '../types/assets.js';
import asyncHandler from '../utils/async-handler.js';
import { getCacheControlHeader } from '../utils/get-cache-headers.js';
import { getConfigFromEnv } from '../utils/get-config-from-env.js';

View File

@@ -1,7 +1,8 @@
import formatTitle from '@directus/format-title';
import { toArray } from '@directus/utils';
import Busboy from 'busboy';
import express, { RequestHandler } from 'express';
import type { RequestHandler } from 'express';
import express from 'express';
import Joi from 'joi';
import path from 'path';
import env from '../env.js';

View File

@@ -1,6 +1,7 @@
import { parseJSON } from '@directus/utils';
import Busboy from 'busboy';
import express, { RequestHandler } from 'express';
import type { RequestHandler } from 'express';
import express from 'express';
import { load as loadYaml } from 'js-yaml';
import { InvalidPayloadException, UnsupportedMediaTypeException } from '../exceptions/index.js';
import logger from '../logger.js';

View File

@@ -1,5 +1,6 @@
import type { Knex } from 'knex';
import { FnHelper, FnHelperOptions } from '../types.js';
import type { FnHelperOptions } from '../types.js';
import { FnHelper } from '../types.js';
const parseLocaltime = (columnType?: string) => {
if (columnType === 'timestamp') {

View File

@@ -1,5 +1,6 @@
import type { Knex } from 'knex';
import { FnHelper, FnHelperOptions } from '../types.js';
import type { FnHelperOptions } from '../types.js';
import { FnHelper } from '../types.js';
export class FnHelperMySQL extends FnHelper {
year(table: string, column: string): Knex.Raw {

View File

@@ -1,5 +1,6 @@
import type { Knex } from 'knex';
import { FnHelper, FnHelperOptions } from '../types.js';
import type { FnHelperOptions } from '../types.js';
import { FnHelper } from '../types.js';
const parseLocaltime = (columnType?: string) => {
if (columnType === 'timestamp') {

View File

@@ -1,5 +1,6 @@
import type { Knex } from 'knex';
import { FnHelper, FnHelperOptions } from '../types.js';
import type { FnHelperOptions } from '../types.js';
import { FnHelper } from '../types.js';
const parseLocaltime = (columnType?: string) => {
if (columnType === 'timestamp') {

View File

@@ -1,5 +1,6 @@
import type { Knex } from 'knex';
import { FnHelper, FnHelperOptions } from '../types.js';
import type { FnHelperOptions } from '../types.js';
import { FnHelper } from '../types.js';
const parseLocaltime = (columnType?: string) => {
if (columnType === 'timestamp') {

View File

@@ -1,6 +1,7 @@
import type { Field, RawField } from '@directus/types';
import type { Knex } from 'knex';
import { GeoJSONGeometry, stringify as geojsonToWKT } from 'wellknown';
import type { GeoJSONGeometry } from 'wellknown';
import { stringify as geojsonToWKT } from 'wellknown';
import { DatabaseHelper } from '../types.js';
export abstract class GeometryHelper extends DatabaseHelper {

View File

@@ -1,5 +1,6 @@
import type { KNEX_TYPES } from '@directus/constants';
import { Options, SchemaHelper } from '../types.js';
import type { Options } from '../types.js';
import { SchemaHelper } from '../types.js';
export class SchemaHelperCockroachDb extends SchemaHelper {
override async changeToType(

View File

@@ -1,6 +1,7 @@
import type { KNEX_TYPES } from '@directus/constants';
import type { Field, Relation, Type } from '@directus/types';
import { Options, SchemaHelper } from '../types.js';
import type { Options } from '../types.js';
import { SchemaHelper } from '../types.js';
export class SchemaHelperOracle extends SchemaHelper {
override async changeToType(

View File

@@ -1,8 +1,9 @@
import knex from 'knex';
import type { Knex } from 'knex';
import knex from 'knex';
import { createTracker, MockClient, Tracker } from 'knex-mock-client';
import type { MockedFunction } from 'vitest';
import { afterEach, beforeAll, describe, expect, it, vi } from 'vitest';
import run from './run.js';
import { describe, beforeAll, afterEach, it, expect, MockedFunction, vi } from 'vitest';
describe('run', () => {
let db: MockedFunction<Knex>;

View File

@@ -7,7 +7,8 @@ import env from '../env.js';
import { PayloadService } from '../services/payload.js';
import type { AST, FieldNode, FunctionFieldNode, M2ONode, NestedCollectionNode } from '../types/ast.js';
import { applyFunctionToColumnName } from '../utils/apply-function-to-column-name.js';
import applyQuery, { applyLimit, applySort, ColumnSortRecord, generateAlias } from '../utils/apply-query.js';
import type { ColumnSortRecord } from '../utils/apply-query.js';
import applyQuery, { applyLimit, applySort, generateAlias } from '../utils/apply-query.js';
import { getCollectionFromAlias } from '../utils/get-collection-from-alias.js';
import type { AliasMap } from '../utils/get-column-path.js';
import { getColumn } from '../utils/get-column.js';

View File

@@ -1,8 +1,11 @@
import { Writable } from 'node:stream';
import { pino } from 'pino';
import { afterEach, beforeEach, describe, expect, test, vi } from 'vitest';
import { REDACT_TEXT } from './constants.js';
const REFRESH_TOKEN_COOKIE_NAME = 'directus_refresh_token';
vi.mock('./env', async () => {
vi.doMock('./env', async () => {
const MOCK_ENV = {
AUTH_PROVIDERS: 'ranger,monospace',
AUTH_RANGER_DRIVER: 'oauth2',
@@ -18,10 +21,7 @@ vi.mock('./env', async () => {
};
});
import { Writable } from 'node:stream';
import { pino } from 'pino';
import { REDACT_TEXT } from './constants.js';
import { httpLoggerOptions } from './logger.js';
const { httpLoggerOptions } = await import('./logger.js');
const logOutput = vi.fn();

View File

@@ -1,4 +1,5 @@
import nodemailer, { Transporter } from 'nodemailer';
import type { Transporter } from 'nodemailer';
import nodemailer from 'nodemailer';
import env from './env.js';
import logger from './logger.js';
import { getConfigFromEnv } from './utils/get-config-from-env.js';

View File

@@ -1,6 +1,7 @@
import { parseJSON } from '@directus/utils';
import type { RequestHandler } from 'express';
import { DocumentNode, getOperationAST, parse, Source } from 'graphql';
import type { DocumentNode } from 'graphql';
import { getOperationAST, parse, Source } from 'graphql';
import { InvalidPayloadException, InvalidQueryException, MethodNotAllowedException } from '../exceptions/index.js';
import type { GraphQLParams } from '../types/index.js';
import asyncHandler from '../utils/async-handler.js';

View File

@@ -1,6 +1,7 @@
import { defineOperationApi, toArray } from '@directus/utils';
import { NodeVM, NodeVMOptions, VMScript } from 'vm2';
import { isBuiltin } from 'node:module';
import type { NodeVMOptions } from 'vm2';
import { NodeVM, VMScript } from 'vm2';
type Options = {
code: string;

View File

@@ -2,13 +2,13 @@ import { afterEach, expect, test, vi } from 'vitest';
const loggerInfo = vi.fn();
vi.mock('../../logger', () => ({
vi.doMock('../../logger', () => ({
default: {
info: loggerInfo,
},
}));
import config from './index.js';
const { default: config } = await import('./index.js');
afterEach(() => {
vi.clearAllMocks();

View File

@@ -2,13 +2,13 @@ import { afterEach, expect, test, vi } from 'vitest';
const runOperationFlow = vi.fn();
vi.mock('../../flows.js', () => ({
vi.doMock('../../flows.js', () => ({
getFlowManager: vi.fn().mockReturnValue({
runOperationFlow,
}),
}));
import config from './index.js';
const { default: config } = await import('./index.js');
const testFlowId = '00000000-0000-0000-0000-000000000000';

View File

@@ -1,12 +1,6 @@
import { merge } from 'lodash-es';
import {
IRateLimiterOptions,
IRateLimiterStoreOptions,
RateLimiterAbstract,
RateLimiterMemcache,
RateLimiterMemory,
RateLimiterRedis,
} from 'rate-limiter-flexible';
import type { IRateLimiterOptions, IRateLimiterStoreOptions, RateLimiterAbstract } from 'rate-limiter-flexible';
import { RateLimiterMemcache, RateLimiterMemory, RateLimiterRedis } from 'rate-limiter-flexible';
import env from './env.js';
import { getConfigFromEnv } from './utils/get-config-from-env.js';

View File

@@ -1,18 +1,19 @@
import { createTerminus, TerminusOptions } from '@godaddy/terminus';
import { isUpToDate } from '@directus/update-check';
import type { TerminusOptions } from '@godaddy/terminus';
import { createTerminus } from '@godaddy/terminus';
import type { Request } from 'express';
import * as http from 'http';
import * as https from 'https';
import { once } from 'lodash-es';
import qs from 'qs';
import { isUpToDate } from '@directus/update-check';
import url from 'url';
import * as pkg from './utils/package.js';
import createApp from './app.js';
import getDatabase from './database/index.js';
import emitter from './emitter.js';
import env from './env.js';
import logger from './logger.js';
import { getConfigFromEnv } from './utils/get-config-from-env.js';
import * as pkg from './utils/package.js';
export let SERVER_ONLINE = true;

View File

@@ -1,14 +1,15 @@
import type { SchemaInspector, Table } from '@directus/schema';
import { createInspector } from '@directus/schema';
import type { Accountability, FieldMeta, RawField, SchemaOverview } from '@directus/types';
import { addFieldFlag } from '@directus/utils';
import type Keyv from 'keyv';
import type { Knex } from 'knex';
import type { Table, SchemaInspector } from '@directus/schema';
import { omit, chunk } from 'lodash-es';
import { chunk, omit } from 'lodash-es';
import { clearSystemCache, getCache } from '../cache.js';
import { ALIAS_TYPES } from '../constants.js';
import type { Helpers } from '../database/helpers/index.js';
import { getHelpers } from '../database/helpers/index.js';
import getDatabase, { getSchemaInspector } from '../database/index.js';
import { getHelpers, Helpers } from '../database/helpers/index.js';
import { systemCollectionRows } from '../database/system-data/collections/index.js';
import emitter from '../emitter.js';
import env from '../env.js';

View File

@@ -1,6 +1,6 @@
import { KNEX_TYPES, REGEX_BETWEEN_PARENS } from '@directus/constants';
import type { Column, SchemaInspector } from '@directus/schema';
import { createInspector } from '@directus/schema';
import { KNEX_TYPES, REGEX_BETWEEN_PARENS } from '@directus/constants';
import type { Accountability, Field, FieldMeta, RawField, SchemaOverview, Type } from '@directus/types';
import { addFieldFlag, toArray } from '@directus/utils';
import type Keyv from 'keyv';
@@ -8,7 +8,8 @@ import type { Knex } from 'knex';
import { isEqual, isNil } from 'lodash-es';
import { clearSystemCache, getCache } from '../cache.js';
import { ALIAS_TYPES } from '../constants.js';
import { getHelpers, Helpers } from '../database/helpers/index.js';
import type { Helpers } from '../database/helpers/index.js';
import { getHelpers } from '../database/helpers/index.js';
import getDatabase, { getSchemaInspector } from '../database/index.js';
import { systemFieldRows } from '../database/system-data/fields/index.js';
import emitter from '../emitter.js';

View File

@@ -1,7 +1,8 @@
import type { Knex } from 'knex';
import knex from 'knex';
import { createTracker, MockClient, Tracker } from 'knex-mock-client';
import { afterEach, beforeAll, beforeEach, describe, expect, it, MockedFunction, SpyInstance, vi } from 'vitest';
import type { MockedFunction, SpyInstance } from 'vitest';
import { afterEach, beforeAll, beforeEach, describe, expect, it, vi } from 'vitest';
import { InvalidPayloadException } from '../exceptions/index.js';
import { FilesService, ItemsService } from './index.js';

View File

@@ -2,6 +2,7 @@ import formatTitle from '@directus/format-title';
import { toArray } from '@directus/utils';
import encodeURL from 'encodeurl';
import exif from 'exif-reader';
import type { IccProfile } from 'icc';
import { parse as parseIcc } from 'icc';
import { clone, pick } from 'lodash-es';
import { extension } from 'mime-types';
@@ -166,7 +167,7 @@ export class FilesService extends ItemsService {
exif?: Record<string, unknown>;
gps?: Record<string, unknown>;
interop?: Record<string, unknown>;
icc?: Record<string, unknown>;
icc?: IccProfile;
iptc?: Record<string, unknown>;
xmp?: Record<string, unknown>;
} = {};

View File

@@ -1,16 +1,21 @@
import { FUNCTIONS } from '@directus/constants';
import { Action, FUNCTIONS } from '@directus/constants';
import type { BaseException } from '@directus/exceptions';
import type { Accountability, Aggregate, Filter, PrimaryKey, Query, SchemaOverview } from '@directus/types';
import { Action } from '@directus/constants';
import { parseFilterFunctionPath } from '@directus/utils';
import argon2 from 'argon2';
import {
import type {
ArgumentNode,
execute,
ExecutionResult,
FieldNode,
FormattedExecutionResult,
FragmentDefinitionNode,
GraphQLNullableType,
GraphQLResolveInfo,
InlineFragmentNode,
SelectionNode,
ValueNode,
} from 'graphql';
import {
GraphQLBoolean,
GraphQLEnumType,
GraphQLError,
@@ -19,32 +24,24 @@ import {
GraphQLInt,
GraphQLList,
GraphQLNonNull,
GraphQLNullableType,
GraphQLObjectType,
GraphQLResolveInfo,
GraphQLScalarType,
GraphQLSchema,
GraphQLString,
GraphQLUnionType,
InlineFragmentNode,
NoSchemaIntrospectionCustomRule,
SelectionNode,
execute,
specifiedRules,
validate,
ValueNode,
} from 'graphql';
import {
GraphQLJSON,
InputTypeComposer,
import type {
InputTypeComposerFieldConfigMapDefinition,
ObjectTypeComposer,
ObjectTypeComposerFieldConfigAsObjectDefinition,
ObjectTypeComposerFieldConfigDefinition,
ObjectTypeComposerFieldConfigMapDefinition,
ResolverDefinition,
SchemaComposer,
toInputObjectType,
} from 'graphql-compose';
import { GraphQLJSON, InputTypeComposer, ObjectTypeComposer, SchemaComposer, toInputObjectType } from 'graphql-compose';
import type { Knex } from 'knex';
import { flatten, get, mapKeys, merge, omit, pick, set, transform, uniq } from 'lodash-es';
import { clearSystemCache, getCache } from '../../cache.js';

View File

@@ -1,14 +1,15 @@
import type { CollectionsOverview, NestedDeepQuery } from '@directus/types';
import knex from 'knex';
import type { Knex } from 'knex';
import { createTracker, MockClient, Tracker } from 'knex-mock-client';
import knex from 'knex';
import { MockClient, Tracker, createTracker } from 'knex-mock-client';
import { cloneDeep } from 'lodash-es';
import { afterEach, beforeAll, beforeEach, describe, expect, it, MockedFunction, vi } from 'vitest';
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 { InvalidPayloadException } from '../exceptions/index.js';
import { sqlFieldFormatter, sqlFieldList } from '../__utils__/items-utils.js';
import { systemSchema, userSchema } from '../__utils__/schemas.js';
import { InvalidPayloadException } from '../exceptions/index.js';
vi.mock('../env', async () => {
const actual = (await vi.importActual('../env')) as { default: Record<string, any> };

View File

@@ -1,9 +1,11 @@
import knex from 'knex';
import type { Knex } from 'knex';
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 { getHelpers, Helpers } from '../../src/database/helpers/index.js';
import { describe, beforeAll, afterEach, it, expect, vi, beforeEach, MockedFunction } from 'vitest';
vi.mock('../../src/database/index', () => ({
getDatabaseClient: vi.fn().mockReturnValue('postgres'),

View File

@@ -1,14 +1,15 @@
import type { Accountability, Query, SchemaOverview } from '@directus/types';
import { format, parseISO, isValid } from 'date-fns';
import { parseJSON, toArray } from '@directus/utils';
import { format, isValid, parseISO } from 'date-fns';
import flat from 'flat';
import Joi from 'joi';
import type { Knex } from 'knex';
import { clone, cloneDeep, isNil, isObject, isPlainObject, omit, pick } from 'lodash-es';
import { v4 as uuid } from 'uuid';
import { parse as wktToGeoJSON } from 'wellknown';
import type { Helpers } from '../database/helpers/index.js';
import { getHelpers } from '../database/helpers/index.js';
import getDatabase from '../database/index.js';
import { getHelpers, Helpers } from '../database/helpers/index.js';
import { ForbiddenException, InvalidPayloadException } from '../exceptions/index.js';
import type {
AbstractServiceOptions,

View File

@@ -2,7 +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 { ItemsService, QueryOptions } from '../services/items.js';
import type { QueryOptions } from '../services/items.js';
import { ItemsService } from '../services/items.js';
import type { AbstractServiceOptions, Item, MutationOptions, PrimaryKey } from '../types/index.js';
import { filterItems } from '../utils/filter-items.js';

View File

@@ -1,19 +1,21 @@
import type { ForeignKey, SchemaInspector } from '@directus/schema';
import { createInspector } from '@directus/schema';
import type { Accountability, Query, Relation, RelationMeta, SchemaOverview } from '@directus/types';
import { toArray } from '@directus/utils';
import type Keyv from 'keyv';
import type { Knex } from 'knex';
import type { ForeignKey, SchemaInspector } from '@directus/schema';
import { clearSystemCache, getCache } from '../cache.js';
import type { Helpers } from '../database/helpers/index.js';
import { getHelpers } from '../database/helpers/index.js';
import getDatabase, { getSchemaInspector } from '../database/index.js';
import { getHelpers, Helpers } from '../database/helpers/index.js';
import { systemRelationRows } from '../database/system-data/relations/index.js';
import emitter from '../emitter.js';
import { ForbiddenException, InvalidPayloadException } from '../exceptions/index.js';
import type { AbstractServiceOptions, ActionEventParams, MutationOptions } from '../types/index.js';
import { getDefaultIndexName } from '../utils/get-default-index-name.js';
import { getSchema } from '../utils/get-schema.js';
import { ItemsService, QueryOptions } from './items.js';
import type { QueryOptions } from './items.js';
import { ItemsService } from './items.js';
import { PermissionsService } from './permissions.js';
export class RelationsService {

View File

@@ -1,10 +1,11 @@
import type { SchemaOverview } from '@directus/types';
import knex from 'knex';
import type { Knex } from 'knex';
import knex from 'knex';
import { createTracker, MockClient, Tracker } from 'knex-mock-client';
import { afterEach, beforeAll, beforeEach, describe, expect, it, MockedFunction, SpyInstance, vi } from 'vitest';
import { ItemsService, PermissionsService, PresetsService, RolesService, UsersService } from './index.js';
import type { MockedFunction, SpyInstance } from 'vitest';
import { afterEach, beforeAll, beforeEach, describe, expect, it, vi } from 'vitest';
import { ForbiddenException, UnprocessableEntityException } from '../exceptions/index.js';
import { ItemsService, PermissionsService, PresetsService, RolesService, UsersService } from './index.js';
vi.mock('../../src/database/index', () => {
return { __esModule: true, default: vi.fn(), getDatabaseClient: vi.fn().mockReturnValue('postgres') };

View File

@@ -201,7 +201,8 @@ export class ServerService {
checks[`${client}:responseTime`]![0]!.observedValue = +(endTime - startTime).toFixed(3);
if (
checks[`${client}:responseTime`]![0]!.observedValue! > checks[`${client}:responseTime`]![0]!.threshold! &&
Number(checks[`${client}:responseTime`]![0]!.observedValue!) >
checks[`${client}:responseTime`]![0]!.threshold! &&
checks[`${client}:responseTime`]![0]!.status !== 'error'
) {
checks[`${client}:responseTime`]![0]!.status = 'warn';
@@ -388,7 +389,7 @@ export class ServerService {
checks[`storage:${location}:responseTime`]![0]!.observedValue = +(endTime - startTime).toFixed(3);
if (
checks[`storage:${location}:responseTime`]![0]!.observedValue! >
Number(checks[`storage:${location}:responseTime`]![0]!.observedValue!) >
checks[`storage:${location}:responseTime`]![0]!.threshold! &&
checks[`storage:${location}:responseTime`]![0]!.status !== 'error'
) {

View File

@@ -1,7 +1,8 @@
import knex from 'knex';
import type { Knex } from 'knex';
import knex from 'knex';
import { createTracker, MockClient, Tracker } from 'knex-mock-client';
import { afterEach, beforeAll, beforeEach, describe, expect, it, MockedFunction, vi } from 'vitest';
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 type { Collection } from '../types/index.js';

View File

@@ -1,11 +1,12 @@
import type { SchemaOverview } from '@directus/types';
import knex from 'knex';
import type { Knex } from 'knex';
import knex from 'knex';
import { createTracker, MockClient, Tracker } from 'knex-mock-client';
import { afterEach, beforeAll, beforeEach, describe, expect, it, MockedFunction, SpyInstance, vi } from 'vitest';
import { ItemsService, MailService, UsersService } from './index.js';
import { ForbiddenException, InvalidPayloadException } from '../exceptions/index.js';
import type { MockedFunction, SpyInstance } from 'vitest';
import { afterEach, beforeAll, beforeEach, describe, expect, it, vi } from 'vitest';
import { RecordNotUniqueException } from '../exceptions/database/record-not-unique.js';
import { ForbiddenException, InvalidPayloadException } from '../exceptions/index.js';
import { ItemsService, MailService, UsersService } from './index.js';
vi.mock('../../src/database/index', () => ({
default: vi.fn(),

View File

@@ -1,9 +1,10 @@
import knex from 'knex';
import type { Knex } from 'knex';
import knex from 'knex';
import { createTracker, MockClient, Tracker } from 'knex-mock-client';
import { afterEach, beforeAll, beforeEach, describe, expect, it, SpyInstance, vi } from 'vitest';
import { WebhooksService } from './index.js';
import type { SpyInstance } from 'vitest';
import { afterEach, beforeAll, beforeEach, describe, expect, it, vi } from 'vitest';
import { getMessenger } from '../messenger.js';
import { WebhooksService } from './index.js';
vi.mock('../../src/database/index', () => {
return { __esModule: true, default: vi.fn(), getDatabaseClient: vi.fn().mockReturnValue('postgres') };

View File

@@ -1,4 +1,5 @@
import { getMessenger, Messenger } from '../messenger.js';
import type { Messenger } from '../messenger.js';
import { getMessenger } from '../messenger.js';
import type { AbstractServiceOptions, Item, MutationOptions, PrimaryKey, Webhook } from '../types/index.js';
import { ItemsService } from './items.js';

View File

@@ -1,4 +0,0 @@
declare module 'icc' {
const parse: (buf: Buffer) => Record<string, string>;
export { parse };
}

View File

@@ -4,23 +4,23 @@ import deepDiff from 'deep-diff';
import type { Knex } from 'knex';
import { cloneDeep, merge, set } from 'lodash-es';
import { clearSystemCache } from '../cache.js';
import { getHelpers } from '../database/helpers/index.js';
import getDatabase from '../database/index.js';
import emitter from '../emitter.js';
import logger from '../logger.js';
import { CollectionsService } from '../services/collections.js';
import { FieldsService } from '../services/fields.js';
import { RelationsService } from '../services/relations.js';
import {
import type {
ActionEventParams,
Collection,
DiffKind,
MutationOptions,
Snapshot,
SnapshotDiff,
SnapshotField,
} from '../types/index.js';
import { DiffKind } from '../types/index.js';
import { getSchema } from './get-schema.js';
import { getHelpers } from '../database/helpers/index.js';
type CollectionDelta = {
collection: string;

View File

@@ -15,8 +15,9 @@ import { clone, isPlainObject } from 'lodash-es';
import validate from 'uuid-validate';
import { getHelpers } from '../database/helpers/index.js';
import { InvalidQueryException } from '../exceptions/invalid-query.js';
import type { AliasMap } from './get-column-path.js';
import { getColumnPath } from './get-column-path.js';
import { getColumn } from './get-column.js';
import { AliasMap, getColumnPath } from './get-column-path.js';
import { getRelationInfo } from './get-relation-info.js';
import { stripFunction } from './strip-function.js';

View File

@@ -1,9 +1,8 @@
import knex from 'knex';
import type { Knex } from 'knex';
import knex from 'knex';
import { createTracker, MockClient, Tracker } from 'knex-mock-client';
import { afterEach, beforeEach, describe, expect, it, MockedFunction, vi } from 'vitest';
import { CollectionsService, FieldsService } from '../services/index.js';
import type { Snapshot, SnapshotField } from '../types/index.js';
import type { MockedFunction } from 'vitest';
import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest';
import { snapshotApplyTestSchema } from '../__utils__/schemas.js';
import {
snapshotBeforeCreateCollection,
@@ -11,6 +10,8 @@ import {
snapshotCreateCollection,
snapshotCreateCollectionNotNested,
} from '../__utils__/snapshots.js';
import { CollectionsService, FieldsService } from '../services/index.js';
import type { Snapshot, SnapshotField } from '../types/index.js';
import { applySnapshot } from './apply-snapshot.js';
import * as getSchema from './get-schema.js';

View File

@@ -1,5 +1,6 @@
import type { Request } from 'express';
import { afterEach, beforeAll, describe, expect, SpyInstance, test, vi } from 'vitest';
import type { SpyInstance } from 'vitest';
import { afterEach, beforeAll, describe, expect, test, vi } from 'vitest';
import { getCacheKey } from './get-cache-key.js';
import * as getGraphqlQueryUtil from './get-graphql-query-and-variables.js';

View File

@@ -1,7 +1,8 @@
import type { DeepPartial } from '@directus/types';
import { expect, test } from 'vitest';
import { InvalidQueryException } from '../../src/exceptions/index.js';
import { ColPathProps, getColumnPath } from '../../src/utils/get-column-path.js';
import type { ColPathProps } from '../../src/utils/get-column-path.js';
import { getColumnPath } from '../../src/utils/get-column-path.js';
/*
{

View File

@@ -1,13 +1,6 @@
import type { Type } from '@directus/types';
import {
GraphQLBoolean,
GraphQLFloat,
GraphQLInt,
GraphQLList,
GraphQLScalarType,
GraphQLString,
GraphQLType,
} from 'graphql';
import type { GraphQLType } from 'graphql';
import { GraphQLBoolean, GraphQLFloat, GraphQLInt, GraphQLList, GraphQLScalarType, GraphQLString } from 'graphql';
import { GraphQLJSON } from 'graphql-compose';
import { GraphQLBigInt } from '../services/graphql/types/bigint.js';
import { GraphQLDate } from '../services/graphql/types/date.js';

View File

@@ -1,6 +1,7 @@
import deepDiff from 'deep-diff';
import { orderBy } from 'lodash-es';
import { Snapshot, SnapshotDiff, DiffKind } from '../types/index.js';
import type { Snapshot, SnapshotDiff } from '../types/index.js';
import { DiffKind } from '../types/index.js';
import { sanitizeCollection, sanitizeField, sanitizeRelation } from './sanitize-schema.js';
export function getSnapshotDiff(current: Snapshot, after: Snapshot): SnapshotDiff {

View File

@@ -1,4 +1,5 @@
import { afterAll, beforeAll, expect, SpyInstance, test, vi } from 'vitest';
import type { SpyInstance } from 'vitest';
import { afterAll, beforeAll, expect, test, vi } from 'vitest';
import { stall } from './stall.js';
let performanceNowSpy: SpyInstance;

View File

@@ -1,6 +1,7 @@
import Joi from 'joi';
import { InvalidPayloadException } from '../exceptions/invalid-payload.js';
import { DiffKind, SnapshotDiffWithHash, SnapshotWithHash } from '../types/snapshot.js';
import type { SnapshotDiffWithHash, SnapshotWithHash } from '../types/snapshot.js';
import { DiffKind } from '../types/snapshot.js';
const deepDiffSchema = Joi.object({
kind: Joi.string()

View File

@@ -1,10 +1,11 @@
import { version as currentDirectusVersion } from './package.js';
import { InvalidPayloadException } from '../exceptions/invalid-payload.js';
import { getDatabaseClient } from '../database/index.js';
import Joi from 'joi';
import { TYPES } from '@directus/constants';
import Joi from 'joi';
import { ALIAS_TYPES } from '../constants.js';
import { DatabaseClients, Snapshot } from '../types/index.js';
import { getDatabaseClient } from '../database/index.js';
import { InvalidPayloadException } from '../exceptions/invalid-payload.js';
import type { Snapshot } from '../types/index.js';
import { DatabaseClients } from '../types/index.js';
import { version as currentDirectusVersion } from './package.js';
const snapshotJoiSchema = Joi.object({
version: Joi.number().valid(1).required(),