@nicia-ai/typegraph 0.58.0 → 0.60.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 (179) hide show
  1. package/CHANGELOG.md +42 -0
  2. package/README.md +15 -0
  3. package/dist/{atomic-mutation-program-CPcn0ZPu.d.ts → atomic-mutation-program-BNvJ13bq.d.ts} +1 -1
  4. package/dist/{atomic-mutation-program-AqOe51XD.d.cts → atomic-mutation-program-DOVE147J.d.cts} +1 -1
  5. package/dist/backend/drizzle/engine/index.cjs +8 -8
  6. package/dist/backend/drizzle/engine/index.d.cts +9 -9
  7. package/dist/backend/drizzle/engine/index.d.ts +9 -9
  8. package/dist/backend/drizzle/engine/index.js +3 -3
  9. package/dist/backend/drizzle/indexes.cjs +6 -6
  10. package/dist/backend/drizzle/indexes.d.cts +1 -1
  11. package/dist/backend/drizzle/indexes.d.ts +1 -1
  12. package/dist/backend/drizzle/indexes.js +2 -2
  13. package/dist/backend/index.d.cts +7 -7
  14. package/dist/backend/index.d.ts +7 -7
  15. package/dist/backend/postgres/index.cjs +17 -17
  16. package/dist/backend/postgres/index.d.cts +8 -8
  17. package/dist/backend/postgres/index.d.ts +8 -8
  18. package/dist/backend/postgres/index.js +3 -3
  19. package/dist/backend/postgres/pglite-store.cjs +1 -1
  20. package/dist/backend/postgres/pglite-store.d.cts +6 -6
  21. package/dist/backend/postgres/pglite-store.d.ts +6 -6
  22. package/dist/backend/postgres/pglite-store.js +1 -1
  23. package/dist/backend/postgres/pglite.cjs +5 -5
  24. package/dist/backend/postgres/pglite.d.cts +3 -3
  25. package/dist/backend/postgres/pglite.d.ts +3 -3
  26. package/dist/backend/postgres/pglite.js +4 -4
  27. package/dist/backend/sqlite/index.cjs +16 -16
  28. package/dist/backend/sqlite/index.d.cts +7 -7
  29. package/dist/backend/sqlite/index.d.ts +7 -7
  30. package/dist/backend/sqlite/index.js +3 -3
  31. package/dist/backend/sqlite/libsql.cjs +7 -7
  32. package/dist/backend/sqlite/libsql.d.cts +3 -3
  33. package/dist/backend/sqlite/libsql.d.ts +3 -3
  34. package/dist/backend/sqlite/libsql.js +3 -3
  35. package/dist/backend/sqlite/local-store.cjs +1 -1
  36. package/dist/backend/sqlite/local-store.d.cts +6 -6
  37. package/dist/backend/sqlite/local-store.d.ts +6 -6
  38. package/dist/backend/sqlite/local-store.js +1 -1
  39. package/dist/backend/sqlite/local.cjs +5 -5
  40. package/dist/backend/sqlite/local.d.cts +3 -3
  41. package/dist/backend/sqlite/local.d.ts +3 -3
  42. package/dist/backend/sqlite/local.js +4 -4
  43. package/dist/{chunk-7JUD57B4.js → chunk-2DKIJP2R.js} +1044 -84
  44. package/dist/chunk-2DKIJP2R.js.map +1 -0
  45. package/dist/{chunk-QIKO6DL5.js → chunk-2QNFFAMF.js} +3 -3
  46. package/dist/{chunk-QIKO6DL5.js.map → chunk-2QNFFAMF.js.map} +1 -1
  47. package/dist/{chunk-6BVZHDAZ.js → chunk-43DOTETB.js} +3 -3
  48. package/dist/{chunk-6BVZHDAZ.js.map → chunk-43DOTETB.js.map} +1 -1
  49. package/dist/{chunk-US3BLFWM.js → chunk-7GNPCBS2.js} +3 -3
  50. package/dist/{chunk-US3BLFWM.js.map → chunk-7GNPCBS2.js.map} +1 -1
  51. package/dist/{chunk-IV5W7LKW.cjs → chunk-A22XPVBQ.cjs} +2 -2
  52. package/dist/chunk-A22XPVBQ.cjs.map +1 -0
  53. package/dist/{chunk-CVO2ZPW5.js → chunk-B4P4DAW3.js} +4 -4
  54. package/dist/{chunk-CVO2ZPW5.js.map → chunk-B4P4DAW3.js.map} +1 -1
  55. package/dist/{chunk-FHFPUORN.cjs → chunk-CNFKFE5L.cjs} +1375 -415
  56. package/dist/chunk-CNFKFE5L.cjs.map +1 -0
  57. package/dist/{chunk-4MZQVVPX.cjs → chunk-D5CHUSW7.cjs} +33 -2
  58. package/dist/chunk-D5CHUSW7.cjs.map +1 -0
  59. package/dist/{chunk-TKEJR2UL.cjs → chunk-DWO6WZP5.cjs} +6 -6
  60. package/dist/{chunk-TKEJR2UL.cjs.map → chunk-DWO6WZP5.cjs.map} +1 -1
  61. package/dist/{chunk-GUMNJJFP.cjs → chunk-EHDLHPMK.cjs} +9 -9
  62. package/dist/{chunk-GUMNJJFP.cjs.map → chunk-EHDLHPMK.cjs.map} +1 -1
  63. package/dist/{chunk-DV24YZHG.js → chunk-FTDRMXIJ.js} +6 -6
  64. package/dist/{chunk-DV24YZHG.js.map → chunk-FTDRMXIJ.js.map} +1 -1
  65. package/dist/{chunk-BYBMDK6X.js → chunk-GYOQAV6R.js} +3 -3
  66. package/dist/{chunk-BYBMDK6X.js.map → chunk-GYOQAV6R.js.map} +1 -1
  67. package/dist/{chunk-GTW5YKFV.js → chunk-HCNC53MU.js} +3 -3
  68. package/dist/{chunk-GTW5YKFV.js.map → chunk-HCNC53MU.js.map} +1 -1
  69. package/dist/{chunk-M7TRJXFE.js → chunk-ILVXUOQY.js} +3 -3
  70. package/dist/{chunk-M7TRJXFE.js.map → chunk-ILVXUOQY.js.map} +1 -1
  71. package/dist/{chunk-FGKWXSHF.cjs → chunk-KGQVK2II.cjs} +40 -40
  72. package/dist/{chunk-FGKWXSHF.cjs.map → chunk-KGQVK2II.cjs.map} +1 -1
  73. package/dist/{chunk-BMATB57B.cjs → chunk-KW3ON5IU.cjs} +11 -11
  74. package/dist/{chunk-BMATB57B.cjs.map → chunk-KW3ON5IU.cjs.map} +1 -1
  75. package/dist/{chunk-GK62U3S5.js → chunk-LOFUF6L7.js} +3 -3
  76. package/dist/{chunk-GK62U3S5.js.map → chunk-LOFUF6L7.js.map} +1 -1
  77. package/dist/{chunk-BPYZUJX5.cjs → chunk-MTJAT6UO.cjs} +5 -5
  78. package/dist/{chunk-BPYZUJX5.cjs.map → chunk-MTJAT6UO.cjs.map} +1 -1
  79. package/dist/{chunk-YTYB5KCQ.js → chunk-OH7QRGPQ.js} +33 -2
  80. package/dist/chunk-OH7QRGPQ.js.map +1 -0
  81. package/dist/{chunk-U53HFE4L.cjs → chunk-OKA6H3B3.cjs} +22 -22
  82. package/dist/{chunk-U53HFE4L.cjs.map → chunk-OKA6H3B3.cjs.map} +1 -1
  83. package/dist/{chunk-QR6V2BXA.cjs → chunk-PTFO3JI5.cjs} +114 -114
  84. package/dist/{chunk-QR6V2BXA.cjs.map → chunk-PTFO3JI5.cjs.map} +1 -1
  85. package/dist/{chunk-C3CN2C2T.cjs → chunk-Q6ZVQWH7.cjs} +38 -38
  86. package/dist/{chunk-C3CN2C2T.cjs.map → chunk-Q6ZVQWH7.cjs.map} +1 -1
  87. package/dist/{chunk-WAG3NVD7.cjs → chunk-QBQ465OX.cjs} +12 -12
  88. package/dist/{chunk-WAG3NVD7.cjs.map → chunk-QBQ465OX.cjs.map} +1 -1
  89. package/dist/{chunk-CRROO6PK.cjs → chunk-QHP2BCBJ.cjs} +4 -4
  90. package/dist/{chunk-CRROO6PK.cjs.map → chunk-QHP2BCBJ.cjs.map} +1 -1
  91. package/dist/{chunk-HWWPL2YL.js → chunk-QWIR5533.js} +2 -2
  92. package/dist/chunk-QWIR5533.js.map +1 -0
  93. package/dist/{chunk-ZHLWPHNT.cjs → chunk-RJ3GVX73.cjs} +6 -6
  94. package/dist/{chunk-ZHLWPHNT.cjs.map → chunk-RJ3GVX73.cjs.map} +1 -1
  95. package/dist/{chunk-SYKR6MVR.cjs → chunk-T2M2S5YZ.cjs} +59 -59
  96. package/dist/{chunk-SYKR6MVR.cjs.map → chunk-T2M2S5YZ.cjs.map} +1 -1
  97. package/dist/{chunk-OESX3T5K.js → chunk-TNNDNSNH.js} +4 -4
  98. package/dist/{chunk-OESX3T5K.js.map → chunk-TNNDNSNH.js.map} +1 -1
  99. package/dist/{chunk-5C4OYYDD.js → chunk-UVQMUBZ6.js} +6 -6
  100. package/dist/{chunk-5C4OYYDD.js.map → chunk-UVQMUBZ6.js.map} +1 -1
  101. package/dist/{chunk-IV3FENV2.js → chunk-W6K6NSRT.js} +5 -5
  102. package/dist/{chunk-IV3FENV2.js.map → chunk-W6K6NSRT.js.map} +1 -1
  103. package/dist/core/index.d.cts +3 -3
  104. package/dist/core/index.d.ts +3 -3
  105. package/dist/{ddl-wlEdaCQK.d.cts → ddl-B9lzB8Zi.d.cts} +3 -3
  106. package/dist/{ddl-DkFrUTn_.d.ts → ddl-DuZWvxBb.d.ts} +3 -3
  107. package/dist/graph-extension/index.d.cts +2 -2
  108. package/dist/graph-extension/index.d.ts +2 -2
  109. package/dist/graph-merge/index.cjs +122 -122
  110. package/dist/graph-merge/index.d.cts +7 -6
  111. package/dist/graph-merge/index.d.ts +7 -6
  112. package/dist/graph-merge/index.js +10 -10
  113. package/dist/{graph-templates-B4gkXVqg.d.ts → graph-templates-ClBhrXiA.d.ts} +2 -2
  114. package/dist/{graph-templates-6zTU7bNe.d.cts → graph-templates-DfmKDARd.d.cts} +2 -2
  115. package/dist/index.cjs +73 -73
  116. package/dist/index.d.cts +10 -10
  117. package/dist/index.d.ts +10 -10
  118. package/dist/index.js +11 -11
  119. package/dist/indexes/index.cjs +8 -8
  120. package/dist/indexes/index.d.cts +4 -4
  121. package/dist/indexes/index.d.ts +4 -4
  122. package/dist/indexes/index.js +3 -3
  123. package/dist/{ingestion-import-target-im9wEB00.d.cts → ingestion-import-target-BSgJagqI.d.cts} +1 -1
  124. package/dist/{ingestion-import-target-SopMSm-T.d.ts → ingestion-import-target-PNw10V4T.d.ts} +1 -1
  125. package/dist/interchange/index.cjs +29 -29
  126. package/dist/interchange/index.d.cts +7 -6
  127. package/dist/interchange/index.d.ts +7 -6
  128. package/dist/interchange/index.js +6 -6
  129. package/dist/{local-store-impl-ARNXBBSF.cjs → local-store-impl-QGSRYFZF.cjs} +17 -17
  130. package/dist/{local-store-impl-ARNXBBSF.cjs.map → local-store-impl-QGSRYFZF.cjs.map} +1 -1
  131. package/dist/{local-store-impl-FTGRP2V7.js → local-store-impl-VEVK2VGA.js} +14 -14
  132. package/dist/{local-store-impl-FTGRP2V7.js.map → local-store-impl-VEVK2VGA.js.map} +1 -1
  133. package/dist/{pglite-store-impl-CNQZYRBC.cjs → pglite-store-impl-33CI3P3M.cjs} +17 -17
  134. package/dist/{pglite-store-impl-CNQZYRBC.cjs.map → pglite-store-impl-33CI3P3M.cjs.map} +1 -1
  135. package/dist/{pglite-store-impl-NULC2IHH.js → pglite-store-impl-RDPTOOP3.js} +14 -14
  136. package/dist/{pglite-store-impl-NULC2IHH.js.map → pglite-store-impl-RDPTOOP3.js.map} +1 -1
  137. package/dist/{postgres-Dd3TrFku.d.ts → postgres-2FBMdOE_.d.ts} +3 -3
  138. package/dist/{postgres-cLQPlKtp.d.cts → postgres-BR3AeXm9.d.ts} +1 -1
  139. package/dist/{postgres-CLPfTNYN.d.ts → postgres-CRatyTVL.d.cts} +1 -1
  140. package/dist/{postgres-B4VD_rVy.d.cts → postgres-lbZf0zyg.d.cts} +3 -3
  141. package/dist/{profile-Co154QBx.d.ts → profile-BipG05-8.d.ts} +2 -2
  142. package/dist/{profile-BqThShR_.d.cts → profile-DKtvxVyA.d.cts} +2 -2
  143. package/dist/profiler/index.d.cts +8 -7
  144. package/dist/profiler/index.d.ts +8 -7
  145. package/dist/provenance/index.cjs +15 -15
  146. package/dist/provenance/index.cjs.map +1 -1
  147. package/dist/provenance/index.d.cts +6 -5
  148. package/dist/provenance/index.d.ts +6 -5
  149. package/dist/provenance/index.js +2 -2
  150. package/dist/provenance/index.js.map +1 -1
  151. package/dist/{repair-validity-windows-BLoClfCq.d.cts → repair-validity-windows-BnSHFIsR.d.cts} +1 -1
  152. package/dist/{repair-validity-windows-C__28ckL.d.ts → repair-validity-windows-DfRb4gZm.d.ts} +1 -1
  153. package/dist/{resolve-DgFSIK99.d.ts → resolve-BbjZDYTw.d.ts} +1 -1
  154. package/dist/{resolve-DSUxNIqw.d.cts → resolve-mLksuBg2.d.cts} +1 -1
  155. package/dist/schema/index.cjs +36 -36
  156. package/dist/schema/index.d.cts +7 -7
  157. package/dist/schema/index.d.ts +7 -7
  158. package/dist/schema/index.js +6 -6
  159. package/dist/{searchable-CZKn12eY.d.cts → searchable-BEAN91Ce.d.cts} +1 -1
  160. package/dist/{searchable-CUWWphQI.d.ts → searchable-Bg2lMPRm.d.ts} +1 -1
  161. package/dist/{sqlite-mSd_eVk4.d.ts → sqlite-Cal3rHgZ.d.ts} +3 -3
  162. package/dist/{sqlite-RdH7w-ix.d.cts → sqlite-CvajLABd.d.cts} +1 -1
  163. package/dist/{sqlite-qXLIybR2.d.cts → sqlite-DQxKoWAH.d.cts} +3 -3
  164. package/dist/{sqlite-CoBmhiFd.d.ts → sqlite-jH5J-Jb8.d.ts} +1 -1
  165. package/dist/{store-BzmMsCcw.d.ts → store-B5WZ8E5m.d.ts} +313 -177
  166. package/dist/{store-CL6uTm_W.d.cts → store-DdhFpX53.d.cts} +313 -177
  167. package/dist/{types-BUoh7cc3.d.cts → types-BUA3dZ99.d.cts} +1 -1
  168. package/dist/{types-ClC0IFIS.d.ts → types-CPtb7KNf.d.ts} +1 -1
  169. package/dist/{types-Blq8PG_N.d.cts → types-Dky3sCFz.d.cts} +9 -0
  170. package/dist/{types-Blq8PG_N.d.ts → types-Dky3sCFz.d.ts} +9 -0
  171. package/dist/{where-61C-QoM8.d.ts → where-BReEkAiy.d.ts} +1 -1
  172. package/dist/{where-o3Me5iJx.d.cts → where-Cz11nPRu.d.cts} +1 -1
  173. package/package.json +2 -2
  174. package/dist/chunk-4MZQVVPX.cjs.map +0 -1
  175. package/dist/chunk-7JUD57B4.js.map +0 -1
  176. package/dist/chunk-FHFPUORN.cjs.map +0 -1
  177. package/dist/chunk-HWWPL2YL.js.map +0 -1
  178. package/dist/chunk-IV5W7LKW.cjs.map +0 -1
  179. package/dist/chunk-YTYB5KCQ.js.map +0 -1
@@ -2,28 +2,28 @@
2
2
 
3
3
  var chunk7BHUIAZR_cjs = require('./chunk-7BHUIAZR.cjs');
4
4
  var chunkJFLJVLNU_cjs = require('./chunk-JFLJVLNU.cjs');
5
- var chunkQR6V2BXA_cjs = require('./chunk-QR6V2BXA.cjs');
6
- var chunkBPYZUJX5_cjs = require('./chunk-BPYZUJX5.cjs');
5
+ var chunkPTFO3JI5_cjs = require('./chunk-PTFO3JI5.cjs');
6
+ var chunkMTJAT6UO_cjs = require('./chunk-MTJAT6UO.cjs');
7
7
  var chunkY6M5BFRJ_cjs = require('./chunk-Y6M5BFRJ.cjs');
8
8
  var chunkGD7IWK36_cjs = require('./chunk-GD7IWK36.cjs');
9
9
  var chunkR255UE5U_cjs = require('./chunk-R255UE5U.cjs');
10
10
  var chunkXUCVGEJT_cjs = require('./chunk-XUCVGEJT.cjs');
11
- var chunkU53HFE4L_cjs = require('./chunk-U53HFE4L.cjs');
11
+ var chunkOKA6H3B3_cjs = require('./chunk-OKA6H3B3.cjs');
12
12
  var chunk6YKISECL_cjs = require('./chunk-6YKISECL.cjs');
13
13
  var chunkUVVDQGOY_cjs = require('./chunk-UVVDQGOY.cjs');
14
- var chunkC3CN2C2T_cjs = require('./chunk-C3CN2C2T.cjs');
15
- var chunkIV5W7LKW_cjs = require('./chunk-IV5W7LKW.cjs');
14
+ var chunkQ6ZVQWH7_cjs = require('./chunk-Q6ZVQWH7.cjs');
15
+ var chunkA22XPVBQ_cjs = require('./chunk-A22XPVBQ.cjs');
16
16
  var chunkWEXAMJTA_cjs = require('./chunk-WEXAMJTA.cjs');
17
17
  var chunkOGK7F2J3_cjs = require('./chunk-OGK7F2J3.cjs');
18
18
  var chunkEOLNL35G_cjs = require('./chunk-EOLNL35G.cjs');
19
19
  var chunk6ODVH5SA_cjs = require('./chunk-6ODVH5SA.cjs');
20
20
  var chunkFSSQ4YNU_cjs = require('./chunk-FSSQ4YNU.cjs');
21
21
  var chunkNWJV4UVW_cjs = require('./chunk-NWJV4UVW.cjs');
22
- var chunkZHLWPHNT_cjs = require('./chunk-ZHLWPHNT.cjs');
22
+ var chunkRJ3GVX73_cjs = require('./chunk-RJ3GVX73.cjs');
23
23
  var chunkGDTWUVSN_cjs = require('./chunk-GDTWUVSN.cjs');
24
- var chunkCRROO6PK_cjs = require('./chunk-CRROO6PK.cjs');
24
+ var chunkQHP2BCBJ_cjs = require('./chunk-QHP2BCBJ.cjs');
25
25
  var chunkZY4GXIVN_cjs = require('./chunk-ZY4GXIVN.cjs');
26
- var chunk4MZQVVPX_cjs = require('./chunk-4MZQVVPX.cjs');
26
+ var chunkD5CHUSW7_cjs = require('./chunk-D5CHUSW7.cjs');
27
27
  var chunkNAUA4PW5_cjs = require('./chunk-NAUA4PW5.cjs');
28
28
  var chunk4FB7REYC_cjs = require('./chunk-4FB7REYC.cjs');
29
29
  var chunkMAYQDOZB_cjs = require('./chunk-MAYQDOZB.cjs');
@@ -352,17 +352,17 @@ function pinnedEdgeCollectionsFor(store, coordinate, wrap) {
352
352
  }
353
353
  function recordedNodeCollection(store, kind, live, coordinate) {
354
354
  const reads = {
355
- getById: (id) => chunkIV5W7LKW_cjs.storeRuntime(store).recordedNodeGetById(kind, id, coordinate),
356
- getByIds: (ids) => chunkIV5W7LKW_cjs.storeRuntime(store).recordedNodeGetByIds(kind, ids, coordinate),
357
- scan: (options) => chunkIV5W7LKW_cjs.storeRuntime(store).recordedNodeScan(kind, coordinate, options)
355
+ getById: (id) => chunkA22XPVBQ_cjs.storeRuntime(store).recordedNodeGetById(kind, id, coordinate),
356
+ getByIds: (ids) => chunkA22XPVBQ_cjs.storeRuntime(store).recordedNodeGetByIds(kind, ids, coordinate),
357
+ scan: (options) => chunkA22XPVBQ_cjs.storeRuntime(store).recordedNodeScan(kind, coordinate, options)
358
358
  };
359
359
  return recordedCollectionProxy(reads, live, coordinate, "node");
360
360
  }
361
361
  function recordedEdgeCollection(store, kind, live, coordinate) {
362
362
  const reads = {
363
- getById: (id) => chunkIV5W7LKW_cjs.storeRuntime(store).recordedEdgeGetById(kind, id, coordinate),
364
- getByIds: (ids) => chunkIV5W7LKW_cjs.storeRuntime(store).recordedEdgeGetByIds(kind, ids, coordinate),
365
- scan: (options) => chunkIV5W7LKW_cjs.storeRuntime(store).recordedEdgeScan(kind, coordinate, options)
363
+ getById: (id) => chunkA22XPVBQ_cjs.storeRuntime(store).recordedEdgeGetById(kind, id, coordinate),
364
+ getByIds: (ids) => chunkA22XPVBQ_cjs.storeRuntime(store).recordedEdgeGetByIds(kind, ids, coordinate),
365
+ scan: (options) => chunkA22XPVBQ_cjs.storeRuntime(store).recordedEdgeScan(kind, coordinate, options)
366
366
  };
367
367
  return recordedCollectionProxy(reads, live, coordinate, "edge");
368
368
  }
@@ -449,7 +449,7 @@ var CoordinatePinnedView = class {
449
449
  this.coordinate = coordinate;
450
450
  Object.defineProperty(this, "identity", {
451
451
  enumerable: false,
452
- get: () => chunkIV5W7LKW_cjs.storeRuntime(this.store).identityAtCoordinate(this.coordinate)
452
+ get: () => chunkA22XPVBQ_cjs.storeRuntime(this.store).identityAtCoordinate(this.coordinate)
453
453
  });
454
454
  }
455
455
  /** The temporal mode this view reads in. */
@@ -466,10 +466,10 @@ var CoordinatePinnedView = class {
466
466
  * view's coordinate cannot be overridden on a per-query basis.
467
467
  */
468
468
  query() {
469
- return chunkIV5W7LKW_cjs.storeRuntime(this.store).sealedQuery(this.coordinate);
469
+ return chunkA22XPVBQ_cjs.storeRuntime(this.store).sealedQuery(this.coordinate);
470
470
  }
471
471
  internalAlgorithms() {
472
- this.#internalAlgorithms ??= chunkIV5W7LKW_cjs.storeRuntime(
472
+ this.#internalAlgorithms ??= chunkA22XPVBQ_cjs.storeRuntime(
473
473
  this.store
474
474
  ).algorithmsAtCoordinate(this.coordinate);
475
475
  return this.#internalAlgorithms;
@@ -496,7 +496,7 @@ var CoordinatePinnedView = class {
496
496
  ...options,
497
497
  ...withCoordinate(this.coordinate)
498
498
  };
499
- return chunkIV5W7LKW_cjs.storeRuntime(this.store).subgraphAtCoordinate(
499
+ return chunkA22XPVBQ_cjs.storeRuntime(this.store).subgraphAtCoordinate(
500
500
  rootId,
501
501
  internalOptions
502
502
  );
@@ -1141,7 +1141,7 @@ function historicalCoordinate(input) {
1141
1141
  return void 0;
1142
1142
  }
1143
1143
  if (recorded !== void 0 && chunkJFLJVLNU_cjs.isEngineNativeRecordedReadBinding(ctx.recordedReadBinding)) {
1144
- chunkIV5W7LKW_cjs.refuseEngineNativeRecordedIdentityRead("historical identity expansion");
1144
+ chunkA22XPVBQ_cjs.refuseEngineNativeRecordedIdentityRead("historical identity expansion");
1145
1145
  }
1146
1146
  return {
1147
1147
  validMode: ast.temporalMode.mode,
@@ -1162,7 +1162,7 @@ function compileIdentityClassCte(input) {
1162
1162
  ctx,
1163
1163
  "historical identity expansion"
1164
1164
  );
1165
- const peerClasses = chunkIV5W7LKW_cjs.historicalIdentityPeerClassQuery({
1165
+ const peerClasses = chunkA22XPVBQ_cjs.historicalIdentityPeerClassQuery({
1166
1166
  schema: ctx.schema,
1167
1167
  graphId,
1168
1168
  coordinate,
@@ -1170,7 +1170,7 @@ function compileIdentityClassCte(input) {
1170
1170
  recursiveTraversal
1171
1171
  });
1172
1172
  return chunkMAYQDOZB_cjs.sql`
1173
- ${chunkMAYQDOZB_cjs.sql.identifier(IDENTITY_CLASS_CTE_ALIAS)}(${chunkIV5W7LKW_cjs.IDENTITY_PEER_CLASS_COLUMNS}) AS MATERIALIZED (
1173
+ ${chunkMAYQDOZB_cjs.sql.identifier(IDENTITY_CLASS_CTE_ALIAS)}(${chunkA22XPVBQ_cjs.IDENTITY_PEER_CLASS_COLUMNS}) AS MATERIALIZED (
1174
1174
  ${peerClasses}
1175
1175
  )
1176
1176
  `;
@@ -2730,7 +2730,7 @@ function lowerComposableQueryToLogicalPlanNode(query, dialect, graphId, nextPlan
2730
2730
  nextPlanNodeId
2731
2731
  });
2732
2732
  }
2733
- const dialectAdapter = chunk4MZQVVPX_cjs.getDialect(dialect);
2733
+ const dialectAdapter = chunkD5CHUSW7_cjs.getDialect(dialect);
2734
2734
  const vectorPredicate = runVectorPredicatePass(
2735
2735
  query,
2736
2736
  dialectAdapter,
@@ -3475,6 +3475,344 @@ function decodeByValueType(value, valueType) {
3475
3475
  }
3476
3476
  }
3477
3477
 
3478
+ // src/store/neighbors.ts
3479
+ var NEIGHBOR_ORDER_FIELDS = [
3480
+ "createdAt",
3481
+ "id",
3482
+ "updatedAt",
3483
+ "validFrom",
3484
+ "validTo"
3485
+ ];
3486
+ var NEIGHBOR_ORDER_FIELD_SET = new Set(
3487
+ NEIGHBOR_ORDER_FIELDS
3488
+ );
3489
+ function isNeighborOrderField(field2) {
3490
+ return NEIGHBOR_ORDER_FIELD_SET.has(field2);
3491
+ }
3492
+ function mapNeighborCountRows(rows) {
3493
+ return Number(rows[0]?.["count"] ?? 0);
3494
+ }
3495
+ function createNeighborRead(ctx, source, options) {
3496
+ validateOptions(ctx, options);
3497
+ const query = buildNeighborQuery(ctx, source, options, false);
3498
+ function mapRows(rows) {
3499
+ return rows.map((row) => ({
3500
+ edge: mapEdge(row),
3501
+ node: mapNode(row)
3502
+ }));
3503
+ }
3504
+ return {
3505
+ execute: async () => {
3506
+ if (options.edges.length === 0) return [];
3507
+ return mapRows(
3508
+ await ctx.backend.execute(chunkMAYQDOZB_cjs.asCompiledRowsSql(query))
3509
+ );
3510
+ },
3511
+ compileOneStatementBatchItem: () => ({
3512
+ query: chunkMAYQDOZB_cjs.asCompiledRowsSql(query),
3513
+ outputNames: neighborOutputNames(),
3514
+ orderBy: neighborBatchOrder(options.orderBy),
3515
+ mapRows
3516
+ })
3517
+ };
3518
+ }
3519
+ async function readNeighbors(ctx, source, options) {
3520
+ return createNeighborRead(ctx, source, options).execute();
3521
+ }
3522
+ async function countNeighbors(ctx, source, options) {
3523
+ return createNeighborCountRead(ctx, source, options).execute();
3524
+ }
3525
+ function createNeighborCountRead(ctx, source, options) {
3526
+ validateEdgeReadBounds(options, "countNeighbors");
3527
+ const query = buildNeighborQuery(ctx, source, options, true);
3528
+ return {
3529
+ execute: async () => {
3530
+ if (options.edges.length === 0) return 0;
3531
+ return mapNeighborCountRows(
3532
+ await ctx.backend.execute(chunkMAYQDOZB_cjs.asCompiledRowsSql(query))
3533
+ );
3534
+ },
3535
+ compileOneStatementBatchItem: () => ({
3536
+ query: chunkMAYQDOZB_cjs.asCompiledRowsSql(query),
3537
+ outputNames: ["count"],
3538
+ orderBy: [],
3539
+ mapRows: mapNeighborCountRows
3540
+ })
3541
+ };
3542
+ }
3543
+ function buildNeighborQuery(ctx, source, options, aggregate) {
3544
+ const direction = options.direction ?? "out";
3545
+ const instant = chunkWEXAMJTA_cjs.currentReadInstant();
3546
+ const temporalMode = options.temporalMode ?? ctx.defaultTemporalMode;
3547
+ const edgeTemporal = chunkWEXAMJTA_cjs.compileTemporalFilter({
3548
+ mode: temporalMode,
3549
+ asOf: options.asOf,
3550
+ tableAlias: "e",
3551
+ currentTimestamp: instant
3552
+ });
3553
+ const nodeTemporal = chunkWEXAMJTA_cjs.compileTemporalFilter({
3554
+ mode: temporalMode,
3555
+ asOf: options.asOf,
3556
+ tableAlias: "n",
3557
+ currentTimestamp: instant
3558
+ });
3559
+ const endpoint = endpointClauses(direction, source);
3560
+ const where = chunkMAYQDOZB_cjs.sql.join(
3561
+ [
3562
+ chunkMAYQDOZB_cjs.sql`e.graph_id = ${ctx.graphId}`,
3563
+ chunkMAYQDOZB_cjs.sql`n.graph_id = ${ctx.graphId}`,
3564
+ chunkWEXAMJTA_cjs.compileKindFilter(chunkMAYQDOZB_cjs.sql.raw("e.kind"), options.edges),
3565
+ edgeTemporal,
3566
+ nodeTemporal,
3567
+ endpoint.filter
3568
+ ],
3569
+ chunkMAYQDOZB_cjs.sql` AND `
3570
+ );
3571
+ if (aggregate) {
3572
+ return chunkMAYQDOZB_cjs.sql`SELECT COUNT(DISTINCT e.id) AS count FROM ${ctx.schema.edgesTable} e JOIN ${ctx.schema.nodesTable} n ON ${endpoint.join} WHERE ${where}`;
3573
+ }
3574
+ const orderValue = buildOrderValue(ctx, options.orderBy);
3575
+ const order = buildOrder(options.orderBy, orderValue);
3576
+ const limit = options.limit === void 0 ? chunkMAYQDOZB_cjs.sql.empty() : chunkMAYQDOZB_cjs.sql` LIMIT ${options.limit}`;
3577
+ return chunkMAYQDOZB_cjs.sql`SELECT ${neighborColumns()}, ${orderValue} AS typegraph_neighbor_order FROM ${ctx.schema.edgesTable} e JOIN ${ctx.schema.nodesTable} n ON ${endpoint.join} WHERE ${where} ORDER BY ${order}${limit}`;
3578
+ }
3579
+ function endpointClauses(direction, source) {
3580
+ const outgoingFilter = chunkMAYQDOZB_cjs.sql`e.from_kind = ${source.kind} AND e.from_id = ${source.id}`;
3581
+ const incomingFilter = chunkMAYQDOZB_cjs.sql`e.to_kind = ${source.kind} AND e.to_id = ${source.id}`;
3582
+ switch (direction) {
3583
+ case "out": {
3584
+ return {
3585
+ filter: outgoingFilter,
3586
+ join: chunkMAYQDOZB_cjs.sql`n.kind = e.to_kind AND n.id = e.to_id`
3587
+ };
3588
+ }
3589
+ case "in": {
3590
+ return {
3591
+ filter: incomingFilter,
3592
+ join: chunkMAYQDOZB_cjs.sql`n.kind = e.from_kind AND n.id = e.from_id`
3593
+ };
3594
+ }
3595
+ case "both": {
3596
+ return {
3597
+ filter: chunkMAYQDOZB_cjs.sql`((${outgoingFilter}) OR (${incomingFilter}))`,
3598
+ join: chunkMAYQDOZB_cjs.sql`((e.from_kind = ${source.kind} AND e.from_id = ${source.id} AND n.kind = e.to_kind AND n.id = e.to_id) OR (e.to_kind = ${source.kind} AND e.to_id = ${source.id} AND n.kind = e.from_kind AND n.id = e.from_id))`
3599
+ };
3600
+ }
3601
+ }
3602
+ }
3603
+ function edgeOrderColumnName(field2) {
3604
+ switch (field2) {
3605
+ case "id": {
3606
+ return "id";
3607
+ }
3608
+ case "createdAt": {
3609
+ return "created_at";
3610
+ }
3611
+ case "updatedAt": {
3612
+ return "updated_at";
3613
+ }
3614
+ case "validFrom": {
3615
+ return "valid_from";
3616
+ }
3617
+ case "validTo": {
3618
+ return "valid_to";
3619
+ }
3620
+ }
3621
+ }
3622
+ function buildOrderValue(ctx, orderBy) {
3623
+ if (orderBy?.by !== "node") {
3624
+ return chunkMAYQDOZB_cjs.sql`e.${chunkMAYQDOZB_cjs.sql.raw(edgeOrderColumnName(orderBy?.field ?? "id"))}`;
3625
+ }
3626
+ return compileTypedJsonExtract({
3627
+ column: chunkMAYQDOZB_cjs.sql.raw("n.props"),
3628
+ dialect: chunkD5CHUSW7_cjs.getDialect(ctx.backend.dialect),
3629
+ fallback: "text",
3630
+ pointer: chunkOZ3ZU7Q2_cjs.jsonPointer([orderBy.field]),
3631
+ valueType: resolveNodeOrderFieldType(ctx, orderBy.field)?.valueType
3632
+ });
3633
+ }
3634
+ function buildOrder(orderBy, value) {
3635
+ const direction = orderBy?.direction ?? "asc";
3636
+ return chunkMAYQDOZB_cjs.sql`CASE WHEN ${value} IS NULL THEN 1 ELSE 0 END ASC, ${value} ${chunkMAYQDOZB_cjs.sql.raw(direction.toUpperCase())}, e.id ASC`;
3637
+ }
3638
+ function neighborBatchOrder(orderBy) {
3639
+ return [
3640
+ {
3641
+ column: "typegraph_neighbor_order",
3642
+ direction: orderBy?.direction ?? "asc",
3643
+ nulls: "last"
3644
+ },
3645
+ { column: "edge_id", direction: "asc", nulls: "last" }
3646
+ ];
3647
+ }
3648
+ function validateOptions(ctx, options) {
3649
+ validateEdgeReadBounds(options, "neighbors");
3650
+ if (options.orderBy?.by !== "node") return;
3651
+ resolveNodeOrderFieldType(ctx, options.orderBy.field);
3652
+ }
3653
+ function resolveNodeOrderFieldType(ctx, field2) {
3654
+ const nodeKinds = [...ctx.registry.nodeKinds.keys()];
3655
+ const introspector = chunkUSBHGGZV_cjs.createSchemaIntrospector(ctx.registry.nodeKinds);
3656
+ const declaringKinds = nodeKinds.filter(
3657
+ (kind) => introspector.getFieldTypeInfo(kind, field2) !== void 0
3658
+ );
3659
+ if (declaringKinds.length === 0) {
3660
+ throw new chunkG7W67PZO_cjs.ValidationError("Unknown adjacent-node ordering field", {
3661
+ issues: [{ path: "neighbors.orderBy.field", message: "Invalid field" }]
3662
+ });
3663
+ }
3664
+ return introspector.getSharedFieldTypeInfo(declaringKinds, field2);
3665
+ }
3666
+ function validateEdgeReadBounds(options, path) {
3667
+ if (options.limit !== void 0 && (!Number.isSafeInteger(options.limit) || options.limit <= 0)) {
3668
+ throw new chunkG7W67PZO_cjs.ValidationError(
3669
+ "Neighbor limit must be a positive safe integer",
3670
+ {
3671
+ issues: [{ path: `${path}.limit`, message: "Invalid edge-read limit" }]
3672
+ }
3673
+ );
3674
+ }
3675
+ if (options.direction !== void 0 && options.direction !== "both" && options.direction !== "in" && options.direction !== "out") {
3676
+ throw new chunkG7W67PZO_cjs.ValidationError("Unknown edge traversal direction", {
3677
+ issues: [{ path: `${path}.direction`, message: "Invalid direction" }]
3678
+ });
3679
+ }
3680
+ const field2 = options.orderBy?.field;
3681
+ if (field2 !== void 0 && options.orderBy?.by !== "node" && !isNeighborOrderField(field2)) {
3682
+ throw new chunkG7W67PZO_cjs.ValidationError("Unknown edge ordering field", {
3683
+ issues: [{ path: `${path}.orderBy.field`, message: "Invalid field" }]
3684
+ });
3685
+ }
3686
+ const direction = options.orderBy?.direction;
3687
+ if (direction !== void 0 && direction !== "asc" && direction !== "desc") {
3688
+ throw new chunkG7W67PZO_cjs.ValidationError("Unknown edge ordering direction", {
3689
+ issues: [
3690
+ { path: `${path}.orderBy.direction`, message: "Invalid direction" }
3691
+ ]
3692
+ });
3693
+ }
3694
+ }
3695
+ function neighborColumns() {
3696
+ const edgeColumns = [
3697
+ "graph_id",
3698
+ "id",
3699
+ "kind",
3700
+ "from_kind",
3701
+ "from_id",
3702
+ "to_kind",
3703
+ "to_id",
3704
+ "props",
3705
+ "valid_from",
3706
+ "valid_to",
3707
+ "created_at",
3708
+ "updated_at",
3709
+ "deleted_at"
3710
+ ];
3711
+ const nodeColumns = [
3712
+ "graph_id",
3713
+ "id",
3714
+ "kind",
3715
+ "props",
3716
+ "version",
3717
+ "valid_from",
3718
+ "valid_to",
3719
+ "created_at",
3720
+ "updated_at",
3721
+ "deleted_at"
3722
+ ];
3723
+ return chunkMAYQDOZB_cjs.sql.join(
3724
+ [
3725
+ ...edgeColumns.map(
3726
+ (column) => chunkMAYQDOZB_cjs.sql`e.${chunkMAYQDOZB_cjs.sql.raw(column)} AS ${chunkMAYQDOZB_cjs.sql.identifier(`edge_${column}`)}`
3727
+ ),
3728
+ ...nodeColumns.map(
3729
+ (column) => chunkMAYQDOZB_cjs.sql`n.${chunkMAYQDOZB_cjs.sql.raw(column)} AS ${chunkMAYQDOZB_cjs.sql.identifier(`node_${column}`)}`
3730
+ )
3731
+ ],
3732
+ chunkMAYQDOZB_cjs.sql`, `
3733
+ );
3734
+ }
3735
+ function neighborOutputNames() {
3736
+ return [
3737
+ "edge_graph_id",
3738
+ "edge_id",
3739
+ "edge_kind",
3740
+ "edge_from_kind",
3741
+ "edge_from_id",
3742
+ "edge_to_kind",
3743
+ "edge_to_id",
3744
+ "edge_props",
3745
+ "edge_valid_from",
3746
+ "edge_valid_to",
3747
+ "edge_created_at",
3748
+ "edge_updated_at",
3749
+ "edge_deleted_at",
3750
+ "node_graph_id",
3751
+ "node_id",
3752
+ "node_kind",
3753
+ "node_props",
3754
+ "node_version",
3755
+ "node_valid_from",
3756
+ "node_valid_to",
3757
+ "node_created_at",
3758
+ "node_updated_at",
3759
+ "node_deleted_at"
3760
+ ];
3761
+ }
3762
+ function mapEdge(row) {
3763
+ return chunkPTFO3JI5_cjs.rowToEdge({
3764
+ id: String(row["edge_id"]),
3765
+ kind: String(row["edge_kind"]),
3766
+ from_kind: String(row["edge_from_kind"]),
3767
+ from_id: String(row["edge_from_id"]),
3768
+ to_kind: String(row["edge_to_kind"]),
3769
+ to_id: String(row["edge_to_id"]),
3770
+ props: row["edge_props"],
3771
+ valid_from: chunk7BHUIAZR_cjs.normalizeRowTimestamp(
3772
+ row["edge_valid_from"],
3773
+ "edge_valid_from"
3774
+ ),
3775
+ valid_to: chunk7BHUIAZR_cjs.normalizeRowTimestamp(row["edge_valid_to"], "edge_valid_to"),
3776
+ created_at: chunk7BHUIAZR_cjs.normalizeRequiredRowTimestamp(
3777
+ row["edge_created_at"],
3778
+ "edge_created_at"
3779
+ ),
3780
+ updated_at: chunk7BHUIAZR_cjs.normalizeRequiredRowTimestamp(
3781
+ row["edge_updated_at"],
3782
+ "edge_updated_at"
3783
+ ),
3784
+ deleted_at: chunk7BHUIAZR_cjs.normalizeRowTimestamp(
3785
+ row["edge_deleted_at"],
3786
+ "edge_deleted_at"
3787
+ )
3788
+ });
3789
+ }
3790
+ function mapNode(row) {
3791
+ return chunkPTFO3JI5_cjs.rowToNode({
3792
+ id: String(row["node_id"]),
3793
+ kind: String(row["node_kind"]),
3794
+ props: row["node_props"],
3795
+ version: Number(row["node_version"]),
3796
+ valid_from: chunk7BHUIAZR_cjs.normalizeRowTimestamp(
3797
+ row["node_valid_from"],
3798
+ "node_valid_from"
3799
+ ),
3800
+ valid_to: chunk7BHUIAZR_cjs.normalizeRowTimestamp(row["node_valid_to"], "node_valid_to"),
3801
+ created_at: chunk7BHUIAZR_cjs.normalizeRequiredRowTimestamp(
3802
+ row["node_created_at"],
3803
+ "node_created_at"
3804
+ ),
3805
+ updated_at: chunk7BHUIAZR_cjs.normalizeRequiredRowTimestamp(
3806
+ row["node_updated_at"],
3807
+ "node_updated_at"
3808
+ ),
3809
+ deleted_at: chunk7BHUIAZR_cjs.normalizeRowTimestamp(
3810
+ row["node_deleted_at"],
3811
+ "node_deleted_at"
3812
+ )
3813
+ });
3814
+ }
3815
+
3478
3816
  // src/store/recursive-cte.ts
3479
3817
  function buildReachableCte(options) {
3480
3818
  chunkEOLNL35G_cjs.assertRecursiveTraversal(options.recursiveTraversal, options.operation);
@@ -3506,6 +3844,9 @@ function buildReachableCte(options) {
3506
3844
  options.recordedReadBinding,
3507
3845
  "recorded-recursive-cte"
3508
3846
  );
3847
+ const edgeWindows = Object.entries(options.edgeWindows ?? {}).filter(
3848
+ (entry2) => entry2[1] !== void 0
3849
+ );
3509
3850
  const initialPath = trackPath ? options.dialect.initializePath(chunkMAYQDOZB_cjs.sql.raw("n.id")) : void 0;
3510
3851
  const pathExtension = trackPath ? options.dialect.extendPath(chunkMAYQDOZB_cjs.sql.raw("r.path"), chunkMAYQDOZB_cjs.sql.raw("n.id")) : void 0;
3511
3852
  const cycleCheck = options.cyclePolicy === "prevent" ? options.dialect.cycleCheck(chunkMAYQDOZB_cjs.sql.raw("n.id"), chunkMAYQDOZB_cjs.sql.raw("r.path")) : void 0;
@@ -3531,14 +3872,34 @@ function buildReachableCte(options) {
3531
3872
  ];
3532
3873
  if (cycleCheck !== void 0) recursiveWhere.push(cycleCheck);
3533
3874
  const forceWorktableOuterJoinOrder = options.dialect.capabilities.forceRecursiveWorktableOuterJoinOrder;
3875
+ const usesOrientedEdges = edgeWindows.length > 0;
3534
3876
  const recursiveCase = compileRecursiveBranch({
3535
3877
  recursiveColumns,
3536
3878
  whereClauses: recursiveWhere,
3537
- direction: options.direction,
3879
+ direction: usesOrientedEdges ? "out" : options.direction,
3538
3880
  forceWorktableOuterJoinOrder,
3539
- schema
3881
+ schema,
3882
+ edgesTable: usesOrientedEdges ? chunkMAYQDOZB_cjs.sql.identifier("typegraph_windowed_edges") : schema.edgesTable,
3883
+ ...usesOrientedEdges && {
3884
+ joinField: "typegraph_source_id",
3885
+ targetField: "typegraph_target_id",
3886
+ targetKindField: "typegraph_target_kind"
3887
+ }
3540
3888
  });
3541
- return chunkMAYQDOZB_cjs.sql`WITH RECURSIVE reachable AS (${baseCase} UNION ALL ${recursiveCase})`;
3889
+ const windowedEdges = usesOrientedEdges ? buildWindowedEdgesCte(
3890
+ schema.edgesTable,
3891
+ options.direction,
3892
+ options.edgeKinds.map((kind) => [kind, options.edgeWindows?.[kind]]),
3893
+ chunkMAYQDOZB_cjs.sql.join(
3894
+ [
3895
+ chunkMAYQDOZB_cjs.sql`e.graph_id = ${options.graphId}`,
3896
+ edgeKindFilter,
3897
+ edgeTemporalFilter
3898
+ ],
3899
+ chunkMAYQDOZB_cjs.sql` AND `
3900
+ )
3901
+ ) : void 0;
3902
+ return windowedEdges === void 0 ? chunkMAYQDOZB_cjs.sql`WITH RECURSIVE reachable AS (${baseCase} UNION ALL ${recursiveCase})` : chunkMAYQDOZB_cjs.sql`WITH RECURSIVE typegraph_windowed_edges AS (${windowedEdges}), reachable AS (${baseCase} UNION ALL ${recursiveCase})`;
3542
3903
  }
3543
3904
  function compileRecursiveBranch(options) {
3544
3905
  const selectClause = chunkMAYQDOZB_cjs.sql`SELECT ${chunkMAYQDOZB_cjs.sql.join([...options.recursiveColumns], chunkMAYQDOZB_cjs.sql`, `)}`;
@@ -3547,11 +3908,12 @@ function compileRecursiveBranch(options) {
3547
3908
  return buildDirectionalBranch({
3548
3909
  selectClause,
3549
3910
  whereClauses: options.whereClauses,
3550
- joinField: "from_id",
3551
- targetField: "to_id",
3552
- targetKindField: "to_kind",
3911
+ joinField: options.joinField ?? "from_id",
3912
+ targetField: options.targetField ?? "to_id",
3913
+ targetKindField: options.targetKindField ?? "to_kind",
3553
3914
  forceWorktableOuterJoinOrder: options.forceWorktableOuterJoinOrder,
3554
- schema: options.schema
3915
+ schema: options.schema,
3916
+ edgesTable: options.edgesTable
3555
3917
  });
3556
3918
  }
3557
3919
  case "in": {
@@ -3562,7 +3924,8 @@ function compileRecursiveBranch(options) {
3562
3924
  targetField: "from_id",
3563
3925
  targetKindField: "from_kind",
3564
3926
  forceWorktableOuterJoinOrder: options.forceWorktableOuterJoinOrder,
3565
- schema: options.schema
3927
+ schema: options.schema,
3928
+ edgesTable: options.edgesTable
3566
3929
  });
3567
3930
  }
3568
3931
  case "both": {
@@ -3570,7 +3933,8 @@ function compileRecursiveBranch(options) {
3570
3933
  selectClause,
3571
3934
  whereClauses: options.whereClauses,
3572
3935
  forceWorktableOuterJoinOrder: options.forceWorktableOuterJoinOrder,
3573
- schema: options.schema
3936
+ schema: options.schema,
3937
+ edgesTable: options.edgesTable
3574
3938
  });
3575
3939
  }
3576
3940
  }
@@ -3582,9 +3946,9 @@ function buildDirectionalBranch(options) {
3582
3946
  ...options.whereClauses,
3583
3947
  chunkMAYQDOZB_cjs.sql`e.${chunkMAYQDOZB_cjs.sql.raw(options.joinField)} = r.id`
3584
3948
  ];
3585
- return chunkMAYQDOZB_cjs.sql`${options.selectClause} FROM reachable r CROSS JOIN ${options.schema.edgesTable} e ${nodeJoin} WHERE ${chunkMAYQDOZB_cjs.sql.join(allWhere, chunkMAYQDOZB_cjs.sql` AND `)}`;
3949
+ return chunkMAYQDOZB_cjs.sql`${options.selectClause} FROM reachable r CROSS JOIN ${options.edgesTable} e ${nodeJoin} WHERE ${chunkMAYQDOZB_cjs.sql.join(allWhere, chunkMAYQDOZB_cjs.sql` AND `)}`;
3586
3950
  }
3587
- return chunkMAYQDOZB_cjs.sql`${options.selectClause} FROM reachable r JOIN ${options.schema.edgesTable} e ON e.${chunkMAYQDOZB_cjs.sql.raw(options.joinField)} = r.id ${nodeJoin} WHERE ${chunkMAYQDOZB_cjs.sql.join([...options.whereClauses], chunkMAYQDOZB_cjs.sql` AND `)}`;
3951
+ return chunkMAYQDOZB_cjs.sql`${options.selectClause} FROM reachable r JOIN ${options.edgesTable} e ON e.${chunkMAYQDOZB_cjs.sql.raw(options.joinField)} = r.id ${nodeJoin} WHERE ${chunkMAYQDOZB_cjs.sql.join([...options.whereClauses], chunkMAYQDOZB_cjs.sql` AND `)}`;
3588
3952
  }
3589
3953
  function buildBidirectionalBranch(options) {
3590
3954
  const nodeJoin = chunkMAYQDOZB_cjs.sql`JOIN ${options.schema.nodesTable} n ON n.graph_id = e.graph_id AND ((e.to_id = r.id AND n.id = e.from_id AND n.kind = e.from_kind) OR (e.from_id = r.id AND n.id = e.to_id AND n.kind = e.to_kind))`;
@@ -3593,9 +3957,32 @@ function buildBidirectionalBranch(options) {
3593
3957
  ...options.whereClauses,
3594
3958
  chunkMAYQDOZB_cjs.sql`(e.from_id = r.id OR e.to_id = r.id)`
3595
3959
  ];
3596
- return chunkMAYQDOZB_cjs.sql`${options.selectClause} FROM reachable r CROSS JOIN ${options.schema.edgesTable} e ${nodeJoin} WHERE ${chunkMAYQDOZB_cjs.sql.join(allWhere, chunkMAYQDOZB_cjs.sql` AND `)}`;
3597
- }
3598
- return chunkMAYQDOZB_cjs.sql`${options.selectClause} FROM reachable r JOIN ${options.schema.edgesTable} e ON (e.from_id = r.id OR e.to_id = r.id) ${nodeJoin} WHERE ${chunkMAYQDOZB_cjs.sql.join([...options.whereClauses], chunkMAYQDOZB_cjs.sql` AND `)}`;
3960
+ return chunkMAYQDOZB_cjs.sql`${options.selectClause} FROM reachable r CROSS JOIN ${options.edgesTable} e ${nodeJoin} WHERE ${chunkMAYQDOZB_cjs.sql.join(allWhere, chunkMAYQDOZB_cjs.sql` AND `)}`;
3961
+ }
3962
+ return chunkMAYQDOZB_cjs.sql`${options.selectClause} FROM reachable r JOIN ${options.edgesTable} e ON (e.from_id = r.id OR e.to_id = r.id) ${nodeJoin} WHERE ${chunkMAYQDOZB_cjs.sql.join([...options.whereClauses], chunkMAYQDOZB_cjs.sql` AND `)}`;
3963
+ }
3964
+ function buildWindowedEdgesCte(edgesTable, defaultDirection, edgeKinds, where) {
3965
+ const branches = edgeKinds.flatMap(([kind, window]) => {
3966
+ const direction = window?.direction ?? defaultDirection;
3967
+ const directions = direction === "both" ? ["out", "in"] : [direction];
3968
+ return directions.map((orientedDirection) => {
3969
+ const sourceKind = orientedDirection === "out" ? "from_kind" : "to_kind";
3970
+ const sourceId = orientedDirection === "out" ? "from_id" : "to_id";
3971
+ const targetKind = orientedDirection === "out" ? "to_kind" : "from_kind";
3972
+ const targetId = orientedDirection === "out" ? "to_id" : "from_id";
3973
+ const column = edgeOrderColumnName(window?.orderBy?.field ?? "id");
3974
+ const orderDirection = window?.orderBy?.direction ?? "asc";
3975
+ const omitReverseSelfLoop = direction === "both" && orientedDirection === "in" ? chunkMAYQDOZB_cjs.sql` AND NOT (e.from_kind = e.to_kind AND e.from_id = e.to_id)` : chunkMAYQDOZB_cjs.sql.empty();
3976
+ const oriented = chunkMAYQDOZB_cjs.sql`SELECT e.*, e.${chunkMAYQDOZB_cjs.sql.raw(sourceKind)} AS typegraph_source_kind, e.${chunkMAYQDOZB_cjs.sql.raw(sourceId)} AS typegraph_source_id, e.${chunkMAYQDOZB_cjs.sql.raw(targetKind)} AS typegraph_target_kind, e.${chunkMAYQDOZB_cjs.sql.raw(targetId)} AS typegraph_target_id`;
3977
+ if (window === void 0) {
3978
+ return chunkMAYQDOZB_cjs.sql`${oriented}, 1 AS typegraphedgerank FROM ${edgesTable} e WHERE ${where} AND e.kind = ${kind}${omitReverseSelfLoop}`;
3979
+ }
3980
+ const rank = chunkMAYQDOZB_cjs.sql`ROW_NUMBER() OVER (PARTITION BY e.kind, e.${chunkMAYQDOZB_cjs.sql.raw(sourceKind)}, e.${chunkMAYQDOZB_cjs.sql.raw(sourceId)} ORDER BY CASE WHEN e.${chunkMAYQDOZB_cjs.sql.raw(column)} IS NULL THEN 1 ELSE 0 END ASC, e.${chunkMAYQDOZB_cjs.sql.raw(column)} ${chunkMAYQDOZB_cjs.sql.raw(orderDirection.toUpperCase())}, e.id ASC)`;
3981
+ const ranked = chunkMAYQDOZB_cjs.sql`${oriented}, ${rank} AS typegraphedgerank FROM ${edgesTable} e WHERE ${where} AND e.kind = ${kind}${omitReverseSelfLoop}`;
3982
+ return chunkMAYQDOZB_cjs.sql`SELECT * FROM (${ranked}) ranked WHERE ranked.typegraphedgerank <= ${window.limit}`;
3983
+ });
3984
+ });
3985
+ return chunkMAYQDOZB_cjs.sql.join(branches, chunkMAYQDOZB_cjs.sql` UNION ALL `);
3599
3986
  }
3600
3987
 
3601
3988
  // src/store/subgraph.ts
@@ -3614,52 +4001,53 @@ function normalizeProps(value) {
3614
4001
  function defineSubgraphProject(_graph) {
3615
4002
  return (project) => project;
3616
4003
  }
3617
- async function executeSubgraph(params) {
4004
+ function buildSubgraphPlan(params, surface) {
3618
4005
  const { options } = params;
3619
4006
  const { valid: coordinate } = chunkNWJV4UVW_cjs.resolveReadCoordinate(
3620
4007
  options.temporalMode ?? params.graph.defaults.temporalMode,
3621
4008
  options.asOf
3622
4009
  );
3623
- const temporalMode = coordinate.mode;
3624
- const recordedAsOf = options.recordedAsOf;
4010
+ validateEdgeWindows(options.edgeWindows, options.edges);
3625
4011
  const baseSchema = params.schema ?? chunkEOLNL35G_cjs.DEFAULT_SQL_SCHEMA;
3626
- const maxDepth = Math.min(
3627
- options.maxDepth ?? DEFAULT_SUBGRAPH_MAX_DEPTH,
3628
- MAX_EXPLICIT_RECURSIVE_DEPTH
3629
- );
3630
4012
  const ctx = {
3631
4013
  graphId: params.graphId,
3632
4014
  rootId: params.rootId,
3633
4015
  edgeKinds: options.edges,
3634
- maxDepth,
4016
+ maxDepth: Math.min(
4017
+ options.maxDepth ?? DEFAULT_SUBGRAPH_MAX_DEPTH,
4018
+ MAX_EXPLICIT_RECURSIVE_DEPTH
4019
+ ),
3635
4020
  includeKinds: options.includeKinds,
3636
4021
  excludeRoot: options.excludeRoot ?? false,
3637
4022
  direction: options.direction ?? "out",
3638
4023
  cyclePolicy: options.cyclePolicy ?? "prevent",
3639
- temporalMode,
4024
+ temporalMode: coordinate.mode,
3640
4025
  asOf: coordinate.asOf,
3641
- recordedAsOf,
4026
+ // Recorded coordinates reach here only through the StoreView seam. The
4027
+ // public API rejects them before either execution strategy is selected.
4028
+ recordedAsOf: options.recordedAsOf,
3642
4029
  dialect: params.dialect,
3643
4030
  schema: chunkEOLNL35G_cjs.recordedReadSchemaFor(
3644
4031
  baseSchema,
3645
- recordedAsOf,
4032
+ options.recordedAsOf,
3646
4033
  params.recordedReadBinding,
3647
- "recorded-subgraph"
4034
+ surface === "subgraph" ? "recorded-subgraph" : "recorded-subgraph-query"
3648
4035
  ),
3649
4036
  recordedReadBinding: params.recordedReadBinding,
3650
- backend: params.backend
4037
+ backend: params.backend,
4038
+ edgeWindows: options.edgeWindows
3651
4039
  };
3652
- const schemaIntrospector = getSubgraphSchemaIntrospector(params.graph);
4040
+ const introspector = getSubgraphSchemaIntrospector(params.graph);
3653
4041
  const nodeProjectionPlan = buildProjectionPlan(
3654
4042
  getIncludedNodeKinds(params.graph, options.includeKinds),
3655
4043
  options.project?.nodes,
3656
- (kind, field2) => schemaIntrospector.getFieldTypeInfo(kind, field2),
4044
+ (kind, field2) => introspector.getFieldTypeInfo(kind, field2),
3657
4045
  "node"
3658
4046
  );
3659
4047
  const edgeProjectionPlan = buildProjectionPlan(
3660
4048
  dedupeStrings(options.edges),
3661
4049
  options.project?.edges,
3662
- (kind, field2) => schemaIntrospector.getEdgeFieldTypeInfo(kind, field2),
4050
+ (kind, field2) => introspector.getEdgeFieldTypeInfo(kind, field2),
3663
4051
  "edge"
3664
4052
  );
3665
4053
  const reachableCte = buildReachableCte({
@@ -3674,13 +4062,29 @@ async function executeSubgraph(params) {
3674
4062
  ...ctx.asOf !== void 0 && { asOf: ctx.asOf },
3675
4063
  ...ctx.recordedAsOf !== void 0 && { recordedAsOf: ctx.recordedAsOf },
3676
4064
  dialect: ctx.dialect,
3677
- // Base schema: buildReachableCte derives the recorded swap from recordedAsOf.
4065
+ // The recursive compiler derives the recorded relation from the pin.
3678
4066
  schema: baseSchema,
3679
4067
  ...ctx.recordedReadBinding === void 0 ? {} : { recordedReadBinding: ctx.recordedReadBinding },
3680
4068
  recursiveTraversal: chunkEOLNL35G_cjs.resolveRecursiveTraversal(params.backend.capabilities),
3681
- operation: "subgraph"
4069
+ operation: surface,
4070
+ ...ctx.edgeWindows === void 0 ? {} : { edgeWindows: ctx.edgeWindows }
3682
4071
  });
3683
- const includedIdsCte = buildIncludedIdsCte(ctx);
4072
+ return {
4073
+ ctx,
4074
+ reachableCte,
4075
+ includedIdsCte: buildIncludedIdsCte(ctx),
4076
+ nodeProjectionPlan,
4077
+ edgeProjectionPlan
4078
+ };
4079
+ }
4080
+ async function executeSubgraph(params) {
4081
+ const {
4082
+ ctx,
4083
+ reachableCte,
4084
+ includedIdsCte,
4085
+ nodeProjectionPlan,
4086
+ edgeProjectionPlan
4087
+ } = buildSubgraphPlan(params, "subgraph");
3684
4088
  let membership;
3685
4089
  const membershipStrategy = ctx.dialect.capabilities.subgraphMembershipStrategy;
3686
4090
  switch (membershipStrategy) {
@@ -3719,24 +4123,47 @@ async function executeSubgraph(params) {
3719
4123
  fetchSubgraphNodes(ctx, membership, nodeProjectionPlan),
3720
4124
  fetchSubgraphEdges(ctx, membership, edgeProjectionPlan)
3721
4125
  ]);
3722
- const nodesMap = /* @__PURE__ */ new Map();
3723
- for (const row of nodeRows) {
3724
- const node = mapSubgraphNodeRow(row, nodeProjectionPlan);
3725
- nodesMap.set(node.id, node);
3726
- }
3727
- const adjacency = /* @__PURE__ */ new Map();
3728
- const reverseAdjacency = /* @__PURE__ */ new Map();
3729
- for (const row of edgeRows) {
3730
- const edge = mapSubgraphEdgeRow(row, edgeProjectionPlan);
3731
- insertAdjacencyEntry(adjacency, edge.fromId, edge.kind, edge);
3732
- insertAdjacencyEntry(reverseAdjacency, edge.toId, edge.kind, edge);
4126
+ return assembleSubgraphResult(
4127
+ ctx.rootId,
4128
+ nodeRows.map((row) => mapSubgraphNodeRow(row, nodeProjectionPlan)),
4129
+ edgeRows.map((row) => mapSubgraphEdgeRow(row, edgeProjectionPlan))
4130
+ );
4131
+ }
4132
+ function createSubgraphRead(params) {
4133
+ const {
4134
+ ctx,
4135
+ reachableCte,
4136
+ includedIdsCte,
4137
+ nodeProjectionPlan: nodePlan,
4138
+ edgeProjectionPlan: edgePlan
4139
+ } = buildSubgraphPlan(params, "batchOnce.subgraph");
4140
+ const query = buildOneStatementSubgraphQuery(
4141
+ ctx,
4142
+ reachableCte,
4143
+ includedIdsCte,
4144
+ nodePlan,
4145
+ edgePlan
4146
+ );
4147
+ function mapRows(rows) {
4148
+ return mapOneStatementSubgraphRows(
4149
+ ctx.rootId,
4150
+ rows,
4151
+ nodePlan,
4152
+ edgePlan
4153
+ );
3733
4154
  }
3734
- const root = nodesMap.get(ctx.rootId);
3735
4155
  return {
3736
- root,
3737
- nodes: nodesMap,
3738
- adjacency,
3739
- reverseAdjacency
4156
+ execute: async () => mapRows(
4157
+ await params.backend.execute(
4158
+ chunkMAYQDOZB_cjs.asCompiledRowsSql(query)
4159
+ )
4160
+ ),
4161
+ compileOneStatementBatchItem: () => ({
4162
+ query: chunkMAYQDOZB_cjs.asCompiledRowsSql(query),
4163
+ outputNames: oneStatementSubgraphOutputNames(nodePlan, edgePlan),
4164
+ orderBy: [],
4165
+ mapRows
4166
+ })
3740
4167
  };
3741
4168
  }
3742
4169
  var introspectorCache = /* @__PURE__ */ new WeakMap();
@@ -3817,6 +4244,38 @@ function buildIncludedIdsCte(ctx) {
3817
4244
  const whereClause = filters.length > 0 ? chunkMAYQDOZB_cjs.sql` WHERE ${chunkMAYQDOZB_cjs.sql.join(filters, chunkMAYQDOZB_cjs.sql` AND `)}` : chunkMAYQDOZB_cjs.sql``;
3818
4245
  return chunkMAYQDOZB_cjs.sql`, included_ids AS (SELECT DISTINCT id FROM reachable${whereClause})`;
3819
4246
  }
4247
+ function buildSubgraphEdgeSource(ctx, edgeTemporalFilter) {
4248
+ const windows = Object.entries(ctx.edgeWindows ?? {}).filter(
4249
+ (entry2) => entry2[1] !== void 0
4250
+ );
4251
+ if (windows.length === 0) return ctx.schema.edgesTable;
4252
+ const edgeKindFilter = chunkWEXAMJTA_cjs.compileKindFilter(chunkMAYQDOZB_cjs.sql.raw("e.kind"), ctx.edgeKinds);
4253
+ const windowedEdges = buildWindowedEdgesCte(
4254
+ ctx.schema.edgesTable,
4255
+ ctx.direction,
4256
+ ctx.edgeKinds.map((kind) => [kind, ctx.edgeWindows?.[kind]]),
4257
+ chunkMAYQDOZB_cjs.sql.join(
4258
+ [chunkMAYQDOZB_cjs.sql`e.graph_id = ${ctx.graphId}`, edgeKindFilter, edgeTemporalFilter],
4259
+ chunkMAYQDOZB_cjs.sql` AND `
4260
+ )
4261
+ );
4262
+ const physicalColumns = [
4263
+ "graph_id",
4264
+ "id",
4265
+ "kind",
4266
+ "from_kind",
4267
+ "from_id",
4268
+ "to_kind",
4269
+ "to_id",
4270
+ "props",
4271
+ "valid_from",
4272
+ "valid_to",
4273
+ "created_at",
4274
+ "updated_at",
4275
+ "deleted_at"
4276
+ ].map((column) => chunkMAYQDOZB_cjs.sql.raw(`windowed_edge.${column}`));
4277
+ return chunkMAYQDOZB_cjs.sql`(SELECT DISTINCT ${chunkMAYQDOZB_cjs.sql.join(physicalColumns, chunkMAYQDOZB_cjs.sql`, `)} FROM (${windowedEdges}) windowed_edge)`;
4278
+ }
3820
4279
  function textArrayParam(values) {
3821
4280
  const elements = values.map(
3822
4281
  (value) => `"${value.replaceAll("\\", "\\\\").replaceAll('"', String.raw`\"`)}"`
@@ -3831,6 +4290,125 @@ async function fetchIncludedIds(ctx, reachableCte, includedIdsCte) {
3831
4290
  );
3832
4291
  return rows.map((row) => row.id);
3833
4292
  }
4293
+ function projectionOutputNames(plan) {
4294
+ return [...plan.projectedKinds.values()].flatMap(
4295
+ (kindPlan) => kindPlan.propertyFields.map((field2) => field2.outputName)
4296
+ );
4297
+ }
4298
+ function oneStatementSubgraphOutputNames(nodePlan, edgePlan) {
4299
+ return [
4300
+ "typegraph_entity",
4301
+ "id",
4302
+ "kind",
4303
+ "from_kind",
4304
+ "from_id",
4305
+ "to_kind",
4306
+ "to_id",
4307
+ "props",
4308
+ "version",
4309
+ "valid_from",
4310
+ "valid_to",
4311
+ "created_at",
4312
+ "updated_at",
4313
+ "deleted_at",
4314
+ ...projectionOutputNames(nodePlan),
4315
+ ...projectionOutputNames(edgePlan)
4316
+ ];
4317
+ }
4318
+ function nullProjectionColumns(plan) {
4319
+ return projectionOutputNames(plan).map(
4320
+ (outputName) => chunkMAYQDOZB_cjs.sql`NULL AS ${quoteIdentifier(outputName)}`
4321
+ );
4322
+ }
4323
+ function buildOneStatementSubgraphQuery(ctx, reachable, includedIds, nodePlan, edgePlan) {
4324
+ const instant = chunkWEXAMJTA_cjs.currentReadInstant();
4325
+ const nodeTemporal = chunkWEXAMJTA_cjs.compileTemporalFilter({
4326
+ mode: ctx.temporalMode,
4327
+ asOf: ctx.asOf,
4328
+ recordedAsOf: ctx.recordedAsOf,
4329
+ tableAlias: "n",
4330
+ currentTimestamp: instant,
4331
+ recordedReadBinding: ctx.recordedReadBinding
4332
+ });
4333
+ const edgeTemporal = chunkWEXAMJTA_cjs.compileTemporalFilter({
4334
+ mode: ctx.temporalMode,
4335
+ asOf: ctx.asOf,
4336
+ recordedAsOf: ctx.recordedAsOf,
4337
+ tableAlias: "e",
4338
+ currentTimestamp: instant,
4339
+ recordedReadBinding: ctx.recordedReadBinding
4340
+ });
4341
+ const nodeColumns = [
4342
+ chunkMAYQDOZB_cjs.sql`'node' AS typegraph_entity`,
4343
+ chunkMAYQDOZB_cjs.sql`n.id`,
4344
+ chunkMAYQDOZB_cjs.sql`n.kind`,
4345
+ chunkMAYQDOZB_cjs.sql`NULL AS from_kind`,
4346
+ chunkMAYQDOZB_cjs.sql`NULL AS from_id`,
4347
+ chunkMAYQDOZB_cjs.sql`NULL AS to_kind`,
4348
+ chunkMAYQDOZB_cjs.sql`NULL AS to_id`,
4349
+ buildFullPropsColumn("n", nodePlan),
4350
+ ...buildMetadataColumns("n", nodePlan, [
4351
+ "version",
4352
+ "valid_from",
4353
+ "valid_to",
4354
+ "created_at",
4355
+ "updated_at",
4356
+ "deleted_at"
4357
+ ]),
4358
+ ...buildProjectedPropertyColumns("n", nodePlan, ctx.dialect),
4359
+ ...nullProjectionColumns(edgePlan)
4360
+ ];
4361
+ const edgeColumns = [
4362
+ chunkMAYQDOZB_cjs.sql`'edge' AS typegraph_entity`,
4363
+ chunkMAYQDOZB_cjs.sql`e.id`,
4364
+ chunkMAYQDOZB_cjs.sql`e.kind`,
4365
+ chunkMAYQDOZB_cjs.sql`e.from_kind`,
4366
+ chunkMAYQDOZB_cjs.sql`e.from_id`,
4367
+ chunkMAYQDOZB_cjs.sql`e.to_kind`,
4368
+ chunkMAYQDOZB_cjs.sql`e.to_id`,
4369
+ buildFullPropsColumn("e", edgePlan),
4370
+ chunkMAYQDOZB_cjs.sql`NULL AS version`,
4371
+ ...buildMetadataColumns("e", edgePlan, [
4372
+ "valid_from",
4373
+ "valid_to",
4374
+ "created_at",
4375
+ "updated_at",
4376
+ "deleted_at"
4377
+ ]),
4378
+ ...nullProjectionColumns(nodePlan),
4379
+ ...buildProjectedPropertyColumns("e", edgePlan, ctx.dialect)
4380
+ ];
4381
+ const edgeSource = buildSubgraphEdgeSource(ctx, edgeTemporal);
4382
+ return chunkMAYQDOZB_cjs.sql`${reachable}${includedIds} SELECT ${chunkMAYQDOZB_cjs.sql.join(nodeColumns, chunkMAYQDOZB_cjs.sql`, `)} FROM ${ctx.schema.nodesTable} n WHERE n.graph_id = ${ctx.graphId} AND ${nodeTemporal} AND n.id IN (SELECT id FROM included_ids) UNION ALL SELECT ${chunkMAYQDOZB_cjs.sql.join(edgeColumns, chunkMAYQDOZB_cjs.sql`, `)} FROM ${edgeSource} e WHERE e.graph_id = ${ctx.graphId} AND ${chunkWEXAMJTA_cjs.compileKindFilter(chunkMAYQDOZB_cjs.sql.raw("e.kind"), ctx.edgeKinds)} AND ${edgeTemporal} AND e.from_id IN (SELECT id FROM included_ids) AND e.to_id IN (SELECT id FROM included_ids)`;
4383
+ }
4384
+ function mapOneStatementSubgraphRows(rootId, rows, nodePlan, edgePlan) {
4385
+ const nodes = [];
4386
+ const edges = [];
4387
+ for (const row of rows) {
4388
+ if (row.typegraph_entity === "node") {
4389
+ nodes.push(mapSubgraphNodeRow(row, nodePlan));
4390
+ continue;
4391
+ }
4392
+ edges.push(mapSubgraphEdgeRow(row, edgePlan));
4393
+ }
4394
+ return assembleSubgraphResult(rootId, nodes, edges);
4395
+ }
4396
+ function assembleSubgraphResult(rootId, nodeValues, edgeValues) {
4397
+ const nodes = /* @__PURE__ */ new Map();
4398
+ for (const node of nodeValues) nodes.set(node.id, node);
4399
+ const adjacency = /* @__PURE__ */ new Map();
4400
+ const reverseAdjacency = /* @__PURE__ */ new Map();
4401
+ for (const edge of edgeValues) {
4402
+ insertAdjacencyEntry(adjacency, edge.fromId, edge.kind, edge);
4403
+ insertAdjacencyEntry(reverseAdjacency, edge.toId, edge.kind, edge);
4404
+ }
4405
+ return {
4406
+ root: nodes.get(rootId),
4407
+ nodes,
4408
+ adjacency,
4409
+ reverseAdjacency
4410
+ };
4411
+ }
3834
4412
  async function fetchSubgraphNodes(ctx, membership, projectionPlan) {
3835
4413
  const nodeTemporalFilter = chunkWEXAMJTA_cjs.compileTemporalFilter({
3836
4414
  mode: ctx.temporalMode,
@@ -3887,12 +4465,33 @@ async function fetchSubgraphEdges(ctx, membership, projectionPlan) {
3887
4465
  ]),
3888
4466
  ...buildProjectedPropertyColumns("e", projectionPlan, ctx.dialect)
3889
4467
  ];
3890
- const query = chunkMAYQDOZB_cjs.sql`${membership.prefix}SELECT ${chunkMAYQDOZB_cjs.sql.join(columns, chunkMAYQDOZB_cjs.sql`, `)} FROM ${ctx.schema.edgesTable} e WHERE e.graph_id = ${ctx.graphId} AND ${edgeKindFilter} AND ${edgeTemporalFilter} AND ${membership.idFilter(chunkMAYQDOZB_cjs.sql.raw("e.from_id"))} AND ${membership.idFilter(chunkMAYQDOZB_cjs.sql.raw("e.to_id"))}`;
4468
+ const edgesSource = buildSubgraphEdgeSource(ctx, edgeTemporalFilter);
4469
+ const query = chunkMAYQDOZB_cjs.sql`${membership.prefix}SELECT ${chunkMAYQDOZB_cjs.sql.join(columns, chunkMAYQDOZB_cjs.sql`, `)} FROM ${edgesSource} e WHERE e.graph_id = ${ctx.graphId} AND ${edgeKindFilter} AND ${edgeTemporalFilter} AND ${membership.idFilter(chunkMAYQDOZB_cjs.sql.raw("e.from_id"))} AND ${membership.idFilter(chunkMAYQDOZB_cjs.sql.raw("e.to_id"))}`;
3891
4470
  if (membership.parameterDependentPlan) chunkMAYQDOZB_cjs.markForceCustomPlan(query);
3892
4471
  return ctx.backend.execute(
3893
4472
  chunkMAYQDOZB_cjs.asCompiledRowsSql(query)
3894
4473
  );
3895
4474
  }
4475
+ function validateEdgeWindows(windows, selectedEdgeKinds) {
4476
+ for (const [kind, window] of Object.entries(windows ?? {})) {
4477
+ if (!selectedEdgeKinds.includes(kind)) {
4478
+ throw new chunkG7W67PZO_cjs.ValidationError(
4479
+ "Subgraph edge windows must name a traversed edge kind",
4480
+ {
4481
+ issues: [
4482
+ {
4483
+ path: `edgeWindows.${kind}`,
4484
+ message: "Edge kind is not present in options.edges"
4485
+ }
4486
+ ]
4487
+ }
4488
+ );
4489
+ }
4490
+ if (window !== void 0) {
4491
+ validateEdgeReadBounds(window, `edgeWindows.${kind}`);
4492
+ }
4493
+ }
4494
+ }
3896
4495
  function buildMetadataColumns(alias, plan, columns) {
3897
4496
  if (plan.projectedKinds.size === 0) {
3898
4497
  return columns.map((col) => chunkMAYQDOZB_cjs.sql`${chunkMAYQDOZB_cjs.sql.raw(`${alias}.${col}`)}`);
@@ -3960,12 +4559,23 @@ function applyProjectedFields(target, row, kindPlan) {
3960
4559
  );
3961
4560
  }
3962
4561
  }
4562
+ function normalizeSubgraphRowTimestamps(row) {
4563
+ return {
4564
+ ...row,
4565
+ valid_from: chunk7BHUIAZR_cjs.normalizeRowTimestamp(row.valid_from, "valid_from"),
4566
+ valid_to: chunk7BHUIAZR_cjs.normalizeRowTimestamp(row.valid_to, "valid_to"),
4567
+ created_at: chunk7BHUIAZR_cjs.normalizeRequiredRowTimestamp(row.created_at, "created_at"),
4568
+ updated_at: chunk7BHUIAZR_cjs.normalizeRequiredRowTimestamp(row.updated_at, "updated_at"),
4569
+ deleted_at: chunk7BHUIAZR_cjs.normalizeRowTimestamp(row.deleted_at, "deleted_at")
4570
+ };
4571
+ }
3963
4572
  function mapSubgraphNodeRow(row, projectionPlan) {
3964
4573
  const kindPlan = projectionPlan.projectedKinds.get(row.kind);
3965
4574
  if (kindPlan === void 0) {
3966
- return chunkQR6V2BXA_cjs.rowToNode({
3967
- ...row,
3968
- props: normalizeProps(row.props)
4575
+ const normalizedRow = normalizeSubgraphRowTimestamps(row);
4576
+ return chunkPTFO3JI5_cjs.rowToNode({
4577
+ ...normalizedRow,
4578
+ props: normalizeProps(normalizedRow.props)
3969
4579
  });
3970
4580
  }
3971
4581
  const projectedNode = {
@@ -3973,7 +4583,7 @@ function mapSubgraphNodeRow(row, projectionPlan) {
3973
4583
  id: row.id
3974
4584
  };
3975
4585
  if (kindPlan.includeMeta) {
3976
- projectedNode["meta"] = chunkQR6V2BXA_cjs.rowToNodeMeta(row);
4586
+ projectedNode["meta"] = chunkPTFO3JI5_cjs.rowToNodeMeta(normalizeSubgraphRowTimestamps(row));
3977
4587
  }
3978
4588
  applyProjectedFields(projectedNode, row, kindPlan);
3979
4589
  return projectedNode;
@@ -3981,9 +4591,10 @@ function mapSubgraphNodeRow(row, projectionPlan) {
3981
4591
  function mapSubgraphEdgeRow(row, projectionPlan) {
3982
4592
  const kindPlan = projectionPlan.projectedKinds.get(row.kind);
3983
4593
  if (kindPlan === void 0) {
3984
- return chunkQR6V2BXA_cjs.rowToEdge({
3985
- ...row,
3986
- props: normalizeProps(row.props)
4594
+ const normalizedRow = normalizeSubgraphRowTimestamps(row);
4595
+ return chunkPTFO3JI5_cjs.rowToEdge({
4596
+ ...normalizedRow,
4597
+ props: normalizeProps(normalizedRow.props)
3987
4598
  });
3988
4599
  }
3989
4600
  const projectedEdge = {
@@ -3995,7 +4606,7 @@ function mapSubgraphEdgeRow(row, projectionPlan) {
3995
4606
  toId: row.to_id
3996
4607
  };
3997
4608
  if (kindPlan.includeMeta) {
3998
- projectedEdge["meta"] = chunkQR6V2BXA_cjs.rowToEdgeMeta(row);
4609
+ projectedEdge["meta"] = chunkPTFO3JI5_cjs.rowToEdgeMeta(normalizeSubgraphRowTimestamps(row));
3999
4610
  }
4000
4611
  applyProjectedFields(projectedEdge, row, kindPlan);
4001
4612
  return projectedEdge;
@@ -4662,7 +5273,7 @@ function compileSetOperation2(op, graphId, options = "sqlite") {
4662
5273
  return chunkMAYQDOZB_cjs.asCompiledSelectSql(combined);
4663
5274
  }
4664
5275
  function resolveDialectAdapter(dialect, fulltextStrategy) {
4665
- const baseAdapter = chunk4MZQVVPX_cjs.getDialect(dialect);
5276
+ const baseAdapter = chunkD5CHUSW7_cjs.getDialect(dialect);
4666
5277
  if (fulltextStrategy === false) {
4667
5278
  return {
4668
5279
  ...baseAdapter,
@@ -5873,7 +6484,7 @@ function createNodeTrackingProxy(alias, kindNames, tracker, options) {
5873
6484
  return getPlaceholderForSystemField(property, options.mode);
5874
6485
  }
5875
6486
  if (property === "meta") {
5876
- for (const key of chunkCRROO6PK_cjs.NODE_META_KEYS) {
6487
+ for (const key of chunkQHP2BCBJ_cjs.NODE_META_KEYS) {
5877
6488
  tracker.record(alias, `meta.${key}`, true);
5878
6489
  }
5879
6490
  return buildNodeMetaPlaceholder(options.mode);
@@ -5917,7 +6528,7 @@ function createEdgeTrackingProxy(alias, edgeKindNames, tracker, options) {
5917
6528
  return getPlaceholderForSystemField(property, options.mode);
5918
6529
  }
5919
6530
  if (property === "meta") {
5920
- for (const key of chunkCRROO6PK_cjs.EDGE_META_KEYS) {
6531
+ for (const key of chunkQHP2BCBJ_cjs.EDGE_META_KEYS) {
5921
6532
  tracker.record(alias, `meta.${key}`, true);
5922
6533
  }
5923
6534
  return buildEdgeMetaPlaceholder(options.mode);
@@ -6273,7 +6884,7 @@ async function executeSchemaCheckedRead(input) {
6273
6884
  );
6274
6885
  }
6275
6886
  const marker = "typegraphschemaversion";
6276
- const dialect = chunk4MZQVVPX_cjs.getDialect(backend.dialect);
6887
+ const dialect = chunkD5CHUSW7_cjs.getDialect(backend.dialect);
6277
6888
  const orderBy = buildStandardOrderBy({
6278
6889
  ast,
6279
6890
  dialect,
@@ -6360,7 +6971,7 @@ function fillTemplateParams(params, bindings, dialect, listParameters = EMPTY_LI
6360
6971
  }
6361
6972
  if (listParameters.has(name)) {
6362
6973
  assertListBinding(name, value);
6363
- return chunk4MZQVVPX_cjs.getDialect(dialect).packListValue(value);
6974
+ return chunkD5CHUSW7_cjs.getDialect(dialect).packListValue(value);
6364
6975
  }
6365
6976
  return chunkMAYQDOZB_cjs.bindSqlValue(value, dialect);
6366
6977
  });
@@ -7166,7 +7777,7 @@ function buildQueryAst(config, state) {
7166
7777
  // src/query/builder/internal-context.ts
7167
7778
  var contexts = /* @__PURE__ */ new WeakMap();
7168
7779
  function registerQueryBuilderInternalContext(config, context) {
7169
- if (context.recordedReadBinding === void 0 && context.sealedCoordinate === void 0 && context.runtimeKindTokenResolver === void 0) {
7780
+ if (context.recordedReadBinding === void 0 && context.sealedCoordinate === void 0 && context.runtimeKindTokenResolver === void 0 && context.expectedSchemaVersion === void 0) {
7170
7781
  return;
7171
7782
  }
7172
7783
  contexts.set(config, context);
@@ -7224,6 +7835,97 @@ function buildVectorSlots(registry) {
7224
7835
  return slots;
7225
7836
  }
7226
7837
 
7838
+ // src/query/builder/one-statement-batch.ts
7839
+ var ORDER_COLUMN = "typegraphbatchordinal";
7840
+ var ORDER_KEY_PREFIX = "typegraphbatchorder";
7841
+ function oneStatementBatchOrderColumn(index) {
7842
+ return `${ORDER_KEY_PREFIX}${index}`;
7843
+ }
7844
+ function buildOrdinalOrder(rowAlias, orderBy) {
7845
+ if (orderBy.length === 0) return chunkMAYQDOZB_cjs.sql.empty();
7846
+ const row = chunkMAYQDOZB_cjs.sql.identifier(rowAlias);
7847
+ const terms = orderBy.flatMap((order) => {
7848
+ const column = chunkMAYQDOZB_cjs.sql`${row}.${chunkMAYQDOZB_cjs.sql.identifier(order.column)}`;
7849
+ const nullDirection = order.nulls === "first" ? chunkMAYQDOZB_cjs.sql.raw("DESC") : chunkMAYQDOZB_cjs.sql.raw("ASC");
7850
+ return [
7851
+ chunkMAYQDOZB_cjs.sql`(${column} IS NULL) ${nullDirection}`,
7852
+ chunkMAYQDOZB_cjs.sql`${column} ${chunkMAYQDOZB_cjs.sql.raw(order.direction.toUpperCase())}`
7853
+ ];
7854
+ });
7855
+ return chunkMAYQDOZB_cjs.sql`ORDER BY ${chunkMAYQDOZB_cjs.sql.join(terms, chunkMAYQDOZB_cjs.sql`, `)}`;
7856
+ }
7857
+ async function executeOneStatementBatch(backend, queries) {
7858
+ const dialect = chunkD5CHUSW7_cjs.getDialect(backend.dialect);
7859
+ const items = queries.map((query) => {
7860
+ const compile = query.compileOneStatementBatchItem;
7861
+ if (compile === void 0) {
7862
+ throw new chunkG7W67PZO_cjs.ConfigurationError(
7863
+ "Read cannot be embedded in store.batchOnce().",
7864
+ { operation: "batchOnce" },
7865
+ {
7866
+ suggestion: "Pass a fluent relational query or a set-oriented read returned by the store's query helpers."
7867
+ }
7868
+ );
7869
+ }
7870
+ return compile.call(query);
7871
+ });
7872
+ const ctes = [];
7873
+ const branches = [];
7874
+ for (const [index, item] of items.entries()) {
7875
+ const reservedAlias = item.outputNames.find(
7876
+ (outputName) => outputName === ORDER_COLUMN || outputName.startsWith(ORDER_KEY_PREFIX)
7877
+ );
7878
+ if (reservedAlias !== void 0) {
7879
+ throw new chunkG7W67PZO_cjs.ConfigurationError(
7880
+ `Query output alias "${reservedAlias}" is reserved by store.batchOnce().`,
7881
+ { operation: "batchOnce", alias: reservedAlias }
7882
+ );
7883
+ }
7884
+ const sourceName = `typegraph_batch_source_${index}`;
7885
+ const rowsName = `typegraph_batch_rows_${index}`;
7886
+ const ordinalOrder = buildOrdinalOrder(sourceName, item.orderBy);
7887
+ ctes.push(
7888
+ chunkMAYQDOZB_cjs.sql`${chunkMAYQDOZB_cjs.sql.identifier(sourceName)} AS (${item.query})`,
7889
+ chunkMAYQDOZB_cjs.sql`${chunkMAYQDOZB_cjs.sql.identifier(rowsName)} AS (SELECT ${chunkMAYQDOZB_cjs.sql.identifier(sourceName)}.*, ROW_NUMBER() OVER (${ordinalOrder}) AS ${chunkMAYQDOZB_cjs.sql.identifier(ORDER_COLUMN)} FROM ${chunkMAYQDOZB_cjs.sql.identifier(sourceName)})`
7890
+ );
7891
+ const payload = dialect.orderedRowsJsonArray(
7892
+ rowsName,
7893
+ item.outputNames,
7894
+ ORDER_COLUMN
7895
+ );
7896
+ branches.push(chunkMAYQDOZB_cjs.sql`SELECT ${index} AS batch_index, ${payload} AS payload`);
7897
+ }
7898
+ const statement = chunkMAYQDOZB_cjs.asCompiledRowsSql(
7899
+ chunkMAYQDOZB_cjs.sql`WITH ${chunkMAYQDOZB_cjs.sql.join(ctes, chunkMAYQDOZB_cjs.sql`, `)} SELECT * FROM (${chunkMAYQDOZB_cjs.sql.join(branches, chunkMAYQDOZB_cjs.sql` UNION ALL `)}) AS typegraph_batch_envelope ORDER BY batch_index`
7900
+ );
7901
+ const envelopes = await backend.execute(statement);
7902
+ const payloads = /* @__PURE__ */ new Map();
7903
+ for (const envelope of envelopes) {
7904
+ payloads.set(Number(envelope.batch_index), parsePayload(envelope.payload));
7905
+ }
7906
+ return items.map(
7907
+ (item, index) => item.mapRows(payloads.get(index) ?? [])
7908
+ );
7909
+ }
7910
+ function parsePayload(value) {
7911
+ const parsed = typeof value === "string" ? JSON.parse(value) : value;
7912
+ if (!Array.isArray(parsed)) {
7913
+ throw new chunkG7W67PZO_cjs.ConfigurationError(
7914
+ "One-statement batch returned a non-array JSON payload.",
7915
+ { operation: "batchOnce" }
7916
+ );
7917
+ }
7918
+ return parsed.map((row) => {
7919
+ if (typeof row !== "object" || row === null || Array.isArray(row)) {
7920
+ throw new chunkG7W67PZO_cjs.ConfigurationError(
7921
+ "One-statement batch returned a non-object row.",
7922
+ { operation: "batchOnce" }
7923
+ );
7924
+ }
7925
+ return row;
7926
+ });
7927
+ }
7928
+
7227
7929
  // src/query/builder/order-by-field.ts
7228
7930
  var COMMON_SYSTEM_ORDER_FIELDS = /* @__PURE__ */ new Map([
7229
7931
  ["id", "string"],
@@ -7513,6 +8215,12 @@ var ExecutableQuery = class _ExecutableQuery {
7513
8215
  * @throws Error if no backend is configured
7514
8216
  */
7515
8217
  prepare() {
8218
+ if (getQueryBuilderInternalContext(this.#config).expectedSchemaVersion !== void 0) {
8219
+ throw new chunkG7W67PZO_cjs.ConfigurationError(
8220
+ "Prepared queries are unavailable inside withCheckedReads().",
8221
+ { operation: "withCheckedReads.prepare" }
8222
+ );
8223
+ }
7516
8224
  if (!this.#config.backend) {
7517
8225
  throw new Error(
7518
8226
  "Cannot prepare query: no backend configured. Use store.query() or pass a backend to createQueryBuilder()."
@@ -7633,6 +8341,10 @@ var ExecutableQuery = class _ExecutableQuery {
7633
8341
  "Query contains param() references. Use .prepare().execute({...}) instead of .execute()."
7634
8342
  );
7635
8343
  }
8344
+ const checked = getQueryBuilderInternalContext(
8345
+ this.#config
8346
+ ).expectedSchemaVersion;
8347
+ if (checked !== void 0) return this.executeChecked(checked.value);
7636
8348
  const optimizedResult = await this.#tryOptimizedExecution();
7637
8349
  if (optimizedResult !== void 0) {
7638
8350
  return optimizedResult;
@@ -7698,6 +8410,24 @@ var ExecutableQuery = class _ExecutableQuery {
7698
8410
  "Query contains param() references. Use .prepare().execute({...}) instead of .execute()."
7699
8411
  );
7700
8412
  }
8413
+ const checked = getQueryBuilderInternalContext(
8414
+ this.#config
8415
+ ).expectedSchemaVersion;
8416
+ if (checked !== void 0) {
8417
+ const rows2 = await executeSchemaCheckedRead({
8418
+ backend,
8419
+ ast,
8420
+ graphId: this.#config.graphId,
8421
+ expectedVersion: checked.value,
8422
+ compile: () => compileQuery(ast, this.#config.graphId, this.#compileOptions())
8423
+ });
8424
+ return mapResults(
8425
+ rows2,
8426
+ this.#state.startAlias,
8427
+ this.#state.traversals,
8428
+ this.#selectFn
8429
+ );
8430
+ }
7701
8431
  const optimizedResult = await this.#tryOptimizedExecutionOn(backend);
7702
8432
  if (optimizedResult !== void 0) {
7703
8433
  return optimizedResult;
@@ -7715,6 +8445,53 @@ var ExecutableQuery = class _ExecutableQuery {
7715
8445
  this.#selectFn
7716
8446
  );
7717
8447
  }
8448
+ /** @internal Embedding contract consumed by `store.batchOnce()`. */
8449
+ compileOneStatementBatchItem() {
8450
+ if (getQueryBuilderInternalContext(this.#config).expectedSchemaVersion !== void 0) {
8451
+ throw new chunkG7W67PZO_cjs.ConfigurationError(
8452
+ "Queries from withCheckedReads() cannot be embedded in batchOnce().",
8453
+ { operation: "withCheckedReads.batchOnce" }
8454
+ );
8455
+ }
8456
+ if (this.#hasParameterReferences()) {
8457
+ throw new Error(
8458
+ "Query contains param() references. Bind prepared queries before batching."
8459
+ );
8460
+ }
8461
+ const ast = this.toAst();
8462
+ const batchOrderBy = (ast.orderBy ?? []).map((order, index) => ({
8463
+ column: oneStatementBatchOrderColumn(index),
8464
+ direction: order.direction,
8465
+ nulls: order.nulls ?? (order.direction === "asc" ? "last" : "first")
8466
+ }));
8467
+ const batchAst = batchOrderBy.length === 0 ? ast : {
8468
+ ...ast,
8469
+ projection: {
8470
+ fields: [
8471
+ ...ast.projection.fields,
8472
+ ...(ast.orderBy ?? []).map((order, index) => ({
8473
+ outputName: oneStatementBatchOrderColumn(index),
8474
+ source: order.field
8475
+ }))
8476
+ ]
8477
+ }
8478
+ };
8479
+ return {
8480
+ query: compileQuery(
8481
+ batchAst,
8482
+ this.#config.graphId,
8483
+ this.#compileOptions()
8484
+ ),
8485
+ outputNames: ast.projection.fields.map((field2) => field2.outputName),
8486
+ orderBy: batchOrderBy,
8487
+ mapRows: (rows) => mapResults(
8488
+ transformPathColumns(rows, this.#state, this.#dialect()),
8489
+ this.#state.startAlias,
8490
+ this.#state.traversals,
8491
+ this.#selectFn
8492
+ )
8493
+ };
8494
+ }
7718
8495
  /**
7719
8496
  * Attempts optimized execution by tracking which fields the select callback accesses.
7720
8497
  *
@@ -8137,6 +8914,7 @@ var ExecutableQuery = class _ExecutableQuery {
8137
8914
  * @throws ValidationError if cursor columns don't match query ORDER BY columns
8138
8915
  */
8139
8916
  async paginate(options) {
8917
+ this.#refuseCheckedReadSurface("paginate");
8140
8918
  if (!this.#config.backend) {
8141
8919
  throw new Error(
8142
8920
  "Cannot execute query: no backend configured. Use store.query() or pass a backend to createQueryBuilder()."
@@ -8218,6 +8996,7 @@ var ExecutableQuery = class _ExecutableQuery {
8218
8996
  * @throws ValidationError if ORDER BY is not specified
8219
8997
  */
8220
8998
  stream(options) {
8999
+ this.#refuseCheckedReadSurface("stream");
8221
9000
  if (this.#state.orderBy.length === 0) {
8222
9001
  throw new chunkG7W67PZO_cjs.ValidationError(
8223
9002
  "Streaming requires ORDER BY. Add .orderBy() before .stream()",
@@ -8237,6 +9016,15 @@ var ExecutableQuery = class _ExecutableQuery {
8237
9016
  (paginateOptions) => this.paginate(paginateOptions)
8238
9017
  );
8239
9018
  }
9019
+ #refuseCheckedReadSurface(surface) {
9020
+ if (getQueryBuilderInternalContext(this.#config).expectedSchemaVersion === void 0) {
9021
+ return;
9022
+ }
9023
+ throw new chunkG7W67PZO_cjs.ConfigurationError(
9024
+ `${surface === "paginate" ? "Pagination" : "Streaming"} is unavailable inside withCheckedReads().`,
9025
+ { operation: `withCheckedReads.${surface}` }
9026
+ );
9027
+ }
8240
9028
  /**
8241
9029
  * Executes a query with cursor conditions applied.
8242
9030
  */
@@ -8403,6 +9191,12 @@ var ExecutableAggregateQuery = class _ExecutableAggregateQuery {
8403
9191
  * @throws Error if no backend is configured
8404
9192
  */
8405
9193
  async execute() {
9194
+ if (getQueryBuilderInternalContext(this.#config).expectedSchemaVersion !== void 0) {
9195
+ throw new chunkG7W67PZO_cjs.ConfigurationError(
9196
+ "Aggregate queries are unavailable inside withCheckedReads().",
9197
+ { operation: "withCheckedReads.aggregate" }
9198
+ );
9199
+ }
8406
9200
  const backend = this.#config.backend;
8407
9201
  if (!backend) {
8408
9202
  throw new Error(
@@ -9930,6 +10724,7 @@ var UnionableQuery = class _UnionableQuery {
9930
10724
  * Executes the combined query.
9931
10725
  */
9932
10726
  async execute() {
10727
+ this.#refuseCheckedScope();
9933
10728
  if (!this.#config.backend) {
9934
10729
  throw new Error(
9935
10730
  "Cannot execute query: no backend configured. Use store.query() or pass a backend to createQueryBuilder()."
@@ -9954,6 +10749,7 @@ var UnionableQuery = class _UnionableQuery {
9954
10749
  * transaction support.
9955
10750
  */
9956
10751
  async executeOn(backend) {
10752
+ this.#refuseCheckedScope();
9957
10753
  const ast = this.toAst();
9958
10754
  if (composableQueryHasParameterReferences(ast)) {
9959
10755
  throw new Error(
@@ -9964,7 +10760,40 @@ var UnionableQuery = class _UnionableQuery {
9964
10760
  await this.#fetchRows(backend, ast, "recorded-batch-query")
9965
10761
  );
9966
10762
  }
10763
+ /** @internal Embedding contract consumed by `store.batchOnce()`. */
10764
+ compileOneStatementBatchItem() {
10765
+ this.#refuseCheckedScope();
10766
+ const ast = this.toAst();
10767
+ if (composableQueryHasParameterReferences(ast)) {
10768
+ throw new Error(
10769
+ "Query contains param() references. Bind prepared queries before batching."
10770
+ );
10771
+ }
10772
+ return {
10773
+ query: compileSetOperation2(
10774
+ ast,
10775
+ this.#config.graphId,
10776
+ this.#compileOptions()
10777
+ ),
10778
+ outputNames: projectionOutputNames2(ast),
10779
+ orderBy: [],
10780
+ mapRows: (rows) => this.#mapRows(rows)
10781
+ };
10782
+ }
10783
+ #refuseCheckedScope() {
10784
+ if (getQueryBuilderInternalContext(this.#config).expectedSchemaVersion === void 0) {
10785
+ return;
10786
+ }
10787
+ throw new chunkG7W67PZO_cjs.ConfigurationError(
10788
+ "Set operations are unavailable inside withCheckedReads().",
10789
+ { operation: "withCheckedReads.setOperation" }
10790
+ );
10791
+ }
9967
10792
  };
10793
+ function projectionOutputNames2(query) {
10794
+ if ("__type" in query) return projectionOutputNames2(query.left);
10795
+ return query.projection.fields.map((field2) => field2.outputName);
10796
+ }
9968
10797
 
9969
10798
  // src/query/builder/aggregates.ts
9970
10799
  function count(alias, field2) {
@@ -10192,6 +11021,9 @@ function createQueryBuilderWithContext(graphId, registry, options) {
10192
11021
  },
10193
11022
  ...options?.runtimeKindTokenResolver !== void 0 && {
10194
11023
  runtimeKindTokenResolver: options.runtimeKindTokenResolver
11024
+ },
11025
+ ...options?.expectedSchemaVersion !== void 0 && {
11026
+ expectedSchemaVersion: options.expectedSchemaVersion
10195
11027
  }
10196
11028
  });
10197
11029
  const sealed = options?.sealedCoordinate?.valid;
@@ -10286,8 +11118,8 @@ async function runFulltextRebuild(driver, ctx, nodeKind, options) {
10286
11118
  "This backend declares no fulltext capability, so there is no fulltext index to rebuild. Use a backend with fulltext support."
10287
11119
  );
10288
11120
  }
10289
- chunkBPYZUJX5_cjs.assertFulltextMember(backend.upsertFulltext, "upsertFulltext", backend);
10290
- chunkBPYZUJX5_cjs.assertFulltextMember(backend.deleteFulltext, "deleteFulltext", backend);
11121
+ chunkMTJAT6UO_cjs.assertFulltextMember(backend.upsertFulltext, "upsertFulltext", backend);
11122
+ chunkMTJAT6UO_cjs.assertFulltextMember(backend.deleteFulltext, "deleteFulltext", backend);
10291
11123
  const pageSize = validatePageSize(options.pageSize);
10292
11124
  const maxSkippedIds = validateMaxSkippedIds(options.maxSkippedIds);
10293
11125
  const targetKinds = nodeKind === void 0 ? [...registry.nodeKinds.keys()] : [nodeKind];
@@ -10342,7 +11174,7 @@ async function runFulltextRebuild(driver, ctx, nodeKind, options) {
10342
11174
  });
10343
11175
  }
10344
11176
  } else {
10345
- chunkBPYZUJX5_cjs.assertFulltextMember(
11177
+ chunkMTJAT6UO_cjs.assertFulltextMember(
10346
11178
  target.upsertFulltext,
10347
11179
  "upsertFulltext",
10348
11180
  target
@@ -10365,7 +11197,7 @@ async function runFulltextRebuild(driver, ctx, nodeKind, options) {
10365
11197
  });
10366
11198
  }
10367
11199
  } else {
10368
- chunkBPYZUJX5_cjs.assertFulltextMember(
11200
+ chunkMTJAT6UO_cjs.assertFulltextMember(
10369
11201
  target.deleteFulltext,
10370
11202
  "deleteFulltext",
10371
11203
  target
@@ -10416,7 +11248,7 @@ function processPage(schema, rows) {
10416
11248
  skippedIds.push(row.id);
10417
11249
  continue;
10418
11250
  }
10419
- const computed = chunkBPYZUJX5_cjs.computeFulltextContent(schema, parsed);
11251
+ const computed = chunkMTJAT6UO_cjs.computeFulltextContent(schema, parsed);
10420
11252
  if (computed === void 0) {
10421
11253
  toDelete.push(row.id);
10422
11254
  } else {
@@ -10503,7 +11335,7 @@ async function fetchNodesForRows(backend, batchPointRead, graphId, rows) {
10503
11335
  function tryResolveSearchSlot(ctx, nodeKind, fieldPath) {
10504
11336
  const nodeType = ctx.registry.getNodeType(nodeKind);
10505
11337
  if (nodeType === void 0) return void 0;
10506
- const fields = chunkBPYZUJX5_cjs.getEmbeddingFields(nodeType.schema);
11338
+ const fields = chunkMTJAT6UO_cjs.getEmbeddingFields(nodeType.schema);
10507
11339
  const field2 = fields.find((entry2) => entry2.fieldPath === fieldPath);
10508
11340
  if (field2 === void 0) return void 0;
10509
11341
  return {
@@ -10825,7 +11657,7 @@ async function executeHybridSearch(ctx, nodeKind, options) {
10825
11657
  ...candidates === void 0 ? {} : { candidates }
10826
11658
  });
10827
11659
  return rows.map((row, index) => {
10828
- const typedNode = chunkQR6V2BXA_cjs.rowToNode(row.node);
11660
+ const typedNode = chunkPTFO3JI5_cjs.rowToNode(row.node);
10829
11661
  return {
10830
11662
  node: typedNode,
10831
11663
  score: row.fusedScore,
@@ -11104,13 +11936,13 @@ async function fetchNodesByIds(backend, batchPointRead, graphId, nodeKind, ids)
11104
11936
  const rows = await bound.getNodes(graphId, nodeKind, ids);
11105
11937
  for (const row of rows) {
11106
11938
  if (row.deleted_at !== void 0) continue;
11107
- map.set(row.id, chunkQR6V2BXA_cjs.rowToNode(row));
11939
+ map.set(row.id, chunkPTFO3JI5_cjs.rowToNode(row));
11108
11940
  }
11109
11941
  return map;
11110
11942
  }
11111
11943
  for (const id of ids) {
11112
11944
  const row = await backend.getNode(graphId, nodeKind, id);
11113
- if (row && row.deleted_at === void 0) map.set(row.id, chunkQR6V2BXA_cjs.rowToNode(row));
11945
+ if (row && row.deleted_at === void 0) map.set(row.id, chunkPTFO3JI5_cjs.rowToNode(row));
11114
11946
  }
11115
11947
  return map;
11116
11948
  }
@@ -11391,7 +12223,7 @@ function declaredPathsForEntity(graph, entity) {
11391
12223
  );
11392
12224
  for (const schema of schemas) {
11393
12225
  for (const path of declaredPropertyPaths(
11394
- chunkU53HFE4L_cjs.serializeSchemaProperties(schema)
12226
+ chunkOKA6H3B3_cjs.serializeSchemaProperties(schema)
11395
12227
  )) {
11396
12228
  paths.add(pathToPointer(path));
11397
12229
  }
@@ -11400,7 +12232,7 @@ function declaredPathsForEntity(graph, entity) {
11400
12232
  }
11401
12233
  function populationSelect(ctx, entity, paths, currentTimestamp) {
11402
12234
  const table = entity === "node" ? ctx.schema.nodesTable : ctx.schema.edgesTable;
11403
- const dialect = chunk4MZQVVPX_cjs.getDialect(ctx.backend.dialect);
12235
+ const dialect = chunkD5CHUSW7_cjs.getDialect(ctx.backend.dialect);
11404
12236
  const temporal = chunkWEXAMJTA_cjs.compileTemporalFilter({
11405
12237
  mode: "current",
11406
12238
  currentTimestamp: chunkMAYQDOZB_cjs.sql`${currentTimestamp}`
@@ -11456,7 +12288,7 @@ async function readEntityPopulation(ctx, entity, paths, currentTimestamp) {
11456
12288
  function populationForKind(entity, kind, schema, populations) {
11457
12289
  const population = populations.get(kind);
11458
12290
  const count2 = population?.count ?? 0;
11459
- const declaredPaths = declaredPropertyPaths(chunkU53HFE4L_cjs.serializeSchemaProperties(schema)).map((path) => pathToPointer(path)).toSorted();
12291
+ const declaredPaths = declaredPropertyPaths(chunkOKA6H3B3_cjs.serializeSchemaProperties(schema)).map((path) => pathToPointer(path)).toSorted();
11460
12292
  return {
11461
12293
  entity,
11462
12294
  kind,
@@ -12271,7 +13103,7 @@ function temporaryTableCapabilityError(ctx, algorithm, sqlState, cause) {
12271
13103
  }
12272
13104
  async function runWorkingTableRounds(ctx, options, plan, backend) {
12273
13105
  const temporaryBackend = requireTemporaryStatements(backend);
12274
- const runId = chunkIV5W7LKW_cjs.generateId();
13106
+ const runId = chunkA22XPVBQ_cjs.generateId();
12275
13107
  const workingTable = chunkMAYQDOZB_cjs.sql.identifier(
12276
13108
  `typegraph_iterative_${runId.replaceAll("-", "_")}`
12277
13109
  );
@@ -14650,7 +15482,7 @@ function createGraphAlgorithms(params) {
14650
15482
  graph: params.graph,
14651
15483
  registry: params.registry,
14652
15484
  backend: params.backend,
14653
- dialect: chunk4MZQVVPX_cjs.getDialect(params.backend.dialect),
15485
+ dialect: chunkD5CHUSW7_cjs.getDialect(params.backend.dialect),
14654
15486
  schema: params.schema ?? chunkEOLNL35G_cjs.createSqlSchema(params.backend.tableNames),
14655
15487
  recordedReadBinding: params.recordedReadBinding,
14656
15488
  defaultTemporalMode: params.defaultTemporalMode
@@ -14949,18 +15781,18 @@ function lowerBoundRequiresWrite(requested, stored) {
14949
15781
  return requestedValidFrom !== void 0 && requestedValidFrom !== null && !chunkNWJV4UVW_cjs.isCanonicalIsoDate(requestedValidFrom);
14950
15782
  }
14951
15783
  function upsertWindowChanges(requested, current) {
14952
- return lowerBoundRequiresWrite(requested, current.valid_from) || requested?.clearValidTo === true && chunkQR6V2BXA_cjs.validityEndAfterMutation(requested, current.valid_to) !== current.valid_to || requested?.clearValidTo === true && requested.validTo !== void 0 || windowFieldChanges("validTo", requested?.validTo, current.valid_to);
15784
+ return lowerBoundRequiresWrite(requested, current.valid_from) || requested?.clearValidTo === true && chunkPTFO3JI5_cjs.validityEndAfterMutation(requested, current.valid_to) !== current.valid_to || requested?.clearValidTo === true && requested.validTo !== void 0 || windowFieldChanges("validTo", requested?.validTo, current.valid_to);
14953
15785
  }
14954
15786
  function windowAfterUpsertCreate(requested) {
14955
15787
  return {
14956
15788
  valid_from: requested.validFrom === null ? void 0 : requested.validFrom ?? UNKNOWN_VALIDITY_LOWER_BOUND,
14957
- valid_to: chunkQR6V2BXA_cjs.validityEndAfterMutation(requested, void 0)
15789
+ valid_to: chunkPTFO3JI5_cjs.validityEndAfterMutation(requested, void 0)
14958
15790
  };
14959
15791
  }
14960
15792
  function windowAfterUpsertUpdate(current, requested) {
14961
15793
  return {
14962
15794
  valid_from: current.valid_from,
14963
- valid_to: chunkQR6V2BXA_cjs.validityEndAfterMutation(requested, current.valid_to)
15795
+ valid_to: chunkPTFO3JI5_cjs.validityEndAfterMutation(requested, current.valid_to)
14964
15796
  };
14965
15797
  }
14966
15798
  function shouldCoalesceUpsert(existing, options, runDirtyCheck) {
@@ -15166,7 +15998,7 @@ function createEdgeCollection(config) {
15166
15998
  },
15167
15999
  async getByIds(ids, options) {
15168
16000
  if (ids.length === 0) return [];
15169
- const rowsById = await chunkIV5W7LKW_cjs.getEdgeRowsByIds(
16001
+ const rowsById = await chunkA22XPVBQ_cjs.getEdgeRowsByIds(
15170
16002
  backend,
15171
16003
  batchPointRead,
15172
16004
  graphId,
@@ -15271,18 +16103,18 @@ function createEdgeCollection(config) {
15271
16103
  async bulkUpsertById(items) {
15272
16104
  if (items.length === 0) return [];
15273
16105
  for (const item of items) {
15274
- chunkQR6V2BXA_cjs.assertValidityEndMutation(item, {
16106
+ chunkPTFO3JI5_cjs.assertValidityEndMutation(item, {
15275
16107
  entityType: "edge",
15276
16108
  kind,
15277
16109
  id: item.id
15278
16110
  });
15279
16111
  if (item.clearValidTo === true) {
15280
- chunkQR6V2BXA_cjs.assertClearValidToSupported(backend, "edge");
16112
+ chunkPTFO3JI5_cjs.assertClearValidToSupported(backend, "edge");
15281
16113
  }
15282
16114
  }
15283
16115
  const upsertAll = async (target) => {
15284
16116
  const ids = items.map((item) => item.id);
15285
- const existingMap = await chunkIV5W7LKW_cjs.getEdgeRowsByIds(
16117
+ const existingMap = await chunkA22XPVBQ_cjs.getEdgeRowsByIds(
15286
16118
  target,
15287
16119
  batchPointRead,
15288
16120
  graphId,
@@ -15450,7 +16282,7 @@ function createEdgeCollection(config) {
15450
16282
  }
15451
16283
  return { results: results2, mutations: toCreate.length + toUpdate.length };
15452
16284
  };
15453
- const { results, mutations } = await chunkQR6V2BXA_cjs.runResolvedMutationSetConverging(
16285
+ const { results, mutations } = await chunkPTFO3JI5_cjs.runResolvedMutationSetConverging(
15454
16286
  "edge",
15455
16287
  backend,
15456
16288
  () => chunkEOLNL35G_cjs.runOptionallyInTransaction(backend, (target) => upsertAll(target))
@@ -15480,7 +16312,7 @@ function createEdgeCollection(config) {
15480
16312
  return result === void 0 ? void 0 : narrowEdge(result);
15481
16313
  },
15482
16314
  async getOrCreateByEndpoints(from, to, props, options) {
15483
- chunkQR6V2BXA_cjs.assertValidityEndMutation(options ?? {}, {
16315
+ chunkPTFO3JI5_cjs.assertValidityEndMutation(options ?? {}, {
15484
16316
  entityType: "edge",
15485
16317
  kind
15486
16318
  });
@@ -15515,7 +16347,7 @@ function createEdgeCollection(config) {
15515
16347
  async bulkGetOrCreateByEndpoints(items, options) {
15516
16348
  if (items.length === 0) return [];
15517
16349
  for (const item of items) {
15518
- chunkQR6V2BXA_cjs.assertValidityEndMutation(item, {
16350
+ chunkPTFO3JI5_cjs.assertValidityEndMutation(item, {
15519
16351
  entityType: "edge",
15520
16352
  kind
15521
16353
  });
@@ -15671,7 +16503,7 @@ function createNodeCollection(config) {
15671
16503
  },
15672
16504
  async getByIds(ids, options) {
15673
16505
  if (ids.length === 0) return [];
15674
- const rowsById = await chunkIV5W7LKW_cjs.getNodeRowsByIds(
16506
+ const rowsById = await chunkA22XPVBQ_cjs.getNodeRowsByIds(
15675
16507
  backend,
15676
16508
  batchPointRead,
15677
16509
  graphId,
@@ -15839,13 +16671,13 @@ function createNodeCollection(config) {
15839
16671
  return this.upsertByIdFromRecord(id, props, options);
15840
16672
  },
15841
16673
  async upsertByIdFromRecord(id, data, options) {
15842
- chunkQR6V2BXA_cjs.assertValidityEndMutation(options ?? {}, {
16674
+ chunkPTFO3JI5_cjs.assertValidityEndMutation(options ?? {}, {
15843
16675
  entityType: "node",
15844
16676
  kind,
15845
16677
  id
15846
16678
  });
15847
16679
  if (options?.clearValidTo === true) {
15848
- chunkQR6V2BXA_cjs.assertClearValidToSupported(backend, "node");
16680
+ chunkPTFO3JI5_cjs.assertClearValidToSupported(backend, "node");
15849
16681
  }
15850
16682
  const existing = await backend.getNode(graphId, kind, id);
15851
16683
  const coalesces = (row) => {
@@ -15918,11 +16750,11 @@ function createNodeCollection(config) {
15918
16750
  await config.maybeRefreshStatisticsAfterBulk?.(attempt.value.length);
15919
16751
  return narrowNodes(attempt.value);
15920
16752
  }
15921
- const results = await chunkQR6V2BXA_cjs.runResolvedMutationSetConverging(
16753
+ const results = await chunkPTFO3JI5_cjs.runResolvedMutationSetConverging(
15922
16754
  "node",
15923
16755
  backend,
15924
16756
  () => chunkEOLNL35G_cjs.runOptionallyInTransaction(backend, async (target) => {
15925
- const rows = await chunkIV5W7LKW_cjs.getNodeRowsByIds(
16757
+ const rows = await chunkA22XPVBQ_cjs.getNodeRowsByIds(
15926
16758
  target,
15927
16759
  batchPointRead,
15928
16760
  graphId,
@@ -15969,13 +16801,13 @@ function createNodeCollection(config) {
15969
16801
  async bulkUpsertById(items) {
15970
16802
  if (items.length === 0) return [];
15971
16803
  for (const item of items) {
15972
- chunkQR6V2BXA_cjs.assertValidityEndMutation(item, {
16804
+ chunkPTFO3JI5_cjs.assertValidityEndMutation(item, {
15973
16805
  entityType: "node",
15974
16806
  kind,
15975
16807
  id: item.id
15976
16808
  });
15977
16809
  if (item.clearValidTo === true) {
15978
- chunkQR6V2BXA_cjs.assertClearValidToSupported(backend, "node");
16810
+ chunkPTFO3JI5_cjs.assertClearValidToSupported(backend, "node");
15979
16811
  }
15980
16812
  }
15981
16813
  const upsertAll = async (target) => {
@@ -16115,7 +16947,7 @@ function createNodeCollection(config) {
16115
16947
  }
16116
16948
  return { results: results2, mutations: toCreate.length + toUpdate.length };
16117
16949
  };
16118
- const { results, mutations } = await chunkQR6V2BXA_cjs.runResolvedMutationSetConverging(
16950
+ const { results, mutations } = await chunkPTFO3JI5_cjs.runResolvedMutationSetConverging(
16119
16951
  "node",
16120
16952
  backend,
16121
16953
  () => chunkEOLNL35G_cjs.runOptionallyInTransaction(backend, (target) => upsertAll(target))
@@ -16396,7 +17228,7 @@ function createHistoryStoreBackendProjection(backend) {
16396
17228
  // src/store/introspect.ts
16397
17229
  function introspectSchema(graph, context) {
16398
17230
  const extension = graph.extension;
16399
- const { nodes: runtimeNodeNames, edges: runtimeEdgeNames } = chunkU53HFE4L_cjs.extensionKindNames(extension);
17231
+ const { nodes: runtimeNodeNames, edges: runtimeEdgeNames } = chunkOKA6H3B3_cjs.extensionKindNames(extension);
16400
17232
  const deprecated = graph.deprecatedKinds;
16401
17233
  const kinds = [];
16402
17234
  for (const [name, registration] of Object.entries(graph.nodes)) {
@@ -16407,7 +17239,7 @@ function introspectSchema(graph, context) {
16407
17239
  description: reg.type.description,
16408
17240
  annotations: reg.type.annotations,
16409
17241
  deprecated: deprecated.has(name),
16410
- properties: chunkU53HFE4L_cjs.serializeSchemaProperties(reg.type.schema),
17242
+ properties: chunkOKA6H3B3_cjs.serializeSchemaProperties(reg.type.schema),
16411
17243
  unique: (reg.unique ?? []).map((constraint) => ({
16412
17244
  name: constraint.name,
16413
17245
  fields: [...constraint.fields],
@@ -16428,17 +17260,17 @@ function introspectSchema(graph, context) {
16428
17260
  to: chunkFSSQ4YNU_cjs.projectTargetKinds(reg.to),
16429
17261
  cardinality: reg.cardinality ?? "many",
16430
17262
  endpointExistence: reg.endpointExistence ?? "notDeleted",
16431
- properties: chunkU53HFE4L_cjs.serializeSchemaProperties(edgeType.schema),
17263
+ properties: chunkOKA6H3B3_cjs.serializeSchemaProperties(edgeType.schema),
16432
17264
  annotations: edgeType.annotations,
16433
17265
  deprecated: deprecated.has(name)
16434
17266
  });
16435
17267
  }
16436
- const runtimeOntologyKeys = chunkU53HFE4L_cjs.buildGraphExtensionOntologyKeySet(extension);
17268
+ const runtimeOntologyKeys = chunkOKA6H3B3_cjs.buildGraphExtensionOntologyKeySet(extension);
16437
17269
  const ontology = graph.ontology.map((relation) => ({
16438
17270
  metaEdge: relation.metaEdge.name,
16439
17271
  from: chunkUVVDQGOY_cjs.getTypeName(relation.from),
16440
17272
  to: chunkUVVDQGOY_cjs.getTypeName(relation.to),
16441
- origin: runtimeOntologyKeys.has(chunkU53HFE4L_cjs.compileTimeOntologyKey(relation)) ? "runtime" : "compile-time"
17273
+ origin: runtimeOntologyKeys.has(chunkOKA6H3B3_cjs.compileTimeOntologyKey(relation)) ? "runtime" : "compile-time"
16442
17274
  }));
16443
17275
  return {
16444
17276
  graphId: context.graphId,
@@ -16643,7 +17475,7 @@ async function materializeRelationalIndex(declaration, backend, catalog, dialect
16643
17475
  reason: `Index method "${declaration.method}" requires PostgreSQL (expression GIN${declaration.method === "trigram" ? " + pg_trgm" : ""}); SQLite serves substring search via FTS5 fulltext instead.`
16644
17476
  };
16645
17477
  }
16646
- const ddl = chunkZHLWPHNT_cjs.generateIndexDDL(declaration, dialect, ddlOptions);
17478
+ const ddl = chunkRJ3GVX73_cjs.generateIndexDDL(declaration, dialect, ddlOptions);
16647
17479
  const targetTable = declaration.entity === "node" ? ddlOptions.nodesTableName ?? "typegraph_nodes" : ddlOptions.edgesTableName ?? "typegraph_edges";
16648
17480
  const signature = await computeIndexSignature(
16649
17481
  dialect,
@@ -17151,7 +17983,7 @@ async function computeIndexSignature(dialect, targetTableName, declaration) {
17151
17983
  const hashable = {
17152
17984
  dialect,
17153
17985
  targetTableName,
17154
- declaration: chunkU53HFE4L_cjs.serializeIndexDeclaration(declaration)
17986
+ declaration: chunkOKA6H3B3_cjs.serializeIndexDeclaration(declaration)
17155
17987
  };
17156
17988
  const json = JSON.stringify(hashable, chunkWEXAMJTA_cjs.sortedReplacer);
17157
17989
  return chunkZY4GXIVN_cjs.sha256Hex(json, 16);
@@ -17173,7 +18005,7 @@ async function materializeRemovals(context, options = {}) {
17173
18005
  await ensureFocusedStatusTable(backend, backend.ensureKindRemovalsTable);
17174
18006
  await reconcilePendingRemovals(context);
17175
18007
  const activeRow = await backend.getActiveSchema(graphId);
17176
- const activeSchema = activeRow === void 0 ? void 0 : chunkU53HFE4L_cjs.parseSerializedSchema(activeRow.schema_doc);
18008
+ const activeSchema = activeRow === void 0 ? void 0 : chunkOKA6H3B3_cjs.parseSerializedSchema(activeRow.schema_doc);
17177
18009
  const reclaimedVectorFields = await reclaimRemovedVectorFieldTables(
17178
18010
  context,
17179
18011
  activeRow
@@ -17242,14 +18074,14 @@ async function reconcilePendingRemovals(context) {
17242
18074
  const reconciliations = [];
17243
18075
  const stopAtVersion = marker ?? 1;
17244
18076
  let currentRow = activeRow;
17245
- let currentSchema = chunkU53HFE4L_cjs.parseSerializedSchema(activeRow.schema_doc);
18077
+ let currentSchema = chunkOKA6H3B3_cjs.parseSerializedSchema(activeRow.schema_doc);
17246
18078
  while (currentRow.version > stopAtVersion) {
17247
18079
  const priorRow = await backend.getSchemaVersion(
17248
18080
  graphId,
17249
18081
  currentRow.version - 1
17250
18082
  );
17251
18083
  if (priorRow === void 0) break;
17252
- const priorSchema = chunkU53HFE4L_cjs.parseSerializedSchema(priorRow.schema_doc);
18084
+ const priorSchema = chunkOKA6H3B3_cjs.parseSerializedSchema(priorRow.schema_doc);
17253
18085
  for (const entity of ENTITY_KINDS) {
17254
18086
  const priorEntries = priorSchema[entity === "node" ? "nodes" : "edges"];
17255
18087
  const currentEntries = currentSchema[entity === "node" ? "nodes" : "edges"];
@@ -17314,7 +18146,7 @@ async function materializeOne2(row, ctx) {
17314
18146
  ctx.graphId,
17315
18147
  async (target) => {
17316
18148
  const activeRow = await target.getActiveSchema(ctx.graphId);
17317
- const activeSchema = activeRow === void 0 ? void 0 : chunkU53HFE4L_cjs.parseSerializedSchema(activeRow.schema_doc);
18149
+ const activeSchema = activeRow === void 0 ? void 0 : chunkOKA6H3B3_cjs.parseSerializedSchema(activeRow.schema_doc);
17318
18150
  if (liveKindNamesFrom(activeSchema)[row.entity].has(row.kindName)) {
17319
18151
  return "skipped";
17320
18152
  }
@@ -17389,7 +18221,7 @@ async function closeRecordedAndDeleteLiveRows(ctx, row, target) {
17389
18221
  await executeDeleteStatements(target, deleteStatements);
17390
18222
  return;
17391
18223
  }
17392
- await chunkIV5W7LKW_cjs.closeRecordedHardDeletedKind(
18224
+ await chunkA22XPVBQ_cjs.closeRecordedHardDeletedKind(
17393
18225
  target,
17394
18226
  recordedSchema,
17395
18227
  ctx.graphId,
@@ -17477,7 +18309,7 @@ async function resolveRemovedKindEmbeddingSlots(backend, row) {
17477
18309
  if (priorVersion < 1) return [];
17478
18310
  const priorRow = await backend.getSchemaVersion(row.graphId, priorVersion);
17479
18311
  if (priorRow === void 0) return [];
17480
- const priorSchema = chunkU53HFE4L_cjs.parseSerializedSchema(priorRow.schema_doc);
18312
+ const priorSchema = chunkOKA6H3B3_cjs.parseSerializedSchema(priorRow.schema_doc);
17481
18313
  const slots = /* @__PURE__ */ new Map();
17482
18314
  for (const declaration of priorSchema.indexes ?? []) {
17483
18315
  if (declaration.entity === "vector" && declaration.kind === row.kindName) {
@@ -17514,14 +18346,14 @@ async function reclaimRemovedVectorFieldTables(context, activeRow) {
17514
18346
  let perBackend = reclaimCache.get(backend);
17515
18347
  const cached = perBackend?.get(cacheKey);
17516
18348
  if (cached !== void 0) return cached;
17517
- const activeSchema = chunkU53HFE4L_cjs.parseSerializedSchema(activeRow.schema_doc);
18349
+ const activeSchema = chunkOKA6H3B3_cjs.parseSerializedSchema(activeRow.schema_doc);
17518
18350
  const activeVectorFields = vectorFieldKeysFrom(activeSchema);
17519
18351
  const survivingKinds = new Set(Object.keys(activeSchema.nodes));
17520
18352
  const historical = /* @__PURE__ */ new Map();
17521
18353
  for (let version = activeRow.version - 1; version >= 1; version -= 1) {
17522
18354
  const priorRow = await backend.getSchemaVersion(graphId, version);
17523
18355
  if (priorRow === void 0) continue;
17524
- const priorSchema = chunkU53HFE4L_cjs.parseSerializedSchema(priorRow.schema_doc);
18356
+ const priorSchema = chunkOKA6H3B3_cjs.parseSerializedSchema(priorRow.schema_doc);
17525
18357
  for (const declaration of priorSchema.indexes ?? []) {
17526
18358
  if (declaration.entity !== "vector") continue;
17527
18359
  const key = vectorFieldKey(declaration.kind, declaration.fieldPath);
@@ -17559,7 +18391,7 @@ async function reclaimRemovedVectorFieldTables(context, activeRow) {
17559
18391
  async (target) => {
17560
18392
  const lockedActiveRow = await target.getActiveSchema(graphId);
17561
18393
  if (lockedActiveRow === void 0) return false;
17562
- const lockedActiveSchema = chunkU53HFE4L_cjs.parseSerializedSchema(
18394
+ const lockedActiveSchema = chunkOKA6H3B3_cjs.parseSerializedSchema(
17563
18395
  lockedActiveRow.schema_doc
17564
18396
  );
17565
18397
  const lockedVectorFields = vectorFieldKeysFrom(lockedActiveSchema);
@@ -17684,7 +18516,7 @@ async function validateAndPrepareEdgeCreate(ctx, input, id, backend, options) {
17684
18516
  const toKind = input.toKind;
17685
18517
  const registration = getEdgeRegistration(ctx.graph, kind);
17686
18518
  const edgeKind = registration.type;
17687
- chunkC3CN2C2T_cjs.assertEdgeMatchIdentityBackendSupport(
18519
+ chunkQ6ZVQWH7_cjs.assertEdgeMatchIdentityBackendSupport(
17688
18520
  registration.matchIdentity,
17689
18521
  backend.capabilities,
17690
18522
  kind
@@ -17708,11 +18540,11 @@ async function validateAndPrepareEdgeCreate(ctx, input, id, backend, options) {
17708
18540
  backend
17709
18541
  );
17710
18542
  }
17711
- const validatedProps = chunkIV5W7LKW_cjs.validateEdgeProps(edgeKind.schema, input.props, {
18543
+ const validatedProps = chunkA22XPVBQ_cjs.validateEdgeProps(edgeKind.schema, input.props, {
17712
18544
  kind,
17713
18545
  operation: "create"
17714
18546
  });
17715
- const matchIdentity = chunkQR6V2BXA_cjs.resolveEdgeMatchIdentityStorage(
18547
+ const matchIdentity = chunkPTFO3JI5_cjs.resolveEdgeMatchIdentityStorage(
17716
18548
  registration.matchIdentity,
17717
18549
  {
17718
18550
  fromKind,
@@ -17736,7 +18568,7 @@ async function validateAndPrepareEdgeCreate(ctx, input, id, backend, options) {
17736
18568
  backend
17737
18569
  };
17738
18570
  if (options?.validateCardinality ?? true) {
17739
- await chunkQR6V2BXA_cjs.checkCardinalityConstraint(
18571
+ await chunkPTFO3JI5_cjs.checkCardinalityConstraint(
17740
18572
  constraintContext,
17741
18573
  kind,
17742
18574
  cardinality,
@@ -17788,7 +18620,7 @@ function createdEdgeResult(edge) {
17788
18620
  return { outcome: "created", edge };
17789
18621
  }
17790
18622
  function foundEdgeResult(row) {
17791
- return { outcome: "found", edge: chunkQR6V2BXA_cjs.rowToEdge(row), row };
18623
+ return { outcome: "found", edge: chunkPTFO3JI5_cjs.rowToEdge(row), row };
17792
18624
  }
17793
18625
  function edgeCreateDidWrite(result) {
17794
18626
  return result.outcome === "created";
@@ -17831,9 +18663,9 @@ async function durableIdentityIdConflict(target, graphId, id, identity, kind) {
17831
18663
  }
17832
18664
  async function executeEdgeCreateInternal(ctx, input, backend, options) {
17833
18665
  const kind = input.kind;
17834
- const id = input.id ?? chunkIV5W7LKW_cjs.generateId();
18666
+ const id = input.id ?? chunkA22XPVBQ_cjs.generateId();
17835
18667
  const registration = getEdgeRegistration(ctx.graph, kind);
17836
- chunkC3CN2C2T_cjs.assertEdgeMatchIdentityBackendSupport(
18668
+ chunkQ6ZVQWH7_cjs.assertEdgeMatchIdentityBackendSupport(
17837
18669
  registration.matchIdentity,
17838
18670
  backend.capabilities,
17839
18671
  kind
@@ -17852,26 +18684,26 @@ async function executeEdgeCreateInternal(ctx, input, backend, options) {
17852
18684
  convergesDynamically: convergeOn !== void 0 && !durableConvergence,
17853
18685
  cardinality: edgeCardinality(ctx, kind)
17854
18686
  } : void 0;
17855
- const schemaFenceInFirstWrite = candidate !== void 0 && chunkQR6V2BXA_cjs.canFuseSchemaFenceInFirstWrite({ kind: "edge", candidate });
17856
- const autocommitSingleStatement = autocommitBackend !== void 0 && candidate !== void 0 && chunkQR6V2BXA_cjs.isAutocommitSingleStatementWrite({ kind: "edge", candidate });
17857
- const plan = chunkQR6V2BXA_cjs.edgeWritePlan(
17858
- convergeOn === void 0 || durableConvergence ? chunkQR6V2BXA_cjs.edgeWriteNeedsConstraintFence(edgeCardinality(ctx, kind)) : "edgeMatchKeyConvergence"
18687
+ const schemaFenceInFirstWrite = candidate !== void 0 && chunkPTFO3JI5_cjs.canFuseSchemaFenceInFirstWrite({ kind: "edge", candidate });
18688
+ const autocommitSingleStatement = autocommitBackend !== void 0 && candidate !== void 0 && chunkPTFO3JI5_cjs.isAutocommitSingleStatementWrite({ kind: "edge", candidate });
18689
+ const plan = chunkPTFO3JI5_cjs.edgeWritePlan(
18690
+ convergeOn === void 0 || durableConvergence ? chunkPTFO3JI5_cjs.edgeWriteNeedsConstraintFence(edgeCardinality(ctx, kind)) : "edgeMatchKeyConvergence"
17859
18691
  );
17860
18692
  const rowWork = async (session, target, _overlaidSession, lock, transactionMode) => {
17861
- const targetBackend = chunkQR6V2BXA_cjs.unfencedTarget(target);
17862
- const fuseSchemaFenceInFirstWrite = schemaFenceInFirstWrite && chunkEOLNL35G_cjs.isSchemaFencedInsertEligible(targetBackend) && !chunkIV5W7LKW_cjs.hasLeasedSchemaFence(ctx, targetBackend);
18693
+ const targetBackend = chunkPTFO3JI5_cjs.unfencedTarget(target);
18694
+ const fuseSchemaFenceInFirstWrite = schemaFenceInFirstWrite && chunkEOLNL35G_cjs.isSchemaFencedInsertEligible(targetBackend) && !chunkA22XPVBQ_cjs.hasLeasedSchemaFence(ctx, targetBackend);
17863
18695
  if (schemaFenceInFirstWrite && !fuseSchemaFenceInFirstWrite) {
17864
- await chunkIV5W7LKW_cjs.lockSchemaVersionForStoreWrite(ctx, targetBackend);
18696
+ await chunkA22XPVBQ_cjs.lockSchemaVersionForStoreWrite(ctx, targetBackend);
17865
18697
  }
17866
18698
  const diagnoseFusedCreateNoRow = async (validateCardinality) => {
17867
18699
  if (fuseSchemaFenceInFirstWrite) {
17868
- await chunkIV5W7LKW_cjs.diagnoseFusedSchemaFenceNoRow(ctx, targetBackend);
18700
+ await chunkA22XPVBQ_cjs.diagnoseFusedSchemaFenceNoRow(ctx, targetBackend);
17869
18701
  const directInteractiveAutocommit = autocommitSingleStatement && transactionMode === "none" && targetBackend.capabilities.execution.interactiveTransactions;
17870
18702
  if (directInteractiveAutocommit) {
17871
- throw new chunkQR6V2BXA_cjs.AutocommitWriteRequiresTransaction();
18703
+ throw new chunkPTFO3JI5_cjs.AutocommitWriteRequiresTransaction();
17872
18704
  }
17873
18705
  if (transactionMode !== "none") {
17874
- await chunkIV5W7LKW_cjs.lockSchemaVersionForStoreWrite(ctx, targetBackend);
18706
+ await chunkA22XPVBQ_cjs.lockSchemaVersionForStoreWrite(ctx, targetBackend);
17875
18707
  }
17876
18708
  const prepared2 = await validateAndPrepareEdgeCreate(
17877
18709
  ctx,
@@ -17881,7 +18713,7 @@ async function executeEdgeCreateInternal(ctx, input, backend, options) {
17881
18713
  { validateEndpoints: true, validateCardinality }
17882
18714
  );
17883
18715
  if (transactionMode === "none") {
17884
- await chunkIV5W7LKW_cjs.lockSchemaVersionForStoreWrite(ctx, targetBackend);
18716
+ await chunkA22XPVBQ_cjs.lockSchemaVersionForStoreWrite(ctx, targetBackend);
17885
18717
  }
17886
18718
  return prepared2;
17887
18719
  }
@@ -17935,7 +18767,7 @@ async function executeEdgeCreateInternal(ctx, input, backend, options) {
17935
18767
  match: durableMatchIdentity === void 0 ? { kind: "dynamic", ...chunkBXHAPCQG_cjs.requireDefined(convergeOn) } : { kind: "durable", identity: durableMatchIdentity }
17936
18768
  };
17937
18769
  const result = lock.coordination === void 0 && command.match.kind === "dynamic" ? {
17938
- outcome: "unsupported"} : await chunkQR6V2BXA_cjs.withAlreadyExistsTranslation(
18770
+ outcome: "unsupported"} : await chunkPTFO3JI5_cjs.withAlreadyExistsTranslation(
17939
18771
  "edge",
17940
18772
  () => chunkEOLNL35G_cjs.executeAuthoritativeGraphCommand(
17941
18773
  target.commands,
@@ -17947,7 +18779,7 @@ async function executeEdgeCreateInternal(ctx, input, backend, options) {
17947
18779
  if (durableMatchIdentity !== void 0 && work2.claim !== void 0) {
17948
18780
  await chunkGD7IWK36_cjs.claimEdgeCardinality(target, ctx.claimsVerdict(), work2.claim);
17949
18781
  }
17950
- return createdEdgeResult(chunkQR6V2BXA_cjs.rowToEdge(result.row));
18782
+ return createdEdgeResult(chunkPTFO3JI5_cjs.rowToEdge(result.row));
17951
18783
  }
17952
18784
  if (result.outcome === "found") {
17953
18785
  if (command.match.kind === "dynamic") {
@@ -18011,7 +18843,7 @@ async function executeEdgeCreateInternal(ctx, input, backend, options) {
18011
18843
  kind
18012
18844
  );
18013
18845
  if (identityConflict !== void 0) {
18014
- await chunkIV5W7LKW_cjs.diagnoseFusedSchemaFenceNoRow(ctx, targetBackend);
18846
+ await chunkA22XPVBQ_cjs.diagnoseFusedSchemaFenceNoRow(ctx, targetBackend);
18015
18847
  await validateAndPrepareEdgeCreate(ctx, input, id, target, {
18016
18848
  validateEndpoints: true,
18017
18849
  validateCardinality: false
@@ -18054,28 +18886,28 @@ async function executeEdgeCreateInternal(ctx, input, backend, options) {
18054
18886
  ...usesFusedCardinalityInsert && fusedWork.claim !== void 0 ? { cardinalityClaim: fusedWork.claim } : {}
18055
18887
  }
18056
18888
  };
18057
- const fusedResult = await chunkQR6V2BXA_cjs.withAlreadyExistsTranslation(
18889
+ const fusedResult = await chunkPTFO3JI5_cjs.withAlreadyExistsTranslation(
18058
18890
  "edge",
18059
18891
  () => session.createEdgeWithPlan(fusedCommand)
18060
18892
  );
18061
18893
  if (fusedResult.outcome === "created") {
18062
18894
  if (fuseSchemaFenceInFirstWrite) {
18063
- chunkIV5W7LKW_cjs.memoizeLeasedSchemaFence(ctx, targetBackend);
18895
+ chunkA22XPVBQ_cjs.memoizeLeasedSchemaFence(ctx, targetBackend);
18064
18896
  }
18065
- return createdEdgeResult(chunkQR6V2BXA_cjs.rowToEdge(fusedResult.row));
18897
+ return createdEdgeResult(chunkPTFO3JI5_cjs.rowToEdge(fusedResult.row));
18066
18898
  }
18067
18899
  prepared = await diagnoseFusedCreateNoRow(true);
18068
18900
  }
18069
18901
  const work = edgeInsertWork(prepared);
18070
- const row = await chunkQR6V2BXA_cjs.withAlreadyExistsTranslation("edge", async () => {
18902
+ const row = await chunkPTFO3JI5_cjs.withAlreadyExistsTranslation("edge", async () => {
18071
18903
  if (shouldReturnRow) return session.createEdge(work);
18072
18904
  await session.createEdgeNoReturn(work);
18073
18905
  return;
18074
18906
  });
18075
- return createdEdgeResult(row === void 0 ? void 0 : chunkQR6V2BXA_cjs.rowToEdge(row));
18907
+ return createdEdgeResult(row === void 0 ? void 0 : chunkPTFO3JI5_cjs.rowToEdge(row));
18076
18908
  };
18077
18909
  if (autocommitSingleStatement) {
18078
- return chunkQR6V2BXA_cjs.runAutocommitSingleStatementWritePlan(
18910
+ return chunkPTFO3JI5_cjs.runAutocommitSingleStatementWritePlan(
18079
18911
  ctx,
18080
18912
  opContext,
18081
18913
  plan,
@@ -18088,12 +18920,12 @@ async function executeEdgeCreateInternal(ctx, input, backend, options) {
18088
18920
  );
18089
18921
  }
18090
18922
  if (options?.skipHooks === true) {
18091
- return chunkQR6V2BXA_cjs.runWritePlan(ctx, plan, backend, rowWork, {
18923
+ return chunkPTFO3JI5_cjs.runWritePlan(ctx, plan, backend, rowWork, {
18092
18924
  schemaFenceInFirstWrite,
18093
18925
  didWrite: edgeCreateDidWrite
18094
18926
  });
18095
18927
  }
18096
- return chunkQR6V2BXA_cjs.runHookedWritePlan(ctx, opContext, plan, backend, rowWork, {
18928
+ return chunkPTFO3JI5_cjs.runHookedWritePlan(ctx, opContext, plan, backend, rowWork, {
18097
18929
  schemaFenceInFirstWrite,
18098
18930
  didWrite: edgeCreateDidWrite
18099
18931
  });
@@ -18143,11 +18975,11 @@ async function prepareEdgeBatchCreates(ctx, inputs, backend) {
18143
18975
  backend: validationBackend,
18144
18976
  registerPendingEdgeForCardinality,
18145
18977
  seedEndpointRow
18146
- } = chunkQR6V2BXA_cjs.createEdgeBatchValidationBackend(backend);
18978
+ } = chunkPTFO3JI5_cjs.createEdgeBatchValidationBackend(backend);
18147
18979
  await primeEdgeBatchValidationCache(ctx, inputs, backend, seedEndpointRow);
18148
18980
  const preparedCreates = [];
18149
18981
  for (const input of inputs) {
18150
- const id = input.id ?? chunkIV5W7LKW_cjs.generateId();
18982
+ const id = input.id ?? chunkA22XPVBQ_cjs.generateId();
18151
18983
  const prepared = await validateAndPrepareEdgeCreate(
18152
18984
  ctx,
18153
18985
  input,
@@ -18173,7 +19005,7 @@ async function prepareAtomicEdgeBatchCreates(ctx, inputs, backend) {
18173
19005
  const prepared = await validateAndPrepareEdgeCreate(
18174
19006
  ctx,
18175
19007
  input,
18176
- input.id ?? chunkIV5W7LKW_cjs.generateId(),
19008
+ input.id ?? chunkA22XPVBQ_cjs.generateId(),
18177
19009
  backend,
18178
19010
  { validateEndpoints: false, validateCardinality: false }
18179
19011
  );
@@ -18292,7 +19124,7 @@ async function assertAtomicEdgeBatchCardinality(ctx, inputs, backend) {
18292
19124
  const errors = await Promise.all(
18293
19125
  window.map(async (input) => {
18294
19126
  try {
18295
- await chunkQR6V2BXA_cjs.checkCardinalityConstraint(
19127
+ await chunkPTFO3JI5_cjs.checkCardinalityConstraint(
18296
19128
  constraintContext,
18297
19129
  input.kind,
18298
19130
  edgeCardinality(ctx, input.kind),
@@ -18321,7 +19153,7 @@ async function runAtomicEdgeBatchProgram(ctx, inputs, preparation, backend, atom
18321
19153
  graphId: ctx.graphId,
18322
19154
  expectedVersion: chunkBXHAPCQG_cjs.requireDefined(ctx.schemaVersion)
18323
19155
  };
18324
- const result = await chunkQR6V2BXA_cjs.withAlreadyExistsTranslation("edge", async () => {
19156
+ const result = await chunkPTFO3JI5_cjs.withAlreadyExistsTranslation("edge", async () => {
18325
19157
  try {
18326
19158
  if (resultMode === "count") {
18327
19159
  return await atomicExecutor({
@@ -18362,7 +19194,7 @@ async function runAtomicEdgeBatchProgram(ctx, inputs, preparation, backend, atom
18362
19194
  });
18363
19195
  const insertedCount = typeof result === "number" ? result : result.length;
18364
19196
  if (insertedCount === 0) {
18365
- await chunkIV5W7LKW_cjs.diagnoseFusedSchemaFenceNoRow(ctx, backend);
19197
+ await chunkA22XPVBQ_cjs.diagnoseFusedSchemaFenceNoRow(ctx, backend);
18366
19198
  await assertAtomicEdgeBatchEndpoints(ctx, inputs, backend);
18367
19199
  }
18368
19200
  if (insertedCount !== inputs.length) {
@@ -18375,11 +19207,11 @@ async function runAtomicEdgeBatchProgram(ctx, inputs, preparation, backend, atom
18375
19207
  }
18376
19208
  );
18377
19209
  }
18378
- chunkIV5W7LKW_cjs.memoizeLeasedSchemaFence(ctx, backend);
19210
+ chunkA22XPVBQ_cjs.memoizeLeasedSchemaFence(ctx, backend);
18379
19211
  return result;
18380
19212
  }
18381
19213
  function assertDurableBatchRows(work, rows) {
18382
- const outcomes = chunkQR6V2BXA_cjs.classifyDurableEdgeBatchOutcomes(
19214
+ const outcomes = chunkPTFO3JI5_cjs.classifyDurableEdgeBatchOutcomes(
18383
19215
  work.map((item) => item.params),
18384
19216
  rows
18385
19217
  );
@@ -18403,7 +19235,7 @@ async function executeEdgeCreateNoReturnBatch(ctx, inputs, backend) {
18403
19235
  if (inputs.length === 0) {
18404
19236
  return;
18405
19237
  }
18406
- const atomicExecutor = chunkQR6V2BXA_cjs.resolveAtomicEdgeBatchExecutor({
19238
+ const atomicExecutor = chunkPTFO3JI5_cjs.resolveAtomicEdgeBatchExecutor({
18407
19239
  backend,
18408
19240
  graph: ctx.graph,
18409
19241
  inputs,
@@ -18427,9 +19259,9 @@ async function executeEdgeCreateNoReturnBatch(ctx, inputs, backend) {
18427
19259
  );
18428
19260
  return;
18429
19261
  }
18430
- await chunkQR6V2BXA_cjs.runWritePlan(
19262
+ await chunkPTFO3JI5_cjs.runWritePlan(
18431
19263
  ctx,
18432
- chunkQR6V2BXA_cjs.edgeWritePlan(batchFencesConstraintProbe(ctx, inputs)),
19264
+ chunkPTFO3JI5_cjs.edgeWritePlan(batchFencesConstraintProbe(ctx, inputs)),
18433
19265
  backend,
18434
19266
  async (session, target) => {
18435
19267
  const { batchInsertWork } = await prepareEdgeBatchCreates(
@@ -18446,7 +19278,7 @@ async function executeEdgeCreateNoReturnBatch(ctx, inputs, backend) {
18446
19278
  await executeEdgeCreateInternal(
18447
19279
  ctx,
18448
19280
  input,
18449
- chunkQR6V2BXA_cjs.nestedManagedWriteTarget(target),
19281
+ chunkPTFO3JI5_cjs.nestedManagedWriteTarget(target),
18450
19282
  {
18451
19283
  returnRow: false,
18452
19284
  skipHooks: true
@@ -18455,14 +19287,14 @@ async function executeEdgeCreateNoReturnBatch(ctx, inputs, backend) {
18455
19287
  }
18456
19288
  return;
18457
19289
  }
18458
- const rows = await chunkQR6V2BXA_cjs.withAlreadyExistsTranslation(
19290
+ const rows = await chunkPTFO3JI5_cjs.withAlreadyExistsTranslation(
18459
19291
  "edge",
18460
19292
  () => chunkBXHAPCQG_cjs.requireDefined(session.createEdgesDurable)(batchInsertWork)
18461
19293
  );
18462
19294
  assertDurableBatchRows(batchInsertWork, rows);
18463
19295
  return;
18464
19296
  }
18465
- await chunkQR6V2BXA_cjs.withAlreadyExistsTranslation(
19297
+ await chunkPTFO3JI5_cjs.withAlreadyExistsTranslation(
18466
19298
  "edge",
18467
19299
  () => session.createEdgesNoReturn(batchInsertWork)
18468
19300
  );
@@ -18473,7 +19305,7 @@ async function executeEdgeCreateBatch(ctx, inputs, backend) {
18473
19305
  if (inputs.length === 0) {
18474
19306
  return [];
18475
19307
  }
18476
- const atomicExecutor = chunkQR6V2BXA_cjs.resolveAtomicEdgeBatchExecutor({
19308
+ const atomicExecutor = chunkPTFO3JI5_cjs.resolveAtomicEdgeBatchExecutor({
18477
19309
  backend,
18478
19310
  graph: ctx.graph,
18479
19311
  inputs,
@@ -18495,11 +19327,11 @@ async function executeEdgeCreateBatch(ctx, inputs, backend) {
18495
19327
  atomicExecutor,
18496
19328
  "rows"
18497
19329
  );
18498
- return rows.map((row) => chunkQR6V2BXA_cjs.rowToEdge(row));
19330
+ return rows.map((row) => chunkPTFO3JI5_cjs.rowToEdge(row));
18499
19331
  }
18500
- return chunkQR6V2BXA_cjs.runWritePlan(
19332
+ return chunkPTFO3JI5_cjs.runWritePlan(
18501
19333
  ctx,
18502
- chunkQR6V2BXA_cjs.edgeWritePlan(batchFencesConstraintProbe(ctx, inputs)),
19334
+ chunkPTFO3JI5_cjs.edgeWritePlan(batchFencesConstraintProbe(ctx, inputs)),
18503
19335
  backend,
18504
19336
  async (session, target) => {
18505
19337
  const { batchInsertWork } = await prepareEdgeBatchCreates(
@@ -18517,7 +19349,7 @@ async function executeEdgeCreateBatch(ctx, inputs, backend) {
18517
19349
  const result = await executeEdgeCreateInternal(
18518
19350
  ctx,
18519
19351
  input,
18520
- chunkQR6V2BXA_cjs.nestedManagedWriteTarget(target),
19352
+ chunkPTFO3JI5_cjs.nestedManagedWriteTarget(target),
18521
19353
  { returnRow: true, skipHooks: true }
18522
19354
  );
18523
19355
  if (result.outcome !== "created") {
@@ -18536,24 +19368,24 @@ async function executeEdgeCreateBatch(ctx, inputs, backend) {
18536
19368
  }
18537
19369
  return fallbackRows;
18538
19370
  }
18539
- const rows2 = await chunkQR6V2BXA_cjs.withAlreadyExistsTranslation(
19371
+ const rows2 = await chunkPTFO3JI5_cjs.withAlreadyExistsTranslation(
18540
19372
  "edge",
18541
19373
  () => chunkBXHAPCQG_cjs.requireDefined(session.createEdgesDurable)(batchInsertWork)
18542
19374
  );
18543
19375
  assertDurableBatchRows(batchInsertWork, rows2);
18544
- return rows2.map((row) => chunkQR6V2BXA_cjs.rowToEdge(row));
19376
+ return rows2.map((row) => chunkPTFO3JI5_cjs.rowToEdge(row));
18545
19377
  }
18546
- const rows = await chunkQR6V2BXA_cjs.withAlreadyExistsTranslation(
19378
+ const rows = await chunkPTFO3JI5_cjs.withAlreadyExistsTranslation(
18547
19379
  "edge",
18548
19380
  () => session.createEdges(batchInsertWork)
18549
19381
  );
18550
- return rows.map((row) => chunkQR6V2BXA_cjs.rowToEdge(row));
19382
+ return rows.map((row) => chunkPTFO3JI5_cjs.rowToEdge(row));
18551
19383
  }
18552
19384
  );
18553
19385
  }
18554
19386
  function batchFencesConstraintProbe(ctx, inputs) {
18555
19387
  for (const input of inputs) {
18556
- const reason = chunkQR6V2BXA_cjs.edgeWriteNeedsConstraintFence(
19388
+ const reason = chunkPTFO3JI5_cjs.edgeWriteNeedsConstraintFence(
18557
19389
  edgeCardinality(ctx, input.kind)
18558
19390
  );
18559
19391
  if (reason !== void 0) return reason;
@@ -18562,12 +19394,12 @@ function batchFencesConstraintProbe(ctx, inputs) {
18562
19394
  }
18563
19395
  function computeEdgeUpdate(ctx, kind, id, existingProps, inputProps) {
18564
19396
  const registration = getEdgeRegistration(ctx.graph, kind);
18565
- const validatedProps = chunkIV5W7LKW_cjs.validateEdgeProps(
19397
+ const validatedProps = chunkA22XPVBQ_cjs.validateEdgeProps(
18566
19398
  registration.type.schema,
18567
19399
  { ...existingProps, ...inputProps },
18568
19400
  { kind, operation: "update", id }
18569
19401
  );
18570
- const identityRefusal = chunkQR6V2BXA_cjs.edgeMatchIdentityUpdateRefusal({
19402
+ const identityRefusal = chunkPTFO3JI5_cjs.edgeMatchIdentityUpdateRefusal({
18571
19403
  identity: registration.matchIdentity,
18572
19404
  kind,
18573
19405
  id,
@@ -18603,7 +19435,7 @@ function edgeUpsertDirtyCheck(ctx, kind, id, existingProps, inputProps) {
18603
19435
  }
18604
19436
  async function performEdgeUpdate(ctx, input, session, target, options, resolvedExisting) {
18605
19437
  const id = input.id;
18606
- chunkQR6V2BXA_cjs.assertValidityEndMutation(input, {
19438
+ chunkPTFO3JI5_cjs.assertValidityEndMutation(input, {
18607
19439
  entityType: "edge",
18608
19440
  kind: input.identity.kind,
18609
19441
  id
@@ -18629,7 +19461,7 @@ async function performEdgeUpdate(ctx, input, session, target, options, resolvedE
18629
19461
  const preservesLiveLowerBound = options?.clearDeleted !== true && chunkNWJV4UVW_cjs.preservesImmutableLowerBound(input.onImmutableLowerBound);
18630
19462
  const appliedValidFrom = preservesLiveLowerBound ? void 0 : statedValidFrom;
18631
19463
  const validTo = chunkNWJV4UVW_cjs.validateOptionalCanonicalIsoDate(input.validTo, "validTo");
18632
- const effectiveValidTo = options?.clearDeleted === true && appliedValidFrom !== void 0 ? validTo : chunkQR6V2BXA_cjs.validityEndAfterMutation(
19464
+ const effectiveValidTo = options?.clearDeleted === true && appliedValidFrom !== void 0 ? validTo : chunkPTFO3JI5_cjs.validityEndAfterMutation(
18633
19465
  input.clearValidTo === true ? { clearValidTo: true } : validTo === void 0 ? {} : { validTo },
18634
19466
  existing.valid_to
18635
19467
  );
@@ -18638,7 +19470,7 @@ async function performEdgeUpdate(ctx, input, session, target, options, resolvedE
18638
19470
  let reentryClaim;
18639
19471
  const reentersActivePopulation = cardinality === "oneActive" && effectiveValidTo === void 0 && (existing.deleted_at !== void 0 || existing.valid_to !== void 0);
18640
19472
  if (reentersLivePopulation || reentersActivePopulation) {
18641
- await chunkQR6V2BXA_cjs.checkCardinalityConstraint(
19473
+ await chunkPTFO3JI5_cjs.checkCardinalityConstraint(
18642
19474
  {
18643
19475
  graphId: ctx.graphId,
18644
19476
  registry: ctx.registry,
@@ -18699,10 +19531,10 @@ async function performEdgeUpdate(ctx, input, session, target, options, resolvedE
18699
19531
  // "Did this write assert any window state?" is one predicate with one
18700
19532
  // owner, consulted here and by the fence appliers that carry it, rather
18701
19533
  // than re-derived from the params the diagnosis never sees.
18702
- chunkQR6V2BXA_cjs.assertsStoredWindowState(fences),
19534
+ chunkPTFO3JI5_cjs.assertsStoredWindowState(fences),
18703
19535
  () => session.reviseEdge(work, fences)
18704
19536
  );
18705
- return chunkQR6V2BXA_cjs.rowToEdge(row);
19537
+ return chunkPTFO3JI5_cjs.rowToEdge(row);
18706
19538
  }
18707
19539
  var EDGE_UPDATE_ATTEMPTS = 2;
18708
19540
  async function performEdgeUpdateConverging(ctx, input, session, target, options, resolvedExisting) {
@@ -18738,7 +19570,7 @@ function resolveAtomicEdgeUpdateExecutor(ctx, entries, backend) {
18738
19570
  )) {
18739
19571
  return;
18740
19572
  }
18741
- return chunkQR6V2BXA_cjs.resolveAtomicEdgeResolvedUpdateBatchExecutor({
19573
+ return chunkPTFO3JI5_cjs.resolveAtomicEdgeResolvedUpdateBatchExecutor({
18742
19574
  backend,
18743
19575
  graph: ctx.graph,
18744
19576
  schemaVersion: ctx.schemaVersion,
@@ -18762,7 +19594,7 @@ async function executeEdgeUpdate(ctx, input, backend) {
18762
19594
  );
18763
19595
  const opContext = ctx.createOperationContext("update", "edge", gate.kind, id);
18764
19596
  if (input.clearValidTo === true) {
18765
- chunkQR6V2BXA_cjs.assertClearValidToSupported(backend, "edge");
19597
+ chunkPTFO3JI5_cjs.assertClearValidToSupported(backend, "edge");
18766
19598
  }
18767
19599
  const atomicEntry = {
18768
19600
  input,
@@ -18775,7 +19607,7 @@ async function executeEdgeUpdate(ctx, input, backend) {
18775
19607
  backend
18776
19608
  );
18777
19609
  if (atomicExecutor !== void 0) {
18778
- return chunkQR6V2BXA_cjs.runAtomicProgramWithHooks(
19610
+ return chunkPTFO3JI5_cjs.runAtomicProgramWithHooks(
18779
19611
  ctx,
18780
19612
  opContext,
18781
19613
  async () => {
@@ -18787,36 +19619,36 @@ async function executeEdgeUpdate(ctx, input, backend) {
18787
19619
  );
18788
19620
  return chunkBXHAPCQG_cjs.requireDefined(edges[0]);
18789
19621
  },
18790
- chunkQR6V2BXA_cjs.writeResultAlwaysChanges
19622
+ chunkPTFO3JI5_cjs.writeResultAlwaysChanges
18791
19623
  );
18792
19624
  }
18793
- return chunkQR6V2BXA_cjs.runHookedWritePlan(
19625
+ return chunkPTFO3JI5_cjs.runHookedWritePlan(
18794
19626
  ctx,
18795
19627
  opContext,
18796
19628
  // An in-place props update on a live edge re-derives no constraint verdict.
18797
19629
  // Clearing an `oneActive` edge's end DOES: it re-admits the row to the
18798
19630
  // counted active population.
18799
- chunkQR6V2BXA_cjs.edgeWritePlan(
18800
- input.clearValidTo === true && edgeCardinality(ctx, gate.kind) === "oneActive" ? chunkQR6V2BXA_cjs.edgeWriteNeedsConstraintFence("oneActive") : void 0
19631
+ chunkPTFO3JI5_cjs.edgeWritePlan(
19632
+ input.clearValidTo === true && edgeCardinality(ctx, gate.kind) === "oneActive" ? chunkPTFO3JI5_cjs.edgeWriteNeedsConstraintFence("oneActive") : void 0
18801
19633
  ),
18802
19634
  backend,
18803
19635
  (session, target) => performEdgeUpdateConverging(ctx, input, session, target),
18804
- { didWrite: chunkQR6V2BXA_cjs.writeResultAlwaysChanges }
19636
+ { didWrite: chunkPTFO3JI5_cjs.writeResultAlwaysChanges }
18805
19637
  );
18806
19638
  }
18807
19639
  async function executeEdgeUpsertUpdateWithOutcome(ctx, input, backend, options) {
18808
19640
  if (input.clearValidTo === true) {
18809
- chunkQR6V2BXA_cjs.assertClearValidToSupported(backend, "edge");
19641
+ chunkPTFO3JI5_cjs.assertClearValidToSupported(backend, "edge");
18810
19642
  }
18811
- return chunkQR6V2BXA_cjs.runWritePlan(
19643
+ return chunkPTFO3JI5_cjs.runWritePlan(
18812
19644
  ctx,
18813
19645
  // An in-place props update re-derives no constraint verdict: endpoints
18814
19646
  // are immutable, so cardinality cannot change under it. A coalescing upsert
18815
19647
  // converges on a match key no database key backs; a resurrect or a cleared
18816
19648
  // end re-admits the row to the counted population its cardinality
18817
19649
  // constrains.
18818
- chunkQR6V2BXA_cjs.edgeWritePlan(
18819
- options?.coalesceUnchanged === true ? "edgeMatchKeyConvergence" : input.clearValidTo === true || options?.clearDeleted === true ? chunkQR6V2BXA_cjs.edgeWriteNeedsConstraintFence(edgeCardinality(ctx, input.identity.kind)) : void 0
19650
+ chunkPTFO3JI5_cjs.edgeWritePlan(
19651
+ options?.coalesceUnchanged === true ? "edgeMatchKeyConvergence" : input.clearValidTo === true || options?.clearDeleted === true ? chunkPTFO3JI5_cjs.edgeWriteNeedsConstraintFence(edgeCardinality(ctx, input.identity.kind)) : void 0
18820
19652
  ),
18821
19653
  backend,
18822
19654
  async (session, target) => {
@@ -18840,7 +19672,7 @@ async function executeEdgeUpsertUpdateWithOutcome(ctx, input, backend, options)
18840
19672
  input.props
18841
19673
  );
18842
19674
  if (shouldCoalesceUpsert(existing, input, runDirtyCheck)) {
18843
- return { edge: chunkQR6V2BXA_cjs.rowToEdge(existing), wrote: false };
19675
+ return { edge: chunkPTFO3JI5_cjs.rowToEdge(existing), wrote: false };
18844
19676
  }
18845
19677
  }
18846
19678
  }
@@ -18869,10 +19701,10 @@ async function executeEdgeUpsertUpdate(ctx, input, backend, options) {
18869
19701
  }
18870
19702
  async function executeEdgeResolvedMutationSet(ctx, creates, updates, backend) {
18871
19703
  if (creates.length === 0 || updates.length === 0) {
18872
- return chunkQR6V2BXA_cjs.unsupportedResolvedMutationSet();
19704
+ return chunkPTFO3JI5_cjs.unsupportedResolvedMutationSet();
18873
19705
  }
18874
19706
  const firstUpdate = chunkBXHAPCQG_cjs.requireDefined(updates[0]);
18875
- const executor = chunkQR6V2BXA_cjs.resolveAtomicEdgeResolvedMutationSetExecutor({
19707
+ const executor = chunkPTFO3JI5_cjs.resolveAtomicEdgeResolvedMutationSetExecutor({
18876
19708
  backend,
18877
19709
  graph: ctx.graph,
18878
19710
  schemaVersion: ctx.schemaVersion,
@@ -18882,18 +19714,18 @@ async function executeEdgeResolvedMutationSet(ctx, creates, updates, backend) {
18882
19714
  creates,
18883
19715
  updateCount: updates.length
18884
19716
  });
18885
- if (executor === void 0) return chunkQR6V2BXA_cjs.unsupportedResolvedMutationSet();
19717
+ if (executor === void 0) return chunkPTFO3JI5_cjs.unsupportedResolvedMutationSet();
18886
19718
  const ids = /* @__PURE__ */ new Set([
18887
19719
  ...creates.map((input) => chunkBXHAPCQG_cjs.requireDefined(input.id)),
18888
19720
  ...updates.map((entry2) => entry2.input.id)
18889
19721
  ]);
18890
19722
  if (ids.size !== creates.length + updates.length) {
18891
- return chunkQR6V2BXA_cjs.unsupportedResolvedMutationSet();
19723
+ return chunkPTFO3JI5_cjs.unsupportedResolvedMutationSet();
18892
19724
  }
18893
19725
  if (updates.some(
18894
19726
  (entry2) => entry2.clearDeleted || entry2.existing === void 0 || entry2.input.validFrom !== void 0 || entry2.input.validTo !== void 0 || entry2.input.clearValidTo === true
18895
19727
  )) {
18896
- return chunkQR6V2BXA_cjs.unsupportedResolvedMutationSet();
19728
+ return chunkPTFO3JI5_cjs.unsupportedResolvedMutationSet();
18897
19729
  }
18898
19730
  const preparation = await prepareAtomicEdgeBatchCreates(
18899
19731
  ctx,
@@ -18923,7 +19755,7 @@ async function executeEdgeResolvedMutationSet(ctx, creates, updates, backend) {
18923
19755
  );
18924
19756
  return { existing, props: validatedProps };
18925
19757
  });
18926
- const result = await chunkQR6V2BXA_cjs.withAlreadyExistsTranslation("edge", async () => {
19758
+ const result = await chunkPTFO3JI5_cjs.withAlreadyExistsTranslation("edge", async () => {
18927
19759
  try {
18928
19760
  return await executor({
18929
19761
  kind: "resolved-set",
@@ -18947,23 +19779,23 @@ async function executeEdgeResolvedMutationSet(ctx, creates, updates, backend) {
18947
19779
  }
18948
19780
  });
18949
19781
  if (result.created.length === 0 && result.updated.length === 0) {
18950
- await chunkIV5W7LKW_cjs.diagnoseFusedSchemaFenceNoRow(ctx, backend);
18951
- throw new chunkQR6V2BXA_cjs.ResolvedMutationSetMoved("edge", executor);
19782
+ await chunkA22XPVBQ_cjs.diagnoseFusedSchemaFenceNoRow(ctx, backend);
19783
+ throw new chunkPTFO3JI5_cjs.ResolvedMutationSetMoved("edge", executor);
18952
19784
  }
18953
19785
  if (result.created.length !== creates.length || result.updated.length !== updates.length) {
18954
19786
  throw new chunkG7W67PZO_cjs.CompilerInvariantError(
18955
19787
  "Atomic resolved edge mutation set returned a partial result."
18956
19788
  );
18957
19789
  }
18958
- chunkIV5W7LKW_cjs.memoizeLeasedSchemaFence(ctx, backend);
19790
+ chunkA22XPVBQ_cjs.memoizeLeasedSchemaFence(ctx, backend);
18959
19791
  const createdById = new Map(result.created.map((row) => [row.id, row]));
18960
19792
  const updatedById = new Map(result.updated.map((row) => [row.id, row]));
18961
- return chunkQR6V2BXA_cjs.appliedResolvedMutationSet({
19793
+ return chunkPTFO3JI5_cjs.appliedResolvedMutationSet({
18962
19794
  created: creates.map(
18963
- (input) => chunkQR6V2BXA_cjs.rowToEdge(chunkBXHAPCQG_cjs.requireDefined(createdById.get(chunkBXHAPCQG_cjs.requireDefined(input.id))))
19795
+ (input) => chunkPTFO3JI5_cjs.rowToEdge(chunkBXHAPCQG_cjs.requireDefined(createdById.get(chunkBXHAPCQG_cjs.requireDefined(input.id))))
18964
19796
  ),
18965
19797
  updated: updates.map(
18966
- (entry2) => chunkQR6V2BXA_cjs.rowToEdge(chunkBXHAPCQG_cjs.requireDefined(updatedById.get(entry2.input.id)))
19798
+ (entry2) => chunkPTFO3JI5_cjs.rowToEdge(chunkBXHAPCQG_cjs.requireDefined(updatedById.get(entry2.input.id)))
18967
19799
  )
18968
19800
  });
18969
19801
  }
@@ -18971,7 +19803,7 @@ async function executeEdgeUpsertUpdateBatch(ctx, entries, backend) {
18971
19803
  if (entries.length === 0) return [];
18972
19804
  for (const entry2 of entries) {
18973
19805
  if (entry2.input.clearValidTo === true) {
18974
- chunkQR6V2BXA_cjs.assertClearValidToSupported(backend, "edge");
19806
+ chunkPTFO3JI5_cjs.assertClearValidToSupported(backend, "edge");
18975
19807
  }
18976
19808
  }
18977
19809
  const first = chunkBXHAPCQG_cjs.requireDefined(entries[0]);
@@ -18988,16 +19820,16 @@ async function executeEdgeUpsertUpdateBatch(ctx, entries, backend) {
18988
19820
  const needsConstraintFence = entries.some(
18989
19821
  (entry2) => entry2.clearDeleted || entry2.input.clearValidTo === true
18990
19822
  );
18991
- return chunkQR6V2BXA_cjs.runWritePlan(
19823
+ return chunkPTFO3JI5_cjs.runWritePlan(
18992
19824
  ctx,
18993
- chunkQR6V2BXA_cjs.edgeWritePlan(
18994
- needsConstraintFence ? chunkQR6V2BXA_cjs.edgeWriteNeedsConstraintFence(
19825
+ chunkPTFO3JI5_cjs.edgeWritePlan(
19826
+ needsConstraintFence ? chunkPTFO3JI5_cjs.edgeWriteNeedsConstraintFence(
18995
19827
  edgeCardinality(ctx, first.input.identity.kind)
18996
19828
  ) : void 0
18997
19829
  ),
18998
19830
  backend,
18999
19831
  async (session, target) => {
19000
- const resolvedRows = target.capabilities.execution.interactiveTransactions && distinctIds.size === entries.length ? await chunkIV5W7LKW_cjs.getEdgeRowsByIds(target, ctx.batchPointRead, ctx.graphId, [
19832
+ const resolvedRows = target.capabilities.execution.interactiveTransactions && distinctIds.size === entries.length ? await chunkA22XPVBQ_cjs.getEdgeRowsByIds(target, ctx.batchPointRead, ctx.graphId, [
19001
19833
  ...distinctIds
19002
19834
  ]) : void 0;
19003
19835
  const edges = [];
@@ -19015,11 +19847,11 @@ async function executeEdgeUpsertUpdateBatch(ctx, entries, backend) {
19015
19847
  }
19016
19848
  return edges;
19017
19849
  },
19018
- { didWrite: chunkQR6V2BXA_cjs.writeResultAlwaysChanges }
19850
+ { didWrite: chunkPTFO3JI5_cjs.writeResultAlwaysChanges }
19019
19851
  );
19020
19852
  }
19021
19853
  async function executeAtomicEdgeResolvedUpdates(ctx, entries, backend, atomicExecutor) {
19022
- const maxAttempts = chunkQR6V2BXA_cjs.atomicResolvedUpdateAttemptBudget(
19854
+ const maxAttempts = chunkPTFO3JI5_cjs.atomicResolvedUpdateAttemptBudget(
19023
19855
  entries.length,
19024
19856
  EDGE_UPDATE_ATTEMPTS
19025
19857
  );
@@ -19028,7 +19860,7 @@ async function executeAtomicEdgeResolvedUpdates(ctx, entries, backend, atomicExe
19028
19860
  const supplied = entries.flatMap(
19029
19861
  (entry2) => entry2.existing === void 0 ? [] : [entry2.existing]
19030
19862
  );
19031
- const fetched = supplied.length === entries.length ? void 0 : await chunkIV5W7LKW_cjs.getEdgeRowsByIds(backend, ctx.batchPointRead, ctx.graphId, [
19863
+ const fetched = supplied.length === entries.length ? void 0 : await chunkA22XPVBQ_cjs.getEdgeRowsByIds(backend, ctx.batchPointRead, ctx.graphId, [
19032
19864
  ...distinctIds
19033
19865
  ]);
19034
19866
  let existing = fetched === void 0 ? supplied : [...fetched.values()];
@@ -19064,10 +19896,10 @@ async function executeAtomicEdgeResolvedUpdates(ctx, entries, backend, atomicExe
19064
19896
  }
19065
19897
  });
19066
19898
  if (rows.length === entries.length) {
19067
- chunkIV5W7LKW_cjs.memoizeLeasedSchemaFence(ctx, backend);
19899
+ chunkA22XPVBQ_cjs.memoizeLeasedSchemaFence(ctx, backend);
19068
19900
  const returned = new Map(rows.map((row) => [row.id, row]));
19069
19901
  return entries.map(
19070
- (entry2) => chunkQR6V2BXA_cjs.rowToEdge(chunkBXHAPCQG_cjs.requireDefined(returned.get(entry2.input.id)))
19902
+ (entry2) => chunkPTFO3JI5_cjs.rowToEdge(chunkBXHAPCQG_cjs.requireDefined(returned.get(entry2.input.id)))
19071
19903
  );
19072
19904
  }
19073
19905
  if (rows.length > 0) {
@@ -19076,7 +19908,7 @@ async function executeAtomicEdgeResolvedUpdates(ctx, entries, backend, atomicExe
19076
19908
  { expected: entries.length, actual: rows.length }
19077
19909
  );
19078
19910
  }
19079
- await chunkIV5W7LKW_cjs.diagnoseFusedSchemaFenceNoRow(ctx, backend);
19911
+ await chunkA22XPVBQ_cjs.diagnoseFusedSchemaFenceNoRow(ctx, backend);
19080
19912
  if (attempt === maxAttempts) {
19081
19913
  throw new chunkG7W67PZO_cjs.DatabaseOperationError(
19082
19914
  `Atomic edge update could not be applied to stable rows after ${maxAttempts} attempts.`,
@@ -19090,7 +19922,7 @@ async function executeAtomicEdgeResolvedUpdates(ctx, entries, backend, atomicExe
19090
19922
  }
19091
19923
  );
19092
19924
  }
19093
- const refreshed = await chunkIV5W7LKW_cjs.getEdgeRowsByIds(
19925
+ const refreshed = await chunkA22XPVBQ_cjs.getEdgeRowsByIds(
19094
19926
  backend,
19095
19927
  ctx.batchPointRead,
19096
19928
  ctx.graphId,
@@ -19113,7 +19945,7 @@ async function executeEdgeDelete(ctx, expectedKind, id, backend) {
19113
19945
  );
19114
19946
  if (gate.deleted_at) return;
19115
19947
  const opContext = ctx.createOperationContext("delete", "edge", gate.kind, id);
19116
- const atomicExecutor = chunkQR6V2BXA_cjs.resolveAtomicEdgeDeleteBatchExecutor({
19948
+ const atomicExecutor = chunkPTFO3JI5_cjs.resolveAtomicEdgeDeleteBatchExecutor({
19117
19949
  backend,
19118
19950
  graph: ctx.graph,
19119
19951
  expectedKind,
@@ -19123,7 +19955,7 @@ async function executeEdgeDelete(ctx, expectedKind, id, backend) {
19123
19955
  revisionTrackingEnabled: ctx.revisionTrackingEnabled
19124
19956
  });
19125
19957
  if (atomicExecutor !== void 0) {
19126
- await chunkQR6V2BXA_cjs.runAtomicProgramWithHooks(
19958
+ await chunkPTFO3JI5_cjs.runAtomicProgramWithHooks(
19127
19959
  ctx,
19128
19960
  opContext,
19129
19961
  () => executeAtomicEdgeDeletes(
@@ -19137,11 +19969,11 @@ async function executeEdgeDelete(ctx, expectedKind, id, backend) {
19137
19969
  );
19138
19970
  return;
19139
19971
  }
19140
- return chunkQR6V2BXA_cjs.runHookedWritePlan(
19972
+ return chunkPTFO3JI5_cjs.runHookedWritePlan(
19141
19973
  ctx,
19142
19974
  opContext,
19143
19975
  // A soft delete decides nothing a concurrent write could invalidate.
19144
- chunkQR6V2BXA_cjs.edgeWritePlan(void 0),
19976
+ chunkPTFO3JI5_cjs.edgeWritePlan(void 0),
19145
19977
  backend,
19146
19978
  async (session) => {
19147
19979
  await session.retireEdge({ id, kind: expectedKind });
@@ -19149,7 +19981,7 @@ async function executeEdgeDelete(ctx, expectedKind, id, backend) {
19149
19981
  );
19150
19982
  }
19151
19983
  async function executeEdgeDeleteBatch(ctx, expectedKind, ids, backend) {
19152
- const atomicExecutor = chunkQR6V2BXA_cjs.resolveAtomicEdgeDeleteBatchExecutor({
19984
+ const atomicExecutor = chunkPTFO3JI5_cjs.resolveAtomicEdgeDeleteBatchExecutor({
19153
19985
  backend,
19154
19986
  graph: ctx.graph,
19155
19987
  expectedKind,
@@ -19168,12 +20000,12 @@ async function executeEdgeDeleteBatch(ctx, expectedKind, ids, backend) {
19168
20000
  );
19169
20001
  return;
19170
20002
  }
19171
- await chunkQR6V2BXA_cjs.runWritePlan(
20003
+ await chunkPTFO3JI5_cjs.runWritePlan(
19172
20004
  ctx,
19173
- chunkQR6V2BXA_cjs.edgeWritePlan(void 0),
20005
+ chunkPTFO3JI5_cjs.edgeWritePlan(void 0),
19174
20006
  backend,
19175
20007
  async (session, target) => {
19176
- const rowsById = await chunkIV5W7LKW_cjs.getEdgeRowsByIds(
20008
+ const rowsById = await chunkA22XPVBQ_cjs.getEdgeRowsByIds(
19177
20009
  target,
19178
20010
  ctx.batchPointRead,
19179
20011
  ctx.graphId,
@@ -19212,7 +20044,7 @@ async function executeAtomicEdgeDeletes(ctx, expectedKind, ids, backend, atomicE
19212
20044
  expectedVersion: chunkBXHAPCQG_cjs.requireDefined(ctx.schemaVersion)
19213
20045
  }
19214
20046
  });
19215
- await chunkQR6V2BXA_cjs.assertAtomicDeleteSchemaFenceMatched(
20047
+ await chunkPTFO3JI5_cjs.assertAtomicDeleteSchemaFenceMatched(
19216
20048
  result.schemaFenceMatched,
19217
20049
  ctx,
19218
20050
  backend,
@@ -19221,7 +20053,7 @@ async function executeAtomicEdgeDeletes(ctx, expectedKind, ids, backend, atomicE
19221
20053
  return result.affectedCount;
19222
20054
  } catch (error) {
19223
20055
  if (!(error instanceof chunkXUCVGEJT_cjs.AtomicEdgeDeleteIdentityRefusalError)) throw error;
19224
- const rowsById = await chunkIV5W7LKW_cjs.getEdgeRowsByIds(
20056
+ const rowsById = await chunkA22XPVBQ_cjs.getEdgeRowsByIds(
19225
20057
  backend,
19226
20058
  ctx.batchPointRead,
19227
20059
  ctx.graphId,
@@ -19254,10 +20086,10 @@ async function executeEdgeHardDelete(ctx, expectedKind, id, backend) {
19254
20086
  "hardDelete"
19255
20087
  );
19256
20088
  const opContext = ctx.createOperationContext("delete", "edge", gate.kind, id);
19257
- return chunkQR6V2BXA_cjs.runHookedWritePlan(
20089
+ return chunkPTFO3JI5_cjs.runHookedWritePlan(
19258
20090
  ctx,
19259
20091
  opContext,
19260
- chunkQR6V2BXA_cjs.edgeWritePlan(void 0),
20092
+ chunkPTFO3JI5_cjs.edgeWritePlan(void 0),
19261
20093
  backend,
19262
20094
  async (session) => {
19263
20095
  await session.purgeEdge({
@@ -19326,7 +20158,7 @@ function findMatchingEdge(rows, matchOn, inputProps) {
19326
20158
  if (matchOn.length > 0) {
19327
20159
  const rowProps = chunkEOLNL35G_cjs.rowPropsToObject(row.props);
19328
20160
  const matches = matchOn.every(
19329
- (field2) => chunkQR6V2BXA_cjs.canonicalPersistedJsonValue(chunkBXHAPCQG_cjs.readOwnProperty(rowProps, field2)) === chunkQR6V2BXA_cjs.canonicalPersistedJsonValue(chunkBXHAPCQG_cjs.readOwnProperty(inputProps, field2))
20161
+ (field2) => chunkPTFO3JI5_cjs.canonicalPersistedJsonValue(chunkBXHAPCQG_cjs.readOwnProperty(rowProps, field2)) === chunkPTFO3JI5_cjs.canonicalPersistedJsonValue(chunkBXHAPCQG_cjs.readOwnProperty(inputProps, field2))
19330
20162
  );
19331
20163
  if (!matches) continue;
19332
20164
  }
@@ -19347,7 +20179,7 @@ function assertEdgeMatchKey(row, matchOn, matchProps) {
19347
20179
  }
19348
20180
  async function executeEdgeFindByEndpoints(ctx, kind, fromKind, fromId, toKind, toId, backend, options) {
19349
20181
  const matchOn = options?.matchOn ?? [];
19350
- const matchProps = chunkQR6V2BXA_cjs.normalizePersistedEdgeMatchProps(options?.props ?? {});
20182
+ const matchProps = chunkPTFO3JI5_cjs.normalizePersistedEdgeMatchProps(options?.props ?? {});
19351
20183
  const registration = getEdgeRegistration(ctx.graph, kind);
19352
20184
  const edgeKind = registration.type;
19353
20185
  if (matchOn.length > 0) {
@@ -19367,9 +20199,9 @@ async function executeEdgeFindByEndpoints(ctx, kind, fromKind, fromId, toKind, t
19367
20199
  ...options?.asOf !== void 0 && { asOf: options.asOf }
19368
20200
  });
19369
20201
  if (candidateRows.length === 0) return void 0;
19370
- if (matchOn.length === 0) return chunkQR6V2BXA_cjs.rowToEdge(chunkBXHAPCQG_cjs.requireDefined(candidateRows[0]));
20202
+ if (matchOn.length === 0) return chunkPTFO3JI5_cjs.rowToEdge(chunkBXHAPCQG_cjs.requireDefined(candidateRows[0]));
19371
20203
  const { liveRow } = findMatchingEdge(candidateRows, matchOn, matchProps);
19372
- return liveRow === void 0 ? void 0 : chunkQR6V2BXA_cjs.rowToEdge(liveRow);
20204
+ return liveRow === void 0 ? void 0 : chunkPTFO3JI5_cjs.rowToEdge(liveRow);
19373
20205
  }
19374
20206
  function defersEndpointWindowOrdering(ifExists, onImmutableLowerBound) {
19375
20207
  return ifExists === "update" && chunkNWJV4UVW_cjs.preservesImmutableLowerBound(onImmutableLowerBound);
@@ -19394,15 +20226,15 @@ async function executeEdgeGetOrCreateByEndpoints(ctx, kind, fromKind, fromId, to
19394
20226
  registration.matchIdentity?.fields,
19395
20227
  options?.matchOn
19396
20228
  );
19397
- chunkQR6V2BXA_cjs.assertValidityEndMutation(options ?? {}, { entityType: "edge", kind });
20229
+ chunkPTFO3JI5_cjs.assertValidityEndMutation(options ?? {}, { entityType: "edge", kind });
19398
20230
  if (options?.clearValidTo === true) {
19399
- chunkQR6V2BXA_cjs.assertClearValidToSupported(backend, "edge");
20231
+ chunkPTFO3JI5_cjs.assertClearValidToSupported(backend, "edge");
19400
20232
  }
19401
- const validatedProps = chunkIV5W7LKW_cjs.validateEdgeProps(edgeKind.schema, props, {
20233
+ const validatedProps = chunkA22XPVBQ_cjs.validateEdgeProps(edgeKind.schema, props, {
19402
20234
  kind,
19403
20235
  operation: "create"
19404
20236
  });
19405
- const matchProps = chunkQR6V2BXA_cjs.normalizePersistedEdgeMatchProps(validatedProps);
20237
+ const matchProps = chunkPTFO3JI5_cjs.normalizePersistedEdgeMatchProps(validatedProps);
19406
20238
  validateMatchOnFields(edgeKind.schema, matchOn, kind);
19407
20239
  const validFrom = chunkNWJV4UVW_cjs.validateStatedValidityLowerBound(
19408
20240
  options?.validFrom,
@@ -19446,7 +20278,7 @@ async function executeEdgeGetOrCreateByEndpoints(ctx, kind, fromKind, fromId, to
19446
20278
  );
19447
20279
  if (currentLiveRow !== void 0) {
19448
20280
  assertEndpointClearCanApply(ifExists, options?.clearValidTo, kind);
19449
- return { edge: chunkQR6V2BXA_cjs.rowToEdge(currentLiveRow), action: "found" };
20281
+ return { edge: chunkPTFO3JI5_cjs.rowToEdge(currentLiveRow), action: "found" };
19450
20282
  }
19451
20283
  initialCandidateRead = {
19452
20284
  rows: currentRows,
@@ -19463,7 +20295,7 @@ async function executeEdgeGetOrCreateByEndpoints(ctx, kind, fromKind, fromId, to
19463
20295
  if (!isDeleted) {
19464
20296
  if (ifExists === "return") {
19465
20297
  assertEndpointClearCanApply(ifExists, options?.clearValidTo, kind);
19466
- return { edge: chunkQR6V2BXA_cjs.rowToEdge(matchedRow), action: "found" };
20298
+ return { edge: chunkPTFO3JI5_cjs.rowToEdge(matchedRow), action: "found" };
19467
20299
  }
19468
20300
  const outcome = await executeEdgeUpsertUpdateWithOutcome(
19469
20301
  ctx,
@@ -19658,7 +20490,7 @@ async function executeEdgeBulkGetOrCreateByEndpoints(ctx, kind, items, backend,
19658
20490
  const ifExists = options?.ifExists ?? "return";
19659
20491
  const registration = getEdgeRegistration(ctx.graph, kind);
19660
20492
  const edgeKind = registration.type;
19661
- chunkC3CN2C2T_cjs.assertEdgeMatchIdentityBackendSupport(
20493
+ chunkQ6ZVQWH7_cjs.assertEdgeMatchIdentityBackendSupport(
19662
20494
  registration.matchIdentity,
19663
20495
  backend.capabilities,
19664
20496
  kind
@@ -19671,15 +20503,15 @@ async function executeEdgeBulkGetOrCreateByEndpoints(ctx, kind, items, backend,
19671
20503
  validateMatchOnFields(edgeKind.schema, matchOn, kind);
19672
20504
  const validated = [];
19673
20505
  for (const item of items) {
19674
- chunkQR6V2BXA_cjs.assertValidityEndMutation(item, { entityType: "edge", kind });
20506
+ chunkPTFO3JI5_cjs.assertValidityEndMutation(item, { entityType: "edge", kind });
19675
20507
  if (item.clearValidTo === true) {
19676
- chunkQR6V2BXA_cjs.assertClearValidToSupported(backend, "edge");
20508
+ chunkPTFO3JI5_cjs.assertClearValidToSupported(backend, "edge");
19677
20509
  }
19678
- const validatedProps = chunkIV5W7LKW_cjs.validateEdgeProps(edgeKind.schema, item.props, {
20510
+ const validatedProps = chunkA22XPVBQ_cjs.validateEdgeProps(edgeKind.schema, item.props, {
19679
20511
  kind,
19680
20512
  operation: "create"
19681
20513
  });
19682
- const matchProps = chunkQR6V2BXA_cjs.normalizePersistedEdgeMatchProps(validatedProps);
20514
+ const matchProps = chunkPTFO3JI5_cjs.normalizePersistedEdgeMatchProps(validatedProps);
19683
20515
  const validFrom = chunkNWJV4UVW_cjs.validateStatedValidityLowerBound(
19684
20516
  item.validFrom,
19685
20517
  "validFrom"
@@ -19692,7 +20524,7 @@ async function executeEdgeBulkGetOrCreateByEndpoints(ctx, kind, items, backend,
19692
20524
  validTo
19693
20525
  );
19694
20526
  }
19695
- const compositeKey = chunkQR6V2BXA_cjs.buildEdgeMatchKey({
20527
+ const compositeKey = chunkPTFO3JI5_cjs.buildEdgeMatchKey({
19696
20528
  fromKind: item.fromKind,
19697
20529
  fromId: item.fromId,
19698
20530
  toKind: item.toKind,
@@ -19723,7 +20555,7 @@ async function executeEdgeBulkGetOrCreateByEndpoints(ctx, kind, items, backend,
19723
20555
  }
19724
20556
  });
19725
20557
  }
19726
- const atomicConvergenceExecutor = chunkQR6V2BXA_cjs.resolveAtomicEdgeConvergenceExecutor({
20558
+ const atomicConvergenceExecutor = chunkPTFO3JI5_cjs.resolveAtomicEdgeConvergenceExecutor({
19727
20559
  backend,
19728
20560
  graph: ctx.graph,
19729
20561
  schemaVersion: ctx.schemaVersion,
@@ -19749,7 +20581,7 @@ async function executeEdgeBulkGetOrCreateByEndpoints(ctx, kind, items, backend,
19749
20581
  ctx.registry
19750
20582
  );
19751
20583
  if (endpointError) throw endpointError;
19752
- const matchIdentity = chunkQR6V2BXA_cjs.resolveEdgeMatchIdentityStorage(
20584
+ const matchIdentity = chunkPTFO3JI5_cjs.resolveEdgeMatchIdentityStorage(
19753
20585
  registration.matchIdentity,
19754
20586
  {
19755
20587
  fromKind: entry2.fromKind,
@@ -19768,7 +20600,7 @@ async function executeEdgeBulkGetOrCreateByEndpoints(ctx, kind, items, backend,
19768
20600
  }
19769
20601
  const params = buildInsertEdgeParams(
19770
20602
  ctx.graphId,
19771
- chunkIV5W7LKW_cjs.generateId(),
20603
+ chunkA22XPVBQ_cjs.generateId(),
19772
20604
  kind,
19773
20605
  entry2.fromKind,
19774
20606
  entry2.fromId,
@@ -19817,7 +20649,7 @@ async function executeEdgeBulkGetOrCreateByEndpoints(ctx, kind, items, backend,
19817
20649
  }
19818
20650
  if (nativeResults !== void 0) {
19819
20651
  if (nativeResults.length !== nativeEntries.length) {
19820
- await chunkIV5W7LKW_cjs.diagnoseFusedSchemaFenceNoRow(ctx, backend);
20652
+ await chunkA22XPVBQ_cjs.diagnoseFusedSchemaFenceNoRow(ctx, backend);
19821
20653
  throw new chunkG7W67PZO_cjs.DatabaseOperationError(
19822
20654
  `Atomic edge convergence returned ${nativeResults.length} results, expected ${nativeEntries.length}.`,
19823
20655
  { operation: "insert", entity: "edge" }
@@ -19828,7 +20660,7 @@ async function executeEdgeBulkGetOrCreateByEndpoints(ctx, kind, items, backend,
19828
20660
  for (const [nativeIndex, nativeResult] of nativeResults.entries()) {
19829
20661
  const nativeEntry = chunkBXHAPCQG_cjs.requireDefined(nativeEntries[nativeIndex]);
19830
20662
  const result = {
19831
- edge: chunkQR6V2BXA_cjs.rowToEdge(nativeResult.row),
20663
+ edge: chunkPTFO3JI5_cjs.rowToEdge(nativeResult.row),
19832
20664
  action: nativeResult.outcome
19833
20665
  };
19834
20666
  results[nativeEntry.index] = result;
@@ -20000,7 +20832,7 @@ async function executeEdgeBulkGetOrCreateByEndpoints(ctx, kind, items, backend,
20000
20832
  const found = Array.from({ length: items.length });
20001
20833
  for (const entry2 of partition.toFetch) {
20002
20834
  assertEndpointClearCanApply(ifExists, entry2.clearValidTo, kind);
20003
- found[entry2.index] = { edge: chunkQR6V2BXA_cjs.rowToEdge(entry2.row), action: "found" };
20835
+ found[entry2.index] = { edge: chunkPTFO3JI5_cjs.rowToEdge(entry2.row), action: "found" };
20004
20836
  }
20005
20837
  for (const { index, sourceIndex } of partition.duplicateOf) {
20006
20838
  found[index] = {
@@ -20017,15 +20849,15 @@ async function executeEdgeBulkGetOrCreateByEndpoints(ctx, kind, items, backend,
20017
20849
  if (found !== void 0) return found;
20018
20850
  }
20019
20851
  function runBatch() {
20020
- return chunkQR6V2BXA_cjs.runWritePlan(
20852
+ return chunkPTFO3JI5_cjs.runWritePlan(
20021
20853
  ctx,
20022
20854
  // A bulk getOrCreate always converges on a match key no database key
20023
20855
  // backs, whatever its cardinality — the same reason the single-item path
20024
20856
  // fences unconditionally.
20025
- chunkQR6V2BXA_cjs.edgeWritePlan("edgeMatchKeyConvergence"),
20857
+ chunkPTFO3JI5_cjs.edgeWritePlan("edgeMatchKeyConvergence"),
20026
20858
  backend,
20027
20859
  async (session, target, _overlaidSession, lock) => {
20028
- const rawTarget = chunkQR6V2BXA_cjs.nestedManagedWriteTarget(target);
20860
+ const rawTarget = chunkPTFO3JI5_cjs.nestedManagedWriteTarget(target);
20029
20861
  const { toCreate, toFetch, duplicateOf } = partitionEntries(
20030
20862
  await fetchRowsByEndpoint(target)
20031
20863
  );
@@ -20103,7 +20935,7 @@ async function executeEdgeBulkGetOrCreateByEndpoints(ctx, kind, items, backend,
20103
20935
  if (entry2.isDeleted) continue;
20104
20936
  assertEndpointClearCanApply(ifExists, entry2.clearValidTo, kind);
20105
20937
  results[entry2.index] = {
20106
- edge: chunkQR6V2BXA_cjs.rowToEdge(entry2.row),
20938
+ edge: chunkPTFO3JI5_cjs.rowToEdge(entry2.row),
20107
20939
  action: "found"
20108
20940
  };
20109
20941
  }
@@ -20138,7 +20970,7 @@ async function executeEdgeBulkGetOrCreateByEndpoints(ctx, kind, items, backend,
20138
20970
  } else {
20139
20971
  assertEndpointClearCanApply(ifExists, entry2.clearValidTo, kind);
20140
20972
  results[entry2.index] = {
20141
- edge: chunkQR6V2BXA_cjs.rowToEdge(entry2.row),
20973
+ edge: chunkPTFO3JI5_cjs.rowToEdge(entry2.row),
20142
20974
  action: "found"
20143
20975
  };
20144
20976
  }
@@ -20176,7 +21008,7 @@ async function executeEdgeBulkGetOrCreateByEndpoints(ctx, kind, items, backend,
20176
21008
  var RECORDED_POINT_READ_FIXED_BIND_PARAMS = 8;
20177
21009
  var RECORDED_SCAN_LIMIT = 1e3;
20178
21010
  function recordedPointReadIdChunk(backend) {
20179
- const budget = chunkIV5W7LKW_cjs.recordedBindParamBudget(backend);
21011
+ const budget = chunkA22XPVBQ_cjs.recordedBindParamBudget(backend);
20180
21012
  return Math.max(1, budget - RECORDED_POINT_READ_FIXED_BIND_PARAMS);
20181
21013
  }
20182
21014
  function recordedRelationErrorDetails(backend, surface) {
@@ -20417,7 +21249,7 @@ function createRecordedReadService(params) {
20417
21249
  kind,
20418
21250
  ids,
20419
21251
  coordinate,
20420
- toEntity: (row) => chunkQR6V2BXA_cjs.rowToNode(mapRecordedNodeRow(row))
21252
+ toEntity: (row) => chunkPTFO3JI5_cjs.rowToNode(mapRecordedNodeRow(row))
20421
21253
  });
20422
21254
  }
20423
21255
  function edgeGetByIds(kind, ids, coordinate) {
@@ -20432,7 +21264,7 @@ function createRecordedReadService(params) {
20432
21264
  kind,
20433
21265
  ids,
20434
21266
  coordinate,
20435
- toEntity: (row) => chunkQR6V2BXA_cjs.rowToEdge(mapRecordedEdgeRow(row))
21267
+ toEntity: (row) => chunkPTFO3JI5_cjs.rowToEdge(mapRecordedEdgeRow(row))
20436
21268
  });
20437
21269
  }
20438
21270
  function nodeScan(kind, coordinate, options) {
@@ -20447,7 +21279,7 @@ function createRecordedReadService(params) {
20447
21279
  kind,
20448
21280
  coordinate,
20449
21281
  options,
20450
- toEntity: (row) => chunkQR6V2BXA_cjs.rowToNode(mapRecordedNodeRow(row))
21282
+ toEntity: (row) => chunkPTFO3JI5_cjs.rowToNode(mapRecordedNodeRow(row))
20451
21283
  });
20452
21284
  }
20453
21285
  function edgeScan(kind, coordinate, options) {
@@ -20462,7 +21294,7 @@ function createRecordedReadService(params) {
20462
21294
  kind,
20463
21295
  coordinate,
20464
21296
  options,
20465
- toEntity: (row) => chunkQR6V2BXA_cjs.rowToEdge(mapRecordedEdgeRow(row))
21297
+ toEntity: (row) => chunkPTFO3JI5_cjs.rowToEdge(mapRecordedEdgeRow(row))
20466
21298
  });
20467
21299
  }
20468
21300
  return {
@@ -20800,7 +21632,7 @@ function syncStoreReplacementRef(ref, replacement) {
20800
21632
  ref.current = replacement;
20801
21633
  }
20802
21634
  async function commitEvolvedSchemaWhenRequiredKindsAreEmpty(backend, graph, currentVersion, classification, storedSchema) {
20803
- const result = await chunkU53HFE4L_cjs.commitNewSchemaVersionIfKindsEmpty(
21635
+ const result = await chunkOKA6H3B3_cjs.commitNewSchemaVersionIfKindsEmpty(
20804
21636
  backend,
20805
21637
  graph,
20806
21638
  currentVersion,
@@ -20853,7 +21685,7 @@ async function assertEvolvedSchemaRequiredKindsEmpty(backend, graphId, classific
20853
21685
  }
20854
21686
  var IDENTITY_FACADES = /* @__PURE__ */ new WeakMap();
20855
21687
  var StoreImplementation = class _StoreImplementation {
20856
- [chunkIV5W7LKW_cjs.STORE_RUNTIME];
21688
+ [chunkA22XPVBQ_cjs.STORE_RUNTIME];
20857
21689
  #graph;
20858
21690
  /**
20859
21691
  * Bare backend for DDL, vector-storage, and bulk-materialization work that must
@@ -20970,7 +21802,7 @@ var StoreImplementation = class _StoreImplementation {
20970
21802
  if (clockFencePlan.kind === "unfenced") {
20971
21803
  chunkEOLNL35G_cjs.refuseUnfencedClockAllocation(backend.dialect);
20972
21804
  }
20973
- chunkIV5W7LKW_cjs.assertRevisionTrackableBackend(backend);
21805
+ chunkA22XPVBQ_cjs.assertRevisionTrackableBackend(backend);
20974
21806
  }
20975
21807
  const explicitSchema = options?.schema === void 0 ? void 0 : chunkEOLNL35G_cjs.requireSqlSchema(options.schema, "store schema");
20976
21808
  const resolvedSchema = explicitSchema ?? (backend.tableNames ? chunkEOLNL35G_cjs.createSqlSchema(backend.tableNames) : void 0);
@@ -20991,7 +21823,7 @@ var StoreImplementation = class _StoreImplementation {
20991
21823
  chunkJFLJVLNU_cjs.requireRecordedTime(backend, "store construction"),
20992
21824
  readSchema
20993
21825
  ) : externalRecordedRead;
20994
- this.#backend = this.#captureEnabled ? asGraphWriteBackend(chunkIV5W7LKW_cjs.createRecordedBackend(backend, resolvedSchema)) : asGraphWriteBackend(backend);
21826
+ this.#backend = this.#captureEnabled ? asGraphWriteBackend(chunkA22XPVBQ_cjs.createRecordedBackend(backend, resolvedSchema)) : asGraphWriteBackend(backend);
20995
21827
  this.#claimsVerdict = chunkOGK7F2J3_cjs.createClaimsVerdictThunk(this.#backend);
20996
21828
  this.#batchPointRead = chunkOGK7F2J3_cjs.batchPointReadVerdict(this.#backend);
20997
21829
  this.#uniqueSidecarBatch = chunkOGK7F2J3_cjs.uniqueSidecarBatchVerdict(this.#backend);
@@ -21009,19 +21841,19 @@ var StoreImplementation = class _StoreImplementation {
21009
21841
  mapRecordedNodeRow: chunk7BHUIAZR_cjs.createNodeRowMapper(rowMapperConfig),
21010
21842
  mapRecordedEdgeRow: chunk7BHUIAZR_cjs.createEdgeRowMapper(rowMapperConfig)
21011
21843
  });
21012
- this.#registry = chunkU53HFE4L_cjs.buildKindRegistry(graph);
21844
+ this.#registry = chunkOKA6H3B3_cjs.buildKindRegistry(graph);
21013
21845
  this.#hooks = options?.hooks ?? {};
21014
21846
  this.#defaultTraversalExpansion = options?.queryDefaults?.traversalExpansion ?? "inverse";
21015
21847
  this.#options = options;
21016
21848
  this.#schemaMetadata = schemaMetadata ?? UNKNOWN_SCHEMA_METADATA;
21017
- this[chunkIV5W7LKW_cjs.STORE_RUNTIME] = {
21849
+ this[chunkA22XPVBQ_cjs.STORE_RUNTIME] = {
21018
21850
  backend: this.#backend,
21019
21851
  captureEnabled: this.#captureEnabled,
21020
21852
  uniqueSidecarBatch: this.#uniqueSidecarBatch,
21021
21853
  // The query path's own construction, not a second spelling of it: a
21022
21854
  // caller that could only rebuild this object could not observe the one
21023
21855
  // the queries actually run on.
21024
- queryBackend: (target) => this.#createHookedQueryBackend(target ?? this[chunkIV5W7LKW_cjs.STORE_RUNTIME].backend),
21856
+ queryBackend: (target) => this.#createHookedQueryBackend(target ?? this[chunkA22XPVBQ_cjs.STORE_RUNTIME].backend),
21025
21857
  sealedQuery: (coordinate) => this.sealedQuery(coordinate),
21026
21858
  recordedNodeGetById: (kind, id, coordinate) => this.recordedNodeGetById(kind, id, coordinate),
21027
21859
  recordedNodeGetByIds: (kind, ids, coordinate) => this.recordedNodeGetByIds(kind, ids, coordinate),
@@ -21068,8 +21900,8 @@ var StoreImplementation = class _StoreImplementation {
21068
21900
  if (upserts.every((upsert) => upsert.constraints.length === 0) && releases.length === 0) {
21069
21901
  return apply();
21070
21902
  }
21071
- const lock = await chunkIV5W7LKW_cjs.lockRecordedGraphWrite(target, this.graphId);
21072
- return chunkBPYZUJX5_cjs.applyResolvedNodeClaims(
21903
+ const lock = await chunkA22XPVBQ_cjs.lockRecordedGraphWrite(target, this.graphId);
21904
+ return chunkMTJAT6UO_cjs.applyResolvedNodeClaims(
21073
21905
  {
21074
21906
  graphId: this.graphId,
21075
21907
  registry: this.#registry,
@@ -21085,7 +21917,7 @@ var StoreImplementation = class _StoreImplementation {
21085
21917
  },
21086
21918
  liveNodesSharingIds: async (ids, target) => {
21087
21919
  const backend2 = target ?? this.#baseBackend;
21088
- const liveKindsById = await chunkC3CN2C2T_cjs.liveNodeKindsSharingIds(
21920
+ const liveKindsById = await chunkQ6ZVQWH7_cjs.liveNodeKindsSharingIds(
21089
21921
  this.#identityContext(backend2),
21090
21922
  backend2,
21091
21923
  ids
@@ -21100,21 +21932,21 @@ var StoreImplementation = class _StoreImplementation {
21100
21932
  if (this.#graph.identity === void 0) return /* @__PURE__ */ new Map();
21101
21933
  const backend2 = target ?? this.#baseBackend;
21102
21934
  const ctx = this.#identityContext(backend2);
21103
- const rows = await chunkC3CN2C2T_cjs.loadAssertionsByIds(
21935
+ const rows = await chunkQ6ZVQWH7_cjs.loadAssertionsByIds(
21104
21936
  backend2,
21105
21937
  ctx.schema,
21106
21938
  this.graphId,
21107
21939
  ids
21108
21940
  );
21109
21941
  return new Map(
21110
- [...rows].map(([id, row]) => [id, chunkC3CN2C2T_cjs.toTransferAssertion(row)])
21942
+ [...rows].map(([id, row]) => [id, chunkQ6ZVQWH7_cjs.toTransferAssertion(row)])
21111
21943
  );
21112
21944
  },
21113
21945
  structuralIdentityClasses: async (references, target) => {
21114
21946
  if (this.#graph.identity === void 0) return /* @__PURE__ */ new Map();
21115
21947
  const backend2 = target ?? this.#baseBackend;
21116
21948
  const ctx = this.#identityContext(backend2);
21117
- return chunkC3CN2C2T_cjs.loadCurrentStructuralClasses(
21949
+ return chunkQ6ZVQWH7_cjs.loadCurrentStructuralClasses(
21118
21950
  backend2,
21119
21951
  ctx.schema,
21120
21952
  this.graphId,
@@ -21130,7 +21962,7 @@ var StoreImplementation = class _StoreImplementation {
21130
21962
  applyIdentityMergeAtTarget: (target, retractions, assertions) => this.applyIdentityMergeAtTarget(target, retractions, assertions),
21131
21963
  assertIdentityClassesConsistentAtTarget: (target, seeds) => this.assertIdentityClassesConsistentAtTarget(target, seeds)
21132
21964
  };
21133
- Object.defineProperty(this, chunkIV5W7LKW_cjs.STORE_RUNTIME, {
21965
+ Object.defineProperty(this, chunkA22XPVBQ_cjs.STORE_RUNTIME, {
21134
21966
  configurable: false,
21135
21967
  enumerable: false,
21136
21968
  writable: false
@@ -21167,7 +21999,7 @@ var StoreImplementation = class _StoreImplementation {
21167
21999
  );
21168
22000
  const existing = IDENTITY_FACADES.get(this);
21169
22001
  if (existing !== void 0) return existing;
21170
- const facade = chunkC3CN2C2T_cjs.createIdentityFacade(this.#identityContext(this.#backend));
22002
+ const facade = chunkQ6ZVQWH7_cjs.createIdentityFacade(this.#identityContext(this.#backend));
21171
22003
  IDENTITY_FACADES.set(this, facade);
21172
22004
  return facade;
21173
22005
  }
@@ -21188,7 +22020,7 @@ var StoreImplementation = class _StoreImplementation {
21188
22020
  this.#requireIdentityEnabled();
21189
22021
  const recordedAsOf = coordinate.recorded?.asOf;
21190
22022
  if (recordedAsOf !== void 0 && chunkJFLJVLNU_cjs.isEngineNativeRecordedReadBinding(this.#recordedReadBinding)) {
21191
- chunkIV5W7LKW_cjs.refuseEngineNativeRecordedIdentityRead("identityAtCoordinate");
22023
+ chunkA22XPVBQ_cjs.refuseEngineNativeRecordedIdentityRead("identityAtCoordinate");
21192
22024
  }
21193
22025
  const backend = recordedAsOf === void 0 ? this.#backend : this.#recordedReads.backendForCoordinate(
21194
22026
  coordinate,
@@ -21200,7 +22032,7 @@ var StoreImplementation = class _StoreImplementation {
21200
22032
  this.#recordedReadBinding,
21201
22033
  "recorded-identity"
21202
22034
  );
21203
- return chunkC3CN2C2T_cjs.createIdentityReadFacade({
22035
+ return chunkQ6ZVQWH7_cjs.createIdentityReadFacade({
21204
22036
  ...this.#identityContext(backend),
21205
22037
  schema,
21206
22038
  coordinate
@@ -21229,7 +22061,7 @@ var StoreImplementation = class _StoreImplementation {
21229
22061
  * fails leaves no half-published derived relation behind.
21230
22062
  */
21231
22063
  async identitySchemaPreflight(target, provisionDerivedRelations) {
21232
- await chunkU53HFE4L_cjs.identitySchemaCommitPreflight(this.#identityContext(this.#backend), {
22064
+ await chunkOKA6H3B3_cjs.identitySchemaCommitPreflight(this.#identityContext(this.#backend), {
21233
22065
  enablement: false,
21234
22066
  provisionDerivedRelations
21235
22067
  })(target);
@@ -21237,25 +22069,25 @@ var StoreImplementation = class _StoreImplementation {
21237
22069
  /** @internal Read-only startup integrity verification. */
21238
22070
  async validateIdentity() {
21239
22071
  if (this.#graph.identity === void 0) return;
21240
- await chunkC3CN2C2T_cjs.validateIdentityForContext(this.#identityContext(this.#baseBackend));
22072
+ await chunkQ6ZVQWH7_cjs.validateIdentityForContext(this.#identityContext(this.#baseBackend));
21241
22073
  }
21242
22074
  /** @internal Cascades removed kinds in the schema-commit transaction. */
21243
22075
  async removeIdentityKindsInSchemaPreflight(target, kinds, options) {
21244
22076
  if (!this.#captureEnabled) {
21245
- await chunkC3CN2C2T_cjs.removeIdentityKindsForContext(
22077
+ await chunkQ6ZVQWH7_cjs.removeIdentityKindsForContext(
21246
22078
  this.#identityContext(target),
21247
22079
  kinds,
21248
22080
  options
21249
22081
  );
21250
22082
  return;
21251
22083
  }
21252
- const scope = chunkIV5W7LKW_cjs.createRecordedTransactionScope(
22084
+ const scope = chunkA22XPVBQ_cjs.createRecordedTransactionScope(
21253
22085
  target,
21254
22086
  this.#batchPointRead,
21255
22087
  this.#sqlSchema(),
21256
22088
  target.dialect === "sqlite"
21257
22089
  );
21258
- await chunkC3CN2C2T_cjs.removeIdentityKindsForContext(
22090
+ await chunkQ6ZVQWH7_cjs.removeIdentityKindsForContext(
21259
22091
  this.#identityContext(scope.backend),
21260
22092
  kinds,
21261
22093
  options
@@ -21269,7 +22101,7 @@ var StoreImplementation = class _StoreImplementation {
21269
22101
  */
21270
22102
  readCurrentIdentityAssertions(mode, options) {
21271
22103
  if (this.#graph.identity === void 0) return Promise.resolve([]);
21272
- return chunkC3CN2C2T_cjs.readIdentityAssertionsForInterchange(
22104
+ return chunkQ6ZVQWH7_cjs.readIdentityAssertionsForInterchange(
21273
22105
  this.#identityContext(this.#baseBackend),
21274
22106
  mode,
21275
22107
  options
@@ -21278,7 +22110,7 @@ var StoreImplementation = class _StoreImplementation {
21278
22110
  /** @internal Reads identity truth through an already-bound transaction. */
21279
22111
  identityAssertionsAtTarget(target, mode = "state") {
21280
22112
  if (this.#graph.identity === void 0) return Promise.resolve([]);
21281
- return chunkC3CN2C2T_cjs.readIdentityAssertionsForInterchange(
22113
+ return chunkQ6ZVQWH7_cjs.readIdentityAssertionsForInterchange(
21282
22114
  this.#identityContext(target),
21283
22115
  mode
21284
22116
  );
@@ -21288,7 +22120,7 @@ var StoreImplementation = class _StoreImplementation {
21288
22120
  if (this.#graph.identity === void 0) {
21289
22121
  return Promise.resolve({ assertions: [], done: true });
21290
22122
  }
21291
- return chunkC3CN2C2T_cjs.readIdentityAssertionPageAtTarget(
22123
+ return chunkQ6ZVQWH7_cjs.readIdentityAssertionPageAtTarget(
21292
22124
  this.#identityContext(target),
21293
22125
  target,
21294
22126
  mode,
@@ -21297,14 +22129,14 @@ var StoreImplementation = class _StoreImplementation {
21297
22129
  }
21298
22130
  /** @internal Acquires the enabled graph's identity lock for an import. */
21299
22131
  lockIdentityImportTarget(target) {
21300
- return this.#graph.identity === void 0 ? Promise.resolve() : chunkC3CN2C2T_cjs.lockIdentityGraph(target, this.graphId);
22132
+ return this.#graph.identity === void 0 ? Promise.resolve() : chunkQ6ZVQWH7_cjs.lockIdentityGraph(target, this.graphId);
21301
22133
  }
21302
22134
  /** @internal Restores same-id folding after the ops-layer import bypass. */
21303
22135
  foldImportedIdentityNodes(target, references) {
21304
22136
  if (this.#graph.identity === void 0 || references.length === 0) {
21305
22137
  return Promise.resolve();
21306
22138
  }
21307
- return chunkC3CN2C2T_cjs.foldIdentityForCreatedNodes(
22139
+ return chunkQ6ZVQWH7_cjs.foldIdentityForCreatedNodes(
21308
22140
  {
21309
22141
  graphId: this.graphId,
21310
22142
  registry: this.#registry,
@@ -21326,7 +22158,7 @@ var StoreImplementation = class _StoreImplementation {
21326
22158
  { code: "IDENTITY_IMPORT_REQUIRES_PROFILE", graphId: this.graphId }
21327
22159
  );
21328
22160
  }
21329
- return chunkC3CN2C2T_cjs.importIdentityAssertionsIntoTarget(
22161
+ return chunkQ6ZVQWH7_cjs.importIdentityAssertionsIntoTarget(
21330
22162
  // The slice the coordinator reads — graph, registry, schema, folding
21331
22163
  // mode — none of which depend on the target. The target it writes
21332
22164
  // through is the parameter beside it, which is why this method can take
@@ -21346,7 +22178,7 @@ var StoreImplementation = class _StoreImplementation {
21346
22178
  if (this.#graph.identity === void 0 || seeds.length === 0) {
21347
22179
  return Promise.resolve();
21348
22180
  }
21349
- return chunkC3CN2C2T_cjs.assertAffectedIdentityClassesConsistent(
22181
+ return chunkQ6ZVQWH7_cjs.assertAffectedIdentityClassesConsistent(
21350
22182
  this.#identityContext(target),
21351
22183
  target,
21352
22184
  seeds
@@ -21363,7 +22195,7 @@ var StoreImplementation = class _StoreImplementation {
21363
22195
  { code: "IDENTITY_MERGE_REQUIRES_PROFILE", graphId: this.graphId }
21364
22196
  );
21365
22197
  }
21366
- return chunkC3CN2C2T_cjs.applyIdentityChangesForContext(
22198
+ return chunkQ6ZVQWH7_cjs.applyIdentityChangesForContext(
21367
22199
  this.#identityContext(target),
21368
22200
  retractions,
21369
22201
  assertions
@@ -21791,7 +22623,7 @@ var StoreImplementation = class _StoreImplementation {
21791
22623
  * between "proceed" and "ask the user" *before* attempting a commit.
21792
22624
  */
21793
22625
  async schemaChanges() {
21794
- return chunkU53HFE4L_cjs.getSchemaChanges(this.#backend, this.#graph);
22626
+ return chunkOKA6H3B3_cjs.getSchemaChanges(this.#backend, this.#graph);
21795
22627
  }
21796
22628
  /**
21797
22629
  * Whether committing this store's graph would require a schema migration —
@@ -21803,7 +22635,7 @@ var StoreImplementation = class _StoreImplementation {
21803
22635
  * through a user's request.
21804
22636
  */
21805
22637
  async requiresMigration() {
21806
- return chunkU53HFE4L_cjs.requiresMigration(this.#backend, this.#graph);
22638
+ return chunkOKA6H3B3_cjs.requiresMigration(this.#backend, this.#graph);
21807
22639
  }
21808
22640
  /**
21809
22641
  * Node operations bound to this store instance.
@@ -21819,7 +22651,7 @@ var StoreImplementation = class _StoreImplementation {
21819
22651
  async #maybeRefreshStatisticsAfterBulk(rowCount) {
21820
22652
  const configured = this.#options?.autoRefreshStatistics;
21821
22653
  if (configured === false) return;
21822
- const threshold = configured ?? chunkIV5W7LKW_cjs.AUTO_REFRESH_STATISTICS_ROW_THRESHOLD;
22654
+ const threshold = configured ?? chunkA22XPVBQ_cjs.AUTO_REFRESH_STATISTICS_ROW_THRESHOLD;
21823
22655
  if (rowCount < threshold) return;
21824
22656
  try {
21825
22657
  await this.refreshStatistics();
@@ -21833,13 +22665,13 @@ var StoreImplementation = class _StoreImplementation {
21833
22665
  #buildNodeOperations(ctx) {
21834
22666
  return {
21835
22667
  defaultTemporalMode: this.#graph.defaults.temporalMode,
21836
- rowToNode: (row) => chunkQR6V2BXA_cjs.rowToNode(row),
22668
+ rowToNode: (row) => chunkPTFO3JI5_cjs.rowToNode(row),
21837
22669
  maybeRefreshStatisticsAfterBulk: (rowCount) => this.#maybeRefreshStatisticsAfterBulk(rowCount),
21838
- executeCreate: (input, backend) => chunkQR6V2BXA_cjs.executeNodeCreate(ctx, input, backend),
21839
- executeCreateBatch: (inputs, backend, options) => chunkQR6V2BXA_cjs.executeNodeCreateBatch(ctx, inputs, backend, options),
21840
- executeCreateNoReturnBatch: (inputs, backend) => chunkQR6V2BXA_cjs.executeNodeCreateNoReturnBatch(ctx, inputs, backend),
21841
- executeUpdate: (input, backend, options) => chunkQR6V2BXA_cjs.executeNodeUpdate(ctx, { ...input, id: input.id }, backend, options),
21842
- executeNodeSetUpdate: (kind, patch, candidateIds, candidateIdColumn, backend, options) => chunkQR6V2BXA_cjs.executeNodeSetUpdate(
22670
+ executeCreate: (input, backend) => chunkPTFO3JI5_cjs.executeNodeCreate(ctx, input, backend),
22671
+ executeCreateBatch: (inputs, backend, options) => chunkPTFO3JI5_cjs.executeNodeCreateBatch(ctx, inputs, backend, options),
22672
+ executeCreateNoReturnBatch: (inputs, backend) => chunkPTFO3JI5_cjs.executeNodeCreateNoReturnBatch(ctx, inputs, backend),
22673
+ executeUpdate: (input, backend, options) => chunkPTFO3JI5_cjs.executeNodeUpdate(ctx, { ...input, id: input.id }, backend, options),
22674
+ executeNodeSetUpdate: (kind, patch, candidateIds, candidateIdColumn, backend, options) => chunkPTFO3JI5_cjs.executeNodeSetUpdate(
21843
22675
  ctx,
21844
22676
  kind,
21845
22677
  patch,
@@ -21848,20 +22680,20 @@ var StoreImplementation = class _StoreImplementation {
21848
22680
  backend,
21849
22681
  options
21850
22682
  ),
21851
- executeUpsertUpdateBatch: (entries, backend) => chunkQR6V2BXA_cjs.executeNodeUpsertUpdateBatch(ctx, entries, backend),
21852
- executeResolvedMutationSet: (creates, updates, backend) => chunkQR6V2BXA_cjs.executeNodeResolvedMutationSet(ctx, creates, updates, backend),
21853
- prepareReplacement: (kind, props) => chunkQR6V2BXA_cjs.prepareNodeReplacement(ctx, kind, props),
21854
- executeReplacementBatch: (kind, items, backend) => chunkQR6V2BXA_cjs.executeNodeReplacementBatch(ctx, kind, items, backend),
22683
+ executeUpsertUpdateBatch: (entries, backend) => chunkPTFO3JI5_cjs.executeNodeUpsertUpdateBatch(ctx, entries, backend),
22684
+ executeResolvedMutationSet: (creates, updates, backend) => chunkPTFO3JI5_cjs.executeNodeResolvedMutationSet(ctx, creates, updates, backend),
22685
+ prepareReplacement: (kind, props) => chunkPTFO3JI5_cjs.prepareNodeReplacement(ctx, kind, props),
22686
+ executeReplacementBatch: (kind, items, backend) => chunkPTFO3JI5_cjs.executeNodeReplacementBatch(ctx, kind, items, backend),
21855
22687
  // Present only when opted in; its absence is the coalesce off switch.
21856
22688
  ...ctx.coalesceUnchangedUpsertsEnabled && {
21857
- upsertDirtyCheck: (kind, id, existingProps, inputProps) => chunkQR6V2BXA_cjs.nodeUpsertDirtyCheck(ctx, kind, id, existingProps, inputProps)
22689
+ upsertDirtyCheck: (kind, id, existingProps, inputProps) => chunkPTFO3JI5_cjs.nodeUpsertDirtyCheck(ctx, kind, id, existingProps, inputProps)
21858
22690
  },
21859
- executeDelete: (kind, id, backend) => chunkQR6V2BXA_cjs.executeNodeDelete(ctx, kind, id, backend),
21860
- executeDeleteBatch: (kind, ids, backend) => chunkQR6V2BXA_cjs.executeNodeDeleteBatch(ctx, kind, ids, backend),
21861
- executeHardDelete: (kind, id, backend) => chunkQR6V2BXA_cjs.executeNodeHardDelete(ctx, kind, id, backend),
22691
+ executeDelete: (kind, id, backend) => chunkPTFO3JI5_cjs.executeNodeDelete(ctx, kind, id, backend),
22692
+ executeDeleteBatch: (kind, ids, backend) => chunkPTFO3JI5_cjs.executeNodeDeleteBatch(ctx, kind, ids, backend),
22693
+ executeHardDelete: (kind, id, backend) => chunkPTFO3JI5_cjs.executeNodeHardDelete(ctx, kind, id, backend),
21862
22694
  temporalRowMatcher: (options) => this.#temporalRowMatcher(options),
21863
22695
  createQuery: () => this.query(),
21864
- executeGetOrCreateByConstraint: (kind, constraintName, props, backend, options) => chunkQR6V2BXA_cjs.executeNodeGetOrCreateByConstraint(
22696
+ executeGetOrCreateByConstraint: (kind, constraintName, props, backend, options) => chunkPTFO3JI5_cjs.executeNodeGetOrCreateByConstraint(
21865
22697
  ctx,
21866
22698
  kind,
21867
22699
  constraintName,
@@ -21869,7 +22701,7 @@ var StoreImplementation = class _StoreImplementation {
21869
22701
  backend,
21870
22702
  options
21871
22703
  ),
21872
- executeBulkGetOrCreateByConstraint: (kind, constraintName, items, backend, options) => chunkQR6V2BXA_cjs.executeNodeBulkGetOrCreateByConstraint(
22704
+ executeBulkGetOrCreateByConstraint: (kind, constraintName, items, backend, options) => chunkPTFO3JI5_cjs.executeNodeBulkGetOrCreateByConstraint(
21873
22705
  ctx,
21874
22706
  kind,
21875
22707
  constraintName,
@@ -21877,15 +22709,15 @@ var StoreImplementation = class _StoreImplementation {
21877
22709
  backend,
21878
22710
  options
21879
22711
  ),
21880
- executeFindByConstraint: (kind, constraintName, props, backend) => chunkQR6V2BXA_cjs.executeNodeFindByConstraint(ctx, kind, constraintName, props, backend),
21881
- executeBulkFindByConstraint: (kind, constraintName, items, backend) => chunkQR6V2BXA_cjs.executeNodeBulkFindByConstraint(
22712
+ executeFindByConstraint: (kind, constraintName, props, backend) => chunkPTFO3JI5_cjs.executeNodeFindByConstraint(ctx, kind, constraintName, props, backend),
22713
+ executeBulkFindByConstraint: (kind, constraintName, items, backend) => chunkPTFO3JI5_cjs.executeNodeBulkFindByConstraint(
21882
22714
  ctx,
21883
22715
  kind,
21884
22716
  constraintName,
21885
22717
  items,
21886
22718
  backend
21887
22719
  ),
21888
- executeBulkFindByIndex: (kind, indexName, items, backend, options) => chunkQR6V2BXA_cjs.executeNodeBulkFindByIndex(
22720
+ executeBulkFindByIndex: (kind, indexName, items, backend, options) => chunkPTFO3JI5_cjs.executeNodeBulkFindByIndex(
21889
22721
  ctx,
21890
22722
  kind,
21891
22723
  indexName,
@@ -21904,7 +22736,7 @@ var StoreImplementation = class _StoreImplementation {
21904
22736
  #buildEdgeOperations(ctx) {
21905
22737
  return {
21906
22738
  defaultTemporalMode: this.#graph.defaults.temporalMode,
21907
- rowToEdge: (row) => chunkQR6V2BXA_cjs.rowToEdge(row),
22739
+ rowToEdge: (row) => chunkPTFO3JI5_cjs.rowToEdge(row),
21908
22740
  maybeRefreshStatisticsAfterBulk: (rowCount) => this.#maybeRefreshStatisticsAfterBulk(rowCount),
21909
22741
  executeCreate: (input, backend) => executeEdgeCreate(ctx, input, backend),
21910
22742
  executeCreateBatch: (inputs, backend) => executeEdgeCreateBatch(ctx, inputs, backend),
@@ -21967,6 +22799,20 @@ var StoreImplementation = class _StoreImplementation {
21967
22799
  query() {
21968
22800
  return this.#createQueryForBackend(this.#backend);
21969
22801
  }
22802
+ /**
22803
+ * Runs a read block whose fluent queries automatically use
22804
+ * `executeChecked(expectedSchemaVersion)` when `.execute()` is called.
22805
+ * A schema mismatch aborts the block with `SchemaChangedError`, so callers
22806
+ * can put one reload-and-retry boundary around the whole block.
22807
+ */
22808
+ withCheckedReads(expectedSchemaVersion, fn) {
22809
+ const reads = {
22810
+ query: () => this.#createQueryForBackend(this.#backend, void 0, 1, {
22811
+ value: expectedSchemaVersion
22812
+ })
22813
+ };
22814
+ return fn(reads);
22815
+ }
21970
22816
  /**
21971
22817
  * Internal seam for {@link StoreView.query}: a query builder pinned to a
21972
22818
  * view's {@link ReadCoordinate} with its temporal axis sealed
@@ -22120,7 +22966,7 @@ var StoreImplementation = class _StoreImplementation {
22120
22966
  );
22121
22967
  }
22122
22968
  const recordedAt = await chunkEOLNL35G_cjs.withRecordedRelationsPrecondition(
22123
- chunkIV5W7LKW_cjs.readRecordedClock(this.#backend, this.#sqlSchema(), this.graphId),
22969
+ chunkA22XPVBQ_cjs.readRecordedClock(this.#backend, this.#sqlSchema(), this.graphId),
22124
22970
  { dialect: this.#backend.dialect, surface: "recorded-now" }
22125
22971
  );
22126
22972
  return recordedAt === void 0 ? void 0 : chunkNWJV4UVW_cjs.asRecordedInstant(recordedAt);
@@ -22167,7 +23013,7 @@ var StoreImplementation = class _StoreImplementation {
22167
23013
  return this.#engineRecordedInstant(this.#backend);
22168
23014
  }
22169
23015
  if (!this.#revisionTrackingEnabled) return void 0;
22170
- return chunkIV5W7LKW_cjs.readRecordedClock(this.#backend, this.#sqlSchema(), this.graphId);
23016
+ return chunkA22XPVBQ_cjs.readRecordedClock(this.#backend, this.#sqlSchema(), this.graphId);
22171
23017
  }
22172
23018
  /**
22173
23019
  * Returns the durable random namespace for this graph's revision clock. A
@@ -22195,7 +23041,7 @@ var StoreImplementation = class _StoreImplementation {
22195
23041
  { code: "REVISION_ORIGIN_REQUIRES_TRACKING" }
22196
23042
  );
22197
23043
  }
22198
- return chunkIV5W7LKW_cjs.ensureRevisionOrigin(
23044
+ return chunkA22XPVBQ_cjs.ensureRevisionOrigin(
22199
23045
  this.#baseBackend,
22200
23046
  this.#recordedRevisionOrigins,
22201
23047
  this.#sqlSchema(),
@@ -22301,17 +23147,14 @@ var StoreImplementation = class _StoreImplementation {
22301
23147
  * adapter may reuse one client there too. The portable guarantee is only
22302
23148
  * that at most one query is in flight at a time.
22303
23149
  *
22304
- * **Not a snapshot — and there is no way to make it one.** PostgreSQL
22305
- * defaults to read-committed isolation, so a later query can observe a
22306
- * commit the earlier ones did not. `store.transaction()` takes an
22307
- * `isolationLevel`, but its context exposes only `nodes` / `edges`: there is
22308
- * no public way to run a fluent query or a batch inside a transaction, so a
22309
- * snapshot across fluent queries is not available today. Collection reads
22310
- * can have one — `store.transaction(fn, { isolationLevel: "repeatable_read" })`
22311
- * reading through `tx.nodes` / `tx.edges` — but only where the backend has
22312
- * transactions (other backends refuse before invoking the callback), and a history-enabled
22313
- * store on PostgreSQL additionally requires `accessMode: "read_only"` or the
22314
- * call throws.
23150
+ * **Not a snapshot by default.** PostgreSQL defaults to read-committed
23151
+ * isolation, so a later query can observe a commit the earlier ones did not.
23152
+ * When multiple reads need one stable snapshot, use `tx.query()` or the
23153
+ * transaction's set-oriented reads inside `store.transaction(fn, {
23154
+ * isolationLevel: "repeatable_read" })`. `tx.batchOnce()` is one statement
23155
+ * regardless of isolation level. Transaction reads require a backend with
23156
+ * interactive transactions, and a history-enabled store on PostgreSQL
23157
+ * additionally requires `accessMode: "read_only"` for a read-only transaction.
22315
23158
  *
22316
23159
  * **Will not fix an N+1.** Serializing N queries does not reduce their
22317
23160
  * number. The alternatives are set-oriented or chunked rather than
@@ -22362,6 +23205,80 @@ var StoreImplementation = class _StoreImplementation {
22362
23205
  return results;
22363
23206
  });
22364
23207
  }
23208
+ /**
23209
+ * Executes two or more independent relational queries as exactly one SQL
23210
+ * statement and returns their typed results in input order.
23211
+ *
23212
+ * Each read is embedded as a CTE and its rows are returned through a JSON
23213
+ * envelope. Unlike {@link batch}, this method opens no transaction and has
23214
+ * no sequential fallback: one call means one statement on every supported
23215
+ * backend. Fluent queries and the reads built by the callback are composable
23216
+ * here.
23217
+ */
23218
+ async batchOnce(build) {
23219
+ return this.#batchOnceForBackend(this.#baseBackend, 1, build);
23220
+ }
23221
+ #createBatchReadBuilder(backend, attempt) {
23222
+ return {
23223
+ neighbors: (source, options) => {
23224
+ this.#assertNeighborKinds(source, options.edges);
23225
+ return createNeighborRead(
23226
+ this.#neighborContext(backend, attempt),
23227
+ source,
23228
+ options
23229
+ );
23230
+ },
23231
+ countNeighbors: (source, options) => {
23232
+ this.#assertNeighborKinds(source, options.edges);
23233
+ return createNeighborCountRead(
23234
+ this.#neighborContext(backend, attempt),
23235
+ source,
23236
+ options
23237
+ );
23238
+ },
23239
+ subgraph: (rootId, options) => this.#createSubgraphRead(rootId, options, backend, attempt)
23240
+ };
23241
+ }
23242
+ async #batchOnceForBackend(backend, attempt, build) {
23243
+ const queries = build(this.#createBatchReadBuilder(backend, attempt));
23244
+ return executeOneStatementBatch(
23245
+ this.#createHookedQueryBackend(backend, attempt),
23246
+ queries
23247
+ );
23248
+ }
23249
+ /** Reads hydrated adjacent nodes and their connecting edges in one statement. */
23250
+ async neighbors(source, options) {
23251
+ this.#assertNeighborKinds(source, options.edges);
23252
+ return readNeighbors(this.#neighborContext(), source, options);
23253
+ }
23254
+ /** Counts visible relationships to adjacent nodes without hydrating them. */
23255
+ async countNeighbors(source, options) {
23256
+ this.#assertNeighborKinds(source, options.edges);
23257
+ return countNeighbors(this.#neighborContext(), source, options);
23258
+ }
23259
+ #neighborContext(backend = this.#backend, attempt = 1) {
23260
+ return {
23261
+ graphId: this.graphId,
23262
+ backend: this.#createHookedQueryBackend(backend, attempt),
23263
+ schema: this.#sqlSchema(),
23264
+ defaultTemporalMode: this.#graph.defaults.temporalMode,
23265
+ registry: this.#registry
23266
+ };
23267
+ }
23268
+ #assertNeighborKinds(source, edgeKinds) {
23269
+ if (!Object.hasOwn(this.#graph.nodes, source.kind)) {
23270
+ throw new chunkG7W67PZO_cjs.KindNotFoundError(source.kind, "node", {
23271
+ graphId: this.graphId
23272
+ });
23273
+ }
23274
+ for (const edgeKind of edgeKinds) {
23275
+ if (!Object.hasOwn(this.#graph.edges, edgeKind)) {
23276
+ throw new chunkG7W67PZO_cjs.KindNotFoundError(edgeKind, "edge", {
23277
+ graphId: this.graphId
23278
+ });
23279
+ }
23280
+ }
23281
+ }
22365
23282
  /**
22366
23283
  * Reads several edge kinds from heterogeneous source nodes with round trips
22367
23284
  * independent of the number of licensed edge/source-kind combinations.
@@ -22453,7 +23370,7 @@ var StoreImplementation = class _StoreImplementation {
22453
23370
  });
22454
23371
  const edgesBySource = /* @__PURE__ */ new Map();
22455
23372
  for (const row of rows) {
22456
- const edge = chunkQR6V2BXA_cjs.rowToEdge(row);
23373
+ const edge = chunkPTFO3JI5_cjs.rowToEdge(row);
22457
23374
  const key = side === "from" ? `${edge.fromKind}\0${edge.fromId}` : `${edge.toKind}\0${edge.toId}`;
22458
23375
  const bucket = edgesBySource.get(key);
22459
23376
  if (bucket === void 0) edgesBySource.set(key, [edge]);
@@ -22515,12 +23432,28 @@ var StoreImplementation = class _StoreImplementation {
22515
23432
  * ```
22516
23433
  */
22517
23434
  async subgraph(rootId, options) {
23435
+ this.#assertPublicSubgraphOptions(options);
23436
+ return this.subgraphAtCoordinate(rootId, options);
23437
+ }
23438
+ #createSubgraphRead(rootId, options, backend = this.#baseBackend, attempt = 1) {
23439
+ this.#assertPublicSubgraphOptions(options);
23440
+ return createSubgraphRead({
23441
+ graph: this.#graph,
23442
+ graphId: this.graphId,
23443
+ rootId,
23444
+ backend: this.#createHookedQueryBackend(backend, attempt),
23445
+ dialect: chunkD5CHUSW7_cjs.getDialect(backend.dialect),
23446
+ schema: this.#schema,
23447
+ recordedReadBinding: this.#recordedReadBinding,
23448
+ options
23449
+ });
23450
+ }
23451
+ #assertPublicSubgraphOptions(options) {
22518
23452
  assertNoRecordedCoordinate(options, {
22519
23453
  code: "SUBGRAPH_RECORDED_ASOF_INTERNAL_ONLY",
22520
23454
  message: "recordedAsOf is only available through store.asOfRecorded(...).subgraph(...).",
22521
23455
  suggestion: "Use store.asOfRecorded(recordedAt).subgraph(rootId, options) instead of passing recordedAsOf directly."
22522
23456
  });
22523
- return this.subgraphAtCoordinate(rootId, options);
22524
23457
  }
22525
23458
  /**
22526
23459
  * Internal seam for {@link StoreView} / {@link RecordedStoreView}: runs a
@@ -22544,7 +23477,7 @@ var StoreImplementation = class _StoreImplementation {
22544
23477
  readCoordinate,
22545
23478
  "recorded-subgraph"
22546
23479
  ),
22547
- dialect: chunk4MZQVVPX_cjs.getDialect(this.#backend.dialect),
23480
+ dialect: chunkD5CHUSW7_cjs.getDialect(this.#backend.dialect),
22548
23481
  schema: this.#schema,
22549
23482
  recordedReadBinding: this.#recordedReadBinding,
22550
23483
  options
@@ -22623,15 +23556,15 @@ var StoreImplementation = class _StoreImplementation {
22623
23556
  const runBulkHooks = this.#createBufferedBulkHookRunner(pending);
22624
23557
  const receiptRecorder = createReceiptRecorder?.();
22625
23558
  let recordedByGraph;
22626
- const transactionOptions = receiptRecorder !== void 0 && this.#captureEnabled ? chunkIV5W7LKW_cjs.withRecordedFlushObserver(backendOptions, (instants) => {
23559
+ const transactionOptions = receiptRecorder !== void 0 && this.#captureEnabled ? chunkA22XPVBQ_cjs.withRecordedFlushObserver(backendOptions, (instants) => {
22627
23560
  recordedByGraph = instants;
22628
23561
  }) : backendOptions;
22629
23562
  try {
22630
23563
  const run = async (txBackend, nativeTransaction) => {
22631
- const mutationWitness = this.#engineNativeHistory && receiptRecorder !== void 0 ? chunkIV5W7LKW_cjs.createMutationWitness() : void 0;
23564
+ const mutationWitness = this.#engineNativeHistory && receiptRecorder !== void 0 ? chunkA22XPVBQ_cjs.createMutationWitness() : void 0;
22632
23565
  const writeTarget = mutationWitness === void 0 ? txBackend : mutationWitness.wrap(txBackend);
22633
23566
  if (mutationWitness !== void 0) {
22634
- chunkIV5W7LKW_cjs.registerRecordedIdentityMutationWitness(
23567
+ chunkA22XPVBQ_cjs.registerRecordedIdentityMutationWitness(
22635
23568
  writeTarget,
22636
23569
  txBackend,
22637
23570
  mutationWitness.sink
@@ -22647,7 +23580,7 @@ var StoreImplementation = class _StoreImplementation {
22647
23580
  frame.attempt
22648
23581
  )
22649
23582
  );
22650
- const invokeWithSchemaFenceLease = () => this.#adapterBackend === void 0 ? chunkIV5W7LKW_cjs.withTransactionSchemaFenceLease(
23583
+ const invokeWithSchemaFenceLease = () => this.#adapterBackend === void 0 ? chunkA22XPVBQ_cjs.withTransactionSchemaFenceLease(
22651
23584
  {
22652
23585
  graphId: this.graphId,
22653
23586
  schemaVersion: this.#schemaMetadata.schemaVersion
@@ -22655,7 +23588,7 @@ var StoreImplementation = class _StoreImplementation {
22655
23588
  writeTarget,
22656
23589
  invokeTransaction
22657
23590
  ) : invokeTransaction();
22658
- const output = await chunkIV5W7LKW_cjs.withWriteTransactionSession(
23591
+ const output = await chunkA22XPVBQ_cjs.withWriteTransactionSession(
22659
23592
  writeTarget,
22660
23593
  {
22661
23594
  graphId: this.graphId,
@@ -22795,7 +23728,7 @@ var StoreImplementation = class _StoreImplementation {
22795
23728
  */
22796
23729
  withTransaction(externalTx) {
22797
23730
  if (this.#captureEnabled) {
22798
- throw chunkIV5W7LKW_cjs.recordedCaptureRequiresCallbackTransactionError();
23731
+ throw chunkA22XPVBQ_cjs.recordedCaptureRequiresCallbackTransactionError();
22799
23732
  }
22800
23733
  const adopt = this.#adapterBackend?.adoptTransaction;
22801
23734
  if (adopt === void 0) {
@@ -22819,8 +23752,8 @@ var StoreImplementation = class _StoreImplementation {
22819
23752
  }
22820
23753
  const txBackend = adopt(externalTx);
22821
23754
  if (this.#captureEnabled) {
22822
- await chunkIV5W7LKW_cjs.assertRecordedCaptureTransactionIsolation(txBackend);
22823
- await chunkIV5W7LKW_cjs.lockSchemaVersionForStoreWrite(
23755
+ await chunkA22XPVBQ_cjs.assertRecordedCaptureTransactionIsolation(txBackend);
23756
+ await chunkA22XPVBQ_cjs.lockSchemaVersionForStoreWrite(
22824
23757
  {
22825
23758
  graphId: this.graphId,
22826
23759
  schemaVersion: this.#schemaMetadata.schemaVersion
@@ -22828,7 +23761,7 @@ var StoreImplementation = class _StoreImplementation {
22828
23761
  txBackend
22829
23762
  );
22830
23763
  }
22831
- const scope = this.#captureEnabled ? chunkIV5W7LKW_cjs.createRecordedTransactionScope(
23764
+ const scope = this.#captureEnabled ? chunkA22XPVBQ_cjs.createRecordedTransactionScope(
22832
23765
  txBackend,
22833
23766
  this.#batchPointRead,
22834
23767
  this.#sqlSchema()
@@ -22837,13 +23770,13 @@ var StoreImplementation = class _StoreImplementation {
22837
23770
  flush: () => Promise.resolve(EMPTY_RECORDED_FLUSH_INSTANTS)
22838
23771
  };
22839
23772
  if (this.#captureEnabled) {
22840
- await chunkIV5W7LKW_cjs.lockRecordedGraphWrite(scope.backend, this.graphId);
23773
+ await chunkA22XPVBQ_cjs.lockRecordedGraphWrite(scope.backend, this.graphId);
22841
23774
  }
22842
23775
  const receiptRecorder = createTransactionReceiptRecorder();
22843
- const mutationWitness = this.#engineNativeHistory ? chunkIV5W7LKW_cjs.createMutationWitness() : void 0;
23776
+ const mutationWitness = this.#engineNativeHistory ? chunkA22XPVBQ_cjs.createMutationWitness() : void 0;
22844
23777
  const writeTarget = mutationWitness === void 0 ? scope.backend : mutationWitness.wrap(scope.backend);
22845
23778
  if (mutationWitness !== void 0) {
22846
- chunkIV5W7LKW_cjs.registerRecordedIdentityMutationWitness(
23779
+ chunkA22XPVBQ_cjs.registerRecordedIdentityMutationWitness(
22847
23780
  writeTarget,
22848
23781
  scope.backend,
22849
23782
  mutationWitness.sink
@@ -22907,9 +23840,34 @@ var StoreImplementation = class _StoreImplementation {
22907
23840
  };
22908
23841
  return overlayPropertyDescriptors(context, { measure });
22909
23842
  }
23843
+ /** Builds graph reads that execute through one already-open transaction. */
23844
+ #createTransactionReadSurface(txBackend, attempt) {
23845
+ return {
23846
+ query: () => this.#createQueryForBackend(txBackend, void 0, attempt),
23847
+ batchOnce: (build) => this.#batchOnceForBackend(txBackend, attempt, build),
23848
+ neighbors: (source, options) => {
23849
+ this.#assertNeighborKinds(source, options.edges);
23850
+ return readNeighbors(
23851
+ this.#neighborContext(txBackend, attempt),
23852
+ source,
23853
+ options
23854
+ );
23855
+ },
23856
+ countNeighbors: (source, options) => {
23857
+ this.#assertNeighborKinds(source, options.edges);
23858
+ return countNeighbors(
23859
+ this.#neighborContext(txBackend, attempt),
23860
+ source,
23861
+ options
23862
+ );
23863
+ },
23864
+ subgraph: (rootId, options) => this.#createSubgraphRead(rootId, options, txBackend, attempt).execute()
23865
+ };
23866
+ }
22910
23867
  /**
22911
- * Builds the `{ nodes, edges, sql }` projection bound to a
22912
- * transaction-scoped backend. Shared verbatim by {@link transaction}
23868
+ * Builds the transaction context bound to a transaction-scoped backend.
23869
+ * Collections, fluent queries, and set-oriented reads all use that same
23870
+ * backend. Shared verbatim by {@link transaction}
22913
23871
  * (TypeGraph opens the tx) and {@link withTransaction} (#134 — the
22914
23872
  * caller opened it) so both surfaces resolve collections, query
22915
23873
  * factories, and the reused graph/registry identically. When history capture
@@ -22959,15 +23917,16 @@ var StoreImplementation = class _StoreImplementation {
22959
23917
  receiptRecorder
22960
23918
  ));
22961
23919
  }
22962
- const identity = this.#graph.identity === void 0 ? void 0 : chunkC3CN2C2T_cjs.createIdentityFacade(this.#identityContext(txBackend));
23920
+ const identity = this.#graph.identity === void 0 ? void 0 : chunkQ6ZVQWH7_cjs.createIdentityFacade(this.#identityContext(txBackend));
22963
23921
  const receiptIdentity = identity === void 0 || receiptRecorder === void 0 ? identity : wrapTransactionIdentity(identity, receiptRecorder);
22964
23922
  const getNodeCollection = (kind) => this.#resolveDynamicNodeCollection(nodes, kind);
22965
23923
  const base = {
22966
23924
  nodes,
22967
23925
  edges,
23926
+ ...this.#createTransactionReadSurface(txBackend, attempt),
22968
23927
  ...receiptIdentity === void 0 ? {} : { identity: receiptIdentity },
22969
23928
  backend: chunkEOLNL35G_cjs.createTransactionReadBackend(txBackend),
22970
- [chunkIV5W7LKW_cjs.TRANSACTION_RUNTIME]: { backend: txBackend, runNodeOperationHooks },
23929
+ [chunkA22XPVBQ_cjs.TRANSACTION_RUNTIME]: { backend: txBackend, runNodeOperationHooks },
22971
23930
  getNodeCollection,
22972
23931
  ...this.#edgeCollectionAccess(edges)
22973
23932
  };
@@ -22977,7 +23936,7 @@ var StoreImplementation = class _StoreImplementation {
22977
23936
  ...base,
22978
23937
  sqlAvailability: "history"
22979
23938
  };
22980
- defineUnavailableSqlGuard(withSql, () => chunkIV5W7LKW_cjs.throwHistoryUnsafeSqlAccess());
23939
+ defineUnavailableSqlGuard(withSql, () => chunkA22XPVBQ_cjs.throwHistoryUnsafeSqlAccess());
22981
23940
  } else if (this.#revisionTrackingEnabled) {
22982
23941
  withSql = {
22983
23942
  ...base,
@@ -22985,14 +23944,14 @@ var StoreImplementation = class _StoreImplementation {
22985
23944
  };
22986
23945
  defineUnavailableSqlGuard(
22987
23946
  withSql,
22988
- () => chunkIV5W7LKW_cjs.throwRevisionTrackingUnsafeSqlAccess()
23947
+ () => chunkA22XPVBQ_cjs.throwRevisionTrackingUnsafeSqlAccess()
22989
23948
  );
22990
23949
  } else if (sql2 === void 0) {
22991
23950
  withSql = { ...base, sqlAvailability: "unavailable" };
22992
23951
  } else {
22993
23952
  withSql = { ...base, sql: sql2, sqlAvailability: "available" };
22994
23953
  }
22995
- Object.defineProperty(withSql, chunkIV5W7LKW_cjs.TRANSACTION_RUNTIME, {
23954
+ Object.defineProperty(withSql, chunkA22XPVBQ_cjs.TRANSACTION_RUNTIME, {
22996
23955
  configurable: false,
22997
23956
  enumerable: false,
22998
23957
  writable: false
@@ -23033,7 +23992,7 @@ var StoreImplementation = class _StoreImplementation {
23033
23992
  for (const [index, node] of nodes.entries()) {
23034
23993
  if (node !== void 0) {
23035
23994
  loadedByReference.set(
23036
- chunkC3CN2C2T_cjs.refKey({ kind, id: chunkBXHAPCQG_cjs.requireDefined(ids[index]) }),
23995
+ chunkQ6ZVQWH7_cjs.refKey({ kind, id: chunkBXHAPCQG_cjs.requireDefined(ids[index]) }),
23037
23996
  node
23038
23997
  );
23039
23998
  }
@@ -23053,14 +24012,14 @@ var StoreImplementation = class _StoreImplementation {
23053
24012
  if (row === void 0) continue;
23054
24013
  if (!includeTombstoned && row.deleted_at !== void 0) continue;
23055
24014
  loadedByReference.set(
23056
- chunkC3CN2C2T_cjs.refKey({ kind, id: row.id }),
23057
- chunkQR6V2BXA_cjs.rowToNode(row)
24015
+ chunkQ6ZVQWH7_cjs.refKey({ kind, id: row.id }),
24016
+ chunkPTFO3JI5_cjs.rowToNode(row)
23058
24017
  );
23059
24018
  }
23060
24019
  })
23061
24020
  );
23062
24021
  return references.map(
23063
- (reference) => loadedByReference.get(chunkC3CN2C2T_cjs.refKey(reference))
24022
+ (reference) => loadedByReference.get(chunkQ6ZVQWH7_cjs.refKey(reference))
23064
24023
  );
23065
24024
  }
23066
24025
  };
@@ -23076,30 +24035,30 @@ var StoreImplementation = class _StoreImplementation {
23076
24035
  * The store is usable after clearing — new data can be created immediately.
23077
24036
  */
23078
24037
  async clear() {
23079
- const mintsAnchorOrigin = chunkIV5W7LKW_cjs.mintsOriginNamespacedAnchor(
24038
+ const mintsAnchorOrigin = chunkA22XPVBQ_cjs.mintsOriginNamespacedAnchor(
23080
24039
  this,
23081
24040
  this.#recordedRevisionOrigins.supported
23082
24041
  );
23083
24042
  if (mintsAnchorOrigin) {
23084
- await chunkIV5W7LKW_cjs.ensureRevisionOriginsRelation(
24043
+ await chunkA22XPVBQ_cjs.ensureRevisionOriginsRelation(
23085
24044
  this.#baseBackend,
23086
24045
  this.#recordedRevisionOrigins
23087
24046
  );
23088
24047
  }
23089
24048
  const doClear = async (target) => {
23090
24049
  if (this.#revisionTrackingEnabled) {
23091
- await chunkIV5W7LKW_cjs.lockRecordedGraphWrite(target, this.graphId);
24050
+ await chunkA22XPVBQ_cjs.lockRecordedGraphWrite(target, this.graphId);
23092
24051
  }
23093
24052
  if (this.#graph.identity !== void 0) {
23094
- await chunkC3CN2C2T_cjs.lockIdentityGraph(target, this.graphId);
24053
+ await chunkQ6ZVQWH7_cjs.lockIdentityGraph(target, this.graphId);
23095
24054
  }
23096
- const previousRevision = this.#revisionTrackingEnabled && !this.#captureEnabled ? await chunkIV5W7LKW_cjs.readRecordedClock(target, this.#sqlSchema(), this.graphId) : void 0;
24055
+ const previousRevision = this.#revisionTrackingEnabled && !this.#captureEnabled ? await chunkA22XPVBQ_cjs.readRecordedClock(target, this.#sqlSchema(), this.graphId) : void 0;
23097
24056
  await target.clearGraph(this.graphId);
23098
24057
  if (mintsAnchorOrigin) {
23099
- await chunkIV5W7LKW_cjs.resetRevisionOrigin(target, this.#sqlSchema(), this.graphId);
24058
+ await chunkA22XPVBQ_cjs.resetRevisionOrigin(target, this.#sqlSchema(), this.graphId);
23100
24059
  }
23101
24060
  if (this.#revisionTrackingEnabled && !this.#captureEnabled) {
23102
- await chunkIV5W7LKW_cjs.advanceRevisionClock(
24061
+ await chunkA22XPVBQ_cjs.advanceRevisionClock(
23103
24062
  target,
23104
24063
  this.#sqlSchema(),
23105
24064
  this.graphId,
@@ -23230,7 +24189,7 @@ var StoreImplementation = class _StoreImplementation {
23230
24189
  */
23231
24190
  async evolve(extension, options) {
23232
24191
  const { activeRow, storedSchema, baseline } = await this.#loadCaughtUp("evolve");
23233
- const merged = chunkU53HFE4L_cjs.mergeGraphExtension(baseline, extension);
24192
+ const merged = chunkOKA6H3B3_cjs.mergeGraphExtension(baseline, extension);
23234
24193
  if (merged === baseline) {
23235
24194
  if (baseline === this.#graph) {
23236
24195
  syncStoreReplacementRef(options?.ref, this);
@@ -23259,7 +24218,7 @@ var StoreImplementation = class _StoreImplementation {
23259
24218
  );
23260
24219
  }
23261
24220
  const identityCandidate = merged.identity === void 0 ? void 0 : this.#cloneWithGraph(merged, void 0);
23262
- const identityProvisioning = identityCandidate === void 0 ? void 0 : await chunkU53HFE4L_cjs.ensureIdentitySchemaStorage(
24221
+ const identityProvisioning = identityCandidate === void 0 ? void 0 : await chunkOKA6H3B3_cjs.ensureIdentitySchemaStorage(
23263
24222
  this.#baseBackend,
23264
24223
  this.#sqlSchema(),
23265
24224
  {
@@ -23268,7 +24227,7 @@ var StoreImplementation = class _StoreImplementation {
23268
24227
  // The evolved graph's registry — the one the candidate's own
23269
24228
  // preflight rebuilds through, so the predicate and the fill agree
23270
24229
  // on which assertions count.
23271
- registry: chunkU53HFE4L_cjs.buildKindRegistry(merged)
24230
+ registry: chunkOKA6H3B3_cjs.buildKindRegistry(merged)
23272
24231
  }
23273
24232
  );
23274
24233
  const committed = identityCandidate === void 0 ? classification.requireEmpty.length > 0 ? await commitEvolvedSchemaWhenRequiredKindsAreEmpty(
@@ -23277,12 +24236,12 @@ var StoreImplementation = class _StoreImplementation {
23277
24236
  activeRow.version,
23278
24237
  classification,
23279
24238
  storedSchema
23280
- ) : await chunkU53HFE4L_cjs.commitNewSchemaVersion(
24239
+ ) : await chunkOKA6H3B3_cjs.commitNewSchemaVersion(
23281
24240
  this.#backend,
23282
24241
  merged,
23283
24242
  activeRow.version,
23284
24243
  storedSchema
23285
- ) : await chunkU53HFE4L_cjs.commitNewSchemaVersionWithPreflight(
24244
+ ) : await chunkOKA6H3B3_cjs.commitNewSchemaVersionWithPreflight(
23286
24245
  this.#backend,
23287
24246
  merged,
23288
24247
  activeRow.version,
@@ -23668,8 +24627,8 @@ var StoreImplementation = class _StoreImplementation {
23668
24627
  */
23669
24628
  async verifyConstraintFences() {
23670
24629
  const activeRow = await this.#baseBackend.getActiveSchema(this.graphId);
23671
- const graph = activeRow === void 0 ? this.#graph : this.#catchUpToStored(chunkU53HFE4L_cjs.parseSerializedSchema(activeRow.schema_doc));
23672
- const registry = graph === this.#graph ? this.#registry : chunkU53HFE4L_cjs.buildKindRegistry(graph);
24630
+ const graph = activeRow === void 0 ? this.#graph : this.#catchUpToStored(chunkOKA6H3B3_cjs.parseSerializedSchema(activeRow.schema_doc));
24631
+ const registry = graph === this.#graph ? this.#registry : chunkOKA6H3B3_cjs.buildKindRegistry(graph);
23673
24632
  return verifyConstraintFences({
23674
24633
  graph,
23675
24634
  registry,
@@ -23928,7 +24887,7 @@ var StoreImplementation = class _StoreImplementation {
23928
24887
  */
23929
24888
  async removeKinds(names, options) {
23930
24889
  const { activeRow, storedSchema, baseline } = await this.#loadCaughtUp("remove");
23931
- const plan = chunkU53HFE4L_cjs.planRemovals(baseline, names);
24890
+ const plan = chunkOKA6H3B3_cjs.planRemovals(baseline, names);
23932
24891
  if (plan.removedNodeKinds.length === 0 && plan.removedEdgeKinds.length === 0) {
23933
24892
  if (baseline === this.#graph) {
23934
24893
  syncStoreReplacementRef(options?.ref, this);
@@ -23940,19 +24899,19 @@ var StoreImplementation = class _StoreImplementation {
23940
24899
  schemaMetadataFromRow(activeRow)
23941
24900
  );
23942
24901
  }
23943
- const compileTimeGraph = chunkU53HFE4L_cjs.stripGraphExtension(this.#graph);
23944
- const merged = plan.document === void 0 ? compileTimeGraph : chunkU53HFE4L_cjs.mergeGraphExtension(compileTimeGraph, plan.document);
23945
- const finalGraph = chunkU53HFE4L_cjs.applyDeprecatedKinds(merged, baseline.deprecatedKinds);
24902
+ const compileTimeGraph = chunkOKA6H3B3_cjs.stripGraphExtension(this.#graph);
24903
+ const merged = plan.document === void 0 ? compileTimeGraph : chunkOKA6H3B3_cjs.mergeGraphExtension(compileTimeGraph, plan.document);
24904
+ const finalGraph = chunkOKA6H3B3_cjs.applyDeprecatedKinds(merged, baseline.deprecatedKinds);
23946
24905
  const identityCascade = await this.#identityRemovalPreflight(
23947
24906
  finalGraph,
23948
24907
  plan.removedNodeKinds
23949
24908
  );
23950
- const committedRow = identityCascade === void 0 ? await chunkU53HFE4L_cjs.commitNewSchemaVersion(
24909
+ const committedRow = identityCascade === void 0 ? await chunkOKA6H3B3_cjs.commitNewSchemaVersion(
23951
24910
  this.#backend,
23952
24911
  finalGraph,
23953
24912
  activeRow.version,
23954
24913
  storedSchema
23955
- ) : await chunkU53HFE4L_cjs.commitNewSchemaVersionWithPreflight(
24914
+ ) : await chunkOKA6H3B3_cjs.commitNewSchemaVersionWithPreflight(
23956
24915
  this.#backend,
23957
24916
  finalGraph,
23958
24917
  activeRow.version,
@@ -24011,7 +24970,7 @@ var StoreImplementation = class _StoreImplementation {
24011
24970
  async #identityRemovalPreflight(finalGraph, removedNodeKinds) {
24012
24971
  if (removedNodeKinds.length === 0) return void 0;
24013
24972
  const repairClosure = finalGraph.identity !== void 0;
24014
- if (!repairClosure && !await chunkU53HFE4L_cjs.identityKindCascadeNeeded(
24973
+ if (!repairClosure && !await chunkOKA6H3B3_cjs.identityKindCascadeNeeded(
24015
24974
  this.#backend,
24016
24975
  this.#sqlSchema(),
24017
24976
  this.graphId,
@@ -24072,8 +25031,8 @@ var StoreImplementation = class _StoreImplementation {
24072
25031
  schemaMetadataFromRow(activeRow)
24073
25032
  );
24074
25033
  }
24075
- const merged = chunkU53HFE4L_cjs.applyDeprecatedKinds(baseline, nextSet);
24076
- const result = await chunkU53HFE4L_cjs.ensureSchema(this.#backend, merged, {
25034
+ const merged = chunkOKA6H3B3_cjs.applyDeprecatedKinds(baseline, nextSet);
25035
+ const result = await chunkOKA6H3B3_cjs.ensureSchema(this.#backend, merged, {
24077
25036
  preloaded: { activeRow, storedSchema },
24078
25037
  autoMigrate: true
24079
25038
  });
@@ -24081,9 +25040,9 @@ var StoreImplementation = class _StoreImplementation {
24081
25040
  return this.#cloneWithGraph(merged, options?.ref, metadata);
24082
25041
  }
24083
25042
  #catchUpToStored(storedSchema) {
24084
- const compileTimeGraph = chunkU53HFE4L_cjs.stripGraphExtension(this.#graph);
24085
- const withGraphExtension = storedSchema.extension === void 0 ? compileTimeGraph : chunkU53HFE4L_cjs.mergeGraphExtension(compileTimeGraph, storedSchema.extension);
24086
- return chunkU53HFE4L_cjs.applyDeprecatedKinds(
25043
+ const compileTimeGraph = chunkOKA6H3B3_cjs.stripGraphExtension(this.#graph);
25044
+ const withGraphExtension = storedSchema.extension === void 0 ? compileTimeGraph : chunkOKA6H3B3_cjs.mergeGraphExtension(compileTimeGraph, storedSchema.extension);
25045
+ return chunkOKA6H3B3_cjs.applyDeprecatedKinds(
24087
25046
  withGraphExtension,
24088
25047
  storedSchema.deprecatedKinds
24089
25048
  );
@@ -24101,7 +25060,7 @@ var StoreImplementation = class _StoreImplementation {
24101
25060
  * serializes the actual commit.
24102
25061
  */
24103
25062
  async #loadCaughtUp(verb) {
24104
- const activeRow = await chunkU53HFE4L_cjs.loadActiveSchemaWithBootstrap(
25063
+ const activeRow = await chunkOKA6H3B3_cjs.loadActiveSchemaWithBootstrap(
24105
25064
  this.#backend,
24106
25065
  this.graphId
24107
25066
  );
@@ -24112,7 +25071,7 @@ var StoreImplementation = class _StoreImplementation {
24112
25071
  { code }
24113
25072
  );
24114
25073
  }
24115
- const storedSchema = chunkU53HFE4L_cjs.parseSerializedSchema(activeRow.schema_doc);
25074
+ const storedSchema = chunkOKA6H3B3_cjs.parseSerializedSchema(activeRow.schema_doc);
24116
25075
  const baseline = this.#catchUpToStored(storedSchema);
24117
25076
  return { activeRow, storedSchema, baseline };
24118
25077
  }
@@ -24202,8 +25161,8 @@ var StoreImplementation = class _StoreImplementation {
24202
25161
  uniqueSidecarBatch: this.#uniqueSidecarBatch,
24203
25162
  ...identityConfig === void 0 ? {} : {
24204
25163
  identity: {
24205
- lock: (target) => chunkC3CN2C2T_cjs.lockIdentityGraph(target, this.graphId),
24206
- foldCreated: (target, references) => chunkC3CN2C2T_cjs.foldIdentityForCreatedNodes(
25164
+ lock: (target) => chunkQ6ZVQWH7_cjs.lockIdentityGraph(target, this.graphId),
25165
+ foldCreated: (target, references) => chunkQ6ZVQWH7_cjs.foldIdentityForCreatedNodes(
24207
25166
  {
24208
25167
  graphId: this.graphId,
24209
25168
  registry: this.#registry,
@@ -24213,7 +25172,7 @@ var StoreImplementation = class _StoreImplementation {
24213
25172
  target,
24214
25173
  references
24215
25174
  ),
24216
- detachDeleted: (target, ref, mode) => chunkC3CN2C2T_cjs.detachIdentityForNode(
25175
+ detachDeleted: (target, ref, mode) => chunkQ6ZVQWH7_cjs.detachIdentityForNode(
24217
25176
  {
24218
25177
  graphId: this.graphId,
24219
25178
  sameIdAcrossKinds: identityConfig.sameIdAcrossKinds,
@@ -24223,7 +25182,7 @@ var StoreImplementation = class _StoreImplementation {
24223
25182
  ref,
24224
25183
  mode
24225
25184
  ),
24226
- requireValidityEndCompatible: (target, ref, validTo) => chunkC3CN2C2T_cjs.requireNodeValidityEndCompatible(
25185
+ requireValidityEndCompatible: (target, ref, validTo) => chunkQ6ZVQWH7_cjs.requireNodeValidityEndCompatible(
24227
25186
  {
24228
25187
  graphId: this.graphId,
24229
25188
  schema: this.#sqlSchema()
@@ -24332,7 +25291,7 @@ var StoreImplementation = class _StoreImplementation {
24332
25291
  */
24333
25292
  #createHookContext(attempt = 1) {
24334
25293
  return {
24335
- operationId: chunkIV5W7LKW_cjs.generateId(),
25294
+ operationId: chunkA22XPVBQ_cjs.generateId(),
24336
25295
  graphId: this.graphId,
24337
25296
  startedAt: /* @__PURE__ */ new Date(),
24338
25297
  attempt
@@ -24465,7 +25424,7 @@ var StoreImplementation = class _StoreImplementation {
24465
25424
  }
24466
25425
  };
24467
25426
  }
24468
- #createQueryForBackend(backend, sealedCoordinate, attempt = 1) {
25427
+ #createQueryForBackend(backend, sealedCoordinate, attempt = 1, expectedSchemaVersion) {
24469
25428
  const queryBackend = this.#createHookedQueryBackend(backend, attempt);
24470
25429
  return createInternalQueryBuilder(
24471
25430
  this.graphId,
@@ -24481,7 +25440,8 @@ var StoreImplementation = class _StoreImplementation {
24481
25440
  ...this.#recordedReadBinding !== void 0 && {
24482
25441
  recordedReadBinding: this.#recordedReadBinding
24483
25442
  },
24484
- ...sealedCoordinate !== void 0 && { sealedCoordinate }
25443
+ ...sealedCoordinate !== void 0 && { sealedCoordinate },
25444
+ ...expectedSchemaVersion !== void 0 && { expectedSchemaVersion }
24485
25445
  }
24486
25446
  );
24487
25447
  }
@@ -24490,7 +25450,7 @@ var AdapterStoreImplementation = class _AdapterStoreImplementation extends Store
24490
25450
  backend;
24491
25451
  constructor(graph, backend, options, schemaMetadata) {
24492
25452
  super(graph, backend, options, schemaMetadata, backend);
24493
- this.backend = options?.history === true ? createHistoryStoreBackendProjection(this[chunkIV5W7LKW_cjs.STORE_RUNTIME].backend) : Object.freeze(chunkEOLNL35G_cjs.projectGraphBackend(this[chunkIV5W7LKW_cjs.STORE_RUNTIME].backend));
25453
+ this.backend = options?.history === true ? createHistoryStoreBackendProjection(this[chunkA22XPVBQ_cjs.STORE_RUNTIME].backend) : Object.freeze(chunkEOLNL35G_cjs.projectGraphBackend(this[chunkA22XPVBQ_cjs.STORE_RUNTIME].backend));
24494
25454
  }
24495
25455
  /**
24496
25456
  * Rebind this store's already-reconciled schema onto a fresh backend/
@@ -24683,7 +25643,7 @@ async function assertHistorySchemaOnOpen(backend, graph, options) {
24683
25643
  if (options?.history !== true) return;
24684
25644
  if (chunkJFLJVLNU_cjs.resolveRecordedTimeOwnership(backend) !== "typegraph-relations") return;
24685
25645
  const schema = options.schema === void 0 ? chunkEOLNL35G_cjs.createSqlSchema(backend.tableNames) : chunkEOLNL35G_cjs.requireSqlSchema(options.schema, "store schema");
24686
- await chunkIV5W7LKW_cjs.assertCurrentRecordedSchema(
25646
+ await chunkA22XPVBQ_cjs.assertCurrentRecordedSchema(
24687
25647
  backend,
24688
25648
  schema,
24689
25649
  graph.identity !== void 0
@@ -24710,7 +25670,7 @@ var IDENTITY_GATE_CODES = {
24710
25670
  };
24711
25671
  async function ensureSchemaWithIdentityPrecedence(backend, graph, options, gate) {
24712
25672
  try {
24713
- return await chunkU53HFE4L_cjs.ensureSchema(backend, graph, options);
25673
+ return await chunkOKA6H3B3_cjs.ensureSchema(backend, graph, options);
24714
25674
  } catch (error) {
24715
25675
  if (gate === void 0 || !isIdentityOnlyBreakingChange(error)) throw error;
24716
25676
  throw identityMigrationRequiredError(graph.id, gate, {
@@ -24746,10 +25706,10 @@ function identityMigrationRequiredError(graphId, gate, context) {
24746
25706
  );
24747
25707
  }
24748
25708
  function rebuildIdentityClosureWithSchemaFence(identityContext, writeContext) {
24749
- return chunkIV5W7LKW_cjs.runInWriteTransaction(
25709
+ return chunkA22XPVBQ_cjs.runInWriteTransaction(
24750
25710
  writeContext,
24751
25711
  identityContext.backend,
24752
- async (target) => chunkC3CN2C2T_cjs.rebuildIdentityClosureForContext({ ...identityContext, backend: target }),
25712
+ async (target) => chunkQ6ZVQWH7_cjs.rebuildIdentityClosureForContext({ ...identityContext, backend: target }),
24753
25713
  { didWrite: () => false }
24754
25714
  );
24755
25715
  }
@@ -24758,20 +25718,20 @@ async function prepareStoreWithSchema(graph, backend, options) {
24758
25718
  graph: merged,
24759
25719
  activeRow,
24760
25720
  storedSchema
24761
- } = await chunkU53HFE4L_cjs.loadAndMergeGraphExtensionDocument(backend, graph);
25721
+ } = await chunkOKA6H3B3_cjs.loadAndMergeGraphExtensionDocument(backend, graph);
24762
25722
  const identityProfileChanged = activeRow !== void 0 && storedSchema?.identity?.sameIdAcrossKinds !== merged.identity?.sameIdAcrossKinds;
24763
25723
  const identityInitialization = activeRow === void 0 && merged.identity !== void 0;
24764
25724
  const identityEnablement = identityInitialization || identityProfileChanged && storedSchema?.identity === void 0 && merged.identity !== void 0;
24765
25725
  const identitySemanticsChanged = identityProfileChanged || activeRow !== void 0 && storedSchema !== void 0 && merged.identity !== void 0 && identityOntologyChanged(
24766
25726
  storedSchema,
24767
- chunkU53HFE4L_cjs.serializeSchema(merged, activeRow.version + 1)
25727
+ chunkOKA6H3B3_cjs.serializeSchema(merged, activeRow.version + 1)
24768
25728
  );
24769
25729
  const identityGate = identitySemanticsChanged ? identityEnablement ? "enablement" : identityProfileChanged ? "profile" : "ontology" : void 0;
24770
25730
  const identityProfile = merged.identity;
24771
25731
  if (identityProfile !== void 0) {
24772
25732
  const resolvedIdentitySchema = options?.schema === void 0 ? chunkEOLNL35G_cjs.createSqlSchema(backend.tableNames) : chunkEOLNL35G_cjs.requireSqlSchema(options.schema, "store schema");
24773
- const identityRegistry = chunkU53HFE4L_cjs.buildKindRegistry(merged);
24774
- await chunkU53HFE4L_cjs.ensureIdentitySchemaStorage(backend, resolvedIdentitySchema, {
25733
+ const identityRegistry = chunkOKA6H3B3_cjs.buildKindRegistry(merged);
25734
+ await chunkOKA6H3B3_cjs.ensureIdentitySchemaStorage(backend, resolvedIdentitySchema, {
24775
25735
  graphId: merged.id,
24776
25736
  enablement: identityEnablement,
24777
25737
  registry: identityRegistry,
@@ -24901,7 +25861,7 @@ async function prepareVerifiedStore(graph, backend, options) {
24901
25861
  graph: merged,
24902
25862
  activeRow,
24903
25863
  result
24904
- } = await chunkU53HFE4L_cjs.loadAndVerifyGraph(backend, graph);
25864
+ } = await chunkOKA6H3B3_cjs.loadAndVerifyGraph(backend, graph);
24905
25865
  await assertHistorySchemaOnOpen(backend, merged, options);
24906
25866
  return {
24907
25867
  graph: merged,
@@ -24964,5 +25924,5 @@ exports.min = min;
24964
25924
  exports.offsetFragment = offsetFragment;
24965
25925
  exports.orderByFragment = orderByFragment;
24966
25926
  exports.sum = sum;
24967
- //# sourceMappingURL=chunk-FHFPUORN.cjs.map
24968
- //# sourceMappingURL=chunk-FHFPUORN.cjs.map
25927
+ //# sourceMappingURL=chunk-CNFKFE5L.cjs.map
25928
+ //# sourceMappingURL=chunk-CNFKFE5L.cjs.map