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.
- package/dist/app.js +12 -12
- package/dist/auth/drivers/ldap.js +22 -22
- package/dist/auth/drivers/local.js +7 -7
- package/dist/auth/drivers/oauth2.js +27 -25
- package/dist/auth/drivers/openid.js +32 -30
- package/dist/auth/drivers/saml.js +10 -10
- package/dist/auth.js +4 -3
- package/dist/cache.js +16 -11
- package/dist/cli/commands/bootstrap/index.js +5 -4
- package/dist/cli/utils/create-db-connection.js +1 -1
- package/dist/cli/utils/create-env/index.js +1 -1
- package/dist/constants.d.ts +1 -0
- package/dist/constants.js +6 -5
- package/dist/controllers/activity.js +9 -9
- package/dist/controllers/assets.js +19 -18
- package/dist/controllers/auth.js +13 -13
- package/dist/controllers/collections.js +10 -10
- package/dist/controllers/dashboards.js +9 -9
- package/dist/controllers/extensions.js +3 -3
- package/dist/controllers/fields.js +16 -16
- package/dist/controllers/files.js +16 -15
- package/dist/controllers/flows.js +11 -11
- package/dist/controllers/folders.js +9 -9
- package/dist/controllers/graphql.js +6 -6
- package/dist/controllers/items.js +17 -17
- package/dist/controllers/notifications.js +9 -9
- package/dist/controllers/operations.js +9 -9
- package/dist/controllers/panels.js +9 -9
- package/dist/controllers/permissions.js +9 -9
- package/dist/controllers/presets.js +9 -9
- package/dist/controllers/relations.js +10 -10
- package/dist/controllers/revisions.js +3 -3
- package/dist/controllers/roles.js +9 -9
- package/dist/controllers/schema.js +5 -5
- package/dist/controllers/server.js +7 -7
- package/dist/controllers/settings.js +2 -2
- package/dist/controllers/shares.js +13 -13
- package/dist/controllers/users.js +16 -16
- package/dist/controllers/utils.js +5 -5
- package/dist/controllers/webhooks.js +9 -9
- package/dist/database/helpers/fn/types.d.ts +0 -1
- package/dist/database/helpers/fn/types.js +0 -2
- package/dist/database/helpers/index.d.ts +3 -3
- package/dist/database/index.js +5 -5
- package/dist/database/migrations/20210805B-change-image-metadata-structure.js +15 -15
- package/dist/database/migrations/run.js +1 -1
- package/dist/database/run-ast.js +4 -4
- package/dist/database/system-data/collections/index.js +2 -2
- package/dist/database/system-data/fields/index.js +3 -3
- package/dist/env.js +1 -1
- package/dist/extensions.js +10 -10
- package/dist/flows.js +33 -31
- package/dist/logger.d.ts +1 -0
- package/dist/logger.js +32 -32
- package/dist/mailer.js +16 -16
- package/dist/messenger.js +4 -4
- package/dist/middleware/authenticate.js +1 -1
- package/dist/middleware/cache.js +11 -11
- package/dist/middleware/collection-exists.js +3 -3
- package/dist/middleware/cors.js +7 -7
- package/dist/middleware/error-handler.js +2 -2
- package/dist/middleware/extract-token.js +2 -2
- package/dist/middleware/graphql.js +12 -6
- package/dist/middleware/rate-limiter-global.js +5 -5
- package/dist/middleware/rate-limiter-ip.js +2 -2
- package/dist/middleware/respond.js +16 -16
- package/dist/middleware/sanitize-query.js +1 -1
- package/dist/operations/exec/index.js +2 -2
- package/dist/rate-limiter.js +1 -1
- package/dist/request/validate-ip.js +2 -2
- package/dist/server.js +4 -4
- package/dist/services/activity.js +14 -14
- package/dist/services/assets.js +6 -6
- package/dist/services/authentication.js +9 -9
- package/dist/services/collections.js +9 -9
- package/dist/services/fields.js +5 -5
- package/dist/services/files.js +12 -12
- package/dist/services/graphql/index.js +100 -98
- package/dist/services/import-export.js +6 -6
- package/dist/services/items.js +6 -6
- package/dist/services/mail/index.js +5 -5
- package/dist/services/meta.js +1 -0
- package/dist/services/notifications.js +4 -4
- package/dist/services/revisions.js +3 -3
- package/dist/services/roles.js +5 -5
- package/dist/services/server.js +27 -27
- package/dist/services/shares.js +9 -9
- package/dist/services/specifications.js +5 -3
- package/dist/services/users.d.ts +1 -5
- package/dist/services/users.js +24 -27
- package/dist/storage/register-locations.js +1 -1
- package/dist/utils/apply-query.js +2 -1
- package/dist/utils/dynamic-import.js +1 -1
- package/dist/utils/generate-hash.js +1 -1
- package/dist/utils/get-ast-from-query.js +1 -1
- package/dist/utils/get-auth-providers.js +1 -1
- package/dist/utils/get-cache-headers.js +3 -3
- package/dist/utils/get-collection-from-alias.js +1 -0
- package/dist/utils/get-default-value.js +1 -1
- package/dist/utils/get-ip-from-req.js +2 -2
- package/dist/utils/get-permissions.js +11 -11
- package/dist/utils/get-schema.js +2 -2
- package/dist/utils/is-url-allowed.js +5 -2
- package/dist/utils/sanitize-query.js +26 -26
- package/dist/utils/should-skip-cache.js +2 -2
- package/dist/utils/track.js +16 -16
- package/dist/utils/validate-query.js +1 -1
- package/dist/utils/validate-storage.js +8 -8
- package/dist/webhooks.js +2 -2
- package/package.json +13 -13
- package/dist/utils/redact-header-cookies.d.ts +0 -1
- package/dist/utils/redact-header-cookies.js +0 -11
- /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
|
|
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
|
|
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
|
|
274
|
-
return collections.filter((collection) => env_1.default
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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) {
|
package/dist/services/fields.js
CHANGED
|
@@ -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
|
|
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
|
|
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
|
|
481
|
+
collectionMetaUpdates['archive_field'] = null;
|
|
482
482
|
}
|
|
483
483
|
if (collectionMeta?.sort_field === field) {
|
|
484
|
-
collectionMetaUpdates
|
|
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
|
|
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) {
|
package/dist/services/files.js
CHANGED
|
@@ -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
|
|
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
|
|
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
|
|
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
|
|
183
|
-
metadata.title = fullMetadata.iptc
|
|
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
|
|
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
|
|
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
|
|
268
|
+
const disk = storage.location(file['storage']);
|
|
269
269
|
// Delete file + thumbnails
|
|
270
|
-
for await (const filepath of disk.list(file
|
|
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
|
|
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;
|