@travetto/model-file 5.0.0-rc.15 → 5.0.1
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 -5
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@travetto/model-file",
|
|
3
|
-
"version": "5.0.
|
|
3
|
+
"version": "5.0.1",
|
|
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": "^5.0.
|
|
29
|
-
"@travetto/di": "^5.0.
|
|
30
|
-
"@travetto/model": "^5.0.
|
|
31
|
-
"@travetto/schema": "^5.0.
|
|
28
|
+
"@travetto/config": "^5.0.1",
|
|
29
|
+
"@travetto/di": "^5.0.1",
|
|
30
|
+
"@travetto/model": "^5.0.1",
|
|
31
|
+
"@travetto/schema": "^5.0.1"
|
|
32
32
|
},
|
|
33
33
|
"peerDependencies": {
|
|
34
|
-
"@travetto/cli": "^5.0.
|
|
35
|
-
"@travetto/test": "^5.0.
|
|
34
|
+
"@travetto/cli": "^5.0.1",
|
|
35
|
+
"@travetto/test": "^5.0.1"
|
|
36
36
|
},
|
|
37
37
|
"peerDependenciesMeta": {
|
|
38
38
|
"@travetto/cli": {
|
package/src/service.ts
CHANGED
|
@@ -4,7 +4,7 @@ import os from 'node:os';
|
|
|
4
4
|
import { pipeline } from 'node:stream/promises';
|
|
5
5
|
import path from 'node:path';
|
|
6
6
|
|
|
7
|
-
import { Class, TimeSpan, Runtime,
|
|
7
|
+
import { Class, TimeSpan, Runtime, BlobMeta, ByteRange, BinaryInput, BinaryUtil } from '@travetto/runtime';
|
|
8
8
|
import { Injectable } from '@travetto/di';
|
|
9
9
|
import { Config } from '@travetto/config';
|
|
10
10
|
import { Required } from '@travetto/schema';
|
|
@@ -145,10 +145,10 @@ export class FileModelService implements ModelCrudSupport, ModelBlobSupport, Mod
|
|
|
145
145
|
async updatePartial<T extends ModelType>(cls: Class<T>, item: Partial<T> & { id: string }, view?: string): Promise<T> {
|
|
146
146
|
ModelCrudUtil.ensureNotSubType(cls);
|
|
147
147
|
const id = item.id;
|
|
148
|
-
|
|
149
|
-
const file = await this.#resolveName(cls, '.json',
|
|
150
|
-
await fs.writeFile(file, JSON.stringify(
|
|
151
|
-
return
|
|
148
|
+
const full = await ModelCrudUtil.naivePartialUpdate(cls, () => this.get(cls, id), item, view);
|
|
149
|
+
const file = await this.#resolveName(cls, '.json', full.id);
|
|
150
|
+
await fs.writeFile(file, JSON.stringify(full), { encoding: 'utf8' });
|
|
151
|
+
return full;
|
|
152
152
|
}
|
|
153
153
|
|
|
154
154
|
async delete<T extends ModelType>(cls: Class<T>, id: string): Promise<void> {
|