@travetto/model-file 6.0.0 → 7.0.0-rc.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.
- package/package.json +7 -7
- package/src/service.ts +3 -3
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@travetto/model-file",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "7.0.0-rc.0",
|
|
4
4
|
"description": "File system backing for the travetto model module.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"datastore",
|
|
@@ -25,14 +25,14 @@
|
|
|
25
25
|
"directory": "module/model-file"
|
|
26
26
|
},
|
|
27
27
|
"dependencies": {
|
|
28
|
-
"@travetto/config": "^
|
|
29
|
-
"@travetto/di": "^
|
|
30
|
-
"@travetto/model": "^
|
|
31
|
-
"@travetto/schema": "^
|
|
28
|
+
"@travetto/config": "^7.0.0-rc.0",
|
|
29
|
+
"@travetto/di": "^7.0.0-rc.0",
|
|
30
|
+
"@travetto/model": "^7.0.0-rc.0",
|
|
31
|
+
"@travetto/schema": "^7.0.0-rc.0"
|
|
32
32
|
},
|
|
33
33
|
"peerDependencies": {
|
|
34
|
-
"@travetto/cli": "^
|
|
35
|
-
"@travetto/test": "^
|
|
34
|
+
"@travetto/cli": "^7.0.0-rc.0",
|
|
35
|
+
"@travetto/test": "^7.0.0-rc.0"
|
|
36
36
|
},
|
|
37
37
|
"peerDependenciesMeta": {
|
|
38
38
|
"@travetto/cli": {
|
package/src/service.ts
CHANGED
|
@@ -9,7 +9,7 @@ import { Injectable } from '@travetto/di';
|
|
|
9
9
|
import { Config } from '@travetto/config';
|
|
10
10
|
import { Required } from '@travetto/schema';
|
|
11
11
|
import {
|
|
12
|
-
ModelCrudSupport, ModelExpirySupport, ModelStorageSupport, ModelType,
|
|
12
|
+
ModelCrudSupport, ModelExpirySupport, ModelStorageSupport, ModelType, ModelRegistryIndex,
|
|
13
13
|
NotFoundError, OptionalId, ExistsError, ModelBlobSupport,
|
|
14
14
|
ModelCrudUtil, ModelExpiryUtil, ModelBlobUtil
|
|
15
15
|
} from '@travetto/model';
|
|
@@ -66,7 +66,7 @@ export class FileModelService implements ModelCrudSupport, ModelBlobSupport, Mod
|
|
|
66
66
|
}
|
|
67
67
|
|
|
68
68
|
async #resolveName<T extends ModelType>(cls: Class<T> | string, suffix?: Suffix, id?: string): Promise<string> {
|
|
69
|
-
const name = typeof cls === 'string' ? cls :
|
|
69
|
+
const name = typeof cls === 'string' ? cls : ModelRegistryIndex.getStoreName(cls);
|
|
70
70
|
let resolved = path.resolve(this.config.folder, this.config.namespace, name);
|
|
71
71
|
if (id) {
|
|
72
72
|
resolved = path.resolve(resolved, id.replace(/^[/]/, '').substring(0, 3));
|
|
@@ -94,7 +94,7 @@ export class FileModelService implements ModelCrudSupport, ModelBlobSupport, Mod
|
|
|
94
94
|
}
|
|
95
95
|
|
|
96
96
|
checkExpiry<T extends ModelType>(cls: Class<T>, item: T): T {
|
|
97
|
-
const { expiresAt } =
|
|
97
|
+
const { expiresAt } = ModelRegistryIndex.getConfig(cls);
|
|
98
98
|
if (expiresAt && ModelExpiryUtil.getExpiryState(cls, item).expired) {
|
|
99
99
|
throw new NotFoundError(cls, item.id);
|
|
100
100
|
}
|