@directus/api 32.2.0 → 33.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.
Files changed (201) hide show
  1. package/dist/ai/chat/lib/create-ui-stream.d.ts +1 -1
  2. package/dist/ai/tools/assets/index.js +1 -1
  3. package/dist/ai/tools/collections/index.js +2 -2
  4. package/dist/ai/tools/fields/index.js +2 -2
  5. package/dist/ai/tools/files/index.js +1 -1
  6. package/dist/ai/tools/flows/index.js +1 -1
  7. package/dist/ai/tools/folders/index.js +1 -1
  8. package/dist/ai/tools/items/index.js +2 -2
  9. package/dist/ai/tools/relations/index.js +1 -1
  10. package/dist/ai/tools/trigger-flow/index.js +1 -1
  11. package/dist/app.js +8 -8
  12. package/dist/auth/drivers/ldap.js +2 -2
  13. package/dist/auth/drivers/local.js +1 -1
  14. package/dist/auth/drivers/oauth2.d.ts +1 -2
  15. package/dist/auth/drivers/oauth2.js +22 -17
  16. package/dist/auth/drivers/openid.d.ts +1 -2
  17. package/dist/auth/drivers/openid.js +18 -13
  18. package/dist/auth/drivers/saml.js +3 -3
  19. package/dist/auth/utils/generate-callback-url.d.ts +11 -0
  20. package/dist/auth/utils/generate-callback-url.js +40 -0
  21. package/dist/auth/utils/is-login-redirect-allowed.d.ts +7 -0
  22. package/dist/{utils → auth/utils}/is-login-redirect-allowed.js +12 -9
  23. package/dist/cache.js +2 -2
  24. package/dist/cli/commands/bootstrap/index.js +2 -2
  25. package/dist/cli/commands/database/install.js +1 -1
  26. package/dist/cli/commands/database/migrate.js +1 -1
  27. package/dist/cli/commands/init/index.js +2 -2
  28. package/dist/cli/commands/roles/create.js +4 -4
  29. package/dist/cli/commands/schema/apply.js +3 -3
  30. package/dist/cli/commands/schema/snapshot.js +1 -1
  31. package/dist/cli/utils/create-db-connection.d.ts +1 -1
  32. package/dist/cli/utils/create-db-connection.js +1 -1
  33. package/dist/cli/utils/create-env/index.js +1 -1
  34. package/dist/constants.d.ts +7 -3
  35. package/dist/constants.js +7 -3
  36. package/dist/controllers/access.js +1 -1
  37. package/dist/controllers/assets.js +1 -1
  38. package/dist/controllers/extensions.js +1 -1
  39. package/dist/controllers/fields.js +2 -2
  40. package/dist/controllers/files.js +1 -1
  41. package/dist/controllers/items.js +1 -1
  42. package/dist/controllers/not-found.js +1 -1
  43. package/dist/controllers/relations.js +1 -1
  44. package/dist/database/errors/dialects/mysql.d.ts +1 -1
  45. package/dist/database/errors/dialects/postgres.d.ts +1 -1
  46. package/dist/database/errors/dialects/sqlite.d.ts +1 -1
  47. package/dist/database/errors/translate.d.ts +1 -1
  48. package/dist/database/errors/translate.js +1 -1
  49. package/dist/database/helpers/date/dialects/mssql.js +1 -1
  50. package/dist/database/helpers/date/dialects/mysql.js +1 -1
  51. package/dist/database/helpers/date/types.js +1 -1
  52. package/dist/database/helpers/schema/dialects/cockroachdb.d.ts +1 -0
  53. package/dist/database/helpers/schema/dialects/cockroachdb.js +24 -1
  54. package/dist/database/helpers/schema/dialects/mssql.d.ts +1 -1
  55. package/dist/database/helpers/schema/dialects/mysql.d.ts +2 -1
  56. package/dist/database/helpers/schema/dialects/mysql.js +16 -3
  57. package/dist/database/helpers/schema/dialects/postgres.d.ts +1 -1
  58. package/dist/database/helpers/schema/types.d.ts +13 -0
  59. package/dist/database/helpers/schema/types.js +24 -0
  60. package/dist/database/index.js +4 -4
  61. package/dist/database/migrations/20220429A-add-flows.js +1 -1
  62. package/dist/database/migrations/20230526A-migrate-translation-strings.js +1 -1
  63. package/dist/database/migrations/20231009A-update-csv-fields-to-text.js +1 -1
  64. package/dist/database/migrations/20240204A-marketplace.js +9 -7
  65. package/dist/database/migrations/20240311A-deprecate-webhooks.d.ts +15 -0
  66. package/dist/database/migrations/20240311A-deprecate-webhooks.js +1 -1
  67. package/dist/database/migrations/20240806A-permissions-policies.js +2 -2
  68. package/dist/database/migrations/20240924A-migrate-legacy-comments.js +1 -1
  69. package/dist/database/migrations/20251014A-add-project-owner.js +1 -1
  70. package/dist/database/migrations/20251224A-remove-webhooks.d.ts +3 -0
  71. package/dist/database/migrations/20251224A-remove-webhooks.js +19 -0
  72. package/dist/database/migrations/20260113A-add-revisions-index.d.ts +3 -0
  73. package/dist/database/migrations/20260113A-add-revisions-index.js +41 -0
  74. package/dist/database/migrations/run.js +3 -3
  75. package/dist/database/run-ast/lib/apply-query/filter/get-filter-type.d.ts +2 -2
  76. package/dist/database/run-ast/lib/apply-query/filter/get-filter-type.js +1 -1
  77. package/dist/database/run-ast/lib/apply-query/filter/operator.js +1 -1
  78. package/dist/database/run-ast/lib/apply-query/sort.js +1 -1
  79. package/dist/database/run-ast/utils/get-column-pre-processor.js +2 -2
  80. package/dist/database/run-ast/utils/get-column.js +1 -1
  81. package/dist/database/seeds/run.js +3 -3
  82. package/dist/extensions/lib/get-extensions-path.js +1 -1
  83. package/dist/extensions/lib/get-extensions-settings.js +1 -1
  84. package/dist/extensions/lib/get-extensions.js +1 -1
  85. package/dist/extensions/lib/get-shared-deps-mapping.js +3 -3
  86. package/dist/extensions/lib/installation/manager.js +3 -3
  87. package/dist/extensions/lib/sandbox/register/route.d.ts +1 -1
  88. package/dist/extensions/lib/sync/status.js +1 -1
  89. package/dist/extensions/lib/sync/sync.js +7 -7
  90. package/dist/extensions/lib/sync/utils.js +2 -2
  91. package/dist/extensions/manager.d.ts +1 -1
  92. package/dist/extensions/manager.js +8 -8
  93. package/dist/flows.d.ts +1 -1
  94. package/dist/logger/index.js +1 -1
  95. package/dist/logger/logs-stream.d.ts +1 -1
  96. package/dist/logger/logs-stream.js +1 -1
  97. package/dist/mailer.js +1 -1
  98. package/dist/metrics/lib/create-metrics.js +2 -2
  99. package/dist/middleware/authenticate.js +3 -3
  100. package/dist/middleware/collection-exists.js +1 -1
  101. package/dist/middleware/extract-token.js +1 -1
  102. package/dist/middleware/graphql.js +2 -2
  103. package/dist/middleware/validate-batch.js +1 -1
  104. package/dist/operations/exec/index.js +2 -1
  105. package/dist/operations/mail/index.js +1 -1
  106. package/dist/operations/mail/rate-limiter.js +2 -2
  107. package/dist/permissions/cache.js +5 -0
  108. package/dist/permissions/modules/fetch-allowed-collections/fetch-allowed-collections.js +1 -1
  109. package/dist/permissions/modules/fetch-allowed-field-map/fetch-allowed-field-map.js +1 -1
  110. package/dist/permissions/modules/fetch-inconsistent-field-map/fetch-inconsistent-field-map.js +2 -2
  111. package/dist/permissions/modules/process-ast/lib/inject-cases.js +1 -1
  112. package/dist/permissions/modules/process-ast/process-ast.js +1 -1
  113. package/dist/permissions/modules/process-payload/process-payload.js +1 -1
  114. package/dist/permissions/modules/validate-access/lib/validate-item-access.d.ts +13 -1
  115. package/dist/permissions/modules/validate-access/lib/validate-item-access.js +54 -6
  116. package/dist/permissions/modules/validate-access/validate-access.js +3 -2
  117. package/dist/rate-limiter.js +1 -1
  118. package/dist/request/is-denied-ip.js +1 -1
  119. package/dist/schedules/project.js +1 -1
  120. package/dist/schedules/telemetry.js +1 -1
  121. package/dist/schedules/tus.js +1 -1
  122. package/dist/server.js +4 -4
  123. package/dist/services/assets.d.ts +2 -1
  124. package/dist/services/assets.js +35 -8
  125. package/dist/services/authentication.js +2 -2
  126. package/dist/services/collections.js +1 -1
  127. package/dist/services/extensions.d.ts +1 -1
  128. package/dist/services/files/utils/get-metadata.d.ts +1 -1
  129. package/dist/services/files/utils/get-metadata.js +1 -1
  130. package/dist/services/files.d.ts +1 -1
  131. package/dist/services/files.js +4 -4
  132. package/dist/services/graphql/index.d.ts +1 -1
  133. package/dist/services/graphql/index.js +1 -1
  134. package/dist/services/graphql/resolvers/mutation.js +1 -1
  135. package/dist/services/graphql/schema/get-types.d.ts +1 -1
  136. package/dist/services/graphql/schema/read.js +1 -1
  137. package/dist/services/graphql/subscription.d.ts +1 -1
  138. package/dist/services/graphql/types/date.js +1 -1
  139. package/dist/services/graphql/types/hash.js +1 -1
  140. package/dist/services/graphql/utils/add-path-to-validation-error.js +1 -1
  141. package/dist/services/import-export.d.ts +1 -1
  142. package/dist/services/import-export.js +2 -2
  143. package/dist/services/index.d.ts +0 -1
  144. package/dist/services/index.js +0 -1
  145. package/dist/services/mail/index.js +2 -2
  146. package/dist/services/mail/rate-limiter.js +2 -2
  147. package/dist/services/payload.js +2 -2
  148. package/dist/services/schema.js +1 -1
  149. package/dist/services/server.js +12 -4
  150. package/dist/services/settings.js +2 -2
  151. package/dist/services/tfa.js +1 -1
  152. package/dist/services/translations.js +1 -1
  153. package/dist/services/tus/data-store.d.ts +1 -3
  154. package/dist/services/tus/data-store.js +2 -5
  155. package/dist/services/tus/server.js +6 -6
  156. package/dist/services/users.js +4 -4
  157. package/dist/services/versions.js +1 -1
  158. package/dist/telemetry/lib/send-report.d.ts +1 -1
  159. package/dist/telemetry/lib/send-report.js +1 -1
  160. package/dist/telemetry/lib/track.js +1 -1
  161. package/dist/test-utils/knex.js +1 -1
  162. package/dist/types/collection.d.ts +1 -1
  163. package/dist/utils/async-handler.d.ts +1 -1
  164. package/dist/utils/calculate-field-depth.js +1 -1
  165. package/dist/utils/compress.js +1 -1
  166. package/dist/utils/deep-map-response.js +2 -2
  167. package/dist/utils/get-cache-key.js +1 -1
  168. package/dist/utils/get-field-system-rows.js +1 -1
  169. package/dist/utils/get-ip-from-req.d.ts +1 -1
  170. package/dist/utils/get-ip-from-req.js +1 -1
  171. package/dist/utils/get-local-type.js +7 -3
  172. package/dist/utils/get-service.js +1 -3
  173. package/dist/utils/get-snapshot-diff.js +1 -1
  174. package/dist/utils/is-url-allowed.js +1 -1
  175. package/dist/utils/jwt.js +1 -1
  176. package/dist/utils/sanitize-schema.d.ts +1 -1
  177. package/dist/utils/should-clear-cache.d.ts +1 -1
  178. package/dist/utils/should-skip-cache.js +2 -2
  179. package/dist/utils/validate-diff.js +1 -1
  180. package/dist/utils/validate-snapshot.js +3 -3
  181. package/dist/utils/validate-storage.js +2 -2
  182. package/dist/utils/verify-session-jwt.js +1 -1
  183. package/dist/utils/versioning/deep-map-with-schema.js +2 -2
  184. package/dist/websocket/controllers/base.d.ts +2 -2
  185. package/dist/websocket/controllers/base.js +3 -3
  186. package/dist/websocket/controllers/graphql.d.ts +1 -1
  187. package/dist/websocket/controllers/graphql.js +1 -1
  188. package/dist/websocket/controllers/logs.d.ts +1 -1
  189. package/dist/websocket/controllers/rest.d.ts +1 -1
  190. package/dist/websocket/controllers/rest.js +2 -2
  191. package/dist/websocket/handlers/heartbeat.js +1 -1
  192. package/dist/websocket/handlers/items.js +2 -2
  193. package/dist/websocket/handlers/subscribe.js +1 -1
  194. package/dist/websocket/types.d.ts +1 -1
  195. package/dist/websocket/utils/wait-for-message.js +1 -1
  196. package/package.json +24 -24
  197. package/dist/controllers/webhooks.d.ts +0 -2
  198. package/dist/controllers/webhooks.js +0 -74
  199. package/dist/services/webhooks.d.ts +0 -14
  200. package/dist/services/webhooks.js +0 -32
  201. package/dist/utils/is-login-redirect-allowed.d.ts +0 -4
@@ -1,12 +1,11 @@
1
+ import stream from 'node:stream';
1
2
  import type { TusDriver } from '@directus/storage';
2
3
  import type { Accountability, File, SchemaOverview } from '@directus/types';
3
4
  import { DataStore, Upload } from '@tus/utils';
4
- import stream from 'node:stream';
5
5
  export type TusDataStoreConfig = {
6
6
  constants: {
7
7
  ENABLED: boolean;
8
8
  CHUNK_SIZE: number | null;
9
- MAX_SIZE: number | null;
10
9
  EXPIRATION_TIME: number;
11
10
  SCHEDULE: string;
12
11
  };
@@ -18,7 +17,6 @@ export type TusDataStoreConfig = {
18
17
  };
19
18
  export declare class TusDataStore extends DataStore {
20
19
  protected chunkSize: number | undefined;
21
- protected maxSize: number | undefined;
22
20
  protected expirationTime: number;
23
21
  protected location: string;
24
22
  protected storageDriver: TusDriver;
@@ -1,15 +1,14 @@
1
+ import { extname } from 'node:path';
2
+ import stream from 'node:stream';
1
3
  import formatTitle from '@directus/format-title';
2
4
  import { DataStore, ERRORS, Upload } from '@tus/utils';
3
5
  import { omit } from 'lodash-es';
4
6
  import { extension } from 'mime-types';
5
- import { extname } from 'node:path';
6
- import stream from 'node:stream';
7
7
  import getDatabase from '../../database/index.js';
8
8
  import { useLogger } from '../../logger/index.js';
9
9
  import { ItemsService } from '../items.js';
10
10
  export class TusDataStore extends DataStore {
11
11
  chunkSize;
12
- maxSize;
13
12
  expirationTime;
14
13
  location;
15
14
  storageDriver;
@@ -19,8 +18,6 @@ export class TusDataStore extends DataStore {
19
18
  super();
20
19
  if (config.constants.CHUNK_SIZE !== null)
21
20
  this.chunkSize = config.constants.CHUNK_SIZE;
22
- if (config.constants.MAX_SIZE !== null)
23
- this.maxSize = config.constants.MAX_SIZE;
24
21
  this.expirationTime = config.constants.EXPIRATION_TIME;
25
22
  this.location = config.location;
26
23
  this.storageDriver = config.driver;
@@ -7,16 +7,16 @@ import { useEnv } from '@directus/env';
7
7
  import { supportsTus } from '@directus/storage';
8
8
  import { toArray } from '@directus/utils';
9
9
  import { Server } from '@tus/server';
10
- import { RESUMABLE_UPLOADS } from '../../constants.js';
10
+ import { pick } from 'lodash-es';
11
+ import { FILE_UPLOADS, RESUMABLE_UPLOADS } from '../../constants.js';
12
+ import getDatabase from '../../database/index.js';
13
+ import emitter from '../../emitter.js';
11
14
  import { getStorage } from '../../storage/index.js';
15
+ import { getSchema } from '../../utils/get-schema.js';
12
16
  import { extractMetadata } from '../files/lib/extract-metadata.js';
13
17
  import { ItemsService } from '../index.js';
14
18
  import { TusDataStore } from './data-store.js';
15
19
  import { getTusLocker } from './lockers.js';
16
- import { pick } from 'lodash-es';
17
- import emitter from '../../emitter.js';
18
- import getDatabase from '../../database/index.js';
19
- import { getSchema } from '../../utils/get-schema.js';
20
20
  async function createTusStore(context) {
21
21
  const env = useEnv();
22
22
  const storage = await getStorage();
@@ -40,7 +40,7 @@ export async function createTusServer(context) {
40
40
  path: '/files/tus',
41
41
  datastore: store,
42
42
  locker: getTusLocker(),
43
- ...(RESUMABLE_UPLOADS.MAX_SIZE !== null && { maxSize: RESUMABLE_UPLOADS.MAX_SIZE }),
43
+ ...(FILE_UPLOADS.MAX_SIZE !== null && { maxSize: FILE_UPLOADS.MAX_SIZE }),
44
44
  async onUploadFinish(_req, upload) {
45
45
  const schema = await getSchema();
46
46
  const service = new ItemsService('directus_files', {
@@ -1,3 +1,4 @@
1
+ import { performance } from 'perf_hooks';
1
2
  import { useEnv } from '@directus/env';
2
3
  import { ForbiddenError, InvalidPayloadError, RecordNotUniqueError } from '@directus/errors';
3
4
  import { UserIntegrityCheckFlag } from '@directus/types';
@@ -6,7 +7,6 @@ import { FailedValidationError, joiValidationErrorItemToErrorExtensions } from '
6
7
  import Joi from 'joi';
7
8
  import jwt from 'jsonwebtoken';
8
9
  import { isEmpty } from 'lodash-es';
9
- import { performance } from 'perf_hooks';
10
10
  import { clearSystemCache } from '../cache.js';
11
11
  import getDatabase from '../database/index.js';
12
12
  import { useLogger } from '../logger/index.js';
@@ -451,14 +451,14 @@ export class UsersService extends ItemsService {
451
451
  async requestPasswordReset(email, url, subject) {
452
452
  const STALL_TIME = 500;
453
453
  const timeStart = performance.now();
454
+ if (url && isUrlAllowed(url, env['PASSWORD_RESET_URL_ALLOW_LIST']) === false) {
455
+ throw new InvalidPayloadError({ reason: `URL "${url}" can't be used to reset passwords` });
456
+ }
454
457
  const user = await this.getUserByEmail(email);
455
458
  if (user?.status !== 'active') {
456
459
  await stall(STALL_TIME, timeStart);
457
460
  throw new ForbiddenError();
458
461
  }
459
- if (url && isUrlAllowed(url, env['PASSWORD_RESET_URL_ALLOW_LIST']) === false) {
460
- throw new InvalidPayloadError({ reason: `URL "${url}" can't be used to reset passwords` });
461
- }
462
462
  const mailService = new MailService({
463
463
  schema: this.schema,
464
464
  knex: this.knex,
@@ -8,12 +8,12 @@ import { getHelpers } from '../database/helpers/index.js';
8
8
  import emitter from '../emitter.js';
9
9
  import { validateAccess } from '../permissions/modules/validate-access/validate-access.js';
10
10
  import { shouldClearCache } from '../utils/should-clear-cache.js';
11
+ import { deepMapWithSchema } from '../utils/versioning/deep-map-with-schema.js';
11
12
  import { splitRecursive } from '../utils/versioning/split-recursive.js';
12
13
  import { ActivityService } from './activity.js';
13
14
  import { ItemsService } from './items.js';
14
15
  import { PayloadService } from './payload.js';
15
16
  import { RevisionsService } from './revisions.js';
16
- import { deepMapWithSchema } from '../utils/versioning/deep-map-with-schema.js';
17
17
  export class VersionsService extends ItemsService {
18
18
  constructor(options) {
19
19
  super('directus_versions', options);
@@ -1,5 +1,5 @@
1
- import type { TelemetryReport } from '../types/report.js';
2
1
  import type { OwnerInformation } from '@directus/types';
2
+ import type { TelemetryReport } from '../types/report.js';
3
3
  export type OwnerReport = OwnerInformation & {
4
4
  project_id: string;
5
5
  version: string;
@@ -1,5 +1,5 @@
1
- import { useEnv } from '@directus/env';
2
1
  import { URL } from 'node:url';
2
+ import { useEnv } from '@directus/env';
3
3
  /**
4
4
  * Post an anonymous usage report to the centralized intake server
5
5
  */
@@ -1,5 +1,5 @@
1
- import { getNodeEnv } from '@directus/utils/node';
2
1
  import { setTimeout } from 'timers/promises';
2
+ import { getNodeEnv } from '@directus/utils/node';
3
3
  import { useLogger } from '../../logger/index.js';
4
4
  import { getRandomWaitTime } from '../utils/get-random-wait-time.js';
5
5
  import { getReport } from './get-report.js';
@@ -4,7 +4,7 @@
4
4
  */
5
5
  import { systemCollectionNames } from '@directus/system-data';
6
6
  import knex from 'knex';
7
- import { MockClient, createTracker } from 'knex-mock-client';
7
+ import { createTracker, MockClient } from 'knex-mock-client';
8
8
  import { vi } from 'vitest';
9
9
  /**
10
10
  * Creates a mocked knex instance with tracker and schema builder support
@@ -1,6 +1,6 @@
1
- import type { Field } from '@directus/types';
2
1
  import type { Table } from '@directus/schema';
3
2
  import type { BaseCollectionMeta } from '@directus/system-data';
3
+ import type { Field } from '@directus/types';
4
4
  export type Collection = {
5
5
  collection: string;
6
6
  fields?: Field[];
@@ -1,3 +1,3 @@
1
- import type { RequestHandler, Request, Response, NextFunction } from 'express';
1
+ import type { NextFunction, Request, RequestHandler, Response } from 'express';
2
2
  declare const asyncHandler: (fn: RequestHandler) => (req: Request, res: Response, next: NextFunction) => Promise<void>;
3
3
  export default asyncHandler;
@@ -1,4 +1,4 @@
1
- import { isPlainObject, isArray } from 'lodash-es';
1
+ import { isArray, isPlainObject } from 'lodash-es';
2
2
  /**
3
3
  * Calculates the depth of a given JSON structure, not counting any _ prefixed properties
4
4
  *
@@ -1,5 +1,5 @@
1
- import { compress as compressSnappy, uncompress as uncompressSnappy } from 'snappy';
2
1
  import { compress as compressJSON, decompress as decompressJSON } from '@directus/utils';
2
+ import { compress as compressSnappy, uncompress as uncompressSnappy } from 'snappy';
3
3
  export async function compress(raw) {
4
4
  if (!raw)
5
5
  return raw;
@@ -1,7 +1,7 @@
1
- import { isPlainObject } from 'lodash-es';
2
1
  import assert from 'node:assert';
3
- import { getRelationInfo } from './get-relation-info.js';
4
2
  import { InvalidQueryError } from '@directus/errors';
3
+ import { isPlainObject } from 'lodash-es';
4
+ import { getRelationInfo } from './get-relation-info.js';
5
5
  /**
6
6
  * Allows to deep map the response from the ItemsService with collection, field and relation context for each entry.
7
7
  * Bottom to Top depth first mapping of values.
@@ -1,7 +1,7 @@
1
+ import url from 'url';
1
2
  import { ipInNetworks } from '@directus/utils/node';
2
3
  import { version } from 'directus/version';
3
4
  import hash from 'object-hash';
4
- import url from 'url';
5
5
  import getDatabase from '../database/index.js';
6
6
  import { fetchPoliciesIpAccess } from '../permissions/modules/fetch-policies-ip-access/fetch-policies-ip-access.js';
7
7
  import { getGraphqlQueryAndVariables } from './get-graphql-query-and-variables.js';
@@ -1,5 +1,5 @@
1
- import { systemFieldRows } from '@directus/system-data';
2
1
  import formatTitle from '@directus/format-title';
2
+ import { systemFieldRows } from '@directus/system-data';
3
3
  import { getAuthProviders } from './get-auth-providers.js';
4
4
  // Dynamically populate auth providers field
5
5
  export function getSystemFieldRowsWithAuthProviders() {
@@ -1,3 +1,3 @@
1
- import type { Request } from 'express';
2
1
  import type { IncomingMessage } from 'http';
2
+ import type { Request } from 'express';
3
3
  export declare function getIPFromReq(req: IncomingMessage | Request): string | null;
@@ -1,5 +1,5 @@
1
- import { useEnv } from '@directus/env';
2
1
  import { isIP } from 'net';
2
+ import { useEnv } from '@directus/env';
3
3
  import proxyAddr from 'proxy-addr';
4
4
  import { useLogger } from '../logger/index.js';
5
5
  /**
@@ -61,15 +61,15 @@ const localTypeMap = {
61
61
  binary: 'binary',
62
62
  varbinary: 'binary',
63
63
  uniqueidentifier: 'uuid',
64
- // Postgres
64
+ // Postgres / Cockroachdb
65
65
  json: 'json',
66
66
  jsonb: 'json',
67
67
  uuid: 'uuid',
68
68
  int2: 'integer',
69
69
  serial4: 'integer',
70
70
  int4: 'integer',
71
- serial8: 'integer',
72
- int8: 'integer',
71
+ serial8: 'bigInteger',
72
+ int8: 'bigInteger',
73
73
  bool: 'boolean',
74
74
  'character varying': 'string',
75
75
  character: 'string',
@@ -124,5 +124,9 @@ export default function getLocalType(column, field) {
124
124
  if (column.data_type === 'nvarchar' && column.max_length === -1) {
125
125
  return 'text';
126
126
  }
127
+ /** Handle CockroachDB 64-bit integers (reported as 'integer' with precision 64) */
128
+ if ((dataType === 'integer' || dataType === 'int') && column.numeric_precision === 64) {
129
+ return 'bigInteger';
130
+ }
127
131
  return type ?? 'unknown';
128
132
  }
@@ -1,5 +1,5 @@
1
1
  import { ForbiddenError } from '@directus/errors';
2
- import { AccessService, ActivityService, CommentsService, DashboardsService, FilesService, FlowsService, FoldersService, ItemsService, NotificationsService, OperationsService, PanelsService, PermissionsService, PoliciesService, PresetsService, RevisionsService, RolesService, SettingsService, SharesService, TranslationsService, UsersService, VersionsService, WebhooksService, } from '../services/index.js';
2
+ import { AccessService, ActivityService, CommentsService, DashboardsService, FilesService, FlowsService, FoldersService, ItemsService, NotificationsService, OperationsService, PanelsService, PermissionsService, PoliciesService, PresetsService, RevisionsService, RolesService, SettingsService, SharesService, TranslationsService, UsersService, VersionsService, } from '../services/index.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).
@@ -46,8 +46,6 @@ export function getService(collection, opts) {
46
46
  return new UsersService(opts);
47
47
  case 'directus_versions':
48
48
  return new VersionsService(opts);
49
- case 'directus_webhooks':
50
- return new WebhooksService(opts);
51
49
  default:
52
50
  // Deny usage of other system collections via ItemsService
53
51
  if (collection.startsWith('directus_'))
@@ -1,5 +1,5 @@
1
- import deepDiff from 'deep-diff';
2
1
  import { DiffKind } from '@directus/types';
2
+ import deepDiff from 'deep-diff';
3
3
  import { sanitizeCollection, sanitizeField, sanitizeRelation, sanitizeSystemField } from './sanitize-schema.js';
4
4
  export function getSnapshotDiff(current, after) {
5
5
  const diffedSnapshot = {
@@ -1,5 +1,5 @@
1
- import { toArray } from '@directus/utils';
2
1
  import { URL } from 'url';
2
+ import { toArray } from '@directus/utils';
3
3
  import { useLogger } from '../logger/index.js';
4
4
  /**
5
5
  * Check if URL matches allow list either exactly or by origin (protocol+domain+port) + pathname
package/dist/utils/jwt.js CHANGED
@@ -1,5 +1,5 @@
1
- import jwt from 'jsonwebtoken';
2
1
  import { InvalidTokenError, ServiceUnavailableError, TokenExpiredError } from '@directus/errors';
2
+ import jwt from 'jsonwebtoken';
3
3
  export function verifyJWT(token, secret) {
4
4
  let payload;
5
5
  try {
@@ -16,7 +16,7 @@ export declare function sanitizeCollection(collection: Collection): SnapshotColl
16
16
  * @returns sanitized field
17
17
  */
18
18
  export declare function sanitizeField(field: Field, sanitizeAllSchema?: boolean): SnapshotField;
19
- export declare function sanitizeColumn(column: Column): Pick<Column, "table" | "foreign_key_table" | "foreign_key_column" | "name" | "data_type" | "default_value" | "max_length" | "numeric_precision" | "numeric_scale" | "is_nullable" | "is_unique" | "is_indexed" | "is_primary_key" | "is_generated" | "generation_expression" | "has_auto_increment">;
19
+ export declare function sanitizeColumn(column: Column): Pick<Column, "name" | "table" | "foreign_key_table" | "foreign_key_column" | "data_type" | "default_value" | "max_length" | "numeric_precision" | "numeric_scale" | "is_nullable" | "is_unique" | "is_indexed" | "is_primary_key" | "is_generated" | "generation_expression" | "has_auto_increment">;
20
20
  /**
21
21
  * Pick certain database vendor specific relation properties that should be compared when performing diff
22
22
  *
@@ -1,5 +1,5 @@
1
- import type Keyv from 'keyv';
2
1
  import type { MutationOptions } from '@directus/types';
2
+ import type Keyv from 'keyv';
3
3
  /**
4
4
  * Check whether cache should be cleared
5
5
  *
@@ -1,7 +1,7 @@
1
- import { useEnv } from '@directus/env';
2
1
  import url from 'url';
3
- import { Url } from './url.js';
2
+ import { useEnv } from '@directus/env';
4
3
  import { getEndpoint } from '@directus/utils';
4
+ import { Url } from './url.js';
5
5
  /**
6
6
  * Whether to skip caching for the current request
7
7
  *
@@ -1,6 +1,6 @@
1
- import Joi from 'joi';
2
1
  import { InvalidPayloadError } from '@directus/errors';
3
2
  import { DiffKind } from '@directus/types';
3
+ import Joi from 'joi';
4
4
  const deepDiffSchema = Joi.object({
5
5
  kind: Joi.string()
6
6
  .valid(...Object.values(DiffKind))
@@ -1,10 +1,10 @@
1
1
  import { TYPES } from '@directus/constants';
2
- import Joi from 'joi';
3
- import { ALIAS_TYPES } from '../constants.js';
4
- import { getDatabaseClient } from '../database/index.js';
5
2
  import { InvalidPayloadError } from '@directus/errors';
6
3
  import { DatabaseClients } from '@directus/types';
7
4
  import { version } from 'directus/version';
5
+ import Joi from 'joi';
6
+ import { ALIAS_TYPES } from '../constants.js';
7
+ import { getDatabaseClient } from '../database/index.js';
8
8
  const snapshotJoiSchema = Joi.object({
9
9
  version: Joi.number().valid(1).required(),
10
10
  directus: Joi.string().required(),
@@ -1,8 +1,8 @@
1
- import { useEnv } from '@directus/env';
2
- import { toArray } from '@directus/utils';
3
1
  import { constants } from 'fs';
4
2
  import { access } from 'node:fs/promises';
5
3
  import path from 'path';
4
+ import { useEnv } from '@directus/env';
5
+ import { toArray } from '@directus/utils';
6
6
  import { getExtensionsPath } from '../extensions/lib/get-extensions-path.js';
7
7
  import { useLogger } from '../logger/index.js';
8
8
  export async function validateStorage() {
@@ -1,5 +1,5 @@
1
- import getDatabase from '../database/index.js';
2
1
  import { InvalidCredentialsError } from '@directus/errors';
2
+ import getDatabase from '../database/index.js';
3
3
  /**
4
4
  * Verifies the associated session is still available and valid.
5
5
  *
@@ -1,7 +1,7 @@
1
- import { isPlainObject } from 'lodash-es';
2
1
  import assert from 'node:assert';
3
- import { getRelationInfo } from '../get-relation-info.js';
4
2
  import { InvalidQueryError } from '@directus/errors';
3
+ import { isPlainObject } from 'lodash-es';
4
+ import { getRelationInfo } from '../get-relation-info.js';
5
5
  /**
6
6
  * Allows to deep map the data like a response or delta changes with collection, field and relation context for each entry.
7
7
  * Bottom to Top depth first mapping of values.
@@ -1,8 +1,8 @@
1
+ import type { Server as httpServer, IncomingMessage } from 'http';
2
+ import type internal from 'stream';
1
3
  import type { Accountability } from '@directus/types';
2
4
  import { WebSocketMessage } from '@directus/types';
3
- import type { IncomingMessage, Server as httpServer } from 'http';
4
5
  import type { RateLimiterAbstract } from 'rate-limiter-flexible';
5
- import type internal from 'stream';
6
6
  import WebSocket, { type Server } from 'ws';
7
7
  import { WebSocketAuthMessage } from '../messages.js';
8
8
  import type { AuthenticationState, UpgradeContext, WebSocketAuthentication, WebSocketClient } from '../types.js';
@@ -1,10 +1,10 @@
1
+ import { randomUUID } from 'node:crypto';
2
+ import { parse } from 'url';
1
3
  import { useEnv } from '@directus/env';
2
4
  import { InvalidProviderConfigError, TokenExpiredError } from '@directus/errors';
3
5
  import { WebSocketMessage } from '@directus/types';
4
6
  import { parseJSON, toBoolean } from '@directus/utils';
5
7
  import cookie from 'cookie';
6
- import { randomUUID } from 'node:crypto';
7
- import { parse } from 'url';
8
8
  import WebSocket, { WebSocketServer } from 'ws';
9
9
  import { fromZodError } from 'zod-validation-error';
10
10
  import emitter from '../../emitter.js';
@@ -13,7 +13,7 @@ import { createDefaultAccountability } from '../../permissions/utils/create-defa
13
13
  import { createRateLimiter } from '../../rate-limiter.js';
14
14
  import { getIPFromReq } from '../../utils/get-ip-from-req.js';
15
15
  import { authenticateConnection, authenticationSuccess } from '../authenticate.js';
16
- import { WebSocketError, handleWebSocketError } from '../errors.js';
16
+ import { handleWebSocketError, WebSocketError } from '../errors.js';
17
17
  import { AuthMode, WebSocketAuthMessage } from '../messages.js';
18
18
  import { getMessageType } from '../utils/message.js';
19
19
  import { waitForAnyMessage, waitForMessageType } from '../utils/wait-for-message.js';
@@ -1,5 +1,5 @@
1
- import type { Server } from 'graphql-ws';
2
1
  import type { Server as httpServer } from 'http';
2
+ import type { Server } from 'graphql-ws';
3
3
  import type { GraphQLSocket, UpgradeContext, WebSocketClient } from '../types.js';
4
4
  import SocketController from './base.js';
5
5
  export declare class GraphQLSubscriptionController extends SocketController {
@@ -1,4 +1,4 @@
1
- import { CloseCode, MessageType, makeServer } from 'graphql-ws';
1
+ import { CloseCode, makeServer, MessageType } from 'graphql-ws';
2
2
  import { useLogger } from '../../logger/index.js';
3
3
  import { createDefaultAccountability } from '../../permissions/utils/create-default-accountability.js';
4
4
  import { bindPubSub } from '../../services/graphql/subscription.js';
@@ -1,7 +1,7 @@
1
1
  import type { Server as httpServer } from 'http';
2
+ import type { Accountability } from '@directus/types';
2
3
  import { AuthMode } from '../messages.js';
3
4
  import SocketController from './base.js';
4
- import type { Accountability } from '@directus/types';
5
5
  export declare class LogsController extends SocketController {
6
6
  constructor(httpServer: httpServer);
7
7
  getEnvironmentConfig(configPrefix: string): {
@@ -1,5 +1,5 @@
1
- import { WebSocketMessage } from '@directus/types';
2
1
  import type { Server as httpServer } from 'http';
2
+ import { WebSocketMessage } from '@directus/types';
3
3
  import SocketController from './base.js';
4
4
  export declare class WebSocketController extends SocketController {
5
5
  constructor(httpServer: httpServer);
@@ -1,9 +1,9 @@
1
- import { parseJSON } from '@directus/utils';
2
1
  import { WebSocketMessage } from '@directus/types';
2
+ import { parseJSON } from '@directus/utils';
3
3
  import emitter from '../../emitter.js';
4
4
  import { useLogger } from '../../logger/index.js';
5
5
  import { getAddress } from '../../utils/get-address.js';
6
- import { WebSocketError, handleWebSocketError } from '../errors.js';
6
+ import { handleWebSocketError, WebSocketError } from '../errors.js';
7
7
  import SocketController from './base.js';
8
8
  import { registerWebSocketEvents } from './hooks.js';
9
9
  const logger = useLogger();
@@ -3,7 +3,7 @@ import { ServiceUnavailableError } from '@directus/errors';
3
3
  import { WebSocketMessage } from '@directus/types';
4
4
  import { toBoolean } from '@directus/utils';
5
5
  import emitter from '../../emitter.js';
6
- import { WebSocketController, getWebSocketController } from '../controllers/index.js';
6
+ import { getWebSocketController, WebSocketController } from '../controllers/index.js';
7
7
  import { fmtMessage, getMessageType } from '../utils/message.js';
8
8
  const env = useEnv();
9
9
  const HEARTBEAT_FREQUENCY = Number(env['WEBSOCKETS_HEARTBEAT_PERIOD']) * 1000;
@@ -1,9 +1,9 @@
1
+ import { isSystemCollection } from '@directus/system-data';
1
2
  import emitter from '../../emitter.js';
2
3
  import { ItemsService, MetaService } from '../../services/index.js';
3
4
  import { getSchema } from '../../utils/get-schema.js';
4
- import { isSystemCollection } from '@directus/system-data';
5
5
  import { sanitizeQuery } from '../../utils/sanitize-query.js';
6
- import { WebSocketError, handleWebSocketError } from '../errors.js';
6
+ import { handleWebSocketError, WebSocketError } from '../errors.js';
7
7
  import { WebSocketItemsMessage } from '../messages.js';
8
8
  import { fmtMessage, getMessageType } from '../utils/message.js';
9
9
  export class ItemsHandler {
@@ -4,7 +4,7 @@ import { useBus } from '../../bus/index.js';
4
4
  import emitter from '../../emitter.js';
5
5
  import { getSchema } from '../../utils/get-schema.js';
6
6
  import { sanitizeQuery } from '../../utils/sanitize-query.js';
7
- import { WebSocketError, handleWebSocketError } from '../errors.js';
7
+ import { handleWebSocketError, WebSocketError } from '../errors.js';
8
8
  import { WebSocketSubscribeMessage } from '../messages.js';
9
9
  import { getPayload } from '../utils/items.js';
10
10
  import { fmtMessage, getMessageType } from '../utils/message.js';
@@ -1,6 +1,6 @@
1
- import type { Accountability, Query } from '@directus/types';
2
1
  import type { IncomingMessage } from 'http';
3
2
  import type internal from 'stream';
3
+ import type { Accountability, Query } from '@directus/types';
4
4
  import type { WebSocket } from 'ws';
5
5
  import type { AuthMode } from './messages.js';
6
6
  export type AuthenticationState = {
@@ -1,5 +1,5 @@
1
- import { parseJSON } from '@directus/utils';
2
1
  import { WebSocketMessage } from '@directus/types';
2
+ import { parseJSON } from '@directus/utils';
3
3
  import { getMessageType } from './message.js';
4
4
  export const waitForAnyMessage = (client, timeout) => {
5
5
  return new Promise((resolve, reject) => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@directus/api",
3
- "version": "32.2.0",
3
+ "version": "33.0.0",
4
4
  "description": "Directus is a real-time API and App dashboard for managing SQL database content",
5
5
  "keywords": [
6
6
  "directus",
@@ -125,7 +125,7 @@
125
125
  "ms": "2.1.3",
126
126
  "nanoid": "5.1.6",
127
127
  "node-machine-id": "1.1.12",
128
- "nodemailer": "7.0.10",
128
+ "nodemailer": "7.0.11",
129
129
  "object-hash": "3.0.0",
130
130
  "openapi3-ts": "4.5.0",
131
131
  "openid-client": "5.7.1",
@@ -158,30 +158,30 @@
158
158
  "ws": "8.18.3",
159
159
  "zod": "4.1.12",
160
160
  "zod-validation-error": "4.0.2",
161
- "@directus/app": "14.4.0",
162
- "@directus/extensions": "3.0.15",
163
- "@directus/errors": "2.1.0",
164
- "@directus/extensions-sdk": "17.0.4",
161
+ "@directus/app": "15.0.0",
165
162
  "@directus/constants": "14.0.0",
166
- "@directus/extensions-registry": "3.0.15",
167
- "@directus/env": "5.3.3",
163
+ "@directus/env": "5.4.0",
164
+ "@directus/extensions": "3.0.16",
165
+ "@directus/extensions-registry": "3.0.16",
166
+ "@directus/errors": "2.1.0",
167
+ "@directus/extensions-sdk": "17.0.5",
168
+ "@directus/memory": "3.0.14",
168
169
  "@directus/format-title": "12.1.1",
169
- "@directus/memory": "3.0.13",
170
- "@directus/pressure": "3.0.13",
171
- "@directus/schema": "13.0.4",
170
+ "@directus/pressure": "3.0.14",
171
+ "@directus/schema": "13.0.5",
172
+ "@directus/schema-builder": "0.0.11",
173
+ "@directus/specs": "12.0.0",
172
174
  "@directus/storage": "12.0.3",
173
- "@directus/specs": "11.2.0",
174
- "@directus/schema-builder": "0.0.10",
175
- "@directus/storage-driver-azure": "12.0.13",
176
- "@directus/storage-driver-cloudinary": "12.0.13",
177
- "@directus/storage-driver-gcs": "12.0.13",
175
+ "@directus/storage-driver-azure": "12.0.14",
176
+ "@directus/storage-driver-gcs": "12.0.14",
178
177
  "@directus/storage-driver-local": "12.0.3",
179
- "@directus/system-data": "3.5.0",
180
- "@directus/storage-driver-supabase": "3.0.13",
181
- "@directus/utils": "13.1.0",
182
- "@directus/validation": "2.0.13",
183
- "@directus/storage-driver-s3": "12.0.13",
184
- "directus": "11.14.0"
178
+ "@directus/storage-driver-cloudinary": "12.0.14",
179
+ "@directus/storage-driver-s3": "12.1.0",
180
+ "@directus/system-data": "4.0.0",
181
+ "@directus/utils": "13.1.1",
182
+ "@directus/validation": "2.0.14",
183
+ "directus": "11.14.1",
184
+ "@directus/storage-driver-supabase": "3.0.14"
185
185
  },
186
186
  "devDependencies": {
187
187
  "@directus/tsconfig": "3.0.0",
@@ -225,8 +225,8 @@
225
225
  "knex-mock-client": "3.0.2",
226
226
  "typescript": "5.9.3",
227
227
  "vitest": "3.2.4",
228
- "@directus/schema-builder": "0.0.10",
229
- "@directus/types": "13.5.0"
228
+ "@directus/schema-builder": "0.0.11",
229
+ "@directus/types": "14.0.0"
230
230
  },
231
231
  "optionalDependencies": {
232
232
  "@keyv/redis": "3.0.1",
@@ -1,2 +0,0 @@
1
- declare const router: import("express-serve-static-core").Router;
2
- export default router;