@directus/api 29.0.0 → 29.1.1
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/openid.js +12 -6
- package/dist/cli/commands/init/index.js +2 -2
- package/dist/cli/commands/init/questions.d.ts +1 -1
- package/dist/cli/commands/schema/apply.js +1 -1
- package/dist/cli/index.js +1 -0
- package/dist/cli/utils/create-db-connection.d.ts +1 -1
- package/dist/cli/utils/create-env/index.d.ts +1 -1
- package/dist/cli/utils/drivers.d.ts +1 -1
- package/dist/constants.d.ts +1 -1
- package/dist/controllers/assets.js +1 -1
- package/dist/controllers/extensions.js +1 -1
- package/dist/database/helpers/index.d.ts +4 -4
- package/dist/database/helpers/schema/types.d.ts +1 -2
- package/dist/database/index.d.ts +1 -1
- package/dist/database/migrations/20210225A-add-relations-sort-field.js +1 -1
- package/dist/database/migrations/20240924B-populate-versioning-deltas.js +1 -1
- package/dist/database/run-ast/lib/apply-query/filter/get-filter-type.d.ts +2 -2
- package/dist/extensions/lib/get-extensions-settings.d.ts +1 -1
- package/dist/extensions/lib/sandbox/generate-api-extensions-sandbox-entrypoint.d.ts +1 -1
- package/dist/extensions/manager.d.ts +1 -2
- package/dist/extensions/manager.js +3 -2
- package/dist/flows.d.ts +1 -2
- package/dist/operations/throw-error/index.d.ts +7 -0
- package/dist/operations/throw-error/index.js +11 -0
- package/dist/permissions/utils/fetch-share-info.d.ts +1 -1
- package/dist/services/access.d.ts +1 -2
- package/dist/services/access.js +1 -1
- package/dist/services/activity.d.ts +1 -1
- package/dist/services/assets.d.ts +1 -3
- package/dist/services/authentication.d.ts +1 -2
- package/dist/services/collections.d.ts +3 -10
- package/dist/services/comments.d.ts +1 -2
- package/dist/services/dashboards.d.ts +1 -1
- package/dist/services/extensions.d.ts +2 -4
- package/dist/services/fields.d.ts +1 -2
- package/dist/services/files.d.ts +2 -3
- package/dist/services/flows.d.ts +1 -2
- package/dist/services/folders.d.ts +1 -1
- package/dist/services/graphql/errors/format.d.ts +1 -1
- package/dist/services/graphql/errors/format.js +0 -1
- package/dist/services/graphql/index.d.ts +1 -3
- package/dist/services/graphql/resolvers/system-admin.d.ts +1 -1
- package/dist/services/graphql/resolvers/system-global.d.ts +1 -1
- package/dist/services/graphql/resolvers/system.d.ts +1 -1
- package/dist/services/graphql/schema/get-types.d.ts +1 -1
- package/dist/services/graphql/schema/get-types.js +0 -1
- package/dist/services/import-export.d.ts +2 -4
- package/dist/services/items.d.ts +2 -12
- package/dist/services/items.js +2 -1
- package/dist/services/mail/index.d.ts +2 -4
- package/dist/services/mail/index.js +11 -5
- package/dist/services/meta.d.ts +1 -2
- package/dist/services/notifications.d.ts +1 -2
- package/dist/services/operations.d.ts +1 -2
- package/dist/services/panels.d.ts +1 -1
- package/dist/services/payload.d.ts +9 -17
- package/dist/services/payload.js +1 -1
- package/dist/services/permissions.d.ts +1 -3
- package/dist/services/policies.d.ts +1 -2
- package/dist/services/policies.js +1 -1
- package/dist/services/presets.d.ts +1 -1
- package/dist/services/relations.d.ts +2 -3
- package/dist/services/revisions.d.ts +1 -2
- package/dist/services/roles.d.ts +1 -2
- package/dist/services/roles.js +1 -1
- package/dist/services/schema.d.ts +1 -2
- package/dist/services/server.d.ts +1 -2
- package/dist/services/settings.d.ts +1 -1
- package/dist/services/shares.d.ts +1 -2
- package/dist/services/specifications.d.ts +1 -2
- package/dist/services/tfa.d.ts +1 -2
- package/dist/services/translations.d.ts +1 -3
- package/dist/services/users.d.ts +1 -2
- package/dist/services/users.js +1 -1
- package/dist/services/utils.d.ts +1 -2
- package/dist/services/versions.d.ts +1 -2
- package/dist/services/webhooks.d.ts +1 -2
- package/dist/services/websocket.d.ts +1 -3
- package/dist/types/auth.d.ts +0 -6
- package/dist/types/index.d.ts +0 -7
- package/dist/types/index.js +0 -7
- package/dist/utils/apply-diff.d.ts +1 -2
- package/dist/utils/apply-diff.js +1 -1
- package/dist/utils/apply-snapshot.d.ts +1 -2
- package/dist/utils/get-ip-from-req.js +1 -1
- package/dist/utils/get-service.d.ts +1 -1
- package/dist/utils/get-snapshot-diff.d.ts +1 -1
- package/dist/utils/get-snapshot-diff.js +1 -1
- package/dist/utils/get-snapshot.d.ts +1 -2
- package/dist/utils/schedule.js +4 -1
- package/dist/utils/should-clear-cache.d.ts +1 -1
- package/dist/utils/transformations.d.ts +1 -2
- package/dist/utils/validate-diff.d.ts +1 -1
- package/dist/utils/validate-diff.js +1 -1
- package/dist/utils/validate-snapshot.d.ts +1 -1
- package/dist/utils/validate-snapshot.js +1 -1
- package/dist/utils/validate-user-count-integrity.d.ts +1 -8
- package/dist/utils/validate-user-count-integrity.js +1 -9
- package/dist/websocket/controllers/base.d.ts +2 -1
- package/dist/websocket/controllers/base.js +2 -1
- package/dist/websocket/controllers/graphql.js +1 -1
- package/dist/websocket/controllers/logs.js +1 -1
- package/dist/websocket/controllers/rest.d.ts +1 -1
- package/dist/websocket/controllers/rest.js +1 -1
- package/dist/websocket/errors.d.ts +1 -1
- package/dist/websocket/handlers/heartbeat.d.ts +1 -1
- package/dist/websocket/handlers/heartbeat.js +1 -1
- package/dist/websocket/messages.d.ts +57 -308
- package/dist/websocket/messages.js +5 -10
- package/dist/websocket/utils/items.d.ts +1 -1
- package/dist/websocket/utils/wait-for-message.d.ts +1 -1
- package/dist/websocket/utils/wait-for-message.js +1 -1
- package/package.json +80 -81
- package/dist/extensions/types.d.ts +0 -19
- package/dist/extensions/types.js +0 -1
- package/dist/types/assets.d.ts +0 -22
- package/dist/types/assets.js +0 -51
- package/dist/types/database.d.ts +0 -3
- package/dist/types/database.js +0 -1
- package/dist/types/graphql.d.ts +0 -14
- package/dist/types/graphql.js +0 -1
- package/dist/types/items.d.ts +0 -52
- package/dist/types/items.js +0 -1
- package/dist/types/services.d.ts +0 -22
- package/dist/types/services.js +0 -1
- package/dist/types/snapshot.d.ts +0 -55
- package/dist/types/snapshot.js +0 -13
- package/dist/types/webhooks.d.ts +0 -15
- package/dist/types/webhooks.js +0 -1
|
@@ -1,14 +1,15 @@
|
|
|
1
1
|
import { useEnv } from '@directus/env';
|
|
2
2
|
import { InvalidPayloadError } from '@directus/errors';
|
|
3
|
+
import { isObject } from '@directus/utils';
|
|
3
4
|
import fse from 'fs-extra';
|
|
4
5
|
import { Liquid } from 'liquidjs';
|
|
5
6
|
import path from 'path';
|
|
6
7
|
import { fileURLToPath } from 'url';
|
|
7
8
|
import getDatabase from '../../database/index.js';
|
|
9
|
+
import emitter from '../../emitter.js';
|
|
8
10
|
import { useLogger } from '../../logger/index.js';
|
|
9
11
|
import getMailer from '../../mailer.js';
|
|
10
12
|
import { Url } from '../../utils/url.js';
|
|
11
|
-
import emitter from '../../emitter.js';
|
|
12
13
|
const env = useEnv();
|
|
13
14
|
const logger = useLogger();
|
|
14
15
|
const __dirname = path.dirname(fileURLToPath(import.meta.url));
|
|
@@ -42,10 +43,15 @@ export class MailService {
|
|
|
42
43
|
const { template, ...emailOptions } = payload;
|
|
43
44
|
let { html } = options;
|
|
44
45
|
const defaultTemplateData = await this.getDefaultTemplateData();
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
46
|
+
if (isObject(emailOptions.from) && (!emailOptions.from.name || !emailOptions.from.address)) {
|
|
47
|
+
throw new InvalidPayloadError({ reason: 'A name and address property are required in the "from" object' });
|
|
48
|
+
}
|
|
49
|
+
const from = isObject(emailOptions.from)
|
|
50
|
+
? emailOptions.from
|
|
51
|
+
: {
|
|
52
|
+
name: defaultTemplateData.projectName,
|
|
53
|
+
address: emailOptions.from || env['EMAIL_FROM'],
|
|
54
|
+
};
|
|
49
55
|
if (template) {
|
|
50
56
|
let templateData = template.data;
|
|
51
57
|
templateData = {
|
package/dist/services/meta.d.ts
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
import type { Accountability, Query, SchemaOverview } from '@directus/types';
|
|
1
|
+
import type { AbstractServiceOptions, Accountability, Query, SchemaOverview } from '@directus/types';
|
|
2
2
|
import type { Knex } from 'knex';
|
|
3
|
-
import type { AbstractServiceOptions } from '../types/index.js';
|
|
4
3
|
export declare class MetaService {
|
|
5
4
|
knex: Knex;
|
|
6
5
|
accountability: Accountability | null;
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import type { Notification, PrimaryKey } from '@directus/types';
|
|
2
|
-
import type { AbstractServiceOptions, MutationOptions } from '../types/index.js';
|
|
1
|
+
import type { AbstractServiceOptions, MutationOptions, Notification, PrimaryKey } from '@directus/types';
|
|
3
2
|
import { ItemsService } from './items.js';
|
|
4
3
|
export declare class NotificationsService extends ItemsService {
|
|
5
4
|
constructor(options: AbstractServiceOptions);
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import type { Item, OperationRaw, PrimaryKey } from '@directus/types';
|
|
2
|
-
import type { AbstractServiceOptions, MutationOptions } from '../types/index.js';
|
|
1
|
+
import type { AbstractServiceOptions, Item, MutationOptions, OperationRaw, PrimaryKey } from '@directus/types';
|
|
3
2
|
import { ItemsService } from './items.js';
|
|
4
3
|
export declare class OperationsService extends ItemsService<OperationRaw> {
|
|
5
4
|
constructor(options: AbstractServiceOptions);
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { AbstractServiceOptions } from '
|
|
1
|
+
import type { AbstractServiceOptions } from '@directus/types';
|
|
2
2
|
import { ItemsService } from './items.js';
|
|
3
3
|
export declare class PanelsService extends ItemsService {
|
|
4
4
|
constructor(options: AbstractServiceOptions);
|
|
@@ -1,12 +1,9 @@
|
|
|
1
|
-
import type { Accountability, Aggregate, FieldOverview, Item, PrimaryKey, SchemaOverview } from '@directus/types';
|
|
1
|
+
import type { AbstractServiceOptions, Accountability, Aggregate, FieldOverview, Item, MutationOptions, PayloadAction, PayloadServiceProcessRelationResult, PrimaryKey, SchemaOverview } from '@directus/types';
|
|
2
2
|
import type { Knex } from 'knex';
|
|
3
3
|
import type { Helpers } from '../database/helpers/index.js';
|
|
4
|
-
import type { AbstractServiceOptions, ActionEventParams, MutationOptions } from '../types/index.js';
|
|
5
|
-
import { UserIntegrityCheckFlag } from '../utils/validate-user-count-integrity.js';
|
|
6
|
-
type Action = 'create' | 'read' | 'update';
|
|
7
4
|
type Transformers = {
|
|
8
5
|
[type: string]: (context: {
|
|
9
|
-
action:
|
|
6
|
+
action: PayloadAction;
|
|
10
7
|
value: any;
|
|
11
8
|
payload: Partial<Item>;
|
|
12
9
|
accountability: Accountability | null;
|
|
@@ -14,11 +11,6 @@ type Transformers = {
|
|
|
14
11
|
helpers: Helpers;
|
|
15
12
|
}) => Promise<any>;
|
|
16
13
|
};
|
|
17
|
-
type PayloadServiceProcessRelationResult = {
|
|
18
|
-
revisions: PrimaryKey[];
|
|
19
|
-
nestedActionEvents: ActionEventParams[];
|
|
20
|
-
userIntegrityCheckFlags: UserIntegrityCheckFlag;
|
|
21
|
-
};
|
|
22
14
|
/**
|
|
23
15
|
* Process a given payload for a collection to ensure the special fields (hash, uuid, date etc) are
|
|
24
16
|
* handled correctly.
|
|
@@ -32,24 +24,24 @@ export declare class PayloadService {
|
|
|
32
24
|
nested: string[];
|
|
33
25
|
constructor(collection: string, options: AbstractServiceOptions);
|
|
34
26
|
transformers: Transformers;
|
|
35
|
-
processValues(action:
|
|
36
|
-
processValues(action:
|
|
37
|
-
processValues(action:
|
|
38
|
-
processValues(action:
|
|
27
|
+
processValues(action: PayloadAction, payloads: Partial<Item>[]): Promise<Partial<Item>[]>;
|
|
28
|
+
processValues(action: PayloadAction, payload: Partial<Item>): Promise<Partial<Item>>;
|
|
29
|
+
processValues(action: PayloadAction, payloads: Partial<Item>[], aliasMap: Record<string, string>, aggregate: Aggregate): Promise<Partial<Item>[]>;
|
|
30
|
+
processValues(action: PayloadAction, payload: Partial<Item>, aliasMap: Record<string, string>, aggregate: Aggregate): Promise<Partial<Item>>;
|
|
39
31
|
processAggregates(payload: Partial<Item>[], aggregate?: Aggregate): void;
|
|
40
|
-
processField(field: SchemaOverview['collections'][string]['fields'][string], payload: Partial<Item>, action:
|
|
32
|
+
processField(field: SchemaOverview['collections'][string]['fields'][string], payload: Partial<Item>, action: PayloadAction, accountability: Accountability | null): Promise<any>;
|
|
41
33
|
/**
|
|
42
34
|
* Native geometries are stored in custom binary format. We need to insert them with
|
|
43
35
|
* the function st_geomfromtext. For this to work, that function call must not be
|
|
44
36
|
* escaped. It's therefore placed as a Knex.Raw object in the payload. Thus the need
|
|
45
37
|
* to check if the value is a raw instance before stringifying it in the next step.
|
|
46
38
|
*/
|
|
47
|
-
processGeometries<T extends Partial<Record<string, any>>[]>(fieldEntries: [string, FieldOverview][], payloads: T, action:
|
|
39
|
+
processGeometries<T extends Partial<Record<string, any>>[]>(fieldEntries: [string, FieldOverview][], payloads: T, action: PayloadAction): T;
|
|
48
40
|
/**
|
|
49
41
|
* Knex returns `datetime` and `date` columns as Date.. This is wrong for date / datetime, as those
|
|
50
42
|
* shouldn't return with time / timezone info respectively
|
|
51
43
|
*/
|
|
52
|
-
processDates(fieldEntries: [string, FieldOverview][], payloads: Partial<Record<string, any>>[], action:
|
|
44
|
+
processDates(fieldEntries: [string, FieldOverview][], payloads: Partial<Record<string, any>>[], action: PayloadAction, aliasMap?: Record<string, string>, aggregate?: Aggregate): Partial<Record<string, any>>[];
|
|
53
45
|
/**
|
|
54
46
|
* Recursively save/update all nested related Any-to-One items
|
|
55
47
|
*/
|
package/dist/services/payload.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { ForbiddenError, InvalidPayloadError } from '@directus/errors';
|
|
2
|
+
import { UserIntegrityCheckFlag } from '@directus/types';
|
|
2
3
|
import { parseJSON, toArray } from '@directus/utils';
|
|
3
4
|
import { format, isValid, parseISO } from 'date-fns';
|
|
4
5
|
import { unflatten } from 'flat';
|
|
@@ -9,7 +10,6 @@ import { parse as wktToGeoJSON } from 'wellknown';
|
|
|
9
10
|
import { getHelpers } from '../database/helpers/index.js';
|
|
10
11
|
import getDatabase from '../database/index.js';
|
|
11
12
|
import { generateHash } from '../utils/generate-hash.js';
|
|
12
|
-
import { UserIntegrityCheckFlag } from '../utils/validate-user-count-integrity.js';
|
|
13
13
|
/**
|
|
14
14
|
* Process a given payload for a collection to ensure the special fields (hash, uuid, date etc) are
|
|
15
15
|
* handled correctly.
|
|
@@ -1,6 +1,4 @@
|
|
|
1
|
-
import type { Item, ItemPermissions, PrimaryKey, Query } from '@directus/types';
|
|
2
|
-
import type { AbstractServiceOptions, MutationOptions } from '../types/index.js';
|
|
3
|
-
import type { QueryOptions } from './items.js';
|
|
1
|
+
import type { AbstractServiceOptions, Item, ItemPermissions, MutationOptions, PrimaryKey, Query, QueryOptions } from '@directus/types';
|
|
4
2
|
import { ItemsService } from './items.js';
|
|
5
3
|
export declare class PermissionsService extends ItemsService {
|
|
6
4
|
constructor(options: AbstractServiceOptions);
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import type { Policy, PrimaryKey } from '@directus/types';
|
|
2
|
-
import type { AbstractServiceOptions, MutationOptions } from '../types/index.js';
|
|
1
|
+
import type { AbstractServiceOptions, MutationOptions, Policy, PrimaryKey } from '@directus/types';
|
|
3
2
|
import { ItemsService } from './items.js';
|
|
4
3
|
export declare class PoliciesService extends ItemsService<Policy> {
|
|
5
4
|
constructor(options: AbstractServiceOptions);
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { InvalidPayloadError } from '@directus/errors';
|
|
2
|
+
import { UserIntegrityCheckFlag } from '@directus/types';
|
|
2
3
|
import { getMatch } from 'ip-matching';
|
|
3
4
|
import { clearSystemCache } from '../cache.js';
|
|
4
5
|
import { clearCache as clearPermissionsCache } from '../permissions/cache.js';
|
|
5
|
-
import { UserIntegrityCheckFlag } from '../utils/validate-user-count-integrity.js';
|
|
6
6
|
import { ItemsService } from './items.js';
|
|
7
7
|
export class PoliciesService extends ItemsService {
|
|
8
8
|
constructor(options) {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { AbstractServiceOptions } from '
|
|
1
|
+
import type { AbstractServiceOptions } from '@directus/types';
|
|
2
2
|
import { ItemsService } from './items.js';
|
|
3
3
|
export declare class PresetsService extends ItemsService {
|
|
4
4
|
constructor(options: AbstractServiceOptions);
|
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
import type { ForeignKey, SchemaInspector } from '@directus/schema';
|
|
2
|
-
import type { Accountability, Relation, RelationMeta, SchemaOverview } from '@directus/types';
|
|
2
|
+
import type { AbstractServiceOptions, Accountability, MutationOptions, QueryOptions, Relation, RelationMeta, SchemaOverview } from '@directus/types';
|
|
3
3
|
import type Keyv from 'keyv';
|
|
4
4
|
import type { Knex } from 'knex';
|
|
5
5
|
import type { Helpers } from '../database/helpers/index.js';
|
|
6
|
-
import
|
|
7
|
-
import { ItemsService, type QueryOptions } from './items.js';
|
|
6
|
+
import { ItemsService } from './items.js';
|
|
8
7
|
export declare class RelationsService {
|
|
9
8
|
knex: Knex;
|
|
10
9
|
schemaInspector: SchemaInspector;
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import type { Item, PrimaryKey } from '@directus/types';
|
|
2
|
-
import type { AbstractServiceOptions, MutationOptions } from '../types/index.js';
|
|
1
|
+
import type { AbstractServiceOptions, Item, MutationOptions, PrimaryKey } from '@directus/types';
|
|
3
2
|
import { ItemsService } from './items.js';
|
|
4
3
|
export declare class RevisionsService extends ItemsService {
|
|
5
4
|
constructor(options: AbstractServiceOptions);
|
package/dist/services/roles.d.ts
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import type { Item, PrimaryKey } from '@directus/types';
|
|
2
|
-
import type { AbstractServiceOptions, MutationOptions } from '../types/index.js';
|
|
1
|
+
import type { AbstractServiceOptions, Item, MutationOptions, PrimaryKey } from '@directus/types';
|
|
3
2
|
import { ItemsService } from './items.js';
|
|
4
3
|
export declare class RolesService extends ItemsService {
|
|
5
4
|
constructor(options: AbstractServiceOptions);
|
package/dist/services/roles.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { InvalidPayloadError } from '@directus/errors';
|
|
2
|
+
import { UserIntegrityCheckFlag } from '@directus/types';
|
|
2
3
|
import { clearSystemCache } from '../cache.js';
|
|
3
4
|
import { fetchRolesTree } from '../permissions/lib/fetch-roles-tree.js';
|
|
4
5
|
import { transaction } from '../utils/transaction.js';
|
|
5
|
-
import { UserIntegrityCheckFlag } from '../utils/validate-user-count-integrity.js';
|
|
6
6
|
import { ItemsService } from './items.js';
|
|
7
7
|
import { AccessService } from './access.js';
|
|
8
8
|
import { PresetsService } from './presets.js';
|
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
import type { Accountability } from '@directus/types';
|
|
1
|
+
import type { AbstractServiceOptions, Accountability, Snapshot, SnapshotDiff, SnapshotDiffWithHash, SnapshotWithHash } from '@directus/types';
|
|
2
2
|
import type { Knex } from 'knex';
|
|
3
|
-
import type { AbstractServiceOptions, Snapshot, SnapshotDiff, SnapshotDiffWithHash, SnapshotWithHash } from '../types/index.js';
|
|
4
3
|
export declare class SchemaService {
|
|
5
4
|
knex: Knex;
|
|
6
5
|
accountability: Accountability | null;
|
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
import type { Accountability, SchemaOverview } from '@directus/types';
|
|
1
|
+
import type { AbstractServiceOptions, Accountability, SchemaOverview } from '@directus/types';
|
|
2
2
|
import type { Knex } from 'knex';
|
|
3
|
-
import type { AbstractServiceOptions } from '../types/index.js';
|
|
4
3
|
import { SettingsService } from './settings.js';
|
|
5
4
|
export declare class ServerService {
|
|
6
5
|
knex: Knex;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { AbstractServiceOptions } from '
|
|
1
|
+
import type { AbstractServiceOptions } from '@directus/types';
|
|
2
2
|
import { ItemsService } from './items.js';
|
|
3
3
|
export declare class SettingsService extends ItemsService {
|
|
4
4
|
constructor(options: AbstractServiceOptions);
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import type { Item, PrimaryKey } from '@directus/types';
|
|
2
|
-
import type { AbstractServiceOptions, LoginResult, MutationOptions } from '../types/index.js';
|
|
1
|
+
import type { AbstractServiceOptions, Item, LoginResult, MutationOptions, PrimaryKey } from '@directus/types';
|
|
3
2
|
import { ItemsService } from './items.js';
|
|
4
3
|
export declare class SharesService extends ItemsService {
|
|
5
4
|
constructor(options: AbstractServiceOptions);
|
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
import type { Accountability, SchemaOverview } from '@directus/types';
|
|
1
|
+
import type { AbstractServiceOptions, Accountability, SchemaOverview } from '@directus/types';
|
|
2
2
|
import type { Knex } from 'knex';
|
|
3
3
|
import type { OpenAPIObject } from 'openapi3-ts/oas30';
|
|
4
|
-
import type { AbstractServiceOptions } from '../types/index.js';
|
|
5
4
|
import { GraphQLService } from './graphql/index.js';
|
|
6
5
|
export declare class SpecificationService {
|
|
7
6
|
accountability: Accountability | null;
|
package/dist/services/tfa.d.ts
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
import type { PrimaryKey } from '@directus/types';
|
|
1
|
+
import type { AbstractServiceOptions, PrimaryKey } from '@directus/types';
|
|
2
2
|
import type { Knex } from 'knex';
|
|
3
|
-
import type { AbstractServiceOptions } from '../types/index.js';
|
|
4
3
|
import { ItemsService } from './items.js';
|
|
5
4
|
export declare class TFAService {
|
|
6
5
|
knex: Knex;
|
|
@@ -1,6 +1,4 @@
|
|
|
1
|
-
import type { Item, PrimaryKey } from '@directus/types';
|
|
2
|
-
import type { MutationOptions } from '../types/items.js';
|
|
3
|
-
import type { AbstractServiceOptions } from '../types/services.js';
|
|
1
|
+
import type { AbstractServiceOptions, Item, MutationOptions, PrimaryKey } from '@directus/types';
|
|
4
2
|
import { ItemsService } from './items.js';
|
|
5
3
|
export declare class TranslationsService extends ItemsService {
|
|
6
4
|
constructor(options: AbstractServiceOptions);
|
package/dist/services/users.d.ts
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import type { Item, PrimaryKey, RegisterUserInput } from '@directus/types';
|
|
2
|
-
import type { AbstractServiceOptions, MutationOptions } from '../types/index.js';
|
|
1
|
+
import type { AbstractServiceOptions, Item, MutationOptions, PrimaryKey, RegisterUserInput } from '@directus/types';
|
|
3
2
|
import { ItemsService } from './items.js';
|
|
4
3
|
export declare class UsersService extends ItemsService {
|
|
5
4
|
constructor(options: AbstractServiceOptions);
|
package/dist/services/users.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { useEnv } from '@directus/env';
|
|
2
2
|
import { ForbiddenError, InvalidPayloadError, RecordNotUniqueError } from '@directus/errors';
|
|
3
|
+
import { UserIntegrityCheckFlag } from '@directus/types';
|
|
3
4
|
import { getSimpleHash, toArray, validatePayload } from '@directus/utils';
|
|
4
5
|
import { FailedValidationError, joiValidationErrorItemToErrorExtensions } from '@directus/validation';
|
|
5
6
|
import Joi from 'joi';
|
|
@@ -16,7 +17,6 @@ import isUrlAllowed from '../utils/is-url-allowed.js';
|
|
|
16
17
|
import { verifyJWT } from '../utils/jwt.js';
|
|
17
18
|
import { stall } from '../utils/stall.js';
|
|
18
19
|
import { Url } from '../utils/url.js';
|
|
19
|
-
import { UserIntegrityCheckFlag } from '../utils/validate-user-count-integrity.js';
|
|
20
20
|
import { ItemsService } from './items.js';
|
|
21
21
|
import { MailService } from './mail/index.js';
|
|
22
22
|
import { SettingsService } from './settings.js';
|
package/dist/services/utils.d.ts
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
import type { Accountability, PrimaryKey, SchemaOverview } from '@directus/types';
|
|
1
|
+
import type { AbstractServiceOptions, Accountability, PrimaryKey, SchemaOverview } from '@directus/types';
|
|
2
2
|
import type { Knex } from 'knex';
|
|
3
|
-
import type { AbstractServiceOptions } from '../types/index.js';
|
|
4
3
|
export declare class UtilsService {
|
|
5
4
|
knex: Knex;
|
|
6
5
|
accountability: Accountability | null;
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import type { Item, PrimaryKey, Query } from '@directus/types';
|
|
2
|
-
import type { AbstractServiceOptions, MutationOptions } from '../types/index.js';
|
|
1
|
+
import type { AbstractServiceOptions, Item, MutationOptions, PrimaryKey, Query } from '@directus/types';
|
|
3
2
|
import { ItemsService } from './items.js';
|
|
4
3
|
export declare class VersionsService extends ItemsService {
|
|
5
4
|
constructor(options: AbstractServiceOptions);
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { type DirectusError } from '@directus/errors';
|
|
2
2
|
import type { Bus } from '@directus/memory';
|
|
3
|
-
import type { PrimaryKey } from '@directus/types';
|
|
4
|
-
import type { AbstractServiceOptions, MutationOptions, Webhook } from '../types/index.js';
|
|
3
|
+
import type { AbstractServiceOptions, MutationOptions, PrimaryKey, Webhook } from '@directus/types';
|
|
5
4
|
import { ItemsService } from './items.js';
|
|
6
5
|
export declare class WebhooksService extends ItemsService<Webhook> {
|
|
7
6
|
messenger: Bus;
|
|
@@ -1,6 +1,4 @@
|
|
|
1
|
-
import type { ActionHandler } from '@directus/types';
|
|
2
|
-
import type { WebSocketMessage } from '../websocket/messages.js';
|
|
3
|
-
import type { WebSocketClient } from '../websocket/types.js';
|
|
1
|
+
import type { ActionHandler, WebSocketClient, WebSocketMessage } from '@directus/types';
|
|
4
2
|
export declare class WebSocketService {
|
|
5
3
|
private controller;
|
|
6
4
|
constructor();
|
package/dist/types/auth.d.ts
CHANGED
|
@@ -40,10 +40,4 @@ export type ShareData = {
|
|
|
40
40
|
share_max_uses?: number;
|
|
41
41
|
share_password?: string;
|
|
42
42
|
};
|
|
43
|
-
export type LoginResult = {
|
|
44
|
-
accessToken: string;
|
|
45
|
-
refreshToken: string;
|
|
46
|
-
expires: number;
|
|
47
|
-
id?: string;
|
|
48
|
-
};
|
|
49
43
|
export type AuthenticationMode = 'json' | 'cookie' | 'session';
|
package/dist/types/index.d.ts
CHANGED
|
@@ -1,14 +1,7 @@
|
|
|
1
|
-
export * from './assets.js';
|
|
2
1
|
export * from './ast.js';
|
|
3
2
|
export * from './auth.js';
|
|
4
3
|
export * from './collection.js';
|
|
5
|
-
export * from './database.js';
|
|
6
4
|
export * from './events.js';
|
|
7
|
-
export * from './graphql.js';
|
|
8
|
-
export * from './items.js';
|
|
9
5
|
export * from './meta.js';
|
|
10
6
|
export * from './migration.js';
|
|
11
7
|
export * from './revision.js';
|
|
12
|
-
export * from './services.js';
|
|
13
|
-
export * from './snapshot.js';
|
|
14
|
-
export * from './webhooks.js';
|
package/dist/types/index.js
CHANGED
|
@@ -1,14 +1,7 @@
|
|
|
1
|
-
export * from './assets.js';
|
|
2
1
|
export * from './ast.js';
|
|
3
2
|
export * from './auth.js';
|
|
4
3
|
export * from './collection.js';
|
|
5
|
-
export * from './database.js';
|
|
6
4
|
export * from './events.js';
|
|
7
|
-
export * from './graphql.js';
|
|
8
|
-
export * from './items.js';
|
|
9
5
|
export * from './meta.js';
|
|
10
6
|
export * from './migration.js';
|
|
11
7
|
export * from './revision.js';
|
|
12
|
-
export * from './services.js';
|
|
13
|
-
export * from './snapshot.js';
|
|
14
|
-
export * from './webhooks.js';
|
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
import type { SchemaOverview } from '@directus/types';
|
|
1
|
+
import type { SchemaOverview, Snapshot, SnapshotDiff, SnapshotField } from '@directus/types';
|
|
2
2
|
import type { Diff } from 'deep-diff';
|
|
3
3
|
import type { Knex } from 'knex';
|
|
4
|
-
import type { Snapshot, SnapshotDiff, SnapshotField } from '../types/index.js';
|
|
5
4
|
export declare function applyDiff(currentSnapshot: Snapshot, snapshotDiff: SnapshotDiff, options?: {
|
|
6
5
|
database?: Knex;
|
|
7
6
|
schema?: SchemaOverview;
|
package/dist/utils/apply-diff.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { DiffKind } from '@directus/types';
|
|
1
2
|
import deepDiff from 'deep-diff';
|
|
2
3
|
import { cloneDeep, merge, set } from 'lodash-es';
|
|
3
4
|
import { flushCaches } from '../cache.js';
|
|
@@ -8,7 +9,6 @@ import { useLogger } from '../logger/index.js';
|
|
|
8
9
|
import { CollectionsService } from '../services/collections.js';
|
|
9
10
|
import { FieldsService } from '../services/fields.js';
|
|
10
11
|
import { RelationsService } from '../services/relations.js';
|
|
11
|
-
import { DiffKind } from '../types/index.js';
|
|
12
12
|
import { transaction } from '../utils/transaction.js';
|
|
13
13
|
import { getSchema } from './get-schema.js';
|
|
14
14
|
const logger = useLogger();
|
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
import type { SchemaOverview } from '@directus/types';
|
|
1
|
+
import type { SchemaOverview, Snapshot, SnapshotDiff } from '@directus/types';
|
|
2
2
|
import type { Knex } from 'knex';
|
|
3
|
-
import type { Snapshot, SnapshotDiff } from '../types/index.js';
|
|
4
3
|
export declare function applySnapshot(snapshot: Snapshot, options?: {
|
|
5
4
|
database?: Knex;
|
|
6
5
|
schema?: SchemaOverview;
|
|
@@ -42,5 +42,5 @@ export function getIPFromReq(req) {
|
|
|
42
42
|
}
|
|
43
43
|
}
|
|
44
44
|
// IP addresses starting with ::ffff: are IPv4 addresses in IPv6 format. We can strip the prefix to get back to IPv4
|
|
45
|
-
return ip?.startsWith('::ffff:') ? ip.substring(7) : ip ?? null;
|
|
45
|
+
return ip?.startsWith('::ffff:') ? ip.substring(7) : (ip ?? null);
|
|
46
46
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
+
import type { AbstractServiceOptions } from '@directus/types';
|
|
1
2
|
import { ItemsService } from '../services/index.js';
|
|
2
|
-
import type { AbstractServiceOptions } from '../types/services.js';
|
|
3
3
|
/**
|
|
4
4
|
* Select the correct service for the given collection. This allows the individual services to run
|
|
5
5
|
* their custom checks (f.e. it allows `UsersService` to prevent updating TFA secret from outside).
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import type { Snapshot, SnapshotDiff } from '
|
|
1
|
+
import type { Snapshot, SnapshotDiff } from '@directus/types';
|
|
2
2
|
export declare function getSnapshotDiff(current: Snapshot, after: Snapshot): SnapshotDiff;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import deepDiff from 'deep-diff';
|
|
2
|
-
import { DiffKind } from '
|
|
2
|
+
import { DiffKind } from '@directus/types';
|
|
3
3
|
import { sanitizeCollection, sanitizeField, sanitizeRelation } from './sanitize-schema.js';
|
|
4
4
|
export function getSnapshotDiff(current, after) {
|
|
5
5
|
const diffedSnapshot = {
|
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
import type { SchemaOverview } from '@directus/types';
|
|
1
|
+
import type { SchemaOverview, Snapshot } from '@directus/types';
|
|
2
2
|
import type { Knex } from 'knex';
|
|
3
|
-
import type { Snapshot } from '../types/index.js';
|
|
4
3
|
export declare function getSnapshot(options?: {
|
|
5
4
|
database?: Knex;
|
|
6
5
|
schema?: SchemaOverview;
|
package/dist/utils/schedule.js
CHANGED
|
@@ -13,7 +13,10 @@ export function validateCron(rule) {
|
|
|
13
13
|
export function scheduleSynchronizedJob(id, rule, cb) {
|
|
14
14
|
const clock = new SynchronizedClock(`${id}:${rule}`);
|
|
15
15
|
const job = schedule.scheduleJob(rule, async (fireDate) => {
|
|
16
|
-
const
|
|
16
|
+
const nextInvocation = job.nextInvocation();
|
|
17
|
+
if (!nextInvocation)
|
|
18
|
+
return;
|
|
19
|
+
const nextTimestamp = nextInvocation.getTime();
|
|
17
20
|
const wasSet = await clock.set(nextTimestamp);
|
|
18
21
|
if (wasSet) {
|
|
19
22
|
await cb(fireDate);
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import type { File } from '@directus/types';
|
|
2
|
-
import type { Transformation, TransformationSet } from '../types/index.js';
|
|
1
|
+
import type { File, Transformation, TransformationSet } from '@directus/types';
|
|
3
2
|
export declare function resolvePreset({ transformationParams, acceptFormat }: TransformationSet, file: File): Transformation[];
|
|
4
3
|
/**
|
|
5
4
|
* Try to extract a file format from an array of `Transformation`'s.
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import Joi from 'joi';
|
|
2
2
|
import { InvalidPayloadError } from '@directus/errors';
|
|
3
|
-
import { DiffKind } from '
|
|
3
|
+
import { DiffKind } from '@directus/types';
|
|
4
4
|
const deepDiffSchema = Joi.object({
|
|
5
5
|
kind: Joi.string()
|
|
6
6
|
.valid(...Object.values(DiffKind))
|
|
@@ -3,7 +3,7 @@ import Joi from 'joi';
|
|
|
3
3
|
import { ALIAS_TYPES } from '../constants.js';
|
|
4
4
|
import { getDatabaseClient } from '../database/index.js';
|
|
5
5
|
import { InvalidPayloadError } from '@directus/errors';
|
|
6
|
-
import { DatabaseClients } from '
|
|
6
|
+
import { DatabaseClients } from '@directus/types';
|
|
7
7
|
import { version } from 'directus/version';
|
|
8
8
|
const snapshotJoiSchema = Joi.object({
|
|
9
9
|
version: Joi.number().valid(1).required(),
|
|
@@ -1,12 +1,5 @@
|
|
|
1
|
+
import { UserIntegrityCheckFlag } from '@directus/types';
|
|
1
2
|
import { type FetchUserCountOptions } from './fetch-user-count/fetch-user-count.js';
|
|
2
|
-
export declare enum UserIntegrityCheckFlag {
|
|
3
|
-
None = 0,
|
|
4
|
-
/** Check if the number of remaining admin users is greater than 0 */
|
|
5
|
-
RemainingAdmins = 1,
|
|
6
|
-
/** Check if the number of users is within the limits */
|
|
7
|
-
UserLimits = 2,
|
|
8
|
-
All = 3
|
|
9
|
-
}
|
|
10
3
|
export interface ValidateUserCountIntegrityOptions extends Omit<FetchUserCountOptions, 'adminOnly'> {
|
|
11
4
|
flags: UserIntegrityCheckFlag;
|
|
12
5
|
}
|
|
@@ -1,16 +1,8 @@
|
|
|
1
|
+
import { UserIntegrityCheckFlag } from '@directus/types';
|
|
1
2
|
import { validateRemainingAdminCount } from '../permissions/modules/validate-remaining-admin/validate-remaining-admin-count.js';
|
|
2
3
|
import { checkUserLimits } from '../telemetry/utils/check-user-limits.js';
|
|
3
4
|
import { shouldCheckUserLimits } from '../telemetry/utils/should-check-user-limits.js';
|
|
4
5
|
import { fetchUserCount } from './fetch-user-count/fetch-user-count.js';
|
|
5
|
-
export var UserIntegrityCheckFlag;
|
|
6
|
-
(function (UserIntegrityCheckFlag) {
|
|
7
|
-
UserIntegrityCheckFlag[UserIntegrityCheckFlag["None"] = 0] = "None";
|
|
8
|
-
/** Check if the number of remaining admin users is greater than 0 */
|
|
9
|
-
UserIntegrityCheckFlag[UserIntegrityCheckFlag["RemainingAdmins"] = 1] = "RemainingAdmins";
|
|
10
|
-
/** Check if the number of users is within the limits */
|
|
11
|
-
UserIntegrityCheckFlag[UserIntegrityCheckFlag["UserLimits"] = 2] = "UserLimits";
|
|
12
|
-
UserIntegrityCheckFlag[UserIntegrityCheckFlag["All"] = 3] = "All";
|
|
13
|
-
})(UserIntegrityCheckFlag || (UserIntegrityCheckFlag = {}));
|
|
14
6
|
export async function validateUserCountIntegrity(options) {
|
|
15
7
|
const validateUserLimits = (options.flags & UserIntegrityCheckFlag.UserLimits) !== 0;
|
|
16
8
|
const validateRemainingAdminUsers = (options.flags & UserIntegrityCheckFlag.RemainingAdmins) !== 0;
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import type { Accountability } from '@directus/types';
|
|
2
|
+
import { WebSocketMessage } from '@directus/types';
|
|
2
3
|
import type { IncomingMessage, Server as httpServer } from 'http';
|
|
3
4
|
import type { RateLimiterAbstract } from 'rate-limiter-flexible';
|
|
4
5
|
import type internal from 'stream';
|
|
5
6
|
import WebSocket, { type Server } from 'ws';
|
|
6
|
-
import { WebSocketAuthMessage
|
|
7
|
+
import { WebSocketAuthMessage } from '../messages.js';
|
|
7
8
|
import type { AuthenticationState, UpgradeContext, WebSocketAuthentication, WebSocketClient } from '../types.js';
|
|
8
9
|
export default abstract class SocketController {
|
|
9
10
|
server: Server;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { useEnv } from '@directus/env';
|
|
2
2
|
import { InvalidProviderConfigError, TokenExpiredError } from '@directus/errors';
|
|
3
|
+
import { WebSocketMessage } from '@directus/types';
|
|
3
4
|
import { parseJSON, toBoolean } from '@directus/utils';
|
|
4
5
|
import cookie from 'cookie';
|
|
5
6
|
import { randomUUID } from 'node:crypto';
|
|
@@ -13,7 +14,7 @@ import { createRateLimiter } from '../../rate-limiter.js';
|
|
|
13
14
|
import { getIPFromReq } from '../../utils/get-ip-from-req.js';
|
|
14
15
|
import { authenticateConnection, authenticationSuccess } from '../authenticate.js';
|
|
15
16
|
import { WebSocketError, handleWebSocketError } from '../errors.js';
|
|
16
|
-
import { AuthMode, WebSocketAuthMessage
|
|
17
|
+
import { AuthMode, WebSocketAuthMessage } from '../messages.js';
|
|
17
18
|
import { getMessageType } from '../utils/message.js';
|
|
18
19
|
import { waitForAnyMessage, waitForMessageType } from '../utils/wait-for-message.js';
|
|
19
20
|
const TOKEN_CHECK_INTERVAL = 15 * 60 * 1000; // 15 minutes
|
|
@@ -7,7 +7,7 @@ import { getAddress } from '../../utils/get-address.js';
|
|
|
7
7
|
import { getSchema } from '../../utils/get-schema.js';
|
|
8
8
|
import { authenticateConnection } from '../authenticate.js';
|
|
9
9
|
import { handleWebSocketError } from '../errors.js';
|
|
10
|
-
import { ConnectionParams
|
|
10
|
+
import { ConnectionParams } from '../messages.js';
|
|
11
11
|
import { getMessageType } from '../utils/message.js';
|
|
12
12
|
import SocketController from './base.js';
|
|
13
13
|
import { registerWebSocketEvents } from './hooks.js';
|
|
@@ -2,7 +2,7 @@ import { useEnv } from '@directus/env';
|
|
|
2
2
|
import emitter from '../../emitter.js';
|
|
3
3
|
import { useLogger } from '../../logger/index.js';
|
|
4
4
|
import { handleWebSocketError, WebSocketError } from '../errors.js';
|
|
5
|
-
import { AuthMode
|
|
5
|
+
import { AuthMode } from '../messages.js';
|
|
6
6
|
import SocketController from './base.js';
|
|
7
7
|
const logger = useLogger();
|
|
8
8
|
export class LogsController extends SocketController {
|