@nicia-ai/typegraph 0.59.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 (81) hide show
  1. package/CHANGELOG.md +20 -0
  2. package/README.md +3 -0
  3. package/dist/backend/postgres/pglite-store.cjs +1 -1
  4. package/dist/backend/postgres/pglite-store.d.cts +2 -2
  5. package/dist/backend/postgres/pglite-store.d.ts +2 -2
  6. package/dist/backend/postgres/pglite-store.js +1 -1
  7. package/dist/backend/sqlite/local-store.cjs +1 -1
  8. package/dist/backend/sqlite/local-store.d.cts +2 -2
  9. package/dist/backend/sqlite/local-store.d.ts +2 -2
  10. package/dist/backend/sqlite/local-store.js +1 -1
  11. package/dist/{chunk-MKQY4ZLZ.js → chunk-2DKIJP2R.js} +73 -41
  12. package/dist/chunk-2DKIJP2R.js.map +1 -0
  13. package/dist/{chunk-6BVZHDAZ.js → chunk-43DOTETB.js} +3 -3
  14. package/dist/{chunk-6BVZHDAZ.js.map → chunk-43DOTETB.js.map} +1 -1
  15. package/dist/{chunk-IV5W7LKW.cjs → chunk-A22XPVBQ.cjs} +2 -2
  16. package/dist/chunk-A22XPVBQ.cjs.map +1 -0
  17. package/dist/{chunk-W4NT4IMI.js → chunk-B4P4DAW3.js} +3 -3
  18. package/dist/{chunk-W4NT4IMI.js.map → chunk-B4P4DAW3.js.map} +1 -1
  19. package/dist/{chunk-CA76FVJB.cjs → chunk-CNFKFE5L.cjs} +399 -367
  20. package/dist/chunk-CNFKFE5L.cjs.map +1 -0
  21. package/dist/{chunk-EN67I47R.cjs → chunk-EHDLHPMK.cjs} +9 -9
  22. package/dist/{chunk-EN67I47R.cjs.map → chunk-EHDLHPMK.cjs.map} +1 -1
  23. package/dist/{chunk-V3JKR2CN.js → chunk-FTDRMXIJ.js} +5 -5
  24. package/dist/{chunk-V3JKR2CN.js.map → chunk-FTDRMXIJ.js.map} +1 -1
  25. package/dist/{chunk-3GX5HTPP.js → chunk-ILVXUOQY.js} +3 -3
  26. package/dist/{chunk-3GX5HTPP.js.map → chunk-ILVXUOQY.js.map} +1 -1
  27. package/dist/{chunk-XGYUUUHY.cjs → chunk-KGQVK2II.cjs} +40 -40
  28. package/dist/{chunk-XGYUUUHY.cjs.map → chunk-KGQVK2II.cjs.map} +1 -1
  29. package/dist/{chunk-BPYZUJX5.cjs → chunk-MTJAT6UO.cjs} +5 -5
  30. package/dist/{chunk-BPYZUJX5.cjs.map → chunk-MTJAT6UO.cjs.map} +1 -1
  31. package/dist/{chunk-2GZL5ED3.cjs → chunk-OKA6H3B3.cjs} +19 -19
  32. package/dist/{chunk-2GZL5ED3.cjs.map → chunk-OKA6H3B3.cjs.map} +1 -1
  33. package/dist/{chunk-26CL47SW.cjs → chunk-PTFO3JI5.cjs} +110 -110
  34. package/dist/{chunk-26CL47SW.cjs.map → chunk-PTFO3JI5.cjs.map} +1 -1
  35. package/dist/{chunk-UOHFBYYH.cjs → chunk-Q6ZVQWH7.cjs} +36 -36
  36. package/dist/{chunk-UOHFBYYH.cjs.map → chunk-Q6ZVQWH7.cjs.map} +1 -1
  37. package/dist/{chunk-HWWPL2YL.js → chunk-QWIR5533.js} +2 -2
  38. package/dist/chunk-QWIR5533.js.map +1 -0
  39. package/dist/{chunk-DZ3ETMXF.js → chunk-UVQMUBZ6.js} +6 -6
  40. package/dist/{chunk-DZ3ETMXF.js.map → chunk-UVQMUBZ6.js.map} +1 -1
  41. package/dist/{chunk-E6PU35DE.js → chunk-W6K6NSRT.js} +4 -4
  42. package/dist/{chunk-E6PU35DE.js.map → chunk-W6K6NSRT.js.map} +1 -1
  43. package/dist/graph-merge/index.cjs +119 -119
  44. package/dist/graph-merge/index.d.cts +2 -2
  45. package/dist/graph-merge/index.d.ts +2 -2
  46. package/dist/graph-merge/index.js +7 -7
  47. package/dist/{graph-templates-DQnmCPkd.d.ts → graph-templates-ClBhrXiA.d.ts} +1 -1
  48. package/dist/{graph-templates-Buh-RlmQ.d.cts → graph-templates-DfmKDARd.d.cts} +1 -1
  49. package/dist/index.cjs +68 -68
  50. package/dist/index.d.cts +3 -3
  51. package/dist/index.d.ts +3 -3
  52. package/dist/index.js +8 -8
  53. package/dist/interchange/index.cjs +28 -28
  54. package/dist/interchange/index.d.cts +2 -2
  55. package/dist/interchange/index.d.ts +2 -2
  56. package/dist/interchange/index.js +5 -5
  57. package/dist/{local-store-impl-GFBZBCTN.cjs → local-store-impl-QGSRYFZF.cjs} +9 -9
  58. package/dist/{local-store-impl-GFBZBCTN.cjs.map → local-store-impl-QGSRYFZF.cjs.map} +1 -1
  59. package/dist/{local-store-impl-EPUMDNQJ.js → local-store-impl-VEVK2VGA.js} +8 -8
  60. package/dist/{local-store-impl-EPUMDNQJ.js.map → local-store-impl-VEVK2VGA.js.map} +1 -1
  61. package/dist/{pglite-store-impl-DB4RRLB7.cjs → pglite-store-impl-33CI3P3M.cjs} +9 -9
  62. package/dist/{pglite-store-impl-DB4RRLB7.cjs.map → pglite-store-impl-33CI3P3M.cjs.map} +1 -1
  63. package/dist/{pglite-store-impl-M5PWKN7Z.js → pglite-store-impl-RDPTOOP3.js} +8 -8
  64. package/dist/{pglite-store-impl-M5PWKN7Z.js.map → pglite-store-impl-RDPTOOP3.js.map} +1 -1
  65. package/dist/profiler/index.d.cts +2 -2
  66. package/dist/profiler/index.d.ts +2 -2
  67. package/dist/provenance/index.cjs +15 -15
  68. package/dist/provenance/index.d.cts +2 -2
  69. package/dist/provenance/index.d.ts +2 -2
  70. package/dist/provenance/index.js +2 -2
  71. package/dist/schema/index.cjs +34 -34
  72. package/dist/schema/index.d.cts +3 -3
  73. package/dist/schema/index.d.ts +3 -3
  74. package/dist/schema/index.js +4 -4
  75. package/dist/{store-sLu0hcRm.d.ts → store-B5WZ8E5m.d.ts} +225 -215
  76. package/dist/{store-CvtRQ8Nb.d.cts → store-DdhFpX53.d.cts} +225 -215
  77. package/package.json +1 -1
  78. package/dist/chunk-CA76FVJB.cjs.map +0 -1
  79. package/dist/chunk-HWWPL2YL.js.map +0 -1
  80. package/dist/chunk-IV5W7LKW.cjs.map +0 -1
  81. package/dist/chunk-MKQY4ZLZ.js.map +0 -1
@@ -2,17 +2,17 @@
2
2
 
3
3
  var chunk7BHUIAZR_cjs = require('./chunk-7BHUIAZR.cjs');
4
4
  var chunkJFLJVLNU_cjs = require('./chunk-JFLJVLNU.cjs');
5
- var chunk26CL47SW_cjs = require('./chunk-26CL47SW.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 chunk2GZL5ED3_cjs = require('./chunk-2GZL5ED3.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 chunkUOHFBYYH_cjs = require('./chunk-UOHFBYYH.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');
@@ -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
  `;
@@ -3760,7 +3760,7 @@ function neighborOutputNames() {
3760
3760
  ];
3761
3761
  }
3762
3762
  function mapEdge(row) {
3763
- return chunk26CL47SW_cjs.rowToEdge({
3763
+ return chunkPTFO3JI5_cjs.rowToEdge({
3764
3764
  id: String(row["edge_id"]),
3765
3765
  kind: String(row["edge_kind"]),
3766
3766
  from_kind: String(row["edge_from_kind"]),
@@ -3788,7 +3788,7 @@ function mapEdge(row) {
3788
3788
  });
3789
3789
  }
3790
3790
  function mapNode(row) {
3791
- return chunk26CL47SW_cjs.rowToNode({
3791
+ return chunkPTFO3JI5_cjs.rowToNode({
3792
3792
  id: String(row["node_id"]),
3793
3793
  kind: String(row["node_kind"]),
3794
3794
  props: row["node_props"],
@@ -4573,7 +4573,7 @@ function mapSubgraphNodeRow(row, projectionPlan) {
4573
4573
  const kindPlan = projectionPlan.projectedKinds.get(row.kind);
4574
4574
  if (kindPlan === void 0) {
4575
4575
  const normalizedRow = normalizeSubgraphRowTimestamps(row);
4576
- return chunk26CL47SW_cjs.rowToNode({
4576
+ return chunkPTFO3JI5_cjs.rowToNode({
4577
4577
  ...normalizedRow,
4578
4578
  props: normalizeProps(normalizedRow.props)
4579
4579
  });
@@ -4583,7 +4583,7 @@ function mapSubgraphNodeRow(row, projectionPlan) {
4583
4583
  id: row.id
4584
4584
  };
4585
4585
  if (kindPlan.includeMeta) {
4586
- projectedNode["meta"] = chunk26CL47SW_cjs.rowToNodeMeta(normalizeSubgraphRowTimestamps(row));
4586
+ projectedNode["meta"] = chunkPTFO3JI5_cjs.rowToNodeMeta(normalizeSubgraphRowTimestamps(row));
4587
4587
  }
4588
4588
  applyProjectedFields(projectedNode, row, kindPlan);
4589
4589
  return projectedNode;
@@ -4592,7 +4592,7 @@ function mapSubgraphEdgeRow(row, projectionPlan) {
4592
4592
  const kindPlan = projectionPlan.projectedKinds.get(row.kind);
4593
4593
  if (kindPlan === void 0) {
4594
4594
  const normalizedRow = normalizeSubgraphRowTimestamps(row);
4595
- return chunk26CL47SW_cjs.rowToEdge({
4595
+ return chunkPTFO3JI5_cjs.rowToEdge({
4596
4596
  ...normalizedRow,
4597
4597
  props: normalizeProps(normalizedRow.props)
4598
4598
  });
@@ -4606,7 +4606,7 @@ function mapSubgraphEdgeRow(row, projectionPlan) {
4606
4606
  toId: row.to_id
4607
4607
  };
4608
4608
  if (kindPlan.includeMeta) {
4609
- projectedEdge["meta"] = chunk26CL47SW_cjs.rowToEdgeMeta(normalizeSubgraphRowTimestamps(row));
4609
+ projectedEdge["meta"] = chunkPTFO3JI5_cjs.rowToEdgeMeta(normalizeSubgraphRowTimestamps(row));
4610
4610
  }
4611
4611
  applyProjectedFields(projectedEdge, row, kindPlan);
4612
4612
  return projectedEdge;
@@ -11118,8 +11118,8 @@ async function runFulltextRebuild(driver, ctx, nodeKind, options) {
11118
11118
  "This backend declares no fulltext capability, so there is no fulltext index to rebuild. Use a backend with fulltext support."
11119
11119
  );
11120
11120
  }
11121
- chunkBPYZUJX5_cjs.assertFulltextMember(backend.upsertFulltext, "upsertFulltext", backend);
11122
- chunkBPYZUJX5_cjs.assertFulltextMember(backend.deleteFulltext, "deleteFulltext", backend);
11121
+ chunkMTJAT6UO_cjs.assertFulltextMember(backend.upsertFulltext, "upsertFulltext", backend);
11122
+ chunkMTJAT6UO_cjs.assertFulltextMember(backend.deleteFulltext, "deleteFulltext", backend);
11123
11123
  const pageSize = validatePageSize(options.pageSize);
11124
11124
  const maxSkippedIds = validateMaxSkippedIds(options.maxSkippedIds);
11125
11125
  const targetKinds = nodeKind === void 0 ? [...registry.nodeKinds.keys()] : [nodeKind];
@@ -11174,7 +11174,7 @@ async function runFulltextRebuild(driver, ctx, nodeKind, options) {
11174
11174
  });
11175
11175
  }
11176
11176
  } else {
11177
- chunkBPYZUJX5_cjs.assertFulltextMember(
11177
+ chunkMTJAT6UO_cjs.assertFulltextMember(
11178
11178
  target.upsertFulltext,
11179
11179
  "upsertFulltext",
11180
11180
  target
@@ -11197,7 +11197,7 @@ async function runFulltextRebuild(driver, ctx, nodeKind, options) {
11197
11197
  });
11198
11198
  }
11199
11199
  } else {
11200
- chunkBPYZUJX5_cjs.assertFulltextMember(
11200
+ chunkMTJAT6UO_cjs.assertFulltextMember(
11201
11201
  target.deleteFulltext,
11202
11202
  "deleteFulltext",
11203
11203
  target
@@ -11248,7 +11248,7 @@ function processPage(schema, rows) {
11248
11248
  skippedIds.push(row.id);
11249
11249
  continue;
11250
11250
  }
11251
- const computed = chunkBPYZUJX5_cjs.computeFulltextContent(schema, parsed);
11251
+ const computed = chunkMTJAT6UO_cjs.computeFulltextContent(schema, parsed);
11252
11252
  if (computed === void 0) {
11253
11253
  toDelete.push(row.id);
11254
11254
  } else {
@@ -11335,7 +11335,7 @@ async function fetchNodesForRows(backend, batchPointRead, graphId, rows) {
11335
11335
  function tryResolveSearchSlot(ctx, nodeKind, fieldPath) {
11336
11336
  const nodeType = ctx.registry.getNodeType(nodeKind);
11337
11337
  if (nodeType === void 0) return void 0;
11338
- const fields = chunkBPYZUJX5_cjs.getEmbeddingFields(nodeType.schema);
11338
+ const fields = chunkMTJAT6UO_cjs.getEmbeddingFields(nodeType.schema);
11339
11339
  const field2 = fields.find((entry2) => entry2.fieldPath === fieldPath);
11340
11340
  if (field2 === void 0) return void 0;
11341
11341
  return {
@@ -11657,7 +11657,7 @@ async function executeHybridSearch(ctx, nodeKind, options) {
11657
11657
  ...candidates === void 0 ? {} : { candidates }
11658
11658
  });
11659
11659
  return rows.map((row, index) => {
11660
- const typedNode = chunk26CL47SW_cjs.rowToNode(row.node);
11660
+ const typedNode = chunkPTFO3JI5_cjs.rowToNode(row.node);
11661
11661
  return {
11662
11662
  node: typedNode,
11663
11663
  score: row.fusedScore,
@@ -11936,13 +11936,13 @@ async function fetchNodesByIds(backend, batchPointRead, graphId, nodeKind, ids)
11936
11936
  const rows = await bound.getNodes(graphId, nodeKind, ids);
11937
11937
  for (const row of rows) {
11938
11938
  if (row.deleted_at !== void 0) continue;
11939
- map.set(row.id, chunk26CL47SW_cjs.rowToNode(row));
11939
+ map.set(row.id, chunkPTFO3JI5_cjs.rowToNode(row));
11940
11940
  }
11941
11941
  return map;
11942
11942
  }
11943
11943
  for (const id of ids) {
11944
11944
  const row = await backend.getNode(graphId, nodeKind, id);
11945
- if (row && row.deleted_at === void 0) map.set(row.id, chunk26CL47SW_cjs.rowToNode(row));
11945
+ if (row && row.deleted_at === void 0) map.set(row.id, chunkPTFO3JI5_cjs.rowToNode(row));
11946
11946
  }
11947
11947
  return map;
11948
11948
  }
@@ -12223,7 +12223,7 @@ function declaredPathsForEntity(graph, entity) {
12223
12223
  );
12224
12224
  for (const schema of schemas) {
12225
12225
  for (const path of declaredPropertyPaths(
12226
- chunk2GZL5ED3_cjs.serializeSchemaProperties(schema)
12226
+ chunkOKA6H3B3_cjs.serializeSchemaProperties(schema)
12227
12227
  )) {
12228
12228
  paths.add(pathToPointer(path));
12229
12229
  }
@@ -12288,7 +12288,7 @@ async function readEntityPopulation(ctx, entity, paths, currentTimestamp) {
12288
12288
  function populationForKind(entity, kind, schema, populations) {
12289
12289
  const population = populations.get(kind);
12290
12290
  const count2 = population?.count ?? 0;
12291
- const declaredPaths = declaredPropertyPaths(chunk2GZL5ED3_cjs.serializeSchemaProperties(schema)).map((path) => pathToPointer(path)).toSorted();
12291
+ const declaredPaths = declaredPropertyPaths(chunkOKA6H3B3_cjs.serializeSchemaProperties(schema)).map((path) => pathToPointer(path)).toSorted();
12292
12292
  return {
12293
12293
  entity,
12294
12294
  kind,
@@ -13103,7 +13103,7 @@ function temporaryTableCapabilityError(ctx, algorithm, sqlState, cause) {
13103
13103
  }
13104
13104
  async function runWorkingTableRounds(ctx, options, plan, backend) {
13105
13105
  const temporaryBackend = requireTemporaryStatements(backend);
13106
- const runId = chunkIV5W7LKW_cjs.generateId();
13106
+ const runId = chunkA22XPVBQ_cjs.generateId();
13107
13107
  const workingTable = chunkMAYQDOZB_cjs.sql.identifier(
13108
13108
  `typegraph_iterative_${runId.replaceAll("-", "_")}`
13109
13109
  );
@@ -15781,18 +15781,18 @@ function lowerBoundRequiresWrite(requested, stored) {
15781
15781
  return requestedValidFrom !== void 0 && requestedValidFrom !== null && !chunkNWJV4UVW_cjs.isCanonicalIsoDate(requestedValidFrom);
15782
15782
  }
15783
15783
  function upsertWindowChanges(requested, current) {
15784
- return lowerBoundRequiresWrite(requested, current.valid_from) || requested?.clearValidTo === true && chunk26CL47SW_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);
15785
15785
  }
15786
15786
  function windowAfterUpsertCreate(requested) {
15787
15787
  return {
15788
15788
  valid_from: requested.validFrom === null ? void 0 : requested.validFrom ?? UNKNOWN_VALIDITY_LOWER_BOUND,
15789
- valid_to: chunk26CL47SW_cjs.validityEndAfterMutation(requested, void 0)
15789
+ valid_to: chunkPTFO3JI5_cjs.validityEndAfterMutation(requested, void 0)
15790
15790
  };
15791
15791
  }
15792
15792
  function windowAfterUpsertUpdate(current, requested) {
15793
15793
  return {
15794
15794
  valid_from: current.valid_from,
15795
- valid_to: chunk26CL47SW_cjs.validityEndAfterMutation(requested, current.valid_to)
15795
+ valid_to: chunkPTFO3JI5_cjs.validityEndAfterMutation(requested, current.valid_to)
15796
15796
  };
15797
15797
  }
15798
15798
  function shouldCoalesceUpsert(existing, options, runDirtyCheck) {
@@ -15998,7 +15998,7 @@ function createEdgeCollection(config) {
15998
15998
  },
15999
15999
  async getByIds(ids, options) {
16000
16000
  if (ids.length === 0) return [];
16001
- const rowsById = await chunkIV5W7LKW_cjs.getEdgeRowsByIds(
16001
+ const rowsById = await chunkA22XPVBQ_cjs.getEdgeRowsByIds(
16002
16002
  backend,
16003
16003
  batchPointRead,
16004
16004
  graphId,
@@ -16103,18 +16103,18 @@ function createEdgeCollection(config) {
16103
16103
  async bulkUpsertById(items) {
16104
16104
  if (items.length === 0) return [];
16105
16105
  for (const item of items) {
16106
- chunk26CL47SW_cjs.assertValidityEndMutation(item, {
16106
+ chunkPTFO3JI5_cjs.assertValidityEndMutation(item, {
16107
16107
  entityType: "edge",
16108
16108
  kind,
16109
16109
  id: item.id
16110
16110
  });
16111
16111
  if (item.clearValidTo === true) {
16112
- chunk26CL47SW_cjs.assertClearValidToSupported(backend, "edge");
16112
+ chunkPTFO3JI5_cjs.assertClearValidToSupported(backend, "edge");
16113
16113
  }
16114
16114
  }
16115
16115
  const upsertAll = async (target) => {
16116
16116
  const ids = items.map((item) => item.id);
16117
- const existingMap = await chunkIV5W7LKW_cjs.getEdgeRowsByIds(
16117
+ const existingMap = await chunkA22XPVBQ_cjs.getEdgeRowsByIds(
16118
16118
  target,
16119
16119
  batchPointRead,
16120
16120
  graphId,
@@ -16282,7 +16282,7 @@ function createEdgeCollection(config) {
16282
16282
  }
16283
16283
  return { results: results2, mutations: toCreate.length + toUpdate.length };
16284
16284
  };
16285
- const { results, mutations } = await chunk26CL47SW_cjs.runResolvedMutationSetConverging(
16285
+ const { results, mutations } = await chunkPTFO3JI5_cjs.runResolvedMutationSetConverging(
16286
16286
  "edge",
16287
16287
  backend,
16288
16288
  () => chunkEOLNL35G_cjs.runOptionallyInTransaction(backend, (target) => upsertAll(target))
@@ -16312,7 +16312,7 @@ function createEdgeCollection(config) {
16312
16312
  return result === void 0 ? void 0 : narrowEdge(result);
16313
16313
  },
16314
16314
  async getOrCreateByEndpoints(from, to, props, options) {
16315
- chunk26CL47SW_cjs.assertValidityEndMutation(options ?? {}, {
16315
+ chunkPTFO3JI5_cjs.assertValidityEndMutation(options ?? {}, {
16316
16316
  entityType: "edge",
16317
16317
  kind
16318
16318
  });
@@ -16347,7 +16347,7 @@ function createEdgeCollection(config) {
16347
16347
  async bulkGetOrCreateByEndpoints(items, options) {
16348
16348
  if (items.length === 0) return [];
16349
16349
  for (const item of items) {
16350
- chunk26CL47SW_cjs.assertValidityEndMutation(item, {
16350
+ chunkPTFO3JI5_cjs.assertValidityEndMutation(item, {
16351
16351
  entityType: "edge",
16352
16352
  kind
16353
16353
  });
@@ -16503,7 +16503,7 @@ function createNodeCollection(config) {
16503
16503
  },
16504
16504
  async getByIds(ids, options) {
16505
16505
  if (ids.length === 0) return [];
16506
- const rowsById = await chunkIV5W7LKW_cjs.getNodeRowsByIds(
16506
+ const rowsById = await chunkA22XPVBQ_cjs.getNodeRowsByIds(
16507
16507
  backend,
16508
16508
  batchPointRead,
16509
16509
  graphId,
@@ -16671,13 +16671,13 @@ function createNodeCollection(config) {
16671
16671
  return this.upsertByIdFromRecord(id, props, options);
16672
16672
  },
16673
16673
  async upsertByIdFromRecord(id, data, options) {
16674
- chunk26CL47SW_cjs.assertValidityEndMutation(options ?? {}, {
16674
+ chunkPTFO3JI5_cjs.assertValidityEndMutation(options ?? {}, {
16675
16675
  entityType: "node",
16676
16676
  kind,
16677
16677
  id
16678
16678
  });
16679
16679
  if (options?.clearValidTo === true) {
16680
- chunk26CL47SW_cjs.assertClearValidToSupported(backend, "node");
16680
+ chunkPTFO3JI5_cjs.assertClearValidToSupported(backend, "node");
16681
16681
  }
16682
16682
  const existing = await backend.getNode(graphId, kind, id);
16683
16683
  const coalesces = (row) => {
@@ -16750,11 +16750,11 @@ function createNodeCollection(config) {
16750
16750
  await config.maybeRefreshStatisticsAfterBulk?.(attempt.value.length);
16751
16751
  return narrowNodes(attempt.value);
16752
16752
  }
16753
- const results = await chunk26CL47SW_cjs.runResolvedMutationSetConverging(
16753
+ const results = await chunkPTFO3JI5_cjs.runResolvedMutationSetConverging(
16754
16754
  "node",
16755
16755
  backend,
16756
16756
  () => chunkEOLNL35G_cjs.runOptionallyInTransaction(backend, async (target) => {
16757
- const rows = await chunkIV5W7LKW_cjs.getNodeRowsByIds(
16757
+ const rows = await chunkA22XPVBQ_cjs.getNodeRowsByIds(
16758
16758
  target,
16759
16759
  batchPointRead,
16760
16760
  graphId,
@@ -16801,13 +16801,13 @@ function createNodeCollection(config) {
16801
16801
  async bulkUpsertById(items) {
16802
16802
  if (items.length === 0) return [];
16803
16803
  for (const item of items) {
16804
- chunk26CL47SW_cjs.assertValidityEndMutation(item, {
16804
+ chunkPTFO3JI5_cjs.assertValidityEndMutation(item, {
16805
16805
  entityType: "node",
16806
16806
  kind,
16807
16807
  id: item.id
16808
16808
  });
16809
16809
  if (item.clearValidTo === true) {
16810
- chunk26CL47SW_cjs.assertClearValidToSupported(backend, "node");
16810
+ chunkPTFO3JI5_cjs.assertClearValidToSupported(backend, "node");
16811
16811
  }
16812
16812
  }
16813
16813
  const upsertAll = async (target) => {
@@ -16947,7 +16947,7 @@ function createNodeCollection(config) {
16947
16947
  }
16948
16948
  return { results: results2, mutations: toCreate.length + toUpdate.length };
16949
16949
  };
16950
- const { results, mutations } = await chunk26CL47SW_cjs.runResolvedMutationSetConverging(
16950
+ const { results, mutations } = await chunkPTFO3JI5_cjs.runResolvedMutationSetConverging(
16951
16951
  "node",
16952
16952
  backend,
16953
16953
  () => chunkEOLNL35G_cjs.runOptionallyInTransaction(backend, (target) => upsertAll(target))
@@ -17228,7 +17228,7 @@ function createHistoryStoreBackendProjection(backend) {
17228
17228
  // src/store/introspect.ts
17229
17229
  function introspectSchema(graph, context) {
17230
17230
  const extension = graph.extension;
17231
- const { nodes: runtimeNodeNames, edges: runtimeEdgeNames } = chunk2GZL5ED3_cjs.extensionKindNames(extension);
17231
+ const { nodes: runtimeNodeNames, edges: runtimeEdgeNames } = chunkOKA6H3B3_cjs.extensionKindNames(extension);
17232
17232
  const deprecated = graph.deprecatedKinds;
17233
17233
  const kinds = [];
17234
17234
  for (const [name, registration] of Object.entries(graph.nodes)) {
@@ -17239,7 +17239,7 @@ function introspectSchema(graph, context) {
17239
17239
  description: reg.type.description,
17240
17240
  annotations: reg.type.annotations,
17241
17241
  deprecated: deprecated.has(name),
17242
- properties: chunk2GZL5ED3_cjs.serializeSchemaProperties(reg.type.schema),
17242
+ properties: chunkOKA6H3B3_cjs.serializeSchemaProperties(reg.type.schema),
17243
17243
  unique: (reg.unique ?? []).map((constraint) => ({
17244
17244
  name: constraint.name,
17245
17245
  fields: [...constraint.fields],
@@ -17260,17 +17260,17 @@ function introspectSchema(graph, context) {
17260
17260
  to: chunkFSSQ4YNU_cjs.projectTargetKinds(reg.to),
17261
17261
  cardinality: reg.cardinality ?? "many",
17262
17262
  endpointExistence: reg.endpointExistence ?? "notDeleted",
17263
- properties: chunk2GZL5ED3_cjs.serializeSchemaProperties(edgeType.schema),
17263
+ properties: chunkOKA6H3B3_cjs.serializeSchemaProperties(edgeType.schema),
17264
17264
  annotations: edgeType.annotations,
17265
17265
  deprecated: deprecated.has(name)
17266
17266
  });
17267
17267
  }
17268
- const runtimeOntologyKeys = chunk2GZL5ED3_cjs.buildGraphExtensionOntologyKeySet(extension);
17268
+ const runtimeOntologyKeys = chunkOKA6H3B3_cjs.buildGraphExtensionOntologyKeySet(extension);
17269
17269
  const ontology = graph.ontology.map((relation) => ({
17270
17270
  metaEdge: relation.metaEdge.name,
17271
17271
  from: chunkUVVDQGOY_cjs.getTypeName(relation.from),
17272
17272
  to: chunkUVVDQGOY_cjs.getTypeName(relation.to),
17273
- origin: runtimeOntologyKeys.has(chunk2GZL5ED3_cjs.compileTimeOntologyKey(relation)) ? "runtime" : "compile-time"
17273
+ origin: runtimeOntologyKeys.has(chunkOKA6H3B3_cjs.compileTimeOntologyKey(relation)) ? "runtime" : "compile-time"
17274
17274
  }));
17275
17275
  return {
17276
17276
  graphId: context.graphId,
@@ -17983,7 +17983,7 @@ async function computeIndexSignature(dialect, targetTableName, declaration) {
17983
17983
  const hashable = {
17984
17984
  dialect,
17985
17985
  targetTableName,
17986
- declaration: chunk2GZL5ED3_cjs.serializeIndexDeclaration(declaration)
17986
+ declaration: chunkOKA6H3B3_cjs.serializeIndexDeclaration(declaration)
17987
17987
  };
17988
17988
  const json = JSON.stringify(hashable, chunkWEXAMJTA_cjs.sortedReplacer);
17989
17989
  return chunkZY4GXIVN_cjs.sha256Hex(json, 16);
@@ -18005,7 +18005,7 @@ async function materializeRemovals(context, options = {}) {
18005
18005
  await ensureFocusedStatusTable(backend, backend.ensureKindRemovalsTable);
18006
18006
  await reconcilePendingRemovals(context);
18007
18007
  const activeRow = await backend.getActiveSchema(graphId);
18008
- const activeSchema = activeRow === void 0 ? void 0 : chunk2GZL5ED3_cjs.parseSerializedSchema(activeRow.schema_doc);
18008
+ const activeSchema = activeRow === void 0 ? void 0 : chunkOKA6H3B3_cjs.parseSerializedSchema(activeRow.schema_doc);
18009
18009
  const reclaimedVectorFields = await reclaimRemovedVectorFieldTables(
18010
18010
  context,
18011
18011
  activeRow
@@ -18074,14 +18074,14 @@ async function reconcilePendingRemovals(context) {
18074
18074
  const reconciliations = [];
18075
18075
  const stopAtVersion = marker ?? 1;
18076
18076
  let currentRow = activeRow;
18077
- let currentSchema = chunk2GZL5ED3_cjs.parseSerializedSchema(activeRow.schema_doc);
18077
+ let currentSchema = chunkOKA6H3B3_cjs.parseSerializedSchema(activeRow.schema_doc);
18078
18078
  while (currentRow.version > stopAtVersion) {
18079
18079
  const priorRow = await backend.getSchemaVersion(
18080
18080
  graphId,
18081
18081
  currentRow.version - 1
18082
18082
  );
18083
18083
  if (priorRow === void 0) break;
18084
- const priorSchema = chunk2GZL5ED3_cjs.parseSerializedSchema(priorRow.schema_doc);
18084
+ const priorSchema = chunkOKA6H3B3_cjs.parseSerializedSchema(priorRow.schema_doc);
18085
18085
  for (const entity of ENTITY_KINDS) {
18086
18086
  const priorEntries = priorSchema[entity === "node" ? "nodes" : "edges"];
18087
18087
  const currentEntries = currentSchema[entity === "node" ? "nodes" : "edges"];
@@ -18146,7 +18146,7 @@ async function materializeOne2(row, ctx) {
18146
18146
  ctx.graphId,
18147
18147
  async (target) => {
18148
18148
  const activeRow = await target.getActiveSchema(ctx.graphId);
18149
- const activeSchema = activeRow === void 0 ? void 0 : chunk2GZL5ED3_cjs.parseSerializedSchema(activeRow.schema_doc);
18149
+ const activeSchema = activeRow === void 0 ? void 0 : chunkOKA6H3B3_cjs.parseSerializedSchema(activeRow.schema_doc);
18150
18150
  if (liveKindNamesFrom(activeSchema)[row.entity].has(row.kindName)) {
18151
18151
  return "skipped";
18152
18152
  }
@@ -18221,7 +18221,7 @@ async function closeRecordedAndDeleteLiveRows(ctx, row, target) {
18221
18221
  await executeDeleteStatements(target, deleteStatements);
18222
18222
  return;
18223
18223
  }
18224
- await chunkIV5W7LKW_cjs.closeRecordedHardDeletedKind(
18224
+ await chunkA22XPVBQ_cjs.closeRecordedHardDeletedKind(
18225
18225
  target,
18226
18226
  recordedSchema,
18227
18227
  ctx.graphId,
@@ -18309,7 +18309,7 @@ async function resolveRemovedKindEmbeddingSlots(backend, row) {
18309
18309
  if (priorVersion < 1) return [];
18310
18310
  const priorRow = await backend.getSchemaVersion(row.graphId, priorVersion);
18311
18311
  if (priorRow === void 0) return [];
18312
- const priorSchema = chunk2GZL5ED3_cjs.parseSerializedSchema(priorRow.schema_doc);
18312
+ const priorSchema = chunkOKA6H3B3_cjs.parseSerializedSchema(priorRow.schema_doc);
18313
18313
  const slots = /* @__PURE__ */ new Map();
18314
18314
  for (const declaration of priorSchema.indexes ?? []) {
18315
18315
  if (declaration.entity === "vector" && declaration.kind === row.kindName) {
@@ -18346,14 +18346,14 @@ async function reclaimRemovedVectorFieldTables(context, activeRow) {
18346
18346
  let perBackend = reclaimCache.get(backend);
18347
18347
  const cached = perBackend?.get(cacheKey);
18348
18348
  if (cached !== void 0) return cached;
18349
- const activeSchema = chunk2GZL5ED3_cjs.parseSerializedSchema(activeRow.schema_doc);
18349
+ const activeSchema = chunkOKA6H3B3_cjs.parseSerializedSchema(activeRow.schema_doc);
18350
18350
  const activeVectorFields = vectorFieldKeysFrom(activeSchema);
18351
18351
  const survivingKinds = new Set(Object.keys(activeSchema.nodes));
18352
18352
  const historical = /* @__PURE__ */ new Map();
18353
18353
  for (let version = activeRow.version - 1; version >= 1; version -= 1) {
18354
18354
  const priorRow = await backend.getSchemaVersion(graphId, version);
18355
18355
  if (priorRow === void 0) continue;
18356
- const priorSchema = chunk2GZL5ED3_cjs.parseSerializedSchema(priorRow.schema_doc);
18356
+ const priorSchema = chunkOKA6H3B3_cjs.parseSerializedSchema(priorRow.schema_doc);
18357
18357
  for (const declaration of priorSchema.indexes ?? []) {
18358
18358
  if (declaration.entity !== "vector") continue;
18359
18359
  const key = vectorFieldKey(declaration.kind, declaration.fieldPath);
@@ -18391,7 +18391,7 @@ async function reclaimRemovedVectorFieldTables(context, activeRow) {
18391
18391
  async (target) => {
18392
18392
  const lockedActiveRow = await target.getActiveSchema(graphId);
18393
18393
  if (lockedActiveRow === void 0) return false;
18394
- const lockedActiveSchema = chunk2GZL5ED3_cjs.parseSerializedSchema(
18394
+ const lockedActiveSchema = chunkOKA6H3B3_cjs.parseSerializedSchema(
18395
18395
  lockedActiveRow.schema_doc
18396
18396
  );
18397
18397
  const lockedVectorFields = vectorFieldKeysFrom(lockedActiveSchema);
@@ -18516,7 +18516,7 @@ async function validateAndPrepareEdgeCreate(ctx, input, id, backend, options) {
18516
18516
  const toKind = input.toKind;
18517
18517
  const registration = getEdgeRegistration(ctx.graph, kind);
18518
18518
  const edgeKind = registration.type;
18519
- chunkUOHFBYYH_cjs.assertEdgeMatchIdentityBackendSupport(
18519
+ chunkQ6ZVQWH7_cjs.assertEdgeMatchIdentityBackendSupport(
18520
18520
  registration.matchIdentity,
18521
18521
  backend.capabilities,
18522
18522
  kind
@@ -18540,11 +18540,11 @@ async function validateAndPrepareEdgeCreate(ctx, input, id, backend, options) {
18540
18540
  backend
18541
18541
  );
18542
18542
  }
18543
- const validatedProps = chunkIV5W7LKW_cjs.validateEdgeProps(edgeKind.schema, input.props, {
18543
+ const validatedProps = chunkA22XPVBQ_cjs.validateEdgeProps(edgeKind.schema, input.props, {
18544
18544
  kind,
18545
18545
  operation: "create"
18546
18546
  });
18547
- const matchIdentity = chunk26CL47SW_cjs.resolveEdgeMatchIdentityStorage(
18547
+ const matchIdentity = chunkPTFO3JI5_cjs.resolveEdgeMatchIdentityStorage(
18548
18548
  registration.matchIdentity,
18549
18549
  {
18550
18550
  fromKind,
@@ -18568,7 +18568,7 @@ async function validateAndPrepareEdgeCreate(ctx, input, id, backend, options) {
18568
18568
  backend
18569
18569
  };
18570
18570
  if (options?.validateCardinality ?? true) {
18571
- await chunk26CL47SW_cjs.checkCardinalityConstraint(
18571
+ await chunkPTFO3JI5_cjs.checkCardinalityConstraint(
18572
18572
  constraintContext,
18573
18573
  kind,
18574
18574
  cardinality,
@@ -18620,7 +18620,7 @@ function createdEdgeResult(edge) {
18620
18620
  return { outcome: "created", edge };
18621
18621
  }
18622
18622
  function foundEdgeResult(row) {
18623
- return { outcome: "found", edge: chunk26CL47SW_cjs.rowToEdge(row), row };
18623
+ return { outcome: "found", edge: chunkPTFO3JI5_cjs.rowToEdge(row), row };
18624
18624
  }
18625
18625
  function edgeCreateDidWrite(result) {
18626
18626
  return result.outcome === "created";
@@ -18663,9 +18663,9 @@ async function durableIdentityIdConflict(target, graphId, id, identity, kind) {
18663
18663
  }
18664
18664
  async function executeEdgeCreateInternal(ctx, input, backend, options) {
18665
18665
  const kind = input.kind;
18666
- const id = input.id ?? chunkIV5W7LKW_cjs.generateId();
18666
+ const id = input.id ?? chunkA22XPVBQ_cjs.generateId();
18667
18667
  const registration = getEdgeRegistration(ctx.graph, kind);
18668
- chunkUOHFBYYH_cjs.assertEdgeMatchIdentityBackendSupport(
18668
+ chunkQ6ZVQWH7_cjs.assertEdgeMatchIdentityBackendSupport(
18669
18669
  registration.matchIdentity,
18670
18670
  backend.capabilities,
18671
18671
  kind
@@ -18684,26 +18684,26 @@ async function executeEdgeCreateInternal(ctx, input, backend, options) {
18684
18684
  convergesDynamically: convergeOn !== void 0 && !durableConvergence,
18685
18685
  cardinality: edgeCardinality(ctx, kind)
18686
18686
  } : void 0;
18687
- const schemaFenceInFirstWrite = candidate !== void 0 && chunk26CL47SW_cjs.canFuseSchemaFenceInFirstWrite({ kind: "edge", candidate });
18688
- const autocommitSingleStatement = autocommitBackend !== void 0 && candidate !== void 0 && chunk26CL47SW_cjs.isAutocommitSingleStatementWrite({ kind: "edge", candidate });
18689
- const plan = chunk26CL47SW_cjs.edgeWritePlan(
18690
- convergeOn === void 0 || durableConvergence ? chunk26CL47SW_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"
18691
18691
  );
18692
18692
  const rowWork = async (session, target, _overlaidSession, lock, transactionMode) => {
18693
- const targetBackend = chunk26CL47SW_cjs.unfencedTarget(target);
18694
- 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);
18695
18695
  if (schemaFenceInFirstWrite && !fuseSchemaFenceInFirstWrite) {
18696
- await chunkIV5W7LKW_cjs.lockSchemaVersionForStoreWrite(ctx, targetBackend);
18696
+ await chunkA22XPVBQ_cjs.lockSchemaVersionForStoreWrite(ctx, targetBackend);
18697
18697
  }
18698
18698
  const diagnoseFusedCreateNoRow = async (validateCardinality) => {
18699
18699
  if (fuseSchemaFenceInFirstWrite) {
18700
- await chunkIV5W7LKW_cjs.diagnoseFusedSchemaFenceNoRow(ctx, targetBackend);
18700
+ await chunkA22XPVBQ_cjs.diagnoseFusedSchemaFenceNoRow(ctx, targetBackend);
18701
18701
  const directInteractiveAutocommit = autocommitSingleStatement && transactionMode === "none" && targetBackend.capabilities.execution.interactiveTransactions;
18702
18702
  if (directInteractiveAutocommit) {
18703
- throw new chunk26CL47SW_cjs.AutocommitWriteRequiresTransaction();
18703
+ throw new chunkPTFO3JI5_cjs.AutocommitWriteRequiresTransaction();
18704
18704
  }
18705
18705
  if (transactionMode !== "none") {
18706
- await chunkIV5W7LKW_cjs.lockSchemaVersionForStoreWrite(ctx, targetBackend);
18706
+ await chunkA22XPVBQ_cjs.lockSchemaVersionForStoreWrite(ctx, targetBackend);
18707
18707
  }
18708
18708
  const prepared2 = await validateAndPrepareEdgeCreate(
18709
18709
  ctx,
@@ -18713,7 +18713,7 @@ async function executeEdgeCreateInternal(ctx, input, backend, options) {
18713
18713
  { validateEndpoints: true, validateCardinality }
18714
18714
  );
18715
18715
  if (transactionMode === "none") {
18716
- await chunkIV5W7LKW_cjs.lockSchemaVersionForStoreWrite(ctx, targetBackend);
18716
+ await chunkA22XPVBQ_cjs.lockSchemaVersionForStoreWrite(ctx, targetBackend);
18717
18717
  }
18718
18718
  return prepared2;
18719
18719
  }
@@ -18767,7 +18767,7 @@ async function executeEdgeCreateInternal(ctx, input, backend, options) {
18767
18767
  match: durableMatchIdentity === void 0 ? { kind: "dynamic", ...chunkBXHAPCQG_cjs.requireDefined(convergeOn) } : { kind: "durable", identity: durableMatchIdentity }
18768
18768
  };
18769
18769
  const result = lock.coordination === void 0 && command.match.kind === "dynamic" ? {
18770
- outcome: "unsupported"} : await chunk26CL47SW_cjs.withAlreadyExistsTranslation(
18770
+ outcome: "unsupported"} : await chunkPTFO3JI5_cjs.withAlreadyExistsTranslation(
18771
18771
  "edge",
18772
18772
  () => chunkEOLNL35G_cjs.executeAuthoritativeGraphCommand(
18773
18773
  target.commands,
@@ -18779,7 +18779,7 @@ async function executeEdgeCreateInternal(ctx, input, backend, options) {
18779
18779
  if (durableMatchIdentity !== void 0 && work2.claim !== void 0) {
18780
18780
  await chunkGD7IWK36_cjs.claimEdgeCardinality(target, ctx.claimsVerdict(), work2.claim);
18781
18781
  }
18782
- return createdEdgeResult(chunk26CL47SW_cjs.rowToEdge(result.row));
18782
+ return createdEdgeResult(chunkPTFO3JI5_cjs.rowToEdge(result.row));
18783
18783
  }
18784
18784
  if (result.outcome === "found") {
18785
18785
  if (command.match.kind === "dynamic") {
@@ -18843,7 +18843,7 @@ async function executeEdgeCreateInternal(ctx, input, backend, options) {
18843
18843
  kind
18844
18844
  );
18845
18845
  if (identityConflict !== void 0) {
18846
- await chunkIV5W7LKW_cjs.diagnoseFusedSchemaFenceNoRow(ctx, targetBackend);
18846
+ await chunkA22XPVBQ_cjs.diagnoseFusedSchemaFenceNoRow(ctx, targetBackend);
18847
18847
  await validateAndPrepareEdgeCreate(ctx, input, id, target, {
18848
18848
  validateEndpoints: true,
18849
18849
  validateCardinality: false
@@ -18886,28 +18886,28 @@ async function executeEdgeCreateInternal(ctx, input, backend, options) {
18886
18886
  ...usesFusedCardinalityInsert && fusedWork.claim !== void 0 ? { cardinalityClaim: fusedWork.claim } : {}
18887
18887
  }
18888
18888
  };
18889
- const fusedResult = await chunk26CL47SW_cjs.withAlreadyExistsTranslation(
18889
+ const fusedResult = await chunkPTFO3JI5_cjs.withAlreadyExistsTranslation(
18890
18890
  "edge",
18891
18891
  () => session.createEdgeWithPlan(fusedCommand)
18892
18892
  );
18893
18893
  if (fusedResult.outcome === "created") {
18894
18894
  if (fuseSchemaFenceInFirstWrite) {
18895
- chunkIV5W7LKW_cjs.memoizeLeasedSchemaFence(ctx, targetBackend);
18895
+ chunkA22XPVBQ_cjs.memoizeLeasedSchemaFence(ctx, targetBackend);
18896
18896
  }
18897
- return createdEdgeResult(chunk26CL47SW_cjs.rowToEdge(fusedResult.row));
18897
+ return createdEdgeResult(chunkPTFO3JI5_cjs.rowToEdge(fusedResult.row));
18898
18898
  }
18899
18899
  prepared = await diagnoseFusedCreateNoRow(true);
18900
18900
  }
18901
18901
  const work = edgeInsertWork(prepared);
18902
- const row = await chunk26CL47SW_cjs.withAlreadyExistsTranslation("edge", async () => {
18902
+ const row = await chunkPTFO3JI5_cjs.withAlreadyExistsTranslation("edge", async () => {
18903
18903
  if (shouldReturnRow) return session.createEdge(work);
18904
18904
  await session.createEdgeNoReturn(work);
18905
18905
  return;
18906
18906
  });
18907
- return createdEdgeResult(row === void 0 ? void 0 : chunk26CL47SW_cjs.rowToEdge(row));
18907
+ return createdEdgeResult(row === void 0 ? void 0 : chunkPTFO3JI5_cjs.rowToEdge(row));
18908
18908
  };
18909
18909
  if (autocommitSingleStatement) {
18910
- return chunk26CL47SW_cjs.runAutocommitSingleStatementWritePlan(
18910
+ return chunkPTFO3JI5_cjs.runAutocommitSingleStatementWritePlan(
18911
18911
  ctx,
18912
18912
  opContext,
18913
18913
  plan,
@@ -18920,12 +18920,12 @@ async function executeEdgeCreateInternal(ctx, input, backend, options) {
18920
18920
  );
18921
18921
  }
18922
18922
  if (options?.skipHooks === true) {
18923
- return chunk26CL47SW_cjs.runWritePlan(ctx, plan, backend, rowWork, {
18923
+ return chunkPTFO3JI5_cjs.runWritePlan(ctx, plan, backend, rowWork, {
18924
18924
  schemaFenceInFirstWrite,
18925
18925
  didWrite: edgeCreateDidWrite
18926
18926
  });
18927
18927
  }
18928
- return chunk26CL47SW_cjs.runHookedWritePlan(ctx, opContext, plan, backend, rowWork, {
18928
+ return chunkPTFO3JI5_cjs.runHookedWritePlan(ctx, opContext, plan, backend, rowWork, {
18929
18929
  schemaFenceInFirstWrite,
18930
18930
  didWrite: edgeCreateDidWrite
18931
18931
  });
@@ -18975,11 +18975,11 @@ async function prepareEdgeBatchCreates(ctx, inputs, backend) {
18975
18975
  backend: validationBackend,
18976
18976
  registerPendingEdgeForCardinality,
18977
18977
  seedEndpointRow
18978
- } = chunk26CL47SW_cjs.createEdgeBatchValidationBackend(backend);
18978
+ } = chunkPTFO3JI5_cjs.createEdgeBatchValidationBackend(backend);
18979
18979
  await primeEdgeBatchValidationCache(ctx, inputs, backend, seedEndpointRow);
18980
18980
  const preparedCreates = [];
18981
18981
  for (const input of inputs) {
18982
- const id = input.id ?? chunkIV5W7LKW_cjs.generateId();
18982
+ const id = input.id ?? chunkA22XPVBQ_cjs.generateId();
18983
18983
  const prepared = await validateAndPrepareEdgeCreate(
18984
18984
  ctx,
18985
18985
  input,
@@ -19005,7 +19005,7 @@ async function prepareAtomicEdgeBatchCreates(ctx, inputs, backend) {
19005
19005
  const prepared = await validateAndPrepareEdgeCreate(
19006
19006
  ctx,
19007
19007
  input,
19008
- input.id ?? chunkIV5W7LKW_cjs.generateId(),
19008
+ input.id ?? chunkA22XPVBQ_cjs.generateId(),
19009
19009
  backend,
19010
19010
  { validateEndpoints: false, validateCardinality: false }
19011
19011
  );
@@ -19124,7 +19124,7 @@ async function assertAtomicEdgeBatchCardinality(ctx, inputs, backend) {
19124
19124
  const errors = await Promise.all(
19125
19125
  window.map(async (input) => {
19126
19126
  try {
19127
- await chunk26CL47SW_cjs.checkCardinalityConstraint(
19127
+ await chunkPTFO3JI5_cjs.checkCardinalityConstraint(
19128
19128
  constraintContext,
19129
19129
  input.kind,
19130
19130
  edgeCardinality(ctx, input.kind),
@@ -19153,7 +19153,7 @@ async function runAtomicEdgeBatchProgram(ctx, inputs, preparation, backend, atom
19153
19153
  graphId: ctx.graphId,
19154
19154
  expectedVersion: chunkBXHAPCQG_cjs.requireDefined(ctx.schemaVersion)
19155
19155
  };
19156
- const result = await chunk26CL47SW_cjs.withAlreadyExistsTranslation("edge", async () => {
19156
+ const result = await chunkPTFO3JI5_cjs.withAlreadyExistsTranslation("edge", async () => {
19157
19157
  try {
19158
19158
  if (resultMode === "count") {
19159
19159
  return await atomicExecutor({
@@ -19194,7 +19194,7 @@ async function runAtomicEdgeBatchProgram(ctx, inputs, preparation, backend, atom
19194
19194
  });
19195
19195
  const insertedCount = typeof result === "number" ? result : result.length;
19196
19196
  if (insertedCount === 0) {
19197
- await chunkIV5W7LKW_cjs.diagnoseFusedSchemaFenceNoRow(ctx, backend);
19197
+ await chunkA22XPVBQ_cjs.diagnoseFusedSchemaFenceNoRow(ctx, backend);
19198
19198
  await assertAtomicEdgeBatchEndpoints(ctx, inputs, backend);
19199
19199
  }
19200
19200
  if (insertedCount !== inputs.length) {
@@ -19207,11 +19207,11 @@ async function runAtomicEdgeBatchProgram(ctx, inputs, preparation, backend, atom
19207
19207
  }
19208
19208
  );
19209
19209
  }
19210
- chunkIV5W7LKW_cjs.memoizeLeasedSchemaFence(ctx, backend);
19210
+ chunkA22XPVBQ_cjs.memoizeLeasedSchemaFence(ctx, backend);
19211
19211
  return result;
19212
19212
  }
19213
19213
  function assertDurableBatchRows(work, rows) {
19214
- const outcomes = chunk26CL47SW_cjs.classifyDurableEdgeBatchOutcomes(
19214
+ const outcomes = chunkPTFO3JI5_cjs.classifyDurableEdgeBatchOutcomes(
19215
19215
  work.map((item) => item.params),
19216
19216
  rows
19217
19217
  );
@@ -19235,7 +19235,7 @@ async function executeEdgeCreateNoReturnBatch(ctx, inputs, backend) {
19235
19235
  if (inputs.length === 0) {
19236
19236
  return;
19237
19237
  }
19238
- const atomicExecutor = chunk26CL47SW_cjs.resolveAtomicEdgeBatchExecutor({
19238
+ const atomicExecutor = chunkPTFO3JI5_cjs.resolveAtomicEdgeBatchExecutor({
19239
19239
  backend,
19240
19240
  graph: ctx.graph,
19241
19241
  inputs,
@@ -19259,9 +19259,9 @@ async function executeEdgeCreateNoReturnBatch(ctx, inputs, backend) {
19259
19259
  );
19260
19260
  return;
19261
19261
  }
19262
- await chunk26CL47SW_cjs.runWritePlan(
19262
+ await chunkPTFO3JI5_cjs.runWritePlan(
19263
19263
  ctx,
19264
- chunk26CL47SW_cjs.edgeWritePlan(batchFencesConstraintProbe(ctx, inputs)),
19264
+ chunkPTFO3JI5_cjs.edgeWritePlan(batchFencesConstraintProbe(ctx, inputs)),
19265
19265
  backend,
19266
19266
  async (session, target) => {
19267
19267
  const { batchInsertWork } = await prepareEdgeBatchCreates(
@@ -19278,7 +19278,7 @@ async function executeEdgeCreateNoReturnBatch(ctx, inputs, backend) {
19278
19278
  await executeEdgeCreateInternal(
19279
19279
  ctx,
19280
19280
  input,
19281
- chunk26CL47SW_cjs.nestedManagedWriteTarget(target),
19281
+ chunkPTFO3JI5_cjs.nestedManagedWriteTarget(target),
19282
19282
  {
19283
19283
  returnRow: false,
19284
19284
  skipHooks: true
@@ -19287,14 +19287,14 @@ async function executeEdgeCreateNoReturnBatch(ctx, inputs, backend) {
19287
19287
  }
19288
19288
  return;
19289
19289
  }
19290
- const rows = await chunk26CL47SW_cjs.withAlreadyExistsTranslation(
19290
+ const rows = await chunkPTFO3JI5_cjs.withAlreadyExistsTranslation(
19291
19291
  "edge",
19292
19292
  () => chunkBXHAPCQG_cjs.requireDefined(session.createEdgesDurable)(batchInsertWork)
19293
19293
  );
19294
19294
  assertDurableBatchRows(batchInsertWork, rows);
19295
19295
  return;
19296
19296
  }
19297
- await chunk26CL47SW_cjs.withAlreadyExistsTranslation(
19297
+ await chunkPTFO3JI5_cjs.withAlreadyExistsTranslation(
19298
19298
  "edge",
19299
19299
  () => session.createEdgesNoReturn(batchInsertWork)
19300
19300
  );
@@ -19305,7 +19305,7 @@ async function executeEdgeCreateBatch(ctx, inputs, backend) {
19305
19305
  if (inputs.length === 0) {
19306
19306
  return [];
19307
19307
  }
19308
- const atomicExecutor = chunk26CL47SW_cjs.resolveAtomicEdgeBatchExecutor({
19308
+ const atomicExecutor = chunkPTFO3JI5_cjs.resolveAtomicEdgeBatchExecutor({
19309
19309
  backend,
19310
19310
  graph: ctx.graph,
19311
19311
  inputs,
@@ -19327,11 +19327,11 @@ async function executeEdgeCreateBatch(ctx, inputs, backend) {
19327
19327
  atomicExecutor,
19328
19328
  "rows"
19329
19329
  );
19330
- return rows.map((row) => chunk26CL47SW_cjs.rowToEdge(row));
19330
+ return rows.map((row) => chunkPTFO3JI5_cjs.rowToEdge(row));
19331
19331
  }
19332
- return chunk26CL47SW_cjs.runWritePlan(
19332
+ return chunkPTFO3JI5_cjs.runWritePlan(
19333
19333
  ctx,
19334
- chunk26CL47SW_cjs.edgeWritePlan(batchFencesConstraintProbe(ctx, inputs)),
19334
+ chunkPTFO3JI5_cjs.edgeWritePlan(batchFencesConstraintProbe(ctx, inputs)),
19335
19335
  backend,
19336
19336
  async (session, target) => {
19337
19337
  const { batchInsertWork } = await prepareEdgeBatchCreates(
@@ -19349,7 +19349,7 @@ async function executeEdgeCreateBatch(ctx, inputs, backend) {
19349
19349
  const result = await executeEdgeCreateInternal(
19350
19350
  ctx,
19351
19351
  input,
19352
- chunk26CL47SW_cjs.nestedManagedWriteTarget(target),
19352
+ chunkPTFO3JI5_cjs.nestedManagedWriteTarget(target),
19353
19353
  { returnRow: true, skipHooks: true }
19354
19354
  );
19355
19355
  if (result.outcome !== "created") {
@@ -19368,24 +19368,24 @@ async function executeEdgeCreateBatch(ctx, inputs, backend) {
19368
19368
  }
19369
19369
  return fallbackRows;
19370
19370
  }
19371
- const rows2 = await chunk26CL47SW_cjs.withAlreadyExistsTranslation(
19371
+ const rows2 = await chunkPTFO3JI5_cjs.withAlreadyExistsTranslation(
19372
19372
  "edge",
19373
19373
  () => chunkBXHAPCQG_cjs.requireDefined(session.createEdgesDurable)(batchInsertWork)
19374
19374
  );
19375
19375
  assertDurableBatchRows(batchInsertWork, rows2);
19376
- return rows2.map((row) => chunk26CL47SW_cjs.rowToEdge(row));
19376
+ return rows2.map((row) => chunkPTFO3JI5_cjs.rowToEdge(row));
19377
19377
  }
19378
- const rows = await chunk26CL47SW_cjs.withAlreadyExistsTranslation(
19378
+ const rows = await chunkPTFO3JI5_cjs.withAlreadyExistsTranslation(
19379
19379
  "edge",
19380
19380
  () => session.createEdges(batchInsertWork)
19381
19381
  );
19382
- return rows.map((row) => chunk26CL47SW_cjs.rowToEdge(row));
19382
+ return rows.map((row) => chunkPTFO3JI5_cjs.rowToEdge(row));
19383
19383
  }
19384
19384
  );
19385
19385
  }
19386
19386
  function batchFencesConstraintProbe(ctx, inputs) {
19387
19387
  for (const input of inputs) {
19388
- const reason = chunk26CL47SW_cjs.edgeWriteNeedsConstraintFence(
19388
+ const reason = chunkPTFO3JI5_cjs.edgeWriteNeedsConstraintFence(
19389
19389
  edgeCardinality(ctx, input.kind)
19390
19390
  );
19391
19391
  if (reason !== void 0) return reason;
@@ -19394,12 +19394,12 @@ function batchFencesConstraintProbe(ctx, inputs) {
19394
19394
  }
19395
19395
  function computeEdgeUpdate(ctx, kind, id, existingProps, inputProps) {
19396
19396
  const registration = getEdgeRegistration(ctx.graph, kind);
19397
- const validatedProps = chunkIV5W7LKW_cjs.validateEdgeProps(
19397
+ const validatedProps = chunkA22XPVBQ_cjs.validateEdgeProps(
19398
19398
  registration.type.schema,
19399
19399
  { ...existingProps, ...inputProps },
19400
19400
  { kind, operation: "update", id }
19401
19401
  );
19402
- const identityRefusal = chunk26CL47SW_cjs.edgeMatchIdentityUpdateRefusal({
19402
+ const identityRefusal = chunkPTFO3JI5_cjs.edgeMatchIdentityUpdateRefusal({
19403
19403
  identity: registration.matchIdentity,
19404
19404
  kind,
19405
19405
  id,
@@ -19435,7 +19435,7 @@ function edgeUpsertDirtyCheck(ctx, kind, id, existingProps, inputProps) {
19435
19435
  }
19436
19436
  async function performEdgeUpdate(ctx, input, session, target, options, resolvedExisting) {
19437
19437
  const id = input.id;
19438
- chunk26CL47SW_cjs.assertValidityEndMutation(input, {
19438
+ chunkPTFO3JI5_cjs.assertValidityEndMutation(input, {
19439
19439
  entityType: "edge",
19440
19440
  kind: input.identity.kind,
19441
19441
  id
@@ -19461,7 +19461,7 @@ async function performEdgeUpdate(ctx, input, session, target, options, resolvedE
19461
19461
  const preservesLiveLowerBound = options?.clearDeleted !== true && chunkNWJV4UVW_cjs.preservesImmutableLowerBound(input.onImmutableLowerBound);
19462
19462
  const appliedValidFrom = preservesLiveLowerBound ? void 0 : statedValidFrom;
19463
19463
  const validTo = chunkNWJV4UVW_cjs.validateOptionalCanonicalIsoDate(input.validTo, "validTo");
19464
- const effectiveValidTo = options?.clearDeleted === true && appliedValidFrom !== void 0 ? validTo : chunk26CL47SW_cjs.validityEndAfterMutation(
19464
+ const effectiveValidTo = options?.clearDeleted === true && appliedValidFrom !== void 0 ? validTo : chunkPTFO3JI5_cjs.validityEndAfterMutation(
19465
19465
  input.clearValidTo === true ? { clearValidTo: true } : validTo === void 0 ? {} : { validTo },
19466
19466
  existing.valid_to
19467
19467
  );
@@ -19470,7 +19470,7 @@ async function performEdgeUpdate(ctx, input, session, target, options, resolvedE
19470
19470
  let reentryClaim;
19471
19471
  const reentersActivePopulation = cardinality === "oneActive" && effectiveValidTo === void 0 && (existing.deleted_at !== void 0 || existing.valid_to !== void 0);
19472
19472
  if (reentersLivePopulation || reentersActivePopulation) {
19473
- await chunk26CL47SW_cjs.checkCardinalityConstraint(
19473
+ await chunkPTFO3JI5_cjs.checkCardinalityConstraint(
19474
19474
  {
19475
19475
  graphId: ctx.graphId,
19476
19476
  registry: ctx.registry,
@@ -19531,10 +19531,10 @@ async function performEdgeUpdate(ctx, input, session, target, options, resolvedE
19531
19531
  // "Did this write assert any window state?" is one predicate with one
19532
19532
  // owner, consulted here and by the fence appliers that carry it, rather
19533
19533
  // than re-derived from the params the diagnosis never sees.
19534
- chunk26CL47SW_cjs.assertsStoredWindowState(fences),
19534
+ chunkPTFO3JI5_cjs.assertsStoredWindowState(fences),
19535
19535
  () => session.reviseEdge(work, fences)
19536
19536
  );
19537
- return chunk26CL47SW_cjs.rowToEdge(row);
19537
+ return chunkPTFO3JI5_cjs.rowToEdge(row);
19538
19538
  }
19539
19539
  var EDGE_UPDATE_ATTEMPTS = 2;
19540
19540
  async function performEdgeUpdateConverging(ctx, input, session, target, options, resolvedExisting) {
@@ -19570,7 +19570,7 @@ function resolveAtomicEdgeUpdateExecutor(ctx, entries, backend) {
19570
19570
  )) {
19571
19571
  return;
19572
19572
  }
19573
- return chunk26CL47SW_cjs.resolveAtomicEdgeResolvedUpdateBatchExecutor({
19573
+ return chunkPTFO3JI5_cjs.resolveAtomicEdgeResolvedUpdateBatchExecutor({
19574
19574
  backend,
19575
19575
  graph: ctx.graph,
19576
19576
  schemaVersion: ctx.schemaVersion,
@@ -19594,7 +19594,7 @@ async function executeEdgeUpdate(ctx, input, backend) {
19594
19594
  );
19595
19595
  const opContext = ctx.createOperationContext("update", "edge", gate.kind, id);
19596
19596
  if (input.clearValidTo === true) {
19597
- chunk26CL47SW_cjs.assertClearValidToSupported(backend, "edge");
19597
+ chunkPTFO3JI5_cjs.assertClearValidToSupported(backend, "edge");
19598
19598
  }
19599
19599
  const atomicEntry = {
19600
19600
  input,
@@ -19607,7 +19607,7 @@ async function executeEdgeUpdate(ctx, input, backend) {
19607
19607
  backend
19608
19608
  );
19609
19609
  if (atomicExecutor !== void 0) {
19610
- return chunk26CL47SW_cjs.runAtomicProgramWithHooks(
19610
+ return chunkPTFO3JI5_cjs.runAtomicProgramWithHooks(
19611
19611
  ctx,
19612
19612
  opContext,
19613
19613
  async () => {
@@ -19619,36 +19619,36 @@ async function executeEdgeUpdate(ctx, input, backend) {
19619
19619
  );
19620
19620
  return chunkBXHAPCQG_cjs.requireDefined(edges[0]);
19621
19621
  },
19622
- chunk26CL47SW_cjs.writeResultAlwaysChanges
19622
+ chunkPTFO3JI5_cjs.writeResultAlwaysChanges
19623
19623
  );
19624
19624
  }
19625
- return chunk26CL47SW_cjs.runHookedWritePlan(
19625
+ return chunkPTFO3JI5_cjs.runHookedWritePlan(
19626
19626
  ctx,
19627
19627
  opContext,
19628
19628
  // An in-place props update on a live edge re-derives no constraint verdict.
19629
19629
  // Clearing an `oneActive` edge's end DOES: it re-admits the row to the
19630
19630
  // counted active population.
19631
- chunk26CL47SW_cjs.edgeWritePlan(
19632
- input.clearValidTo === true && edgeCardinality(ctx, gate.kind) === "oneActive" ? chunk26CL47SW_cjs.edgeWriteNeedsConstraintFence("oneActive") : void 0
19631
+ chunkPTFO3JI5_cjs.edgeWritePlan(
19632
+ input.clearValidTo === true && edgeCardinality(ctx, gate.kind) === "oneActive" ? chunkPTFO3JI5_cjs.edgeWriteNeedsConstraintFence("oneActive") : void 0
19633
19633
  ),
19634
19634
  backend,
19635
19635
  (session, target) => performEdgeUpdateConverging(ctx, input, session, target),
19636
- { didWrite: chunk26CL47SW_cjs.writeResultAlwaysChanges }
19636
+ { didWrite: chunkPTFO3JI5_cjs.writeResultAlwaysChanges }
19637
19637
  );
19638
19638
  }
19639
19639
  async function executeEdgeUpsertUpdateWithOutcome(ctx, input, backend, options) {
19640
19640
  if (input.clearValidTo === true) {
19641
- chunk26CL47SW_cjs.assertClearValidToSupported(backend, "edge");
19641
+ chunkPTFO3JI5_cjs.assertClearValidToSupported(backend, "edge");
19642
19642
  }
19643
- return chunk26CL47SW_cjs.runWritePlan(
19643
+ return chunkPTFO3JI5_cjs.runWritePlan(
19644
19644
  ctx,
19645
19645
  // An in-place props update re-derives no constraint verdict: endpoints
19646
19646
  // are immutable, so cardinality cannot change under it. A coalescing upsert
19647
19647
  // converges on a match key no database key backs; a resurrect or a cleared
19648
19648
  // end re-admits the row to the counted population its cardinality
19649
19649
  // constrains.
19650
- chunk26CL47SW_cjs.edgeWritePlan(
19651
- options?.coalesceUnchanged === true ? "edgeMatchKeyConvergence" : input.clearValidTo === true || options?.clearDeleted === true ? chunk26CL47SW_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
19652
19652
  ),
19653
19653
  backend,
19654
19654
  async (session, target) => {
@@ -19672,7 +19672,7 @@ async function executeEdgeUpsertUpdateWithOutcome(ctx, input, backend, options)
19672
19672
  input.props
19673
19673
  );
19674
19674
  if (shouldCoalesceUpsert(existing, input, runDirtyCheck)) {
19675
- return { edge: chunk26CL47SW_cjs.rowToEdge(existing), wrote: false };
19675
+ return { edge: chunkPTFO3JI5_cjs.rowToEdge(existing), wrote: false };
19676
19676
  }
19677
19677
  }
19678
19678
  }
@@ -19701,10 +19701,10 @@ async function executeEdgeUpsertUpdate(ctx, input, backend, options) {
19701
19701
  }
19702
19702
  async function executeEdgeResolvedMutationSet(ctx, creates, updates, backend) {
19703
19703
  if (creates.length === 0 || updates.length === 0) {
19704
- return chunk26CL47SW_cjs.unsupportedResolvedMutationSet();
19704
+ return chunkPTFO3JI5_cjs.unsupportedResolvedMutationSet();
19705
19705
  }
19706
19706
  const firstUpdate = chunkBXHAPCQG_cjs.requireDefined(updates[0]);
19707
- const executor = chunk26CL47SW_cjs.resolveAtomicEdgeResolvedMutationSetExecutor({
19707
+ const executor = chunkPTFO3JI5_cjs.resolveAtomicEdgeResolvedMutationSetExecutor({
19708
19708
  backend,
19709
19709
  graph: ctx.graph,
19710
19710
  schemaVersion: ctx.schemaVersion,
@@ -19714,18 +19714,18 @@ async function executeEdgeResolvedMutationSet(ctx, creates, updates, backend) {
19714
19714
  creates,
19715
19715
  updateCount: updates.length
19716
19716
  });
19717
- if (executor === void 0) return chunk26CL47SW_cjs.unsupportedResolvedMutationSet();
19717
+ if (executor === void 0) return chunkPTFO3JI5_cjs.unsupportedResolvedMutationSet();
19718
19718
  const ids = /* @__PURE__ */ new Set([
19719
19719
  ...creates.map((input) => chunkBXHAPCQG_cjs.requireDefined(input.id)),
19720
19720
  ...updates.map((entry2) => entry2.input.id)
19721
19721
  ]);
19722
19722
  if (ids.size !== creates.length + updates.length) {
19723
- return chunk26CL47SW_cjs.unsupportedResolvedMutationSet();
19723
+ return chunkPTFO3JI5_cjs.unsupportedResolvedMutationSet();
19724
19724
  }
19725
19725
  if (updates.some(
19726
19726
  (entry2) => entry2.clearDeleted || entry2.existing === void 0 || entry2.input.validFrom !== void 0 || entry2.input.validTo !== void 0 || entry2.input.clearValidTo === true
19727
19727
  )) {
19728
- return chunk26CL47SW_cjs.unsupportedResolvedMutationSet();
19728
+ return chunkPTFO3JI5_cjs.unsupportedResolvedMutationSet();
19729
19729
  }
19730
19730
  const preparation = await prepareAtomicEdgeBatchCreates(
19731
19731
  ctx,
@@ -19755,7 +19755,7 @@ async function executeEdgeResolvedMutationSet(ctx, creates, updates, backend) {
19755
19755
  );
19756
19756
  return { existing, props: validatedProps };
19757
19757
  });
19758
- const result = await chunk26CL47SW_cjs.withAlreadyExistsTranslation("edge", async () => {
19758
+ const result = await chunkPTFO3JI5_cjs.withAlreadyExistsTranslation("edge", async () => {
19759
19759
  try {
19760
19760
  return await executor({
19761
19761
  kind: "resolved-set",
@@ -19779,23 +19779,23 @@ async function executeEdgeResolvedMutationSet(ctx, creates, updates, backend) {
19779
19779
  }
19780
19780
  });
19781
19781
  if (result.created.length === 0 && result.updated.length === 0) {
19782
- await chunkIV5W7LKW_cjs.diagnoseFusedSchemaFenceNoRow(ctx, backend);
19783
- throw new chunk26CL47SW_cjs.ResolvedMutationSetMoved("edge", executor);
19782
+ await chunkA22XPVBQ_cjs.diagnoseFusedSchemaFenceNoRow(ctx, backend);
19783
+ throw new chunkPTFO3JI5_cjs.ResolvedMutationSetMoved("edge", executor);
19784
19784
  }
19785
19785
  if (result.created.length !== creates.length || result.updated.length !== updates.length) {
19786
19786
  throw new chunkG7W67PZO_cjs.CompilerInvariantError(
19787
19787
  "Atomic resolved edge mutation set returned a partial result."
19788
19788
  );
19789
19789
  }
19790
- chunkIV5W7LKW_cjs.memoizeLeasedSchemaFence(ctx, backend);
19790
+ chunkA22XPVBQ_cjs.memoizeLeasedSchemaFence(ctx, backend);
19791
19791
  const createdById = new Map(result.created.map((row) => [row.id, row]));
19792
19792
  const updatedById = new Map(result.updated.map((row) => [row.id, row]));
19793
- return chunk26CL47SW_cjs.appliedResolvedMutationSet({
19793
+ return chunkPTFO3JI5_cjs.appliedResolvedMutationSet({
19794
19794
  created: creates.map(
19795
- (input) => chunk26CL47SW_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))))
19796
19796
  ),
19797
19797
  updated: updates.map(
19798
- (entry2) => chunk26CL47SW_cjs.rowToEdge(chunkBXHAPCQG_cjs.requireDefined(updatedById.get(entry2.input.id)))
19798
+ (entry2) => chunkPTFO3JI5_cjs.rowToEdge(chunkBXHAPCQG_cjs.requireDefined(updatedById.get(entry2.input.id)))
19799
19799
  )
19800
19800
  });
19801
19801
  }
@@ -19803,7 +19803,7 @@ async function executeEdgeUpsertUpdateBatch(ctx, entries, backend) {
19803
19803
  if (entries.length === 0) return [];
19804
19804
  for (const entry2 of entries) {
19805
19805
  if (entry2.input.clearValidTo === true) {
19806
- chunk26CL47SW_cjs.assertClearValidToSupported(backend, "edge");
19806
+ chunkPTFO3JI5_cjs.assertClearValidToSupported(backend, "edge");
19807
19807
  }
19808
19808
  }
19809
19809
  const first = chunkBXHAPCQG_cjs.requireDefined(entries[0]);
@@ -19820,16 +19820,16 @@ async function executeEdgeUpsertUpdateBatch(ctx, entries, backend) {
19820
19820
  const needsConstraintFence = entries.some(
19821
19821
  (entry2) => entry2.clearDeleted || entry2.input.clearValidTo === true
19822
19822
  );
19823
- return chunk26CL47SW_cjs.runWritePlan(
19823
+ return chunkPTFO3JI5_cjs.runWritePlan(
19824
19824
  ctx,
19825
- chunk26CL47SW_cjs.edgeWritePlan(
19826
- needsConstraintFence ? chunk26CL47SW_cjs.edgeWriteNeedsConstraintFence(
19825
+ chunkPTFO3JI5_cjs.edgeWritePlan(
19826
+ needsConstraintFence ? chunkPTFO3JI5_cjs.edgeWriteNeedsConstraintFence(
19827
19827
  edgeCardinality(ctx, first.input.identity.kind)
19828
19828
  ) : void 0
19829
19829
  ),
19830
19830
  backend,
19831
19831
  async (session, target) => {
19832
- 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, [
19833
19833
  ...distinctIds
19834
19834
  ]) : void 0;
19835
19835
  const edges = [];
@@ -19847,11 +19847,11 @@ async function executeEdgeUpsertUpdateBatch(ctx, entries, backend) {
19847
19847
  }
19848
19848
  return edges;
19849
19849
  },
19850
- { didWrite: chunk26CL47SW_cjs.writeResultAlwaysChanges }
19850
+ { didWrite: chunkPTFO3JI5_cjs.writeResultAlwaysChanges }
19851
19851
  );
19852
19852
  }
19853
19853
  async function executeAtomicEdgeResolvedUpdates(ctx, entries, backend, atomicExecutor) {
19854
- const maxAttempts = chunk26CL47SW_cjs.atomicResolvedUpdateAttemptBudget(
19854
+ const maxAttempts = chunkPTFO3JI5_cjs.atomicResolvedUpdateAttemptBudget(
19855
19855
  entries.length,
19856
19856
  EDGE_UPDATE_ATTEMPTS
19857
19857
  );
@@ -19860,7 +19860,7 @@ async function executeAtomicEdgeResolvedUpdates(ctx, entries, backend, atomicExe
19860
19860
  const supplied = entries.flatMap(
19861
19861
  (entry2) => entry2.existing === void 0 ? [] : [entry2.existing]
19862
19862
  );
19863
- 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, [
19864
19864
  ...distinctIds
19865
19865
  ]);
19866
19866
  let existing = fetched === void 0 ? supplied : [...fetched.values()];
@@ -19896,10 +19896,10 @@ async function executeAtomicEdgeResolvedUpdates(ctx, entries, backend, atomicExe
19896
19896
  }
19897
19897
  });
19898
19898
  if (rows.length === entries.length) {
19899
- chunkIV5W7LKW_cjs.memoizeLeasedSchemaFence(ctx, backend);
19899
+ chunkA22XPVBQ_cjs.memoizeLeasedSchemaFence(ctx, backend);
19900
19900
  const returned = new Map(rows.map((row) => [row.id, row]));
19901
19901
  return entries.map(
19902
- (entry2) => chunk26CL47SW_cjs.rowToEdge(chunkBXHAPCQG_cjs.requireDefined(returned.get(entry2.input.id)))
19902
+ (entry2) => chunkPTFO3JI5_cjs.rowToEdge(chunkBXHAPCQG_cjs.requireDefined(returned.get(entry2.input.id)))
19903
19903
  );
19904
19904
  }
19905
19905
  if (rows.length > 0) {
@@ -19908,7 +19908,7 @@ async function executeAtomicEdgeResolvedUpdates(ctx, entries, backend, atomicExe
19908
19908
  { expected: entries.length, actual: rows.length }
19909
19909
  );
19910
19910
  }
19911
- await chunkIV5W7LKW_cjs.diagnoseFusedSchemaFenceNoRow(ctx, backend);
19911
+ await chunkA22XPVBQ_cjs.diagnoseFusedSchemaFenceNoRow(ctx, backend);
19912
19912
  if (attempt === maxAttempts) {
19913
19913
  throw new chunkG7W67PZO_cjs.DatabaseOperationError(
19914
19914
  `Atomic edge update could not be applied to stable rows after ${maxAttempts} attempts.`,
@@ -19922,7 +19922,7 @@ async function executeAtomicEdgeResolvedUpdates(ctx, entries, backend, atomicExe
19922
19922
  }
19923
19923
  );
19924
19924
  }
19925
- const refreshed = await chunkIV5W7LKW_cjs.getEdgeRowsByIds(
19925
+ const refreshed = await chunkA22XPVBQ_cjs.getEdgeRowsByIds(
19926
19926
  backend,
19927
19927
  ctx.batchPointRead,
19928
19928
  ctx.graphId,
@@ -19945,7 +19945,7 @@ async function executeEdgeDelete(ctx, expectedKind, id, backend) {
19945
19945
  );
19946
19946
  if (gate.deleted_at) return;
19947
19947
  const opContext = ctx.createOperationContext("delete", "edge", gate.kind, id);
19948
- const atomicExecutor = chunk26CL47SW_cjs.resolveAtomicEdgeDeleteBatchExecutor({
19948
+ const atomicExecutor = chunkPTFO3JI5_cjs.resolveAtomicEdgeDeleteBatchExecutor({
19949
19949
  backend,
19950
19950
  graph: ctx.graph,
19951
19951
  expectedKind,
@@ -19955,7 +19955,7 @@ async function executeEdgeDelete(ctx, expectedKind, id, backend) {
19955
19955
  revisionTrackingEnabled: ctx.revisionTrackingEnabled
19956
19956
  });
19957
19957
  if (atomicExecutor !== void 0) {
19958
- await chunk26CL47SW_cjs.runAtomicProgramWithHooks(
19958
+ await chunkPTFO3JI5_cjs.runAtomicProgramWithHooks(
19959
19959
  ctx,
19960
19960
  opContext,
19961
19961
  () => executeAtomicEdgeDeletes(
@@ -19969,11 +19969,11 @@ async function executeEdgeDelete(ctx, expectedKind, id, backend) {
19969
19969
  );
19970
19970
  return;
19971
19971
  }
19972
- return chunk26CL47SW_cjs.runHookedWritePlan(
19972
+ return chunkPTFO3JI5_cjs.runHookedWritePlan(
19973
19973
  ctx,
19974
19974
  opContext,
19975
19975
  // A soft delete decides nothing a concurrent write could invalidate.
19976
- chunk26CL47SW_cjs.edgeWritePlan(void 0),
19976
+ chunkPTFO3JI5_cjs.edgeWritePlan(void 0),
19977
19977
  backend,
19978
19978
  async (session) => {
19979
19979
  await session.retireEdge({ id, kind: expectedKind });
@@ -19981,7 +19981,7 @@ async function executeEdgeDelete(ctx, expectedKind, id, backend) {
19981
19981
  );
19982
19982
  }
19983
19983
  async function executeEdgeDeleteBatch(ctx, expectedKind, ids, backend) {
19984
- const atomicExecutor = chunk26CL47SW_cjs.resolveAtomicEdgeDeleteBatchExecutor({
19984
+ const atomicExecutor = chunkPTFO3JI5_cjs.resolveAtomicEdgeDeleteBatchExecutor({
19985
19985
  backend,
19986
19986
  graph: ctx.graph,
19987
19987
  expectedKind,
@@ -20000,12 +20000,12 @@ async function executeEdgeDeleteBatch(ctx, expectedKind, ids, backend) {
20000
20000
  );
20001
20001
  return;
20002
20002
  }
20003
- await chunk26CL47SW_cjs.runWritePlan(
20003
+ await chunkPTFO3JI5_cjs.runWritePlan(
20004
20004
  ctx,
20005
- chunk26CL47SW_cjs.edgeWritePlan(void 0),
20005
+ chunkPTFO3JI5_cjs.edgeWritePlan(void 0),
20006
20006
  backend,
20007
20007
  async (session, target) => {
20008
- const rowsById = await chunkIV5W7LKW_cjs.getEdgeRowsByIds(
20008
+ const rowsById = await chunkA22XPVBQ_cjs.getEdgeRowsByIds(
20009
20009
  target,
20010
20010
  ctx.batchPointRead,
20011
20011
  ctx.graphId,
@@ -20044,7 +20044,7 @@ async function executeAtomicEdgeDeletes(ctx, expectedKind, ids, backend, atomicE
20044
20044
  expectedVersion: chunkBXHAPCQG_cjs.requireDefined(ctx.schemaVersion)
20045
20045
  }
20046
20046
  });
20047
- await chunk26CL47SW_cjs.assertAtomicDeleteSchemaFenceMatched(
20047
+ await chunkPTFO3JI5_cjs.assertAtomicDeleteSchemaFenceMatched(
20048
20048
  result.schemaFenceMatched,
20049
20049
  ctx,
20050
20050
  backend,
@@ -20053,7 +20053,7 @@ async function executeAtomicEdgeDeletes(ctx, expectedKind, ids, backend, atomicE
20053
20053
  return result.affectedCount;
20054
20054
  } catch (error) {
20055
20055
  if (!(error instanceof chunkXUCVGEJT_cjs.AtomicEdgeDeleteIdentityRefusalError)) throw error;
20056
- const rowsById = await chunkIV5W7LKW_cjs.getEdgeRowsByIds(
20056
+ const rowsById = await chunkA22XPVBQ_cjs.getEdgeRowsByIds(
20057
20057
  backend,
20058
20058
  ctx.batchPointRead,
20059
20059
  ctx.graphId,
@@ -20086,10 +20086,10 @@ async function executeEdgeHardDelete(ctx, expectedKind, id, backend) {
20086
20086
  "hardDelete"
20087
20087
  );
20088
20088
  const opContext = ctx.createOperationContext("delete", "edge", gate.kind, id);
20089
- return chunk26CL47SW_cjs.runHookedWritePlan(
20089
+ return chunkPTFO3JI5_cjs.runHookedWritePlan(
20090
20090
  ctx,
20091
20091
  opContext,
20092
- chunk26CL47SW_cjs.edgeWritePlan(void 0),
20092
+ chunkPTFO3JI5_cjs.edgeWritePlan(void 0),
20093
20093
  backend,
20094
20094
  async (session) => {
20095
20095
  await session.purgeEdge({
@@ -20158,7 +20158,7 @@ function findMatchingEdge(rows, matchOn, inputProps) {
20158
20158
  if (matchOn.length > 0) {
20159
20159
  const rowProps = chunkEOLNL35G_cjs.rowPropsToObject(row.props);
20160
20160
  const matches = matchOn.every(
20161
- (field2) => chunk26CL47SW_cjs.canonicalPersistedJsonValue(chunkBXHAPCQG_cjs.readOwnProperty(rowProps, field2)) === chunk26CL47SW_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))
20162
20162
  );
20163
20163
  if (!matches) continue;
20164
20164
  }
@@ -20179,7 +20179,7 @@ function assertEdgeMatchKey(row, matchOn, matchProps) {
20179
20179
  }
20180
20180
  async function executeEdgeFindByEndpoints(ctx, kind, fromKind, fromId, toKind, toId, backend, options) {
20181
20181
  const matchOn = options?.matchOn ?? [];
20182
- const matchProps = chunk26CL47SW_cjs.normalizePersistedEdgeMatchProps(options?.props ?? {});
20182
+ const matchProps = chunkPTFO3JI5_cjs.normalizePersistedEdgeMatchProps(options?.props ?? {});
20183
20183
  const registration = getEdgeRegistration(ctx.graph, kind);
20184
20184
  const edgeKind = registration.type;
20185
20185
  if (matchOn.length > 0) {
@@ -20199,9 +20199,9 @@ async function executeEdgeFindByEndpoints(ctx, kind, fromKind, fromId, toKind, t
20199
20199
  ...options?.asOf !== void 0 && { asOf: options.asOf }
20200
20200
  });
20201
20201
  if (candidateRows.length === 0) return void 0;
20202
- if (matchOn.length === 0) return chunk26CL47SW_cjs.rowToEdge(chunkBXHAPCQG_cjs.requireDefined(candidateRows[0]));
20202
+ if (matchOn.length === 0) return chunkPTFO3JI5_cjs.rowToEdge(chunkBXHAPCQG_cjs.requireDefined(candidateRows[0]));
20203
20203
  const { liveRow } = findMatchingEdge(candidateRows, matchOn, matchProps);
20204
- return liveRow === void 0 ? void 0 : chunk26CL47SW_cjs.rowToEdge(liveRow);
20204
+ return liveRow === void 0 ? void 0 : chunkPTFO3JI5_cjs.rowToEdge(liveRow);
20205
20205
  }
20206
20206
  function defersEndpointWindowOrdering(ifExists, onImmutableLowerBound) {
20207
20207
  return ifExists === "update" && chunkNWJV4UVW_cjs.preservesImmutableLowerBound(onImmutableLowerBound);
@@ -20226,15 +20226,15 @@ async function executeEdgeGetOrCreateByEndpoints(ctx, kind, fromKind, fromId, to
20226
20226
  registration.matchIdentity?.fields,
20227
20227
  options?.matchOn
20228
20228
  );
20229
- chunk26CL47SW_cjs.assertValidityEndMutation(options ?? {}, { entityType: "edge", kind });
20229
+ chunkPTFO3JI5_cjs.assertValidityEndMutation(options ?? {}, { entityType: "edge", kind });
20230
20230
  if (options?.clearValidTo === true) {
20231
- chunk26CL47SW_cjs.assertClearValidToSupported(backend, "edge");
20231
+ chunkPTFO3JI5_cjs.assertClearValidToSupported(backend, "edge");
20232
20232
  }
20233
- const validatedProps = chunkIV5W7LKW_cjs.validateEdgeProps(edgeKind.schema, props, {
20233
+ const validatedProps = chunkA22XPVBQ_cjs.validateEdgeProps(edgeKind.schema, props, {
20234
20234
  kind,
20235
20235
  operation: "create"
20236
20236
  });
20237
- const matchProps = chunk26CL47SW_cjs.normalizePersistedEdgeMatchProps(validatedProps);
20237
+ const matchProps = chunkPTFO3JI5_cjs.normalizePersistedEdgeMatchProps(validatedProps);
20238
20238
  validateMatchOnFields(edgeKind.schema, matchOn, kind);
20239
20239
  const validFrom = chunkNWJV4UVW_cjs.validateStatedValidityLowerBound(
20240
20240
  options?.validFrom,
@@ -20278,7 +20278,7 @@ async function executeEdgeGetOrCreateByEndpoints(ctx, kind, fromKind, fromId, to
20278
20278
  );
20279
20279
  if (currentLiveRow !== void 0) {
20280
20280
  assertEndpointClearCanApply(ifExists, options?.clearValidTo, kind);
20281
- return { edge: chunk26CL47SW_cjs.rowToEdge(currentLiveRow), action: "found" };
20281
+ return { edge: chunkPTFO3JI5_cjs.rowToEdge(currentLiveRow), action: "found" };
20282
20282
  }
20283
20283
  initialCandidateRead = {
20284
20284
  rows: currentRows,
@@ -20295,7 +20295,7 @@ async function executeEdgeGetOrCreateByEndpoints(ctx, kind, fromKind, fromId, to
20295
20295
  if (!isDeleted) {
20296
20296
  if (ifExists === "return") {
20297
20297
  assertEndpointClearCanApply(ifExists, options?.clearValidTo, kind);
20298
- return { edge: chunk26CL47SW_cjs.rowToEdge(matchedRow), action: "found" };
20298
+ return { edge: chunkPTFO3JI5_cjs.rowToEdge(matchedRow), action: "found" };
20299
20299
  }
20300
20300
  const outcome = await executeEdgeUpsertUpdateWithOutcome(
20301
20301
  ctx,
@@ -20490,7 +20490,7 @@ async function executeEdgeBulkGetOrCreateByEndpoints(ctx, kind, items, backend,
20490
20490
  const ifExists = options?.ifExists ?? "return";
20491
20491
  const registration = getEdgeRegistration(ctx.graph, kind);
20492
20492
  const edgeKind = registration.type;
20493
- chunkUOHFBYYH_cjs.assertEdgeMatchIdentityBackendSupport(
20493
+ chunkQ6ZVQWH7_cjs.assertEdgeMatchIdentityBackendSupport(
20494
20494
  registration.matchIdentity,
20495
20495
  backend.capabilities,
20496
20496
  kind
@@ -20503,15 +20503,15 @@ async function executeEdgeBulkGetOrCreateByEndpoints(ctx, kind, items, backend,
20503
20503
  validateMatchOnFields(edgeKind.schema, matchOn, kind);
20504
20504
  const validated = [];
20505
20505
  for (const item of items) {
20506
- chunk26CL47SW_cjs.assertValidityEndMutation(item, { entityType: "edge", kind });
20506
+ chunkPTFO3JI5_cjs.assertValidityEndMutation(item, { entityType: "edge", kind });
20507
20507
  if (item.clearValidTo === true) {
20508
- chunk26CL47SW_cjs.assertClearValidToSupported(backend, "edge");
20508
+ chunkPTFO3JI5_cjs.assertClearValidToSupported(backend, "edge");
20509
20509
  }
20510
- const validatedProps = chunkIV5W7LKW_cjs.validateEdgeProps(edgeKind.schema, item.props, {
20510
+ const validatedProps = chunkA22XPVBQ_cjs.validateEdgeProps(edgeKind.schema, item.props, {
20511
20511
  kind,
20512
20512
  operation: "create"
20513
20513
  });
20514
- const matchProps = chunk26CL47SW_cjs.normalizePersistedEdgeMatchProps(validatedProps);
20514
+ const matchProps = chunkPTFO3JI5_cjs.normalizePersistedEdgeMatchProps(validatedProps);
20515
20515
  const validFrom = chunkNWJV4UVW_cjs.validateStatedValidityLowerBound(
20516
20516
  item.validFrom,
20517
20517
  "validFrom"
@@ -20524,7 +20524,7 @@ async function executeEdgeBulkGetOrCreateByEndpoints(ctx, kind, items, backend,
20524
20524
  validTo
20525
20525
  );
20526
20526
  }
20527
- const compositeKey = chunk26CL47SW_cjs.buildEdgeMatchKey({
20527
+ const compositeKey = chunkPTFO3JI5_cjs.buildEdgeMatchKey({
20528
20528
  fromKind: item.fromKind,
20529
20529
  fromId: item.fromId,
20530
20530
  toKind: item.toKind,
@@ -20555,7 +20555,7 @@ async function executeEdgeBulkGetOrCreateByEndpoints(ctx, kind, items, backend,
20555
20555
  }
20556
20556
  });
20557
20557
  }
20558
- const atomicConvergenceExecutor = chunk26CL47SW_cjs.resolveAtomicEdgeConvergenceExecutor({
20558
+ const atomicConvergenceExecutor = chunkPTFO3JI5_cjs.resolveAtomicEdgeConvergenceExecutor({
20559
20559
  backend,
20560
20560
  graph: ctx.graph,
20561
20561
  schemaVersion: ctx.schemaVersion,
@@ -20581,7 +20581,7 @@ async function executeEdgeBulkGetOrCreateByEndpoints(ctx, kind, items, backend,
20581
20581
  ctx.registry
20582
20582
  );
20583
20583
  if (endpointError) throw endpointError;
20584
- const matchIdentity = chunk26CL47SW_cjs.resolveEdgeMatchIdentityStorage(
20584
+ const matchIdentity = chunkPTFO3JI5_cjs.resolveEdgeMatchIdentityStorage(
20585
20585
  registration.matchIdentity,
20586
20586
  {
20587
20587
  fromKind: entry2.fromKind,
@@ -20600,7 +20600,7 @@ async function executeEdgeBulkGetOrCreateByEndpoints(ctx, kind, items, backend,
20600
20600
  }
20601
20601
  const params = buildInsertEdgeParams(
20602
20602
  ctx.graphId,
20603
- chunkIV5W7LKW_cjs.generateId(),
20603
+ chunkA22XPVBQ_cjs.generateId(),
20604
20604
  kind,
20605
20605
  entry2.fromKind,
20606
20606
  entry2.fromId,
@@ -20649,7 +20649,7 @@ async function executeEdgeBulkGetOrCreateByEndpoints(ctx, kind, items, backend,
20649
20649
  }
20650
20650
  if (nativeResults !== void 0) {
20651
20651
  if (nativeResults.length !== nativeEntries.length) {
20652
- await chunkIV5W7LKW_cjs.diagnoseFusedSchemaFenceNoRow(ctx, backend);
20652
+ await chunkA22XPVBQ_cjs.diagnoseFusedSchemaFenceNoRow(ctx, backend);
20653
20653
  throw new chunkG7W67PZO_cjs.DatabaseOperationError(
20654
20654
  `Atomic edge convergence returned ${nativeResults.length} results, expected ${nativeEntries.length}.`,
20655
20655
  { operation: "insert", entity: "edge" }
@@ -20660,7 +20660,7 @@ async function executeEdgeBulkGetOrCreateByEndpoints(ctx, kind, items, backend,
20660
20660
  for (const [nativeIndex, nativeResult] of nativeResults.entries()) {
20661
20661
  const nativeEntry = chunkBXHAPCQG_cjs.requireDefined(nativeEntries[nativeIndex]);
20662
20662
  const result = {
20663
- edge: chunk26CL47SW_cjs.rowToEdge(nativeResult.row),
20663
+ edge: chunkPTFO3JI5_cjs.rowToEdge(nativeResult.row),
20664
20664
  action: nativeResult.outcome
20665
20665
  };
20666
20666
  results[nativeEntry.index] = result;
@@ -20832,7 +20832,7 @@ async function executeEdgeBulkGetOrCreateByEndpoints(ctx, kind, items, backend,
20832
20832
  const found = Array.from({ length: items.length });
20833
20833
  for (const entry2 of partition.toFetch) {
20834
20834
  assertEndpointClearCanApply(ifExists, entry2.clearValidTo, kind);
20835
- found[entry2.index] = { edge: chunk26CL47SW_cjs.rowToEdge(entry2.row), action: "found" };
20835
+ found[entry2.index] = { edge: chunkPTFO3JI5_cjs.rowToEdge(entry2.row), action: "found" };
20836
20836
  }
20837
20837
  for (const { index, sourceIndex } of partition.duplicateOf) {
20838
20838
  found[index] = {
@@ -20849,15 +20849,15 @@ async function executeEdgeBulkGetOrCreateByEndpoints(ctx, kind, items, backend,
20849
20849
  if (found !== void 0) return found;
20850
20850
  }
20851
20851
  function runBatch() {
20852
- return chunk26CL47SW_cjs.runWritePlan(
20852
+ return chunkPTFO3JI5_cjs.runWritePlan(
20853
20853
  ctx,
20854
20854
  // A bulk getOrCreate always converges on a match key no database key
20855
20855
  // backs, whatever its cardinality — the same reason the single-item path
20856
20856
  // fences unconditionally.
20857
- chunk26CL47SW_cjs.edgeWritePlan("edgeMatchKeyConvergence"),
20857
+ chunkPTFO3JI5_cjs.edgeWritePlan("edgeMatchKeyConvergence"),
20858
20858
  backend,
20859
20859
  async (session, target, _overlaidSession, lock) => {
20860
- const rawTarget = chunk26CL47SW_cjs.nestedManagedWriteTarget(target);
20860
+ const rawTarget = chunkPTFO3JI5_cjs.nestedManagedWriteTarget(target);
20861
20861
  const { toCreate, toFetch, duplicateOf } = partitionEntries(
20862
20862
  await fetchRowsByEndpoint(target)
20863
20863
  );
@@ -20935,7 +20935,7 @@ async function executeEdgeBulkGetOrCreateByEndpoints(ctx, kind, items, backend,
20935
20935
  if (entry2.isDeleted) continue;
20936
20936
  assertEndpointClearCanApply(ifExists, entry2.clearValidTo, kind);
20937
20937
  results[entry2.index] = {
20938
- edge: chunk26CL47SW_cjs.rowToEdge(entry2.row),
20938
+ edge: chunkPTFO3JI5_cjs.rowToEdge(entry2.row),
20939
20939
  action: "found"
20940
20940
  };
20941
20941
  }
@@ -20970,7 +20970,7 @@ async function executeEdgeBulkGetOrCreateByEndpoints(ctx, kind, items, backend,
20970
20970
  } else {
20971
20971
  assertEndpointClearCanApply(ifExists, entry2.clearValidTo, kind);
20972
20972
  results[entry2.index] = {
20973
- edge: chunk26CL47SW_cjs.rowToEdge(entry2.row),
20973
+ edge: chunkPTFO3JI5_cjs.rowToEdge(entry2.row),
20974
20974
  action: "found"
20975
20975
  };
20976
20976
  }
@@ -21008,7 +21008,7 @@ async function executeEdgeBulkGetOrCreateByEndpoints(ctx, kind, items, backend,
21008
21008
  var RECORDED_POINT_READ_FIXED_BIND_PARAMS = 8;
21009
21009
  var RECORDED_SCAN_LIMIT = 1e3;
21010
21010
  function recordedPointReadIdChunk(backend) {
21011
- const budget = chunkIV5W7LKW_cjs.recordedBindParamBudget(backend);
21011
+ const budget = chunkA22XPVBQ_cjs.recordedBindParamBudget(backend);
21012
21012
  return Math.max(1, budget - RECORDED_POINT_READ_FIXED_BIND_PARAMS);
21013
21013
  }
21014
21014
  function recordedRelationErrorDetails(backend, surface) {
@@ -21249,7 +21249,7 @@ function createRecordedReadService(params) {
21249
21249
  kind,
21250
21250
  ids,
21251
21251
  coordinate,
21252
- toEntity: (row) => chunk26CL47SW_cjs.rowToNode(mapRecordedNodeRow(row))
21252
+ toEntity: (row) => chunkPTFO3JI5_cjs.rowToNode(mapRecordedNodeRow(row))
21253
21253
  });
21254
21254
  }
21255
21255
  function edgeGetByIds(kind, ids, coordinate) {
@@ -21264,7 +21264,7 @@ function createRecordedReadService(params) {
21264
21264
  kind,
21265
21265
  ids,
21266
21266
  coordinate,
21267
- toEntity: (row) => chunk26CL47SW_cjs.rowToEdge(mapRecordedEdgeRow(row))
21267
+ toEntity: (row) => chunkPTFO3JI5_cjs.rowToEdge(mapRecordedEdgeRow(row))
21268
21268
  });
21269
21269
  }
21270
21270
  function nodeScan(kind, coordinate, options) {
@@ -21279,7 +21279,7 @@ function createRecordedReadService(params) {
21279
21279
  kind,
21280
21280
  coordinate,
21281
21281
  options,
21282
- toEntity: (row) => chunk26CL47SW_cjs.rowToNode(mapRecordedNodeRow(row))
21282
+ toEntity: (row) => chunkPTFO3JI5_cjs.rowToNode(mapRecordedNodeRow(row))
21283
21283
  });
21284
21284
  }
21285
21285
  function edgeScan(kind, coordinate, options) {
@@ -21294,7 +21294,7 @@ function createRecordedReadService(params) {
21294
21294
  kind,
21295
21295
  coordinate,
21296
21296
  options,
21297
- toEntity: (row) => chunk26CL47SW_cjs.rowToEdge(mapRecordedEdgeRow(row))
21297
+ toEntity: (row) => chunkPTFO3JI5_cjs.rowToEdge(mapRecordedEdgeRow(row))
21298
21298
  });
21299
21299
  }
21300
21300
  return {
@@ -21632,7 +21632,7 @@ function syncStoreReplacementRef(ref, replacement) {
21632
21632
  ref.current = replacement;
21633
21633
  }
21634
21634
  async function commitEvolvedSchemaWhenRequiredKindsAreEmpty(backend, graph, currentVersion, classification, storedSchema) {
21635
- const result = await chunk2GZL5ED3_cjs.commitNewSchemaVersionIfKindsEmpty(
21635
+ const result = await chunkOKA6H3B3_cjs.commitNewSchemaVersionIfKindsEmpty(
21636
21636
  backend,
21637
21637
  graph,
21638
21638
  currentVersion,
@@ -21685,7 +21685,7 @@ async function assertEvolvedSchemaRequiredKindsEmpty(backend, graphId, classific
21685
21685
  }
21686
21686
  var IDENTITY_FACADES = /* @__PURE__ */ new WeakMap();
21687
21687
  var StoreImplementation = class _StoreImplementation {
21688
- [chunkIV5W7LKW_cjs.STORE_RUNTIME];
21688
+ [chunkA22XPVBQ_cjs.STORE_RUNTIME];
21689
21689
  #graph;
21690
21690
  /**
21691
21691
  * Bare backend for DDL, vector-storage, and bulk-materialization work that must
@@ -21802,7 +21802,7 @@ var StoreImplementation = class _StoreImplementation {
21802
21802
  if (clockFencePlan.kind === "unfenced") {
21803
21803
  chunkEOLNL35G_cjs.refuseUnfencedClockAllocation(backend.dialect);
21804
21804
  }
21805
- chunkIV5W7LKW_cjs.assertRevisionTrackableBackend(backend);
21805
+ chunkA22XPVBQ_cjs.assertRevisionTrackableBackend(backend);
21806
21806
  }
21807
21807
  const explicitSchema = options?.schema === void 0 ? void 0 : chunkEOLNL35G_cjs.requireSqlSchema(options.schema, "store schema");
21808
21808
  const resolvedSchema = explicitSchema ?? (backend.tableNames ? chunkEOLNL35G_cjs.createSqlSchema(backend.tableNames) : void 0);
@@ -21823,7 +21823,7 @@ var StoreImplementation = class _StoreImplementation {
21823
21823
  chunkJFLJVLNU_cjs.requireRecordedTime(backend, "store construction"),
21824
21824
  readSchema
21825
21825
  ) : externalRecordedRead;
21826
- 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);
21827
21827
  this.#claimsVerdict = chunkOGK7F2J3_cjs.createClaimsVerdictThunk(this.#backend);
21828
21828
  this.#batchPointRead = chunkOGK7F2J3_cjs.batchPointReadVerdict(this.#backend);
21829
21829
  this.#uniqueSidecarBatch = chunkOGK7F2J3_cjs.uniqueSidecarBatchVerdict(this.#backend);
@@ -21841,19 +21841,19 @@ var StoreImplementation = class _StoreImplementation {
21841
21841
  mapRecordedNodeRow: chunk7BHUIAZR_cjs.createNodeRowMapper(rowMapperConfig),
21842
21842
  mapRecordedEdgeRow: chunk7BHUIAZR_cjs.createEdgeRowMapper(rowMapperConfig)
21843
21843
  });
21844
- this.#registry = chunk2GZL5ED3_cjs.buildKindRegistry(graph);
21844
+ this.#registry = chunkOKA6H3B3_cjs.buildKindRegistry(graph);
21845
21845
  this.#hooks = options?.hooks ?? {};
21846
21846
  this.#defaultTraversalExpansion = options?.queryDefaults?.traversalExpansion ?? "inverse";
21847
21847
  this.#options = options;
21848
21848
  this.#schemaMetadata = schemaMetadata ?? UNKNOWN_SCHEMA_METADATA;
21849
- this[chunkIV5W7LKW_cjs.STORE_RUNTIME] = {
21849
+ this[chunkA22XPVBQ_cjs.STORE_RUNTIME] = {
21850
21850
  backend: this.#backend,
21851
21851
  captureEnabled: this.#captureEnabled,
21852
21852
  uniqueSidecarBatch: this.#uniqueSidecarBatch,
21853
21853
  // The query path's own construction, not a second spelling of it: a
21854
21854
  // caller that could only rebuild this object could not observe the one
21855
21855
  // the queries actually run on.
21856
- queryBackend: (target) => this.#createHookedQueryBackend(target ?? this[chunkIV5W7LKW_cjs.STORE_RUNTIME].backend),
21856
+ queryBackend: (target) => this.#createHookedQueryBackend(target ?? this[chunkA22XPVBQ_cjs.STORE_RUNTIME].backend),
21857
21857
  sealedQuery: (coordinate) => this.sealedQuery(coordinate),
21858
21858
  recordedNodeGetById: (kind, id, coordinate) => this.recordedNodeGetById(kind, id, coordinate),
21859
21859
  recordedNodeGetByIds: (kind, ids, coordinate) => this.recordedNodeGetByIds(kind, ids, coordinate),
@@ -21900,8 +21900,8 @@ var StoreImplementation = class _StoreImplementation {
21900
21900
  if (upserts.every((upsert) => upsert.constraints.length === 0) && releases.length === 0) {
21901
21901
  return apply();
21902
21902
  }
21903
- const lock = await chunkIV5W7LKW_cjs.lockRecordedGraphWrite(target, this.graphId);
21904
- return chunkBPYZUJX5_cjs.applyResolvedNodeClaims(
21903
+ const lock = await chunkA22XPVBQ_cjs.lockRecordedGraphWrite(target, this.graphId);
21904
+ return chunkMTJAT6UO_cjs.applyResolvedNodeClaims(
21905
21905
  {
21906
21906
  graphId: this.graphId,
21907
21907
  registry: this.#registry,
@@ -21917,7 +21917,7 @@ var StoreImplementation = class _StoreImplementation {
21917
21917
  },
21918
21918
  liveNodesSharingIds: async (ids, target) => {
21919
21919
  const backend2 = target ?? this.#baseBackend;
21920
- const liveKindsById = await chunkUOHFBYYH_cjs.liveNodeKindsSharingIds(
21920
+ const liveKindsById = await chunkQ6ZVQWH7_cjs.liveNodeKindsSharingIds(
21921
21921
  this.#identityContext(backend2),
21922
21922
  backend2,
21923
21923
  ids
@@ -21932,21 +21932,21 @@ var StoreImplementation = class _StoreImplementation {
21932
21932
  if (this.#graph.identity === void 0) return /* @__PURE__ */ new Map();
21933
21933
  const backend2 = target ?? this.#baseBackend;
21934
21934
  const ctx = this.#identityContext(backend2);
21935
- const rows = await chunkUOHFBYYH_cjs.loadAssertionsByIds(
21935
+ const rows = await chunkQ6ZVQWH7_cjs.loadAssertionsByIds(
21936
21936
  backend2,
21937
21937
  ctx.schema,
21938
21938
  this.graphId,
21939
21939
  ids
21940
21940
  );
21941
21941
  return new Map(
21942
- [...rows].map(([id, row]) => [id, chunkUOHFBYYH_cjs.toTransferAssertion(row)])
21942
+ [...rows].map(([id, row]) => [id, chunkQ6ZVQWH7_cjs.toTransferAssertion(row)])
21943
21943
  );
21944
21944
  },
21945
21945
  structuralIdentityClasses: async (references, target) => {
21946
21946
  if (this.#graph.identity === void 0) return /* @__PURE__ */ new Map();
21947
21947
  const backend2 = target ?? this.#baseBackend;
21948
21948
  const ctx = this.#identityContext(backend2);
21949
- return chunkUOHFBYYH_cjs.loadCurrentStructuralClasses(
21949
+ return chunkQ6ZVQWH7_cjs.loadCurrentStructuralClasses(
21950
21950
  backend2,
21951
21951
  ctx.schema,
21952
21952
  this.graphId,
@@ -21962,7 +21962,7 @@ var StoreImplementation = class _StoreImplementation {
21962
21962
  applyIdentityMergeAtTarget: (target, retractions, assertions) => this.applyIdentityMergeAtTarget(target, retractions, assertions),
21963
21963
  assertIdentityClassesConsistentAtTarget: (target, seeds) => this.assertIdentityClassesConsistentAtTarget(target, seeds)
21964
21964
  };
21965
- Object.defineProperty(this, chunkIV5W7LKW_cjs.STORE_RUNTIME, {
21965
+ Object.defineProperty(this, chunkA22XPVBQ_cjs.STORE_RUNTIME, {
21966
21966
  configurable: false,
21967
21967
  enumerable: false,
21968
21968
  writable: false
@@ -21999,7 +21999,7 @@ var StoreImplementation = class _StoreImplementation {
21999
21999
  );
22000
22000
  const existing = IDENTITY_FACADES.get(this);
22001
22001
  if (existing !== void 0) return existing;
22002
- const facade = chunkUOHFBYYH_cjs.createIdentityFacade(this.#identityContext(this.#backend));
22002
+ const facade = chunkQ6ZVQWH7_cjs.createIdentityFacade(this.#identityContext(this.#backend));
22003
22003
  IDENTITY_FACADES.set(this, facade);
22004
22004
  return facade;
22005
22005
  }
@@ -22020,7 +22020,7 @@ var StoreImplementation = class _StoreImplementation {
22020
22020
  this.#requireIdentityEnabled();
22021
22021
  const recordedAsOf = coordinate.recorded?.asOf;
22022
22022
  if (recordedAsOf !== void 0 && chunkJFLJVLNU_cjs.isEngineNativeRecordedReadBinding(this.#recordedReadBinding)) {
22023
- chunkIV5W7LKW_cjs.refuseEngineNativeRecordedIdentityRead("identityAtCoordinate");
22023
+ chunkA22XPVBQ_cjs.refuseEngineNativeRecordedIdentityRead("identityAtCoordinate");
22024
22024
  }
22025
22025
  const backend = recordedAsOf === void 0 ? this.#backend : this.#recordedReads.backendForCoordinate(
22026
22026
  coordinate,
@@ -22032,7 +22032,7 @@ var StoreImplementation = class _StoreImplementation {
22032
22032
  this.#recordedReadBinding,
22033
22033
  "recorded-identity"
22034
22034
  );
22035
- return chunkUOHFBYYH_cjs.createIdentityReadFacade({
22035
+ return chunkQ6ZVQWH7_cjs.createIdentityReadFacade({
22036
22036
  ...this.#identityContext(backend),
22037
22037
  schema,
22038
22038
  coordinate
@@ -22061,7 +22061,7 @@ var StoreImplementation = class _StoreImplementation {
22061
22061
  * fails leaves no half-published derived relation behind.
22062
22062
  */
22063
22063
  async identitySchemaPreflight(target, provisionDerivedRelations) {
22064
- await chunk2GZL5ED3_cjs.identitySchemaCommitPreflight(this.#identityContext(this.#backend), {
22064
+ await chunkOKA6H3B3_cjs.identitySchemaCommitPreflight(this.#identityContext(this.#backend), {
22065
22065
  enablement: false,
22066
22066
  provisionDerivedRelations
22067
22067
  })(target);
@@ -22069,25 +22069,25 @@ var StoreImplementation = class _StoreImplementation {
22069
22069
  /** @internal Read-only startup integrity verification. */
22070
22070
  async validateIdentity() {
22071
22071
  if (this.#graph.identity === void 0) return;
22072
- await chunkUOHFBYYH_cjs.validateIdentityForContext(this.#identityContext(this.#baseBackend));
22072
+ await chunkQ6ZVQWH7_cjs.validateIdentityForContext(this.#identityContext(this.#baseBackend));
22073
22073
  }
22074
22074
  /** @internal Cascades removed kinds in the schema-commit transaction. */
22075
22075
  async removeIdentityKindsInSchemaPreflight(target, kinds, options) {
22076
22076
  if (!this.#captureEnabled) {
22077
- await chunkUOHFBYYH_cjs.removeIdentityKindsForContext(
22077
+ await chunkQ6ZVQWH7_cjs.removeIdentityKindsForContext(
22078
22078
  this.#identityContext(target),
22079
22079
  kinds,
22080
22080
  options
22081
22081
  );
22082
22082
  return;
22083
22083
  }
22084
- const scope = chunkIV5W7LKW_cjs.createRecordedTransactionScope(
22084
+ const scope = chunkA22XPVBQ_cjs.createRecordedTransactionScope(
22085
22085
  target,
22086
22086
  this.#batchPointRead,
22087
22087
  this.#sqlSchema(),
22088
22088
  target.dialect === "sqlite"
22089
22089
  );
22090
- await chunkUOHFBYYH_cjs.removeIdentityKindsForContext(
22090
+ await chunkQ6ZVQWH7_cjs.removeIdentityKindsForContext(
22091
22091
  this.#identityContext(scope.backend),
22092
22092
  kinds,
22093
22093
  options
@@ -22101,7 +22101,7 @@ var StoreImplementation = class _StoreImplementation {
22101
22101
  */
22102
22102
  readCurrentIdentityAssertions(mode, options) {
22103
22103
  if (this.#graph.identity === void 0) return Promise.resolve([]);
22104
- return chunkUOHFBYYH_cjs.readIdentityAssertionsForInterchange(
22104
+ return chunkQ6ZVQWH7_cjs.readIdentityAssertionsForInterchange(
22105
22105
  this.#identityContext(this.#baseBackend),
22106
22106
  mode,
22107
22107
  options
@@ -22110,7 +22110,7 @@ var StoreImplementation = class _StoreImplementation {
22110
22110
  /** @internal Reads identity truth through an already-bound transaction. */
22111
22111
  identityAssertionsAtTarget(target, mode = "state") {
22112
22112
  if (this.#graph.identity === void 0) return Promise.resolve([]);
22113
- return chunkUOHFBYYH_cjs.readIdentityAssertionsForInterchange(
22113
+ return chunkQ6ZVQWH7_cjs.readIdentityAssertionsForInterchange(
22114
22114
  this.#identityContext(target),
22115
22115
  mode
22116
22116
  );
@@ -22120,7 +22120,7 @@ var StoreImplementation = class _StoreImplementation {
22120
22120
  if (this.#graph.identity === void 0) {
22121
22121
  return Promise.resolve({ assertions: [], done: true });
22122
22122
  }
22123
- return chunkUOHFBYYH_cjs.readIdentityAssertionPageAtTarget(
22123
+ return chunkQ6ZVQWH7_cjs.readIdentityAssertionPageAtTarget(
22124
22124
  this.#identityContext(target),
22125
22125
  target,
22126
22126
  mode,
@@ -22129,14 +22129,14 @@ var StoreImplementation = class _StoreImplementation {
22129
22129
  }
22130
22130
  /** @internal Acquires the enabled graph's identity lock for an import. */
22131
22131
  lockIdentityImportTarget(target) {
22132
- return this.#graph.identity === void 0 ? Promise.resolve() : chunkUOHFBYYH_cjs.lockIdentityGraph(target, this.graphId);
22132
+ return this.#graph.identity === void 0 ? Promise.resolve() : chunkQ6ZVQWH7_cjs.lockIdentityGraph(target, this.graphId);
22133
22133
  }
22134
22134
  /** @internal Restores same-id folding after the ops-layer import bypass. */
22135
22135
  foldImportedIdentityNodes(target, references) {
22136
22136
  if (this.#graph.identity === void 0 || references.length === 0) {
22137
22137
  return Promise.resolve();
22138
22138
  }
22139
- return chunkUOHFBYYH_cjs.foldIdentityForCreatedNodes(
22139
+ return chunkQ6ZVQWH7_cjs.foldIdentityForCreatedNodes(
22140
22140
  {
22141
22141
  graphId: this.graphId,
22142
22142
  registry: this.#registry,
@@ -22158,7 +22158,7 @@ var StoreImplementation = class _StoreImplementation {
22158
22158
  { code: "IDENTITY_IMPORT_REQUIRES_PROFILE", graphId: this.graphId }
22159
22159
  );
22160
22160
  }
22161
- return chunkUOHFBYYH_cjs.importIdentityAssertionsIntoTarget(
22161
+ return chunkQ6ZVQWH7_cjs.importIdentityAssertionsIntoTarget(
22162
22162
  // The slice the coordinator reads — graph, registry, schema, folding
22163
22163
  // mode — none of which depend on the target. The target it writes
22164
22164
  // through is the parameter beside it, which is why this method can take
@@ -22178,7 +22178,7 @@ var StoreImplementation = class _StoreImplementation {
22178
22178
  if (this.#graph.identity === void 0 || seeds.length === 0) {
22179
22179
  return Promise.resolve();
22180
22180
  }
22181
- return chunkUOHFBYYH_cjs.assertAffectedIdentityClassesConsistent(
22181
+ return chunkQ6ZVQWH7_cjs.assertAffectedIdentityClassesConsistent(
22182
22182
  this.#identityContext(target),
22183
22183
  target,
22184
22184
  seeds
@@ -22195,7 +22195,7 @@ var StoreImplementation = class _StoreImplementation {
22195
22195
  { code: "IDENTITY_MERGE_REQUIRES_PROFILE", graphId: this.graphId }
22196
22196
  );
22197
22197
  }
22198
- return chunkUOHFBYYH_cjs.applyIdentityChangesForContext(
22198
+ return chunkQ6ZVQWH7_cjs.applyIdentityChangesForContext(
22199
22199
  this.#identityContext(target),
22200
22200
  retractions,
22201
22201
  assertions
@@ -22623,7 +22623,7 @@ var StoreImplementation = class _StoreImplementation {
22623
22623
  * between "proceed" and "ask the user" *before* attempting a commit.
22624
22624
  */
22625
22625
  async schemaChanges() {
22626
- return chunk2GZL5ED3_cjs.getSchemaChanges(this.#backend, this.#graph);
22626
+ return chunkOKA6H3B3_cjs.getSchemaChanges(this.#backend, this.#graph);
22627
22627
  }
22628
22628
  /**
22629
22629
  * Whether committing this store's graph would require a schema migration —
@@ -22635,7 +22635,7 @@ var StoreImplementation = class _StoreImplementation {
22635
22635
  * through a user's request.
22636
22636
  */
22637
22637
  async requiresMigration() {
22638
- return chunk2GZL5ED3_cjs.requiresMigration(this.#backend, this.#graph);
22638
+ return chunkOKA6H3B3_cjs.requiresMigration(this.#backend, this.#graph);
22639
22639
  }
22640
22640
  /**
22641
22641
  * Node operations bound to this store instance.
@@ -22651,7 +22651,7 @@ var StoreImplementation = class _StoreImplementation {
22651
22651
  async #maybeRefreshStatisticsAfterBulk(rowCount) {
22652
22652
  const configured = this.#options?.autoRefreshStatistics;
22653
22653
  if (configured === false) return;
22654
- const threshold = configured ?? chunkIV5W7LKW_cjs.AUTO_REFRESH_STATISTICS_ROW_THRESHOLD;
22654
+ const threshold = configured ?? chunkA22XPVBQ_cjs.AUTO_REFRESH_STATISTICS_ROW_THRESHOLD;
22655
22655
  if (rowCount < threshold) return;
22656
22656
  try {
22657
22657
  await this.refreshStatistics();
@@ -22665,13 +22665,13 @@ var StoreImplementation = class _StoreImplementation {
22665
22665
  #buildNodeOperations(ctx) {
22666
22666
  return {
22667
22667
  defaultTemporalMode: this.#graph.defaults.temporalMode,
22668
- rowToNode: (row) => chunk26CL47SW_cjs.rowToNode(row),
22668
+ rowToNode: (row) => chunkPTFO3JI5_cjs.rowToNode(row),
22669
22669
  maybeRefreshStatisticsAfterBulk: (rowCount) => this.#maybeRefreshStatisticsAfterBulk(rowCount),
22670
- executeCreate: (input, backend) => chunk26CL47SW_cjs.executeNodeCreate(ctx, input, backend),
22671
- executeCreateBatch: (inputs, backend, options) => chunk26CL47SW_cjs.executeNodeCreateBatch(ctx, inputs, backend, options),
22672
- executeCreateNoReturnBatch: (inputs, backend) => chunk26CL47SW_cjs.executeNodeCreateNoReturnBatch(ctx, inputs, backend),
22673
- executeUpdate: (input, backend, options) => chunk26CL47SW_cjs.executeNodeUpdate(ctx, { ...input, id: input.id }, backend, options),
22674
- executeNodeSetUpdate: (kind, patch, candidateIds, candidateIdColumn, backend, options) => chunk26CL47SW_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(
22675
22675
  ctx,
22676
22676
  kind,
22677
22677
  patch,
@@ -22680,20 +22680,20 @@ var StoreImplementation = class _StoreImplementation {
22680
22680
  backend,
22681
22681
  options
22682
22682
  ),
22683
- executeUpsertUpdateBatch: (entries, backend) => chunk26CL47SW_cjs.executeNodeUpsertUpdateBatch(ctx, entries, backend),
22684
- executeResolvedMutationSet: (creates, updates, backend) => chunk26CL47SW_cjs.executeNodeResolvedMutationSet(ctx, creates, updates, backend),
22685
- prepareReplacement: (kind, props) => chunk26CL47SW_cjs.prepareNodeReplacement(ctx, kind, props),
22686
- executeReplacementBatch: (kind, items, backend) => chunk26CL47SW_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),
22687
22687
  // Present only when opted in; its absence is the coalesce off switch.
22688
22688
  ...ctx.coalesceUnchangedUpsertsEnabled && {
22689
- upsertDirtyCheck: (kind, id, existingProps, inputProps) => chunk26CL47SW_cjs.nodeUpsertDirtyCheck(ctx, kind, id, existingProps, inputProps)
22689
+ upsertDirtyCheck: (kind, id, existingProps, inputProps) => chunkPTFO3JI5_cjs.nodeUpsertDirtyCheck(ctx, kind, id, existingProps, inputProps)
22690
22690
  },
22691
- executeDelete: (kind, id, backend) => chunk26CL47SW_cjs.executeNodeDelete(ctx, kind, id, backend),
22692
- executeDeleteBatch: (kind, ids, backend) => chunk26CL47SW_cjs.executeNodeDeleteBatch(ctx, kind, ids, backend),
22693
- executeHardDelete: (kind, id, backend) => chunk26CL47SW_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),
22694
22694
  temporalRowMatcher: (options) => this.#temporalRowMatcher(options),
22695
22695
  createQuery: () => this.query(),
22696
- executeGetOrCreateByConstraint: (kind, constraintName, props, backend, options) => chunk26CL47SW_cjs.executeNodeGetOrCreateByConstraint(
22696
+ executeGetOrCreateByConstraint: (kind, constraintName, props, backend, options) => chunkPTFO3JI5_cjs.executeNodeGetOrCreateByConstraint(
22697
22697
  ctx,
22698
22698
  kind,
22699
22699
  constraintName,
@@ -22701,7 +22701,7 @@ var StoreImplementation = class _StoreImplementation {
22701
22701
  backend,
22702
22702
  options
22703
22703
  ),
22704
- executeBulkGetOrCreateByConstraint: (kind, constraintName, items, backend, options) => chunk26CL47SW_cjs.executeNodeBulkGetOrCreateByConstraint(
22704
+ executeBulkGetOrCreateByConstraint: (kind, constraintName, items, backend, options) => chunkPTFO3JI5_cjs.executeNodeBulkGetOrCreateByConstraint(
22705
22705
  ctx,
22706
22706
  kind,
22707
22707
  constraintName,
@@ -22709,15 +22709,15 @@ var StoreImplementation = class _StoreImplementation {
22709
22709
  backend,
22710
22710
  options
22711
22711
  ),
22712
- executeFindByConstraint: (kind, constraintName, props, backend) => chunk26CL47SW_cjs.executeNodeFindByConstraint(ctx, kind, constraintName, props, backend),
22713
- executeBulkFindByConstraint: (kind, constraintName, items, backend) => chunk26CL47SW_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(
22714
22714
  ctx,
22715
22715
  kind,
22716
22716
  constraintName,
22717
22717
  items,
22718
22718
  backend
22719
22719
  ),
22720
- executeBulkFindByIndex: (kind, indexName, items, backend, options) => chunk26CL47SW_cjs.executeNodeBulkFindByIndex(
22720
+ executeBulkFindByIndex: (kind, indexName, items, backend, options) => chunkPTFO3JI5_cjs.executeNodeBulkFindByIndex(
22721
22721
  ctx,
22722
22722
  kind,
22723
22723
  indexName,
@@ -22736,7 +22736,7 @@ var StoreImplementation = class _StoreImplementation {
22736
22736
  #buildEdgeOperations(ctx) {
22737
22737
  return {
22738
22738
  defaultTemporalMode: this.#graph.defaults.temporalMode,
22739
- rowToEdge: (row) => chunk26CL47SW_cjs.rowToEdge(row),
22739
+ rowToEdge: (row) => chunkPTFO3JI5_cjs.rowToEdge(row),
22740
22740
  maybeRefreshStatisticsAfterBulk: (rowCount) => this.#maybeRefreshStatisticsAfterBulk(rowCount),
22741
22741
  executeCreate: (input, backend) => executeEdgeCreate(ctx, input, backend),
22742
22742
  executeCreateBatch: (inputs, backend) => executeEdgeCreateBatch(ctx, inputs, backend),
@@ -22966,7 +22966,7 @@ var StoreImplementation = class _StoreImplementation {
22966
22966
  );
22967
22967
  }
22968
22968
  const recordedAt = await chunkEOLNL35G_cjs.withRecordedRelationsPrecondition(
22969
- chunkIV5W7LKW_cjs.readRecordedClock(this.#backend, this.#sqlSchema(), this.graphId),
22969
+ chunkA22XPVBQ_cjs.readRecordedClock(this.#backend, this.#sqlSchema(), this.graphId),
22970
22970
  { dialect: this.#backend.dialect, surface: "recorded-now" }
22971
22971
  );
22972
22972
  return recordedAt === void 0 ? void 0 : chunkNWJV4UVW_cjs.asRecordedInstant(recordedAt);
@@ -23013,7 +23013,7 @@ var StoreImplementation = class _StoreImplementation {
23013
23013
  return this.#engineRecordedInstant(this.#backend);
23014
23014
  }
23015
23015
  if (!this.#revisionTrackingEnabled) return void 0;
23016
- return chunkIV5W7LKW_cjs.readRecordedClock(this.#backend, this.#sqlSchema(), this.graphId);
23016
+ return chunkA22XPVBQ_cjs.readRecordedClock(this.#backend, this.#sqlSchema(), this.graphId);
23017
23017
  }
23018
23018
  /**
23019
23019
  * Returns the durable random namespace for this graph's revision clock. A
@@ -23041,7 +23041,7 @@ var StoreImplementation = class _StoreImplementation {
23041
23041
  { code: "REVISION_ORIGIN_REQUIRES_TRACKING" }
23042
23042
  );
23043
23043
  }
23044
- return chunkIV5W7LKW_cjs.ensureRevisionOrigin(
23044
+ return chunkA22XPVBQ_cjs.ensureRevisionOrigin(
23045
23045
  this.#baseBackend,
23046
23046
  this.#recordedRevisionOrigins,
23047
23047
  this.#sqlSchema(),
@@ -23147,17 +23147,14 @@ var StoreImplementation = class _StoreImplementation {
23147
23147
  * adapter may reuse one client there too. The portable guarantee is only
23148
23148
  * that at most one query is in flight at a time.
23149
23149
  *
23150
- * **Not a snapshot — and there is no way to make it one.** PostgreSQL
23151
- * defaults to read-committed isolation, so a later query can observe a
23152
- * commit the earlier ones did not. `store.transaction()` takes an
23153
- * `isolationLevel`, but its context exposes only `nodes` / `edges`: there is
23154
- * no public way to run a fluent query or a batch inside a transaction, so a
23155
- * snapshot across fluent queries is not available today. Collection reads
23156
- * can have one — `store.transaction(fn, { isolationLevel: "repeatable_read" })`
23157
- * reading through `tx.nodes` / `tx.edges` — but only where the backend has
23158
- * transactions (other backends refuse before invoking the callback), and a history-enabled
23159
- * store on PostgreSQL additionally requires `accessMode: "read_only"` or the
23160
- * 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.
23161
23158
  *
23162
23159
  * **Will not fix an N+1.** Serializing N queries does not reduce their
23163
23160
  * number. The alternatives are set-oriented or chunked rather than
@@ -23219,23 +23216,33 @@ var StoreImplementation = class _StoreImplementation {
23219
23216
  * here.
23220
23217
  */
23221
23218
  async batchOnce(build) {
23222
- const queries = build({
23219
+ return this.#batchOnceForBackend(this.#baseBackend, 1, build);
23220
+ }
23221
+ #createBatchReadBuilder(backend, attempt) {
23222
+ return {
23223
23223
  neighbors: (source, options) => {
23224
23224
  this.#assertNeighborKinds(source, options.edges);
23225
- return createNeighborRead(this.#neighborContext(), source, options);
23225
+ return createNeighborRead(
23226
+ this.#neighborContext(backend, attempt),
23227
+ source,
23228
+ options
23229
+ );
23226
23230
  },
23227
23231
  countNeighbors: (source, options) => {
23228
23232
  this.#assertNeighborKinds(source, options.edges);
23229
23233
  return createNeighborCountRead(
23230
- this.#neighborContext(),
23234
+ this.#neighborContext(backend, attempt),
23231
23235
  source,
23232
23236
  options
23233
23237
  );
23234
23238
  },
23235
- subgraph: (rootId, options) => this.#createSubgraphRead(rootId, options)
23236
- });
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));
23237
23244
  return executeOneStatementBatch(
23238
- this.#createHookedQueryBackend(this.#baseBackend),
23245
+ this.#createHookedQueryBackend(backend, attempt),
23239
23246
  queries
23240
23247
  );
23241
23248
  }
@@ -23249,10 +23256,10 @@ var StoreImplementation = class _StoreImplementation {
23249
23256
  this.#assertNeighborKinds(source, options.edges);
23250
23257
  return countNeighbors(this.#neighborContext(), source, options);
23251
23258
  }
23252
- #neighborContext() {
23259
+ #neighborContext(backend = this.#backend, attempt = 1) {
23253
23260
  return {
23254
23261
  graphId: this.graphId,
23255
- backend: this.#createHookedQueryBackend(this.#backend),
23262
+ backend: this.#createHookedQueryBackend(backend, attempt),
23256
23263
  schema: this.#sqlSchema(),
23257
23264
  defaultTemporalMode: this.#graph.defaults.temporalMode,
23258
23265
  registry: this.#registry
@@ -23363,7 +23370,7 @@ var StoreImplementation = class _StoreImplementation {
23363
23370
  });
23364
23371
  const edgesBySource = /* @__PURE__ */ new Map();
23365
23372
  for (const row of rows) {
23366
- const edge = chunk26CL47SW_cjs.rowToEdge(row);
23373
+ const edge = chunkPTFO3JI5_cjs.rowToEdge(row);
23367
23374
  const key = side === "from" ? `${edge.fromKind}\0${edge.fromId}` : `${edge.toKind}\0${edge.toId}`;
23368
23375
  const bucket = edgesBySource.get(key);
23369
23376
  if (bucket === void 0) edgesBySource.set(key, [edge]);
@@ -23425,30 +23432,29 @@ var StoreImplementation = class _StoreImplementation {
23425
23432
  * ```
23426
23433
  */
23427
23434
  async subgraph(rootId, options) {
23428
- assertNoRecordedCoordinate(options, {
23429
- code: "SUBGRAPH_RECORDED_ASOF_INTERNAL_ONLY",
23430
- message: "recordedAsOf is only available through store.asOfRecorded(...).subgraph(...).",
23431
- suggestion: "Use store.asOfRecorded(recordedAt).subgraph(rootId, options) instead of passing recordedAsOf directly."
23432
- });
23435
+ this.#assertPublicSubgraphOptions(options);
23433
23436
  return this.subgraphAtCoordinate(rootId, options);
23434
23437
  }
23435
- #createSubgraphRead(rootId, options) {
23436
- assertNoRecordedCoordinate(options, {
23437
- code: "SUBGRAPH_RECORDED_ASOF_INTERNAL_ONLY",
23438
- message: "recordedAsOf is only available through store.asOfRecorded(...).subgraph(...).",
23439
- suggestion: "Use store.asOfRecorded(recordedAt).subgraph(rootId, options) instead of passing recordedAsOf directly."
23440
- });
23438
+ #createSubgraphRead(rootId, options, backend = this.#baseBackend, attempt = 1) {
23439
+ this.#assertPublicSubgraphOptions(options);
23441
23440
  return createSubgraphRead({
23442
23441
  graph: this.#graph,
23443
23442
  graphId: this.graphId,
23444
23443
  rootId,
23445
- backend: this.#createHookedQueryBackend(this.#baseBackend),
23446
- dialect: chunkD5CHUSW7_cjs.getDialect(this.#backend.dialect),
23444
+ backend: this.#createHookedQueryBackend(backend, attempt),
23445
+ dialect: chunkD5CHUSW7_cjs.getDialect(backend.dialect),
23447
23446
  schema: this.#schema,
23448
23447
  recordedReadBinding: this.#recordedReadBinding,
23449
23448
  options
23450
23449
  });
23451
23450
  }
23451
+ #assertPublicSubgraphOptions(options) {
23452
+ assertNoRecordedCoordinate(options, {
23453
+ code: "SUBGRAPH_RECORDED_ASOF_INTERNAL_ONLY",
23454
+ message: "recordedAsOf is only available through store.asOfRecorded(...).subgraph(...).",
23455
+ suggestion: "Use store.asOfRecorded(recordedAt).subgraph(rootId, options) instead of passing recordedAsOf directly."
23456
+ });
23457
+ }
23452
23458
  /**
23453
23459
  * Internal seam for {@link StoreView} / {@link RecordedStoreView}: runs a
23454
23460
  * subgraph with a coordinate already flattened into the options (including a
@@ -23550,15 +23556,15 @@ var StoreImplementation = class _StoreImplementation {
23550
23556
  const runBulkHooks = this.#createBufferedBulkHookRunner(pending);
23551
23557
  const receiptRecorder = createReceiptRecorder?.();
23552
23558
  let recordedByGraph;
23553
- 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) => {
23554
23560
  recordedByGraph = instants;
23555
23561
  }) : backendOptions;
23556
23562
  try {
23557
23563
  const run = async (txBackend, nativeTransaction) => {
23558
- 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;
23559
23565
  const writeTarget = mutationWitness === void 0 ? txBackend : mutationWitness.wrap(txBackend);
23560
23566
  if (mutationWitness !== void 0) {
23561
- chunkIV5W7LKW_cjs.registerRecordedIdentityMutationWitness(
23567
+ chunkA22XPVBQ_cjs.registerRecordedIdentityMutationWitness(
23562
23568
  writeTarget,
23563
23569
  txBackend,
23564
23570
  mutationWitness.sink
@@ -23574,7 +23580,7 @@ var StoreImplementation = class _StoreImplementation {
23574
23580
  frame.attempt
23575
23581
  )
23576
23582
  );
23577
- const invokeWithSchemaFenceLease = () => this.#adapterBackend === void 0 ? chunkIV5W7LKW_cjs.withTransactionSchemaFenceLease(
23583
+ const invokeWithSchemaFenceLease = () => this.#adapterBackend === void 0 ? chunkA22XPVBQ_cjs.withTransactionSchemaFenceLease(
23578
23584
  {
23579
23585
  graphId: this.graphId,
23580
23586
  schemaVersion: this.#schemaMetadata.schemaVersion
@@ -23582,7 +23588,7 @@ var StoreImplementation = class _StoreImplementation {
23582
23588
  writeTarget,
23583
23589
  invokeTransaction
23584
23590
  ) : invokeTransaction();
23585
- const output = await chunkIV5W7LKW_cjs.withWriteTransactionSession(
23591
+ const output = await chunkA22XPVBQ_cjs.withWriteTransactionSession(
23586
23592
  writeTarget,
23587
23593
  {
23588
23594
  graphId: this.graphId,
@@ -23722,7 +23728,7 @@ var StoreImplementation = class _StoreImplementation {
23722
23728
  */
23723
23729
  withTransaction(externalTx) {
23724
23730
  if (this.#captureEnabled) {
23725
- throw chunkIV5W7LKW_cjs.recordedCaptureRequiresCallbackTransactionError();
23731
+ throw chunkA22XPVBQ_cjs.recordedCaptureRequiresCallbackTransactionError();
23726
23732
  }
23727
23733
  const adopt = this.#adapterBackend?.adoptTransaction;
23728
23734
  if (adopt === void 0) {
@@ -23746,8 +23752,8 @@ var StoreImplementation = class _StoreImplementation {
23746
23752
  }
23747
23753
  const txBackend = adopt(externalTx);
23748
23754
  if (this.#captureEnabled) {
23749
- await chunkIV5W7LKW_cjs.assertRecordedCaptureTransactionIsolation(txBackend);
23750
- await chunkIV5W7LKW_cjs.lockSchemaVersionForStoreWrite(
23755
+ await chunkA22XPVBQ_cjs.assertRecordedCaptureTransactionIsolation(txBackend);
23756
+ await chunkA22XPVBQ_cjs.lockSchemaVersionForStoreWrite(
23751
23757
  {
23752
23758
  graphId: this.graphId,
23753
23759
  schemaVersion: this.#schemaMetadata.schemaVersion
@@ -23755,7 +23761,7 @@ var StoreImplementation = class _StoreImplementation {
23755
23761
  txBackend
23756
23762
  );
23757
23763
  }
23758
- const scope = this.#captureEnabled ? chunkIV5W7LKW_cjs.createRecordedTransactionScope(
23764
+ const scope = this.#captureEnabled ? chunkA22XPVBQ_cjs.createRecordedTransactionScope(
23759
23765
  txBackend,
23760
23766
  this.#batchPointRead,
23761
23767
  this.#sqlSchema()
@@ -23764,13 +23770,13 @@ var StoreImplementation = class _StoreImplementation {
23764
23770
  flush: () => Promise.resolve(EMPTY_RECORDED_FLUSH_INSTANTS)
23765
23771
  };
23766
23772
  if (this.#captureEnabled) {
23767
- await chunkIV5W7LKW_cjs.lockRecordedGraphWrite(scope.backend, this.graphId);
23773
+ await chunkA22XPVBQ_cjs.lockRecordedGraphWrite(scope.backend, this.graphId);
23768
23774
  }
23769
23775
  const receiptRecorder = createTransactionReceiptRecorder();
23770
- const mutationWitness = this.#engineNativeHistory ? chunkIV5W7LKW_cjs.createMutationWitness() : void 0;
23776
+ const mutationWitness = this.#engineNativeHistory ? chunkA22XPVBQ_cjs.createMutationWitness() : void 0;
23771
23777
  const writeTarget = mutationWitness === void 0 ? scope.backend : mutationWitness.wrap(scope.backend);
23772
23778
  if (mutationWitness !== void 0) {
23773
- chunkIV5W7LKW_cjs.registerRecordedIdentityMutationWitness(
23779
+ chunkA22XPVBQ_cjs.registerRecordedIdentityMutationWitness(
23774
23780
  writeTarget,
23775
23781
  scope.backend,
23776
23782
  mutationWitness.sink
@@ -23834,9 +23840,34 @@ var StoreImplementation = class _StoreImplementation {
23834
23840
  };
23835
23841
  return overlayPropertyDescriptors(context, { measure });
23836
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
+ }
23837
23867
  /**
23838
- * Builds the `{ nodes, edges, sql }` projection bound to a
23839
- * 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}
23840
23871
  * (TypeGraph opens the tx) and {@link withTransaction} (#134 — the
23841
23872
  * caller opened it) so both surfaces resolve collections, query
23842
23873
  * factories, and the reused graph/registry identically. When history capture
@@ -23886,15 +23917,16 @@ var StoreImplementation = class _StoreImplementation {
23886
23917
  receiptRecorder
23887
23918
  ));
23888
23919
  }
23889
- const identity = this.#graph.identity === void 0 ? void 0 : chunkUOHFBYYH_cjs.createIdentityFacade(this.#identityContext(txBackend));
23920
+ const identity = this.#graph.identity === void 0 ? void 0 : chunkQ6ZVQWH7_cjs.createIdentityFacade(this.#identityContext(txBackend));
23890
23921
  const receiptIdentity = identity === void 0 || receiptRecorder === void 0 ? identity : wrapTransactionIdentity(identity, receiptRecorder);
23891
23922
  const getNodeCollection = (kind) => this.#resolveDynamicNodeCollection(nodes, kind);
23892
23923
  const base = {
23893
23924
  nodes,
23894
23925
  edges,
23926
+ ...this.#createTransactionReadSurface(txBackend, attempt),
23895
23927
  ...receiptIdentity === void 0 ? {} : { identity: receiptIdentity },
23896
23928
  backend: chunkEOLNL35G_cjs.createTransactionReadBackend(txBackend),
23897
- [chunkIV5W7LKW_cjs.TRANSACTION_RUNTIME]: { backend: txBackend, runNodeOperationHooks },
23929
+ [chunkA22XPVBQ_cjs.TRANSACTION_RUNTIME]: { backend: txBackend, runNodeOperationHooks },
23898
23930
  getNodeCollection,
23899
23931
  ...this.#edgeCollectionAccess(edges)
23900
23932
  };
@@ -23904,7 +23936,7 @@ var StoreImplementation = class _StoreImplementation {
23904
23936
  ...base,
23905
23937
  sqlAvailability: "history"
23906
23938
  };
23907
- defineUnavailableSqlGuard(withSql, () => chunkIV5W7LKW_cjs.throwHistoryUnsafeSqlAccess());
23939
+ defineUnavailableSqlGuard(withSql, () => chunkA22XPVBQ_cjs.throwHistoryUnsafeSqlAccess());
23908
23940
  } else if (this.#revisionTrackingEnabled) {
23909
23941
  withSql = {
23910
23942
  ...base,
@@ -23912,14 +23944,14 @@ var StoreImplementation = class _StoreImplementation {
23912
23944
  };
23913
23945
  defineUnavailableSqlGuard(
23914
23946
  withSql,
23915
- () => chunkIV5W7LKW_cjs.throwRevisionTrackingUnsafeSqlAccess()
23947
+ () => chunkA22XPVBQ_cjs.throwRevisionTrackingUnsafeSqlAccess()
23916
23948
  );
23917
23949
  } else if (sql2 === void 0) {
23918
23950
  withSql = { ...base, sqlAvailability: "unavailable" };
23919
23951
  } else {
23920
23952
  withSql = { ...base, sql: sql2, sqlAvailability: "available" };
23921
23953
  }
23922
- Object.defineProperty(withSql, chunkIV5W7LKW_cjs.TRANSACTION_RUNTIME, {
23954
+ Object.defineProperty(withSql, chunkA22XPVBQ_cjs.TRANSACTION_RUNTIME, {
23923
23955
  configurable: false,
23924
23956
  enumerable: false,
23925
23957
  writable: false
@@ -23960,7 +23992,7 @@ var StoreImplementation = class _StoreImplementation {
23960
23992
  for (const [index, node] of nodes.entries()) {
23961
23993
  if (node !== void 0) {
23962
23994
  loadedByReference.set(
23963
- chunkUOHFBYYH_cjs.refKey({ kind, id: chunkBXHAPCQG_cjs.requireDefined(ids[index]) }),
23995
+ chunkQ6ZVQWH7_cjs.refKey({ kind, id: chunkBXHAPCQG_cjs.requireDefined(ids[index]) }),
23964
23996
  node
23965
23997
  );
23966
23998
  }
@@ -23980,14 +24012,14 @@ var StoreImplementation = class _StoreImplementation {
23980
24012
  if (row === void 0) continue;
23981
24013
  if (!includeTombstoned && row.deleted_at !== void 0) continue;
23982
24014
  loadedByReference.set(
23983
- chunkUOHFBYYH_cjs.refKey({ kind, id: row.id }),
23984
- chunk26CL47SW_cjs.rowToNode(row)
24015
+ chunkQ6ZVQWH7_cjs.refKey({ kind, id: row.id }),
24016
+ chunkPTFO3JI5_cjs.rowToNode(row)
23985
24017
  );
23986
24018
  }
23987
24019
  })
23988
24020
  );
23989
24021
  return references.map(
23990
- (reference) => loadedByReference.get(chunkUOHFBYYH_cjs.refKey(reference))
24022
+ (reference) => loadedByReference.get(chunkQ6ZVQWH7_cjs.refKey(reference))
23991
24023
  );
23992
24024
  }
23993
24025
  };
@@ -24003,30 +24035,30 @@ var StoreImplementation = class _StoreImplementation {
24003
24035
  * The store is usable after clearing — new data can be created immediately.
24004
24036
  */
24005
24037
  async clear() {
24006
- const mintsAnchorOrigin = chunkIV5W7LKW_cjs.mintsOriginNamespacedAnchor(
24038
+ const mintsAnchorOrigin = chunkA22XPVBQ_cjs.mintsOriginNamespacedAnchor(
24007
24039
  this,
24008
24040
  this.#recordedRevisionOrigins.supported
24009
24041
  );
24010
24042
  if (mintsAnchorOrigin) {
24011
- await chunkIV5W7LKW_cjs.ensureRevisionOriginsRelation(
24043
+ await chunkA22XPVBQ_cjs.ensureRevisionOriginsRelation(
24012
24044
  this.#baseBackend,
24013
24045
  this.#recordedRevisionOrigins
24014
24046
  );
24015
24047
  }
24016
24048
  const doClear = async (target) => {
24017
24049
  if (this.#revisionTrackingEnabled) {
24018
- await chunkIV5W7LKW_cjs.lockRecordedGraphWrite(target, this.graphId);
24050
+ await chunkA22XPVBQ_cjs.lockRecordedGraphWrite(target, this.graphId);
24019
24051
  }
24020
24052
  if (this.#graph.identity !== void 0) {
24021
- await chunkUOHFBYYH_cjs.lockIdentityGraph(target, this.graphId);
24053
+ await chunkQ6ZVQWH7_cjs.lockIdentityGraph(target, this.graphId);
24022
24054
  }
24023
- 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;
24024
24056
  await target.clearGraph(this.graphId);
24025
24057
  if (mintsAnchorOrigin) {
24026
- await chunkIV5W7LKW_cjs.resetRevisionOrigin(target, this.#sqlSchema(), this.graphId);
24058
+ await chunkA22XPVBQ_cjs.resetRevisionOrigin(target, this.#sqlSchema(), this.graphId);
24027
24059
  }
24028
24060
  if (this.#revisionTrackingEnabled && !this.#captureEnabled) {
24029
- await chunkIV5W7LKW_cjs.advanceRevisionClock(
24061
+ await chunkA22XPVBQ_cjs.advanceRevisionClock(
24030
24062
  target,
24031
24063
  this.#sqlSchema(),
24032
24064
  this.graphId,
@@ -24157,7 +24189,7 @@ var StoreImplementation = class _StoreImplementation {
24157
24189
  */
24158
24190
  async evolve(extension, options) {
24159
24191
  const { activeRow, storedSchema, baseline } = await this.#loadCaughtUp("evolve");
24160
- const merged = chunk2GZL5ED3_cjs.mergeGraphExtension(baseline, extension);
24192
+ const merged = chunkOKA6H3B3_cjs.mergeGraphExtension(baseline, extension);
24161
24193
  if (merged === baseline) {
24162
24194
  if (baseline === this.#graph) {
24163
24195
  syncStoreReplacementRef(options?.ref, this);
@@ -24186,7 +24218,7 @@ var StoreImplementation = class _StoreImplementation {
24186
24218
  );
24187
24219
  }
24188
24220
  const identityCandidate = merged.identity === void 0 ? void 0 : this.#cloneWithGraph(merged, void 0);
24189
- const identityProvisioning = identityCandidate === void 0 ? void 0 : await chunk2GZL5ED3_cjs.ensureIdentitySchemaStorage(
24221
+ const identityProvisioning = identityCandidate === void 0 ? void 0 : await chunkOKA6H3B3_cjs.ensureIdentitySchemaStorage(
24190
24222
  this.#baseBackend,
24191
24223
  this.#sqlSchema(),
24192
24224
  {
@@ -24195,7 +24227,7 @@ var StoreImplementation = class _StoreImplementation {
24195
24227
  // The evolved graph's registry — the one the candidate's own
24196
24228
  // preflight rebuilds through, so the predicate and the fill agree
24197
24229
  // on which assertions count.
24198
- registry: chunk2GZL5ED3_cjs.buildKindRegistry(merged)
24230
+ registry: chunkOKA6H3B3_cjs.buildKindRegistry(merged)
24199
24231
  }
24200
24232
  );
24201
24233
  const committed = identityCandidate === void 0 ? classification.requireEmpty.length > 0 ? await commitEvolvedSchemaWhenRequiredKindsAreEmpty(
@@ -24204,12 +24236,12 @@ var StoreImplementation = class _StoreImplementation {
24204
24236
  activeRow.version,
24205
24237
  classification,
24206
24238
  storedSchema
24207
- ) : await chunk2GZL5ED3_cjs.commitNewSchemaVersion(
24239
+ ) : await chunkOKA6H3B3_cjs.commitNewSchemaVersion(
24208
24240
  this.#backend,
24209
24241
  merged,
24210
24242
  activeRow.version,
24211
24243
  storedSchema
24212
- ) : await chunk2GZL5ED3_cjs.commitNewSchemaVersionWithPreflight(
24244
+ ) : await chunkOKA6H3B3_cjs.commitNewSchemaVersionWithPreflight(
24213
24245
  this.#backend,
24214
24246
  merged,
24215
24247
  activeRow.version,
@@ -24595,8 +24627,8 @@ var StoreImplementation = class _StoreImplementation {
24595
24627
  */
24596
24628
  async verifyConstraintFences() {
24597
24629
  const activeRow = await this.#baseBackend.getActiveSchema(this.graphId);
24598
- const graph = activeRow === void 0 ? this.#graph : this.#catchUpToStored(chunk2GZL5ED3_cjs.parseSerializedSchema(activeRow.schema_doc));
24599
- const registry = graph === this.#graph ? this.#registry : chunk2GZL5ED3_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);
24600
24632
  return verifyConstraintFences({
24601
24633
  graph,
24602
24634
  registry,
@@ -24855,7 +24887,7 @@ var StoreImplementation = class _StoreImplementation {
24855
24887
  */
24856
24888
  async removeKinds(names, options) {
24857
24889
  const { activeRow, storedSchema, baseline } = await this.#loadCaughtUp("remove");
24858
- const plan = chunk2GZL5ED3_cjs.planRemovals(baseline, names);
24890
+ const plan = chunkOKA6H3B3_cjs.planRemovals(baseline, names);
24859
24891
  if (plan.removedNodeKinds.length === 0 && plan.removedEdgeKinds.length === 0) {
24860
24892
  if (baseline === this.#graph) {
24861
24893
  syncStoreReplacementRef(options?.ref, this);
@@ -24867,19 +24899,19 @@ var StoreImplementation = class _StoreImplementation {
24867
24899
  schemaMetadataFromRow(activeRow)
24868
24900
  );
24869
24901
  }
24870
- const compileTimeGraph = chunk2GZL5ED3_cjs.stripGraphExtension(this.#graph);
24871
- const merged = plan.document === void 0 ? compileTimeGraph : chunk2GZL5ED3_cjs.mergeGraphExtension(compileTimeGraph, plan.document);
24872
- const finalGraph = chunk2GZL5ED3_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);
24873
24905
  const identityCascade = await this.#identityRemovalPreflight(
24874
24906
  finalGraph,
24875
24907
  plan.removedNodeKinds
24876
24908
  );
24877
- const committedRow = identityCascade === void 0 ? await chunk2GZL5ED3_cjs.commitNewSchemaVersion(
24909
+ const committedRow = identityCascade === void 0 ? await chunkOKA6H3B3_cjs.commitNewSchemaVersion(
24878
24910
  this.#backend,
24879
24911
  finalGraph,
24880
24912
  activeRow.version,
24881
24913
  storedSchema
24882
- ) : await chunk2GZL5ED3_cjs.commitNewSchemaVersionWithPreflight(
24914
+ ) : await chunkOKA6H3B3_cjs.commitNewSchemaVersionWithPreflight(
24883
24915
  this.#backend,
24884
24916
  finalGraph,
24885
24917
  activeRow.version,
@@ -24938,7 +24970,7 @@ var StoreImplementation = class _StoreImplementation {
24938
24970
  async #identityRemovalPreflight(finalGraph, removedNodeKinds) {
24939
24971
  if (removedNodeKinds.length === 0) return void 0;
24940
24972
  const repairClosure = finalGraph.identity !== void 0;
24941
- if (!repairClosure && !await chunk2GZL5ED3_cjs.identityKindCascadeNeeded(
24973
+ if (!repairClosure && !await chunkOKA6H3B3_cjs.identityKindCascadeNeeded(
24942
24974
  this.#backend,
24943
24975
  this.#sqlSchema(),
24944
24976
  this.graphId,
@@ -24999,8 +25031,8 @@ var StoreImplementation = class _StoreImplementation {
24999
25031
  schemaMetadataFromRow(activeRow)
25000
25032
  );
25001
25033
  }
25002
- const merged = chunk2GZL5ED3_cjs.applyDeprecatedKinds(baseline, nextSet);
25003
- const result = await chunk2GZL5ED3_cjs.ensureSchema(this.#backend, merged, {
25034
+ const merged = chunkOKA6H3B3_cjs.applyDeprecatedKinds(baseline, nextSet);
25035
+ const result = await chunkOKA6H3B3_cjs.ensureSchema(this.#backend, merged, {
25004
25036
  preloaded: { activeRow, storedSchema },
25005
25037
  autoMigrate: true
25006
25038
  });
@@ -25008,9 +25040,9 @@ var StoreImplementation = class _StoreImplementation {
25008
25040
  return this.#cloneWithGraph(merged, options?.ref, metadata);
25009
25041
  }
25010
25042
  #catchUpToStored(storedSchema) {
25011
- const compileTimeGraph = chunk2GZL5ED3_cjs.stripGraphExtension(this.#graph);
25012
- const withGraphExtension = storedSchema.extension === void 0 ? compileTimeGraph : chunk2GZL5ED3_cjs.mergeGraphExtension(compileTimeGraph, storedSchema.extension);
25013
- return chunk2GZL5ED3_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(
25014
25046
  withGraphExtension,
25015
25047
  storedSchema.deprecatedKinds
25016
25048
  );
@@ -25028,7 +25060,7 @@ var StoreImplementation = class _StoreImplementation {
25028
25060
  * serializes the actual commit.
25029
25061
  */
25030
25062
  async #loadCaughtUp(verb) {
25031
- const activeRow = await chunk2GZL5ED3_cjs.loadActiveSchemaWithBootstrap(
25063
+ const activeRow = await chunkOKA6H3B3_cjs.loadActiveSchemaWithBootstrap(
25032
25064
  this.#backend,
25033
25065
  this.graphId
25034
25066
  );
@@ -25039,7 +25071,7 @@ var StoreImplementation = class _StoreImplementation {
25039
25071
  { code }
25040
25072
  );
25041
25073
  }
25042
- const storedSchema = chunk2GZL5ED3_cjs.parseSerializedSchema(activeRow.schema_doc);
25074
+ const storedSchema = chunkOKA6H3B3_cjs.parseSerializedSchema(activeRow.schema_doc);
25043
25075
  const baseline = this.#catchUpToStored(storedSchema);
25044
25076
  return { activeRow, storedSchema, baseline };
25045
25077
  }
@@ -25129,8 +25161,8 @@ var StoreImplementation = class _StoreImplementation {
25129
25161
  uniqueSidecarBatch: this.#uniqueSidecarBatch,
25130
25162
  ...identityConfig === void 0 ? {} : {
25131
25163
  identity: {
25132
- lock: (target) => chunkUOHFBYYH_cjs.lockIdentityGraph(target, this.graphId),
25133
- foldCreated: (target, references) => chunkUOHFBYYH_cjs.foldIdentityForCreatedNodes(
25164
+ lock: (target) => chunkQ6ZVQWH7_cjs.lockIdentityGraph(target, this.graphId),
25165
+ foldCreated: (target, references) => chunkQ6ZVQWH7_cjs.foldIdentityForCreatedNodes(
25134
25166
  {
25135
25167
  graphId: this.graphId,
25136
25168
  registry: this.#registry,
@@ -25140,7 +25172,7 @@ var StoreImplementation = class _StoreImplementation {
25140
25172
  target,
25141
25173
  references
25142
25174
  ),
25143
- detachDeleted: (target, ref, mode) => chunkUOHFBYYH_cjs.detachIdentityForNode(
25175
+ detachDeleted: (target, ref, mode) => chunkQ6ZVQWH7_cjs.detachIdentityForNode(
25144
25176
  {
25145
25177
  graphId: this.graphId,
25146
25178
  sameIdAcrossKinds: identityConfig.sameIdAcrossKinds,
@@ -25150,7 +25182,7 @@ var StoreImplementation = class _StoreImplementation {
25150
25182
  ref,
25151
25183
  mode
25152
25184
  ),
25153
- requireValidityEndCompatible: (target, ref, validTo) => chunkUOHFBYYH_cjs.requireNodeValidityEndCompatible(
25185
+ requireValidityEndCompatible: (target, ref, validTo) => chunkQ6ZVQWH7_cjs.requireNodeValidityEndCompatible(
25154
25186
  {
25155
25187
  graphId: this.graphId,
25156
25188
  schema: this.#sqlSchema()
@@ -25259,7 +25291,7 @@ var StoreImplementation = class _StoreImplementation {
25259
25291
  */
25260
25292
  #createHookContext(attempt = 1) {
25261
25293
  return {
25262
- operationId: chunkIV5W7LKW_cjs.generateId(),
25294
+ operationId: chunkA22XPVBQ_cjs.generateId(),
25263
25295
  graphId: this.graphId,
25264
25296
  startedAt: /* @__PURE__ */ new Date(),
25265
25297
  attempt
@@ -25418,7 +25450,7 @@ var AdapterStoreImplementation = class _AdapterStoreImplementation extends Store
25418
25450
  backend;
25419
25451
  constructor(graph, backend, options, schemaMetadata) {
25420
25452
  super(graph, backend, options, schemaMetadata, backend);
25421
- 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));
25422
25454
  }
25423
25455
  /**
25424
25456
  * Rebind this store's already-reconciled schema onto a fresh backend/
@@ -25611,7 +25643,7 @@ async function assertHistorySchemaOnOpen(backend, graph, options) {
25611
25643
  if (options?.history !== true) return;
25612
25644
  if (chunkJFLJVLNU_cjs.resolveRecordedTimeOwnership(backend) !== "typegraph-relations") return;
25613
25645
  const schema = options.schema === void 0 ? chunkEOLNL35G_cjs.createSqlSchema(backend.tableNames) : chunkEOLNL35G_cjs.requireSqlSchema(options.schema, "store schema");
25614
- await chunkIV5W7LKW_cjs.assertCurrentRecordedSchema(
25646
+ await chunkA22XPVBQ_cjs.assertCurrentRecordedSchema(
25615
25647
  backend,
25616
25648
  schema,
25617
25649
  graph.identity !== void 0
@@ -25638,7 +25670,7 @@ var IDENTITY_GATE_CODES = {
25638
25670
  };
25639
25671
  async function ensureSchemaWithIdentityPrecedence(backend, graph, options, gate) {
25640
25672
  try {
25641
- return await chunk2GZL5ED3_cjs.ensureSchema(backend, graph, options);
25673
+ return await chunkOKA6H3B3_cjs.ensureSchema(backend, graph, options);
25642
25674
  } catch (error) {
25643
25675
  if (gate === void 0 || !isIdentityOnlyBreakingChange(error)) throw error;
25644
25676
  throw identityMigrationRequiredError(graph.id, gate, {
@@ -25674,10 +25706,10 @@ function identityMigrationRequiredError(graphId, gate, context) {
25674
25706
  );
25675
25707
  }
25676
25708
  function rebuildIdentityClosureWithSchemaFence(identityContext, writeContext) {
25677
- return chunkIV5W7LKW_cjs.runInWriteTransaction(
25709
+ return chunkA22XPVBQ_cjs.runInWriteTransaction(
25678
25710
  writeContext,
25679
25711
  identityContext.backend,
25680
- async (target) => chunkUOHFBYYH_cjs.rebuildIdentityClosureForContext({ ...identityContext, backend: target }),
25712
+ async (target) => chunkQ6ZVQWH7_cjs.rebuildIdentityClosureForContext({ ...identityContext, backend: target }),
25681
25713
  { didWrite: () => false }
25682
25714
  );
25683
25715
  }
@@ -25686,20 +25718,20 @@ async function prepareStoreWithSchema(graph, backend, options) {
25686
25718
  graph: merged,
25687
25719
  activeRow,
25688
25720
  storedSchema
25689
- } = await chunk2GZL5ED3_cjs.loadAndMergeGraphExtensionDocument(backend, graph);
25721
+ } = await chunkOKA6H3B3_cjs.loadAndMergeGraphExtensionDocument(backend, graph);
25690
25722
  const identityProfileChanged = activeRow !== void 0 && storedSchema?.identity?.sameIdAcrossKinds !== merged.identity?.sameIdAcrossKinds;
25691
25723
  const identityInitialization = activeRow === void 0 && merged.identity !== void 0;
25692
25724
  const identityEnablement = identityInitialization || identityProfileChanged && storedSchema?.identity === void 0 && merged.identity !== void 0;
25693
25725
  const identitySemanticsChanged = identityProfileChanged || activeRow !== void 0 && storedSchema !== void 0 && merged.identity !== void 0 && identityOntologyChanged(
25694
25726
  storedSchema,
25695
- chunk2GZL5ED3_cjs.serializeSchema(merged, activeRow.version + 1)
25727
+ chunkOKA6H3B3_cjs.serializeSchema(merged, activeRow.version + 1)
25696
25728
  );
25697
25729
  const identityGate = identitySemanticsChanged ? identityEnablement ? "enablement" : identityProfileChanged ? "profile" : "ontology" : void 0;
25698
25730
  const identityProfile = merged.identity;
25699
25731
  if (identityProfile !== void 0) {
25700
25732
  const resolvedIdentitySchema = options?.schema === void 0 ? chunkEOLNL35G_cjs.createSqlSchema(backend.tableNames) : chunkEOLNL35G_cjs.requireSqlSchema(options.schema, "store schema");
25701
- const identityRegistry = chunk2GZL5ED3_cjs.buildKindRegistry(merged);
25702
- await chunk2GZL5ED3_cjs.ensureIdentitySchemaStorage(backend, resolvedIdentitySchema, {
25733
+ const identityRegistry = chunkOKA6H3B3_cjs.buildKindRegistry(merged);
25734
+ await chunkOKA6H3B3_cjs.ensureIdentitySchemaStorage(backend, resolvedIdentitySchema, {
25703
25735
  graphId: merged.id,
25704
25736
  enablement: identityEnablement,
25705
25737
  registry: identityRegistry,
@@ -25829,7 +25861,7 @@ async function prepareVerifiedStore(graph, backend, options) {
25829
25861
  graph: merged,
25830
25862
  activeRow,
25831
25863
  result
25832
- } = await chunk2GZL5ED3_cjs.loadAndVerifyGraph(backend, graph);
25864
+ } = await chunkOKA6H3B3_cjs.loadAndVerifyGraph(backend, graph);
25833
25865
  await assertHistorySchemaOnOpen(backend, merged, options);
25834
25866
  return {
25835
25867
  graph: merged,
@@ -25892,5 +25924,5 @@ exports.min = min;
25892
25924
  exports.offsetFragment = offsetFragment;
25893
25925
  exports.orderByFragment = orderByFragment;
25894
25926
  exports.sum = sum;
25895
- //# sourceMappingURL=chunk-CA76FVJB.cjs.map
25896
- //# sourceMappingURL=chunk-CA76FVJB.cjs.map
25927
+ //# sourceMappingURL=chunk-CNFKFE5L.cjs.map
25928
+ //# sourceMappingURL=chunk-CNFKFE5L.cjs.map