@lmzhen/dsh-evolution-state-json 0.3.45 → 0.3.47
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/lib/index.js +7 -0
- package/package.json +6 -6
package/lib/index.js
CHANGED
|
@@ -72,6 +72,9 @@ async function jsonTransact(io, root, file, task) {
|
|
|
72
72
|
return await quarantine(io, root, file, current, error instanceof Error ? error.message : String(error));
|
|
73
73
|
}
|
|
74
74
|
if (RECORD_MAP_FILES.has(file) && !isPlainRecord(parsed)) return await quarantine(io, root, file, current, `expected a plain JSON object (map of records), got ${Array.isArray(parsed) ? "an array" : parsed === null ? "null" : typeof parsed}`);
|
|
75
|
+
if (RECORD_MAP_FILES.has(file) && isPlainRecord(parsed)) {
|
|
76
|
+
for (const [recordId, record] of Object.entries(parsed)) if (!isPlainRecord(record)) return await quarantine(io, root, file, current, `expected a plain object for record "${recordId}", got ${record === null ? "null" : Array.isArray(record) ? "an array" : typeof record}`);
|
|
77
|
+
}
|
|
75
78
|
}
|
|
76
79
|
const next = await task(parsed);
|
|
77
80
|
if (next !== null && RECORD_MAP_FILES.has(file) && !isPlainRecord(next)) throw new Error(`evolution state file "${file}" task returned ${Array.isArray(next) ? "an array" : typeof next} (expected null or a plain JSON object map of records); not written.`);
|
|
@@ -92,6 +95,9 @@ function apply(ctx, rawConfig) {
|
|
|
92
95
|
return await quarantine(io, root, file, raw, error instanceof Error ? error.message : String(error));
|
|
93
96
|
}
|
|
94
97
|
if (RECORD_MAP_FILES.has(file) && !isPlainRecord(parsed)) return await quarantine(io, root, file, raw, `expected a plain JSON object (map of records), got ${Array.isArray(parsed) ? "an array" : parsed === null ? "null" : typeof parsed}`);
|
|
98
|
+
if (RECORD_MAP_FILES.has(file) && isPlainRecord(parsed)) {
|
|
99
|
+
for (const [recordId, record] of Object.entries(parsed)) if (!isPlainRecord(record)) return await quarantine(io, root, file, raw, `expected a plain object for record "${recordId}", got ${record === null ? "null" : Array.isArray(record) ? "an array" : typeof record}`);
|
|
100
|
+
}
|
|
95
101
|
return parsed;
|
|
96
102
|
}
|
|
97
103
|
const mutate = makeSerialQueue();
|
|
@@ -309,6 +315,7 @@ function apply(ctx, rawConfig) {
|
|
|
309
315
|
const map = { ...await mergedWithFilteredLegacy(legacyMigrated ? null : await readJson("pending.json"), current ?? {}) };
|
|
310
316
|
const record = map[id];
|
|
311
317
|
if (!record || record.claimedBy !== claimId) return map;
|
|
318
|
+
if (record.status !== "pending" && record.status !== "executing") return map;
|
|
312
319
|
record.status = releasedStatus(record.status);
|
|
313
320
|
delete record.claimedBy;
|
|
314
321
|
delete record.claimedAt;
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lmzhen/dsh-evolution-state-json",
|
|
3
3
|
"description": "JSON-file evolution state provider over the IO seam (community build)",
|
|
4
|
-
"version": "0.3.
|
|
4
|
+
"version": "0.3.47",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"access": "public"
|
|
7
7
|
},
|
|
@@ -31,17 +31,17 @@
|
|
|
31
31
|
"license": "MIT",
|
|
32
32
|
"dependencies": {
|
|
33
33
|
"@deepseek-ai/schemastery": "^3.18.1",
|
|
34
|
-
"@lmzhen/dsh-evolution-core": "^0.3.
|
|
34
|
+
"@lmzhen/dsh-evolution-core": "^0.3.47"
|
|
35
35
|
},
|
|
36
36
|
"peerDependencies": {
|
|
37
37
|
"@deepseek-ai/dsh-invariants": "^0.1.1-rc.2",
|
|
38
38
|
"@deepseek-ai/cordis": "^4.0.1",
|
|
39
|
-
"@lmzhen/dsh-evolution-io": "^0.3.
|
|
40
|
-
"@lmzhen/dsh-evolution-state-storage": "^0.3.
|
|
39
|
+
"@lmzhen/dsh-evolution-io": "^0.3.47",
|
|
40
|
+
"@lmzhen/dsh-evolution-state-storage": "^0.3.47"
|
|
41
41
|
},
|
|
42
42
|
"devDependencies": {
|
|
43
43
|
"@deepseek-ai/dsh-invariants": "^0.1.1-rc.2",
|
|
44
|
-
"@lmzhen/dsh-evolution-io": "^0.3.
|
|
45
|
-
"@lmzhen/dsh-evolution-state-storage": "^0.3.
|
|
44
|
+
"@lmzhen/dsh-evolution-io": "^0.3.47",
|
|
45
|
+
"@lmzhen/dsh-evolution-state-storage": "^0.3.47"
|
|
46
46
|
}
|
|
47
47
|
}
|