@pellux/goodvibes-sdk 0.33.0 → 0.33.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/dist/contracts/artifacts/operator-contract.json +1 -1
- package/dist/platform/state/json-file-store.d.ts.map +1 -1
- package/dist/platform/state/json-file-store.js +11 -4
- package/dist/platform/state/persistent-store.d.ts.map +1 -1
- package/dist/platform/state/persistent-store.js +12 -5
- package/dist/platform/version.js +1 -1
- package/package.json +9 -9
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"json-file-store.d.ts","sourceRoot":"","sources":["../../../src/platform/state/json-file-store.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"json-file-store.d.ts","sourceRoot":"","sources":["../../../src/platform/state/json-file-store.ts"],"names":[],"mappings":"AAKA;;;;;;GAMG;AACH,qBAAa,aAAa,CAAC,CAAC;IACd,OAAO,CAAC,QAAQ,CAAC,QAAQ;gBAAR,QAAQ,EAAE,MAAM;IAE7C,2EAA2E;IACrE,IAAI,IAAI,OAAO,CAAC,CAAC,GAAG,IAAI,CAAC;IAa/B,uCAAuC;IACjC,IAAI,CAAC,IAAI,EAAE,CAAC,GAAG,OAAO,CAAC,IAAI,CAAC;CAYnC"}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { randomUUID } from 'node:crypto';
|
|
2
|
+
import { promises as fs, existsSync, mkdirSync } from 'node:fs';
|
|
2
3
|
import { dirname } from 'node:path';
|
|
3
4
|
import { summarizeError } from '../utils/error-display.js';
|
|
4
5
|
/**
|
|
@@ -29,9 +30,15 @@ export class JsonFileStore {
|
|
|
29
30
|
/** Atomically persist data to disk. */
|
|
30
31
|
async save(data) {
|
|
31
32
|
mkdirSync(dirname(this.filePath), { recursive: true });
|
|
32
|
-
const tmpPath = `${this.filePath}.tmp`;
|
|
33
|
+
const tmpPath = `${this.filePath}.tmp.${process.pid}.${randomUUID()}`;
|
|
33
34
|
const content = JSON.stringify(data, null, 2) + '\n';
|
|
34
|
-
|
|
35
|
-
|
|
35
|
+
try {
|
|
36
|
+
await fs.writeFile(tmpPath, content, 'utf-8');
|
|
37
|
+
await fs.rename(tmpPath, this.filePath);
|
|
38
|
+
}
|
|
39
|
+
catch (error) {
|
|
40
|
+
await fs.rm(tmpPath, { force: true }).catch(() => undefined);
|
|
41
|
+
throw error;
|
|
42
|
+
}
|
|
36
43
|
}
|
|
37
44
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"persistent-store.d.ts","sourceRoot":"","sources":["../../../src/platform/state/persistent-store.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"persistent-store.d.ts","sourceRoot":"","sources":["../../../src/platform/state/persistent-store.ts"],"names":[],"mappings":"AAKA;;;;;;GAMG;AACH,qBAAa,eAAe,CAAC,CAAC,SAAS,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC;IAC5D,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAAS;IAClC,OAAO,CAAC,QAAQ,CAAC,GAAG,CAAS;IAC7B,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAAU;IACnC,OAAO,CAAC,UAAU,CAAkB;gBAExB,QAAQ,EAAE,MAAM;IAM5B,2EAA2E;IACrE,IAAI,IAAI,OAAO,CAAC,CAAC,GAAG,IAAI,CAAC;IAa/B,uCAAuC;IACjC,OAAO,CAAC,IAAI,EAAE,CAAC,GAAG,OAAO,CAAC,IAAI,CAAC;CAgBtC"}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
+
import { randomUUID } from 'node:crypto';
|
|
1
2
|
import { promises as fs, existsSync } from 'fs';
|
|
2
|
-
import {
|
|
3
|
+
import { dirname } from 'path';
|
|
3
4
|
import { summarizeError } from '../utils/error-display.js';
|
|
4
5
|
/**
|
|
5
6
|
* PersistentStore — generic JSON file persistence with atomic writes.
|
|
@@ -15,7 +16,7 @@ export class PersistentStore {
|
|
|
15
16
|
memoryData = null;
|
|
16
17
|
constructor(filePath) {
|
|
17
18
|
this.filePath = filePath;
|
|
18
|
-
this.dir =
|
|
19
|
+
this.dir = dirname(filePath);
|
|
19
20
|
this.inMemory = filePath === ':memory:';
|
|
20
21
|
}
|
|
21
22
|
/** Load JSON data from disk, or return null if the file does not exist. */
|
|
@@ -40,9 +41,15 @@ export class PersistentStore {
|
|
|
40
41
|
return;
|
|
41
42
|
}
|
|
42
43
|
await fs.mkdir(this.dir, { recursive: true });
|
|
43
|
-
const tmpPath = `${this.filePath}.tmp`;
|
|
44
|
+
const tmpPath = `${this.filePath}.tmp.${process.pid}.${randomUUID()}`;
|
|
44
45
|
const content = JSON.stringify(data, null, 2) + '\n';
|
|
45
|
-
|
|
46
|
-
|
|
46
|
+
try {
|
|
47
|
+
await fs.writeFile(tmpPath, content, 'utf-8');
|
|
48
|
+
await fs.rename(tmpPath, this.filePath);
|
|
49
|
+
}
|
|
50
|
+
catch (error) {
|
|
51
|
+
await fs.rm(tmpPath, { force: true }).catch(() => undefined);
|
|
52
|
+
throw error;
|
|
53
|
+
}
|
|
47
54
|
}
|
|
48
55
|
}
|
package/dist/platform/version.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { readFileSync } from 'node:fs';
|
|
2
2
|
import { join } from 'node:path';
|
|
3
|
-
let version = '0.33.
|
|
3
|
+
let version = '0.33.1';
|
|
4
4
|
try {
|
|
5
5
|
const pkg = JSON.parse(readFileSync(join(import.meta.dir, '..', '..', 'package.json'), 'utf-8'));
|
|
6
6
|
version = pkg.version ?? version;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pellux/goodvibes-sdk",
|
|
3
|
-
"version": "0.33.
|
|
3
|
+
"version": "0.33.1",
|
|
4
4
|
"description": "TypeScript SDK for building GoodVibes operator, peer, web, mobile, and daemon-connected apps with typed contracts, auth, realtime events, and transport layers.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"goodvibes",
|
|
@@ -441,14 +441,14 @@
|
|
|
441
441
|
"sideEffects": false,
|
|
442
442
|
"type": "module",
|
|
443
443
|
"dependencies": {
|
|
444
|
-
"@pellux/goodvibes-contracts": "0.33.
|
|
445
|
-
"@pellux/goodvibes-daemon-sdk": "0.33.
|
|
446
|
-
"@pellux/goodvibes-errors": "0.33.
|
|
447
|
-
"@pellux/goodvibes-operator-sdk": "0.33.
|
|
448
|
-
"@pellux/goodvibes-peer-sdk": "0.33.
|
|
449
|
-
"@pellux/goodvibes-transport-core": "0.33.
|
|
450
|
-
"@pellux/goodvibes-transport-http": "0.33.
|
|
451
|
-
"@pellux/goodvibes-transport-realtime": "0.33.
|
|
444
|
+
"@pellux/goodvibes-contracts": "0.33.1",
|
|
445
|
+
"@pellux/goodvibes-daemon-sdk": "0.33.1",
|
|
446
|
+
"@pellux/goodvibes-errors": "0.33.1",
|
|
447
|
+
"@pellux/goodvibes-operator-sdk": "0.33.1",
|
|
448
|
+
"@pellux/goodvibes-peer-sdk": "0.33.1",
|
|
449
|
+
"@pellux/goodvibes-transport-core": "0.33.1",
|
|
450
|
+
"@pellux/goodvibes-transport-http": "0.33.1",
|
|
451
|
+
"@pellux/goodvibes-transport-realtime": "0.33.1"
|
|
452
452
|
},
|
|
453
453
|
"optionalDependencies": {
|
|
454
454
|
"@agentclientprotocol/sdk": "^0.21.0",
|