@travetto/model 3.1.3 → 3.1.5

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@travetto/model",
3
- "version": "3.1.3",
3
+ "version": "3.1.5",
4
4
  "description": "Datastore abstraction for core operations.",
5
5
  "keywords": [
6
6
  "datastore",
@@ -26,13 +26,13 @@
26
26
  "directory": "module/model"
27
27
  },
28
28
  "dependencies": {
29
- "@travetto/config": "^3.1.1",
29
+ "@travetto/config": "^3.1.2",
30
30
  "@travetto/di": "^3.1.1",
31
31
  "@travetto/registry": "^3.1.1",
32
- "@travetto/schema": "^3.1.1"
32
+ "@travetto/schema": "^3.1.2"
33
33
  },
34
34
  "peerDependencies": {
35
- "@travetto/cli": "^3.1.1",
35
+ "@travetto/cli": "^3.1.2",
36
36
  "@travetto/test": "^3.1.1"
37
37
  },
38
38
  "peerDependenciesMeta": {
@@ -211,13 +211,17 @@ export class FileModelService implements ModelCrudSupport, ModelStreamSupport, M
211
211
 
212
212
  // Expiry
213
213
  async deleteExpired<T extends ModelType>(cls: Class<T>): Promise<number> {
214
- const deleted = [];
214
+ const deleting = [];
215
215
  for await (const el of this.list(cls)) {
216
216
  if (ModelExpiryUtil.getExpiryState(cls, el).expired) {
217
- deleted.push(this.delete(cls, el.id));
217
+ deleting.push(this.delete(cls, el.id).catch(err => {
218
+ if (!(err instanceof NotFoundError)) {
219
+ throw err;
220
+ }
221
+ }));
218
222
  }
219
223
  }
220
- return (await Promise.all(deleted)).length;
224
+ return (await Promise.all(deleting)).length;
221
225
  }
222
226
 
223
227
  // Storage management
@@ -272,7 +272,11 @@ export class MemoryModelService implements ModelCrudSupport, ModelStreamSupport,
272
272
  const store = this.#getStore(cls);
273
273
  for (const id of [...store.keys()]) {
274
274
  if ((ModelExpiryUtil.getExpiryState(cls, await this.get(cls, id))).expired) {
275
- deleting.push(this.delete(cls, id));
275
+ deleting.push(this.delete(cls, id).catch(err => {
276
+ if (!(err instanceof NotFoundError)) {
277
+ throw err;
278
+ }
279
+ }));
276
280
  }
277
281
  }
278
282
  return (await Promise.all(deleting)).length;