@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.
Files changed (129) hide show
  1. package/dist/auth/drivers/openid.js +12 -6
  2. package/dist/cli/commands/init/index.js +2 -2
  3. package/dist/cli/commands/init/questions.d.ts +1 -1
  4. package/dist/cli/commands/schema/apply.js +1 -1
  5. package/dist/cli/index.js +1 -0
  6. package/dist/cli/utils/create-db-connection.d.ts +1 -1
  7. package/dist/cli/utils/create-env/index.d.ts +1 -1
  8. package/dist/cli/utils/drivers.d.ts +1 -1
  9. package/dist/constants.d.ts +1 -1
  10. package/dist/controllers/assets.js +1 -1
  11. package/dist/controllers/extensions.js +1 -1
  12. package/dist/database/helpers/index.d.ts +4 -4
  13. package/dist/database/helpers/schema/types.d.ts +1 -2
  14. package/dist/database/index.d.ts +1 -1
  15. package/dist/database/migrations/20210225A-add-relations-sort-field.js +1 -1
  16. package/dist/database/migrations/20240924B-populate-versioning-deltas.js +1 -1
  17. package/dist/database/run-ast/lib/apply-query/filter/get-filter-type.d.ts +2 -2
  18. package/dist/extensions/lib/get-extensions-settings.d.ts +1 -1
  19. package/dist/extensions/lib/sandbox/generate-api-extensions-sandbox-entrypoint.d.ts +1 -1
  20. package/dist/extensions/manager.d.ts +1 -2
  21. package/dist/extensions/manager.js +3 -2
  22. package/dist/flows.d.ts +1 -2
  23. package/dist/operations/throw-error/index.d.ts +7 -0
  24. package/dist/operations/throw-error/index.js +11 -0
  25. package/dist/permissions/utils/fetch-share-info.d.ts +1 -1
  26. package/dist/services/access.d.ts +1 -2
  27. package/dist/services/access.js +1 -1
  28. package/dist/services/activity.d.ts +1 -1
  29. package/dist/services/assets.d.ts +1 -3
  30. package/dist/services/authentication.d.ts +1 -2
  31. package/dist/services/collections.d.ts +3 -10
  32. package/dist/services/comments.d.ts +1 -2
  33. package/dist/services/dashboards.d.ts +1 -1
  34. package/dist/services/extensions.d.ts +2 -4
  35. package/dist/services/fields.d.ts +1 -2
  36. package/dist/services/files.d.ts +2 -3
  37. package/dist/services/flows.d.ts +1 -2
  38. package/dist/services/folders.d.ts +1 -1
  39. package/dist/services/graphql/errors/format.d.ts +1 -1
  40. package/dist/services/graphql/errors/format.js +0 -1
  41. package/dist/services/graphql/index.d.ts +1 -3
  42. package/dist/services/graphql/resolvers/system-admin.d.ts +1 -1
  43. package/dist/services/graphql/resolvers/system-global.d.ts +1 -1
  44. package/dist/services/graphql/resolvers/system.d.ts +1 -1
  45. package/dist/services/graphql/schema/get-types.d.ts +1 -1
  46. package/dist/services/graphql/schema/get-types.js +0 -1
  47. package/dist/services/import-export.d.ts +2 -4
  48. package/dist/services/items.d.ts +2 -12
  49. package/dist/services/items.js +2 -1
  50. package/dist/services/mail/index.d.ts +2 -4
  51. package/dist/services/mail/index.js +11 -5
  52. package/dist/services/meta.d.ts +1 -2
  53. package/dist/services/notifications.d.ts +1 -2
  54. package/dist/services/operations.d.ts +1 -2
  55. package/dist/services/panels.d.ts +1 -1
  56. package/dist/services/payload.d.ts +9 -17
  57. package/dist/services/payload.js +1 -1
  58. package/dist/services/permissions.d.ts +1 -3
  59. package/dist/services/policies.d.ts +1 -2
  60. package/dist/services/policies.js +1 -1
  61. package/dist/services/presets.d.ts +1 -1
  62. package/dist/services/relations.d.ts +2 -3
  63. package/dist/services/revisions.d.ts +1 -2
  64. package/dist/services/roles.d.ts +1 -2
  65. package/dist/services/roles.js +1 -1
  66. package/dist/services/schema.d.ts +1 -2
  67. package/dist/services/server.d.ts +1 -2
  68. package/dist/services/settings.d.ts +1 -1
  69. package/dist/services/shares.d.ts +1 -2
  70. package/dist/services/specifications.d.ts +1 -2
  71. package/dist/services/tfa.d.ts +1 -2
  72. package/dist/services/translations.d.ts +1 -3
  73. package/dist/services/users.d.ts +1 -2
  74. package/dist/services/users.js +1 -1
  75. package/dist/services/utils.d.ts +1 -2
  76. package/dist/services/versions.d.ts +1 -2
  77. package/dist/services/webhooks.d.ts +1 -2
  78. package/dist/services/websocket.d.ts +1 -3
  79. package/dist/types/auth.d.ts +0 -6
  80. package/dist/types/index.d.ts +0 -7
  81. package/dist/types/index.js +0 -7
  82. package/dist/utils/apply-diff.d.ts +1 -2
  83. package/dist/utils/apply-diff.js +1 -1
  84. package/dist/utils/apply-snapshot.d.ts +1 -2
  85. package/dist/utils/get-ip-from-req.js +1 -1
  86. package/dist/utils/get-service.d.ts +1 -1
  87. package/dist/utils/get-snapshot-diff.d.ts +1 -1
  88. package/dist/utils/get-snapshot-diff.js +1 -1
  89. package/dist/utils/get-snapshot.d.ts +1 -2
  90. package/dist/utils/schedule.js +4 -1
  91. package/dist/utils/should-clear-cache.d.ts +1 -1
  92. package/dist/utils/transformations.d.ts +1 -2
  93. package/dist/utils/validate-diff.d.ts +1 -1
  94. package/dist/utils/validate-diff.js +1 -1
  95. package/dist/utils/validate-snapshot.d.ts +1 -1
  96. package/dist/utils/validate-snapshot.js +1 -1
  97. package/dist/utils/validate-user-count-integrity.d.ts +1 -8
  98. package/dist/utils/validate-user-count-integrity.js +1 -9
  99. package/dist/websocket/controllers/base.d.ts +2 -1
  100. package/dist/websocket/controllers/base.js +2 -1
  101. package/dist/websocket/controllers/graphql.js +1 -1
  102. package/dist/websocket/controllers/logs.js +1 -1
  103. package/dist/websocket/controllers/rest.d.ts +1 -1
  104. package/dist/websocket/controllers/rest.js +1 -1
  105. package/dist/websocket/errors.d.ts +1 -1
  106. package/dist/websocket/handlers/heartbeat.d.ts +1 -1
  107. package/dist/websocket/handlers/heartbeat.js +1 -1
  108. package/dist/websocket/messages.d.ts +57 -308
  109. package/dist/websocket/messages.js +5 -10
  110. package/dist/websocket/utils/items.d.ts +1 -1
  111. package/dist/websocket/utils/wait-for-message.d.ts +1 -1
  112. package/dist/websocket/utils/wait-for-message.js +1 -1
  113. package/package.json +80 -81
  114. package/dist/extensions/types.d.ts +0 -19
  115. package/dist/extensions/types.js +0 -1
  116. package/dist/types/assets.d.ts +0 -22
  117. package/dist/types/assets.js +0 -51
  118. package/dist/types/database.d.ts +0 -3
  119. package/dist/types/database.js +0 -1
  120. package/dist/types/graphql.d.ts +0 -14
  121. package/dist/types/graphql.js +0 -1
  122. package/dist/types/items.d.ts +0 -52
  123. package/dist/types/items.js +0 -1
  124. package/dist/types/services.d.ts +0 -22
  125. package/dist/types/services.js +0 -1
  126. package/dist/types/snapshot.d.ts +0 -55
  127. package/dist/types/snapshot.js +0 -13
  128. package/dist/types/webhooks.d.ts +0 -15
  129. package/dist/types/webhooks.js +0 -1
@@ -32,8 +32,9 @@ export class OpenIDAuthDriver extends LocalAuthDriver {
32
32
  super(options, config);
33
33
  const env = useEnv();
34
34
  const logger = useLogger();
35
- const { issuerUrl, clientId, clientSecret, provider, issuerDiscoveryMustSucceed } = config;
36
- if (!issuerUrl || !clientId || !clientSecret || !provider) {
35
+ const { issuerUrl, clientId, clientSecret, clientPrivateKeys, clientTokenEndpointAuthMethod, provider, issuerDiscoveryMustSucceed, } = config;
36
+ const isPrivateKeyJwtAuthMethod = clientTokenEndpointAuthMethod === 'private_key_jwt';
37
+ if (!issuerUrl || !clientId || !(clientSecret || (isPrivateKeyJwtAuthMethod && clientPrivateKeys)) || !provider) {
37
38
  logger.error('Invalid provider config');
38
39
  throw new InvalidProviderConfigError({ provider });
39
40
  }
@@ -66,7 +67,8 @@ export class OpenIDAuthDriver extends LocalAuthDriver {
66
67
  if (this.client)
67
68
  return this.client;
68
69
  const logger = useLogger();
69
- const { issuerUrl, clientId, clientSecret, provider } = this.config;
70
+ const { issuerUrl, clientId, clientSecret, clientPrivateKeys, clientTokenEndpointAuthMethod, provider } = this.config;
71
+ const isPrivateKeyJwtAuthMethod = clientTokenEndpointAuthMethod === 'private_key_jwt';
70
72
  // extract client http overrides/options
71
73
  const clientHttpOptions = getConfigFromEnv(`AUTH_${provider.toUpperCase()}_CLIENT_HTTP_`);
72
74
  if (clientHttpOptions) {
@@ -87,17 +89,21 @@ export class OpenIDAuthDriver extends LocalAuthDriver {
87
89
  }
88
90
  // extract client overrides/options excluding CLIENT_ID and CLIENT_SECRET as they are passed directly
89
91
  const clientOptionsOverrides = getConfigFromEnv(`AUTH_${provider.toUpperCase()}_CLIENT_`, {
90
- omitKey: [`AUTH_${provider.toUpperCase()}_CLIENT_ID`, `AUTH_${provider.toUpperCase()}_CLIENT_SECRET`],
92
+ omitKey: [
93
+ `AUTH_${provider.toUpperCase()}_CLIENT_ID`,
94
+ `AUTH_${provider.toUpperCase()}_CLIENT_SECRET`,
95
+ `AUTH_${provider.toUpperCase()}_CLIENT_PRIVATE_KEYS`,
96
+ ],
91
97
  omitPrefix: [`AUTH_${provider.toUpperCase()}_CLIENT_HTTP_`],
92
98
  type: 'underscore',
93
99
  });
94
100
  const client = new issuer.Client({
95
101
  client_id: clientId,
96
- client_secret: clientSecret,
102
+ ...(!isPrivateKeyJwtAuthMethod && { client_secret: clientSecret }),
97
103
  redirect_uris: [this.redirectUrl],
98
104
  response_types: ['code'],
99
105
  ...clientOptionsOverrides,
100
- });
106
+ }, isPrivateKeyJwtAuthMethod ? { keys: clientPrivateKeys } : undefined);
101
107
  if (clientHttpOptions) {
102
108
  client[custom.http_options] = (_, options) => {
103
109
  return {
@@ -60,7 +60,7 @@ export default async function init() {
60
60
  default: 'admin@example.com',
61
61
  validate: (input) => {
62
62
  const emailSchema = Joi.string().email().required();
63
- const { error } = emailSchema.validate(input);
63
+ const { error } = emailSchema.validate(input.trim());
64
64
  if (error)
65
65
  throw new Error('The email entered is not a valid email address!');
66
66
  return true;
@@ -87,7 +87,7 @@ export default async function init() {
87
87
  await db('directus_users').insert({
88
88
  ...defaultAdminUser,
89
89
  id: randomUUID(),
90
- email: firstUser.email,
90
+ email: firstUser.email.trim(),
91
91
  password: firstUser.password,
92
92
  role,
93
93
  });
@@ -1,4 +1,4 @@
1
- import type { Driver } from '../../../types/index.js';
1
+ import type { Driver } from '@directus/types';
2
2
  export declare const databaseQuestions: {
3
3
  sqlite3: (({ filepath }: {
4
4
  filepath: string;
@@ -1,4 +1,5 @@
1
1
  import { parseJSON } from '@directus/utils';
2
+ import { DiffKind } from '@directus/types';
2
3
  import chalk from 'chalk';
3
4
  import { promises as fs } from 'fs';
4
5
  import inquirer from 'inquirer';
@@ -6,7 +7,6 @@ import { load as loadYaml } from 'js-yaml';
6
7
  import path from 'path';
7
8
  import getDatabase, { isInstalled, validateDatabaseConnection } from '../../../database/index.js';
8
9
  import { useLogger } from '../../../logger/index.js';
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
12
  import { getSnapshotDiff } from '../../../utils/get-snapshot-diff.js';
package/dist/cli/index.js CHANGED
@@ -17,6 +17,7 @@ import usersPasswd from './commands/users/passwd.js';
17
17
  import { loadExtensions } from './load-extensions.js';
18
18
  export async function createCli() {
19
19
  const program = new Command();
20
+ program.allowExcessArguments();
20
21
  await loadExtensions();
21
22
  await emitter.emitInit('cli.before', { program });
22
23
  program.name('directus').usage('[command] [options]');
@@ -1,5 +1,5 @@
1
1
  import type { Knex } from 'knex';
2
- import type { Driver } from '../../types/index.js';
2
+ import type { Driver } from '@directus/types';
3
3
  export type Credentials = {
4
4
  filename?: string;
5
5
  host?: string;
@@ -1,3 +1,3 @@
1
- import type { Driver } from '../../../types/index.js';
1
+ import type { Driver } from '@directus/types';
2
2
  import type { Credentials } from '../create-db-connection.js';
3
3
  export default function createEnv(client: Driver, credentials: Credentials, directory: string): Promise<void>;
@@ -1,3 +1,3 @@
1
- import type { Driver } from '../../types/index.js';
1
+ import type { Driver } from '@directus/types';
2
2
  export declare const drivers: Record<Driver, string>;
3
3
  export declare function getDriverForClient(client: string): Driver | null;
@@ -1,5 +1,5 @@
1
1
  import type { CookieOptions } from 'express';
2
- import type { TransformationParams } from './types/index.js';
2
+ import type { TransformationParams } from '@directus/types';
3
3
  export declare const SYSTEM_ASSET_ALLOW_LIST: TransformationParams[];
4
4
  export declare const ASSET_TRANSFORM_QUERY_KEYS: readonly ["key", "transforms", "width", "height", "format", "fit", "quality", "withoutEnlargement", "focal_point_x", "focal_point_y"];
5
5
  export declare const FILTER_VARIABLES: string[];
@@ -1,5 +1,6 @@
1
1
  import { useEnv } from '@directus/env';
2
2
  import { InvalidQueryError, RangeNotSatisfiableError } from '@directus/errors';
3
+ import { TransformationMethods } from '@directus/types';
3
4
  import { parseJSON } from '@directus/utils';
4
5
  import contentDisposition from 'content-disposition';
5
6
  import { Router } from 'express';
@@ -10,7 +11,6 @@ import { useLogger } from '../logger/index.js';
10
11
  import useCollection from '../middleware/use-collection.js';
11
12
  import { AssetsService } from '../services/assets.js';
12
13
  import { PayloadService } from '../services/payload.js';
13
- import { TransformationMethods } from '../types/assets.js';
14
14
  import asyncHandler from '../utils/async-handler.js';
15
15
  import { getCacheControlHeader } from '../utils/get-cache-headers.js';
16
16
  import { getConfigFromEnv } from '../utils/get-config-from-env.js';
@@ -1,6 +1,6 @@
1
1
  import { useEnv } from '@directus/env';
2
2
  import { ErrorCode, ForbiddenError, isDirectusError, RouteNotFoundError } from '@directus/errors';
3
- import { EXTENSION_TYPES } from '@directus/extensions';
3
+ import { EXTENSION_TYPES } from '@directus/constants';
4
4
  import { account, describe, list, } from '@directus/extensions-registry';
5
5
  import { isIn } from '@directus/utils';
6
6
  import express from 'express';
@@ -9,11 +9,11 @@ import * as schemaHelpers from './schema/index.js';
9
9
  import * as sequenceHelpers from './sequence/index.js';
10
10
  export declare function getHelpers(database: Knex): {
11
11
  date: dateHelpers.postgres | dateHelpers.oracle | dateHelpers.mysql | dateHelpers.mssql | dateHelpers.sqlite;
12
- st: geometryHelpers.postgres | geometryHelpers.mssql | geometryHelpers.mysql | geometryHelpers.sqlite | geometryHelpers.oracle | geometryHelpers.redshift;
13
- schema: schemaHelpers.cockroachdb | schemaHelpers.mssql | schemaHelpers.mysql | schemaHelpers.postgres | schemaHelpers.sqlite | schemaHelpers.oracle | schemaHelpers.redshift;
12
+ st: geometryHelpers.mysql | geometryHelpers.postgres | geometryHelpers.sqlite | geometryHelpers.oracle | geometryHelpers.mssql | geometryHelpers.redshift;
13
+ schema: schemaHelpers.mysql | schemaHelpers.postgres | schemaHelpers.cockroachdb | schemaHelpers.sqlite | schemaHelpers.oracle | schemaHelpers.mssql | schemaHelpers.redshift;
14
14
  sequence: sequenceHelpers.mysql | sequenceHelpers.postgres;
15
- number: numberHelpers.cockroachdb | numberHelpers.mssql | numberHelpers.postgres | numberHelpers.sqlite | numberHelpers.oracle;
15
+ number: numberHelpers.cockroachdb | numberHelpers.postgres | numberHelpers.sqlite | numberHelpers.oracle | numberHelpers.mssql;
16
16
  capabilities: capabilitiesHelpers.postgres | capabilitiesHelpers.oracle | capabilitiesHelpers.mysql;
17
17
  };
18
- export declare function getFunctions(database: Knex, schema: SchemaOverview): fnHelpers.postgres | fnHelpers.mssql | fnHelpers.mysql | fnHelpers.sqlite | fnHelpers.oracle;
18
+ export declare function getFunctions(database: Knex, schema: SchemaOverview): fnHelpers.mysql | fnHelpers.postgres | fnHelpers.sqlite | fnHelpers.oracle | fnHelpers.mssql;
19
19
  export type Helpers = ReturnType<typeof getHelpers>;
@@ -1,8 +1,7 @@
1
1
  import type { KNEX_TYPES } from '@directus/constants';
2
2
  import type { Column } from '@directus/schema';
3
- import type { Field, RawField, Relation, Type } from '@directus/types';
3
+ import type { DatabaseClient, Field, RawField, Relation, Type } from '@directus/types';
4
4
  import type { Knex } from 'knex';
5
- import type { DatabaseClient } from '../../../types/index.js';
6
5
  import { DatabaseHelper } from '../types.js';
7
6
  export type Options = {
8
7
  nullable?: boolean;
@@ -1,6 +1,6 @@
1
1
  import type { SchemaInspector } from '@directus/schema';
2
+ import type { DatabaseClient } from '@directus/types';
2
3
  import type { Knex } from 'knex';
3
- import type { DatabaseClient } from '../types/index.js';
4
4
  export default getDatabase;
5
5
  export declare function getDatabase(): Knex;
6
6
  export declare function getSchemaInspector(database?: Knex): SchemaInspector;
@@ -10,7 +10,7 @@ export async function up(knex) {
10
10
  .from('directus_fields')
11
11
  .whereIn('interface', ['one-to-many', 'm2a-builder', 'many-to-many']);
12
12
  for (const field of fieldsWithSort) {
13
- const options = typeof field.options === 'string' ? parseJSON(field.options) : field.options ?? {};
13
+ const options = typeof field.options === 'string' ? parseJSON(field.options) : (field.options ?? {});
14
14
  if ('sortField' in options) {
15
15
  await knex('directus_relations')
16
16
  .update({
@@ -16,7 +16,7 @@ export async function up(knex) {
16
16
  .from('directus_revisions')
17
17
  .where('version', '=', missingDeltaVersion.id)
18
18
  .orderBy('id');
19
- const deltas = revisions.map((revision) => typeof revision.delta === 'string' ? parseJSON(revision.delta) : revision.delta ?? {});
19
+ const deltas = revisions.map((revision) => typeof revision.delta === 'string' ? parseJSON(revision.delta) : (revision.delta ?? {}));
20
20
  const consolidatedDelta = assign({}, ...deltas);
21
21
  await trx('directus_versions')
22
22
  .update({
@@ -1,8 +1,8 @@
1
1
  import type { FieldOverview } from '@directus/types';
2
2
  export declare function getFilterType(fields: Record<string, FieldOverview>, key: string, collection?: string): {
3
- type: "string" | "boolean" | "json" | "binary" | "time" | "text" | "integer" | "float" | "alias" | "uuid" | "dateTime" | "timestamp" | "bigInteger" | "date" | "decimal" | "hash" | "csv" | "geometry" | "geometry.Point" | "geometry.LineString" | "geometry.Polygon" | "geometry.MultiPoint" | "geometry.MultiLineString" | "geometry.MultiPolygon" | "unknown";
3
+ type: "string" | "boolean" | "json" | "text" | "integer" | "float" | "alias" | "uuid" | "binary" | "time" | "dateTime" | "timestamp" | "bigInteger" | "date" | "decimal" | "hash" | "csv" | "geometry" | "geometry.Point" | "geometry.LineString" | "geometry.Polygon" | "geometry.MultiPoint" | "geometry.MultiLineString" | "geometry.MultiPolygon" | "unknown";
4
4
  special?: never;
5
5
  } | {
6
- type: "string" | "boolean" | "json" | "binary" | "time" | "text" | "integer" | "float" | "alias" | "uuid" | "dateTime" | "timestamp" | "bigInteger" | "date" | "decimal" | "hash" | "csv" | "geometry" | "geometry.Point" | "geometry.LineString" | "geometry.Polygon" | "geometry.MultiPoint" | "geometry.MultiLineString" | "geometry.MultiPolygon" | "unknown";
6
+ type: "string" | "boolean" | "json" | "text" | "integer" | "float" | "alias" | "uuid" | "binary" | "time" | "dateTime" | "timestamp" | "bigInteger" | "date" | "decimal" | "hash" | "csv" | "geometry" | "geometry.Point" | "geometry.LineString" | "geometry.Polygon" | "geometry.MultiPoint" | "geometry.MultiLineString" | "geometry.MultiPolygon" | "unknown";
7
7
  special: string[];
8
8
  };
@@ -1,4 +1,4 @@
1
- import type { Extension, ExtensionSettings } from '@directus/extensions';
1
+ import type { Extension, ExtensionSettings } from '@directus/types';
2
2
  /**
3
3
  * Loads stored settings for all extensions. Creates empty new rows in extensions tables for
4
4
  * extensions that don't have settings yet, and remove any settings for extensions that are no
@@ -1,4 +1,4 @@
1
- import type { ApiExtensionType, HybridExtensionType } from '@directus/extensions';
1
+ import type { ApiExtensionType, HybridExtensionType } from '@directus/types';
2
2
  import type { Router } from 'express';
3
3
  /**
4
4
  * Generate the JS to run in the isolate to create the extension's entrypoint to the host
@@ -1,6 +1,5 @@
1
- import type { Extension } from '@directus/extensions';
1
+ import type { Extension, ExtensionManagerOptions } from '@directus/types';
2
2
  import { Router } from 'express';
3
- import type { ExtensionManagerOptions } from './types.js';
4
3
  import type { ReadStream } from 'node:fs';
5
4
  export declare class ExtensionManager {
6
5
  private options;
@@ -1,5 +1,6 @@
1
1
  import { useEnv } from '@directus/env';
2
- import { APP_SHARED_DEPS, HYBRID_EXTENSION_TYPES } from '@directus/extensions';
2
+ import { APP_SHARED_DEPS } from '@directus/extensions';
3
+ import { HYBRID_EXTENSION_TYPES } from '@directus/constants';
3
4
  import { generateExtensionsEntrypoint } from '@directus/extensions/node';
4
5
  import { isTypeIn, toBoolean } from '@directus/utils';
5
6
  import { pathToRelativeUrl, processId } from '@directus/utils/node';
@@ -382,7 +383,7 @@ export class ExtensionManager {
382
383
  const entrypoint = generateExtensionsEntrypoint({ module: this.moduleExtensions, registry: this.registryExtensions, local: this.localExtensions }, this.extensionsSettings);
383
384
  try {
384
385
  /** Opt In for now. Should be @deprecated later to always use rolldown! */
385
- const rollDirection = env['EXTENSIONS_ROLLDOWN'] ?? false ? rolldown : rollup;
386
+ const rollDirection = (env['EXTENSIONS_ROLLDOWN'] ?? false) ? rolldown : rollup;
386
387
  const bundle = await rollDirection({
387
388
  input: 'entry',
388
389
  external: Object.values(sharedDepsMapping),
package/dist/flows.d.ts CHANGED
@@ -1,5 +1,4 @@
1
- import type { OperationHandler } from '@directus/extensions';
2
- import type { Accountability, SchemaOverview } from '@directus/types';
1
+ import type { Accountability, SchemaOverview, OperationHandler } from '@directus/types';
3
2
  export declare function getFlowManager(): FlowManager;
4
3
  declare class FlowManager {
5
4
  private isLoaded;
@@ -0,0 +1,7 @@
1
+ type Options = {
2
+ code: string;
3
+ status: string;
4
+ message: string;
5
+ };
6
+ declare const _default: import("@directus/extensions").OperationApiConfig<Options>;
7
+ export default _default;
@@ -0,0 +1,11 @@
1
+ import { createError, InternalServerError } from '@directus/errors';
2
+ import { defineOperationApi } from '@directus/extensions';
3
+ const FALLBACK_ERROR = new InternalServerError();
4
+ export default defineOperationApi({
5
+ id: 'throw-error',
6
+ handler: ({ code, status, message }) => {
7
+ const statusCode = parseInt(status);
8
+ const error = createError(code ?? FALLBACK_ERROR.code, message ?? FALLBACK_ERROR.message, isNaN(statusCode) ? FALLBACK_ERROR.status : statusCode);
9
+ throw new error();
10
+ },
11
+ });
@@ -1,4 +1,4 @@
1
- import type { AbstractServiceOptions } from '../../types/services.js';
1
+ import type { AbstractServiceOptions } from '@directus/types';
2
2
  export interface ShareInfo {
3
3
  collection: string;
4
4
  item: string;
@@ -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 AccessService extends ItemsService {
5
4
  constructor(options: AbstractServiceOptions);
@@ -1,5 +1,5 @@
1
+ import { UserIntegrityCheckFlag } from '@directus/types';
1
2
  import { clearSystemCache } from '../cache.js';
2
- import { UserIntegrityCheckFlag } from '../utils/validate-user-count-integrity.js';
3
3
  import { ItemsService } from './items.js';
4
4
  export class AccessService extends ItemsService {
5
5
  constructor(options) {
@@ -1,4 +1,4 @@
1
- import type { AbstractServiceOptions } from '../types/index.js';
1
+ import type { AbstractServiceOptions } from '@directus/types';
2
2
  import { ItemsService } from './items.js';
3
3
  export declare class ActivityService extends ItemsService {
4
4
  constructor(options: AbstractServiceOptions);
@@ -1,8 +1,6 @@
1
- import type { Range, Stat } from '@directus/storage';
2
- import type { Accountability, SchemaOverview } from '@directus/types';
1
+ import type { AbstractServiceOptions, Accountability, Range, Stat, SchemaOverview, TransformationSet } from '@directus/types';
3
2
  import type { Knex } from 'knex';
4
3
  import type { Readable } from 'node:stream';
5
- import type { AbstractServiceOptions, TransformationSet } from '../types/index.js';
6
4
  import { FilesService } from './files.js';
7
5
  export declare class AssetsService {
8
6
  knex: Knex;
@@ -1,6 +1,5 @@
1
- import type { Accountability, SchemaOverview } from '@directus/types';
1
+ import type { AbstractServiceOptions, Accountability, LoginResult, SchemaOverview } from '@directus/types';
2
2
  import type { Knex } from 'knex';
3
- import type { AbstractServiceOptions, LoginResult } from '../types/index.js';
4
3
  import { ActivityService } from './activity.js';
5
4
  export declare class AuthenticationService {
6
5
  knex: Knex;
@@ -1,16 +1,9 @@
1
- import type { SchemaInspector, Table } from '@directus/schema';
2
- import { type BaseCollectionMeta } from '@directus/system-data';
3
- import type { Accountability, RawField, SchemaOverview } from '@directus/types';
1
+ import type { SchemaInspector } from '@directus/schema';
2
+ import type { AbstractServiceOptions, Accountability, MutationOptions, SchemaOverview, RawCollection } from '@directus/types';
4
3
  import type Keyv from 'keyv';
5
4
  import type { Knex } from 'knex';
6
5
  import type { Helpers } from '../database/helpers/index.js';
7
- import type { AbstractServiceOptions, Collection, MutationOptions } from '../types/index.js';
8
- export type RawCollection = {
9
- collection: string;
10
- fields?: RawField[];
11
- schema?: Partial<Table> | null;
12
- meta?: Partial<BaseCollectionMeta> | null;
13
- };
6
+ import type { Collection } from '../types/index.js';
14
7
  export declare class CollectionsService {
15
8
  knex: Knex;
16
9
  helpers: Helpers;
@@ -1,5 +1,4 @@
1
- import type { Comment, PrimaryKey } from '@directus/types';
2
- import type { AbstractServiceOptions, MutationOptions } from '../types/index.js';
1
+ import type { AbstractServiceOptions, Comment, MutationOptions, PrimaryKey } from '@directus/types';
3
2
  import { ItemsService } from './items.js';
4
3
  import { NotificationsService } from './notifications.js';
5
4
  import { UsersService } from './users.js';
@@ -1,4 +1,4 @@
1
- import type { AbstractServiceOptions } from '../types/index.js';
1
+ import type { AbstractServiceOptions } from '@directus/types';
2
2
  import { ItemsService } from './items.js';
3
3
  export declare class DashboardsService extends ItemsService {
4
4
  constructor(options: AbstractServiceOptions);
@@ -1,8 +1,6 @@
1
- import type { ApiOutput, ExtensionSettings } from '@directus/extensions';
2
- import type { Accountability, DeepPartial, SchemaOverview } from '@directus/types';
1
+ import type { ApiOutput, ExtensionSettings, ExtensionManager } from '@directus/types';
2
+ import type { AbstractServiceOptions, Accountability, DeepPartial, SchemaOverview } from '@directus/types';
3
3
  import type { Knex } from 'knex';
4
- import type { ExtensionManager } from '../extensions/manager.js';
5
- import type { AbstractServiceOptions } from '../types/index.js';
6
4
  import { ItemsService } from './items.js';
7
5
  export declare class ExtensionReadError extends Error {
8
6
  originalError: unknown;
@@ -1,9 +1,8 @@
1
1
  import type { Column, SchemaInspector } from '@directus/schema';
2
- import type { Accountability, Field, RawField, SchemaOverview, Type } from '@directus/types';
2
+ import type { AbstractServiceOptions, Accountability, Field, MutationOptions, RawField, SchemaOverview, Type } 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 type { AbstractServiceOptions, MutationOptions } from '../types/index.js';
7
6
  import { ItemsService } from './items.js';
8
7
  import { PayloadService } from './payload.js';
9
8
  export declare class FieldsService {
@@ -1,7 +1,6 @@
1
- import type { BusboyFileStream, File, PrimaryKey, Query } from '@directus/types';
1
+ import type { AbstractServiceOptions, BusboyFileStream, File, MutationOptions, PrimaryKey, Query, QueryOptions } from '@directus/types';
2
2
  import type { Readable } from 'node:stream';
3
- import type { AbstractServiceOptions, MutationOptions } from '../types/index.js';
4
- import { ItemsService, type QueryOptions } from './items.js';
3
+ import { ItemsService } from './items.js';
5
4
  export declare class FilesService extends ItemsService<File> {
6
5
  constructor(options: AbstractServiceOptions);
7
6
  /**
@@ -1,5 +1,4 @@
1
- import type { FlowRaw, Item, PrimaryKey } from '@directus/types';
2
- import type { AbstractServiceOptions, MutationOptions } from '../types/index.js';
1
+ import type { AbstractServiceOptions, FlowRaw, Item, MutationOptions, PrimaryKey } from '@directus/types';
3
2
  import { ItemsService } from './items.js';
4
3
  export declare class FlowsService extends ItemsService<FlowRaw> {
5
4
  constructor(options: AbstractServiceOptions);
@@ -1,4 +1,4 @@
1
- import type { AbstractServiceOptions } from '../types/index.js';
1
+ import type { AbstractServiceOptions } from '@directus/types';
2
2
  import { ItemsService } from './items.js';
3
3
  export declare class FoldersService extends ItemsService {
4
4
  constructor(options: AbstractServiceOptions);
@@ -1,4 +1,4 @@
1
- import { type DirectusError } from '@directus/errors';
1
+ import type { DirectusError } from '@directus/errors';
2
2
  import { GraphQLError } from 'graphql';
3
3
  /**
4
4
  * Convert Directus-Exception into a GraphQL format, so it can be returned by GraphQL properly.
@@ -1,4 +1,3 @@
1
- import {} from '@directus/errors';
2
1
  import { GraphQLError } from 'graphql';
3
2
  import { set } from 'lodash-es';
4
3
  /**
@@ -1,8 +1,6 @@
1
- import type { Accountability, Item, Query, SchemaOverview } from '@directus/types';
1
+ import type { AbstractServiceOptions, Accountability, GraphQLParams, GQLScope, Item, Query, SchemaOverview } from '@directus/types';
2
2
  import type { FormattedExecutionResult, GraphQLSchema } from 'graphql';
3
3
  import type { Knex } from 'knex';
4
- import type { AbstractServiceOptions, GraphQLParams } from '../../types/index.js';
5
- export type GQLScope = 'items' | 'system';
6
4
  export declare class GraphQLService {
7
5
  accountability: Accountability | null;
8
6
  knex: Knex;
@@ -1,5 +1,5 @@
1
+ import type { GraphQLParams } from '@directus/types';
1
2
  import { SchemaComposer } from 'graphql-compose';
2
- import type { GraphQLParams } from '../../../types/index.js';
3
3
  import { GraphQLService } from '../index.js';
4
4
  import type { Schema } from '../schema/index.js';
5
5
  export declare function resolveSystemAdmin(gql: GraphQLService, schema: Schema, schemaComposer: SchemaComposer<GraphQLParams['contextValue']>): void;
@@ -1,5 +1,5 @@
1
+ import type { GraphQLParams } from '@directus/types';
1
2
  import { SchemaComposer } from 'graphql-compose';
2
- import type { GraphQLParams } from '../../../types/index.js';
3
3
  import { GraphQLService } from '../index.js';
4
4
  /**
5
5
  * Globally available mutations
@@ -1,5 +1,5 @@
1
+ import type { GraphQLParams } from '@directus/types';
1
2
  import { SchemaComposer } from 'graphql-compose';
2
- import type { GraphQLParams } from '../../../types/index.js';
3
3
  import { GraphQLService } from '../index.js';
4
4
  import { type CollectionTypes, type Schema } from '../schema/index.js';
5
5
  export declare function injectSystemResolvers(gql: GraphQLService, schemaComposer: SchemaComposer<GraphQLParams['contextValue']>, { CreateCollectionTypes, ReadCollectionTypes, UpdateCollectionTypes }: CollectionTypes, schema: Schema): SchemaComposer<any>;
@@ -1,6 +1,6 @@
1
1
  import type { SchemaComposer } from 'graphql-compose';
2
2
  import { ObjectTypeComposer } from 'graphql-compose';
3
- import { type GQLScope } from '../index.js';
3
+ import type { GQLScope } from '@directus/types';
4
4
  import { type InconsistentFields, type Schema } from './index.js';
5
5
  /**
6
6
  * Construct an object of types for every collection, using the permitted fields per action type
@@ -3,7 +3,6 @@ import { GraphQLJSON, ObjectTypeComposer } from 'graphql-compose';
3
3
  import { mapKeys, pick } from 'lodash-es';
4
4
  import { GENERATE_SPECIAL } from '../../../constants.js';
5
5
  import { getGraphQLType } from '../../../utils/get-graphql-type.js';
6
- import {} from '../index.js';
7
6
  import { SYSTEM_DENY_LIST } from './index.js';
8
7
  /**
9
8
  * Construct an object of types for every collection, using the permitted fields per action type
@@ -1,8 +1,7 @@
1
- import type { Accountability, File, Query, SchemaOverview } from '@directus/types';
1
+ import type { AbstractServiceOptions, Accountability, ExportFormat, File, Query, SchemaOverview } from '@directus/types';
2
2
  import type { Knex } from 'knex';
3
3
  import type { Readable } from 'node:stream';
4
- import type { AbstractServiceOptions, FunctionFieldNode, FieldNode, NestedCollectionNode } from '../types/index.js';
5
- type ExportFormat = 'csv' | 'json' | 'xml' | 'yaml';
4
+ import type { FunctionFieldNode, FieldNode, NestedCollectionNode } from '../types/index.js';
6
5
  export declare class ImportService {
7
6
  knex: Knex;
8
7
  accountability: Accountability | null;
@@ -35,4 +34,3 @@ export declare class ExportService {
35
34
  }): string;
36
35
  }
37
36
  export declare function getHeadingsForCsvExport(nodes: (NestedCollectionNode | FieldNode | FunctionFieldNode)[] | undefined, prefix?: string): string[];
38
- export {};
@@ -1,17 +1,7 @@
1
- import type { Accountability, Item as AnyItem, PermissionsAction, PrimaryKey, Query, SchemaOverview } from '@directus/types';
1
+ import type { AbstractService, AbstractServiceOptions, Accountability, Item as AnyItem, MutationTracker, MutationOptions, PrimaryKey, Query, QueryOptions, SchemaOverview } from '@directus/types';
2
2
  import type Keyv from 'keyv';
3
3
  import type { Knex } from 'knex';
4
- import type { AbstractService, AbstractServiceOptions, MutationOptions } from '../types/index.js';
5
- export type QueryOptions = {
6
- stripNonRequested?: boolean;
7
- permissionsAction?: PermissionsAction;
8
- emitEvents?: boolean;
9
- };
10
- export type MutationTracker = {
11
- trackMutations: (count: number) => void;
12
- getCount: () => number;
13
- };
14
- export declare class ItemsService<Item extends AnyItem = AnyItem, Collection extends string = string> implements AbstractService {
4
+ export declare class ItemsService<Item extends AnyItem = AnyItem, Collection extends string = string> implements AbstractService<Item> {
15
5
  collection: Collection;
16
6
  knex: Knex;
17
7
  accountability: Accountability | null;
@@ -2,6 +2,7 @@ import { Action } from '@directus/constants';
2
2
  import { useEnv } from '@directus/env';
3
3
  import { ErrorCode, ForbiddenError, InvalidPayloadError, isDirectusError } from '@directus/errors';
4
4
  import { isSystemCollection } from '@directus/system-data';
5
+ import { UserIntegrityCheckFlag } from '@directus/types';
5
6
  import { assign, clone, cloneDeep, omit, pick, without } from 'lodash-es';
6
7
  import { getCache } from '../cache.js';
7
8
  import { translateDatabaseError } from '../database/errors/translate.js';
@@ -16,7 +17,7 @@ import { validateAccess } from '../permissions/modules/validate-access/validate-
16
17
  import { shouldClearCache } from '../utils/should-clear-cache.js';
17
18
  import { transaction } from '../utils/transaction.js';
18
19
  import { validateKeys } from '../utils/validate-keys.js';
19
- import { UserIntegrityCheckFlag, validateUserCountIntegrity } from '../utils/validate-user-count-integrity.js';
20
+ import { validateUserCountIntegrity } from '../utils/validate-user-count-integrity.js';
20
21
  import { PayloadService } from './payload.js';
21
22
  const env = useEnv();
22
23
  export class ItemsService {
@@ -1,9 +1,7 @@
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 { SendMailOptions, Transporter } from 'nodemailer';
4
- import type { AbstractServiceOptions } from '../../types/index.js';
5
- export type EmailOptions = Omit<SendMailOptions, 'from'> & {
6
- from?: string;
4
+ export type EmailOptions = SendMailOptions & {
7
5
  template?: {
8
6
  name: string;
9
7
  data: Record<string, any>;