directus 9.7.1 → 9.8.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 (59) hide show
  1. package/dist/cache.js +2 -2
  2. package/dist/database/helpers/date/dialects/default.d.ts +3 -0
  3. package/dist/database/helpers/date/dialects/default.js +7 -0
  4. package/dist/database/helpers/date/dialects/sqlite.d.ts +0 -9
  5. package/dist/database/helpers/date/dialects/sqlite.js +0 -24
  6. package/dist/database/helpers/date/index.d.ts +6 -6
  7. package/dist/database/helpers/date/index.js +13 -13
  8. package/dist/database/helpers/date/types.d.ts +0 -9
  9. package/dist/database/helpers/{date → fn}/dialects/mssql.d.ts +3 -2
  10. package/dist/database/helpers/{date → fn}/dialects/mssql.js +14 -3
  11. package/dist/database/helpers/{date → fn}/dialects/mysql.d.ts +3 -2
  12. package/dist/database/helpers/{date → fn}/dialects/mysql.js +14 -3
  13. package/dist/database/helpers/{date → fn}/dialects/oracle.d.ts +3 -2
  14. package/dist/database/helpers/{date → fn}/dialects/oracle.js +14 -3
  15. package/dist/database/helpers/{date → fn}/dialects/postgres.d.ts +3 -2
  16. package/dist/database/helpers/{date → fn}/dialects/postgres.js +14 -3
  17. package/dist/database/helpers/fn/dialects/sqlite.d.ts +13 -0
  18. package/dist/database/helpers/fn/dialects/sqlite.js +42 -0
  19. package/dist/database/helpers/fn/index.d.ts +7 -0
  20. package/dist/database/helpers/fn/index.js +17 -0
  21. package/dist/database/helpers/fn/types.d.ts +18 -0
  22. package/dist/database/helpers/fn/types.js +27 -0
  23. package/dist/database/helpers/index.d.ts +4 -1
  24. package/dist/database/helpers/index.js +7 -1
  25. package/dist/database/migrations/20220308A-add-bookmark-icon-and-color.d.ts +3 -0
  26. package/dist/database/migrations/20220308A-add-bookmark-icon-and-color.js +17 -0
  27. package/dist/database/migrations/20220322A-rename-field-typecast-flags.js +6 -2
  28. package/dist/database/migrations/20220323A-add-field-validation.d.ts +3 -0
  29. package/dist/database/migrations/20220323A-add-field-validation.js +17 -0
  30. package/dist/database/migrations/20220325A-fix-typecast-flags.d.ts +3 -0
  31. package/dist/database/migrations/20220325A-fix-typecast-flags.js +49 -0
  32. package/dist/database/migrations/20220325B-add-default-language.d.ts +3 -0
  33. package/dist/database/migrations/20220325B-add-default-language.js +28 -0
  34. package/dist/database/run-ast.js +4 -2
  35. package/dist/database/system-data/fields/activity.yaml +4 -4
  36. package/dist/database/system-data/fields/fields.yaml +9 -0
  37. package/dist/database/system-data/fields/presets.yaml +14 -0
  38. package/dist/database/system-data/fields/settings.yaml +13 -1
  39. package/dist/logger.js +2 -1
  40. package/dist/services/activity.js +4 -1
  41. package/dist/services/authorization.d.ts +1 -1
  42. package/dist/services/authorization.js +128 -44
  43. package/dist/services/collections.js +222 -198
  44. package/dist/services/fields.js +184 -173
  45. package/dist/services/payload.js +8 -6
  46. package/dist/services/relations.js +93 -81
  47. package/dist/services/server.js +1 -0
  48. package/dist/services/shares.js +2 -1
  49. package/dist/services/users.js +3 -1
  50. package/dist/utils/apply-query.js +21 -3
  51. package/dist/utils/get-column.d.ts +6 -5
  52. package/dist/utils/get-column.js +16 -8
  53. package/dist/utils/get-schema.d.ts +1 -1
  54. package/dist/utils/get-schema.js +15 -10
  55. package/dist/utils/track.js +3 -2
  56. package/dist/utils/url.d.ts +1 -1
  57. package/dist/utils/url.js +1 -1
  58. package/dist/utils/validate-storage.js +3 -1
  59. package/package.json +12 -12
@@ -55,105 +55,113 @@ class CollectionsService {
55
55
  if (payload.collection.startsWith('directus_')) {
56
56
  throw new exceptions_1.InvalidPayloadException(`Collections can't start with "directus_"`);
57
57
  }
58
- const existingCollections = [
59
- ...((_b = (_a = (await this.knex.select('collection').from('directus_collections'))) === null || _a === void 0 ? void 0 : _a.map(({ collection }) => collection)) !== null && _b !== void 0 ? _b : []),
60
- ...Object.keys(this.schema.collections),
61
- ];
62
- if (existingCollections.includes(payload.collection)) {
63
- throw new exceptions_1.InvalidPayloadException(`Collection "${payload.collection}" already exists.`);
64
- }
65
- // Create the collection/fields in a transaction so it'll be reverted in case of errors or
66
- // permission problems. This might not work reliably in MySQL, as it doesn't support DDL in
67
- // transactions.
68
- await this.knex.transaction(async (trx) => {
69
- if (payload.schema) {
70
- // Directus heavily relies on the primary key of a collection, so we have to make sure that
71
- // every collection that is created has a primary key. If no primary key field is created
72
- // while making the collection, we default to an auto incremented id named `id`
73
- if (!payload.fields)
74
- payload.fields = [
75
- {
76
- field: 'id',
77
- type: 'integer',
78
- meta: {
79
- hidden: true,
80
- interface: 'numeric',
81
- readonly: true,
82
- },
83
- schema: {
84
- is_primary_key: true,
85
- has_auto_increment: true,
58
+ try {
59
+ const existingCollections = [
60
+ ...((_b = (_a = (await this.knex.select('collection').from('directus_collections'))) === null || _a === void 0 ? void 0 : _a.map(({ collection }) => collection)) !== null && _b !== void 0 ? _b : []),
61
+ ...Object.keys(this.schema.collections),
62
+ ];
63
+ if (existingCollections.includes(payload.collection)) {
64
+ throw new exceptions_1.InvalidPayloadException(`Collection "${payload.collection}" already exists.`);
65
+ }
66
+ // Create the collection/fields in a transaction so it'll be reverted in case of errors or
67
+ // permission problems. This might not work reliably in MySQL, as it doesn't support DDL in
68
+ // transactions.
69
+ await this.knex.transaction(async (trx) => {
70
+ if (payload.schema) {
71
+ // Directus heavily relies on the primary key of a collection, so we have to make sure that
72
+ // every collection that is created has a primary key. If no primary key field is created
73
+ // while making the collection, we default to an auto incremented id named `id`
74
+ if (!payload.fields)
75
+ payload.fields = [
76
+ {
77
+ field: 'id',
78
+ type: 'integer',
79
+ meta: {
80
+ hidden: true,
81
+ interface: 'numeric',
82
+ readonly: true,
83
+ },
84
+ schema: {
85
+ is_primary_key: true,
86
+ has_auto_increment: true,
87
+ },
86
88
  },
87
- },
88
- ];
89
- // Ensure that every field meta has the field/collection fields filled correctly
90
- payload.fields = payload.fields.map((field) => {
91
- if (field.meta) {
92
- field.meta = {
93
- ...field.meta,
94
- field: field.field,
95
- collection: payload.collection,
96
- };
97
- }
98
- return field;
99
- });
100
- const fieldsService = new fields_1.FieldsService({ knex: trx, schema: this.schema });
101
- await trx.schema.createTable(payload.collection, (table) => {
102
- for (const field of payload.fields) {
103
- if (field.type && constants_1.ALIAS_TYPES.includes(field.type) === false) {
104
- fieldsService.addColumnToTable(table, field);
89
+ ];
90
+ // Ensure that every field meta has the field/collection fields filled correctly
91
+ payload.fields = payload.fields.map((field) => {
92
+ if (field.meta) {
93
+ field.meta = {
94
+ ...field.meta,
95
+ field: field.field,
96
+ collection: payload.collection,
97
+ };
105
98
  }
106
- }
107
- });
108
- const fieldItemsService = new items_1.ItemsService('directus_fields', {
109
- knex: trx,
110
- accountability: this.accountability,
111
- schema: this.schema,
112
- });
113
- const fieldPayloads = payload.fields.filter((field) => field.meta).map((field) => field.meta);
114
- await fieldItemsService.createMany(fieldPayloads);
115
- }
116
- if (payload.meta) {
117
- const collectionItemsService = new items_1.ItemsService('directus_collections', {
118
- knex: trx,
119
- accountability: this.accountability,
120
- schema: this.schema,
121
- });
122
- await collectionItemsService.createOne({
123
- ...payload.meta,
124
- collection: payload.collection,
125
- });
126
- }
99
+ return field;
100
+ });
101
+ const fieldsService = new fields_1.FieldsService({ knex: trx, schema: this.schema });
102
+ await trx.schema.createTable(payload.collection, (table) => {
103
+ for (const field of payload.fields) {
104
+ if (field.type && constants_1.ALIAS_TYPES.includes(field.type) === false) {
105
+ fieldsService.addColumnToTable(table, field);
106
+ }
107
+ }
108
+ });
109
+ const fieldItemsService = new items_1.ItemsService('directus_fields', {
110
+ knex: trx,
111
+ accountability: this.accountability,
112
+ schema: this.schema,
113
+ });
114
+ const fieldPayloads = payload.fields.filter((field) => field.meta).map((field) => field.meta);
115
+ await fieldItemsService.createMany(fieldPayloads);
116
+ }
117
+ if (payload.meta) {
118
+ const collectionItemsService = new items_1.ItemsService('directus_collections', {
119
+ knex: trx,
120
+ accountability: this.accountability,
121
+ schema: this.schema,
122
+ });
123
+ await collectionItemsService.createOne({
124
+ ...payload.meta,
125
+ collection: payload.collection,
126
+ });
127
+ }
128
+ return payload.collection;
129
+ });
127
130
  return payload.collection;
128
- });
129
- if (this.cache && env_1.default.CACHE_AUTO_PURGE && (opts === null || opts === void 0 ? void 0 : opts.autoPurgeCache) !== false) {
130
- await this.cache.clear();
131
131
  }
132
- await (0, cache_1.clearSystemCache)();
133
- return payload.collection;
132
+ finally {
133
+ if (this.cache && env_1.default.CACHE_AUTO_PURGE && (opts === null || opts === void 0 ? void 0 : opts.autoPurgeCache) !== false) {
134
+ await this.cache.clear();
135
+ }
136
+ await (0, cache_1.clearSystemCache)();
137
+ }
134
138
  }
135
139
  /**
136
140
  * Create multiple new collections
137
141
  */
138
142
  async createMany(payloads, opts) {
139
- const collections = await this.knex.transaction(async (trx) => {
140
- const service = new CollectionsService({
141
- schema: this.schema,
142
- accountability: this.accountability,
143
- knex: trx,
143
+ try {
144
+ const collections = await this.knex.transaction(async (trx) => {
145
+ const service = new CollectionsService({
146
+ schema: this.schema,
147
+ accountability: this.accountability,
148
+ knex: trx,
149
+ });
150
+ const collectionNames = [];
151
+ for (const payload of payloads) {
152
+ const name = await service.createOne(payload, { autoPurgeCache: false });
153
+ collectionNames.push(name);
154
+ }
155
+ return collectionNames;
144
156
  });
145
- const collectionNames = [];
146
- for (const payload of payloads) {
147
- const name = await service.createOne(payload, { autoPurgeCache: false });
148
- collectionNames.push(name);
157
+ return collections;
158
+ }
159
+ finally {
160
+ if (this.cache && env_1.default.CACHE_AUTO_PURGE && (opts === null || opts === void 0 ? void 0 : opts.autoPurgeCache) !== false) {
161
+ await this.cache.clear();
149
162
  }
150
- return collectionNames;
151
- });
152
- if (this.cache && env_1.default.CACHE_AUTO_PURGE && (opts === null || opts === void 0 ? void 0 : opts.autoPurgeCache) !== false) {
153
- await this.cache.clear();
163
+ await (0, cache_1.clearSystemCache)();
154
164
  }
155
- await (0, cache_1.clearSystemCache)();
156
- return collections;
157
165
  }
158
166
  /**
159
167
  * Read all collections. Currently doesn't support any query.
@@ -252,31 +260,35 @@ class CollectionsService {
252
260
  if (this.accountability && this.accountability.admin !== true) {
253
261
  throw new exceptions_1.ForbiddenException();
254
262
  }
255
- const collectionItemsService = new items_1.ItemsService('directus_collections', {
256
- knex: this.knex,
257
- accountability: this.accountability,
258
- schema: this.schema,
259
- });
260
- const payload = data;
261
- if (!payload.meta) {
263
+ try {
264
+ const collectionItemsService = new items_1.ItemsService('directus_collections', {
265
+ knex: this.knex,
266
+ accountability: this.accountability,
267
+ schema: this.schema,
268
+ });
269
+ const payload = data;
270
+ if (!payload.meta) {
271
+ return collectionKey;
272
+ }
273
+ const exists = !!(await this.knex
274
+ .select('collection')
275
+ .from('directus_collections')
276
+ .where({ collection: collectionKey })
277
+ .first());
278
+ if (exists) {
279
+ await collectionItemsService.updateOne(collectionKey, payload.meta, opts);
280
+ }
281
+ else {
282
+ await collectionItemsService.createOne({ ...payload.meta, collection: collectionKey }, opts);
283
+ }
262
284
  return collectionKey;
263
285
  }
264
- const exists = !!(await this.knex
265
- .select('collection')
266
- .from('directus_collections')
267
- .where({ collection: collectionKey })
268
- .first());
269
- if (exists) {
270
- await collectionItemsService.updateOne(collectionKey, payload.meta, opts);
271
- }
272
- else {
273
- await collectionItemsService.createOne({ ...payload.meta, collection: collectionKey }, opts);
274
- }
275
- if (this.cache && env_1.default.CACHE_AUTO_PURGE && (opts === null || opts === void 0 ? void 0 : opts.autoPurgeCache) !== false) {
276
- await this.cache.clear();
286
+ finally {
287
+ if (this.cache && env_1.default.CACHE_AUTO_PURGE && (opts === null || opts === void 0 ? void 0 : opts.autoPurgeCache) !== false) {
288
+ await this.cache.clear();
289
+ }
290
+ await (0, cache_1.clearSystemCache)();
277
291
  }
278
- await (0, cache_1.clearSystemCache)();
279
- return collectionKey;
280
292
  }
281
293
  /**
282
294
  * Update multiple collections by name
@@ -285,21 +297,25 @@ class CollectionsService {
285
297
  if (this.accountability && this.accountability.admin !== true) {
286
298
  throw new exceptions_1.ForbiddenException();
287
299
  }
288
- await this.knex.transaction(async (trx) => {
289
- const service = new CollectionsService({
290
- schema: this.schema,
291
- accountability: this.accountability,
292
- knex: trx,
300
+ try {
301
+ await this.knex.transaction(async (trx) => {
302
+ const service = new CollectionsService({
303
+ schema: this.schema,
304
+ accountability: this.accountability,
305
+ knex: trx,
306
+ });
307
+ for (const collectionKey of collectionKeys) {
308
+ await service.updateOne(collectionKey, data, { autoPurgeCache: false });
309
+ }
293
310
  });
294
- for (const collectionKey of collectionKeys) {
295
- await service.updateOne(collectionKey, data, { autoPurgeCache: false });
311
+ return collectionKeys;
312
+ }
313
+ finally {
314
+ if (this.cache && env_1.default.CACHE_AUTO_PURGE && (opts === null || opts === void 0 ? void 0 : opts.autoPurgeCache) !== false) {
315
+ await this.cache.clear();
296
316
  }
297
- });
298
- if (this.cache && env_1.default.CACHE_AUTO_PURGE && (opts === null || opts === void 0 ? void 0 : opts.autoPurgeCache) !== false) {
299
- await this.cache.clear();
317
+ await (0, cache_1.clearSystemCache)();
300
318
  }
301
- await (0, cache_1.clearSystemCache)();
302
- return collectionKeys;
303
319
  }
304
320
  /**
305
321
  * Delete a single collection This will delete the table and all records within. It'll also
@@ -309,78 +325,82 @@ class CollectionsService {
309
325
  if (this.accountability && this.accountability.admin !== true) {
310
326
  throw new exceptions_1.ForbiddenException();
311
327
  }
312
- const collections = await this.readByQuery();
313
- const collectionToBeDeleted = collections.find((collection) => collection.collection === collectionKey);
314
- if (!!collectionToBeDeleted === false) {
315
- throw new exceptions_1.ForbiddenException();
316
- }
317
- await this.knex.transaction(async (trx) => {
318
- var _a;
319
- if (collectionToBeDeleted.schema) {
320
- await trx.schema.dropTable(collectionKey);
328
+ try {
329
+ const collections = await this.readByQuery();
330
+ const collectionToBeDeleted = collections.find((collection) => collection.collection === collectionKey);
331
+ if (!!collectionToBeDeleted === false) {
332
+ throw new exceptions_1.ForbiddenException();
321
333
  }
322
- // Make sure this collection isn't used as a group in any other collections
323
- await trx('directus_collections').update({ group: null }).where({ group: collectionKey });
324
- if (collectionToBeDeleted.meta) {
325
- const collectionItemsService = new items_1.ItemsService('directus_collections', {
326
- knex: trx,
327
- accountability: this.accountability,
328
- schema: this.schema,
329
- });
330
- await collectionItemsService.deleteOne(collectionKey);
331
- }
332
- if (collectionToBeDeleted.schema) {
333
- const fieldsService = new fields_1.FieldsService({
334
- knex: trx,
335
- accountability: this.accountability,
336
- schema: this.schema,
337
- });
338
- await trx('directus_fields').delete().where('collection', '=', collectionKey);
339
- await trx('directus_presets').delete().where('collection', '=', collectionKey);
340
- const revisionsToDelete = await trx
341
- .select('id')
342
- .from('directus_revisions')
343
- .where({ collection: collectionKey });
344
- if (revisionsToDelete.length > 0) {
345
- const keys = revisionsToDelete.map((record) => record.id);
346
- await trx('directus_revisions').update({ parent: null }).whereIn('parent', keys);
334
+ await this.knex.transaction(async (trx) => {
335
+ var _a;
336
+ if (collectionToBeDeleted.schema) {
337
+ await trx.schema.dropTable(collectionKey);
347
338
  }
348
- await trx('directus_revisions').delete().where('collection', '=', collectionKey);
349
- await trx('directus_activity').delete().where('collection', '=', collectionKey);
350
- await trx('directus_permissions').delete().where('collection', '=', collectionKey);
351
- await trx('directus_relations').delete().where({ many_collection: collectionKey });
352
- const relations = this.schema.relations.filter((relation) => {
353
- return relation.collection === collectionKey || relation.related_collection === collectionKey;
354
- });
355
- for (const relation of relations) {
356
- // Delete related o2m fields that point to current collection
357
- if (relation.related_collection && ((_a = relation.meta) === null || _a === void 0 ? void 0 : _a.one_field)) {
358
- await fieldsService.deleteField(relation.related_collection, relation.meta.one_field);
339
+ // Make sure this collection isn't used as a group in any other collections
340
+ await trx('directus_collections').update({ group: null }).where({ group: collectionKey });
341
+ if (collectionToBeDeleted.meta) {
342
+ const collectionItemsService = new items_1.ItemsService('directus_collections', {
343
+ knex: trx,
344
+ accountability: this.accountability,
345
+ schema: this.schema,
346
+ });
347
+ await collectionItemsService.deleteOne(collectionKey);
348
+ }
349
+ if (collectionToBeDeleted.schema) {
350
+ const fieldsService = new fields_1.FieldsService({
351
+ knex: trx,
352
+ accountability: this.accountability,
353
+ schema: this.schema,
354
+ });
355
+ await trx('directus_fields').delete().where('collection', '=', collectionKey);
356
+ await trx('directus_presets').delete().where('collection', '=', collectionKey);
357
+ const revisionsToDelete = await trx
358
+ .select('id')
359
+ .from('directus_revisions')
360
+ .where({ collection: collectionKey });
361
+ if (revisionsToDelete.length > 0) {
362
+ const keys = revisionsToDelete.map((record) => record.id);
363
+ await trx('directus_revisions').update({ parent: null }).whereIn('parent', keys);
364
+ }
365
+ await trx('directus_revisions').delete().where('collection', '=', collectionKey);
366
+ await trx('directus_activity').delete().where('collection', '=', collectionKey);
367
+ await trx('directus_permissions').delete().where('collection', '=', collectionKey);
368
+ await trx('directus_relations').delete().where({ many_collection: collectionKey });
369
+ const relations = this.schema.relations.filter((relation) => {
370
+ return relation.collection === collectionKey || relation.related_collection === collectionKey;
371
+ });
372
+ for (const relation of relations) {
373
+ // Delete related o2m fields that point to current collection
374
+ if (relation.related_collection && ((_a = relation.meta) === null || _a === void 0 ? void 0 : _a.one_field)) {
375
+ await fieldsService.deleteField(relation.related_collection, relation.meta.one_field);
376
+ }
377
+ // Delete related m2o fields that point to current collection
378
+ if (relation.related_collection === collectionKey) {
379
+ await fieldsService.deleteField(relation.collection, relation.field);
380
+ }
359
381
  }
360
- // Delete related m2o fields that point to current collection
361
- if (relation.related_collection === collectionKey) {
362
- await fieldsService.deleteField(relation.collection, relation.field);
382
+ const a2oRelationsThatIncludeThisCollection = this.schema.relations.filter((relation) => {
383
+ var _a, _b;
384
+ return (_b = (_a = relation.meta) === null || _a === void 0 ? void 0 : _a.one_allowed_collections) === null || _b === void 0 ? void 0 : _b.includes(collectionKey);
385
+ });
386
+ for (const relation of a2oRelationsThatIncludeThisCollection) {
387
+ const newAllowedCollections = relation
388
+ .meta.one_allowed_collections.filter((collection) => collectionKey !== collection)
389
+ .join(',');
390
+ await trx('directus_relations')
391
+ .update({ one_allowed_collections: newAllowedCollections })
392
+ .where({ id: relation.meta.id });
363
393
  }
364
394
  }
365
- const a2oRelationsThatIncludeThisCollection = this.schema.relations.filter((relation) => {
366
- var _a, _b;
367
- return (_b = (_a = relation.meta) === null || _a === void 0 ? void 0 : _a.one_allowed_collections) === null || _b === void 0 ? void 0 : _b.includes(collectionKey);
368
- });
369
- for (const relation of a2oRelationsThatIncludeThisCollection) {
370
- const newAllowedCollections = relation
371
- .meta.one_allowed_collections.filter((collection) => collectionKey !== collection)
372
- .join(',');
373
- await trx('directus_relations')
374
- .update({ one_allowed_collections: newAllowedCollections })
375
- .where({ id: relation.meta.id });
376
- }
395
+ });
396
+ return collectionKey;
397
+ }
398
+ finally {
399
+ if (this.cache && env_1.default.CACHE_AUTO_PURGE && (opts === null || opts === void 0 ? void 0 : opts.autoPurgeCache) !== false) {
400
+ await this.cache.clear();
377
401
  }
378
- });
379
- if (this.cache && env_1.default.CACHE_AUTO_PURGE && (opts === null || opts === void 0 ? void 0 : opts.autoPurgeCache) !== false) {
380
- await this.cache.clear();
402
+ await (0, cache_1.clearSystemCache)();
381
403
  }
382
- await (0, cache_1.clearSystemCache)();
383
- return collectionKey;
384
404
  }
385
405
  /**
386
406
  * Delete multiple collections by key
@@ -389,21 +409,25 @@ class CollectionsService {
389
409
  if (this.accountability && this.accountability.admin !== true) {
390
410
  throw new exceptions_1.ForbiddenException();
391
411
  }
392
- await this.knex.transaction(async (trx) => {
393
- const service = new CollectionsService({
394
- schema: this.schema,
395
- accountability: this.accountability,
396
- knex: trx,
412
+ try {
413
+ await this.knex.transaction(async (trx) => {
414
+ const service = new CollectionsService({
415
+ schema: this.schema,
416
+ accountability: this.accountability,
417
+ knex: trx,
418
+ });
419
+ for (const collectionKey of collectionKeys) {
420
+ await service.deleteOne(collectionKey, { autoPurgeCache: false });
421
+ }
397
422
  });
398
- for (const collectionKey of collectionKeys) {
399
- await service.deleteOne(collectionKey, { autoPurgeCache: false });
423
+ return collectionKeys;
424
+ }
425
+ finally {
426
+ if (this.cache && env_1.default.CACHE_AUTO_PURGE && (opts === null || opts === void 0 ? void 0 : opts.autoPurgeCache) !== false) {
427
+ await this.cache.clear();
400
428
  }
401
- });
402
- if (this.cache && env_1.default.CACHE_AUTO_PURGE && (opts === null || opts === void 0 ? void 0 : opts.autoPurgeCache) !== false) {
403
- await this.cache.clear();
429
+ await (0, cache_1.clearSystemCache)();
404
430
  }
405
- await (0, cache_1.clearSystemCache)();
406
- return collectionKeys;
407
431
  }
408
432
  }
409
433
  exports.CollectionsService = CollectionsService;