@directus/api 9.25.2 → 10.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/auth/drivers/oauth2.d.ts +1 -1
- package/dist/auth/drivers/openid.d.ts +1 -1
- package/dist/cli/commands/init/index.js +1 -1
- package/dist/cli/commands/schema/apply.js +1 -1
- package/dist/controllers/files.d.ts +1 -1
- package/dist/database/helpers/fn/dialects/mssql.d.ts +2 -1
- package/dist/database/helpers/fn/dialects/mysql.d.ts +2 -1
- package/dist/database/helpers/fn/dialects/oracle.d.ts +2 -1
- package/dist/database/helpers/fn/dialects/postgres.d.ts +2 -1
- package/dist/database/helpers/fn/dialects/sqlite.d.ts +2 -1
- package/dist/database/helpers/geometry/types.d.ts +1 -1
- package/dist/database/helpers/schema/dialects/cockroachdb.d.ts +2 -1
- package/dist/database/helpers/schema/dialects/oracle.d.ts +2 -1
- package/dist/extensions.js +6 -5
- package/dist/mailer.d.ts +1 -1
- package/dist/operations/exec/index.js +1 -1
- package/dist/operations/mail/index.d.ts +5 -3
- package/dist/operations/mail/index.js +12 -8
- package/dist/operations/mail/index.test.d.ts +1 -0
- package/dist/rate-limiter.d.ts +1 -1
- package/dist/rate-limiter.js +1 -1
- package/dist/server.js +2 -2
- package/dist/services/collections.d.ts +2 -2
- package/dist/services/collections.js +2 -2
- package/dist/services/fields.d.ts +1 -1
- package/dist/services/fields.js +1 -1
- package/dist/services/graphql/index.d.ts +2 -1
- package/dist/services/graphql/index.js +3 -4
- package/dist/services/graphql/utils/add-path-to-validation-error.js +1 -1
- package/dist/services/payload.d.ts +1 -1
- package/dist/services/payload.js +2 -2
- package/dist/services/permissions.d.ts +2 -1
- package/dist/services/relations.d.ts +4 -3
- package/dist/services/relations.js +1 -1
- package/dist/services/server.js +3 -2
- package/dist/services/webhooks.d.ts +1 -1
- package/dist/utils/apply-diff.d.ts +1 -1
- package/dist/utils/apply-diff.js +2 -2
- package/dist/utils/apply-query.d.ts +1 -1
- package/dist/utils/apply-query.js +1 -1
- package/dist/utils/get-graphql-type.d.ts +2 -1
- package/dist/utils/get-graphql-type.js +1 -1
- package/dist/utils/get-snapshot-diff.d.ts +1 -1
- package/dist/utils/validate-diff.d.ts +1 -1
- package/dist/utils/validate-snapshot.d.ts +1 -1
- package/dist/utils/validate-snapshot.js +4 -4
- package/license +107 -0
- package/package.json +49 -50
- package/LICENSE +0 -674
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Router } from 'express';
|
|
2
|
-
import { Client } from 'openid-client';
|
|
2
|
+
import type { Client } from 'openid-client';
|
|
3
3
|
import { UsersService } from '../../services/users.js';
|
|
4
4
|
import type { AuthDriverOptions, User } from '../../types/index.js';
|
|
5
5
|
import { LocalAuthDriver } from './local.js';
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Router } from 'express';
|
|
2
|
-
import { Client } from 'openid-client';
|
|
2
|
+
import type { Client } from 'openid-client';
|
|
3
3
|
import { UsersService } from '../../services/users.js';
|
|
4
4
|
import type { AuthDriverOptions, User } from '../../types/index.js';
|
|
5
5
|
import { LocalAuthDriver } from './local.js';
|
|
@@ -9,8 +9,8 @@ import logger from '../../../logger.js';
|
|
|
9
9
|
import { DiffKind } from '../../../types/index.js';
|
|
10
10
|
import { isNestedMetaUpdate } from '../../../utils/apply-diff.js';
|
|
11
11
|
import { applySnapshot } from '../../../utils/apply-snapshot.js';
|
|
12
|
-
import { getSnapshot } from '../../../utils/get-snapshot.js';
|
|
13
12
|
import { getSnapshotDiff } from '../../../utils/get-snapshot-diff.js';
|
|
13
|
+
import { getSnapshot } from '../../../utils/get-snapshot.js';
|
|
14
14
|
export async function apply(snapshotPath, options) {
|
|
15
15
|
const filename = path.resolve(process.cwd(), snapshotPath);
|
|
16
16
|
const database = getDatabase();
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { Knex } from 'knex';
|
|
2
|
-
import {
|
|
2
|
+
import type { FnHelperOptions } from '../types.js';
|
|
3
|
+
import { FnHelper } from '../types.js';
|
|
3
4
|
export declare class FnHelperMSSQL extends FnHelper {
|
|
4
5
|
year(table: string, column: string, options: FnHelperOptions): Knex.Raw;
|
|
5
6
|
month(table: string, column: string, options: FnHelperOptions): Knex.Raw;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { Knex } from 'knex';
|
|
2
|
-
import {
|
|
2
|
+
import type { FnHelperOptions } from '../types.js';
|
|
3
|
+
import { FnHelper } from '../types.js';
|
|
3
4
|
export declare class FnHelperMySQL extends FnHelper {
|
|
4
5
|
year(table: string, column: string): Knex.Raw;
|
|
5
6
|
month(table: string, column: string): Knex.Raw;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { Knex } from 'knex';
|
|
2
|
-
import {
|
|
2
|
+
import type { FnHelperOptions } from '../types.js';
|
|
3
|
+
import { FnHelper } from '../types.js';
|
|
3
4
|
export declare class FnHelperOracle extends FnHelper {
|
|
4
5
|
year(table: string, column: string, options: FnHelperOptions): Knex.Raw;
|
|
5
6
|
month(table: string, column: string, options: FnHelperOptions): Knex.Raw;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { Knex } from 'knex';
|
|
2
|
-
import {
|
|
2
|
+
import type { FnHelperOptions } from '../types.js';
|
|
3
|
+
import { FnHelper } from '../types.js';
|
|
3
4
|
export declare class FnHelperPostgres extends FnHelper {
|
|
4
5
|
year(table: string, column: string, options: FnHelperOptions): Knex.Raw;
|
|
5
6
|
month(table: string, column: string, options: FnHelperOptions): Knex.Raw;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { Knex } from 'knex';
|
|
2
|
-
import {
|
|
2
|
+
import type { FnHelperOptions } from '../types.js';
|
|
3
|
+
import { FnHelper } from '../types.js';
|
|
3
4
|
export declare class FnHelperSQLite extends FnHelper {
|
|
4
5
|
year(table: string, column: string, options?: FnHelperOptions): Knex.Raw;
|
|
5
6
|
month(table: string, column: string, options?: FnHelperOptions): Knex.Raw;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { Field, RawField } from '@directus/types';
|
|
2
2
|
import type { Knex } from 'knex';
|
|
3
|
-
import { GeoJSONGeometry } from 'wellknown';
|
|
3
|
+
import type { GeoJSONGeometry } from 'wellknown';
|
|
4
4
|
import { DatabaseHelper } from '../types.js';
|
|
5
5
|
export declare abstract class GeometryHelper extends DatabaseHelper {
|
|
6
6
|
supported(): boolean | Promise<boolean>;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { KNEX_TYPES } from '@directus/constants';
|
|
2
|
-
import { Options
|
|
2
|
+
import type { Options } from '../types.js';
|
|
3
|
+
import { SchemaHelper } from '../types.js';
|
|
3
4
|
export declare class SchemaHelperCockroachDb extends SchemaHelper {
|
|
4
5
|
changeToType(table: string, column: string, type: (typeof KNEX_TYPES)[number], options?: Options): Promise<void>;
|
|
5
6
|
constraintName(existingName: string): string;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import type { KNEX_TYPES } from '@directus/constants';
|
|
2
2
|
import type { Field, Relation, Type } from '@directus/types';
|
|
3
|
-
import { Options
|
|
3
|
+
import type { Options } from '../types.js';
|
|
4
|
+
import { SchemaHelper } from '../types.js';
|
|
4
5
|
export declare class SchemaHelperOracle extends SchemaHelper {
|
|
5
6
|
changeToType(table: string, column: string, type: (typeof KNEX_TYPES)[number], options?: Options): Promise<void>;
|
|
6
7
|
castA2oPrimaryKey(): string;
|
package/dist/extensions.js
CHANGED
|
@@ -5,7 +5,7 @@ import { ensureExtensionDirs, generateExtensionsEntrypoint, getLocalExtensions,
|
|
|
5
5
|
import aliasDefault from '@rollup/plugin-alias';
|
|
6
6
|
import nodeResolveDefault from '@rollup/plugin-node-resolve';
|
|
7
7
|
import virtualDefault from '@rollup/plugin-virtual';
|
|
8
|
-
import chokidar from 'chokidar';
|
|
8
|
+
import chokidar, { FSWatcher } from 'chokidar';
|
|
9
9
|
import express, { Router } from 'express';
|
|
10
10
|
import { clone, escapeRegExp } from 'lodash-es';
|
|
11
11
|
import { schedule, validate } from 'node-cron';
|
|
@@ -198,8 +198,9 @@ class ExtensionManager {
|
|
|
198
198
|
}
|
|
199
199
|
initializeWatcher() {
|
|
200
200
|
logger.info('Watching extensions for changes...');
|
|
201
|
-
const
|
|
202
|
-
|
|
201
|
+
const extensionDirUrl = pathToRelativeUrl(env['EXTENSIONS_PATH']);
|
|
202
|
+
const localExtensionUrls = NESTED_EXTENSION_TYPES.flatMap((type) => {
|
|
203
|
+
const typeDir = path.posix.join(extensionDirUrl, pluralize(type));
|
|
203
204
|
const fileExts = ['js', 'mjs', 'cjs'];
|
|
204
205
|
if (isIn(type, HYBRID_EXTENSION_TYPES)) {
|
|
205
206
|
return [
|
|
@@ -211,7 +212,7 @@ class ExtensionManager {
|
|
|
211
212
|
return path.posix.join(typeDir, '*', `index.{${fileExts.join()}}`);
|
|
212
213
|
}
|
|
213
214
|
});
|
|
214
|
-
this.watcher = chokidar.watch([path.resolve('package.json'), ...
|
|
215
|
+
this.watcher = chokidar.watch([path.resolve('package.json'), path.posix.join(extensionDirUrl, '*', 'package.json'), ...localExtensionUrls], {
|
|
215
216
|
ignoreInitial: true,
|
|
216
217
|
});
|
|
217
218
|
this.watcher
|
|
@@ -228,7 +229,7 @@ class ExtensionManager {
|
|
|
228
229
|
updateWatchedExtensions(added, removed = []) {
|
|
229
230
|
if (this.watcher) {
|
|
230
231
|
const toPackageExtensionPaths = (extensions) => extensions
|
|
231
|
-
.filter((extension) => !extension.local)
|
|
232
|
+
.filter((extension) => !extension.local || extension.type === 'bundle')
|
|
232
233
|
.flatMap((extension) => isTypeIn(extension, HYBRID_EXTENSION_TYPES) || extension.type === 'bundle'
|
|
233
234
|
? [
|
|
234
235
|
path.resolve(extension.path, extension.entrypoint.app),
|
package/dist/mailer.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { Transporter } from 'nodemailer';
|
|
1
|
+
import type { Transporter } from 'nodemailer';
|
|
2
2
|
export default function getMailer(): Transporter;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { defineOperationApi, toArray } from '@directus/utils';
|
|
2
|
-
import { NodeVM, VMScript } from 'vm2';
|
|
3
2
|
import { isBuiltin } from 'node:module';
|
|
3
|
+
import { NodeVM, VMScript } from 'vm2';
|
|
4
4
|
export default defineOperationApi({
|
|
5
5
|
id: 'exec',
|
|
6
6
|
handler: async ({ code }, { data, env }) => {
|
|
@@ -1,7 +1,9 @@
|
|
|
1
|
-
type Options = {
|
|
2
|
-
body
|
|
1
|
+
export type Options = {
|
|
2
|
+
body?: string;
|
|
3
|
+
template?: string;
|
|
4
|
+
data?: Record<string, any>;
|
|
3
5
|
to: string;
|
|
4
|
-
type: 'wysiwyg' | 'markdown';
|
|
6
|
+
type: 'wysiwyg' | 'markdown' | 'template';
|
|
5
7
|
subject: string;
|
|
6
8
|
};
|
|
7
9
|
declare const _default: import("@directus/types").OperationApiConfig<Options>;
|
|
@@ -3,15 +3,19 @@ import { MailService } from '../../services/mail/index.js';
|
|
|
3
3
|
import { md } from '../../utils/md.js';
|
|
4
4
|
export default defineOperationApi({
|
|
5
5
|
id: 'mail',
|
|
6
|
-
handler: async ({ body, to, type, subject }, { accountability, database, getSchema }) => {
|
|
6
|
+
handler: async ({ body, template, data, to, type, subject }, { accountability, database, getSchema }) => {
|
|
7
7
|
const mailService = new MailService({ schema: await getSchema({ database }), accountability, knex: database });
|
|
8
|
-
|
|
9
|
-
// convert it to JSON string
|
|
8
|
+
const mailObject = { to, subject };
|
|
10
9
|
const safeBody = typeof body !== 'string' ? JSON.stringify(body) : body;
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
10
|
+
if (type === 'template') {
|
|
11
|
+
mailObject.template = {
|
|
12
|
+
name: template || 'base',
|
|
13
|
+
data: data || {},
|
|
14
|
+
};
|
|
15
|
+
}
|
|
16
|
+
else {
|
|
17
|
+
mailObject.html = type === 'wysiwyg' ? safeBody : md(safeBody);
|
|
18
|
+
}
|
|
19
|
+
await mailService.send(mailObject);
|
|
16
20
|
},
|
|
17
21
|
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/dist/rate-limiter.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { IRateLimiterOptions, IRateLimiterStoreOptions, RateLimiterAbstract } from 'rate-limiter-flexible';
|
|
1
|
+
import type { IRateLimiterOptions, IRateLimiterStoreOptions, RateLimiterAbstract } from 'rate-limiter-flexible';
|
|
2
2
|
type IRateLimiterOptionsOverrides = Partial<IRateLimiterOptions> | Partial<IRateLimiterStoreOptions>;
|
|
3
3
|
export declare function createRateLimiter(configPrefix?: string, configOverrides?: IRateLimiterOptionsOverrides): RateLimiterAbstract;
|
|
4
4
|
export {};
|
package/dist/rate-limiter.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { merge } from 'lodash-es';
|
|
2
|
-
import { RateLimiterMemcache, RateLimiterMemory, RateLimiterRedis
|
|
2
|
+
import { RateLimiterMemcache, RateLimiterMemory, RateLimiterRedis } from 'rate-limiter-flexible';
|
|
3
3
|
import env from './env.js';
|
|
4
4
|
import { getConfigFromEnv } from './utils/get-config-from-env.js';
|
|
5
5
|
import { createRequire } from 'node:module';
|
package/dist/server.js
CHANGED
|
@@ -1,17 +1,17 @@
|
|
|
1
|
+
import { isUpToDate } from '@directus/update-check';
|
|
1
2
|
import { createTerminus } from '@godaddy/terminus';
|
|
2
3
|
import * as http from 'http';
|
|
3
4
|
import * as https from 'https';
|
|
4
5
|
import { once } from 'lodash-es';
|
|
5
6
|
import qs from 'qs';
|
|
6
|
-
import { isUpToDate } from '@directus/update-check';
|
|
7
7
|
import url from 'url';
|
|
8
|
-
import * as pkg from './utils/package.js';
|
|
9
8
|
import createApp from './app.js';
|
|
10
9
|
import getDatabase from './database/index.js';
|
|
11
10
|
import emitter from './emitter.js';
|
|
12
11
|
import env from './env.js';
|
|
13
12
|
import logger from './logger.js';
|
|
14
13
|
import { getConfigFromEnv } from './utils/get-config-from-env.js';
|
|
14
|
+
import * as pkg from './utils/package.js';
|
|
15
15
|
export let SERVER_ONLINE = true;
|
|
16
16
|
export async function createServer() {
|
|
17
17
|
const server = http.createServer(await createApp());
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
+
import type { SchemaInspector, Table } from '@directus/schema';
|
|
1
2
|
import type { Accountability, RawField, SchemaOverview } from '@directus/types';
|
|
2
3
|
import type Keyv from 'keyv';
|
|
3
4
|
import type { Knex } from 'knex';
|
|
4
|
-
import type {
|
|
5
|
-
import { Helpers } from '../database/helpers/index.js';
|
|
5
|
+
import type { Helpers } from '../database/helpers/index.js';
|
|
6
6
|
import type { AbstractServiceOptions, Collection, CollectionMeta, MutationOptions } from '../types/index.js';
|
|
7
7
|
export type RawCollection = {
|
|
8
8
|
collection: string;
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { createInspector } from '@directus/schema';
|
|
2
2
|
import { addFieldFlag } from '@directus/utils';
|
|
3
|
-
import {
|
|
3
|
+
import { chunk, omit } from 'lodash-es';
|
|
4
4
|
import { clearSystemCache, getCache } from '../cache.js';
|
|
5
5
|
import { ALIAS_TYPES } from '../constants.js';
|
|
6
|
-
import getDatabase, { getSchemaInspector } from '../database/index.js';
|
|
7
6
|
import { getHelpers } from '../database/helpers/index.js';
|
|
7
|
+
import getDatabase, { getSchemaInspector } from '../database/index.js';
|
|
8
8
|
import { systemCollectionRows } from '../database/system-data/collections/index.js';
|
|
9
9
|
import emitter from '../emitter.js';
|
|
10
10
|
import env from '../env.js';
|
|
@@ -2,7 +2,7 @@ import type { Column, SchemaInspector } from '@directus/schema';
|
|
|
2
2
|
import type { Accountability, Field, RawField, SchemaOverview, Type } from '@directus/types';
|
|
3
3
|
import type Keyv from 'keyv';
|
|
4
4
|
import type { Knex } from 'knex';
|
|
5
|
-
import { Helpers } from '../database/helpers/index.js';
|
|
5
|
+
import type { Helpers } from '../database/helpers/index.js';
|
|
6
6
|
import { ItemsService } from '../services/items.js';
|
|
7
7
|
import { PayloadService } from '../services/payload.js';
|
|
8
8
|
import type { AbstractServiceOptions, MutationOptions } from '../types/index.js';
|
package/dist/services/fields.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { createInspector } from '@directus/schema';
|
|
2
1
|
import { KNEX_TYPES, REGEX_BETWEEN_PARENS } from '@directus/constants';
|
|
2
|
+
import { createInspector } from '@directus/schema';
|
|
3
3
|
import { addFieldFlag, toArray } from '@directus/utils';
|
|
4
4
|
import { isEqual, isNil } from 'lodash-es';
|
|
5
5
|
import { clearSystemCache, getCache } from '../cache.js';
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import type { BaseException } from '@directus/exceptions';
|
|
2
2
|
import type { Accountability, Filter, Query, SchemaOverview } from '@directus/types';
|
|
3
|
-
import { ArgumentNode, FormattedExecutionResult, FragmentDefinitionNode,
|
|
3
|
+
import type { ArgumentNode, FormattedExecutionResult, FragmentDefinitionNode, GraphQLResolveInfo, SelectionNode } from 'graphql';
|
|
4
|
+
import { GraphQLError, GraphQLSchema } from 'graphql';
|
|
4
5
|
import { ObjectTypeComposer, SchemaComposer } from 'graphql-compose';
|
|
5
6
|
import type { Knex } from 'knex';
|
|
6
7
|
import type { AbstractServiceOptions, GraphQLParams, Item } from '../../types/index.js';
|
|
@@ -1,9 +1,8 @@
|
|
|
1
|
-
import { FUNCTIONS } from '@directus/constants';
|
|
2
|
-
import { Action } from '@directus/constants';
|
|
1
|
+
import { Action, FUNCTIONS } from '@directus/constants';
|
|
3
2
|
import { parseFilterFunctionPath } from '@directus/utils';
|
|
4
3
|
import argon2 from 'argon2';
|
|
5
|
-
import {
|
|
6
|
-
import { GraphQLJSON, SchemaComposer, toInputObjectType
|
|
4
|
+
import { GraphQLBoolean, GraphQLEnumType, GraphQLError, GraphQLFloat, GraphQLID, GraphQLInt, GraphQLList, GraphQLNonNull, GraphQLObjectType, GraphQLScalarType, GraphQLSchema, GraphQLString, GraphQLUnionType, NoSchemaIntrospectionCustomRule, execute, specifiedRules, validate, } from 'graphql';
|
|
5
|
+
import { GraphQLJSON, InputTypeComposer, ObjectTypeComposer, SchemaComposer, toInputObjectType } from 'graphql-compose';
|
|
7
6
|
import { flatten, get, mapKeys, merge, omit, pick, set, transform, uniq } from 'lodash-es';
|
|
8
7
|
import { clearSystemCache, getCache } from '../../cache.js';
|
|
9
8
|
import { DEFAULT_AUTH_PROVIDER, GENERATE_SPECIAL } from '../../constants.js';
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { Accountability, SchemaOverview } from '@directus/types';
|
|
2
2
|
import type { Knex } from 'knex';
|
|
3
|
-
import { Helpers } from '../database/helpers/index.js';
|
|
3
|
+
import type { Helpers } from '../database/helpers/index.js';
|
|
4
4
|
import type { AbstractServiceOptions, ActionEventParams, Item, MutationOptions, PrimaryKey } from '../types/index.js';
|
|
5
5
|
type Action = 'create' | 'read' | 'update';
|
|
6
6
|
type Transformers = {
|
package/dist/services/payload.js
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import { format, parseISO, isValid } from 'date-fns';
|
|
2
1
|
import { parseJSON, toArray } from '@directus/utils';
|
|
2
|
+
import { format, isValid, parseISO } from 'date-fns';
|
|
3
3
|
import flat from 'flat';
|
|
4
4
|
import Joi from 'joi';
|
|
5
5
|
import { clone, cloneDeep, isNil, isObject, isPlainObject, omit, pick } from 'lodash-es';
|
|
6
6
|
import { v4 as uuid } from 'uuid';
|
|
7
7
|
import { parse as wktToGeoJSON } from 'wellknown';
|
|
8
|
-
import getDatabase from '../database/index.js';
|
|
9
8
|
import { getHelpers } from '../database/helpers/index.js';
|
|
9
|
+
import getDatabase from '../database/index.js';
|
|
10
10
|
import { ForbiddenException, InvalidPayloadException } from '../exceptions/index.js';
|
|
11
11
|
import { generateHash } from '../utils/generate-hash.js';
|
|
12
12
|
import { ItemsService } from './items.js';
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import type { PermissionsAction, Query } from '@directus/types';
|
|
2
2
|
import type Keyv from 'keyv';
|
|
3
|
-
import {
|
|
3
|
+
import type { QueryOptions } from '../services/items.js';
|
|
4
|
+
import { ItemsService } from '../services/items.js';
|
|
4
5
|
import type { AbstractServiceOptions, Item, MutationOptions, PrimaryKey } from '../types/index.js';
|
|
5
6
|
export declare class PermissionsService extends ItemsService {
|
|
6
7
|
systemCache: Keyv<any>;
|
|
@@ -1,10 +1,11 @@
|
|
|
1
|
+
import type { SchemaInspector } from '@directus/schema';
|
|
1
2
|
import type { Accountability, Relation, RelationMeta, SchemaOverview } from '@directus/types';
|
|
2
3
|
import type Keyv from 'keyv';
|
|
3
4
|
import type { Knex } from 'knex';
|
|
4
|
-
import type {
|
|
5
|
-
import { Helpers } from '../database/helpers/index.js';
|
|
5
|
+
import type { Helpers } from '../database/helpers/index.js';
|
|
6
6
|
import type { AbstractServiceOptions, MutationOptions } from '../types/index.js';
|
|
7
|
-
import {
|
|
7
|
+
import type { QueryOptions } from './items.js';
|
|
8
|
+
import { ItemsService } from './items.js';
|
|
8
9
|
import { PermissionsService } from './permissions.js';
|
|
9
10
|
export declare class RelationsService {
|
|
10
11
|
knex: Knex;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { createInspector } from '@directus/schema';
|
|
2
2
|
import { toArray } from '@directus/utils';
|
|
3
3
|
import { clearSystemCache, getCache } from '../cache.js';
|
|
4
|
-
import getDatabase, { getSchemaInspector } from '../database/index.js';
|
|
5
4
|
import { getHelpers } from '../database/helpers/index.js';
|
|
5
|
+
import getDatabase, { getSchemaInspector } from '../database/index.js';
|
|
6
6
|
import { systemRelationRows } from '../database/system-data/relations/index.js';
|
|
7
7
|
import emitter from '../emitter.js';
|
|
8
8
|
import { ForbiddenException, InvalidPayloadException } from '../exceptions/index.js';
|
package/dist/services/server.js
CHANGED
|
@@ -150,7 +150,8 @@ export class ServerService {
|
|
|
150
150
|
}
|
|
151
151
|
const endTime = performance.now();
|
|
152
152
|
checks[`${client}:responseTime`][0].observedValue = +(endTime - startTime).toFixed(3);
|
|
153
|
-
if (checks[`${client}:responseTime`][0].observedValue >
|
|
153
|
+
if (Number(checks[`${client}:responseTime`][0].observedValue) >
|
|
154
|
+
checks[`${client}:responseTime`][0].threshold &&
|
|
154
155
|
checks[`${client}:responseTime`][0].status !== 'error') {
|
|
155
156
|
checks[`${client}:responseTime`][0].status = 'warn';
|
|
156
157
|
}
|
|
@@ -307,7 +308,7 @@ export class ServerService {
|
|
|
307
308
|
finally {
|
|
308
309
|
const endTime = performance.now();
|
|
309
310
|
checks[`storage:${location}:responseTime`][0].observedValue = +(endTime - startTime).toFixed(3);
|
|
310
|
-
if (checks[`storage:${location}:responseTime`][0].observedValue >
|
|
311
|
+
if (Number(checks[`storage:${location}:responseTime`][0].observedValue) >
|
|
311
312
|
checks[`storage:${location}:responseTime`][0].threshold &&
|
|
312
313
|
checks[`storage:${location}:responseTime`][0].status !== 'error') {
|
|
313
314
|
checks[`storage:${location}:responseTime`][0].status = 'warn';
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Messenger } from '../messenger.js';
|
|
1
|
+
import type { Messenger } from '../messenger.js';
|
|
2
2
|
import type { AbstractServiceOptions, Item, MutationOptions, PrimaryKey, Webhook } from '../types/index.js';
|
|
3
3
|
import { ItemsService } from './items.js';
|
|
4
4
|
export declare class WebhooksService extends ItemsService<Webhook> {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { SchemaOverview } from '@directus/types';
|
|
2
2
|
import type { Diff } from 'deep-diff';
|
|
3
3
|
import type { Knex } from 'knex';
|
|
4
|
-
import { Snapshot, SnapshotDiff, SnapshotField } from '../types/index.js';
|
|
4
|
+
import type { Snapshot, SnapshotDiff, SnapshotField } from '../types/index.js';
|
|
5
5
|
export declare function applyDiff(currentSnapshot: Snapshot, snapshotDiff: SnapshotDiff, options?: {
|
|
6
6
|
database?: Knex;
|
|
7
7
|
schema?: SchemaOverview;
|
package/dist/utils/apply-diff.js
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
import deepDiff from 'deep-diff';
|
|
2
2
|
import { cloneDeep, merge, set } from 'lodash-es';
|
|
3
3
|
import { clearSystemCache } from '../cache.js';
|
|
4
|
+
import { getHelpers } from '../database/helpers/index.js';
|
|
4
5
|
import getDatabase from '../database/index.js';
|
|
5
6
|
import emitter from '../emitter.js';
|
|
6
7
|
import logger from '../logger.js';
|
|
7
8
|
import { CollectionsService } from '../services/collections.js';
|
|
8
9
|
import { FieldsService } from '../services/fields.js';
|
|
9
10
|
import { RelationsService } from '../services/relations.js';
|
|
10
|
-
import { DiffKind
|
|
11
|
+
import { DiffKind } from '../types/index.js';
|
|
11
12
|
import { getSchema } from './get-schema.js';
|
|
12
|
-
import { getHelpers } from '../database/helpers/index.js';
|
|
13
13
|
export async function applyDiff(currentSnapshot, snapshotDiff, options) {
|
|
14
14
|
const database = options?.database ?? getDatabase();
|
|
15
15
|
const helpers = getHelpers(database);
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { Aggregate, Filter, Query, SchemaOverview } from '@directus/types';
|
|
2
2
|
import type { Knex } from 'knex';
|
|
3
|
-
import { AliasMap } from './get-column-path.js';
|
|
3
|
+
import type { AliasMap } from './get-column-path.js';
|
|
4
4
|
export declare const generateAlias: (size?: number | undefined) => string;
|
|
5
5
|
/**
|
|
6
6
|
* Apply the Query to a given Knex query builder instance
|
|
@@ -3,8 +3,8 @@ import { clone, isPlainObject } from 'lodash-es';
|
|
|
3
3
|
import validate from 'uuid-validate';
|
|
4
4
|
import { getHelpers } from '../database/helpers/index.js';
|
|
5
5
|
import { InvalidQueryException } from '../exceptions/invalid-query.js';
|
|
6
|
-
import { getColumn } from './get-column.js';
|
|
7
6
|
import { getColumnPath } from './get-column-path.js';
|
|
7
|
+
import { getColumn } from './get-column.js';
|
|
8
8
|
import { getRelationInfo } from './get-relation-info.js';
|
|
9
9
|
import { stripFunction } from './strip-function.js';
|
|
10
10
|
// @ts-ignore
|
|
@@ -1,3 +1,4 @@
|
|
|
1
1
|
import type { Type } from '@directus/types';
|
|
2
|
-
import {
|
|
2
|
+
import type { GraphQLType } from 'graphql';
|
|
3
|
+
import { GraphQLList, GraphQLScalarType } from 'graphql';
|
|
3
4
|
export declare function getGraphQLType(localType: Type | 'alias' | 'unknown', special: string[]): GraphQLScalarType | GraphQLList<GraphQLType>;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { GraphQLBoolean, GraphQLFloat, GraphQLInt, GraphQLList,
|
|
1
|
+
import { GraphQLBoolean, GraphQLFloat, GraphQLInt, GraphQLList, GraphQLScalarType, GraphQLString } from 'graphql';
|
|
2
2
|
import { GraphQLJSON } from 'graphql-compose';
|
|
3
3
|
import { GraphQLBigInt } from '../services/graphql/types/bigint.js';
|
|
4
4
|
import { GraphQLDate } from '../services/graphql/types/date.js';
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { Snapshot, SnapshotDiff } from '../types/index.js';
|
|
1
|
+
import type { Snapshot, SnapshotDiff } from '../types/index.js';
|
|
2
2
|
export declare function getSnapshotDiff(current: Snapshot, after: Snapshot): SnapshotDiff;
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { version as currentDirectusVersion } from './package.js';
|
|
2
|
-
import { InvalidPayloadException } from '../exceptions/invalid-payload.js';
|
|
3
|
-
import { getDatabaseClient } from '../database/index.js';
|
|
4
|
-
import Joi from 'joi';
|
|
5
1
|
import { TYPES } from '@directus/constants';
|
|
2
|
+
import Joi from 'joi';
|
|
6
3
|
import { ALIAS_TYPES } from '../constants.js';
|
|
4
|
+
import { getDatabaseClient } from '../database/index.js';
|
|
5
|
+
import { InvalidPayloadException } from '../exceptions/invalid-payload.js';
|
|
7
6
|
import { DatabaseClients } from '../types/index.js';
|
|
7
|
+
import { version as currentDirectusVersion } from './package.js';
|
|
8
8
|
const snapshotJoiSchema = Joi.object({
|
|
9
9
|
version: Joi.number().valid(1).required(),
|
|
10
10
|
directus: Joi.string().required(),
|