@travetto/model-memory 8.0.0-alpha.25 → 8.0.0-alpha.27

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 (2) hide show
  1. package/package.json +8 -8
  2. package/src/service.ts +3 -2
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@travetto/model-memory",
3
- "version": "8.0.0-alpha.25",
3
+ "version": "8.0.0-alpha.27",
4
4
  "type": "module",
5
5
  "description": "Memory backing for the travetto model module.",
6
6
  "keywords": [
@@ -26,15 +26,15 @@
26
26
  "directory": "module/model-memory"
27
27
  },
28
28
  "dependencies": {
29
- "@travetto/config": "^8.0.0-alpha.22",
30
- "@travetto/di": "^8.0.0-alpha.20",
31
- "@travetto/model": "^8.0.0-alpha.23",
32
- "@travetto/model-indexed": "^8.0.0-alpha.25",
33
- "@travetto/schema": "^8.0.0-alpha.22"
29
+ "@travetto/config": "^8.0.0-alpha.24",
30
+ "@travetto/di": "^8.0.0-alpha.22",
31
+ "@travetto/model": "^8.0.0-alpha.25",
32
+ "@travetto/model-indexed": "^8.0.0-alpha.27",
33
+ "@travetto/schema": "^8.0.0-alpha.24"
34
34
  },
35
35
  "peerDependencies": {
36
- "@travetto/cli": "^8.0.0-alpha.28",
37
- "@travetto/test": "^8.0.0-alpha.21"
36
+ "@travetto/cli": "^8.0.0-alpha.30",
37
+ "@travetto/test": "^8.0.0-alpha.23"
38
38
  },
39
39
  "peerDependenciesMeta": {
40
40
  "@travetto/cli": {
package/src/service.ts CHANGED
@@ -14,7 +14,8 @@ import {
14
14
  ModelStorageUtil,
15
15
  type ModelType,
16
16
  NotFoundError,
17
- type OptionalId
17
+ type OptionalId,
18
+ UniqueError
18
19
  } from '@travetto/model';
19
20
  import {
20
21
  type AllIndexes,
@@ -151,7 +152,7 @@ export class MemoryModelService
151
152
  if (idx.unique) {
152
153
  const existing = this.#indices[idx.type].get(idxName)?.get(key);
153
154
  if (existing && existing.size > 0 && !existing.has(item.id)) {
154
- throw new ExistsError(cls, key);
155
+ throw new UniqueError(cls, key);
155
156
  }
156
157
  }
157
158
  this.#indices[idx.type].getOrInsert(idxName, new Map()).getOrInsert(key, new Set()).add(item.id);