@lmzhen/dsh-evolution-state-json 0.3.60 → 0.3.62

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.
Files changed (2) hide show
  1. package/lib/index.js +12 -1
  2. package/package.json +7 -7
package/lib/index.js CHANGED
@@ -165,6 +165,10 @@ async function jsonTransact(ctx, io, root, file, task) {
165
165
  }
166
166
  const next = await task(parsed);
167
167
  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.`);
168
+ if (next !== null && RECORD_MAP_FILES.has(file)) {
169
+ const failing = gateScan(file, next);
170
+ if (failing.length > 0) throw new Error(`evolution state file "${file}" write-back carries ${failing.length} record(s) that fail the field gate (${failing.map(([id]) => id).join(", ")}); not written.`);
171
+ }
168
172
  return next === null ? null : JSON.stringify(next, null, 2);
169
173
  });
170
174
  }
@@ -420,7 +424,7 @@ function apply(ctx, rawConfig) {
420
424
  });
421
425
  });
422
426
  },
423
- async tryResolvePending(id, status) {
427
+ async tryResolvePending(id, status, expectedClaimId) {
424
428
  return await mutate(async () => {
425
429
  let result = {
426
430
  record: null,
@@ -437,6 +441,13 @@ function apply(ctx, rawConfig) {
437
441
  };
438
442
  return map;
439
443
  }
444
+ if (expectedClaimId !== void 0 && record.claimedBy !== expectedClaimId) {
445
+ result = {
446
+ record,
447
+ applied: false
448
+ };
449
+ return map;
450
+ }
440
451
  const resolved = {
441
452
  ...record,
442
453
  status,
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.60",
4
+ "version": "0.3.62",
5
5
  "publishConfig": {
6
6
  "access": "public"
7
7
  },
@@ -31,18 +31,18 @@
31
31
  "license": "MIT",
32
32
  "dependencies": {
33
33
  "@deepseek-ai/schemastery": "^3.18.1",
34
- "@lmzhen/dsh-evolution-core": "^0.3.60"
34
+ "@lmzhen/dsh-evolution-core": "^0.3.62"
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.60",
40
- "@lmzhen/dsh-evolution-state-storage": "^0.3.60"
39
+ "@lmzhen/dsh-evolution-io": "^0.3.62",
40
+ "@lmzhen/dsh-evolution-state-storage": "^0.3.62"
41
41
  },
42
42
  "devDependencies": {
43
43
  "@deepseek-ai/dsh-invariants": "^0.1.1-rc.2",
44
- "@lmzhen/dsh-evolution-io": "^0.3.60",
45
- "@lmzhen/dsh-evolution-state-storage": "^0.3.60",
46
- "@lmzhen/dsh-evolution-io-node": "^0.3.60"
44
+ "@lmzhen/dsh-evolution-io": "^0.3.62",
45
+ "@lmzhen/dsh-evolution-state-storage": "^0.3.62",
46
+ "@lmzhen/dsh-evolution-io-node": "^0.3.62"
47
47
  }
48
48
  }