@travetto/model-memory 5.0.0-rc.12 → 5.0.0-rc.14
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 +5 -9
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@travetto/model-memory",
|
|
3
|
-
"version": "5.0.0-rc.
|
|
3
|
+
"version": "5.0.0-rc.14",
|
|
4
4
|
"description": "Memory backing for the travetto model module.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"datastore",
|
|
@@ -25,14 +25,14 @@
|
|
|
25
25
|
"directory": "module/model-memory"
|
|
26
26
|
},
|
|
27
27
|
"dependencies": {
|
|
28
|
-
"@travetto/config": "^5.0.0-rc.
|
|
29
|
-
"@travetto/di": "^5.0.0-rc.
|
|
30
|
-
"@travetto/model": "^5.0.0-rc.
|
|
31
|
-
"@travetto/schema": "^5.0.0-rc.
|
|
28
|
+
"@travetto/config": "^5.0.0-rc.13",
|
|
29
|
+
"@travetto/di": "^5.0.0-rc.12",
|
|
30
|
+
"@travetto/model": "^5.0.0-rc.14",
|
|
31
|
+
"@travetto/schema": "^5.0.0-rc.13"
|
|
32
32
|
},
|
|
33
33
|
"peerDependencies": {
|
|
34
|
-
"@travetto/cli": "^5.0.0-rc.
|
|
35
|
-
"@travetto/test": "^5.0.0-rc.
|
|
34
|
+
"@travetto/cli": "^5.0.0-rc.13",
|
|
35
|
+
"@travetto/test": "^5.0.0-rc.12"
|
|
36
36
|
},
|
|
37
37
|
"peerDependenciesMeta": {
|
|
38
38
|
"@travetto/cli": {
|
package/src/service.ts
CHANGED
|
@@ -6,14 +6,14 @@ import { Injectable } from '@travetto/di';
|
|
|
6
6
|
import { Config } from '@travetto/config';
|
|
7
7
|
import {
|
|
8
8
|
ModelType, IndexConfig, ModelCrudSupport, ModelExpirySupport, ModelStorageSupport, ModelIndexedSupport,
|
|
9
|
-
ModelRegistry, NotFoundError, ExistsError, OptionalId, ModelBlobSupport
|
|
9
|
+
ModelRegistry, NotFoundError, ExistsError, OptionalId, ModelBlobSupport
|
|
10
10
|
} from '@travetto/model';
|
|
11
11
|
|
|
12
12
|
import { ModelCrudUtil } from '@travetto/model/src/internal/service/crud';
|
|
13
13
|
import { ModelExpiryUtil } from '@travetto/model/src/internal/service/expiry';
|
|
14
14
|
import { ModelIndexedUtil } from '@travetto/model/src/internal/service/indexed';
|
|
15
15
|
import { ModelStorageUtil } from '@travetto/model/src/internal/service/storage';
|
|
16
|
-
import { MODEL_BLOB, ModelBlobNamespace } from '@travetto/model/src/internal/service/blob';
|
|
16
|
+
import { MODEL_BLOB, ModelBlobNamespace, ModelBlobUtil } from '@travetto/model/src/internal/service/blob';
|
|
17
17
|
|
|
18
18
|
const ModelBlobMetaNamespace = `${ModelBlobNamespace}_meta`;
|
|
19
19
|
|
|
@@ -232,15 +232,11 @@ export class MemoryModelService implements ModelCrudSupport, ModelBlobSupport, M
|
|
|
232
232
|
}
|
|
233
233
|
|
|
234
234
|
// Blob Support
|
|
235
|
-
async
|
|
236
|
-
await this.describeBlob(location)
|
|
237
|
-
|
|
238
|
-
throw new ExistsError(ModelBlobNamespace, location);
|
|
235
|
+
async upsertBlob(location: string, input: BinaryInput, meta?: BlobMeta, overwrite = true): Promise<void> {
|
|
236
|
+
if (!overwrite && await this.describeBlob(location).then(() => true, () => false)) {
|
|
237
|
+
return;
|
|
239
238
|
}
|
|
240
|
-
return this.upsertBlob(location, input, meta);
|
|
241
|
-
}
|
|
242
239
|
|
|
243
|
-
async upsertBlob(location: string, input: BinaryInput, meta?: BlobMeta): Promise<void> {
|
|
244
240
|
const [stream, blobMeta] = await ModelBlobUtil.getInput(input, meta);
|
|
245
241
|
const blobs = this.#getStore(ModelBlobNamespace);
|
|
246
242
|
const metaContent = this.#getStore(ModelBlobMetaNamespace);
|