@travetto/model-memory 8.0.2 → 8.0.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/package.json +5 -5
- package/src/service.ts +15 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@travetto/model-memory",
|
|
3
|
-
"version": "8.0.
|
|
3
|
+
"version": "8.0.4",
|
|
4
4
|
"description": "Memory backing for the travetto model module.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"datastore",
|
|
@@ -29,15 +29,15 @@
|
|
|
29
29
|
"access": "public"
|
|
30
30
|
},
|
|
31
31
|
"dependencies": {
|
|
32
|
-
"@travetto/config": "^8.0.
|
|
32
|
+
"@travetto/config": "^8.0.3",
|
|
33
33
|
"@travetto/di": "^8.0.1",
|
|
34
|
-
"@travetto/model": "^8.0.
|
|
35
|
-
"@travetto/model-indexed": "^8.0.
|
|
34
|
+
"@travetto/model": "^8.0.4",
|
|
35
|
+
"@travetto/model-indexed": "^8.0.4",
|
|
36
36
|
"@travetto/schema": "^8.0.2"
|
|
37
37
|
},
|
|
38
38
|
"peerDependencies": {
|
|
39
39
|
"@travetto/cli": "^8.0.2",
|
|
40
|
-
"@travetto/test": "^8.0.
|
|
40
|
+
"@travetto/test": "^8.0.2"
|
|
41
41
|
},
|
|
42
42
|
"peerDependenciesMeta": {
|
|
43
43
|
"@travetto/cli": {
|
package/src/service.ts
CHANGED
|
@@ -421,8 +421,23 @@ export class MemoryModelService
|
|
|
421
421
|
}
|
|
422
422
|
}
|
|
423
423
|
|
|
424
|
+
async deleteModel<T extends ModelType>(cls: Class<T>): Promise<void> {
|
|
425
|
+
const key = ModelRegistryIndex.getStoreName(cls);
|
|
426
|
+
this.#store.delete(key);
|
|
427
|
+
for (const index of ModelRegistryIndex.getIndices(cls)) {
|
|
428
|
+
if (isModelIndexedIndex(index)) {
|
|
429
|
+
this.#indices[index.type].delete(indexName(cls, index));
|
|
430
|
+
}
|
|
431
|
+
}
|
|
432
|
+
}
|
|
433
|
+
|
|
424
434
|
async truncateModel<T extends ModelType>(cls: Class<T>): Promise<void> {
|
|
425
435
|
this.#getStore(cls).clear();
|
|
436
|
+
for (const index of ModelRegistryIndex.getIndices(cls)) {
|
|
437
|
+
if (isModelIndexedIndex(index)) {
|
|
438
|
+
this.#indices[index.type].get(indexName(cls, index))?.clear();
|
|
439
|
+
}
|
|
440
|
+
}
|
|
426
441
|
}
|
|
427
442
|
|
|
428
443
|
async truncateBlob(): Promise<void> {
|