@travetto/model-file 6.0.0-rc.1 → 6.0.0-rc.2
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/README.md +3 -3
- package/__index__.ts +1 -1
- package/package.json +7 -7
- package/src/service.ts +10 -7
package/README.md
CHANGED
|
@@ -14,6 +14,6 @@ yarn add @travetto/model-file
|
|
|
14
14
|
```
|
|
15
15
|
|
|
16
16
|
This module provides an file-based implementation for the [Data Modeling Support](https://github.com/travetto/travetto/tree/main/module/model#readme "Datastore abstraction for core operations."). Supported features:
|
|
17
|
-
* [CRUD](https://github.com/travetto/travetto/tree/main/module/model/src/
|
|
18
|
-
* [Expiry](https://github.com/travetto/travetto/tree/main/module/model/src/
|
|
19
|
-
* [Blob](https://github.com/travetto/travetto/tree/main/module/model/src/
|
|
17
|
+
* [CRUD](https://github.com/travetto/travetto/tree/main/module/model/src/types/crud.ts#L11)
|
|
18
|
+
* [Expiry](https://github.com/travetto/travetto/tree/main/module/model/src/types/expiry.ts#L10)
|
|
19
|
+
* [Blob](https://github.com/travetto/travetto/tree/main/module/model/src/types/blob.ts#L8)
|
package/__index__.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export * from './src/service';
|
|
1
|
+
export * from './src/service.ts';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@travetto/model-file",
|
|
3
|
-
"version": "6.0.0-rc.
|
|
3
|
+
"version": "6.0.0-rc.2",
|
|
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": "^6.0.0-rc.
|
|
29
|
-
"@travetto/di": "^6.0.0-rc.
|
|
30
|
-
"@travetto/model": "^6.0.0-rc.
|
|
31
|
-
"@travetto/schema": "^6.0.0-rc.
|
|
28
|
+
"@travetto/config": "^6.0.0-rc.2",
|
|
29
|
+
"@travetto/di": "^6.0.0-rc.2",
|
|
30
|
+
"@travetto/model": "^6.0.0-rc.2",
|
|
31
|
+
"@travetto/schema": "^6.0.0-rc.2"
|
|
32
32
|
},
|
|
33
33
|
"peerDependencies": {
|
|
34
|
-
"@travetto/cli": "^6.0.0-rc.
|
|
35
|
-
"@travetto/test": "^6.0.0-rc.
|
|
34
|
+
"@travetto/cli": "^6.0.0-rc.2",
|
|
35
|
+
"@travetto/test": "^6.0.0-rc.2"
|
|
36
36
|
},
|
|
37
37
|
"peerDependenciesMeta": {
|
|
38
38
|
"@travetto/cli": {
|
package/src/service.ts
CHANGED
|
@@ -10,15 +10,14 @@ import { Config } from '@travetto/config';
|
|
|
10
10
|
import { Required } from '@travetto/schema';
|
|
11
11
|
import {
|
|
12
12
|
ModelCrudSupport, ModelExpirySupport, ModelStorageSupport, ModelType, ModelRegistry,
|
|
13
|
-
NotFoundError, OptionalId, ExistsError, ModelBlobSupport
|
|
13
|
+
NotFoundError, OptionalId, ExistsError, ModelBlobSupport,
|
|
14
|
+
ModelCrudUtil, ModelExpiryUtil, ModelBlobUtil
|
|
14
15
|
} from '@travetto/model';
|
|
15
16
|
|
|
16
|
-
import { ModelCrudUtil } from '@travetto/model/src/internal/service/crud';
|
|
17
|
-
import { ModelExpiryUtil } from '@travetto/model/src/internal/service/expiry';
|
|
18
|
-
import { MODEL_BLOB, ModelBlobNamespace, ModelBlobUtil } from '@travetto/model/src/internal/service/blob';
|
|
19
|
-
|
|
20
17
|
type Suffix = '.bin' | '.meta' | '.json' | '.expires';
|
|
21
18
|
|
|
19
|
+
const ModelBlobNamespace = '__blobs';
|
|
20
|
+
|
|
22
21
|
const BIN = '.bin';
|
|
23
22
|
const META = '.meta';
|
|
24
23
|
|
|
@@ -240,7 +239,11 @@ export class FileModelService implements ModelCrudSupport, ModelBlobSupport, Mod
|
|
|
240
239
|
await fs.rm(path.resolve(this.config.folder, this.config.namespace), { recursive: true, force: true });
|
|
241
240
|
}
|
|
242
241
|
|
|
243
|
-
async
|
|
244
|
-
await fs.rm(await this.#resolveName(cls
|
|
242
|
+
async truncateModel(cls: Class<ModelType>): Promise<void> {
|
|
243
|
+
await fs.rm(await this.#resolveName(cls), { recursive: true, force: true });
|
|
244
|
+
}
|
|
245
|
+
|
|
246
|
+
async truncateBlob(): Promise<void> {
|
|
247
|
+
await fs.rm(await this.#resolveName(ModelBlobNamespace), { recursive: true, force: true });
|
|
245
248
|
}
|
|
246
249
|
}
|