@nicia-ai/typegraph 0.47.0 → 0.48.0

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 (207) hide show
  1. package/dist/backend/drizzle/indexes.d.cts +1 -1
  2. package/dist/backend/drizzle/indexes.d.ts +1 -1
  3. package/dist/backend/index.cjs +27 -19
  4. package/dist/backend/index.d.cts +37 -55
  5. package/dist/backend/index.d.ts +37 -55
  6. package/dist/backend/index.js +4 -4
  7. package/dist/backend/postgres/index.cjs +7 -7
  8. package/dist/backend/postgres/index.d.cts +21 -7
  9. package/dist/backend/postgres/index.d.ts +21 -7
  10. package/dist/backend/postgres/index.js +6 -6
  11. package/dist/backend/postgres/pglite-store.cjs +17 -17
  12. package/dist/backend/postgres/pglite-store.d.cts +8 -8
  13. package/dist/backend/postgres/pglite-store.d.ts +8 -8
  14. package/dist/backend/postgres/pglite-store.js +14 -14
  15. package/dist/backend/postgres/pglite.cjs +8 -8
  16. package/dist/backend/postgres/pglite.d.cts +3 -3
  17. package/dist/backend/postgres/pglite.d.ts +3 -3
  18. package/dist/backend/postgres/pglite.js +7 -7
  19. package/dist/backend/sqlite/index.cjs +7 -7
  20. package/dist/backend/sqlite/index.d.cts +20 -7
  21. package/dist/backend/sqlite/index.d.ts +20 -7
  22. package/dist/backend/sqlite/index.js +6 -6
  23. package/dist/backend/sqlite/libsql.cjs +8 -8
  24. package/dist/backend/sqlite/libsql.d.cts +3 -3
  25. package/dist/backend/sqlite/libsql.d.ts +3 -3
  26. package/dist/backend/sqlite/libsql.js +6 -6
  27. package/dist/backend/sqlite/local-store.cjs +18 -18
  28. package/dist/backend/sqlite/local-store.d.cts +8 -8
  29. package/dist/backend/sqlite/local-store.d.ts +8 -8
  30. package/dist/backend/sqlite/local-store.js +15 -15
  31. package/dist/backend/sqlite/local.cjs +9 -9
  32. package/dist/backend/sqlite/local.d.cts +3 -3
  33. package/dist/backend/sqlite/local.d.ts +3 -3
  34. package/dist/backend/sqlite/local.js +7 -7
  35. package/dist/{chunk-EMIB2RXD.cjs → chunk-2HIYYMWY.cjs} +99 -96
  36. package/dist/chunk-2HIYYMWY.cjs.map +1 -0
  37. package/dist/{chunk-6KFLYYOC.cjs → chunk-2QGYQBS2.cjs} +5 -5
  38. package/dist/{chunk-6KFLYYOC.cjs.map → chunk-2QGYQBS2.cjs.map} +1 -1
  39. package/dist/{chunk-5FT3TLPK.js → chunk-2SYZXD54.js} +16 -13
  40. package/dist/chunk-2SYZXD54.js.map +1 -0
  41. package/dist/{chunk-XYBQI6LE.js → chunk-2TYSSBU5.js} +6 -6
  42. package/dist/{chunk-XYBQI6LE.js.map → chunk-2TYSSBU5.js.map} +1 -1
  43. package/dist/{chunk-6JVZSOHQ.cjs → chunk-3FPR224C.cjs} +26 -26
  44. package/dist/{chunk-6JVZSOHQ.cjs.map → chunk-3FPR224C.cjs.map} +1 -1
  45. package/dist/{chunk-MFZR4QKM.cjs → chunk-3KOY4FH3.cjs} +181 -4
  46. package/dist/chunk-3KOY4FH3.cjs.map +1 -0
  47. package/dist/{chunk-6FWSNSRE.js → chunk-4WMMBDS5.js} +4 -4
  48. package/dist/chunk-4WMMBDS5.js.map +1 -0
  49. package/dist/{chunk-NG2RB5WL.js → chunk-5K2BKEBD.js} +18 -3
  50. package/dist/chunk-5K2BKEBD.js.map +1 -0
  51. package/dist/chunk-5PRKMB24.cjs +124 -0
  52. package/dist/chunk-5PRKMB24.cjs.map +1 -0
  53. package/dist/chunk-6LN7FIVU.js +107 -0
  54. package/dist/chunk-6LN7FIVU.js.map +1 -0
  55. package/dist/{chunk-I4G3SQPF.cjs → chunk-7XUYFFR4.cjs} +7 -7
  56. package/dist/chunk-7XUYFFR4.cjs.map +1 -0
  57. package/dist/{chunk-KH7XW7VV.js → chunk-ACGSAMD3.js} +24 -27
  58. package/dist/chunk-ACGSAMD3.js.map +1 -0
  59. package/dist/{chunk-QS3NQZVC.js → chunk-AX6JGVTZ.js} +16 -11
  60. package/dist/chunk-AX6JGVTZ.js.map +1 -0
  61. package/dist/{chunk-DJZTXBWY.js → chunk-BRRP76WO.js} +71 -30
  62. package/dist/chunk-BRRP76WO.js.map +1 -0
  63. package/dist/{chunk-5UMTUOM5.js → chunk-CT3ZKTOF.js} +5 -4
  64. package/dist/chunk-CT3ZKTOF.js.map +1 -0
  65. package/dist/{chunk-XY5OMOJD.js → chunk-DZAICA5J.js} +3 -3
  66. package/dist/{chunk-XY5OMOJD.js.map → chunk-DZAICA5J.js.map} +1 -1
  67. package/dist/{chunk-OIFSOPSR.cjs → chunk-EZEEWCFJ.cjs} +38 -156
  68. package/dist/chunk-EZEEWCFJ.cjs.map +1 -0
  69. package/dist/{chunk-AMMWA76F.cjs → chunk-FA2AFWLP.cjs} +6 -6
  70. package/dist/{chunk-AMMWA76F.cjs.map → chunk-FA2AFWLP.cjs.map} +1 -1
  71. package/dist/{chunk-FNOMT74T.js → chunk-I4GAZH5Z.js} +180 -5
  72. package/dist/chunk-I4GAZH5Z.js.map +1 -0
  73. package/dist/{chunk-WGX7JH7E.cjs → chunk-JB6T4GLL.cjs} +106 -134
  74. package/dist/chunk-JB6T4GLL.cjs.map +1 -0
  75. package/dist/{chunk-MX4DHSQP.cjs → chunk-JFRT7S3B.cjs} +92 -98
  76. package/dist/chunk-JFRT7S3B.cjs.map +1 -0
  77. package/dist/{chunk-SE6EGQSD.js → chunk-KF6K7TGH.js} +38 -66
  78. package/dist/chunk-KF6K7TGH.js.map +1 -0
  79. package/dist/{chunk-ZHNXLS3C.js → chunk-NACVVDWB.js} +208 -8
  80. package/dist/chunk-NACVVDWB.js.map +1 -0
  81. package/dist/{chunk-M35DF33T.js → chunk-OD4SSY2U.js} +29 -16
  82. package/dist/chunk-OD4SSY2U.js.map +1 -0
  83. package/dist/{chunk-U5EDAVOJ.cjs → chunk-OTUPEF2W.cjs} +54 -49
  84. package/dist/chunk-OTUPEF2W.cjs.map +1 -0
  85. package/dist/{chunk-BCQ76AXA.cjs → chunk-PFBRJBUL.cjs} +107 -94
  86. package/dist/chunk-PFBRJBUL.cjs.map +1 -0
  87. package/dist/{chunk-AVGUJWVX.js → chunk-S5TERQVW.js} +15 -132
  88. package/dist/chunk-S5TERQVW.js.map +1 -0
  89. package/dist/chunk-SIT26LAZ.cjs +614 -0
  90. package/dist/chunk-SIT26LAZ.cjs.map +1 -0
  91. package/dist/{chunk-BR7SHKGM.cjs → chunk-SR725PWF.cjs} +548 -507
  92. package/dist/chunk-SR725PWF.cjs.map +1 -0
  93. package/dist/{chunk-5FBRVORR.cjs → chunk-TKZXMWQF.cjs} +8 -7
  94. package/dist/chunk-TKZXMWQF.cjs.map +1 -0
  95. package/dist/{chunk-425IZOQ5.cjs → chunk-TQHGE7UC.cjs} +20 -2
  96. package/dist/chunk-TQHGE7UC.cjs.map +1 -0
  97. package/dist/{chunk-GYUJZARH.cjs → chunk-TUNPBZY3.cjs} +4 -4
  98. package/dist/{chunk-GYUJZARH.cjs.map → chunk-TUNPBZY3.cjs.map} +1 -1
  99. package/dist/chunk-UGHG7PGX.js +592 -0
  100. package/dist/chunk-UGHG7PGX.js.map +1 -0
  101. package/dist/{chunk-KABFHAL7.cjs → chunk-UMGZDVOA.cjs} +213 -12
  102. package/dist/chunk-UMGZDVOA.cjs.map +1 -0
  103. package/dist/{chunk-UPAJHMW3.cjs → chunk-WCCATHMB.cjs} +54 -57
  104. package/dist/chunk-WCCATHMB.cjs.map +1 -0
  105. package/dist/{chunk-LEWHMOUY.js → chunk-YIURNGXI.js} +4 -4
  106. package/dist/{chunk-LEWHMOUY.js.map → chunk-YIURNGXI.js.map} +1 -1
  107. package/dist/{chunk-EP4RUYD6.js → chunk-YVF2EM7B.js} +3 -3
  108. package/dist/{chunk-EP4RUYD6.js.map → chunk-YVF2EM7B.js.map} +1 -1
  109. package/dist/{chunk-NNQ6A3RM.js → chunk-ZFMCDJGB.js} +7 -12
  110. package/dist/chunk-ZFMCDJGB.js.map +1 -0
  111. package/dist/core/index.cjs +6 -6
  112. package/dist/core/index.d.cts +4 -4
  113. package/dist/core/index.d.ts +4 -4
  114. package/dist/core/index.js +2 -2
  115. package/dist/ddl-BL1NZLMY.d.cts +78 -0
  116. package/dist/ddl-D_oW-EVO.d.ts +78 -0
  117. package/dist/graph-extension/index.d.cts +4 -4
  118. package/dist/graph-extension/index.d.ts +4 -4
  119. package/dist/graph-merge/index.cjs +334 -191
  120. package/dist/graph-merge/index.cjs.map +1 -1
  121. package/dist/graph-merge/index.d.cts +65 -15
  122. package/dist/graph-merge/index.d.ts +65 -15
  123. package/dist/graph-merge/index.js +174 -32
  124. package/dist/graph-merge/index.js.map +1 -1
  125. package/dist/{index-CHTv4XMZ.d.cts → index-COs_z6nV.d.cts} +2 -2
  126. package/dist/{index-CzoJ3MUw.d.ts → index-D7d1u2gr.d.ts} +2 -2
  127. package/dist/index.cjs +90 -86
  128. package/dist/index.d.cts +12 -12
  129. package/dist/index.d.ts +12 -12
  130. package/dist/index.js +13 -13
  131. package/dist/indexes/index.d.cts +4 -4
  132. package/dist/indexes/index.d.ts +4 -4
  133. package/dist/interchange/index.cjs +38 -38
  134. package/dist/interchange/index.d.cts +7 -7
  135. package/dist/interchange/index.d.ts +7 -7
  136. package/dist/interchange/index.js +10 -10
  137. package/dist/{manager-DlY1vlla.d.cts → manager-CYaff3n3.d.cts} +2 -2
  138. package/dist/{manager-B6sOQzcQ.d.ts → manager-D9eRT_ns.d.ts} +2 -2
  139. package/dist/{materialize-indexes-DQL4xcpf.d.ts → materialize-indexes-DJ3ykH59.d.ts} +1 -1
  140. package/dist/{materialize-indexes-sskhp-c_.d.cts → materialize-indexes-DTtAnvfY.d.cts} +1 -1
  141. package/dist/{postgres-BXy_nyMs.d.cts → postgres-CcL4bAHS.d.ts} +1 -1
  142. package/dist/{postgres-B6YOUcaK.d.ts → postgres-DMj39MEu.d.cts} +1 -1
  143. package/dist/profiler/index.d.cts +9 -9
  144. package/dist/profiler/index.d.ts +9 -9
  145. package/dist/provenance/index.cjs +25 -26
  146. package/dist/provenance/index.cjs.map +1 -1
  147. package/dist/provenance/index.d.cts +7 -7
  148. package/dist/provenance/index.d.ts +7 -7
  149. package/dist/provenance/index.js +9 -10
  150. package/dist/provenance/index.js.map +1 -1
  151. package/dist/repair-validity-windows-BFNZvd_H.d.cts +166 -0
  152. package/dist/repair-validity-windows-DlUSqwCg.d.ts +166 -0
  153. package/dist/schema/index.cjs +35 -35
  154. package/dist/schema/index.d.cts +6 -6
  155. package/dist/schema/index.d.ts +6 -6
  156. package/dist/schema/index.js +8 -8
  157. package/dist/{searchable-D9gMiwcS.d.ts → searchable-DHJMh_nj.d.cts} +1 -1
  158. package/dist/{searchable-0Cn_lY8U.d.cts → searchable-bpE1bBfc.d.ts} +1 -1
  159. package/dist/{sqlite-DioSxaPe.d.cts → sqlite-D7Oz0SQh.d.ts} +1 -1
  160. package/dist/{sqlite-ClXuBYAj.d.ts → sqlite-YppHrNFb.d.cts} +1 -1
  161. package/dist/{store-5j-w5onJ.d.ts → store-JUVvtmR4.d.cts} +113 -26
  162. package/dist/{store-CFedKGU5.d.cts → store-UzrGvZOo.d.ts} +113 -26
  163. package/dist/{temporal-CjO9FH1l.d.ts → temporal-5GqpYCk2.d.cts} +1 -1
  164. package/dist/{temporal-Ce1pG0S1.d.cts → temporal-CbnLzTmM.d.ts} +1 -1
  165. package/dist/{types-DKkMJZjR.d.cts → types-BqFZTQmV.d.cts} +29 -4
  166. package/dist/{types-DKkMJZjR.d.ts → types-BqFZTQmV.d.ts} +29 -4
  167. package/dist/{types-BrdOFu48.d.ts → types-Bx74kaTt.d.ts} +1 -1
  168. package/dist/{types-oj_OGAaZ.d.cts → types-CXAhpW-c.d.cts} +1 -1
  169. package/dist/{where-D1wKCJ4Q.d.cts → where-DI_Fqz-X.d.cts} +1 -1
  170. package/dist/{where-C8w2627G.d.ts → where-O-k2wgYm.d.ts} +1 -1
  171. package/package.json +1 -1
  172. package/dist/chunk-3HGRTCDU.cjs +0 -269
  173. package/dist/chunk-3HGRTCDU.cjs.map +0 -1
  174. package/dist/chunk-425IZOQ5.cjs.map +0 -1
  175. package/dist/chunk-5FBRVORR.cjs.map +0 -1
  176. package/dist/chunk-5FT3TLPK.js.map +0 -1
  177. package/dist/chunk-5UMTUOM5.js.map +0 -1
  178. package/dist/chunk-6FWSNSRE.js.map +0 -1
  179. package/dist/chunk-AVGUJWVX.js.map +0 -1
  180. package/dist/chunk-BCQ76AXA.cjs.map +0 -1
  181. package/dist/chunk-BR7SHKGM.cjs.map +0 -1
  182. package/dist/chunk-DJZTXBWY.js.map +0 -1
  183. package/dist/chunk-EMIB2RXD.cjs.map +0 -1
  184. package/dist/chunk-FNOMT74T.js.map +0 -1
  185. package/dist/chunk-I4G3SQPF.cjs.map +0 -1
  186. package/dist/chunk-JR6SX5RH.cjs +0 -268
  187. package/dist/chunk-JR6SX5RH.cjs.map +0 -1
  188. package/dist/chunk-KABFHAL7.cjs.map +0 -1
  189. package/dist/chunk-KH7XW7VV.js.map +0 -1
  190. package/dist/chunk-M35DF33T.js.map +0 -1
  191. package/dist/chunk-MFZR4QKM.cjs.map +0 -1
  192. package/dist/chunk-MX4DHSQP.cjs.map +0 -1
  193. package/dist/chunk-NAZ2RA4L.js +0 -254
  194. package/dist/chunk-NAZ2RA4L.js.map +0 -1
  195. package/dist/chunk-NG2RB5WL.js.map +0 -1
  196. package/dist/chunk-NNQ6A3RM.js.map +0 -1
  197. package/dist/chunk-OIFSOPSR.cjs.map +0 -1
  198. package/dist/chunk-QS3NQZVC.js.map +0 -1
  199. package/dist/chunk-SE6EGQSD.js.map +0 -1
  200. package/dist/chunk-SHSSRCFR.js +0 -246
  201. package/dist/chunk-SHSSRCFR.js.map +0 -1
  202. package/dist/chunk-U5EDAVOJ.cjs.map +0 -1
  203. package/dist/chunk-UPAJHMW3.cjs.map +0 -1
  204. package/dist/chunk-WGX7JH7E.cjs.map +0 -1
  205. package/dist/chunk-ZHNXLS3C.js.map +0 -1
  206. package/dist/ddl-CprnMXJ-.d.ts +0 -38
  207. package/dist/ddl-DJA7Lci5.d.cts +0 -38
@@ -1,11 +1,12 @@
1
- import { getEmbeddingFields, applyNodeInsertSideEffectsBatch, createNodeWriteContext, applyNodeSoftDelete, applyNodeHardDelete, applyNodeUpdate, applyNodeInsertSideEffects, checkUniquenessConstraints, createUniquenessContext } from './chunk-FNOMT74T.js';
2
- import { encodeTupleKey, runInWriteTransaction, refKey, runHookedWriteOperation, validateNodeProps } from './chunk-NNQ6A3RM.js';
3
- import { runInsertBatch, nodeInsertDispatch, runInsertBatchReturning, getNodeRowsByIds, generateId, runInsertNoReturn } from './chunk-AVGUJWVX.js';
1
+ import { getEmbeddingFields, validateResolvedNodeUniqueness, createUniquenessContext, applyNodeInsertSideEffectsBatch, createNodeWriteContext, applyNodeSoftDelete, applyNodeHardDelete, applyNodeUpdate, applyNodeInsertSideEffects, checkUniquenessConstraints } from './chunk-I4GAZH5Z.js';
2
+ import { runInWriteTransaction, refKey, runHookedWriteOperation, validateNodeProps } from './chunk-ZFMCDJGB.js';
3
+ import { encodeTupleKey, runInsertBatch, nodeInsertDispatch, runInsertBatchReturning, getNodeRowsByIds, generateId, runInsertNoReturn } from './chunk-S5TERQVW.js';
4
4
  import { canonicalEqual } from './chunk-JBQQ7THH.js';
5
+ import { deriveBackend } from './chunk-UGHG7PGX.js';
5
6
  import { createSqlSchema, DEFAULT_SQL_SCHEMA } from './chunk-NVY5CJFP.js';
6
- import { rowPropsToObject, createBackendOverlay, isLiveNodeRow } from './chunk-SHSSRCFR.js';
7
+ import { rowPropsToObject, isLiveNodeRow } from './chunk-6LN7FIVU.js';
7
8
  import { checkCardinality, checkUniqueEdge, checkWherePredicate, computeUniqueKey, getKindsForUniquenessCheck, checkDisjointness } from './chunk-GLHXM7C4.js';
8
- import { validateOptionalCanonicalIsoDate, assertOrderedValidityWindow, nowIso, preservesImmutableLowerBound, assertWritableValidityWindow } from './chunk-NG2RB5WL.js';
9
+ import { validateOptionalCanonicalIsoDate, nowIso, resolveStampedValidityLowerBound, assertOrderedValidityWindow, preservesImmutableLowerBound, assertWritableValidityWindow } from './chunk-5K2BKEBD.js';
9
10
  import { getDialect, compileNodeIndexFieldKeys, compileIndexWhere } from './chunk-ZDKTPBGV.js';
10
11
  import { sql, asCompiledRowsSql } from './chunk-3DMMGT6S.js';
11
12
  import { getSearchableFields } from './chunk-PC2UBAUB.js';
@@ -446,7 +447,7 @@ function createNodeBatchValidationBackend(graphId, registry, backend) {
446
447
  if (uniqueCache.has(cacheKey)) return;
447
448
  uniqueCache.set(cacheKey, row);
448
449
  }
449
- const validationBackend = createBackendOverlay(backend, {
450
+ const validationBackend = deriveBackend(backend, {
450
451
  getNode: getNodeCached,
451
452
  checkUnique: checkUniqueCached
452
453
  });
@@ -609,6 +610,7 @@ async function performNodeUpdate(ctx, input, backend, lock, options) {
609
610
  "validFrom"
610
611
  );
611
612
  const validFrom = preservesLiveLowerBound ? void 0 : statedValidFrom;
613
+ const resurrectionBound = resurrectionInstant === void 0 ? void 0 : resolveStampedValidityLowerBound(validFrom, validTo, resurrectionInstant);
612
614
  const windowVerdict = assertWritableValidityWindow(
613
615
  `${kind} "${id}"`,
614
616
  validFrom,
@@ -617,20 +619,18 @@ async function performNodeUpdate(ctx, input, backend, lock, options) {
617
619
  appliesStatedValidFrom: false,
618
620
  effectiveBoundIsStored: true
619
621
  } : {
620
- effectiveValidFrom: resurrectionInstant,
622
+ effectiveValidFrom: resurrectionBound,
621
623
  appliesStatedValidFrom: true,
622
- // The instant this write is about to stamp, not a bound the row holds.
624
+ // The bound this write is about to stamp, not one the row holds.
623
625
  effectiveBoundIsStored: false
624
626
  },
625
627
  validTo
626
628
  );
627
629
  const writeContext = createNodeWriteContext(ctx.graphId, ctx.registry, lock);
628
- const effectiveValidFrom = validFrom ?? resurrectionInstant;
629
630
  const shared = {
630
631
  schema: nodeKind.schema,
631
632
  validatedProps,
632
633
  uniqueConstraints: registration.unique ?? [],
633
- ...effectiveValidFrom !== void 0 && { validFrom: effectiveValidFrom },
634
634
  ...validTo !== void 0 && { validTo },
635
635
  ...input.clearValidTo === true && { clearValidTo: true },
636
636
  // The bound the verdict above READ, carried into the UPDATE's own `WHERE`
@@ -646,9 +646,10 @@ async function performNodeUpdate(ctx, input, backend, lock, options) {
646
646
  ...windowVerdict.storedLowerBoundFence
647
647
  };
648
648
  if (options?.clearDeleted) {
649
+ const resurrectionLowerBound = resurrectionInstant === void 0 ? validFrom !== void 0 && { validFrom } : { validFrom: resurrectionBound ?? null };
649
650
  const row2 = await applyNodeUpdate(
650
651
  writeContext,
651
- { ...shared, existing, clearDeleted: true },
652
+ { ...shared, existing, clearDeleted: true, ...resurrectionLowerBound },
652
653
  backend
653
654
  );
654
655
  return rowToNode(row2);
@@ -656,7 +657,11 @@ async function performNodeUpdate(ctx, input, backend, lock, options) {
656
657
  if (!isLiveNodeRow(existing)) throw new NodeNotFoundError(kind, id);
657
658
  const row = await applyNodeUpdate(
658
659
  writeContext,
659
- { ...shared, existing },
660
+ // An in-place update must not rewrite the stored bound, so it keeps the
661
+ // conditional spread: `buildUpdateNode` ignores `validFrom` off the
662
+ // resurrection leg, and stating one here would claim a rewrite that no
663
+ // statement performs.
664
+ { ...shared, existing, ...validFrom !== void 0 && { validFrom } },
660
665
  backend
661
666
  );
662
667
  return rowToNode(row);
@@ -819,6 +824,12 @@ async function resurrectPreparedNode(ctx, target, lock, prepared) {
819
824
  if (current.deleted_at === void 0) {
820
825
  throw createAlreadyExistsError("node", prepared.kind, prepared.id);
821
826
  }
827
+ const resurrectionInstant = nowIso();
828
+ const resurrectionBound = resolveStampedValidityLowerBound(
829
+ prepared.insertParams.validFrom,
830
+ prepared.insertParams.validTo,
831
+ resurrectionInstant
832
+ );
822
833
  try {
823
834
  return await applyNodeUpdate(
824
835
  createNodeWriteContext(ctx.graphId, ctx.registry, lock),
@@ -828,7 +839,10 @@ async function resurrectPreparedNode(ctx, target, lock, prepared) {
828
839
  schema: prepared.nodeKind.schema,
829
840
  validatedProps: prepared.validatedProps,
830
841
  uniqueConstraints: prepared.uniqueConstraints,
831
- ...prepared.insertParams.validFrom === void 0 ? {} : { validFrom: prepared.insertParams.validFrom },
842
+ // The decision itself, never an absence — see the same spelling on
843
+ // `performNodeUpdate`'s resurrection leg.
844
+ // eslint-disable-next-line unicorn/no-null -- `validFrom: null` means "store NULL"; omitting the key means "decide for me", and this path has already decided. See UpdateNodeParams.validFrom.
845
+ validFrom: resurrectionBound ?? null,
832
846
  ...prepared.insertParams.validTo === void 0 ? {} : { validTo: prepared.insertParams.validTo }
833
847
  },
834
848
  target
@@ -1263,57 +1277,15 @@ async function executeNodeUpdateWhere(ctx, kind, inputPatch, candidateIds, candi
1263
1277
  };
1264
1278
  });
1265
1279
  if (uniqueConstraints.length > 0) {
1266
- const affectedIds = new Set(result.rows.map((row) => row.id));
1267
- for (const constraint of uniqueConstraints) {
1268
- const keyToId = /* @__PURE__ */ new Map();
1269
- for (const item of sidecarItems) {
1270
- if (!checkWherePredicate(constraint, item.props)) continue;
1271
- const key = computeUniqueKey(
1272
- item.props,
1273
- constraint.fields,
1274
- constraint.collation
1275
- );
1276
- const priorId = keyToId.get(key);
1277
- if (priorId !== void 0 && priorId !== item.id) {
1278
- throw new UniquenessError({
1279
- constraintName: constraint.name,
1280
- kind,
1281
- existingId: priorId,
1282
- newId: item.id,
1283
- fields: constraint.fields
1284
- });
1285
- }
1286
- keyToId.set(key, item.id);
1287
- }
1288
- const keys = [...keyToId.keys()];
1289
- if (keys.length === 0) continue;
1290
- for (const kindToCheck of getKindsForUniquenessCheck(
1291
- kind,
1292
- constraint.scope,
1293
- ctx.registry
1294
- )) {
1295
- const existingRows = await requireDefined(
1296
- target.checkUniqueBatch
1297
- )({
1298
- graphId: ctx.graphId,
1299
- nodeKind: kindToCheck,
1300
- constraintName: constraint.name,
1301
- keys
1302
- });
1303
- for (const existing of existingRows) {
1304
- if (existing.concrete_kind === kind && affectedIds.has(existing.node_id)) {
1305
- continue;
1306
- }
1307
- throw new UniquenessError({
1308
- constraintName: constraint.name,
1309
- kind: kindToCheck,
1310
- existingId: existing.node_id,
1311
- newId: requireDefined(keyToId.get(existing.key)),
1312
- fields: constraint.fields
1313
- });
1314
- }
1315
- }
1316
- }
1280
+ await validateResolvedNodeUniqueness(
1281
+ createUniquenessContext(ctx.graphId, ctx.registry, target),
1282
+ sidecarItems.map((item) => ({
1283
+ kind: item.kind,
1284
+ id: item.id,
1285
+ props: item.props,
1286
+ constraints: item.uniqueConstraints
1287
+ }))
1288
+ );
1317
1289
  await requireDefined(hardDeleteUniquesByNodeIds)({
1318
1290
  graphId: ctx.graphId,
1319
1291
  concreteKind: kind,
@@ -2014,5 +1986,5 @@ async function executeNodeBulkGetOrCreateByConstraint(ctx, kind, constraintName,
2014
1986
  }
2015
1987
 
2016
1988
  export { assertClearValidToSupported, assertValidityEndMutation, checkCardinalityConstraint, createNodeBatchValidationBackend, edgeWriteNeedsConstraintFence, executeNodeBulkFindByConstraint, executeNodeBulkFindByIndex, executeNodeBulkGetOrCreateByConstraint, executeNodeCreate, executeNodeCreateBatch, executeNodeCreateNoReturnBatch, executeNodeDelete, executeNodeDeleteBatch, executeNodeFindByConstraint, executeNodeGetOrCreateByConstraint, executeNodeHardDelete, executeNodeUpdate, executeNodeUpdateWhere, executeNodeUpsertUpdate, nodeUpsertDirtyCheck, primeBatchValidationCaches, rowToEdge, rowToEdgeMeta, rowToNode, rowToNodeMeta, validityEndAfterMutation, withAlreadyExistsTranslation };
2017
- //# sourceMappingURL=chunk-SE6EGQSD.js.map
2018
- //# sourceMappingURL=chunk-SE6EGQSD.js.map
1989
+ //# sourceMappingURL=chunk-KF6K7TGH.js.map
1990
+ //# sourceMappingURL=chunk-KF6K7TGH.js.map