directus 9.23.3 → 9.23.4

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 (113) hide show
  1. package/dist/app.js +12 -12
  2. package/dist/auth/drivers/ldap.js +22 -22
  3. package/dist/auth/drivers/local.js +7 -7
  4. package/dist/auth/drivers/oauth2.js +27 -25
  5. package/dist/auth/drivers/openid.js +32 -30
  6. package/dist/auth/drivers/saml.js +10 -10
  7. package/dist/auth.js +4 -3
  8. package/dist/cache.js +16 -11
  9. package/dist/cli/commands/bootstrap/index.js +5 -4
  10. package/dist/cli/utils/create-db-connection.js +1 -1
  11. package/dist/cli/utils/create-env/index.js +1 -1
  12. package/dist/constants.d.ts +1 -0
  13. package/dist/constants.js +6 -5
  14. package/dist/controllers/activity.js +9 -9
  15. package/dist/controllers/assets.js +19 -18
  16. package/dist/controllers/auth.js +13 -13
  17. package/dist/controllers/collections.js +10 -10
  18. package/dist/controllers/dashboards.js +9 -9
  19. package/dist/controllers/extensions.js +3 -3
  20. package/dist/controllers/fields.js +16 -16
  21. package/dist/controllers/files.js +16 -15
  22. package/dist/controllers/flows.js +11 -11
  23. package/dist/controllers/folders.js +9 -9
  24. package/dist/controllers/graphql.js +6 -6
  25. package/dist/controllers/items.js +17 -17
  26. package/dist/controllers/notifications.js +9 -9
  27. package/dist/controllers/operations.js +9 -9
  28. package/dist/controllers/panels.js +9 -9
  29. package/dist/controllers/permissions.js +9 -9
  30. package/dist/controllers/presets.js +9 -9
  31. package/dist/controllers/relations.js +10 -10
  32. package/dist/controllers/revisions.js +3 -3
  33. package/dist/controllers/roles.js +9 -9
  34. package/dist/controllers/schema.js +5 -5
  35. package/dist/controllers/server.js +7 -7
  36. package/dist/controllers/settings.js +2 -2
  37. package/dist/controllers/shares.js +13 -13
  38. package/dist/controllers/users.js +16 -16
  39. package/dist/controllers/utils.js +5 -5
  40. package/dist/controllers/webhooks.js +9 -9
  41. package/dist/database/helpers/fn/types.d.ts +0 -1
  42. package/dist/database/helpers/fn/types.js +0 -2
  43. package/dist/database/helpers/index.d.ts +3 -3
  44. package/dist/database/index.js +5 -5
  45. package/dist/database/migrations/20210805B-change-image-metadata-structure.js +15 -15
  46. package/dist/database/migrations/run.js +1 -1
  47. package/dist/database/run-ast.js +4 -4
  48. package/dist/database/system-data/collections/index.js +2 -2
  49. package/dist/database/system-data/fields/index.js +3 -3
  50. package/dist/env.js +1 -1
  51. package/dist/extensions.js +10 -10
  52. package/dist/flows.js +33 -31
  53. package/dist/logger.d.ts +1 -0
  54. package/dist/logger.js +32 -32
  55. package/dist/mailer.js +16 -16
  56. package/dist/messenger.js +4 -4
  57. package/dist/middleware/authenticate.js +1 -1
  58. package/dist/middleware/cache.js +11 -11
  59. package/dist/middleware/collection-exists.js +3 -3
  60. package/dist/middleware/cors.js +7 -7
  61. package/dist/middleware/error-handler.js +2 -2
  62. package/dist/middleware/extract-token.js +2 -2
  63. package/dist/middleware/graphql.js +12 -6
  64. package/dist/middleware/rate-limiter-global.js +5 -5
  65. package/dist/middleware/rate-limiter-ip.js +2 -2
  66. package/dist/middleware/respond.js +16 -16
  67. package/dist/middleware/sanitize-query.js +1 -1
  68. package/dist/operations/exec/index.js +2 -2
  69. package/dist/rate-limiter.js +1 -1
  70. package/dist/request/validate-ip.js +2 -2
  71. package/dist/server.js +4 -4
  72. package/dist/services/activity.js +14 -14
  73. package/dist/services/assets.js +6 -6
  74. package/dist/services/authentication.js +9 -9
  75. package/dist/services/collections.js +9 -9
  76. package/dist/services/fields.js +5 -5
  77. package/dist/services/files.js +12 -12
  78. package/dist/services/graphql/index.js +100 -98
  79. package/dist/services/import-export.js +6 -6
  80. package/dist/services/items.js +6 -6
  81. package/dist/services/mail/index.js +5 -5
  82. package/dist/services/meta.js +1 -0
  83. package/dist/services/notifications.js +4 -4
  84. package/dist/services/revisions.js +3 -3
  85. package/dist/services/roles.js +5 -5
  86. package/dist/services/server.js +27 -27
  87. package/dist/services/shares.js +9 -9
  88. package/dist/services/specifications.js +5 -3
  89. package/dist/services/users.d.ts +1 -5
  90. package/dist/services/users.js +24 -27
  91. package/dist/storage/register-locations.js +1 -1
  92. package/dist/utils/apply-query.js +2 -1
  93. package/dist/utils/dynamic-import.js +1 -1
  94. package/dist/utils/generate-hash.js +1 -1
  95. package/dist/utils/get-ast-from-query.js +1 -1
  96. package/dist/utils/get-auth-providers.js +1 -1
  97. package/dist/utils/get-cache-headers.js +3 -3
  98. package/dist/utils/get-collection-from-alias.js +1 -0
  99. package/dist/utils/get-default-value.js +1 -1
  100. package/dist/utils/get-ip-from-req.js +2 -2
  101. package/dist/utils/get-permissions.js +11 -11
  102. package/dist/utils/get-schema.js +2 -2
  103. package/dist/utils/is-url-allowed.js +5 -2
  104. package/dist/utils/sanitize-query.js +26 -26
  105. package/dist/utils/should-skip-cache.js +2 -2
  106. package/dist/utils/track.js +16 -16
  107. package/dist/utils/validate-query.js +1 -1
  108. package/dist/utils/validate-storage.js +8 -8
  109. package/dist/webhooks.js +2 -2
  110. package/package.json +13 -13
  111. package/dist/utils/redact-header-cookies.d.ts +0 -1
  112. package/dist/utils/redact-header-cookies.js +0 -11
  113. /package/dist/{utils/redact-header-cookies.test.d.ts → logger.test.d.ts} +0 -0
@@ -157,7 +157,7 @@ class CollectionsService {
157
157
  return payload.collection;
158
158
  }
159
159
  finally {
160
- if (this.cache && env_1.default.CACHE_AUTO_PURGE && opts?.autoPurgeCache !== false) {
160
+ if (this.cache && env_1.default['CACHE_AUTO_PURGE'] && opts?.autoPurgeCache !== false) {
161
161
  await this.cache.clear();
162
162
  }
163
163
  if (opts?.autoPurgeSystemCache !== false) {
@@ -198,7 +198,7 @@ class CollectionsService {
198
198
  return collections;
199
199
  }
200
200
  finally {
201
- if (this.cache && env_1.default.CACHE_AUTO_PURGE && opts?.autoPurgeCache !== false) {
201
+ if (this.cache && env_1.default['CACHE_AUTO_PURGE'] && opts?.autoPurgeCache !== false) {
202
202
  await this.cache.clear();
203
203
  }
204
204
  if (opts?.autoPurgeSystemCache !== false) {
@@ -270,8 +270,8 @@ class CollectionsService {
270
270
  });
271
271
  }
272
272
  }
273
- if (env_1.default.DB_EXCLUDE_TABLES) {
274
- return collections.filter((collection) => env_1.default.DB_EXCLUDE_TABLES.includes(collection.collection) === false);
273
+ if (env_1.default['DB_EXCLUDE_TABLES']) {
274
+ return collections.filter((collection) => env_1.default['DB_EXCLUDE_TABLES'].includes(collection.collection) === false);
275
275
  }
276
276
  return collections;
277
277
  }
@@ -342,7 +342,7 @@ class CollectionsService {
342
342
  return collectionKey;
343
343
  }
344
344
  finally {
345
- if (this.cache && env_1.default.CACHE_AUTO_PURGE && opts?.autoPurgeCache !== false) {
345
+ if (this.cache && env_1.default['CACHE_AUTO_PURGE'] && opts?.autoPurgeCache !== false) {
346
346
  await this.cache.clear();
347
347
  }
348
348
  if (opts?.autoPurgeSystemCache !== false) {
@@ -390,7 +390,7 @@ class CollectionsService {
390
390
  });
391
391
  }
392
392
  finally {
393
- if (this.cache && env_1.default.CACHE_AUTO_PURGE && opts?.autoPurgeCache !== false) {
393
+ if (this.cache && env_1.default['CACHE_AUTO_PURGE'] && opts?.autoPurgeCache !== false) {
394
394
  await this.cache.clear();
395
395
  }
396
396
  if (opts?.autoPurgeSystemCache !== false) {
@@ -432,7 +432,7 @@ class CollectionsService {
432
432
  return collectionKeys;
433
433
  }
434
434
  finally {
435
- if (this.cache && env_1.default.CACHE_AUTO_PURGE && opts?.autoPurgeCache !== false) {
435
+ if (this.cache && env_1.default['CACHE_AUTO_PURGE'] && opts?.autoPurgeCache !== false) {
436
436
  await this.cache.clear();
437
437
  }
438
438
  if (opts?.autoPurgeSystemCache !== false) {
@@ -535,7 +535,7 @@ class CollectionsService {
535
535
  return collectionKey;
536
536
  }
537
537
  finally {
538
- if (this.cache && env_1.default.CACHE_AUTO_PURGE && opts?.autoPurgeCache !== false) {
538
+ if (this.cache && env_1.default['CACHE_AUTO_PURGE'] && opts?.autoPurgeCache !== false) {
539
539
  await this.cache.clear();
540
540
  }
541
541
  if (opts?.autoPurgeSystemCache !== false) {
@@ -576,7 +576,7 @@ class CollectionsService {
576
576
  return collectionKeys;
577
577
  }
578
578
  finally {
579
- if (this.cache && env_1.default.CACHE_AUTO_PURGE && opts?.autoPurgeCache !== false) {
579
+ if (this.cache && env_1.default['CACHE_AUTO_PURGE'] && opts?.autoPurgeCache !== false) {
580
580
  await this.cache.clear();
581
581
  }
582
582
  if (opts?.autoPurgeSystemCache !== false) {
@@ -298,7 +298,7 @@ class FieldsService {
298
298
  if (runPostColumnChange) {
299
299
  await this.helpers.schema.postColumnChange();
300
300
  }
301
- if (this.cache && env_1.default.CACHE_AUTO_PURGE && opts?.autoPurgeCache !== false) {
301
+ if (this.cache && env_1.default['CACHE_AUTO_PURGE'] && opts?.autoPurgeCache !== false) {
302
302
  await this.cache.clear();
303
303
  }
304
304
  if (opts?.autoPurgeSystemCache !== false) {
@@ -393,7 +393,7 @@ class FieldsService {
393
393
  if (runPostColumnChange) {
394
394
  await this.helpers.schema.postColumnChange();
395
395
  }
396
- if (this.cache && env_1.default.CACHE_AUTO_PURGE && opts?.autoPurgeCache !== false) {
396
+ if (this.cache && env_1.default['CACHE_AUTO_PURGE'] && opts?.autoPurgeCache !== false) {
397
397
  await this.cache.clear();
398
398
  }
399
399
  if (opts?.autoPurgeSystemCache !== false) {
@@ -478,10 +478,10 @@ class FieldsService {
478
478
  .first();
479
479
  const collectionMetaUpdates = {};
480
480
  if (collectionMeta?.archive_field === field) {
481
- collectionMetaUpdates.archive_field = null;
481
+ collectionMetaUpdates['archive_field'] = null;
482
482
  }
483
483
  if (collectionMeta?.sort_field === field) {
484
- collectionMetaUpdates.sort_field = null;
484
+ collectionMetaUpdates['sort_field'] = null;
485
485
  }
486
486
  if (Object.keys(collectionMetaUpdates).length > 0) {
487
487
  await trx('directus_collections').update(collectionMetaUpdates).where({ collection });
@@ -523,7 +523,7 @@ class FieldsService {
523
523
  if (runPostColumnChange) {
524
524
  await this.helpers.schema.postColumnChange();
525
525
  }
526
- if (this.cache && env_1.default.CACHE_AUTO_PURGE && opts?.autoPurgeCache !== false) {
526
+ if (this.cache && env_1.default['CACHE_AUTO_PURGE'] && opts?.autoPurgeCache !== false) {
527
527
  await this.cache.clear();
528
528
  }
529
529
  if (opts?.autoPurgeSystemCache !== false) {
@@ -93,7 +93,7 @@ class FilesService extends items_1.ItemsService {
93
93
  schema: this.schema,
94
94
  });
95
95
  await sudoService.updateOne(primaryKey, payload, { emitEvents: false });
96
- if (this.cache && env_1.default.CACHE_AUTO_PURGE && opts?.autoPurgeCache !== false) {
96
+ if (this.cache && env_1.default['CACHE_AUTO_PURGE'] && opts?.autoPurgeCache !== false) {
97
97
  await this.cache.clear();
98
98
  }
99
99
  if (opts?.emitEvents !== false) {
@@ -112,7 +112,7 @@ class FilesService extends items_1.ItemsService {
112
112
  /**
113
113
  * Extract metadata from a buffer's content
114
114
  */
115
- async getMetadata(stream, allowList = env_1.default.FILE_METADATA_ALLOW_LIST) {
115
+ async getMetadata(stream, allowList = env_1.default['FILE_METADATA_ALLOW_LIST']) {
116
116
  return new Promise((resolve, reject) => {
117
117
  (0, promises_1.pipeline)(stream, (0, sharp_1.default)().metadata(async (err, sharpMetadata) => {
118
118
  if (err) {
@@ -176,14 +176,14 @@ class FilesService extends items_1.ItemsService {
176
176
  logger_1.default.warn(err);
177
177
  }
178
178
  }
179
- if (fullMetadata?.iptc?.Caption && typeof fullMetadata.iptc.Caption === 'string') {
180
- metadata.description = fullMetadata.iptc?.Caption;
179
+ if (fullMetadata?.iptc?.['Caption'] && typeof fullMetadata.iptc['Caption'] === 'string') {
180
+ metadata.description = fullMetadata.iptc?.['Caption'];
181
181
  }
182
- if (fullMetadata?.iptc?.Headline && typeof fullMetadata.iptc.Headline === 'string') {
183
- metadata.title = fullMetadata.iptc.Headline;
182
+ if (fullMetadata?.iptc?.['Headline'] && typeof fullMetadata.iptc['Headline'] === 'string') {
183
+ metadata.title = fullMetadata.iptc['Headline'];
184
184
  }
185
- if (fullMetadata?.iptc?.Keywords) {
186
- metadata.tags = fullMetadata.iptc.Keywords;
185
+ if (fullMetadata?.iptc?.['Keywords']) {
186
+ metadata.tags = fullMetadata.iptc['Keywords'];
187
187
  }
188
188
  if (allowList === '*' || allowList?.[0] === '*') {
189
189
  metadata.metadata = fullMetadata;
@@ -229,7 +229,7 @@ class FilesService extends items_1.ItemsService {
229
229
  const filename = decodeURI(path_1.default.basename(parsedURL.pathname));
230
230
  const payload = {
231
231
  filename_download: filename,
232
- storage: (0, utils_1.toArray)(env_1.default.STORAGE_LOCATIONS)[0],
232
+ storage: (0, utils_1.toArray)(env_1.default['STORAGE_LOCATIONS'])[0],
233
233
  type: fileResponse.headers['content-type'],
234
234
  title: (0, format_title_1.default)(filename),
235
235
  ...(body || {}),
@@ -265,13 +265,13 @@ class FilesService extends items_1.ItemsService {
265
265
  }
266
266
  await super.deleteMany(keys);
267
267
  for (const file of files) {
268
- const disk = storage.location(file.storage);
268
+ const disk = storage.location(file['storage']);
269
269
  // Delete file + thumbnails
270
- for await (const filepath of disk.list(file.id)) {
270
+ for await (const filepath of disk.list(file['id'])) {
271
271
  await disk.delete(filepath);
272
272
  }
273
273
  }
274
- if (this.cache && env_1.default.CACHE_AUTO_PURGE && opts?.autoPurgeCache !== false) {
274
+ if (this.cache && env_1.default['CACHE_AUTO_PURGE'] && opts?.autoPurgeCache !== false) {
275
275
  await this.cache.clear();
276
276
  }
277
277
  return keys;