@nicia-ai/typegraph 0.35.0 → 0.36.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 (116) hide show
  1. package/dist/backend/postgres/index.cjs +19 -19
  2. package/dist/backend/postgres/index.js +6 -6
  3. package/dist/backend/postgres/pglite.cjs +11 -11
  4. package/dist/backend/postgres/pglite.js +6 -6
  5. package/dist/backend/sqlite/index.cjs +9 -9
  6. package/dist/backend/sqlite/index.js +6 -6
  7. package/dist/backend/sqlite/libsql.cjs +8 -8
  8. package/dist/backend/sqlite/libsql.js +6 -6
  9. package/dist/backend/sqlite/local.cjs +16 -16
  10. package/dist/backend/sqlite/local.js +6 -6
  11. package/dist/{chunk-VPYHY3LJ.cjs → chunk-2THZ3TQI.cjs} +11 -11
  12. package/dist/{chunk-VPYHY3LJ.cjs.map → chunk-2THZ3TQI.cjs.map} +1 -1
  13. package/dist/{chunk-EM3CWPND.cjs → chunk-456Z2U7Y.cjs} +51 -51
  14. package/dist/{chunk-EM3CWPND.cjs.map → chunk-456Z2U7Y.cjs.map} +1 -1
  15. package/dist/{chunk-GSQ6NPH6.cjs → chunk-4BCU6VFZ.cjs} +7 -7
  16. package/dist/{chunk-GSQ6NPH6.cjs.map → chunk-4BCU6VFZ.cjs.map} +1 -1
  17. package/dist/chunk-4BMPGT35.cjs +12 -0
  18. package/dist/{chunk-GUR2FNB5.cjs.map → chunk-4BMPGT35.cjs.map} +1 -1
  19. package/dist/{chunk-WJT7OU7E.cjs → chunk-4CAXEB2F.cjs} +124 -92
  20. package/dist/chunk-4CAXEB2F.cjs.map +1 -0
  21. package/dist/{chunk-WDBCBWC4.js → chunk-4GX2JJXS.js} +6 -6
  22. package/dist/{chunk-WDBCBWC4.js.map → chunk-4GX2JJXS.js.map} +1 -1
  23. package/dist/{chunk-UES55P7G.js → chunk-5DIPR3L3.js} +284 -154
  24. package/dist/chunk-5DIPR3L3.js.map +1 -0
  25. package/dist/{chunk-CZQ3FO2Q.js → chunk-5VTR2F2K.js} +49 -16
  26. package/dist/chunk-5VTR2F2K.js.map +1 -0
  27. package/dist/{chunk-CTTSDJLY.cjs → chunk-5W4L6DLF.cjs} +11 -11
  28. package/dist/{chunk-CTTSDJLY.cjs.map → chunk-5W4L6DLF.cjs.map} +1 -1
  29. package/dist/{chunk-J7WFGBJR.cjs → chunk-7BQLPXK6.cjs} +865 -735
  30. package/dist/chunk-7BQLPXK6.cjs.map +1 -0
  31. package/dist/{chunk-3TWF3SH4.js → chunk-BJVEU3ZL.js} +7 -7
  32. package/dist/{chunk-3TWF3SH4.js.map → chunk-BJVEU3ZL.js.map} +1 -1
  33. package/dist/{chunk-LGEALRC6.cjs → chunk-DIK74MXX.cjs} +18 -2
  34. package/dist/chunk-DIK74MXX.cjs.map +1 -0
  35. package/dist/{chunk-QNKSQTKQ.js → chunk-DN5VP4JC.js} +48 -17
  36. package/dist/chunk-DN5VP4JC.js.map +1 -0
  37. package/dist/{chunk-4JEZZJ6S.cjs → chunk-HW3LW7DH.cjs} +39 -39
  38. package/dist/{chunk-4JEZZJ6S.cjs.map → chunk-HW3LW7DH.cjs.map} +1 -1
  39. package/dist/{chunk-JBTOYDMN.js → chunk-IU46OHVW.js} +4 -4
  40. package/dist/{chunk-JBTOYDMN.js.map → chunk-IU46OHVW.js.map} +1 -1
  41. package/dist/{chunk-FL472AMI.cjs → chunk-J3LEGNQB.cjs} +8 -8
  42. package/dist/{chunk-FL472AMI.cjs.map → chunk-J3LEGNQB.cjs.map} +1 -1
  43. package/dist/{chunk-O7UN7OXA.cjs → chunk-JFMEONLG.cjs} +80 -80
  44. package/dist/{chunk-O7UN7OXA.cjs.map → chunk-JFMEONLG.cjs.map} +1 -1
  45. package/dist/{chunk-I7ZUZKFD.js → chunk-JFUPDJXD.js} +3 -3
  46. package/dist/{chunk-I7ZUZKFD.js.map → chunk-JFUPDJXD.js.map} +1 -1
  47. package/dist/{chunk-K3PPLHY7.js → chunk-M75SUBFG.js} +7 -7
  48. package/dist/{chunk-K3PPLHY7.js.map → chunk-M75SUBFG.js.map} +1 -1
  49. package/dist/{chunk-CK5BVQOW.cjs → chunk-PWGX5DF5.cjs} +79 -79
  50. package/dist/{chunk-CK5BVQOW.cjs.map → chunk-PWGX5DF5.cjs.map} +1 -1
  51. package/dist/{chunk-KMI7LYAF.js → chunk-PZKNKG5M.js} +8 -8
  52. package/dist/{chunk-KMI7LYAF.js.map → chunk-PZKNKG5M.js.map} +1 -1
  53. package/dist/{chunk-55MZDDZV.js → chunk-RAXU3RMB.js} +4 -4
  54. package/dist/{chunk-55MZDDZV.js.map → chunk-RAXU3RMB.js.map} +1 -1
  55. package/dist/{chunk-BLZDPRXT.cjs → chunk-RSSQKPSZ.cjs} +5 -5
  56. package/dist/{chunk-BLZDPRXT.cjs.map → chunk-RSSQKPSZ.cjs.map} +1 -1
  57. package/dist/{chunk-RGPG7EOJ.js → chunk-S5F7ZLP2.js} +3 -3
  58. package/dist/{chunk-RGPG7EOJ.js.map → chunk-S5F7ZLP2.js.map} +1 -1
  59. package/dist/{chunk-QWEUYILR.js → chunk-SKCOUWAX.js} +3 -3
  60. package/dist/{chunk-QWEUYILR.js.map → chunk-SKCOUWAX.js.map} +1 -1
  61. package/dist/{chunk-QOTI55H7.js → chunk-SXGE7ITL.js} +4 -4
  62. package/dist/{chunk-QOTI55H7.js.map → chunk-SXGE7ITL.js.map} +1 -1
  63. package/dist/{chunk-RGP33ZJ5.js → chunk-VQEXF5D4.js} +7 -7
  64. package/dist/{chunk-RGP33ZJ5.js.map → chunk-VQEXF5D4.js.map} +1 -1
  65. package/dist/{chunk-MP2JQKSG.js → chunk-WI7ISNQF.js} +17 -3
  66. package/dist/chunk-WI7ISNQF.js.map +1 -0
  67. package/dist/{chunk-4TOD4LBZ.cjs → chunk-X4JBT642.cjs} +29 -29
  68. package/dist/{chunk-4TOD4LBZ.cjs.map → chunk-X4JBT642.cjs.map} +1 -1
  69. package/dist/{chunk-EMF62TZG.cjs → chunk-ZAMFOJ5P.cjs} +86 -86
  70. package/dist/{chunk-EMF62TZG.cjs.map → chunk-ZAMFOJ5P.cjs.map} +1 -1
  71. package/dist/{chunk-VSPCZAXF.js → chunk-ZIGXMKQQ.js} +3 -3
  72. package/dist/{chunk-VSPCZAXF.js.map → chunk-ZIGXMKQQ.js.map} +1 -1
  73. package/dist/{chunk-XOX22WHL.cjs → chunk-ZUNQ5BEP.cjs} +104 -71
  74. package/dist/chunk-ZUNQ5BEP.cjs.map +1 -0
  75. package/dist/graph-extension/index.cjs +19 -19
  76. package/dist/graph-extension/index.d.cts +1 -1
  77. package/dist/graph-extension/index.d.ts +1 -1
  78. package/dist/graph-extension/index.js +4 -4
  79. package/dist/graph-merge/index.cjs +82 -82
  80. package/dist/graph-merge/index.cjs.map +1 -1
  81. package/dist/graph-merge/index.d.cts +2 -2
  82. package/dist/graph-merge/index.d.ts +2 -2
  83. package/dist/graph-merge/index.js +13 -13
  84. package/dist/graph-merge/index.js.map +1 -1
  85. package/dist/{index-6CSUAq-x.d.ts → index-BFvdmBPV.d.ts} +68 -1
  86. package/dist/{index-Bks_3HHK.d.cts → index-BLtQWKRj.d.cts} +68 -1
  87. package/dist/index.cjs +144 -136
  88. package/dist/index.d.cts +3 -3
  89. package/dist/index.d.ts +3 -3
  90. package/dist/index.js +14 -14
  91. package/dist/interchange/index.cjs +27 -26
  92. package/dist/interchange/index.d.cts +1 -1
  93. package/dist/interchange/index.d.ts +1 -1
  94. package/dist/interchange/index.js +9 -8
  95. package/dist/profiler/index.d.cts +1 -1
  96. package/dist/profiler/index.d.ts +1 -1
  97. package/dist/provenance/index.cjs +31 -31
  98. package/dist/provenance/index.d.cts +1 -1
  99. package/dist/provenance/index.d.ts +1 -1
  100. package/dist/provenance/index.js +4 -4
  101. package/dist/schema/index.cjs +31 -31
  102. package/dist/schema/index.d.cts +1 -1
  103. package/dist/schema/index.d.ts +1 -1
  104. package/dist/schema/index.js +7 -7
  105. package/dist/{store-view-BSpqvAxK.d.cts → store-view-9KDOpZzF.d.cts} +250 -36
  106. package/dist/{store-view-CKbHFRnn.d.ts → store-view-DplHC3Nt.d.ts} +250 -36
  107. package/package.json +1 -1
  108. package/dist/chunk-CZQ3FO2Q.js.map +0 -1
  109. package/dist/chunk-GUR2FNB5.cjs +0 -12
  110. package/dist/chunk-J7WFGBJR.cjs.map +0 -1
  111. package/dist/chunk-LGEALRC6.cjs.map +0 -1
  112. package/dist/chunk-MP2JQKSG.js.map +0 -1
  113. package/dist/chunk-QNKSQTKQ.js.map +0 -1
  114. package/dist/chunk-UES55P7G.js.map +0 -1
  115. package/dist/chunk-WJT7OU7E.cjs.map +0 -1
  116. package/dist/chunk-XOX22WHL.cjs.map +0 -1
@@ -1,25 +1,25 @@
1
1
  'use strict';
2
2
 
3
- var chunkCTTSDJLY_cjs = require('./chunk-CTTSDJLY.cjs');
4
- var chunkWJT7OU7E_cjs = require('./chunk-WJT7OU7E.cjs');
5
- var chunkCK5BVQOW_cjs = require('./chunk-CK5BVQOW.cjs');
3
+ var chunk5W4L6DLF_cjs = require('./chunk-5W4L6DLF.cjs');
4
+ var chunk4CAXEB2F_cjs = require('./chunk-4CAXEB2F.cjs');
5
+ var chunkPWGX5DF5_cjs = require('./chunk-PWGX5DF5.cjs');
6
+ var chunk2THZ3TQI_cjs = require('./chunk-2THZ3TQI.cjs');
6
7
  var chunkACSVZPK7_cjs = require('./chunk-ACSVZPK7.cjs');
7
- var chunkVPYHY3LJ_cjs = require('./chunk-VPYHY3LJ.cjs');
8
8
  var chunkFACJJWGF_cjs = require('./chunk-FACJJWGF.cjs');
9
9
  var chunkUUT7UN2N_cjs = require('./chunk-UUT7UN2N.cjs');
10
10
  var chunkTEDRJXOG_cjs = require('./chunk-TEDRJXOG.cjs');
11
11
  var chunkD7ZEOS56_cjs = require('./chunk-D7ZEOS56.cjs');
12
12
  var chunkUMDVATGY_cjs = require('./chunk-UMDVATGY.cjs');
13
- var chunkFL472AMI_cjs = require('./chunk-FL472AMI.cjs');
14
- var chunkGSQ6NPH6_cjs = require('./chunk-GSQ6NPH6.cjs');
13
+ var chunkJ3LEGNQB_cjs = require('./chunk-J3LEGNQB.cjs');
14
+ var chunk4BCU6VFZ_cjs = require('./chunk-4BCU6VFZ.cjs');
15
15
  var chunkA42GCBGX_cjs = require('./chunk-A42GCBGX.cjs');
16
- var chunkXOX22WHL_cjs = require('./chunk-XOX22WHL.cjs');
16
+ var chunkZUNQ5BEP_cjs = require('./chunk-ZUNQ5BEP.cjs');
17
17
  var chunkEOLERH7Y_cjs = require('./chunk-EOLERH7Y.cjs');
18
- var chunk4TOD4LBZ_cjs = require('./chunk-4TOD4LBZ.cjs');
19
- var chunkBLZDPRXT_cjs = require('./chunk-BLZDPRXT.cjs');
18
+ var chunkX4JBT642_cjs = require('./chunk-X4JBT642.cjs');
19
+ var chunkRSSQKPSZ_cjs = require('./chunk-RSSQKPSZ.cjs');
20
20
  var chunk7YSP4V4R_cjs = require('./chunk-7YSP4V4R.cjs');
21
21
  var chunkH7YNSMA7_cjs = require('./chunk-H7YNSMA7.cjs');
22
- var chunkLGEALRC6_cjs = require('./chunk-LGEALRC6.cjs');
22
+ var chunkDIK74MXX_cjs = require('./chunk-DIK74MXX.cjs');
23
23
  var chunkTDXIBCGY_cjs = require('./chunk-TDXIBCGY.cjs');
24
24
  var drizzleOrm = require('drizzle-orm');
25
25
 
@@ -72,7 +72,7 @@ function ownRecordedAsOf(options) {
72
72
  function assertNoRecordedCoordinate(options, guard) {
73
73
  const recordedAsOf = ownRecordedAsOf(options);
74
74
  if (recordedAsOf === void 0) return;
75
- throw new chunkLGEALRC6_cjs.ConfigurationError(
75
+ throw new chunkDIK74MXX_cjs.ConfigurationError(
76
76
  guard.message,
77
77
  {
78
78
  ...guard.context,
@@ -108,7 +108,7 @@ function resolveTemporalReadParams(options, defaultTemporalMode) {
108
108
  message: "Broad collection reads cannot honor recorded-time coordinates.",
109
109
  suggestion: "Use store.asOfRecorded(...).nodes.Kind.getById/getByIds for point reads, or query() for recorded-time scans."
110
110
  });
111
- const { valid } = chunkXOX22WHL_cjs.resolveReadCoordinate(
111
+ const { valid } = chunkZUNQ5BEP_cjs.resolveReadCoordinate(
112
112
  options?.temporalMode ?? defaultTemporalMode,
113
113
  options?.asOf
114
114
  );
@@ -120,7 +120,7 @@ function resolveTemporalReadParams(options, defaultTemporalMode) {
120
120
  if (mode === "current" || mode === "asOf") {
121
121
  return {
122
122
  ...base,
123
- asOf: asOf ?? chunkBLZDPRXT_cjs.nowIso()
123
+ asOf: asOf ?? chunkRSSQKPSZ_cjs.nowIso()
124
124
  };
125
125
  }
126
126
  return base;
@@ -138,52 +138,52 @@ var NON_KIND_KEYS = /* @__PURE__ */ new Set([
138
138
  ]);
139
139
  function createReadOnlyRefusal(entity, method, coordinate) {
140
140
  return () => {
141
- throw new chunkLGEALRC6_cjs.ConfigurationError(
142
- `'${method}' is not available on a read-only StoreView (${chunkXOX22WHL_cjs.describeCoordinate(coordinate)}). A time-pinned view is a read perspective \u2014 perform writes on the live Store.`,
141
+ throw new chunkDIK74MXX_cjs.ConfigurationError(
142
+ `'${method}' is not available on a read-only StoreView (${chunkZUNQ5BEP_cjs.describeCoordinate(coordinate)}). A time-pinned view is a read perspective \u2014 perform writes on the live Store.`,
143
143
  {
144
144
  code: "STORE_VIEW_READ_ONLY",
145
145
  entity,
146
146
  method,
147
- ...chunkXOX22WHL_cjs.coordinateContext(coordinate)
147
+ ...chunkZUNQ5BEP_cjs.coordinateContext(coordinate)
148
148
  }
149
149
  );
150
150
  };
151
151
  }
152
152
  function createCurrentOnlyRefusal(entity, method, coordinate) {
153
153
  return () => Promise.reject(
154
- new chunkLGEALRC6_cjs.ConfigurationError(
155
- `'${method}' is not available on a StoreView (${chunkXOX22WHL_cjs.describeCoordinate(coordinate)}). Constraint / index / endpoint lookups read current state only and cannot honor a temporal coordinate \u2014 use a current-mode view or the live Store.`,
154
+ new chunkDIK74MXX_cjs.ConfigurationError(
155
+ `'${method}' is not available on a StoreView (${chunkZUNQ5BEP_cjs.describeCoordinate(coordinate)}). Constraint / index / endpoint lookups read current state only and cannot honor a temporal coordinate \u2014 use a current-mode view or the live Store.`,
156
156
  {
157
157
  code: "STORE_VIEW_CURRENT_ONLY",
158
158
  entity,
159
159
  method,
160
- ...chunkXOX22WHL_cjs.coordinateContext(coordinate)
160
+ ...chunkZUNQ5BEP_cjs.coordinateContext(coordinate)
161
161
  }
162
162
  )
163
163
  );
164
164
  }
165
165
  function createBatchReadRefusal(entity, method, coordinate) {
166
166
  return () => {
167
- throw new chunkLGEALRC6_cjs.ConfigurationError(
168
- `'${method}' is not available on a read-only StoreView (${chunkXOX22WHL_cjs.describeCoordinate(coordinate)}). Batch endpoint reads resolve through store.batch(...), which a view does not expose \u2014 use the live Store's batch loader, or the view's findFrom / findTo / findByEndpoints for single reads.`,
167
+ throw new chunkDIK74MXX_cjs.ConfigurationError(
168
+ `'${method}' is not available on a read-only StoreView (${chunkZUNQ5BEP_cjs.describeCoordinate(coordinate)}). Batch endpoint reads resolve through store.batch(...), which a view does not expose \u2014 use the live Store's batch loader, or the view's findFrom / findTo / findByEndpoints for single reads.`,
169
169
  {
170
170
  code: "STORE_VIEW_BATCH_UNAVAILABLE",
171
171
  entity,
172
172
  method,
173
- ...chunkXOX22WHL_cjs.coordinateContext(coordinate)
173
+ ...chunkZUNQ5BEP_cjs.coordinateContext(coordinate)
174
174
  }
175
175
  );
176
176
  };
177
177
  }
178
178
  function createRecordedUnsupportedRefusal(entity, method, coordinate) {
179
179
  return () => Promise.reject(
180
- new chunkLGEALRC6_cjs.ConfigurationError(
181
- `'${method}' is not available on a RecordedStoreView (${chunkXOX22WHL_cjs.describeCoordinate(coordinate)}). Recorded-time reads are reconstructing reads; this view exposes only query, subgraph, graph algorithms, and point getById/getByIds collection reads.`,
180
+ new chunkDIK74MXX_cjs.ConfigurationError(
181
+ `'${method}' is not available on a RecordedStoreView (${chunkZUNQ5BEP_cjs.describeCoordinate(coordinate)}). Recorded-time reads are reconstructing reads; this view exposes only query, subgraph, graph algorithms, and point getById/getByIds collection reads.`,
182
182
  {
183
183
  code: "RECORDED_STORE_VIEW_UNSUPPORTED",
184
184
  entity,
185
185
  method,
186
- ...chunkXOX22WHL_cjs.coordinateContext(coordinate)
186
+ ...chunkZUNQ5BEP_cjs.coordinateContext(coordinate)
187
187
  }
188
188
  )
189
189
  );
@@ -349,19 +349,19 @@ function searchProxy(resolve) {
349
349
  });
350
350
  }
351
351
  function searchRefusal(method, coordinate, isCurrent) {
352
- return isCurrent ? new chunkLGEALRC6_cjs.ConfigurationError(
352
+ return isCurrent ? new chunkDIK74MXX_cjs.ConfigurationError(
353
353
  `store.search.${method} is a maintenance write and is not available on a read-only StoreView. Run it on the live Store.`,
354
354
  {
355
355
  code: "STORE_VIEW_READ_ONLY",
356
356
  method,
357
- ...chunkXOX22WHL_cjs.coordinateContext(coordinate)
357
+ ...chunkZUNQ5BEP_cjs.coordinateContext(coordinate)
358
358
  }
359
- ) : new chunkLGEALRC6_cjs.ConfigurationError(
360
- `store.search.${method} is not available on a StoreView (${chunkXOX22WHL_cjs.describeCoordinate(coordinate)}). The fulltext / vector index reflects current state only; historical relevance is out of scope for a temporal view. Use a current-mode view or query the live Store.`,
359
+ ) : new chunkDIK74MXX_cjs.ConfigurationError(
360
+ `store.search.${method} is not available on a StoreView (${chunkZUNQ5BEP_cjs.describeCoordinate(coordinate)}). The fulltext / vector index reflects current state only; historical relevance is out of scope for a temporal view. Use a current-mode view or query the live Store.`,
361
361
  {
362
362
  code: "STORE_VIEW_SEARCH_UNSUPPORTED",
363
363
  method,
364
- ...chunkXOX22WHL_cjs.coordinateContext(coordinate)
364
+ ...chunkZUNQ5BEP_cjs.coordinateContext(coordinate)
365
365
  }
366
366
  );
367
367
  }
@@ -379,12 +379,12 @@ function pinnedSearch(store, coordinate) {
379
379
  });
380
380
  }
381
381
  function recordedSearchRefusal(method, coordinate) {
382
- return new chunkLGEALRC6_cjs.ConfigurationError(
383
- `store.search.${method} is not available on a RecordedStoreView (${chunkXOX22WHL_cjs.describeCoordinate(coordinate)}). The fulltext / vector index reflects current state only and cannot answer a recorded-time query. Run search on the live Store.`,
382
+ return new chunkDIK74MXX_cjs.ConfigurationError(
383
+ `store.search.${method} is not available on a RecordedStoreView (${chunkZUNQ5BEP_cjs.describeCoordinate(coordinate)}). The fulltext / vector index reflects current state only and cannot answer a recorded-time query. Run search on the live Store.`,
384
384
  {
385
385
  code: "RECORDED_STORE_VIEW_SEARCH_UNSUPPORTED",
386
386
  method,
387
- ...chunkXOX22WHL_cjs.coordinateContext(coordinate)
387
+ ...chunkZUNQ5BEP_cjs.coordinateContext(coordinate)
388
388
  }
389
389
  );
390
390
  }
@@ -472,7 +472,7 @@ var StoreView = class extends CoordinatePinnedView {
472
472
  constructor(store, coordinate) {
473
473
  super(
474
474
  store,
475
- isReadCoordinate(coordinate) ? coordinate : chunkXOX22WHL_cjs.resolveReadCoordinate(
475
+ isReadCoordinate(coordinate) ? coordinate : chunkZUNQ5BEP_cjs.resolveReadCoordinate(
476
476
  coordinate.mode,
477
477
  coordinate.asOf,
478
478
  'Use store.asOf("2026-01-01T00:00:00.000Z") or store.view({ mode: "asOf", asOf }).'
@@ -483,7 +483,7 @@ var StoreView = class extends CoordinatePinnedView {
483
483
  asOfRecorded(recordedAsOf) {
484
484
  return new RecordedStoreView(
485
485
  this.store,
486
- chunkXOX22WHL_cjs.withRecordedCoordinate(this.coordinate, recordedAsOf)
486
+ chunkZUNQ5BEP_cjs.withRecordedCoordinate(this.coordinate, recordedAsOf)
487
487
  );
488
488
  }
489
489
  /** Read-only node collections pinned to this view's coordinate. */
@@ -523,7 +523,7 @@ var RecordedStoreView = class extends CoordinatePinnedView {
523
523
  constructor(store, coordinate) {
524
524
  super(store, coordinate);
525
525
  if (!store.recordedReadBound) {
526
- throw new chunkLGEALRC6_cjs.ConfigurationError(
526
+ throw new chunkDIK74MXX_cjs.ConfigurationError(
527
527
  "asOfRecorded() requires a recorded read relation.",
528
528
  { code: "ASOF_RECORDED_REQUIRES_BINDING" },
529
529
  {
@@ -532,7 +532,7 @@ var RecordedStoreView = class extends CoordinatePinnedView {
532
532
  );
533
533
  }
534
534
  if (coordinate.recorded === void 0) {
535
- throw new chunkLGEALRC6_cjs.ConfigurationError(
535
+ throw new chunkDIK74MXX_cjs.ConfigurationError(
536
536
  "RecordedStoreView requires a recorded-time coordinate.",
537
537
  { code: "RECORDED_STORE_VIEW_MISSING_COORDINATE" }
538
538
  );
@@ -550,7 +550,7 @@ var RecordedStoreView = class extends CoordinatePinnedView {
550
550
  get asOfRecorded() {
551
551
  const recorded = this.coordinate.recorded;
552
552
  if (recorded === void 0) {
553
- throw new chunkLGEALRC6_cjs.ConfigurationError(
553
+ throw new chunkDIK74MXX_cjs.ConfigurationError(
554
554
  "RecordedStoreView requires a recorded-time coordinate.",
555
555
  { code: "RECORDED_STORE_VIEW_MISSING_COORDINATE" }
556
556
  );
@@ -631,7 +631,7 @@ function findUnaryNodeInProjectChain(rootNode, op) {
631
631
  }
632
632
  function inspectProjectPlan(logicalPlan) {
633
633
  if (logicalPlan.root.op !== "project") {
634
- throw new chunkLGEALRC6_cjs.CompilerInvariantError(
634
+ throw new chunkDIK74MXX_cjs.CompilerInvariantError(
635
635
  `SQL emitter expected logical plan root to be "project", got "${logicalPlan.root.op}"`,
636
636
  { component: "plan-inspector" }
637
637
  );
@@ -662,13 +662,13 @@ function inspectProjectPlan(logicalPlan) {
662
662
  function inspectStandardProjectPlan(logicalPlan) {
663
663
  const shape = inspectProjectPlan(logicalPlan);
664
664
  if (shape.hasSetOperation) {
665
- throw new chunkLGEALRC6_cjs.CompilerInvariantError(
665
+ throw new chunkDIK74MXX_cjs.CompilerInvariantError(
666
666
  'Standard SQL emitter does not support plans containing "set_op" nodes',
667
667
  { component: "plan-inspector" }
668
668
  );
669
669
  }
670
670
  if (shape.hasRecursiveExpand) {
671
- throw new chunkLGEALRC6_cjs.CompilerInvariantError(
671
+ throw new chunkDIK74MXX_cjs.CompilerInvariantError(
672
672
  'Standard SQL emitter does not support plans containing "recursive_expand" nodes',
673
673
  { component: "plan-inspector" }
674
674
  );
@@ -678,13 +678,13 @@ function inspectStandardProjectPlan(logicalPlan) {
678
678
  function inspectRecursiveProjectPlan(logicalPlan) {
679
679
  const shape = inspectProjectPlan(logicalPlan);
680
680
  if (!shape.hasRecursiveExpand) {
681
- throw new chunkLGEALRC6_cjs.CompilerInvariantError(
681
+ throw new chunkDIK74MXX_cjs.CompilerInvariantError(
682
682
  'Recursive SQL emitter expected logical plan to contain a "recursive_expand" node',
683
683
  { component: "plan-inspector" }
684
684
  );
685
685
  }
686
686
  if (shape.hasSetOperation) {
687
- throw new chunkLGEALRC6_cjs.CompilerInvariantError(
687
+ throw new chunkDIK74MXX_cjs.CompilerInvariantError(
688
688
  'Recursive SQL emitter does not support plans containing "set_op" nodes',
689
689
  { component: "plan-inspector" }
690
690
  );
@@ -745,7 +745,7 @@ function inspectSetOperationPlan(logicalPlan) {
745
745
  const operations = /* @__PURE__ */ new Set();
746
746
  collectPlanOperations(logicalPlan.root, operations);
747
747
  if (!operations.has("set_op")) {
748
- throw new chunkLGEALRC6_cjs.CompilerInvariantError(
748
+ throw new chunkDIK74MXX_cjs.CompilerInvariantError(
749
749
  'Set-operation SQL emitter expected logical plan to contain a "set_op" node',
750
750
  { component: "plan-inspector" }
751
751
  );
@@ -763,25 +763,25 @@ function inspectSetOperationPlan(logicalPlan) {
763
763
  function assertRecursiveEmitterClauseAlignment(logicalPlan, input) {
764
764
  const planShape = inspectRecursiveProjectPlan(logicalPlan);
765
765
  if (planShape.hasSort && input.orderBy === void 0) {
766
- throw new chunkLGEALRC6_cjs.CompilerInvariantError(
766
+ throw new chunkDIK74MXX_cjs.CompilerInvariantError(
767
767
  "Recursive SQL emitter expected ORDER BY clause for plan containing a sort node",
768
768
  { component: "recursive-emitter" }
769
769
  );
770
770
  }
771
771
  if (!planShape.hasSort && input.orderBy !== void 0) {
772
- throw new chunkLGEALRC6_cjs.CompilerInvariantError(
772
+ throw new chunkDIK74MXX_cjs.CompilerInvariantError(
773
773
  "Recursive SQL emitter received ORDER BY clause for a plan without sort nodes",
774
774
  { component: "recursive-emitter" }
775
775
  );
776
776
  }
777
777
  if (planShape.hasLimitOffset && input.limitOffset === void 0) {
778
- throw new chunkLGEALRC6_cjs.CompilerInvariantError(
778
+ throw new chunkDIK74MXX_cjs.CompilerInvariantError(
779
779
  "Recursive SQL emitter expected LIMIT/OFFSET clause for plan containing a limit_offset node",
780
780
  { component: "recursive-emitter" }
781
781
  );
782
782
  }
783
783
  if (!planShape.hasLimitOffset && input.limitOffset !== void 0) {
784
- throw new chunkLGEALRC6_cjs.CompilerInvariantError(
784
+ throw new chunkDIK74MXX_cjs.CompilerInvariantError(
785
785
  "Recursive SQL emitter received LIMIT/OFFSET clause for a plan without limit_offset nodes",
786
786
  { component: "recursive-emitter" }
787
787
  );
@@ -808,14 +808,14 @@ function assertSetOperationEmitterClauseAlignment(logicalPlan, suffixClauses) {
808
808
  const shape = inspectSetOperationPlan(logicalPlan);
809
809
  const hasSuffixClauses = suffixClauses !== void 0 && suffixClauses.length > 0;
810
810
  if (!shape.hasSort && !shape.hasLimitOffset && hasSuffixClauses) {
811
- throw new chunkLGEALRC6_cjs.CompilerInvariantError(
811
+ throw new chunkDIK74MXX_cjs.CompilerInvariantError(
812
812
  "Set-operation SQL emitter received suffix clauses for a plan without top-level sort or limit_offset nodes",
813
813
  { component: "set-operation-emitter" }
814
814
  );
815
815
  }
816
816
  if (!hasSuffixClauses) {
817
817
  if (shape.hasSort || shape.hasLimitOffset) {
818
- throw new chunkLGEALRC6_cjs.CompilerInvariantError(
818
+ throw new chunkDIK74MXX_cjs.CompilerInvariantError(
819
819
  "Set-operation SQL emitter expected suffix clauses for plan containing top-level sort or limit_offset nodes",
820
820
  { component: "set-operation-emitter" }
821
821
  );
@@ -825,7 +825,7 @@ function assertSetOperationEmitterClauseAlignment(logicalPlan, suffixClauses) {
825
825
  const limitOffsetClauseCount = shape.limitOffsetNode === void 0 ? 0 : (shape.limitOffsetNode.limit === void 0 ? 0 : 1) + (shape.limitOffsetNode.offset === void 0 ? 0 : 1);
826
826
  const expectedClauseCount = (shape.sortNode === void 0 ? 0 : 1) + limitOffsetClauseCount;
827
827
  if (suffixClauses.length !== expectedClauseCount) {
828
- throw new chunkLGEALRC6_cjs.CompilerInvariantError(
828
+ throw new chunkDIK74MXX_cjs.CompilerInvariantError(
829
829
  `Set-operation SQL emitter expected ${String(expectedClauseCount)} top-level suffix clause(s) from logical plan, got ${String(suffixClauses.length)}`,
830
830
  { component: "set-operation-emitter" }
831
831
  );
@@ -849,38 +849,38 @@ function emitSetOperationQuerySql(input) {
849
849
  function assertStandardEmitterClauseAlignment(logicalPlan, input) {
850
850
  const planShape = inspectStandardProjectPlan(logicalPlan);
851
851
  if (input.groupBy !== void 0 && !planShape.hasAggregate) {
852
- throw new chunkLGEALRC6_cjs.CompilerInvariantError(
852
+ throw new chunkDIK74MXX_cjs.CompilerInvariantError(
853
853
  "Standard SQL emitter received GROUP BY clause for a plan without aggregate nodes",
854
854
  { component: "standard-emitter" }
855
855
  );
856
856
  }
857
857
  if (input.having !== void 0 && !planShape.hasAggregate) {
858
- throw new chunkLGEALRC6_cjs.CompilerInvariantError(
858
+ throw new chunkDIK74MXX_cjs.CompilerInvariantError(
859
859
  "Standard SQL emitter received HAVING clause for a plan without aggregate nodes",
860
860
  { component: "standard-emitter" }
861
861
  );
862
862
  }
863
863
  const expectsOrderBy = planShape.hasSort || planShape.hasVectorKnn || planShape.hasFulltextMatch;
864
864
  if (expectsOrderBy && input.orderBy === void 0) {
865
- throw new chunkLGEALRC6_cjs.CompilerInvariantError(
865
+ throw new chunkDIK74MXX_cjs.CompilerInvariantError(
866
866
  "Standard SQL emitter expected ORDER BY clause for plan containing a sort, vector_knn, or fulltext_match node",
867
867
  { component: "standard-emitter" }
868
868
  );
869
869
  }
870
870
  if (!expectsOrderBy && input.orderBy !== void 0) {
871
- throw new chunkLGEALRC6_cjs.CompilerInvariantError(
871
+ throw new chunkDIK74MXX_cjs.CompilerInvariantError(
872
872
  "Standard SQL emitter received ORDER BY clause for a plan without sort, vector_knn, or fulltext_match nodes",
873
873
  { component: "standard-emitter" }
874
874
  );
875
875
  }
876
876
  if (planShape.hasLimitOffset && input.limitOffset === void 0) {
877
- throw new chunkLGEALRC6_cjs.CompilerInvariantError(
877
+ throw new chunkDIK74MXX_cjs.CompilerInvariantError(
878
878
  "Standard SQL emitter expected LIMIT/OFFSET clause for plan containing a limit_offset node",
879
879
  { component: "standard-emitter" }
880
880
  );
881
881
  }
882
882
  if (!planShape.hasLimitOffset && input.limitOffset !== void 0) {
883
- throw new chunkLGEALRC6_cjs.CompilerInvariantError(
883
+ throw new chunkDIK74MXX_cjs.CompilerInvariantError(
884
884
  "Standard SQL emitter received LIMIT/OFFSET clause for a plan without limit_offset nodes",
885
885
  { component: "standard-emitter" }
886
886
  );
@@ -989,7 +989,7 @@ function compileColumnReference(tableAlias, column) {
989
989
  return drizzleOrm.sql`${drizzleOrm.sql.raw(tableAlias)}.${drizzleOrm.sql.raw(column)}`;
990
990
  }
991
991
  function qualifyColumn(owner, name) {
992
- return drizzleOrm.sql`${chunkCTTSDJLY_cjs.quoteIdentifier(owner)}.${chunkCTTSDJLY_cjs.quoteIdentifier(name)}`;
992
+ return drizzleOrm.sql`${chunk5W4L6DLF_cjs.quoteIdentifier(owner)}.${chunk5W4L6DLF_cjs.quoteIdentifier(name)}`;
993
993
  }
994
994
  var SCOPED_RELEVANCE_NODES_ALIAS = "scoped_relevance_nodes";
995
995
  function selectivePropsCteColumnName(field2) {
@@ -998,13 +998,13 @@ function selectivePropsCteColumnName(field2) {
998
998
  return boundPgIdentifier(encoded, `${alias}\0${fieldName}`);
999
999
  }
1000
1000
  function buildScopedNodeIdsSubquery(nodeAlias) {
1001
- const cteAlias = `${chunkXOX22WHL_cjs.ALIAS_CTE_PREFIX}${nodeAlias}`;
1001
+ const cteAlias = `${chunkZUNQ5BEP_cjs.ALIAS_CTE_PREFIX}${nodeAlias}`;
1002
1002
  return drizzleOrm.sql`
1003
1003
  (
1004
1004
  SELECT DISTINCT
1005
1005
  ${qualifyColumn(cteAlias, `${nodeAlias}_id`)} AS node_id,
1006
1006
  ${qualifyColumn(cteAlias, `${nodeAlias}_kind`)} AS node_kind
1007
- FROM ${chunkCTTSDJLY_cjs.quoteIdentifier(cteAlias)}
1007
+ FROM ${chunk5W4L6DLF_cjs.quoteIdentifier(cteAlias)}
1008
1008
  ) AS ${drizzleOrm.sql.raw(SCOPED_RELEVANCE_NODES_ALIAS)}
1009
1009
  `;
1010
1010
  }
@@ -1021,7 +1021,7 @@ function compileSelectivePropsSelectColumns(input) {
1021
1021
  propsColumn,
1022
1022
  dialect
1023
1023
  );
1024
- return drizzleOrm.sql`${extracted} AS ${chunkCTTSDJLY_cjs.quoteIdentifier(selectivePropsCteColumnName(field2))}`;
1024
+ return drizzleOrm.sql`${extracted} AS ${chunk5W4L6DLF_cjs.quoteIdentifier(selectivePropsCteColumnName(field2))}`;
1025
1025
  });
1026
1026
  }
1027
1027
  function appendSelectivePropsColumns(baseColumns, input) {
@@ -1029,8 +1029,8 @@ function appendSelectivePropsColumns(baseColumns, input) {
1029
1029
  }
1030
1030
  function compileNodeSelectColumns(input) {
1031
1031
  const { alias, dialect, requiredColumns, selectiveFields, tableAlias } = input;
1032
- const baseColumns = chunkCTTSDJLY_cjs.NODE_COLUMNS.filter(
1033
- (column) => column === "id" || column === "kind" || chunkCTTSDJLY_cjs.shouldProjectColumn(requiredColumns, column)
1032
+ const baseColumns = chunk5W4L6DLF_cjs.NODE_COLUMNS.filter(
1033
+ (column) => column === "id" || column === "kind" || chunk5W4L6DLF_cjs.shouldProjectColumn(requiredColumns, column)
1034
1034
  ).map(
1035
1035
  (column) => drizzleOrm.sql`${compileColumnReference(tableAlias, column)} AS ${drizzleOrm.sql.raw(`${alias}_${column}`)}`
1036
1036
  );
@@ -1043,8 +1043,8 @@ function compileNodeSelectColumns(input) {
1043
1043
  }
1044
1044
  function compileEdgeSelectColumns(input) {
1045
1045
  const { alias, dialect, requiredColumns, selectiveFields, tableAlias } = input;
1046
- const baseColumns = chunkCTTSDJLY_cjs.EDGE_COLUMNS.filter(
1047
- (column) => chunkCTTSDJLY_cjs.shouldProjectColumn(requiredColumns, column)
1046
+ const baseColumns = chunk5W4L6DLF_cjs.EDGE_COLUMNS.filter(
1047
+ (column) => chunk5W4L6DLF_cjs.shouldProjectColumn(requiredColumns, column)
1048
1048
  ).map(
1049
1049
  (column) => drizzleOrm.sql`${compileColumnReference(tableAlias, column)} AS ${drizzleOrm.sql.raw(`${alias}_${column}`)}`
1050
1050
  );
@@ -1060,11 +1060,11 @@ function buildStandardStartCte(input) {
1060
1060
  const alias = ast.start.alias;
1061
1061
  const kinds = ast.start.kinds;
1062
1062
  const cteMaterialization = ctx.dialect.capabilities.emitNotMaterializedHint ? drizzleOrm.sql`NOT MATERIALIZED ` : drizzleOrm.sql``;
1063
- const kindFilter = chunk4TOD4LBZ_cjs.compileKindFilter(drizzleOrm.sql.raw("kind"), kinds);
1063
+ const kindFilter = chunkX4JBT642_cjs.compileKindFilter(drizzleOrm.sql.raw("kind"), kinds);
1064
1064
  const temporalFilter = input.temporalFilterPass.forAlias();
1065
1065
  const cteContext = { ...ctx, cteColumnPrefix: "" };
1066
- const predicateClauses = chunk4TOD4LBZ_cjs.compilePredicateClauses(
1067
- chunk4TOD4LBZ_cjs.getPredicatesForAlias(predicateIndex, alias, "node"),
1066
+ const predicateClauses = chunkX4JBT642_cjs.compilePredicateClauses(
1067
+ chunkX4JBT642_cjs.getPredicatesForAlias(predicateIndex, alias, "node"),
1068
1068
  cteContext
1069
1069
  );
1070
1070
  const whereClauses = [
@@ -1073,7 +1073,7 @@ function buildStandardStartCte(input) {
1073
1073
  temporalFilter,
1074
1074
  ...predicateClauses
1075
1075
  ];
1076
- const effectiveRequiredColumns = requiredColumnsByAlias ? requiredColumnsByAlias.get(alias) ?? chunkCTTSDJLY_cjs.EMPTY_REQUIRED_COLUMNS : void 0;
1076
+ const effectiveRequiredColumns = requiredColumnsByAlias ? requiredColumnsByAlias.get(alias) ?? chunk5W4L6DLF_cjs.EMPTY_REQUIRED_COLUMNS : void 0;
1077
1077
  const limitClause = input.limitOffset === void 0 ? drizzleOrm.sql`` : input.limitOffset.offset === void 0 ? drizzleOrm.sql`
1078
1078
  LIMIT ${input.limitOffset.limit}
1079
1079
  ` : drizzleOrm.sql`
@@ -1111,27 +1111,27 @@ function buildStandardTraversalCte(input) {
1111
1111
  } = input;
1112
1112
  const traversal = ast.traversals[traversalIndex];
1113
1113
  const traversalLimitValue = traversalIndex === ast.traversals.length - 1 ? traversalLimit : void 0;
1114
- const previousNodeKinds = chunk4TOD4LBZ_cjs.getNodeKindsForAlias(ast, traversal.joinFromAlias);
1114
+ const previousNodeKinds = chunkX4JBT642_cjs.getNodeKindsForAlias(ast, traversal.joinFromAlias);
1115
1115
  const directEdgeKinds = [...new Set(traversal.edgeKinds)];
1116
1116
  const inverseEdgeKinds = traversal.inverseEdgeKinds === void 0 ? [] : [...new Set(traversal.inverseEdgeKinds)];
1117
1117
  const nodeKinds = traversal.nodeKinds;
1118
- const nodeKindFilter = chunk4TOD4LBZ_cjs.compileKindFilter(drizzleOrm.sql.raw("n.kind"), nodeKinds);
1118
+ const nodeKindFilter = chunkX4JBT642_cjs.compileKindFilter(drizzleOrm.sql.raw("n.kind"), nodeKinds);
1119
1119
  const edgeTemporalFilter = temporalFilterPass.forAlias("e");
1120
1120
  const nodeTemporalFilter = temporalFilterPass.forAlias("n");
1121
1121
  const nodeCteContext = {
1122
1122
  ...ctx,
1123
1123
  cteColumnPrefix: "n"
1124
1124
  };
1125
- const nodePredicateClauses = chunk4TOD4LBZ_cjs.compilePredicateClauses(
1126
- chunk4TOD4LBZ_cjs.getPredicatesForAlias(predicateIndex, traversal.nodeAlias, "node"),
1125
+ const nodePredicateClauses = chunkX4JBT642_cjs.compilePredicateClauses(
1126
+ chunkX4JBT642_cjs.getPredicatesForAlias(predicateIndex, traversal.nodeAlias, "node"),
1127
1127
  nodeCteContext
1128
1128
  );
1129
1129
  const edgeCteContext = {
1130
1130
  ...ctx,
1131
1131
  cteColumnPrefix: "e"
1132
1132
  };
1133
- const edgePredicateClauses = chunk4TOD4LBZ_cjs.compilePredicateClauses(
1134
- chunk4TOD4LBZ_cjs.getPredicatesForAlias(predicateIndex, traversal.edgeAlias, "edge"),
1133
+ const edgePredicateClauses = chunkX4JBT642_cjs.compilePredicateClauses(
1134
+ chunkX4JBT642_cjs.getPredicatesForAlias(predicateIndex, traversal.edgeAlias, "edge"),
1135
1135
  edgeCteContext
1136
1136
  );
1137
1137
  const baseWhereClauses = [
@@ -1145,8 +1145,8 @@ function buildStandardTraversalCte(input) {
1145
1145
  const previousAlias = traversal.joinFromAlias;
1146
1146
  const edgeAlias = traversal.edgeAlias;
1147
1147
  const nodeAlias = traversal.nodeAlias;
1148
- const requiredNodeColumns = requiredColumnsByAlias ? requiredColumnsByAlias.get(nodeAlias) ?? chunkCTTSDJLY_cjs.EMPTY_REQUIRED_COLUMNS : void 0;
1149
- const requiredEdgeColumns = requiredColumnsByAlias ? requiredColumnsByAlias.get(edgeAlias) ?? chunkCTTSDJLY_cjs.EMPTY_REQUIRED_COLUMNS : void 0;
1148
+ const requiredNodeColumns = requiredColumnsByAlias ? requiredColumnsByAlias.get(nodeAlias) ?? chunk5W4L6DLF_cjs.EMPTY_REQUIRED_COLUMNS : void 0;
1149
+ const requiredEdgeColumns = requiredColumnsByAlias ? requiredColumnsByAlias.get(edgeAlias) ?? chunk5W4L6DLF_cjs.EMPTY_REQUIRED_COLUMNS : void 0;
1150
1150
  const previousRowColumns = carryForwardPreviousColumns ? [drizzleOrm.sql`cte_${drizzleOrm.sql.raw(previousAlias)}.*`] : [
1151
1151
  drizzleOrm.sql`cte_${drizzleOrm.sql.raw(previousAlias)}.${drizzleOrm.sql.raw(previousAlias)}_id AS ${drizzleOrm.sql.raw(previousAlias)}_id`,
1152
1152
  drizzleOrm.sql`cte_${drizzleOrm.sql.raw(previousAlias)}.${drizzleOrm.sql.raw(previousAlias)}_kind AS ${drizzleOrm.sql.raw(previousAlias)}_kind`
@@ -1172,12 +1172,12 @@ function buildStandardTraversalCte(input) {
1172
1172
  function compileTraversalBranch(branch) {
1173
1173
  const whereClauses = [
1174
1174
  ...baseWhereClauses,
1175
- chunk4TOD4LBZ_cjs.compileKindFilter(drizzleOrm.sql.raw("e.kind"), branch.edgeKinds),
1176
- chunk4TOD4LBZ_cjs.compileKindFilter(
1175
+ chunkX4JBT642_cjs.compileKindFilter(drizzleOrm.sql.raw("e.kind"), branch.edgeKinds),
1176
+ chunkX4JBT642_cjs.compileKindFilter(
1177
1177
  drizzleOrm.sql.raw(`e.${branch.joinKindField}`),
1178
1178
  previousNodeKinds
1179
1179
  ),
1180
- chunk4TOD4LBZ_cjs.compileKindFilter(drizzleOrm.sql.raw(`e.${branch.targetKindField}`), nodeKinds)
1180
+ chunkX4JBT642_cjs.compileKindFilter(drizzleOrm.sql.raw(`e.${branch.targetKindField}`), nodeKinds)
1181
1181
  ];
1182
1182
  if (branch.duplicateGuard !== void 0) {
1183
1183
  whereClauses.push(branch.duplicateGuard);
@@ -1228,7 +1228,7 @@ function buildStandardTraversalCte(input) {
1228
1228
  const overlappingKinds = inverseEdgeKinds.filter(
1229
1229
  (kind) => directEdgeKinds.includes(kind)
1230
1230
  );
1231
- const duplicateGuard = overlappingKinds.length > 0 ? drizzleOrm.sql`NOT (e.from_id = e.to_id AND ${chunk4TOD4LBZ_cjs.compileKindFilter(
1231
+ const duplicateGuard = overlappingKinds.length > 0 ? drizzleOrm.sql`NOT (e.from_id = e.to_id AND ${chunkX4JBT642_cjs.compileKindFilter(
1232
1232
  drizzleOrm.sql.raw("e.kind"),
1233
1233
  overlappingKinds
1234
1234
  )})` : void 0;
@@ -1271,7 +1271,7 @@ function compileAggregateExprFromSource(expr, dialect) {
1271
1271
  case "min":
1272
1272
  case "max": {
1273
1273
  const cteAlias = `cte_${field2.alias}`;
1274
- const column = chunk4TOD4LBZ_cjs.compileFieldValue(
1274
+ const column = chunkX4JBT642_cjs.compileFieldValue(
1275
1275
  field2,
1276
1276
  dialect,
1277
1277
  field2.valueType,
@@ -1283,18 +1283,18 @@ function compileAggregateExprFromSource(expr, dialect) {
1283
1283
  return drizzleOrm.sql`${drizzleOrm.sql.raw(fn.toUpperCase())}(${column})`;
1284
1284
  }
1285
1285
  default: {
1286
- throw new chunkLGEALRC6_cjs.UnsupportedPredicateError(
1286
+ throw new chunkDIK74MXX_cjs.UnsupportedPredicateError(
1287
1287
  `Unknown aggregate function: ${String(fn)}`
1288
1288
  );
1289
1289
  }
1290
1290
  }
1291
1291
  }
1292
1292
  function compileProjectedSource(field2, dialect) {
1293
- if (chunkCTTSDJLY_cjs.isAggregateExpr(field2.source)) {
1293
+ if (chunk5W4L6DLF_cjs.isAggregateExpr(field2.source)) {
1294
1294
  return compileAggregateExprFromSource(field2.source, dialect);
1295
1295
  }
1296
1296
  const cteAlias = field2.cteAlias ?? `cte_${field2.source.alias}`;
1297
- return chunk4TOD4LBZ_cjs.compileFieldValue(
1297
+ return chunkX4JBT642_cjs.compileFieldValue(
1298
1298
  field2.source,
1299
1299
  dialect,
1300
1300
  field2.source.valueType,
@@ -1316,7 +1316,7 @@ function buildStandardProjection(input) {
1316
1316
  }
1317
1317
  const projectedFields = fields.map((field2) => {
1318
1318
  const source = compileProjectedSource(field2, dialect);
1319
- return drizzleOrm.sql`${source} AS ${chunkCTTSDJLY_cjs.quoteIdentifier(field2.outputName)}`;
1319
+ return drizzleOrm.sql`${source} AS ${chunk5W4L6DLF_cjs.quoteIdentifier(field2.outputName)}`;
1320
1320
  });
1321
1321
  return drizzleOrm.sql.join(projectedFields, drizzleOrm.sql`, `);
1322
1322
  }
@@ -1335,58 +1335,58 @@ function compileSelectiveProjection(fields, ast, collapsedTraversalCteAlias) {
1335
1335
  const columns = fields.map((field2) => {
1336
1336
  const cteAlias = collapsedTraversalCteAlias ?? aliasToCte.get(field2.alias) ?? `cte_${field2.alias}`;
1337
1337
  if (field2.isSystemField) {
1338
- const dbColumn = chunkCTTSDJLY_cjs.mapSelectiveSystemFieldToColumn(field2.field);
1339
- return drizzleOrm.sql`${drizzleOrm.sql.raw(cteAlias)}.${drizzleOrm.sql.raw(`${field2.alias}_${dbColumn}`)} AS ${chunkCTTSDJLY_cjs.quoteIdentifier(field2.outputName)}`;
1338
+ const dbColumn = chunk5W4L6DLF_cjs.mapSelectiveSystemFieldToColumn(field2.field);
1339
+ return drizzleOrm.sql`${drizzleOrm.sql.raw(cteAlias)}.${drizzleOrm.sql.raw(`${field2.alias}_${dbColumn}`)} AS ${chunk5W4L6DLF_cjs.quoteIdentifier(field2.outputName)}`;
1340
1340
  }
1341
- return drizzleOrm.sql`${drizzleOrm.sql.raw(cteAlias)}.${chunkCTTSDJLY_cjs.quoteIdentifier(selectivePropsCteColumnName(field2))} AS ${chunkCTTSDJLY_cjs.quoteIdentifier(field2.outputName)}`;
1341
+ return drizzleOrm.sql`${drizzleOrm.sql.raw(cteAlias)}.${chunk5W4L6DLF_cjs.quoteIdentifier(selectivePropsCteColumnName(field2))} AS ${chunk5W4L6DLF_cjs.quoteIdentifier(field2.outputName)}`;
1342
1342
  });
1343
1343
  return drizzleOrm.sql.join(columns, drizzleOrm.sql`, `);
1344
1344
  }
1345
1345
  function compileOrderFieldValue(ast, field2, dialect, cteAlias) {
1346
- const selectiveField = chunkCTTSDJLY_cjs.findSelectivePropsFieldForFieldRef(
1346
+ const selectiveField = chunk5W4L6DLF_cjs.findSelectivePropsFieldForFieldRef(
1347
1347
  ast.selectiveFields,
1348
1348
  field2
1349
1349
  );
1350
1350
  if (selectiveField !== void 0) {
1351
- return drizzleOrm.sql`${drizzleOrm.sql.raw(cteAlias)}.${chunkCTTSDJLY_cjs.quoteIdentifier(selectivePropsCteColumnName(selectiveField))}`;
1351
+ return drizzleOrm.sql`${drizzleOrm.sql.raw(cteAlias)}.${chunk5W4L6DLF_cjs.quoteIdentifier(selectivePropsCteColumnName(selectiveField))}`;
1352
1352
  }
1353
- return chunk4TOD4LBZ_cjs.compileFieldValue(field2, dialect, field2.valueType, cteAlias);
1353
+ return chunkX4JBT642_cjs.compileFieldValue(field2, dialect, field2.valueType, cteAlias);
1354
1354
  }
1355
1355
  function buildRelevanceJoins(vectorPredicate, fulltextPredicate) {
1356
- const hybridTargetAlias = chunk4TOD4LBZ_cjs.getHybridTargetAlias(
1356
+ const hybridTargetAlias = chunkX4JBT642_cjs.getHybridTargetAlias(
1357
1357
  vectorPredicate,
1358
1358
  fulltextPredicate
1359
1359
  );
1360
1360
  if (hybridTargetAlias !== void 0) {
1361
1361
  return [
1362
1362
  buildHybridCandidateJoin(hybridTargetAlias),
1363
- buildRelevanceJoin(chunkXOX22WHL_cjs.EMBEDDINGS_CTE_ALIAS, hybridTargetAlias, "LEFT JOIN"),
1364
- buildRelevanceJoin(chunkXOX22WHL_cjs.FULLTEXT_CTE_ALIAS, hybridTargetAlias, "LEFT JOIN")
1363
+ buildRelevanceJoin(chunkZUNQ5BEP_cjs.EMBEDDINGS_CTE_ALIAS, hybridTargetAlias, "LEFT JOIN"),
1364
+ buildRelevanceJoin(chunkZUNQ5BEP_cjs.FULLTEXT_CTE_ALIAS, hybridTargetAlias, "LEFT JOIN")
1365
1365
  ];
1366
1366
  }
1367
1367
  const joins = [];
1368
1368
  if (vectorPredicate) {
1369
1369
  joins.push(
1370
- buildRelevanceJoin(chunkXOX22WHL_cjs.EMBEDDINGS_CTE_ALIAS, vectorPredicate.field.alias)
1370
+ buildRelevanceJoin(chunkZUNQ5BEP_cjs.EMBEDDINGS_CTE_ALIAS, vectorPredicate.field.alias)
1371
1371
  );
1372
1372
  }
1373
1373
  if (fulltextPredicate) {
1374
1374
  joins.push(
1375
- buildRelevanceJoin(chunkXOX22WHL_cjs.FULLTEXT_CTE_ALIAS, fulltextPredicate.field.alias)
1375
+ buildRelevanceJoin(chunkZUNQ5BEP_cjs.FULLTEXT_CTE_ALIAS, fulltextPredicate.field.alias)
1376
1376
  );
1377
1377
  }
1378
1378
  return joins;
1379
1379
  }
1380
1380
  function buildHybridCandidateJoin(nodeAlias) {
1381
- const candidateCte = drizzleOrm.sql.raw(chunkXOX22WHL_cjs.HYBRID_CANDIDATES_CTE_ALIAS);
1382
- const node = drizzleOrm.sql.raw(`${chunkXOX22WHL_cjs.ALIAS_CTE_PREFIX}${nodeAlias}`);
1381
+ const candidateCte = drizzleOrm.sql.raw(chunkZUNQ5BEP_cjs.HYBRID_CANDIDATES_CTE_ALIAS);
1382
+ const node = drizzleOrm.sql.raw(`${chunkZUNQ5BEP_cjs.ALIAS_CTE_PREFIX}${nodeAlias}`);
1383
1383
  const idColumn = drizzleOrm.sql.raw(`${nodeAlias}_id`);
1384
1384
  const kindColumn = drizzleOrm.sql.raw(`${nodeAlias}_kind`);
1385
1385
  return drizzleOrm.sql`INNER JOIN ${candidateCte} ON ${candidateCte}.node_id = ${node}.${idColumn} AND ${candidateCte}.node_kind = ${node}.${kindColumn}`;
1386
1386
  }
1387
1387
  function buildRelevanceJoin(cteAlias, nodeAlias, joinType = "INNER JOIN") {
1388
1388
  const cte = drizzleOrm.sql.raw(cteAlias);
1389
- const node = drizzleOrm.sql.raw(`${chunkXOX22WHL_cjs.ALIAS_CTE_PREFIX}${nodeAlias}`);
1389
+ const node = drizzleOrm.sql.raw(`${chunkZUNQ5BEP_cjs.ALIAS_CTE_PREFIX}${nodeAlias}`);
1390
1390
  const idColumn = drizzleOrm.sql.raw(`${nodeAlias}_id`);
1391
1391
  const kindColumn = drizzleOrm.sql.raw(`${nodeAlias}_kind`);
1392
1392
  return drizzleOrm.sql`${drizzleOrm.sql.raw(joinType)} ${cte} ON ${cte}.node_id = ${node}.${idColumn} AND ${cte}.node_kind = ${node}.${kindColumn}`;
@@ -1429,7 +1429,7 @@ function buildStandardOrderBy(input) {
1429
1429
  for (const orderSpec of fieldOrderBy) {
1430
1430
  const valueType = orderSpec.field.valueType;
1431
1431
  if (valueType === "array" || valueType === "object") {
1432
- throw new chunkLGEALRC6_cjs.UnsupportedPredicateError(
1432
+ throw new chunkDIK74MXX_cjs.UnsupportedPredicateError(
1433
1433
  "Ordering by JSON arrays or objects is not supported"
1434
1434
  );
1435
1435
  }
@@ -1449,7 +1449,7 @@ function buildStandardOrderBy(input) {
1449
1449
  );
1450
1450
  }
1451
1451
  for (const orderSpec of aggregateOrderBy) {
1452
- const column = chunkCTTSDJLY_cjs.quoteIdentifier(orderSpec.outputName);
1452
+ const column = chunk5W4L6DLF_cjs.quoteIdentifier(orderSpec.outputName);
1453
1453
  const direction = drizzleOrm.sql.raw(orderSpec.direction.toUpperCase());
1454
1454
  const nulls = orderSpec.nulls ?? (orderSpec.direction === "asc" ? "last" : "first");
1455
1455
  const nullsKeyword = drizzleOrm.sql.raw(
@@ -1500,7 +1500,7 @@ function buildStandardGroupBy(input) {
1500
1500
  }
1501
1501
  const aliasToCte = buildAliasToCteMap(ast);
1502
1502
  const parts = allFields.map(
1503
- (field2) => chunk4TOD4LBZ_cjs.compileFieldValue(
1503
+ (field2) => chunkX4JBT642_cjs.compileFieldValue(
1504
1504
  field2,
1505
1505
  dialect,
1506
1506
  field2.valueType,
@@ -1514,20 +1514,20 @@ function buildStandardHaving(input) {
1514
1514
  if (!ast.having) {
1515
1515
  return void 0;
1516
1516
  }
1517
- const condition = chunk4TOD4LBZ_cjs.compilePredicateExpression(ast.having, ctx);
1517
+ const condition = chunkX4JBT642_cjs.compilePredicateExpression(ast.having, ctx);
1518
1518
  return drizzleOrm.sql`HAVING ${condition}`;
1519
1519
  }
1520
1520
  function buildStandardEmbeddingsCte(input) {
1521
1521
  const { ctx, graphId, nodeKinds, vectorPredicate } = input;
1522
1522
  const { field: field2, metric, minScore, queryEmbedding } = vectorPredicate;
1523
1523
  if (nodeKinds.length === 0) {
1524
- throw new chunkLGEALRC6_cjs.UnsupportedPredicateError(
1524
+ throw new chunkDIK74MXX_cjs.UnsupportedPredicateError(
1525
1525
  "Vector predicate must resolve to at least one node kind"
1526
1526
  );
1527
1527
  }
1528
1528
  const { vectorStrategy } = ctx;
1529
1529
  if (vectorStrategy === void 0) {
1530
- throw new chunkLGEALRC6_cjs.UnsupportedPredicateError(
1530
+ throw new chunkDIK74MXX_cjs.UnsupportedPredicateError(
1531
1531
  "Vector similarity predicate requires a backend with a vector strategy"
1532
1532
  );
1533
1533
  }
@@ -1535,18 +1535,18 @@ function buildStandardEmbeddingsCte(input) {
1535
1535
  const vectorSlots = ctx.vectorSlots;
1536
1536
  const scopedNodes = buildScopedNodeIdsSubquery(field2.alias);
1537
1537
  const declaringKinds = nodeKinds.filter(
1538
- (kind) => vectorSlots?.has(chunkXOX22WHL_cjs.vectorSlotKey(kind, fieldPath))
1538
+ (kind) => vectorSlots?.has(chunkZUNQ5BEP_cjs.vectorSlotKey(kind, fieldPath))
1539
1539
  );
1540
1540
  const branches = declaringKinds.map((kind) => {
1541
1541
  const tableName = vectorStrategy.tableName(graphId, kind, fieldPath);
1542
- const slotDescriptor = vectorSlots?.get(chunkXOX22WHL_cjs.vectorSlotKey(kind, fieldPath));
1542
+ const slotDescriptor = vectorSlots?.get(chunkZUNQ5BEP_cjs.vectorSlotKey(kind, fieldPath));
1543
1543
  const branchMetric = metric ?? slotDescriptor?.metric ?? "cosine";
1544
1544
  const engineFormEligible = vectorPredicate.approximate === true || vectorStrategy.searchIsExact === true;
1545
1545
  const annSlot = engineFormEligible && branchMetric === slotDescriptor?.metric ? slotDescriptor : void 0;
1546
1546
  if (annSlot !== void 0) {
1547
1547
  ctx.annIndexTypes?.add(annSlot.indexType);
1548
- const candidateCte = `${chunkXOX22WHL_cjs.ALIAS_CTE_PREFIX}${field2.alias}`;
1549
- const kindCandidates = drizzleOrm.sql`SELECT ${qualifyColumn(candidateCte, `${field2.alias}_id`)} FROM ${chunkCTTSDJLY_cjs.quoteIdentifier(candidateCte)} WHERE ${qualifyColumn(candidateCte, `${field2.alias}_kind`)} = ${kind}`;
1548
+ const candidateCte = `${chunkZUNQ5BEP_cjs.ALIAS_CTE_PREFIX}${field2.alias}`;
1549
+ const kindCandidates = drizzleOrm.sql`SELECT ${qualifyColumn(candidateCte, `${field2.alias}_id`)} FROM ${chunk5W4L6DLF_cjs.quoteIdentifier(candidateCte)} WHERE ${qualifyColumn(candidateCte, `${field2.alias}_kind`)} = ${kind}`;
1550
1550
  const annSql = vectorStrategy.buildSearch(
1551
1551
  {
1552
1552
  graphId,
@@ -1596,7 +1596,7 @@ function buildStandardEmbeddingsCte(input) {
1596
1596
  ${kind} AS node_kind,
1597
1597
  ${exactDistanceExpr} AS distance,
1598
1598
  ${scoreExpr} AS score
1599
- FROM ${chunkCTTSDJLY_cjs.quoteIdentifier(tableName)}
1599
+ FROM ${chunk5W4L6DLF_cjs.quoteIdentifier(tableName)}
1600
1600
  INNER JOIN ${scopedNodes}
1601
1601
  ON ${drizzleOrm.sql.raw(`${SCOPED_RELEVANCE_NODES_ALIAS}.node_id`)} =
1602
1602
  ${qualifyColumn(tableName, "node_id")}
@@ -1611,7 +1611,7 @@ function buildStandardEmbeddingsCte(input) {
1611
1611
  `
1612
1612
  );
1613
1613
  return drizzleOrm.sql`
1614
- ${drizzleOrm.sql.raw(chunkXOX22WHL_cjs.EMBEDDINGS_CTE_ALIAS)} AS (
1614
+ ${drizzleOrm.sql.raw(chunkZUNQ5BEP_cjs.EMBEDDINGS_CTE_ALIAS)} AS (
1615
1615
  SELECT
1616
1616
  node_id,
1617
1617
  node_kind,
@@ -1641,7 +1641,7 @@ function buildStandardFulltextCte(input) {
1641
1641
  const { dialect, schema } = ctx;
1642
1642
  const { query, mode, language, limit, minScore } = fulltextPredicate;
1643
1643
  if (nodeKinds.length === 0) {
1644
- throw new chunkLGEALRC6_cjs.UnsupportedPredicateError(
1644
+ throw new chunkDIK74MXX_cjs.UnsupportedPredicateError(
1645
1645
  "Fulltext predicate must resolve to at least one node kind"
1646
1646
  );
1647
1647
  }
@@ -1649,7 +1649,7 @@ function buildStandardFulltextCte(input) {
1649
1649
  const scopedNodes = buildScopedNodeIdsSubquery(fulltextPredicate.field.alias);
1650
1650
  const fulltextStrategy = dialect.fulltext;
1651
1651
  if (fulltextStrategy === void 0) {
1652
- throw new chunkLGEALRC6_cjs.UnsupportedPredicateError(
1652
+ throw new chunkDIK74MXX_cjs.UnsupportedPredicateError(
1653
1653
  `Fulltext match predicates are not supported for dialect "${dialect.name}"`
1654
1654
  );
1655
1655
  }
@@ -1668,14 +1668,14 @@ function buildStandardFulltextCte(input) {
1668
1668
  );
1669
1669
  const conditions = [
1670
1670
  drizzleOrm.sql`${qualifyColumn(tableName, "graph_id")} = ${graphId}`,
1671
- chunk4TOD4LBZ_cjs.compileKindFilter(qualifyColumn(tableName, "node_kind"), nodeKinds),
1671
+ chunkX4JBT642_cjs.compileKindFilter(qualifyColumn(tableName, "node_kind"), nodeKinds),
1672
1672
  matchCondition
1673
1673
  ];
1674
1674
  if (minScore !== void 0) {
1675
1675
  conditions.push(drizzleOrm.sql`${rankExpression} >= ${minScore}`);
1676
1676
  }
1677
1677
  return drizzleOrm.sql`
1678
- ${drizzleOrm.sql.raw(chunkXOX22WHL_cjs.FULLTEXT_CTE_ALIAS)} AS (
1678
+ ${drizzleOrm.sql.raw(chunkZUNQ5BEP_cjs.FULLTEXT_CTE_ALIAS)} AS (
1679
1679
  SELECT
1680
1680
  node_id,
1681
1681
  node_kind,
@@ -1711,10 +1711,10 @@ function sharedDeclaredLanguage(fulltextLanguages, nodeKinds) {
1711
1711
  }
1712
1712
  function buildStandardHybridCandidateCte() {
1713
1713
  return drizzleOrm.sql`
1714
- ${drizzleOrm.sql.raw(chunkXOX22WHL_cjs.HYBRID_CANDIDATES_CTE_ALIAS)} AS (
1715
- SELECT node_id, node_kind FROM ${drizzleOrm.sql.raw(chunkXOX22WHL_cjs.EMBEDDINGS_CTE_ALIAS)}
1714
+ ${drizzleOrm.sql.raw(chunkZUNQ5BEP_cjs.HYBRID_CANDIDATES_CTE_ALIAS)} AS (
1715
+ SELECT node_id, node_kind FROM ${drizzleOrm.sql.raw(chunkZUNQ5BEP_cjs.EMBEDDINGS_CTE_ALIAS)}
1716
1716
  UNION
1717
- SELECT node_id, node_kind FROM ${drizzleOrm.sql.raw(chunkXOX22WHL_cjs.FULLTEXT_CTE_ALIAS)}
1717
+ SELECT node_id, node_kind FROM ${drizzleOrm.sql.raw(chunkZUNQ5BEP_cjs.FULLTEXT_CTE_ALIAS)}
1718
1718
  )
1719
1719
  `;
1720
1720
  }
@@ -1725,11 +1725,11 @@ function compileUserOrderBy(ast, dialect) {
1725
1725
  for (const orderSpec of ast.orderBy) {
1726
1726
  const valueType = orderSpec.field.valueType;
1727
1727
  if (valueType === "array" || valueType === "object") {
1728
- throw new chunkLGEALRC6_cjs.UnsupportedPredicateError(
1728
+ throw new chunkDIK74MXX_cjs.UnsupportedPredicateError(
1729
1729
  "Ordering by JSON arrays or objects is not supported"
1730
1730
  );
1731
1731
  }
1732
- const cteAlias = aliasToCte.get(orderSpec.field.alias) ?? `${chunkXOX22WHL_cjs.ALIAS_CTE_PREFIX}${orderSpec.field.alias}`;
1732
+ const cteAlias = aliasToCte.get(orderSpec.field.alias) ?? `${chunkZUNQ5BEP_cjs.ALIAS_CTE_PREFIX}${orderSpec.field.alias}`;
1733
1733
  const field2 = compileOrderFieldValue(
1734
1734
  ast,
1735
1735
  orderSpec.field,
@@ -1748,7 +1748,7 @@ function compileUserOrderBy(ast, dialect) {
1748
1748
  }
1749
1749
  function buildStandardFulltextOrderBy(input) {
1750
1750
  const { ast, dialect } = input;
1751
- const rankOrder = drizzleOrm.sql.raw(`${chunkXOX22WHL_cjs.FULLTEXT_CTE_ALIAS}.rank DESC`);
1751
+ const rankOrder = drizzleOrm.sql.raw(`${chunkZUNQ5BEP_cjs.FULLTEXT_CTE_ALIAS}.rank DESC`);
1752
1752
  const userOrders = compileUserOrderBy(ast, dialect);
1753
1753
  return drizzleOrm.sql`ORDER BY ${drizzleOrm.sql.join([rankOrder, ...userOrders], drizzleOrm.sql`, `)}`;
1754
1754
  }
@@ -1758,17 +1758,17 @@ function buildStandardHybridRrfOrderBy(input) {
1758
1758
  const vectorWeight = fusion?.weights?.vector ?? DEFAULT_RRF_WEIGHT;
1759
1759
  const fulltextWeight = fusion?.weights?.fulltext ?? DEFAULT_RRF_WEIGHT;
1760
1760
  const rrfOrder = drizzleOrm.sql.raw(
1761
- `(COALESCE(${vectorWeight} / (${k} + ${chunkXOX22WHL_cjs.EMBEDDINGS_CTE_ALIAS}.ord), 0) + COALESCE(${fulltextWeight} / (${k} + ${chunkXOX22WHL_cjs.FULLTEXT_CTE_ALIAS}.ord), 0)) DESC`
1761
+ `(COALESCE(${vectorWeight} / (${k} + ${chunkZUNQ5BEP_cjs.EMBEDDINGS_CTE_ALIAS}.ord), 0) + COALESCE(${fulltextWeight} / (${k} + ${chunkZUNQ5BEP_cjs.FULLTEXT_CTE_ALIAS}.ord), 0)) DESC`
1762
1762
  );
1763
1763
  const idTiebreak = drizzleOrm.sql.raw(
1764
- `COALESCE(${chunkXOX22WHL_cjs.FULLTEXT_CTE_ALIAS}.node_id, ${chunkXOX22WHL_cjs.EMBEDDINGS_CTE_ALIAS}.node_id) ASC`
1764
+ `COALESCE(${chunkZUNQ5BEP_cjs.FULLTEXT_CTE_ALIAS}.node_id, ${chunkZUNQ5BEP_cjs.EMBEDDINGS_CTE_ALIAS}.node_id) ASC`
1765
1765
  );
1766
1766
  const userOrders = compileUserOrderBy(ast, dialect);
1767
1767
  return drizzleOrm.sql`ORDER BY ${drizzleOrm.sql.join([rrfOrder, ...userOrders, idTiebreak], drizzleOrm.sql`, `)}`;
1768
1768
  }
1769
1769
  function buildStandardVectorOrderBy(input) {
1770
1770
  const { ast, dialect } = input;
1771
- const distanceOrder = drizzleOrm.sql.raw(`${chunkXOX22WHL_cjs.EMBEDDINGS_CTE_ALIAS}.distance ASC`);
1771
+ const distanceOrder = drizzleOrm.sql.raw(`${chunkZUNQ5BEP_cjs.EMBEDDINGS_CTE_ALIAS}.distance ASC`);
1772
1772
  const userOrders = compileUserOrderBy(ast, dialect);
1773
1773
  return drizzleOrm.sql`ORDER BY ${drizzleOrm.sql.join([distanceOrder, ...userOrders], drizzleOrm.sql`, `)}`;
1774
1774
  }
@@ -1786,9 +1786,9 @@ function buildLimitOffsetClause(input) {
1786
1786
 
1787
1787
  // src/query/compiler/passes/fulltext.ts
1788
1788
  function runFulltextPredicatePass(ast, dialect) {
1789
- const fulltextPredicates = chunk4TOD4LBZ_cjs.extractFulltextMatchPredicates(ast.predicates);
1789
+ const fulltextPredicates = chunkX4JBT642_cjs.extractFulltextMatchPredicates(ast.predicates);
1790
1790
  if (fulltextPredicates.length > 1) {
1791
- throw new chunkLGEALRC6_cjs.UnsupportedPredicateError(
1791
+ throw new chunkDIK74MXX_cjs.UnsupportedPredicateError(
1792
1792
  "Multiple fulltext match predicates in a single query are not supported"
1793
1793
  );
1794
1794
  }
@@ -1797,34 +1797,34 @@ function runFulltextPredicatePass(ast, dialect) {
1797
1797
  return { fulltextPredicate: void 0 };
1798
1798
  }
1799
1799
  if (!dialect.capabilities.supportsFulltext) {
1800
- throw new chunkLGEALRC6_cjs.UnsupportedPredicateError(
1800
+ throw new chunkDIK74MXX_cjs.UnsupportedPredicateError(
1801
1801
  `Fulltext match predicates are not supported for dialect "${dialect.name}"`
1802
1802
  );
1803
1803
  }
1804
1804
  const strategy = dialect.fulltext;
1805
1805
  if (strategy === void 0) {
1806
- throw new chunkLGEALRC6_cjs.UnsupportedPredicateError(
1806
+ throw new chunkDIK74MXX_cjs.UnsupportedPredicateError(
1807
1807
  `Dialect "${dialect.name}" advertises fulltext support but has no strategy configured`
1808
1808
  );
1809
1809
  }
1810
1810
  if (!strategy.supportedModes.includes(fulltextPredicate.mode)) {
1811
- throw new chunkLGEALRC6_cjs.UnsupportedPredicateError(
1811
+ throw new chunkDIK74MXX_cjs.UnsupportedPredicateError(
1812
1812
  `Fulltext query mode "${fulltextPredicate.mode}" is not supported by the "${strategy.name}" strategy. Supported modes: ${strategy.supportedModes.join(", ")}.`
1813
1813
  );
1814
1814
  }
1815
1815
  if (fulltextPredicate.language !== void 0 && !strategy.supportsLanguageOverride) {
1816
- throw new chunkLGEALRC6_cjs.UnsupportedPredicateError(
1816
+ throw new chunkDIK74MXX_cjs.UnsupportedPredicateError(
1817
1817
  `Fulltext strategy "${strategy.name}" does not honor a per-query \`language\` override (its tokenizer is fixed at table-create time). Drop the option, or use a strategy that advertises \`supportsLanguageOverride: true\`.`
1818
1818
  );
1819
1819
  }
1820
1820
  if (!Number.isFinite(fulltextPredicate.limit) || fulltextPredicate.limit <= 0) {
1821
- throw new chunkLGEALRC6_cjs.UnsupportedPredicateError(
1821
+ throw new chunkDIK74MXX_cjs.UnsupportedPredicateError(
1822
1822
  `Fulltext match limit must be a positive finite number, got ${String(fulltextPredicate.limit)}`
1823
1823
  );
1824
1824
  }
1825
1825
  const { minScore } = fulltextPredicate;
1826
1826
  if (minScore !== void 0 && !Number.isFinite(minScore)) {
1827
- throw new chunkLGEALRC6_cjs.UnsupportedPredicateError(
1827
+ throw new chunkDIK74MXX_cjs.UnsupportedPredicateError(
1828
1828
  `Fulltext minScore must be a finite number, got ${String(minScore)}`
1829
1829
  );
1830
1830
  }
@@ -1845,12 +1845,12 @@ function runFusionConfigPass(ast, vectorPredicate, fulltextPredicate) {
1845
1845
  const fusion = ast.fusion;
1846
1846
  if (fusion === void 0) return { fusion: void 0 };
1847
1847
  if (vectorPredicate === void 0 || fulltextPredicate === void 0) {
1848
- throw new chunkLGEALRC6_cjs.UnsupportedPredicateError(
1848
+ throw new chunkDIK74MXX_cjs.UnsupportedPredicateError(
1849
1849
  `.fuseWith() requires both a .similarTo() and a .$fulltext.matches() predicate in the same query. Remove .fuseWith(), or add the missing predicate.`
1850
1850
  );
1851
1851
  }
1852
1852
  if (vectorPredicate.field.alias !== fulltextPredicate.field.alias) {
1853
- throw new chunkLGEALRC6_cjs.UnsupportedPredicateError(
1853
+ throw new chunkDIK74MXX_cjs.UnsupportedPredicateError(
1854
1854
  `.fuseWith() requires .similarTo() and .$fulltext.matches() to target the same node alias. Got vector=${vectorPredicate.field.alias}, fulltext=${fulltextPredicate.field.alias}.`
1855
1855
  );
1856
1856
  }
@@ -1863,10 +1863,10 @@ function runRecursiveTraversalSelectionPass(ast) {
1863
1863
  (traversal) => traversal.variableLength !== void 0
1864
1864
  );
1865
1865
  if (variableLengthTraversal === void 0) {
1866
- throw new chunkLGEALRC6_cjs.CompilerInvariantError("No variable-length traversal found");
1866
+ throw new chunkDIK74MXX_cjs.CompilerInvariantError("No variable-length traversal found");
1867
1867
  }
1868
1868
  if (ast.traversals.length > 1) {
1869
- throw new chunkLGEALRC6_cjs.UnsupportedPredicateError(
1869
+ throw new chunkDIK74MXX_cjs.UnsupportedPredicateError(
1870
1870
  "Variable-length traversals with multiple traversals are not yet supported. Please use a single variable-length traversal."
1871
1871
  );
1872
1872
  }
@@ -1883,11 +1883,11 @@ function runCompilerPass(state, pass) {
1883
1883
 
1884
1884
  // src/query/compiler/passes/temporal.ts
1885
1885
  function createTemporalFilterPass(ast, readInstant = "literal") {
1886
- const currentTimestamp = chunk4TOD4LBZ_cjs.currentReadInstantFor(readInstant);
1886
+ const currentTimestamp = chunkX4JBT642_cjs.currentReadInstantFor(readInstant);
1887
1887
  return {
1888
1888
  forAlias(tableAlias) {
1889
- return chunk4TOD4LBZ_cjs.compileTemporalFilter({
1890
- ...chunk4TOD4LBZ_cjs.extractTemporalOptions(ast, tableAlias),
1889
+ return chunkX4JBT642_cjs.compileTemporalFilter({
1890
+ ...chunkX4JBT642_cjs.extractTemporalOptions(ast, tableAlias),
1891
1891
  currentTimestamp
1892
1892
  });
1893
1893
  }
@@ -1896,9 +1896,9 @@ function createTemporalFilterPass(ast, readInstant = "literal") {
1896
1896
 
1897
1897
  // src/query/compiler/passes/vector.ts
1898
1898
  function runVectorPredicatePass(ast, dialect, vectorStrategy) {
1899
- const vectorPredicates = chunk4TOD4LBZ_cjs.extractVectorSimilarityPredicates(ast.predicates);
1899
+ const vectorPredicates = chunkX4JBT642_cjs.extractVectorSimilarityPredicates(ast.predicates);
1900
1900
  if (vectorPredicates.length > 1) {
1901
- throw new chunkLGEALRC6_cjs.UnsupportedPredicateError(
1901
+ throw new chunkDIK74MXX_cjs.UnsupportedPredicateError(
1902
1902
  "Multiple vector similarity predicates in a single query are not supported"
1903
1903
  );
1904
1904
  }
@@ -1908,32 +1908,32 @@ function runVectorPredicatePass(ast, dialect, vectorStrategy) {
1908
1908
  }
1909
1909
  const predicateStrategy = dialect.capabilities.vectorPredicateStrategy;
1910
1910
  if (predicateStrategy === "unsupported" || !dialect.supportsVectors) {
1911
- throw new chunkLGEALRC6_cjs.UnsupportedPredicateError(
1911
+ throw new chunkDIK74MXX_cjs.UnsupportedPredicateError(
1912
1912
  `Vector similarity predicates are not supported for dialect "${dialect.name}"`
1913
1913
  );
1914
1914
  }
1915
1915
  if (vectorPredicate.metric !== void 0) {
1916
1916
  const supportedMetrics = vectorStrategy?.capabilities.metrics ?? dialect.capabilities.vectorMetrics;
1917
1917
  if (!supportedMetrics.includes(vectorPredicate.metric)) {
1918
- throw new chunkLGEALRC6_cjs.UnsupportedPredicateError(
1918
+ throw new chunkDIK74MXX_cjs.UnsupportedPredicateError(
1919
1919
  vectorStrategy === void 0 ? `Vector metric "${vectorPredicate.metric}" is not supported for dialect "${dialect.name}"` : `Vector metric "${vectorPredicate.metric}" is not supported by vector strategy "${vectorStrategy.name}" (supported: ${supportedMetrics.join(", ")})`
1920
1920
  );
1921
1921
  }
1922
1922
  }
1923
1923
  if (!Number.isFinite(vectorPredicate.limit) || vectorPredicate.limit <= 0) {
1924
- throw new chunkLGEALRC6_cjs.UnsupportedPredicateError(
1924
+ throw new chunkDIK74MXX_cjs.UnsupportedPredicateError(
1925
1925
  `Vector predicate limit must be a positive finite number, got ${String(vectorPredicate.limit)}`
1926
1926
  );
1927
1927
  }
1928
1928
  const { minScore } = vectorPredicate;
1929
1929
  if (minScore !== void 0) {
1930
1930
  if (!Number.isFinite(minScore)) {
1931
- throw new chunkLGEALRC6_cjs.UnsupportedPredicateError(
1931
+ throw new chunkDIK74MXX_cjs.UnsupportedPredicateError(
1932
1932
  `Vector minScore must be a finite number, got ${String(minScore)}`
1933
1933
  );
1934
1934
  }
1935
1935
  if (vectorPredicate.metric === "cosine" && Math.abs(minScore) > 1) {
1936
- throw new chunkLGEALRC6_cjs.UnsupportedPredicateError(
1936
+ throw new chunkDIK74MXX_cjs.UnsupportedPredicateError(
1937
1937
  `Cosine minScore must be between -1 and 1, got ${String(minScore)}`
1938
1938
  );
1939
1939
  }
@@ -2029,7 +2029,7 @@ function appendAggregateSortLimitAndProjectNodes(currentNode, ast, nextPlanNodeI
2029
2029
  } else if (hasOffset) {
2030
2030
  node = { ...limitOffsetNodeBase, offset: ast.offset };
2031
2031
  } else {
2032
- throw new chunkLGEALRC6_cjs.CompilerInvariantError(
2032
+ throw new chunkDIK74MXX_cjs.CompilerInvariantError(
2033
2033
  "limit_offset node requires limit or offset to be present"
2034
2034
  );
2035
2035
  }
@@ -2309,8 +2309,8 @@ function assertRecordedQueryDoesNotUseCurrentIndexes(ast, vectorPredicate, fullt
2309
2309
  }
2310
2310
  function assertRecordedQueryAstDoesNotUseCurrentIndexes(ast) {
2311
2311
  if (ast.recordedAsOf === void 0) return;
2312
- const vectorPredicates = chunk4TOD4LBZ_cjs.extractVectorSimilarityPredicates(ast.predicates);
2313
- const fulltextPredicates = chunk4TOD4LBZ_cjs.extractFulltextMatchPredicates(ast.predicates);
2312
+ const vectorPredicates = chunkX4JBT642_cjs.extractVectorSimilarityPredicates(ast.predicates);
2313
+ const fulltextPredicates = chunkX4JBT642_cjs.extractFulltextMatchPredicates(ast.predicates);
2314
2314
  assertRecordedQueryHasNoCurrentIndexUsage(ast, {
2315
2315
  usesVectorPredicate: vectorPredicates.length > 0,
2316
2316
  usesFulltextPredicate: fulltextPredicates.length > 0
@@ -2322,7 +2322,7 @@ function assertRecordedQueryHasNoCurrentIndexUsage(ast, usage) {
2322
2322
  throwRecordedCurrentIndexError(ast.recordedAsOf, usage);
2323
2323
  }
2324
2324
  function throwRecordedCurrentIndexError(recordedAsOf, usage) {
2325
- throw new chunkLGEALRC6_cjs.UnsupportedPredicateError(
2325
+ throw new chunkDIK74MXX_cjs.UnsupportedPredicateError(
2326
2326
  "Recorded-time queries cannot use vector or fulltext predicates because those indexes reflect current state.",
2327
2327
  {
2328
2328
  recordedAsOf,
@@ -2383,7 +2383,7 @@ function runRecursiveQueryPassPipeline(ast, graphId, ctx) {
2383
2383
  execute(currentState) {
2384
2384
  const traversal = currentState.traversal;
2385
2385
  if (traversal === void 0) {
2386
- throw new chunkLGEALRC6_cjs.CompilerInvariantError(
2386
+ throw new chunkDIK74MXX_cjs.CompilerInvariantError(
2387
2387
  "Recursive traversal pass did not select traversal"
2388
2388
  );
2389
2389
  }
@@ -2436,17 +2436,17 @@ function compileVariableLengthQueryWithRecursiveCteStrategy(ast, graphId, ctx) {
2436
2436
  traversal: vlTraversal
2437
2437
  } = passState;
2438
2438
  if (temporalFilterPass === void 0) {
2439
- throw new chunkLGEALRC6_cjs.CompilerInvariantError(
2439
+ throw new chunkDIK74MXX_cjs.CompilerInvariantError(
2440
2440
  "Temporal filter pass did not initialize temporal state"
2441
2441
  );
2442
2442
  }
2443
2443
  if (logicalPlan === void 0) {
2444
- throw new chunkLGEALRC6_cjs.CompilerInvariantError(
2444
+ throw new chunkDIK74MXX_cjs.CompilerInvariantError(
2445
2445
  "Logical plan pass did not initialize plan state"
2446
2446
  );
2447
2447
  }
2448
2448
  if (vlTraversal === void 0) {
2449
- throw new chunkLGEALRC6_cjs.CompilerInvariantError(
2449
+ throw new chunkDIK74MXX_cjs.CompilerInvariantError(
2450
2450
  "Recursive traversal pass did not select traversal"
2451
2451
  );
2452
2452
  }
@@ -2493,8 +2493,8 @@ function compileRecursiveCte(ast, traversal, graphId, ctx, requiredColumnsByAlia
2493
2493
  if (previousNodeKinds.length > 1) {
2494
2494
  recursiveJoinRequiredColumns.add("kind");
2495
2495
  }
2496
- const requiredStartColumns = requiredColumnsByAlias ? requiredColumnsByAlias.get(startAlias) ?? chunkCTTSDJLY_cjs.EMPTY_REQUIRED_COLUMNS : void 0;
2497
- const requiredNodeColumns = requiredColumnsByAlias ? requiredColumnsByAlias.get(nodeAlias) ?? chunkCTTSDJLY_cjs.EMPTY_REQUIRED_COLUMNS : void 0;
2496
+ const requiredStartColumns = requiredColumnsByAlias ? requiredColumnsByAlias.get(startAlias) ?? chunk5W4L6DLF_cjs.EMPTY_REQUIRED_COLUMNS : void 0;
2497
+ const requiredNodeColumns = requiredColumnsByAlias ? requiredColumnsByAlias.get(nodeAlias) ?? chunk5W4L6DLF_cjs.EMPTY_REQUIRED_COLUMNS : void 0;
2498
2498
  const startColumnsFromBase = compileNodeSelectColumnsFromTable(
2499
2499
  "n0",
2500
2500
  startAlias,
@@ -2538,7 +2538,7 @@ function compileRecursiveCte(ast, traversal, graphId, ctx, requiredColumnsByAlia
2538
2538
  targetContext
2539
2539
  );
2540
2540
  if (vl.maxDepth > MAX_EXPLICIT_RECURSIVE_DEPTH) {
2541
- throw new chunkLGEALRC6_cjs.UnsupportedPredicateError(
2541
+ throw new chunkDIK74MXX_cjs.UnsupportedPredicateError(
2542
2542
  `Recursive traversal maxHops(${vl.maxDepth}) exceeds maximum explicit depth of ${MAX_EXPLICIT_RECURSIVE_DEPTH}`
2543
2543
  );
2544
2544
  }
@@ -2673,13 +2673,13 @@ function compileRecursiveCte(ast, traversal, graphId, ctx, requiredColumnsByAlia
2673
2673
  `;
2674
2674
  }
2675
2675
  function compileKindFilter2(kinds, columnExpr) {
2676
- return chunk4TOD4LBZ_cjs.compileKindFilter(drizzleOrm.sql.raw(columnExpr), kinds);
2676
+ return chunkX4JBT642_cjs.compileKindFilter(drizzleOrm.sql.raw(columnExpr), kinds);
2677
2677
  }
2678
2678
  function compileNodePredicates(ast, alias, ctx) {
2679
- return ast.predicates.filter((p) => p.targetAlias === alias && p.targetType !== "edge").map((p) => chunk4TOD4LBZ_cjs.compilePredicateExpression(p.expression, ctx));
2679
+ return ast.predicates.filter((p) => p.targetAlias === alias && p.targetType !== "edge").map((p) => chunkX4JBT642_cjs.compilePredicateExpression(p.expression, ctx));
2680
2680
  }
2681
2681
  function compileEdgePredicates(ast, edgeAlias, ctx) {
2682
- return ast.predicates.filter((p) => p.targetAlias === edgeAlias && p.targetType === "edge").map((p) => chunk4TOD4LBZ_cjs.compilePredicateExpression(p.expression, ctx));
2682
+ return ast.predicates.filter((p) => p.targetAlias === edgeAlias && p.targetType === "edge").map((p) => chunkX4JBT642_cjs.compilePredicateExpression(p.expression, ctx));
2683
2683
  }
2684
2684
  function collectRequiredColumnsByAlias(ast, traversal) {
2685
2685
  const selectiveFields = ast.selectiveFields;
@@ -2690,30 +2690,30 @@ function collectRequiredColumnsByAlias(ast, traversal) {
2690
2690
  const previousNodeKinds = [
2691
2691
  .../* @__PURE__ */ new Set([...ast.start.kinds, ...traversal.nodeKinds])
2692
2692
  ];
2693
- chunkCTTSDJLY_cjs.addRequiredColumn(requiredColumnsByAlias, traversal.nodeAlias, "id");
2693
+ chunk5W4L6DLF_cjs.addRequiredColumn(requiredColumnsByAlias, traversal.nodeAlias, "id");
2694
2694
  if (previousNodeKinds.length > 1) {
2695
- chunkCTTSDJLY_cjs.addRequiredColumn(requiredColumnsByAlias, traversal.nodeAlias, "kind");
2695
+ chunk5W4L6DLF_cjs.addRequiredColumn(requiredColumnsByAlias, traversal.nodeAlias, "kind");
2696
2696
  }
2697
2697
  for (const field2 of selectiveFields) {
2698
- chunkCTTSDJLY_cjs.markSelectiveFieldAsRequired(requiredColumnsByAlias, field2);
2698
+ chunk5W4L6DLF_cjs.markSelectiveFieldAsRequired(requiredColumnsByAlias, field2);
2699
2699
  }
2700
2700
  if (ast.orderBy) {
2701
2701
  for (const orderSpec of ast.orderBy) {
2702
- chunkCTTSDJLY_cjs.markFieldRefAsRequired(requiredColumnsByAlias, orderSpec.field);
2702
+ chunk5W4L6DLF_cjs.markFieldRefAsRequired(requiredColumnsByAlias, orderSpec.field);
2703
2703
  }
2704
2704
  }
2705
2705
  return requiredColumnsByAlias;
2706
2706
  }
2707
2707
  function compileNodeSelectColumnsFromTable(tableAlias, alias, requiredColumns, alwaysRequiredColumns) {
2708
- return chunkCTTSDJLY_cjs.NODE_COLUMNS.filter(
2709
- (column) => chunkCTTSDJLY_cjs.shouldProjectColumn(requiredColumns, column, alwaysRequiredColumns)
2708
+ return chunk5W4L6DLF_cjs.NODE_COLUMNS.filter(
2709
+ (column) => chunk5W4L6DLF_cjs.shouldProjectColumn(requiredColumns, column, alwaysRequiredColumns)
2710
2710
  ).map(
2711
2711
  (column) => drizzleOrm.sql`${drizzleOrm.sql.raw(tableAlias)}.${drizzleOrm.sql.raw(column)} AS ${drizzleOrm.sql.raw(`${alias}_${column}`)}`
2712
2712
  );
2713
2713
  }
2714
2714
  function compileNodeSelectColumnsFromRecursiveRow(alias, requiredColumns, alwaysRequiredColumns) {
2715
- return chunkCTTSDJLY_cjs.NODE_COLUMNS.filter(
2716
- (column) => chunkCTTSDJLY_cjs.shouldProjectColumn(requiredColumns, column, alwaysRequiredColumns)
2715
+ return chunk5W4L6DLF_cjs.NODE_COLUMNS.filter(
2716
+ (column) => chunk5W4L6DLF_cjs.shouldProjectColumn(requiredColumns, column, alwaysRequiredColumns)
2717
2717
  ).map((column) => {
2718
2718
  const projected = `${alias}_${column}`;
2719
2719
  return drizzleOrm.sql`r.${drizzleOrm.sql.raw(projected)} AS ${drizzleOrm.sql.raw(projected)}`;
@@ -2754,10 +2754,10 @@ function compileRecursiveProjection(ast, traversal, dialect) {
2754
2754
  drizzleOrm.sql`${drizzleOrm.sql.raw(nodeAlias)}_deleted_at`
2755
2755
  ];
2756
2756
  if (vl.depthAlias !== void 0) {
2757
- fields.push(drizzleOrm.sql`depth AS ${chunkCTTSDJLY_cjs.quoteIdentifier(vl.depthAlias)}`);
2757
+ fields.push(drizzleOrm.sql`depth AS ${chunk5W4L6DLF_cjs.quoteIdentifier(vl.depthAlias)}`);
2758
2758
  }
2759
2759
  if (vl.pathAlias !== void 0) {
2760
- fields.push(drizzleOrm.sql`path AS ${chunkCTTSDJLY_cjs.quoteIdentifier(vl.pathAlias)}`);
2760
+ fields.push(drizzleOrm.sql`path AS ${chunk5W4L6DLF_cjs.quoteIdentifier(vl.pathAlias)}`);
2761
2761
  }
2762
2762
  return drizzleOrm.sql.join(fields, drizzleOrm.sql`, `);
2763
2763
  }
@@ -2765,24 +2765,24 @@ function compileRecursiveSelectiveProjection(fields, ast, traversal, dialect) {
2765
2765
  const allowedAliases = /* @__PURE__ */ new Set([ast.start.alias, traversal.nodeAlias]);
2766
2766
  const columns = fields.map((field2) => {
2767
2767
  if (!allowedAliases.has(field2.alias)) {
2768
- throw new chunkLGEALRC6_cjs.UnsupportedPredicateError(
2768
+ throw new chunkDIK74MXX_cjs.UnsupportedPredicateError(
2769
2769
  `Selective projection for recursive traversals does not support alias "${field2.alias}"`
2770
2770
  );
2771
2771
  }
2772
2772
  if (field2.isSystemField) {
2773
- const dbColumn = chunkCTTSDJLY_cjs.mapSelectiveSystemFieldToColumn(field2.field);
2774
- return drizzleOrm.sql`${drizzleOrm.sql.raw(`${field2.alias}_${dbColumn}`)} AS ${chunkCTTSDJLY_cjs.quoteIdentifier(field2.outputName)}`;
2773
+ const dbColumn = chunk5W4L6DLF_cjs.mapSelectiveSystemFieldToColumn(field2.field);
2774
+ return drizzleOrm.sql`${drizzleOrm.sql.raw(`${field2.alias}_${dbColumn}`)} AS ${chunk5W4L6DLF_cjs.quoteIdentifier(field2.outputName)}`;
2775
2775
  }
2776
2776
  const column = drizzleOrm.sql.raw(`${field2.alias}_props`);
2777
2777
  const extracted = compileSelectivePropsExtraction(field2, column, dialect);
2778
- return drizzleOrm.sql`${extracted} AS ${chunkCTTSDJLY_cjs.quoteIdentifier(field2.outputName)}`;
2778
+ return drizzleOrm.sql`${extracted} AS ${chunk5W4L6DLF_cjs.quoteIdentifier(field2.outputName)}`;
2779
2779
  });
2780
2780
  const vl = traversal.variableLength;
2781
2781
  if (vl.depthAlias !== void 0) {
2782
- columns.push(drizzleOrm.sql`depth AS ${chunkCTTSDJLY_cjs.quoteIdentifier(vl.depthAlias)}`);
2782
+ columns.push(drizzleOrm.sql`depth AS ${chunk5W4L6DLF_cjs.quoteIdentifier(vl.depthAlias)}`);
2783
2783
  }
2784
2784
  if (vl.pathAlias !== void 0) {
2785
- columns.push(drizzleOrm.sql`path AS ${chunkCTTSDJLY_cjs.quoteIdentifier(vl.pathAlias)}`);
2785
+ columns.push(drizzleOrm.sql`path AS ${chunk5W4L6DLF_cjs.quoteIdentifier(vl.pathAlias)}`);
2786
2786
  }
2787
2787
  return drizzleOrm.sql.join(columns, drizzleOrm.sql`, `);
2788
2788
  }
@@ -2794,11 +2794,11 @@ function compileRecursiveOrderBy(ast, dialect) {
2794
2794
  for (const orderSpec of ast.orderBy) {
2795
2795
  const valueType = orderSpec.field.valueType;
2796
2796
  if (valueType === "array" || valueType === "object") {
2797
- throw new chunkLGEALRC6_cjs.UnsupportedPredicateError(
2797
+ throw new chunkDIK74MXX_cjs.UnsupportedPredicateError(
2798
2798
  "Ordering by JSON arrays or objects is not supported"
2799
2799
  );
2800
2800
  }
2801
- const field2 = chunk4TOD4LBZ_cjs.compileFieldValue(orderSpec.field, dialect, valueType);
2801
+ const field2 = chunkX4JBT642_cjs.compileFieldValue(orderSpec.field, dialect, valueType);
2802
2802
  const direction = drizzleOrm.sql.raw(orderSpec.direction.toUpperCase());
2803
2803
  const nulls = orderSpec.nulls ?? (orderSpec.direction === "asc" ? "last" : "first");
2804
2804
  const nullsDirection = drizzleOrm.sql.raw(nulls === "first" ? "DESC" : "ASC");
@@ -2878,26 +2878,26 @@ function decodeByValueType(value, valueType) {
2878
2878
  }
2879
2879
  function buildReachableCte(options) {
2880
2880
  const trackPath = options.cyclePolicy === "prevent" || options.includePath;
2881
- const edgeKindFilter = chunk4TOD4LBZ_cjs.compileKindFilter(
2881
+ const edgeKindFilter = chunkX4JBT642_cjs.compileKindFilter(
2882
2882
  drizzleOrm.sql.raw("e.kind"),
2883
2883
  options.edgeKinds
2884
2884
  );
2885
- const currentTimestamp = chunk4TOD4LBZ_cjs.currentReadInstant();
2886
- const nodeTemporalFilter = chunk4TOD4LBZ_cjs.compileTemporalFilter({
2885
+ const currentTimestamp = chunkX4JBT642_cjs.currentReadInstant();
2886
+ const nodeTemporalFilter = chunkX4JBT642_cjs.compileTemporalFilter({
2887
2887
  mode: options.temporalMode,
2888
2888
  asOf: options.asOf,
2889
2889
  recordedAsOf: options.recordedAsOf,
2890
2890
  tableAlias: "n",
2891
2891
  currentTimestamp
2892
2892
  });
2893
- const edgeTemporalFilter = chunk4TOD4LBZ_cjs.compileTemporalFilter({
2893
+ const edgeTemporalFilter = chunkX4JBT642_cjs.compileTemporalFilter({
2894
2894
  mode: options.temporalMode,
2895
2895
  asOf: options.asOf,
2896
2896
  recordedAsOf: options.recordedAsOf,
2897
2897
  tableAlias: "e",
2898
2898
  currentTimestamp
2899
2899
  });
2900
- const schema = chunkXOX22WHL_cjs.recordedReadSchemaFor(
2900
+ const schema = chunkZUNQ5BEP_cjs.recordedReadSchemaFor(
2901
2901
  options.schema,
2902
2902
  options.recordedAsOf,
2903
2903
  options.recordedReadBinding,
@@ -3013,13 +3013,13 @@ function defineSubgraphProject(_graph) {
3013
3013
  }
3014
3014
  async function executeSubgraph(params) {
3015
3015
  const { options } = params;
3016
- const { valid: coordinate } = chunkXOX22WHL_cjs.resolveReadCoordinate(
3016
+ const { valid: coordinate } = chunkZUNQ5BEP_cjs.resolveReadCoordinate(
3017
3017
  options.temporalMode ?? params.graph.defaults.temporalMode,
3018
3018
  options.asOf
3019
3019
  );
3020
3020
  const temporalMode = coordinate.mode;
3021
3021
  const recordedAsOf = options.recordedAsOf;
3022
- const baseSchema = params.schema ?? chunkXOX22WHL_cjs.DEFAULT_SQL_SCHEMA;
3022
+ const baseSchema = params.schema ?? chunkZUNQ5BEP_cjs.DEFAULT_SQL_SCHEMA;
3023
3023
  const maxDepth = Math.min(
3024
3024
  options.maxDepth ?? DEFAULT_SUBGRAPH_MAX_DEPTH,
3025
3025
  MAX_EXPLICIT_RECURSIVE_DEPTH
@@ -3037,7 +3037,7 @@ async function executeSubgraph(params) {
3037
3037
  asOf: coordinate.asOf,
3038
3038
  recordedAsOf,
3039
3039
  dialect: params.dialect,
3040
- schema: chunkXOX22WHL_cjs.recordedReadSchemaFor(
3040
+ schema: chunkZUNQ5BEP_cjs.recordedReadSchemaFor(
3041
3041
  baseSchema,
3042
3042
  recordedAsOf,
3043
3043
  params.recordedReadBinding,
@@ -3166,7 +3166,7 @@ function buildKindProjectionPlan(kind, selection, resolveFieldType, entityPrefix
3166
3166
  includeMeta = true;
3167
3167
  continue;
3168
3168
  }
3169
- chunkGSQ6NPH6_cjs.validateProjectionField(field2, entityPrefix, kind);
3169
+ chunk4BCU6VFZ_cjs.validateProjectionField(field2, entityPrefix, kind);
3170
3170
  if (!propertyFields.has(field2)) {
3171
3171
  propertyFields.set(field2, {
3172
3172
  field: field2,
@@ -3192,7 +3192,7 @@ function dedupeStrings(values) {
3192
3192
  function buildIncludedIdsCte(ctx) {
3193
3193
  const filters = [];
3194
3194
  if (ctx.includeKinds !== void 0 && ctx.includeKinds.length > 0) {
3195
- filters.push(chunk4TOD4LBZ_cjs.compileKindFilter(drizzleOrm.sql.raw("kind"), ctx.includeKinds));
3195
+ filters.push(chunkX4JBT642_cjs.compileKindFilter(drizzleOrm.sql.raw("kind"), ctx.includeKinds));
3196
3196
  }
3197
3197
  if (ctx.excludeRoot) {
3198
3198
  filters.push(drizzleOrm.sql`id != ${ctx.rootId}`);
@@ -3215,12 +3215,12 @@ async function fetchIncludedIds(ctx, reachableCte, includedIdsCte) {
3215
3215
  return rows.map((row) => row.id);
3216
3216
  }
3217
3217
  async function fetchSubgraphNodes(ctx, membership, projectionPlan) {
3218
- const nodeTemporalFilter = chunk4TOD4LBZ_cjs.compileTemporalFilter({
3218
+ const nodeTemporalFilter = chunkX4JBT642_cjs.compileTemporalFilter({
3219
3219
  mode: ctx.temporalMode,
3220
3220
  asOf: ctx.asOf,
3221
3221
  recordedAsOf: ctx.recordedAsOf,
3222
3222
  tableAlias: "n",
3223
- currentTimestamp: chunk4TOD4LBZ_cjs.currentReadInstant()
3223
+ currentTimestamp: chunkX4JBT642_cjs.currentReadInstant()
3224
3224
  });
3225
3225
  const columns = [
3226
3226
  drizzleOrm.sql`n.kind`,
@@ -3243,13 +3243,13 @@ async function fetchSubgraphNodes(ctx, membership, projectionPlan) {
3243
3243
  );
3244
3244
  }
3245
3245
  async function fetchSubgraphEdges(ctx, membership, projectionPlan) {
3246
- const edgeKindFilter = chunk4TOD4LBZ_cjs.compileKindFilter(drizzleOrm.sql.raw("e.kind"), ctx.edgeKinds);
3247
- const edgeTemporalFilter = chunk4TOD4LBZ_cjs.compileTemporalFilter({
3246
+ const edgeKindFilter = chunkX4JBT642_cjs.compileKindFilter(drizzleOrm.sql.raw("e.kind"), ctx.edgeKinds);
3247
+ const edgeTemporalFilter = chunkX4JBT642_cjs.compileTemporalFilter({
3248
3248
  mode: ctx.temporalMode,
3249
3249
  asOf: ctx.asOf,
3250
3250
  recordedAsOf: ctx.recordedAsOf,
3251
3251
  tableAlias: "e",
3252
- currentTimestamp: chunk4TOD4LBZ_cjs.currentReadInstant()
3252
+ currentTimestamp: chunkX4JBT642_cjs.currentReadInstant()
3253
3253
  });
3254
3254
  const columns = [
3255
3255
  drizzleOrm.sql`e.id`,
@@ -3288,7 +3288,7 @@ function buildMetadataColumns(alias, plan, columns) {
3288
3288
  if (metaKinds.length === plan.fullKinds.length + plan.projectedKinds.size) {
3289
3289
  return columns.map((col) => drizzleOrm.sql`${drizzleOrm.sql.raw(`${alias}.${col}`)}`);
3290
3290
  }
3291
- const filter = chunk4TOD4LBZ_cjs.compileKindFilter(drizzleOrm.sql.raw(`${alias}.kind`), metaKinds);
3291
+ const filter = chunkX4JBT642_cjs.compileKindFilter(drizzleOrm.sql.raw(`${alias}.kind`), metaKinds);
3292
3292
  return columns.map(
3293
3293
  (col) => drizzleOrm.sql`CASE WHEN ${filter} THEN ${drizzleOrm.sql.raw(`${alias}.${col}`)} ELSE NULL END AS ${drizzleOrm.sql.raw(col)}`
3294
3294
  );
@@ -3300,7 +3300,7 @@ function buildFullPropsColumn(alias, plan) {
3300
3300
  if (plan.fullKinds.length === 0) {
3301
3301
  return drizzleOrm.sql`NULL AS props`;
3302
3302
  }
3303
- const filter = chunk4TOD4LBZ_cjs.compileKindFilter(drizzleOrm.sql.raw(`${alias}.kind`), plan.fullKinds);
3303
+ const filter = chunkX4JBT642_cjs.compileKindFilter(drizzleOrm.sql.raw(`${alias}.kind`), plan.fullKinds);
3304
3304
  return drizzleOrm.sql`CASE WHEN ${filter} THEN ${drizzleOrm.sql.raw(`${alias}.props`)} ELSE NULL END AS props`;
3305
3305
  }
3306
3306
  function buildProjectedPropertyColumns(alias, plan, dialect) {
@@ -3314,7 +3314,7 @@ function buildProjectedPropertyColumns(alias, plan, dialect) {
3314
3314
  valueType: fieldPlan.typeInfo?.valueType
3315
3315
  });
3316
3316
  columns.push(
3317
- drizzleOrm.sql`CASE WHEN ${drizzleOrm.sql.raw(alias)}.kind = ${kind} THEN ${extracted} ELSE NULL END AS ${chunkCTTSDJLY_cjs.quoteIdentifier(fieldPlan.outputName)}`
3317
+ drizzleOrm.sql`CASE WHEN ${drizzleOrm.sql.raw(alias)}.kind = ${kind} THEN ${extracted} ELSE NULL END AS ${chunk5W4L6DLF_cjs.quoteIdentifier(fieldPlan.outputName)}`
3318
3318
  );
3319
3319
  }
3320
3320
  }
@@ -3344,7 +3344,7 @@ function applyProjectedFields(target, row, kindPlan) {
3344
3344
  function mapSubgraphNodeRow(row, projectionPlan) {
3345
3345
  const kindPlan = projectionPlan.projectedKinds.get(row.kind);
3346
3346
  if (kindPlan === void 0) {
3347
- return chunkWJT7OU7E_cjs.rowToNode({
3347
+ return chunk4CAXEB2F_cjs.rowToNode({
3348
3348
  ...row,
3349
3349
  props: normalizeProps(row.props)
3350
3350
  });
@@ -3354,7 +3354,7 @@ function mapSubgraphNodeRow(row, projectionPlan) {
3354
3354
  id: row.id
3355
3355
  };
3356
3356
  if (kindPlan.includeMeta) {
3357
- projectedNode.meta = chunkWJT7OU7E_cjs.rowToNodeMeta(row);
3357
+ projectedNode.meta = chunk4CAXEB2F_cjs.rowToNodeMeta(row);
3358
3358
  }
3359
3359
  applyProjectedFields(projectedNode, row, kindPlan);
3360
3360
  return projectedNode;
@@ -3362,7 +3362,7 @@ function mapSubgraphNodeRow(row, projectionPlan) {
3362
3362
  function mapSubgraphEdgeRow(row, projectionPlan) {
3363
3363
  const kindPlan = projectionPlan.projectedKinds.get(row.kind);
3364
3364
  if (kindPlan === void 0) {
3365
- return chunkWJT7OU7E_cjs.rowToEdge({
3365
+ return chunk4CAXEB2F_cjs.rowToEdge({
3366
3366
  ...row,
3367
3367
  props: normalizeProps(row.props)
3368
3368
  });
@@ -3376,7 +3376,7 @@ function mapSubgraphEdgeRow(row, projectionPlan) {
3376
3376
  toId: row.to_id
3377
3377
  };
3378
3378
  if (kindPlan.includeMeta) {
3379
- projectedEdge.meta = chunkWJT7OU7E_cjs.rowToEdgeMeta(row);
3379
+ projectedEdge.meta = chunk4CAXEB2F_cjs.rowToEdgeMeta(row);
3380
3380
  }
3381
3381
  applyProjectedFields(projectedEdge, row, kindPlan);
3382
3382
  return projectedEdge;
@@ -3402,7 +3402,7 @@ function assertUniformSetOperationRecordedCoordinates(op) {
3402
3402
  const keys = /* @__PURE__ */ new Set();
3403
3403
  collectQueryRecordedCoordinateKeys(op, keys);
3404
3404
  if (keys.size <= 1) return;
3405
- throw new chunkLGEALRC6_cjs.ConfigurationError(
3405
+ throw new chunkDIK74MXX_cjs.ConfigurationError(
3406
3406
  "Cannot combine queries with different recorded-time coordinates in a set operation: each operand reads either the live tables or the recorded relation at one instant, so mixing live with recorded (or two different recorded instants) is rejected. Valid-time differences are allowed.",
3407
3407
  { code: "SET_OPERATION_RECORDED_COORDINATE_MISMATCH" },
3408
3408
  {
@@ -3447,7 +3447,7 @@ function compileSetOperation(op, graphId, dialect, compileQuery2, vectorStrategy
3447
3447
  );
3448
3448
  const { logicalPlan } = passState;
3449
3449
  if (logicalPlan === void 0) {
3450
- throw new chunkLGEALRC6_cjs.CompilerInvariantError(
3450
+ throw new chunkDIK74MXX_cjs.CompilerInvariantError(
3451
3451
  "Logical plan pass did not initialize plan state"
3452
3452
  );
3453
3453
  }
@@ -3513,7 +3513,7 @@ function buildSetOperationSuffixClauses(op, dialect) {
3513
3513
  if (op.orderBy && op.orderBy.length > 0) {
3514
3514
  const projection = getLeftmostProjection(op);
3515
3515
  if (projection.fields.length === 0) {
3516
- throw new chunkLGEALRC6_cjs.UnsupportedPredicateError(
3516
+ throw new chunkDIK74MXX_cjs.UnsupportedPredicateError(
3517
3517
  "Set operation ORDER BY requires explicit field projection. SELECT * does not provide stable output column names for ordering. Use .select() to specify which fields to project."
3518
3518
  );
3519
3519
  }
@@ -3523,7 +3523,7 @@ function buildSetOperationSuffixClauses(op, dialect) {
3523
3523
  if (!projected) {
3524
3524
  const fieldDesc = orderSpec.field.jsonPointer ? `${orderSpec.field.alias}.props${orderSpec.field.jsonPointer}` : `${orderSpec.field.alias}.${orderSpec.field.path.join(".")}`;
3525
3525
  const availableFields = projection.fields.map((f) => f.outputName).join(", ");
3526
- throw new chunkLGEALRC6_cjs.UnsupportedPredicateError(
3526
+ throw new chunkDIK74MXX_cjs.UnsupportedPredicateError(
3527
3527
  `Set operation ORDER BY field "${fieldDesc}" is not in the projection. ORDER BY for UNION/INTERSECT/EXCEPT must reference projected columns. Available columns: ${availableFields}`
3528
3528
  );
3529
3529
  }
@@ -3564,7 +3564,7 @@ function isColumnPruningEnabled(ast) {
3564
3564
  function markPredicateFieldsAsRequired(requiredColumnsByAlias, expression) {
3565
3565
  switch (expression.__type) {
3566
3566
  case "comparison": {
3567
- chunkCTTSDJLY_cjs.markFieldRefAsRequired(requiredColumnsByAlias, expression.left);
3567
+ chunk5W4L6DLF_cjs.markFieldRefAsRequired(requiredColumnsByAlias, expression.left);
3568
3568
  return;
3569
3569
  }
3570
3570
  case "string_op":
@@ -3572,7 +3572,7 @@ function markPredicateFieldsAsRequired(requiredColumnsByAlias, expression) {
3572
3572
  case "between":
3573
3573
  case "array_op":
3574
3574
  case "object_op": {
3575
- chunkCTTSDJLY_cjs.markFieldRefAsRequired(requiredColumnsByAlias, expression.field);
3575
+ chunk5W4L6DLF_cjs.markFieldRefAsRequired(requiredColumnsByAlias, expression.field);
3576
3576
  return;
3577
3577
  }
3578
3578
  case "and":
@@ -3590,22 +3590,22 @@ function markPredicateFieldsAsRequired(requiredColumnsByAlias, expression) {
3590
3590
  return;
3591
3591
  }
3592
3592
  case "aggregate_comparison": {
3593
- chunkCTTSDJLY_cjs.markFieldRefAsRequired(
3593
+ chunk5W4L6DLF_cjs.markFieldRefAsRequired(
3594
3594
  requiredColumnsByAlias,
3595
3595
  expression.aggregate.field
3596
3596
  );
3597
3597
  return;
3598
3598
  }
3599
3599
  case "in_subquery": {
3600
- chunkCTTSDJLY_cjs.markFieldRefAsRequired(requiredColumnsByAlias, expression.field);
3600
+ chunk5W4L6DLF_cjs.markFieldRefAsRequired(requiredColumnsByAlias, expression.field);
3601
3601
  return;
3602
3602
  }
3603
3603
  case "vector_similarity": {
3604
- chunkCTTSDJLY_cjs.markFieldRefAsRequired(requiredColumnsByAlias, expression.field);
3604
+ chunk5W4L6DLF_cjs.markFieldRefAsRequired(requiredColumnsByAlias, expression.field);
3605
3605
  return;
3606
3606
  }
3607
3607
  case "fulltext_match": {
3608
- chunkCTTSDJLY_cjs.markFieldRefAsRequired(requiredColumnsByAlias, expression.field);
3608
+ chunk5W4L6DLF_cjs.markFieldRefAsRequired(requiredColumnsByAlias, expression.field);
3609
3609
  return;
3610
3610
  }
3611
3611
  case "exists": {
@@ -3615,18 +3615,18 @@ function markPredicateFieldsAsRequired(requiredColumnsByAlias, expression) {
3615
3615
  }
3616
3616
  function collectRequiredColumnsByAlias2(ast) {
3617
3617
  const requiredColumnsByAlias = /* @__PURE__ */ new Map();
3618
- chunkCTTSDJLY_cjs.addRequiredColumn(requiredColumnsByAlias, ast.start.alias, "id");
3618
+ chunk5W4L6DLF_cjs.addRequiredColumn(requiredColumnsByAlias, ast.start.alias, "id");
3619
3619
  for (const traversal of ast.traversals) {
3620
- chunkCTTSDJLY_cjs.addRequiredColumn(requiredColumnsByAlias, traversal.nodeAlias, "id");
3620
+ chunk5W4L6DLF_cjs.addRequiredColumn(requiredColumnsByAlias, traversal.nodeAlias, "id");
3621
3621
  }
3622
3622
  const hasSelectiveFields = (ast.selectiveFields?.length ?? 0) > 0;
3623
3623
  if (hasSelectiveFields) {
3624
3624
  for (const field2 of ast.selectiveFields ?? []) {
3625
3625
  if (field2.isSystemField) {
3626
- chunkCTTSDJLY_cjs.addRequiredColumn(
3626
+ chunk5W4L6DLF_cjs.addRequiredColumn(
3627
3627
  requiredColumnsByAlias,
3628
3628
  field2.alias,
3629
- chunkCTTSDJLY_cjs.mapSelectiveSystemFieldToColumn(field2.field)
3629
+ chunk5W4L6DLF_cjs.mapSelectiveSystemFieldToColumn(field2.field)
3630
3630
  );
3631
3631
  }
3632
3632
  }
@@ -3634,27 +3634,27 @@ function collectRequiredColumnsByAlias2(ast) {
3634
3634
  for (const projectedField of ast.projection.fields) {
3635
3635
  const source = projectedField.source;
3636
3636
  if (source.__type === "field_ref") {
3637
- chunkCTTSDJLY_cjs.markFieldRefAsRequired(requiredColumnsByAlias, source);
3637
+ chunk5W4L6DLF_cjs.markFieldRefAsRequired(requiredColumnsByAlias, source);
3638
3638
  } else {
3639
- chunkCTTSDJLY_cjs.addRequiredColumn(requiredColumnsByAlias, source.field.alias, "id");
3640
- chunkCTTSDJLY_cjs.markFieldRefAsRequired(requiredColumnsByAlias, source.field);
3639
+ chunk5W4L6DLF_cjs.addRequiredColumn(requiredColumnsByAlias, source.field.alias, "id");
3640
+ chunk5W4L6DLF_cjs.markFieldRefAsRequired(requiredColumnsByAlias, source.field);
3641
3641
  }
3642
3642
  }
3643
3643
  }
3644
3644
  if (ast.groupBy) {
3645
3645
  for (const field2 of ast.groupBy.fields) {
3646
- chunkCTTSDJLY_cjs.markFieldRefAsRequired(requiredColumnsByAlias, field2);
3646
+ chunk5W4L6DLF_cjs.markFieldRefAsRequired(requiredColumnsByAlias, field2);
3647
3647
  }
3648
3648
  }
3649
3649
  if (ast.orderBy) {
3650
3650
  for (const orderSpec of ast.orderBy) {
3651
- if (chunkCTTSDJLY_cjs.findSelectivePropsFieldForFieldRef(
3651
+ if (chunk5W4L6DLF_cjs.findSelectivePropsFieldForFieldRef(
3652
3652
  ast.selectiveFields,
3653
3653
  orderSpec.field
3654
3654
  ) !== void 0) {
3655
3655
  continue;
3656
3656
  }
3657
- chunkCTTSDJLY_cjs.markFieldRefAsRequired(requiredColumnsByAlias, orderSpec.field);
3657
+ chunk5W4L6DLF_cjs.markFieldRefAsRequired(requiredColumnsByAlias, orderSpec.field);
3658
3658
  }
3659
3659
  }
3660
3660
  if (ast.having) {
@@ -3673,7 +3673,7 @@ function collectRequiredColumnsByAlias2(ast) {
3673
3673
  function hasIdEqualityPredicate(expression, alias) {
3674
3674
  switch (expression.__type) {
3675
3675
  case "comparison": {
3676
- return expression.op === "eq" && expression.left.alias === alias && chunkCTTSDJLY_cjs.isIdFieldRef(expression.left);
3676
+ return expression.op === "eq" && expression.left.alias === alias && chunk5W4L6DLF_cjs.isIdFieldRef(expression.left);
3677
3677
  }
3678
3678
  case "and": {
3679
3679
  return expression.predicates.some(
@@ -3697,7 +3697,7 @@ function hasIdEqualityPredicate(expression, alias) {
3697
3697
  }
3698
3698
  }
3699
3699
  function isStartAliasBoundToSingleId(ast, predicateIndex) {
3700
- return chunk4TOD4LBZ_cjs.getPredicatesForAlias(predicateIndex, ast.start.alias, "node").some(
3700
+ return chunkX4JBT642_cjs.getPredicatesForAlias(predicateIndex, ast.start.alias, "node").some(
3701
3701
  (predicate) => hasIdEqualityPredicate(predicate.expression, ast.start.alias)
3702
3702
  );
3703
3703
  }
@@ -3781,7 +3781,7 @@ function runStandardQueryPassPipeline(ast, graphId, ctx) {
3781
3781
  fulltextPredicate: void 0,
3782
3782
  fusion: void 0,
3783
3783
  logicalPlan: void 0,
3784
- predicateIndex: chunk4TOD4LBZ_cjs.buildPredicateIndex(ast),
3784
+ predicateIndex: chunkX4JBT642_cjs.buildPredicateIndex(ast),
3785
3785
  requiredColumnsByAlias: void 0,
3786
3786
  shouldCollapseSelectiveTraversalRowset: false,
3787
3787
  temporalFilterPass: void 0,
@@ -3949,8 +3949,8 @@ function runStandardQueryPassPipeline(ast, graphId, ctx) {
3949
3949
  function compileQuery(ast, graphId, options = "sqlite") {
3950
3950
  const options_ = typeof options === "string" ? { dialect: options } : options;
3951
3951
  const dialect = options_.dialect ?? "sqlite";
3952
- const baseSchema = options_.schema === void 0 ? chunkXOX22WHL_cjs.DEFAULT_SQL_SCHEMA : chunkXOX22WHL_cjs.requireSqlSchema(options_.schema, "compileQuery schema");
3953
- const schema = chunkXOX22WHL_cjs.recordedReadSchemaFor(
3952
+ const baseSchema = options_.schema === void 0 ? chunkZUNQ5BEP_cjs.DEFAULT_SQL_SCHEMA : chunkZUNQ5BEP_cjs.requireSqlSchema(options_.schema, "compileQuery schema");
3953
+ const schema = chunkZUNQ5BEP_cjs.recordedReadSchemaFor(
3954
3954
  baseSchema,
3955
3955
  ast.recordedAsOf,
3956
3956
  options_.recordedReadBinding,
@@ -4021,7 +4021,7 @@ function compileSetOperation2(op, graphId, options = "sqlite") {
4021
4021
  }
4022
4022
  return compiled;
4023
4023
  };
4024
- const combined = chunk4TOD4LBZ_cjs.withPinnedReadInstant(
4024
+ const combined = chunkX4JBT642_cjs.withPinnedReadInstant(
4025
4025
  () => compileSetOperation(op, graphId, adapter, compileOperand, options_.vectorStrategy)
4026
4026
  );
4027
4027
  if (annIndexTypes.size > 0) {
@@ -4054,7 +4054,7 @@ function inheritRecordedAsOf(subAst, recordedAsOf) {
4054
4054
  return subAst;
4055
4055
  }
4056
4056
  function recordedSubqueryCoordinateMismatch(message) {
4057
- return new chunkLGEALRC6_cjs.ConfigurationError(
4057
+ return new chunkDIK74MXX_cjs.ConfigurationError(
4058
4058
  message,
4059
4059
  { code: "SUBQUERY_TEMPORAL_COORDINATE_MISMATCH" },
4060
4060
  {
@@ -4093,7 +4093,7 @@ function resolveCountAggregateFastPath(ast) {
4093
4093
  return void 0;
4094
4094
  }
4095
4095
  const groupField = ast.groupBy.fields[0];
4096
- if (groupField.alias !== ast.start.alias || !chunkCTTSDJLY_cjs.isIdFieldRef(groupField)) {
4096
+ if (groupField.alias !== ast.start.alias || !chunk5W4L6DLF_cjs.isIdFieldRef(groupField)) {
4097
4097
  return void 0;
4098
4098
  }
4099
4099
  let requiresNodeCount = false;
@@ -4102,13 +4102,13 @@ function resolveCountAggregateFastPath(ast) {
4102
4102
  let requiresEdgeCountDistinct = false;
4103
4103
  for (const projectedField of ast.projection.fields) {
4104
4104
  const source = projectedField.source;
4105
- if (!chunkCTTSDJLY_cjs.isAggregateExpr(source)) {
4105
+ if (!chunk5W4L6DLF_cjs.isAggregateExpr(source)) {
4106
4106
  if (source.alias !== ast.start.alias) {
4107
4107
  return void 0;
4108
4108
  }
4109
4109
  continue;
4110
4110
  }
4111
- if (!chunkCTTSDJLY_cjs.isIdFieldRef(source.field)) {
4111
+ if (!chunk5W4L6DLF_cjs.isIdFieldRef(source.field)) {
4112
4112
  return void 0;
4113
4113
  }
4114
4114
  const isNodeTarget = source.field.alias === traversal.nodeAlias;
@@ -4161,7 +4161,7 @@ function compileCountAggregateFastPath(ast, graphId, ctx, logicalPlan, requiredC
4161
4161
  const nodeCountDistinctColumn = `${traversal.nodeAlias}_count_distinct`;
4162
4162
  const edgeCountColumn = `${traversal.edgeAlias}_count`;
4163
4163
  const edgeCountDistinctColumn = `${traversal.edgeAlias}_count_distinct`;
4164
- const previousNodeKinds = chunk4TOD4LBZ_cjs.getNodeKindsForAlias(ast, traversal.joinFromAlias);
4164
+ const previousNodeKinds = chunkX4JBT642_cjs.getNodeKindsForAlias(ast, traversal.joinFromAlias);
4165
4165
  const edgeKinds = [...new Set(traversal.edgeKinds)];
4166
4166
  const nodeKinds = traversal.nodeKinds;
4167
4167
  const edgeTemporalFilter = temporalFilterPass.forAlias("e");
@@ -4170,16 +4170,16 @@ function compileCountAggregateFastPath(ast, graphId, ctx, logicalPlan, requiredC
4170
4170
  ...ctx,
4171
4171
  cteColumnPrefix: "n"
4172
4172
  };
4173
- const nodePredicateClauses = chunk4TOD4LBZ_cjs.compilePredicateClauses(
4174
- chunk4TOD4LBZ_cjs.getPredicatesForAlias(predicateIndex, traversal.nodeAlias, "node"),
4173
+ const nodePredicateClauses = chunkX4JBT642_cjs.compilePredicateClauses(
4174
+ chunkX4JBT642_cjs.getPredicatesForAlias(predicateIndex, traversal.nodeAlias, "node"),
4175
4175
  nodePredicateContext
4176
4176
  );
4177
4177
  const edgePredicateContext = {
4178
4178
  ...ctx,
4179
4179
  cteColumnPrefix: "e"
4180
4180
  };
4181
- const edgePredicateClauses = chunk4TOD4LBZ_cjs.compilePredicateClauses(
4182
- chunk4TOD4LBZ_cjs.getPredicatesForAlias(predicateIndex, traversal.edgeAlias, "edge"),
4181
+ const edgePredicateClauses = chunkX4JBT642_cjs.compilePredicateClauses(
4182
+ chunkX4JBT642_cjs.getPredicatesForAlias(predicateIndex, traversal.edgeAlias, "edge"),
4183
4183
  edgePredicateContext
4184
4184
  );
4185
4185
  const joinField = traversal.direction === "out" ? "from_id" : "to_id";
@@ -4191,14 +4191,14 @@ function compileCountAggregateFastPath(ast, graphId, ctx, logicalPlan, requiredC
4191
4191
  const useInnerJoin = hasNodePredicates;
4192
4192
  const whereClauses = [
4193
4193
  drizzleOrm.sql`e.graph_id = ${graphId}`,
4194
- chunk4TOD4LBZ_cjs.compileKindFilter(drizzleOrm.sql.raw("e.kind"), edgeKinds),
4195
- chunk4TOD4LBZ_cjs.compileKindFilter(drizzleOrm.sql.raw(`e.${joinKindField}`), previousNodeKinds),
4196
- chunk4TOD4LBZ_cjs.compileKindFilter(drizzleOrm.sql.raw(`e.${targetKindField}`), nodeKinds),
4194
+ chunkX4JBT642_cjs.compileKindFilter(drizzleOrm.sql.raw("e.kind"), edgeKinds),
4195
+ chunkX4JBT642_cjs.compileKindFilter(drizzleOrm.sql.raw(`e.${joinKindField}`), previousNodeKinds),
4196
+ chunkX4JBT642_cjs.compileKindFilter(drizzleOrm.sql.raw(`e.${targetKindField}`), nodeKinds),
4197
4197
  edgeTemporalFilter,
4198
4198
  ...edgePredicateClauses,
4199
4199
  // INNER JOIN mode: node-side filters in WHERE constrain every aggregate.
4200
4200
  ...requiresNodeJoin && useInnerJoin ? [
4201
- chunk4TOD4LBZ_cjs.compileKindFilter(drizzleOrm.sql.raw("n.kind"), nodeKinds),
4201
+ chunkX4JBT642_cjs.compileKindFilter(drizzleOrm.sql.raw("n.kind"), nodeKinds),
4202
4202
  nodeTemporalFilter,
4203
4203
  ...nodePredicateClauses
4204
4204
  ] : []
@@ -4214,7 +4214,7 @@ function compileCountAggregateFastPath(ast, graphId, ctx, logicalPlan, requiredC
4214
4214
  drizzleOrm.sql`n.graph_id = e.graph_id`,
4215
4215
  drizzleOrm.sql`n.id = e.${drizzleOrm.sql.raw(targetField)}`,
4216
4216
  drizzleOrm.sql`n.kind = e.${drizzleOrm.sql.raw(targetKindField)}`,
4217
- chunk4TOD4LBZ_cjs.compileKindFilter(drizzleOrm.sql.raw("n.kind"), nodeKinds),
4217
+ chunkX4JBT642_cjs.compileKindFilter(drizzleOrm.sql.raw("n.kind"), nodeKinds),
4218
4218
  nodeTemporalFilter
4219
4219
  ] : [];
4220
4220
  const aggregateColumns = [];
@@ -4273,19 +4273,19 @@ function compileCountAggregateFastPath(ast, graphId, ctx, logicalPlan, requiredC
4273
4273
  const projection = drizzleOrm.sql.join(
4274
4274
  ast.projection.fields.map((projectedField) => {
4275
4275
  const source = projectedField.source;
4276
- if (!chunkCTTSDJLY_cjs.isAggregateExpr(source)) {
4277
- const value = chunk4TOD4LBZ_cjs.compileFieldValue(
4276
+ if (!chunk5W4L6DLF_cjs.isAggregateExpr(source)) {
4277
+ const value = chunkX4JBT642_cjs.compileFieldValue(
4278
4278
  source,
4279
4279
  dialect,
4280
4280
  source.valueType,
4281
4281
  `cte_${source.alias}`
4282
4282
  );
4283
- return drizzleOrm.sql`${value} AS ${chunkCTTSDJLY_cjs.quoteIdentifier(projectedField.outputName)}`;
4283
+ return drizzleOrm.sql`${value} AS ${chunk5W4L6DLF_cjs.quoteIdentifier(projectedField.outputName)}`;
4284
4284
  }
4285
4285
  const projectedCountColumn = resolveCountColumn(source);
4286
4286
  const countValue = drizzleOrm.sql`${drizzleOrm.sql.raw(countCteAlias)}.${drizzleOrm.sql.raw(projectedCountColumn)}`;
4287
4287
  const aggregateValue = traversal.optional ? drizzleOrm.sql`COALESCE(${countValue}, 0)` : countValue;
4288
- return drizzleOrm.sql`${aggregateValue} AS ${chunkCTTSDJLY_cjs.quoteIdentifier(projectedField.outputName)}`;
4288
+ return drizzleOrm.sql`${aggregateValue} AS ${chunk5W4L6DLF_cjs.quoteIdentifier(projectedField.outputName)}`;
4289
4289
  }),
4290
4290
  drizzleOrm.sql`, `
4291
4291
  );
@@ -4361,7 +4361,7 @@ function selectWindowFunctionOperation(vectorPredicate, fulltextPredicate) {
4361
4361
  }
4362
4362
  function assertWindowFunctionsSupported(ctx, operation) {
4363
4363
  if (ctx.windowFunctions) return;
4364
- throw new chunkLGEALRC6_cjs.ConfigurationError(
4364
+ throw new chunkDIK74MXX_cjs.ConfigurationError(
4365
4365
  `${operation} requires SQL window functions, but this backend profile declares windowFunctions: false.`,
4366
4366
  {
4367
4367
  capability: "windowFunctions",
@@ -4389,13 +4389,13 @@ function compileStandardQueryWithCteStrategy(ast, graphId, ctx) {
4389
4389
  vectorPredicate
4390
4390
  } = runStandardQueryPassPipeline(ast, graphId, ctx);
4391
4391
  if (temporalFilterPass === void 0) {
4392
- throw new chunkLGEALRC6_cjs.CompilerInvariantError(
4392
+ throw new chunkDIK74MXX_cjs.CompilerInvariantError(
4393
4393
  "Temporal filter pass did not initialize temporal state",
4394
4394
  { phase: "standard-pass-pipeline" }
4395
4395
  );
4396
4396
  }
4397
4397
  if (logicalPlan === void 0) {
4398
- throw new chunkLGEALRC6_cjs.CompilerInvariantError(
4398
+ throw new chunkDIK74MXX_cjs.CompilerInvariantError(
4399
4399
  "Logical plan pass did not initialize plan state",
4400
4400
  { phase: "standard-pass-pipeline" }
4401
4401
  );
@@ -4452,7 +4452,7 @@ function compileStandardQueryWithCteStrategy(ast, graphId, ctx) {
4452
4452
  );
4453
4453
  }
4454
4454
  if (vectorPredicate) {
4455
- const nodeKinds = chunk4TOD4LBZ_cjs.getNodeKindsForAlias(ast, vectorPredicate.field.alias);
4455
+ const nodeKinds = chunkX4JBT642_cjs.getNodeKindsForAlias(ast, vectorPredicate.field.alias);
4456
4456
  ctes.push(
4457
4457
  buildStandardEmbeddingsCte({
4458
4458
  ctx,
@@ -4463,7 +4463,7 @@ function compileStandardQueryWithCteStrategy(ast, graphId, ctx) {
4463
4463
  );
4464
4464
  }
4465
4465
  if (fulltextPredicate) {
4466
- const nodeKinds = chunk4TOD4LBZ_cjs.getNodeKindsForAlias(ast, fulltextPredicate.field.alias);
4466
+ const nodeKinds = chunkX4JBT642_cjs.getNodeKindsForAlias(ast, fulltextPredicate.field.alias);
4467
4467
  ctes.push(
4468
4468
  buildStandardFulltextCte({
4469
4469
  ctx,
@@ -4473,7 +4473,7 @@ function compileStandardQueryWithCteStrategy(ast, graphId, ctx) {
4473
4473
  })
4474
4474
  );
4475
4475
  }
4476
- if (chunk4TOD4LBZ_cjs.getHybridTargetAlias(vectorPredicate, fulltextPredicate) !== void 0) {
4476
+ if (chunkX4JBT642_cjs.getHybridTargetAlias(vectorPredicate, fulltextPredicate) !== void 0) {
4477
4477
  ctes.push(buildStandardHybridCandidateCte());
4478
4478
  }
4479
4479
  const projection = buildStandardProjection({
@@ -4705,7 +4705,7 @@ function decodeCursor(cursor) {
4705
4705
  const json = atob(base64);
4706
4706
  const raw = JSON.parse(json);
4707
4707
  if (typeof raw.v !== "number" || raw.v > CURSOR_VERSION) {
4708
- throw new chunkLGEALRC6_cjs.ValidationError(
4708
+ throw new chunkDIK74MXX_cjs.ValidationError(
4709
4709
  `Unsupported cursor version: ${String(raw.v)}. Maximum supported: ${CURSOR_VERSION}`,
4710
4710
  {
4711
4711
  issues: [
@@ -4721,7 +4721,7 @@ function decodeCursor(cursor) {
4721
4721
  );
4722
4722
  }
4723
4723
  if (raw.d !== "f" && raw.d !== "b") {
4724
- throw new chunkLGEALRC6_cjs.ValidationError(`Invalid cursor direction: ${String(raw.d)}`, {
4724
+ throw new chunkDIK74MXX_cjs.ValidationError(`Invalid cursor direction: ${String(raw.d)}`, {
4725
4725
  issues: [
4726
4726
  {
4727
4727
  path: "cursor",
@@ -4731,7 +4731,7 @@ function decodeCursor(cursor) {
4731
4731
  });
4732
4732
  }
4733
4733
  if (!Array.isArray(raw.vals) || !Array.isArray(raw.cols)) {
4734
- throw new chunkLGEALRC6_cjs.ValidationError("Invalid cursor structure", {
4734
+ throw new chunkDIK74MXX_cjs.ValidationError("Invalid cursor structure", {
4735
4735
  issues: [
4736
4736
  {
4737
4737
  path: "cursor",
@@ -4741,7 +4741,7 @@ function decodeCursor(cursor) {
4741
4741
  });
4742
4742
  }
4743
4743
  if (raw.vals.length !== raw.cols.length) {
4744
- throw new chunkLGEALRC6_cjs.ValidationError("Cursor column count mismatch", {
4744
+ throw new chunkDIK74MXX_cjs.ValidationError("Cursor column count mismatch", {
4745
4745
  issues: [
4746
4746
  {
4747
4747
  path: "cursor",
@@ -4757,10 +4757,10 @@ function decodeCursor(cursor) {
4757
4757
  cols: raw.cols
4758
4758
  };
4759
4759
  } catch (error) {
4760
- if (error instanceof chunkLGEALRC6_cjs.ValidationError) {
4760
+ if (error instanceof chunkDIK74MXX_cjs.ValidationError) {
4761
4761
  throw error;
4762
4762
  }
4763
- throw new chunkLGEALRC6_cjs.ValidationError(
4763
+ throw new chunkDIK74MXX_cjs.ValidationError(
4764
4764
  "Invalid cursor format",
4765
4765
  {
4766
4766
  issues: [{ path: "cursor", message: "Failed to decode cursor" }]
@@ -4819,7 +4819,7 @@ function buildCursorFromRow(row, orderSpecs, direction) {
4819
4819
  function validateCursorColumns(cursorData, orderSpecs) {
4820
4820
  const expectedCols = orderSpecs.map((spec) => buildColumnId(spec));
4821
4821
  if (cursorData.cols.length !== expectedCols.length) {
4822
- throw new chunkLGEALRC6_cjs.ValidationError(
4822
+ throw new chunkDIK74MXX_cjs.ValidationError(
4823
4823
  `Cursor has ${cursorData.cols.length} columns but query has ${expectedCols.length} ORDER BY columns`,
4824
4824
  {
4825
4825
  issues: [
@@ -4836,7 +4836,7 @@ function validateCursorColumns(cursorData, orderSpecs) {
4836
4836
  }
4837
4837
  for (const [index, expectedCol] of expectedCols.entries()) {
4838
4838
  if (cursorData.cols[index] !== expectedCol) {
4839
- throw new chunkLGEALRC6_cjs.ValidationError(
4839
+ throw new chunkDIK74MXX_cjs.ValidationError(
4840
4840
  `Cursor column mismatch at position ${index}: expected "${expectedCol}", got "${cursorData.cols[index]}"`,
4841
4841
  {
4842
4842
  issues: [
@@ -5398,7 +5398,7 @@ function createGuardedProxy(target, debugPath) {
5398
5398
  }
5399
5399
  function templateHasReadInstant(template) {
5400
5400
  return template.params.some(
5401
- (parameter) => parameter instanceof drizzleOrm.Placeholder && parameter.name === chunk4TOD4LBZ_cjs.CURRENT_READ_INSTANT_PLACEHOLDER
5401
+ (parameter) => parameter instanceof drizzleOrm.Placeholder && parameter.name === chunkX4JBT642_cjs.CURRENT_READ_INSTANT_PLACEHOLDER
5402
5402
  );
5403
5403
  }
5404
5404
  function queryAstNeedsCurrentReadInstant(ast) {
@@ -5437,13 +5437,13 @@ function fillTemplateParams(params, bindings, dialect) {
5437
5437
  return params.map((parameter) => {
5438
5438
  if (!(parameter instanceof drizzleOrm.Placeholder)) return parameter;
5439
5439
  const name = parameter.name;
5440
- if (name === chunk4TOD4LBZ_cjs.CURRENT_READ_INSTANT_PLACEHOLDER) {
5441
- readInstant ??= chunkBLZDPRXT_cjs.nowIso();
5440
+ if (name === chunkX4JBT642_cjs.CURRENT_READ_INSTANT_PLACEHOLDER) {
5441
+ readInstant ??= chunkRSSQKPSZ_cjs.nowIso();
5442
5442
  return readInstant;
5443
5443
  }
5444
5444
  const value = bindings[name];
5445
5445
  if (value === void 0) {
5446
- throw new chunkLGEALRC6_cjs.ConfigurationError(`Missing binding for parameter "${name}"`, {
5446
+ throw new chunkDIK74MXX_cjs.ConfigurationError(`Missing binding for parameter "${name}"`, {
5447
5447
  parameterName: name
5448
5448
  });
5449
5449
  }
@@ -5455,7 +5455,7 @@ function fillTemplateParams(params, bindings, dialect) {
5455
5455
  // src/query/builder/prepared-query.ts
5456
5456
  function toLiteral(value) {
5457
5457
  if (value === null) {
5458
- throw new chunkLGEALRC6_cjs.ConfigurationError(
5458
+ throw new chunkDIK74MXX_cjs.ConfigurationError(
5459
5459
  "Parameter value must not be null (use undefined-based patterns instead)",
5460
5460
  { parameterName: "value", valueType: "null" }
5461
5461
  );
@@ -5472,7 +5472,7 @@ function toLiteral(value) {
5472
5472
  if (typeof value === "boolean") {
5473
5473
  return { __type: "literal", value, valueType: "boolean" };
5474
5474
  }
5475
- throw new chunkLGEALRC6_cjs.ConfigurationError(
5475
+ throw new chunkDIK74MXX_cjs.ConfigurationError(
5476
5476
  `Unsupported parameter value type: ${typeof value}`,
5477
5477
  { parameterName: "value", actualType: typeof value }
5478
5478
  );
@@ -5480,10 +5480,10 @@ function toLiteral(value) {
5480
5480
  function substitutePredicateExpression(expr, bindings) {
5481
5481
  switch (expr.__type) {
5482
5482
  case "comparison": {
5483
- if (chunk4TOD4LBZ_cjs.isParameterRef(expr.right)) {
5483
+ if (chunkX4JBT642_cjs.isParameterRef(expr.right)) {
5484
5484
  const value = bindings[expr.right.name];
5485
5485
  if (value === void 0) {
5486
- throw new chunkLGEALRC6_cjs.ConfigurationError(
5486
+ throw new chunkDIK74MXX_cjs.ConfigurationError(
5487
5487
  `Missing binding for parameter "${expr.right.name}"`,
5488
5488
  { parameterName: expr.right.name }
5489
5489
  );
@@ -5496,16 +5496,16 @@ function substitutePredicateExpression(expr, bindings) {
5496
5496
  return expr;
5497
5497
  }
5498
5498
  case "string_op": {
5499
- if (chunk4TOD4LBZ_cjs.isParameterRef(expr.pattern)) {
5499
+ if (chunkX4JBT642_cjs.isParameterRef(expr.pattern)) {
5500
5500
  const value = bindings[expr.pattern.name];
5501
5501
  if (value === void 0) {
5502
- throw new chunkLGEALRC6_cjs.ConfigurationError(
5502
+ throw new chunkDIK74MXX_cjs.ConfigurationError(
5503
5503
  `Missing binding for parameter "${expr.pattern.name}"`,
5504
5504
  { parameterName: expr.pattern.name }
5505
5505
  );
5506
5506
  }
5507
5507
  if (typeof value !== "string") {
5508
- throw new chunkLGEALRC6_cjs.ConfigurationError(
5508
+ throw new chunkDIK74MXX_cjs.ConfigurationError(
5509
5509
  `Parameter "${expr.pattern.name}" must be a string for string operations`,
5510
5510
  { parameterName: expr.pattern.name, actualType: typeof value }
5511
5511
  );
@@ -5518,8 +5518,8 @@ function substitutePredicateExpression(expr, bindings) {
5518
5518
  return expr;
5519
5519
  }
5520
5520
  case "between": {
5521
- const lowerIsParam = chunk4TOD4LBZ_cjs.isParameterRef(expr.lower);
5522
- const upperIsParam = chunk4TOD4LBZ_cjs.isParameterRef(expr.upper);
5521
+ const lowerIsParam = chunkX4JBT642_cjs.isParameterRef(expr.lower);
5522
+ const upperIsParam = chunkX4JBT642_cjs.isParameterRef(expr.upper);
5523
5523
  if (!lowerIsParam && !upperIsParam) return expr;
5524
5524
  const lower = lowerIsParam ? toLiteral(resolveBinding(bindings, expr.lower.name)) : expr.lower;
5525
5525
  const upper = upperIsParam ? toLiteral(resolveBinding(bindings, expr.upper.name)) : expr.upper;
@@ -5573,7 +5573,7 @@ function substitutePredicateExpression(expr, bindings) {
5573
5573
  function resolveBinding(bindings, name) {
5574
5574
  const value = bindings[name];
5575
5575
  if (value === void 0) {
5576
- throw new chunkLGEALRC6_cjs.ConfigurationError(`Missing binding for parameter "${name}"`, {
5576
+ throw new chunkDIK74MXX_cjs.ConfigurationError(`Missing binding for parameter "${name}"`, {
5577
5577
  parameterName: name
5578
5578
  });
5579
5579
  }
@@ -5667,7 +5667,7 @@ var PreparedQuery = class {
5667
5667
  this.#selectFn
5668
5668
  );
5669
5669
  } catch (error) {
5670
- if (error instanceof MissingSelectiveFieldError || error instanceof chunkLGEALRC6_cjs.UnsupportedPredicateError) {
5670
+ if (error instanceof MissingSelectiveFieldError || error instanceof chunkDIK74MXX_cjs.UnsupportedPredicateError) {
5671
5671
  return this.#executeUnoptimized(bindings);
5672
5672
  }
5673
5673
  throw error;
@@ -5754,23 +5754,23 @@ function collectParameterMetadataFromAst(ast, names, stringOpParameters) {
5754
5754
  function collectParameterMetadataFromExpression(expression, names, stringOpParameters) {
5755
5755
  switch (expression.__type) {
5756
5756
  case "comparison": {
5757
- if (chunk4TOD4LBZ_cjs.isParameterRef(expression.right)) {
5757
+ if (chunkX4JBT642_cjs.isParameterRef(expression.right)) {
5758
5758
  names.add(expression.right.name);
5759
5759
  }
5760
5760
  return;
5761
5761
  }
5762
5762
  case "string_op": {
5763
- if (chunk4TOD4LBZ_cjs.isParameterRef(expression.pattern)) {
5763
+ if (chunkX4JBT642_cjs.isParameterRef(expression.pattern)) {
5764
5764
  names.add(expression.pattern.name);
5765
5765
  stringOpParameters.add(expression.pattern.name);
5766
5766
  }
5767
5767
  return;
5768
5768
  }
5769
5769
  case "between": {
5770
- if (chunk4TOD4LBZ_cjs.isParameterRef(expression.lower)) {
5770
+ if (chunkX4JBT642_cjs.isParameterRef(expression.lower)) {
5771
5771
  names.add(expression.lower.name);
5772
5772
  }
5773
- if (chunk4TOD4LBZ_cjs.isParameterRef(expression.upper)) {
5773
+ if (chunkX4JBT642_cjs.isParameterRef(expression.upper)) {
5774
5774
  names.add(expression.upper.name);
5775
5775
  }
5776
5776
  return;
@@ -5829,7 +5829,7 @@ function validateBindings(bindings, metadata) {
5829
5829
  }
5830
5830
  }
5831
5831
  if (missing.length > 0) {
5832
- throw new chunkLGEALRC6_cjs.ConfigurationError(
5832
+ throw new chunkDIK74MXX_cjs.ConfigurationError(
5833
5833
  `Missing bindings for parameter${missing.length === 1 ? "" : "s"}: ${missing.map((name) => `"${name}"`).join(", ")}`,
5834
5834
  { missingParameters: missing }
5835
5835
  );
@@ -5838,7 +5838,7 @@ function validateBindings(bindings, metadata) {
5838
5838
  (name) => !expectedNames.has(name)
5839
5839
  );
5840
5840
  if (unexpected.length > 0) {
5841
- throw new chunkLGEALRC6_cjs.ConfigurationError(
5841
+ throw new chunkDIK74MXX_cjs.ConfigurationError(
5842
5842
  `Unexpected bindings provided: ${unexpected.map((name) => `"${name}"`).join(", ")}`,
5843
5843
  { unexpectedParameters: unexpected }
5844
5844
  );
@@ -5850,14 +5850,14 @@ function validateBindings(bindings, metadata) {
5850
5850
  }
5851
5851
  function validateBindingValue(name, value, isStringOp) {
5852
5852
  if (value === null) {
5853
- throw new chunkLGEALRC6_cjs.ConfigurationError(
5853
+ throw new chunkDIK74MXX_cjs.ConfigurationError(
5854
5854
  "Parameter value must not be null (use undefined-based patterns instead)",
5855
5855
  { parameterName: name, valueType: "null" }
5856
5856
  );
5857
5857
  }
5858
5858
  if (isStringOp) {
5859
5859
  if (typeof value !== "string") {
5860
- throw new chunkLGEALRC6_cjs.ConfigurationError(
5860
+ throw new chunkDIK74MXX_cjs.ConfigurationError(
5861
5861
  `Parameter "${name}" must be a string for string operations`,
5862
5862
  { parameterName: name, actualType: typeof value }
5863
5863
  );
@@ -5867,7 +5867,7 @@ function validateBindingValue(name, value, isStringOp) {
5867
5867
  if (value instanceof Date || typeof value === "string" || typeof value === "number" || typeof value === "boolean") {
5868
5868
  return;
5869
5869
  }
5870
- throw new chunkLGEALRC6_cjs.ConfigurationError(
5870
+ throw new chunkDIK74MXX_cjs.ConfigurationError(
5871
5871
  `Unsupported parameter value type: ${typeof value}`,
5872
5872
  { parameterName: name, actualType: typeof value }
5873
5873
  );
@@ -5932,7 +5932,7 @@ var SQL_RESERVED_KEYWORDS = /* @__PURE__ */ new Set([
5932
5932
  ]);
5933
5933
  function validateSqlIdentifier(alias) {
5934
5934
  if (!SQL_IDENTIFIER_PATTERN.test(alias)) {
5935
- throw new chunkLGEALRC6_cjs.ValidationError(
5935
+ throw new chunkDIK74MXX_cjs.ValidationError(
5936
5936
  `Invalid alias "${alias}": must start with a letter or underscore, contain only letters, digits, and underscores, and be at most 63 characters`,
5937
5937
  {
5938
5938
  issues: [
@@ -5948,7 +5948,7 @@ function validateSqlIdentifier(alias) {
5948
5948
  );
5949
5949
  }
5950
5950
  if (alias.toLowerCase().startsWith("cte_")) {
5951
- throw new chunkLGEALRC6_cjs.ValidationError(
5951
+ throw new chunkDIK74MXX_cjs.ValidationError(
5952
5952
  `Invalid alias "${alias}": aliases starting with "cte_" are reserved for internal use`,
5953
5953
  {
5954
5954
  issues: [
@@ -5964,7 +5964,7 @@ function validateSqlIdentifier(alias) {
5964
5964
  );
5965
5965
  }
5966
5966
  if (SQL_RESERVED_KEYWORDS.has(alias.toLowerCase())) {
5967
- throw new chunkLGEALRC6_cjs.ValidationError(
5967
+ throw new chunkDIK74MXX_cjs.ValidationError(
5968
5968
  `Invalid alias "${alias}": "${alias}" is a reserved SQL keyword`,
5969
5969
  {
5970
5970
  issues: [
@@ -6033,7 +6033,7 @@ function validateStructuralPredicatePlacement(expression, matchType, buildError,
6033
6033
  }
6034
6034
  }
6035
6035
  function throwInvalidVectorPredicatePlacement(path) {
6036
- throw new chunkLGEALRC6_cjs.ValidationError(
6036
+ throw new chunkDIK74MXX_cjs.ValidationError(
6037
6037
  "Vector similarity predicates cannot be nested under OR or NOT. Use top-level AND combinations instead.",
6038
6038
  {
6039
6039
  issues: [
@@ -6049,7 +6049,7 @@ function throwInvalidVectorPredicatePlacement(path) {
6049
6049
  );
6050
6050
  }
6051
6051
  function throwInvalidFulltextPredicatePlacement(path) {
6052
- throw new chunkLGEALRC6_cjs.ValidationError(
6052
+ throw new chunkDIK74MXX_cjs.ValidationError(
6053
6053
  "Fulltext match predicates (.matches()) cannot be nested under OR or NOT. Use top-level AND combinations instead.",
6054
6054
  {
6055
6055
  issues: [
@@ -6089,13 +6089,13 @@ function validateFulltextPredicatePlacement(predicates) {
6089
6089
  function validateHybridFusionOptions(options) {
6090
6090
  const method = options.method;
6091
6091
  if (method !== void 0 && method !== "rrf") {
6092
- throw new chunkLGEALRC6_cjs.ValidationError(`Unsupported fusion method: ${method}`, {
6092
+ throw new chunkDIK74MXX_cjs.ValidationError(`Unsupported fusion method: ${method}`, {
6093
6093
  issues: [{ path: "fusion.method", message: `Only "rrf" is supported.` }]
6094
6094
  });
6095
6095
  }
6096
6096
  const { k } = options;
6097
6097
  if (k !== void 0 && (!Number.isFinite(k) || k <= 0)) {
6098
- throw new chunkLGEALRC6_cjs.ValidationError(
6098
+ throw new chunkDIK74MXX_cjs.ValidationError(
6099
6099
  `Fusion k must be a positive finite number, got: ${String(k)}`,
6100
6100
  {
6101
6101
  issues: [{ path: "fusion.k", message: "Must be a positive number." }]
@@ -6107,7 +6107,7 @@ function validateHybridFusionOptions(options) {
6107
6107
  for (const key of ["vector", "fulltext"]) {
6108
6108
  const weight = weights[key];
6109
6109
  if (weight !== void 0 && (!Number.isFinite(weight) || weight < 0)) {
6110
- throw new chunkLGEALRC6_cjs.ValidationError(
6110
+ throw new chunkDIK74MXX_cjs.ValidationError(
6111
6111
  `Fusion weight for "${key}" must be a non-negative finite number, got: ${String(weight)}`,
6112
6112
  {
6113
6113
  issues: [
@@ -6209,7 +6209,7 @@ function buildVectorSlots(registry) {
6209
6209
  const slots = /* @__PURE__ */ new Map();
6210
6210
  for (const [nodeKind, nodeType] of registry.nodeKinds) {
6211
6211
  for (const field2 of chunkH7YNSMA7_cjs.resolveEmbeddingFields(nodeType.schema)) {
6212
- slots.set(chunkXOX22WHL_cjs.vectorSlotKey(nodeKind, field2.fieldPath), {
6212
+ slots.set(chunkZUNQ5BEP_cjs.vectorSlotKey(nodeKind, field2.fieldPath), {
6213
6213
  dimensions: field2.dimensions,
6214
6214
  metric: field2.metric,
6215
6215
  indexType: field2.indexType
@@ -6288,10 +6288,10 @@ var ExecutableQuery = class _ExecutableQuery {
6288
6288
  }
6289
6289
  }
6290
6290
  const orderSpec = isSystem ? {
6291
- field: chunk4TOD4LBZ_cjs.fieldRef(alias, [field2], { valueType: "string" }),
6291
+ field: chunkX4JBT642_cjs.fieldRef(alias, [field2], { valueType: "string" }),
6292
6292
  direction
6293
6293
  } : {
6294
- field: chunk4TOD4LBZ_cjs.fieldRef(alias, ["props"], {
6294
+ field: chunkX4JBT642_cjs.fieldRef(alias, ["props"], {
6295
6295
  jsonPointer: chunkTDXIBCGY_cjs.jsonPointer([field2]),
6296
6296
  valueType: typeInfo?.valueType,
6297
6297
  elementType: typeInfo?.elementType
@@ -6506,7 +6506,7 @@ var ExecutableQuery = class _ExecutableQuery {
6506
6506
  }
6507
6507
  #executeOnBackend(backend, promise, surface) {
6508
6508
  if (this.#state.recordedAsOf === void 0) return promise;
6509
- return chunkBLZDPRXT_cjs.withRecordedRelationsPrecondition(promise, {
6509
+ return chunkRSSQKPSZ_cjs.withRecordedRelationsPrecondition(promise, {
6510
6510
  dialect: backend.dialect,
6511
6511
  surface
6512
6512
  });
@@ -6663,7 +6663,7 @@ var ExecutableQuery = class _ExecutableQuery {
6663
6663
  this.#cachedSelectiveFieldsForExecute = void 0;
6664
6664
  return void 0;
6665
6665
  }
6666
- if (error instanceof chunkLGEALRC6_cjs.UnsupportedPredicateError) {
6666
+ if (error instanceof chunkDIK74MXX_cjs.UnsupportedPredicateError) {
6667
6667
  this.#cachedSelectiveFieldsForExecute = void 0;
6668
6668
  return void 0;
6669
6669
  }
@@ -6700,7 +6700,7 @@ var ExecutableQuery = class _ExecutableQuery {
6700
6700
  this.#cachedSelectiveFieldsForExecute = void 0;
6701
6701
  return void 0;
6702
6702
  }
6703
- if (error instanceof chunkLGEALRC6_cjs.UnsupportedPredicateError) {
6703
+ if (error instanceof chunkDIK74MXX_cjs.UnsupportedPredicateError) {
6704
6704
  this.#cachedSelectiveFieldsForExecute = void 0;
6705
6705
  return void 0;
6706
6706
  }
@@ -6833,7 +6833,7 @@ var ExecutableQuery = class _ExecutableQuery {
6833
6833
  selectiveFields
6834
6834
  });
6835
6835
  } catch (error) {
6836
- if (error instanceof chunkLGEALRC6_cjs.UnsupportedPredicateError) {
6836
+ if (error instanceof chunkDIK74MXX_cjs.UnsupportedPredicateError) {
6837
6837
  this.#cachedSelectiveFieldsForPagination = void 0;
6838
6838
  return void 0;
6839
6839
  }
@@ -6859,7 +6859,7 @@ var ExecutableQuery = class _ExecutableQuery {
6859
6859
  this.#cachedSelectiveFieldsForPagination = void 0;
6860
6860
  return void 0;
6861
6861
  }
6862
- if (error instanceof chunkLGEALRC6_cjs.UnsupportedPredicateError) {
6862
+ if (error instanceof chunkDIK74MXX_cjs.UnsupportedPredicateError) {
6863
6863
  this.#cachedSelectiveFieldsForPagination = void 0;
6864
6864
  return void 0;
6865
6865
  }
@@ -6884,7 +6884,7 @@ var ExecutableQuery = class _ExecutableQuery {
6884
6884
  this.#cachedSelectiveFieldsForPagination = void 0;
6885
6885
  return void 0;
6886
6886
  }
6887
- if (error instanceof chunkLGEALRC6_cjs.UnsupportedPredicateError) {
6887
+ if (error instanceof chunkDIK74MXX_cjs.UnsupportedPredicateError) {
6888
6888
  this.#cachedSelectiveFieldsForPagination = void 0;
6889
6889
  return void 0;
6890
6890
  }
@@ -7066,7 +7066,7 @@ var ExecutableQuery = class _ExecutableQuery {
7066
7066
  );
7067
7067
  }
7068
7068
  if (this.#state.orderBy.length === 0) {
7069
- throw new chunkLGEALRC6_cjs.ValidationError(
7069
+ throw new chunkDIK74MXX_cjs.ValidationError(
7070
7070
  "Cursor pagination requires ORDER BY. Add .orderBy() before .paginate()",
7071
7071
  {
7072
7072
  issues: [
@@ -7142,7 +7142,7 @@ var ExecutableQuery = class _ExecutableQuery {
7142
7142
  */
7143
7143
  stream(options) {
7144
7144
  if (this.#state.orderBy.length === 0) {
7145
- throw new chunkLGEALRC6_cjs.ValidationError(
7145
+ throw new chunkDIK74MXX_cjs.ValidationError(
7146
7146
  "Streaming requires ORDER BY. Add .orderBy() before .stream()",
7147
7147
  {
7148
7148
  issues: [
@@ -7412,12 +7412,12 @@ function createDynamicFieldBuilder(introspector, alias, name, kindNames, entity)
7412
7412
  if (typeInfo === void 0) {
7413
7413
  throw new Error(`Property "${name}" is not declared on ${where}.`);
7414
7414
  }
7415
- const ref = chunk4TOD4LBZ_cjs.fieldRef(alias, ["props"], {
7415
+ const ref = chunkX4JBT642_cjs.fieldRef(alias, ["props"], {
7416
7416
  jsonPointer: chunkTDXIBCGY_cjs.jsonPointer([name]),
7417
7417
  valueType: typeInfo.valueType,
7418
7418
  elementType: typeInfo.elementType
7419
7419
  });
7420
- const base = chunk4TOD4LBZ_cjs.buildFieldBuilderForTypeInfo(ref, typeInfo);
7420
+ const base = chunkX4JBT642_cjs.buildFieldBuilderForTypeInfo(ref, typeInfo);
7421
7421
  const expect = (asserted) => {
7422
7422
  if (typeInfo.valueType !== asserted) {
7423
7423
  throw new TypeError(
@@ -7589,17 +7589,17 @@ var TraversalBuilder = class _TraversalBuilder {
7589
7589
  (kind) => !this.#edgeKinds.includes(kind)
7590
7590
  )
7591
7591
  ];
7592
- const idAccessor = chunk4TOD4LBZ_cjs.stringField(
7593
- chunk4TOD4LBZ_cjs.fieldRef(alias, ["id"], { valueType: "string" })
7592
+ const idAccessor = chunkX4JBT642_cjs.stringField(
7593
+ chunkX4JBT642_cjs.fieldRef(alias, ["id"], { valueType: "string" })
7594
7594
  );
7595
- const kindAccessor = chunk4TOD4LBZ_cjs.stringField(
7596
- chunk4TOD4LBZ_cjs.fieldRef(alias, ["kind"], { valueType: "string" })
7595
+ const kindAccessor = chunkX4JBT642_cjs.stringField(
7596
+ chunkX4JBT642_cjs.fieldRef(alias, ["kind"], { valueType: "string" })
7597
7597
  );
7598
- const fromIdAccessor = chunk4TOD4LBZ_cjs.stringField(
7599
- chunk4TOD4LBZ_cjs.fieldRef(alias, ["from_id"], { valueType: "string" })
7598
+ const fromIdAccessor = chunkX4JBT642_cjs.stringField(
7599
+ chunkX4JBT642_cjs.fieldRef(alias, ["from_id"], { valueType: "string" })
7600
7600
  );
7601
- const toIdAccessor = chunk4TOD4LBZ_cjs.stringField(
7602
- chunk4TOD4LBZ_cjs.fieldRef(alias, ["to_id"], { valueType: "string" })
7601
+ const toIdAccessor = chunkX4JBT642_cjs.stringField(
7602
+ chunkX4JBT642_cjs.fieldRef(alias, ["to_id"], { valueType: "string" })
7603
7603
  );
7604
7604
  const buildFieldAccessor = (propertyName) => {
7605
7605
  const typeInfo = this.#config.schemaIntrospector.getSharedEdgeFieldTypeInfo(
@@ -7608,34 +7608,34 @@ var TraversalBuilder = class _TraversalBuilder {
7608
7608
  );
7609
7609
  const valueType = typeInfo?.valueType;
7610
7610
  const elementType = typeInfo?.elementType;
7611
- const ref = chunk4TOD4LBZ_cjs.fieldRef(alias, ["props"], {
7611
+ const ref = chunkX4JBT642_cjs.fieldRef(alias, ["props"], {
7612
7612
  jsonPointer: chunkTDXIBCGY_cjs.jsonPointer([propertyName]),
7613
7613
  valueType,
7614
7614
  elementType
7615
7615
  });
7616
7616
  switch (valueType) {
7617
7617
  case "string": {
7618
- return chunk4TOD4LBZ_cjs.stringField(ref);
7618
+ return chunkX4JBT642_cjs.stringField(ref);
7619
7619
  }
7620
7620
  case "number": {
7621
- return chunk4TOD4LBZ_cjs.numberField(ref);
7621
+ return chunkX4JBT642_cjs.numberField(ref);
7622
7622
  }
7623
7623
  case "boolean": {
7624
- return chunk4TOD4LBZ_cjs.baseField(ref);
7624
+ return chunkX4JBT642_cjs.baseField(ref);
7625
7625
  }
7626
7626
  case "date": {
7627
- return chunk4TOD4LBZ_cjs.dateField(ref);
7627
+ return chunkX4JBT642_cjs.dateField(ref);
7628
7628
  }
7629
7629
  case "array": {
7630
- return chunk4TOD4LBZ_cjs.arrayField(ref);
7630
+ return chunkX4JBT642_cjs.arrayField(ref);
7631
7631
  }
7632
7632
  case "object": {
7633
- return chunk4TOD4LBZ_cjs.objectField(ref);
7633
+ return chunkX4JBT642_cjs.objectField(ref);
7634
7634
  }
7635
7635
  case "embedding":
7636
7636
  case "unknown":
7637
7637
  case void 0: {
7638
- return chunk4TOD4LBZ_cjs.baseField(ref);
7638
+ return chunkX4JBT642_cjs.baseField(ref);
7639
7639
  }
7640
7640
  }
7641
7641
  };
@@ -7681,7 +7681,7 @@ var TraversalBuilder = class _TraversalBuilder {
7681
7681
  toDynamic(kind, alias, options) {
7682
7682
  validateSqlIdentifier(alias);
7683
7683
  if (!this.#config.registry.hasNodeType(kind)) {
7684
- throw new chunkLGEALRC6_cjs.KindNotFoundError(kind, "node", {
7684
+ throw new chunkDIK74MXX_cjs.KindNotFoundError(kind, "node", {
7685
7685
  graphId: this.#config.graphId
7686
7686
  });
7687
7687
  }
@@ -7766,7 +7766,7 @@ var TraversalBuilder = class _TraversalBuilder {
7766
7766
  for (const expected of expectedKinds) {
7767
7767
  if (this.#config.registry.isAssignableTo(targetKind, expected)) return;
7768
7768
  }
7769
- throw new chunkLGEALRC6_cjs.EndpointError({
7769
+ throw new chunkDIK74MXX_cjs.EndpointError({
7770
7770
  edgeKind: this.#edgeKinds[0] ?? "(unknown)",
7771
7771
  endpoint: forwardSide,
7772
7772
  actualKind: targetKind,
@@ -7780,39 +7780,39 @@ function buildNodeFields(alias) {
7780
7780
  return [
7781
7781
  {
7782
7782
  outputName: `${alias}_id`,
7783
- source: chunk4TOD4LBZ_cjs.fieldRef(alias, ["id"])
7783
+ source: chunkX4JBT642_cjs.fieldRef(alias, ["id"])
7784
7784
  },
7785
7785
  {
7786
7786
  outputName: `${alias}_kind`,
7787
- source: chunk4TOD4LBZ_cjs.fieldRef(alias, ["kind"])
7787
+ source: chunkX4JBT642_cjs.fieldRef(alias, ["kind"])
7788
7788
  },
7789
7789
  {
7790
7790
  outputName: `${alias}_props`,
7791
- source: chunk4TOD4LBZ_cjs.fieldRef(alias, ["props"])
7791
+ source: chunkX4JBT642_cjs.fieldRef(alias, ["props"])
7792
7792
  },
7793
7793
  {
7794
7794
  outputName: `${alias}_version`,
7795
- source: chunk4TOD4LBZ_cjs.fieldRef(alias, ["version"])
7795
+ source: chunkX4JBT642_cjs.fieldRef(alias, ["version"])
7796
7796
  },
7797
7797
  {
7798
7798
  outputName: `${alias}_valid_from`,
7799
- source: chunk4TOD4LBZ_cjs.fieldRef(alias, ["valid_from"])
7799
+ source: chunkX4JBT642_cjs.fieldRef(alias, ["valid_from"])
7800
7800
  },
7801
7801
  {
7802
7802
  outputName: `${alias}_valid_to`,
7803
- source: chunk4TOD4LBZ_cjs.fieldRef(alias, ["valid_to"])
7803
+ source: chunkX4JBT642_cjs.fieldRef(alias, ["valid_to"])
7804
7804
  },
7805
7805
  {
7806
7806
  outputName: `${alias}_created_at`,
7807
- source: chunk4TOD4LBZ_cjs.fieldRef(alias, ["created_at"])
7807
+ source: chunkX4JBT642_cjs.fieldRef(alias, ["created_at"])
7808
7808
  },
7809
7809
  {
7810
7810
  outputName: `${alias}_updated_at`,
7811
- source: chunk4TOD4LBZ_cjs.fieldRef(alias, ["updated_at"])
7811
+ source: chunkX4JBT642_cjs.fieldRef(alias, ["updated_at"])
7812
7812
  },
7813
7813
  {
7814
7814
  outputName: `${alias}_deleted_at`,
7815
- source: chunk4TOD4LBZ_cjs.fieldRef(alias, ["deleted_at"])
7815
+ source: chunkX4JBT642_cjs.fieldRef(alias, ["deleted_at"])
7816
7816
  }
7817
7817
  ];
7818
7818
  }
@@ -7821,52 +7821,52 @@ function buildEdgeFields(edgeAlias, nodeCteAlias) {
7821
7821
  return [
7822
7822
  {
7823
7823
  outputName: `${edgeAlias}_id`,
7824
- source: chunk4TOD4LBZ_cjs.fieldRef(edgeAlias, ["id"]),
7824
+ source: chunkX4JBT642_cjs.fieldRef(edgeAlias, ["id"]),
7825
7825
  cteAlias
7826
7826
  },
7827
7827
  {
7828
7828
  outputName: `${edgeAlias}_kind`,
7829
- source: chunk4TOD4LBZ_cjs.fieldRef(edgeAlias, ["kind"]),
7829
+ source: chunkX4JBT642_cjs.fieldRef(edgeAlias, ["kind"]),
7830
7830
  cteAlias
7831
7831
  },
7832
7832
  {
7833
7833
  outputName: `${edgeAlias}_from_id`,
7834
- source: chunk4TOD4LBZ_cjs.fieldRef(edgeAlias, ["from_id"]),
7834
+ source: chunkX4JBT642_cjs.fieldRef(edgeAlias, ["from_id"]),
7835
7835
  cteAlias
7836
7836
  },
7837
7837
  {
7838
7838
  outputName: `${edgeAlias}_to_id`,
7839
- source: chunk4TOD4LBZ_cjs.fieldRef(edgeAlias, ["to_id"]),
7839
+ source: chunkX4JBT642_cjs.fieldRef(edgeAlias, ["to_id"]),
7840
7840
  cteAlias
7841
7841
  },
7842
7842
  {
7843
7843
  outputName: `${edgeAlias}_props`,
7844
- source: chunk4TOD4LBZ_cjs.fieldRef(edgeAlias, ["props"]),
7844
+ source: chunkX4JBT642_cjs.fieldRef(edgeAlias, ["props"]),
7845
7845
  cteAlias
7846
7846
  },
7847
7847
  {
7848
7848
  outputName: `${edgeAlias}_valid_from`,
7849
- source: chunk4TOD4LBZ_cjs.fieldRef(edgeAlias, ["valid_from"]),
7849
+ source: chunkX4JBT642_cjs.fieldRef(edgeAlias, ["valid_from"]),
7850
7850
  cteAlias
7851
7851
  },
7852
7852
  {
7853
7853
  outputName: `${edgeAlias}_valid_to`,
7854
- source: chunk4TOD4LBZ_cjs.fieldRef(edgeAlias, ["valid_to"]),
7854
+ source: chunkX4JBT642_cjs.fieldRef(edgeAlias, ["valid_to"]),
7855
7855
  cteAlias
7856
7856
  },
7857
7857
  {
7858
7858
  outputName: `${edgeAlias}_created_at`,
7859
- source: chunk4TOD4LBZ_cjs.fieldRef(edgeAlias, ["created_at"]),
7859
+ source: chunkX4JBT642_cjs.fieldRef(edgeAlias, ["created_at"]),
7860
7860
  cteAlias
7861
7861
  },
7862
7862
  {
7863
7863
  outputName: `${edgeAlias}_updated_at`,
7864
- source: chunk4TOD4LBZ_cjs.fieldRef(edgeAlias, ["updated_at"]),
7864
+ source: chunkX4JBT642_cjs.fieldRef(edgeAlias, ["updated_at"]),
7865
7865
  cteAlias
7866
7866
  },
7867
7867
  {
7868
7868
  outputName: `${edgeAlias}_deleted_at`,
7869
- source: chunk4TOD4LBZ_cjs.fieldRef(edgeAlias, ["deleted_at"]),
7869
+ source: chunkX4JBT642_cjs.fieldRef(edgeAlias, ["deleted_at"]),
7870
7870
  cteAlias
7871
7871
  }
7872
7872
  ];
@@ -7895,16 +7895,16 @@ var QueryBuilder = class _QueryBuilder {
7895
7895
  const { sealedCoordinate } = getQueryBuilderInternalContext(this.#config);
7896
7896
  if (sealedCoordinate !== void 0) {
7897
7897
  const coordinate2 = sealedCoordinate;
7898
- throw new chunkLGEALRC6_cjs.ConfigurationError(
7899
- `.temporal() is not available on a StoreView query \u2014 the view's temporal coordinate (${chunkXOX22WHL_cjs.describeCoordinate(coordinate2)}) is sealed. Re-coordinate on the live Store via store.query() or store.view(...).`,
7898
+ throw new chunkDIK74MXX_cjs.ConfigurationError(
7899
+ `.temporal() is not available on a StoreView query \u2014 the view's temporal coordinate (${chunkZUNQ5BEP_cjs.describeCoordinate(coordinate2)}) is sealed. Re-coordinate on the live Store via store.query() or store.view(...).`,
7900
7900
  {
7901
7901
  code: "STORE_VIEW_SEALED_QUERY",
7902
- ...chunkXOX22WHL_cjs.coordinateContext(coordinate2),
7902
+ ...chunkZUNQ5BEP_cjs.coordinateContext(coordinate2),
7903
7903
  requestedMode: mode
7904
7904
  }
7905
7905
  );
7906
7906
  }
7907
- const coordinate = chunkXOX22WHL_cjs.resolveReadCoordinate(
7907
+ const coordinate = chunkZUNQ5BEP_cjs.resolveReadCoordinate(
7908
7908
  mode,
7909
7909
  asOf,
7910
7910
  `Use .temporal("asOf", "2024-01-15T10:00:00.000Z") or .temporal("current") for current time.`
@@ -7936,7 +7936,7 @@ var QueryBuilder = class _QueryBuilder {
7936
7936
  fromDynamic(kind, alias, options) {
7937
7937
  validateSqlIdentifier(alias);
7938
7938
  if (!this.#config.registry.hasNodeType(kind)) {
7939
- throw new chunkLGEALRC6_cjs.KindNotFoundError(kind, "node", {
7939
+ throw new chunkDIK74MXX_cjs.KindNotFoundError(kind, "node", {
7940
7940
  graphId: this.#config.graphId
7941
7941
  });
7942
7942
  }
@@ -8066,7 +8066,7 @@ var QueryBuilder = class _QueryBuilder {
8066
8066
  #beginDynamicTraversal(edgeKind, edgeAlias, optional, options) {
8067
8067
  validateSqlIdentifier(edgeAlias);
8068
8068
  if (!this.#config.registry.hasEdgeType(edgeKind)) {
8069
- throw new chunkLGEALRC6_cjs.KindNotFoundError(edgeKind, "edge", {
8069
+ throw new chunkDIK74MXX_cjs.KindNotFoundError(edgeKind, "edge", {
8070
8070
  graphId: this.#config.graphId
8071
8071
  });
8072
8072
  }
@@ -8179,10 +8179,10 @@ var QueryBuilder = class _QueryBuilder {
8179
8179
  field2
8180
8180
  ) : this.#getOrderByTypeInfo(alias, field2);
8181
8181
  const orderSpec = isSystem ? {
8182
- field: chunk4TOD4LBZ_cjs.fieldRef(alias, [field2], { valueType: "string" }),
8182
+ field: chunkX4JBT642_cjs.fieldRef(alias, [field2], { valueType: "string" }),
8183
8183
  direction
8184
8184
  } : {
8185
- field: chunk4TOD4LBZ_cjs.fieldRef(alias, ["props"], {
8185
+ field: chunkX4JBT642_cjs.fieldRef(alias, ["props"], {
8186
8186
  jsonPointer: chunkTDXIBCGY_cjs.jsonPointer([field2]),
8187
8187
  valueType: typeInfo?.valueType,
8188
8188
  elementType: typeInfo?.elementType
@@ -8358,7 +8358,7 @@ var QueryBuilder = class _QueryBuilder {
8358
8358
  kindNames,
8359
8359
  property
8360
8360
  ) : void 0;
8361
- const ref = chunk4TOD4LBZ_cjs.fieldRef(alias, ["props"], {
8361
+ const ref = chunkX4JBT642_cjs.fieldRef(alias, ["props"], {
8362
8362
  jsonPointer: chunkTDXIBCGY_cjs.jsonPointer([property]),
8363
8363
  valueType: typeInfo?.valueType,
8364
8364
  elementType: typeInfo?.elementType
@@ -8366,17 +8366,17 @@ var QueryBuilder = class _QueryBuilder {
8366
8366
  return this.#buildFieldBuilderForTypeInfo(ref, typeInfo);
8367
8367
  }
8368
8368
  #buildFieldBuilderForTypeInfo(ref, typeInfo) {
8369
- return chunk4TOD4LBZ_cjs.buildFieldBuilderForTypeInfo(ref, typeInfo);
8369
+ return chunkX4JBT642_cjs.buildFieldBuilderForTypeInfo(ref, typeInfo);
8370
8370
  }
8371
8371
  #createNodeAccessor(alias) {
8372
8372
  const kindNames = this.#getKindNamesForAlias(alias);
8373
- const idAccessor = chunk4TOD4LBZ_cjs.stringField(
8374
- chunk4TOD4LBZ_cjs.fieldRef(alias, ["id"], { valueType: "string" })
8373
+ const idAccessor = chunkX4JBT642_cjs.stringField(
8374
+ chunkX4JBT642_cjs.fieldRef(alias, ["id"], { valueType: "string" })
8375
8375
  );
8376
- const kindAccessor = chunk4TOD4LBZ_cjs.stringField(
8377
- chunk4TOD4LBZ_cjs.fieldRef(alias, ["kind"], { valueType: "string" })
8376
+ const kindAccessor = chunkX4JBT642_cjs.stringField(
8377
+ chunkX4JBT642_cjs.fieldRef(alias, ["kind"], { valueType: "string" })
8378
8378
  );
8379
- const fulltextAccessor = chunk4TOD4LBZ_cjs.createFulltextAccessor(
8379
+ const fulltextAccessor = chunkX4JBT642_cjs.createFulltextAccessor(
8380
8380
  alias,
8381
8381
  () => this.#hasSearchableField(kindNames)
8382
8382
  );
@@ -8451,7 +8451,7 @@ var QueryBuilder = class _QueryBuilder {
8451
8451
  edgeKindNames,
8452
8452
  property
8453
8453
  ) : void 0;
8454
- const ref = chunk4TOD4LBZ_cjs.fieldRef(alias, ["props"], {
8454
+ const ref = chunkX4JBT642_cjs.fieldRef(alias, ["props"], {
8455
8455
  jsonPointer: chunkTDXIBCGY_cjs.jsonPointer([property]),
8456
8456
  valueType: typeInfo?.valueType,
8457
8457
  elementType: typeInfo?.elementType
@@ -8460,17 +8460,17 @@ var QueryBuilder = class _QueryBuilder {
8460
8460
  }
8461
8461
  #createEdgeAccessor(alias) {
8462
8462
  const edgeKindNames = this.#getEdgeKindNamesForAlias(alias);
8463
- const idAccessor = chunk4TOD4LBZ_cjs.stringField(
8464
- chunk4TOD4LBZ_cjs.fieldRef(alias, ["id"], { valueType: "string" })
8463
+ const idAccessor = chunkX4JBT642_cjs.stringField(
8464
+ chunkX4JBT642_cjs.fieldRef(alias, ["id"], { valueType: "string" })
8465
8465
  );
8466
- const kindAccessor = chunk4TOD4LBZ_cjs.stringField(
8467
- chunk4TOD4LBZ_cjs.fieldRef(alias, ["kind"], { valueType: "string" })
8466
+ const kindAccessor = chunkX4JBT642_cjs.stringField(
8467
+ chunkX4JBT642_cjs.fieldRef(alias, ["kind"], { valueType: "string" })
8468
8468
  );
8469
- const fromIdAccessor = chunk4TOD4LBZ_cjs.stringField(
8470
- chunk4TOD4LBZ_cjs.fieldRef(alias, ["from_id"], { valueType: "string" })
8469
+ const fromIdAccessor = chunkX4JBT642_cjs.stringField(
8470
+ chunkX4JBT642_cjs.fieldRef(alias, ["from_id"], { valueType: "string" })
8471
8471
  );
8472
- const toIdAccessor = chunk4TOD4LBZ_cjs.stringField(
8473
- chunk4TOD4LBZ_cjs.fieldRef(alias, ["to_id"], { valueType: "string" })
8472
+ const toIdAccessor = chunkX4JBT642_cjs.stringField(
8473
+ chunkX4JBT642_cjs.fieldRef(alias, ["to_id"], { valueType: "string" })
8474
8474
  );
8475
8475
  if (this.#state.dynamicEdgeAliases.has(alias)) {
8476
8476
  return {
@@ -8509,7 +8509,7 @@ var QueryBuilder = class _QueryBuilder {
8509
8509
  // src/query/builder/unionable-query.ts
8510
8510
  function executeOnBackend(backend, recordedAsOf, promise, surface) {
8511
8511
  if (recordedAsOf === void 0) return promise;
8512
- return chunkBLZDPRXT_cjs.withRecordedRelationsPrecondition(promise, {
8512
+ return chunkRSSQKPSZ_cjs.withRecordedRelationsPrecondition(promise, {
8513
8513
  dialect: backend.dialect,
8514
8514
  surface
8515
8515
  });
@@ -8998,7 +8998,7 @@ var DEFAULT_MAX_SKIPPED_IDS = 1e4;
8998
8998
  function validatePageSize(value) {
8999
8999
  if (value === void 0) return DEFAULT_PAGE_SIZE;
9000
9000
  if (!Number.isInteger(value) || value <= 0) {
9001
- throw new chunkLGEALRC6_cjs.ValidationError(
9001
+ throw new chunkDIK74MXX_cjs.ValidationError(
9002
9002
  `pageSize must be a positive integer, got: ${String(value)}`,
9003
9003
  {
9004
9004
  issues: [{ path: "pageSize", message: "Must be a positive integer." }]
@@ -9010,7 +9010,7 @@ function validatePageSize(value) {
9010
9010
  function validateMaxSkippedIds(value) {
9011
9011
  if (value === void 0) return DEFAULT_MAX_SKIPPED_IDS;
9012
9012
  if (!Number.isInteger(value) || value < 0) {
9013
- throw new chunkLGEALRC6_cjs.ValidationError(
9013
+ throw new chunkDIK74MXX_cjs.ValidationError(
9014
9014
  `maxSkippedIds must be a non-negative integer, got: ${String(value)}`,
9015
9015
  {
9016
9016
  issues: [
@@ -9030,7 +9030,7 @@ function isPropsObject(value) {
9030
9030
  async function rebuildFulltextIndex(ctx, nodeKind, options) {
9031
9031
  const { backend, registry } = ctx;
9032
9032
  if (!backend.upsertFulltext || !backend.deleteFulltext) {
9033
- throw new chunkLGEALRC6_cjs.ConfigurationError(
9033
+ throw new chunkDIK74MXX_cjs.ConfigurationError(
9034
9034
  "Backend does not support fulltext; cannot rebuild index",
9035
9035
  { backend: backend.dialect, capability: "fulltext" }
9036
9036
  );
@@ -9047,7 +9047,7 @@ async function rebuildFulltextIndex(ctx, nodeKind, options) {
9047
9047
  for (const kind of targetKinds) {
9048
9048
  const nodeType = registry.getNodeType(kind);
9049
9049
  if (!nodeType) {
9050
- throw new chunkLGEALRC6_cjs.ConfigurationError(`Unknown node kind: ${kind}`, { kind });
9050
+ throw new chunkDIK74MXX_cjs.ConfigurationError(`Unknown node kind: ${kind}`, { kind });
9051
9051
  }
9052
9052
  if (chunkH7YNSMA7_cjs.getSearchableFields(nodeType.schema).length === 0) {
9053
9053
  continue;
@@ -9108,7 +9108,7 @@ async function rebuildFulltextIndex(ctx, nodeKind, options) {
9108
9108
  }
9109
9109
  }
9110
9110
  };
9111
- await chunk4TOD4LBZ_cjs.runOptionallyInTransaction(backend, writePage);
9111
+ await chunkX4JBT642_cjs.runOptionallyInTransaction(backend, writePage);
9112
9112
  processed += rows.length;
9113
9113
  upserted += pageResult.toUpsert.length;
9114
9114
  cleared += pageResult.toDelete.length;
@@ -9140,7 +9140,7 @@ function processPage(schema, rows) {
9140
9140
  }
9141
9141
  let parsed;
9142
9142
  try {
9143
- parsed = chunk4TOD4LBZ_cjs.rowPropsToObject(row.props);
9143
+ parsed = chunkX4JBT642_cjs.rowPropsToObject(row.props);
9144
9144
  } catch {
9145
9145
  skipped += 1;
9146
9146
  skippedIds.push(row.id);
@@ -9151,7 +9151,7 @@ function processPage(schema, rows) {
9151
9151
  skippedIds.push(row.id);
9152
9152
  continue;
9153
9153
  }
9154
- const computed = chunkXOX22WHL_cjs.computeFulltextContent(schema, parsed);
9154
+ const computed = chunkZUNQ5BEP_cjs.computeFulltextContent(schema, parsed);
9155
9155
  if (computed === void 0) {
9156
9156
  toDelete.push(row.id);
9157
9157
  } else {
@@ -9168,7 +9168,7 @@ var SEARCH_CANDIDATE_ALIAS = "_sc";
9168
9168
  function buildKindCandidates(ctx, nodeKind, where) {
9169
9169
  if (where === void 0) return void 0;
9170
9170
  if (ctx.createQuery === void 0) {
9171
- throw new chunkLGEALRC6_cjs.ConfigurationError(
9171
+ throw new chunkDIK74MXX_cjs.ConfigurationError(
9172
9172
  "search with a where predicate requires a query-capable store",
9173
9173
  { capability: "search", graphId: ctx.graphId }
9174
9174
  );
@@ -9182,7 +9182,7 @@ function buildKindCandidates(ctx, nodeKind, where) {
9182
9182
  function resolveSearchKinds(ctx, nodeKind, includeSubClasses) {
9183
9183
  if (includeSubClasses !== true) return [nodeKind];
9184
9184
  if (ctx.createQuery === void 0) {
9185
- throw new chunkLGEALRC6_cjs.ConfigurationError(
9185
+ throw new chunkDIK74MXX_cjs.ConfigurationError(
9186
9186
  "search with includeSubClasses requires a query-capable store",
9187
9187
  { capability: "search", graphId: ctx.graphId }
9188
9188
  );
@@ -9230,7 +9230,7 @@ async function fetchNodesForRows(backend, graphId, rows) {
9230
9230
  function tryResolveSearchSlot(ctx, nodeKind, fieldPath) {
9231
9231
  const nodeType = ctx.registry.getNodeType(nodeKind);
9232
9232
  if (nodeType === void 0) return void 0;
9233
- const fields = chunkXOX22WHL_cjs.getEmbeddingFields(nodeType.schema);
9233
+ const fields = chunkZUNQ5BEP_cjs.getEmbeddingFields(nodeType.schema);
9234
9234
  const field2 = fields.find((entry2) => entry2.fieldPath === fieldPath);
9235
9235
  if (field2 === void 0) return void 0;
9236
9236
  return {
@@ -9242,7 +9242,7 @@ function tryResolveSearchSlot(ctx, nodeKind, fieldPath) {
9242
9242
  function resolveSearchSlot(ctx, nodeKind, fieldPath) {
9243
9243
  const slot = tryResolveSearchSlot(ctx, nodeKind, fieldPath);
9244
9244
  if (slot !== void 0) return slot;
9245
- throw new chunkLGEALRC6_cjs.ConfigurationError(
9245
+ throw new chunkDIK74MXX_cjs.ConfigurationError(
9246
9246
  `Node kind "${nodeKind}" has no embedding field "${fieldPath}". Declare it with embedding(dimensions) on the node schema.`,
9247
9247
  { capability: "vector", graphId: ctx.graphId }
9248
9248
  );
@@ -9250,7 +9250,7 @@ function resolveSearchSlot(ctx, nodeKind, fieldPath) {
9250
9250
  async function executeFulltextSearch(ctx, nodeKind, options) {
9251
9251
  const { backend, graphId } = ctx;
9252
9252
  if (!backend.fulltextSearch) {
9253
- throw new chunkLGEALRC6_cjs.ConfigurationError("Backend does not support fulltext search", {
9253
+ throw new chunkDIK74MXX_cjs.ConfigurationError("Backend does not support fulltext search", {
9254
9254
  backend: backend.dialect,
9255
9255
  capability: "fulltext"
9256
9256
  });
@@ -9318,7 +9318,7 @@ async function executeFulltextSearch(ctx, nodeKind, options) {
9318
9318
  async function executeVectorSearch(ctx, nodeKind, options) {
9319
9319
  const { backend, graphId } = ctx;
9320
9320
  if (!backend.vectorSearch) {
9321
- throw new chunkLGEALRC6_cjs.ConfigurationError("Backend does not support vector search", {
9321
+ throw new chunkDIK74MXX_cjs.ConfigurationError("Backend does not support vector search", {
9322
9322
  backend: backend.dialect,
9323
9323
  capability: "vector"
9324
9324
  });
@@ -9411,7 +9411,7 @@ function resolveVectorSearchKinds(ctx, nodeKind, fieldPath, includeSubClasses, l
9411
9411
  if (resolved.length === 0) resolveSearchSlot(ctx, nodeKind, fieldPath);
9412
9412
  const metrics = new Set(resolved.map(({ slot }) => slot.metric));
9413
9413
  if (metrics.size > 1) {
9414
- throw new chunkLGEALRC6_cjs.ConfigurationError(
9414
+ throw new chunkDIK74MXX_cjs.ConfigurationError(
9415
9415
  `${label}: kinds expanded from "${nodeKind}" declare different metrics for "${fieldPath}" (${[...metrics].join(", ")}). Cross-kind vector ranking requires one shared declared metric \u2014 search the kinds separately.`,
9416
9416
  { capability: "vector", graphId: ctx.graphId }
9417
9417
  );
@@ -9432,13 +9432,13 @@ function mergeFulltextRows(perKindRows) {
9432
9432
  async function executeHybridSearch(ctx, nodeKind, options) {
9433
9433
  const { backend, graphId } = ctx;
9434
9434
  if (!backend.vectorSearch) {
9435
- throw new chunkLGEALRC6_cjs.ConfigurationError("Backend does not support vector search", {
9435
+ throw new chunkDIK74MXX_cjs.ConfigurationError("Backend does not support vector search", {
9436
9436
  backend: backend.dialect,
9437
9437
  capability: "vector"
9438
9438
  });
9439
9439
  }
9440
9440
  if (!backend.fulltextSearch) {
9441
- throw new chunkLGEALRC6_cjs.ConfigurationError("Backend does not support fulltext search", {
9441
+ throw new chunkDIK74MXX_cjs.ConfigurationError("Backend does not support fulltext search", {
9442
9442
  backend: backend.dialect,
9443
9443
  capability: "fulltext"
9444
9444
  });
@@ -9540,7 +9540,7 @@ async function executeHybridSearch(ctx, nodeKind, options) {
9540
9540
  ...candidates === void 0 ? {} : { candidates }
9541
9541
  });
9542
9542
  return rows.map((row, index) => {
9543
- const typedNode = chunkWJT7OU7E_cjs.rowToNode(row.node);
9543
+ const typedNode = chunk4CAXEB2F_cjs.rowToNode(row.node);
9544
9544
  return {
9545
9545
  node: typedNode,
9546
9546
  score: row.fusedScore,
@@ -9709,14 +9709,14 @@ function assertMinScore(minScore, metric, label) {
9709
9709
  }
9710
9710
  function assertVectorQueryCompatible(backend, slot, options, label) {
9711
9711
  if (options.metric !== void 0 && options.metric !== slot.metric) {
9712
- throw new chunkLGEALRC6_cjs.ConfigurationError(
9712
+ throw new chunkDIK74MXX_cjs.ConfigurationError(
9713
9713
  `${label}: metric "${options.metric}" does not match the field's declared metric "${slot.metric}". Vector storage is built for the declared metric \u2014 omit metric or pass "${slot.metric}".`,
9714
9714
  { backend: backend.dialect, capability: "vector" }
9715
9715
  );
9716
9716
  }
9717
9717
  const supported = backend.capabilities.vector?.metrics;
9718
9718
  if (supported !== void 0 && !supported.includes(slot.metric)) {
9719
- throw new chunkLGEALRC6_cjs.ConfigurationError(
9719
+ throw new chunkDIK74MXX_cjs.ConfigurationError(
9720
9720
  `${label}: backend "${backend.dialect}" does not support the "${slot.metric}" metric (supported: ${supported.join(", ")}).`,
9721
9721
  { backend: backend.dialect, capability: "vector" }
9722
9722
  );
@@ -9748,7 +9748,7 @@ function validateFulltextCallOptions(backend, options) {
9748
9748
  function validateFulltextMode(backend, strategy, capabilities, mode) {
9749
9749
  if (strategy !== void 0) {
9750
9750
  if (strategy.supportedModes.includes(mode)) return;
9751
- throw new chunkLGEALRC6_cjs.ConfigurationError(
9751
+ throw new chunkDIK74MXX_cjs.ConfigurationError(
9752
9752
  `Backend "${backend.dialect}" fulltext strategy "${strategy.name}" does not support mode "${mode}". Supported modes: ${strategy.supportedModes.join(", ")}`,
9753
9753
  {
9754
9754
  backend: backend.dialect,
@@ -9758,7 +9758,7 @@ function validateFulltextMode(backend, strategy, capabilities, mode) {
9758
9758
  );
9759
9759
  }
9760
9760
  if (mode === "phrase" && capabilities && !capabilities.phraseQueries) {
9761
- throw new chunkLGEALRC6_cjs.ConfigurationError(
9761
+ throw new chunkDIK74MXX_cjs.ConfigurationError(
9762
9762
  `Backend "${backend.dialect}" does not support phrase queries`,
9763
9763
  { backend: backend.dialect, capability: "fulltext.phraseQueries" }
9764
9764
  );
@@ -9767,14 +9767,14 @@ function validateFulltextMode(backend, strategy, capabilities, mode) {
9767
9767
  function validateFulltextSnippets(backend, strategy, capabilities) {
9768
9768
  const supportsSnippets = strategy === void 0 ? capabilities?.highlighting !== false : strategy.supportsSnippets;
9769
9769
  if (supportsSnippets) return;
9770
- throw new chunkLGEALRC6_cjs.ConfigurationError(
9770
+ throw new chunkDIK74MXX_cjs.ConfigurationError(
9771
9771
  `Backend "${backend.dialect}" does not support snippet highlighting; drop includeSnippets or switch to a backend where highlighting is supported`,
9772
9772
  { backend: backend.dialect, capability: "fulltext.highlighting" }
9773
9773
  );
9774
9774
  }
9775
9775
  function validateFulltextLanguageOption(backend, strategy, capabilities, language) {
9776
9776
  if (strategy !== void 0 && !strategy.supportsLanguageOverride) {
9777
- throw new chunkLGEALRC6_cjs.ConfigurationError(
9777
+ throw new chunkDIK74MXX_cjs.ConfigurationError(
9778
9778
  `Backend "${backend.dialect}" fulltext strategy "${strategy.name}" does not honor a per-query \`language\` override (its tokenizer is fixed at table-create time). Drop the option, or pick a strategy that advertises \`supportsLanguageOverride: true\`.`,
9779
9779
  {
9780
9780
  backend: backend.dialect,
@@ -9804,13 +9804,13 @@ async function fetchNodesByIds(backend, graphId, nodeKind, ids) {
9804
9804
  const rows = await backend.getNodes(graphId, nodeKind, ids);
9805
9805
  for (const row of rows) {
9806
9806
  if (row.deleted_at !== void 0) continue;
9807
- map.set(row.id, chunkWJT7OU7E_cjs.rowToNode(row));
9807
+ map.set(row.id, chunk4CAXEB2F_cjs.rowToNode(row));
9808
9808
  }
9809
9809
  return map;
9810
9810
  }
9811
9811
  for (const id of ids) {
9812
9812
  const row = await backend.getNode(graphId, nodeKind, id);
9813
- if (row && row.deleted_at === void 0) map.set(row.id, chunkWJT7OU7E_cjs.rowToNode(row));
9813
+ if (row && row.deleted_at === void 0) map.set(row.id, chunk4CAXEB2F_cjs.rowToNode(row));
9814
9814
  }
9815
9815
  return map;
9816
9816
  }
@@ -9912,7 +9912,7 @@ var StoreSearch = class {
9912
9912
  }
9913
9913
  #assertKindRegistered(kind) {
9914
9914
  if (this.#context.registry.hasNodeType(kind)) return;
9915
- throw new chunkLGEALRC6_cjs.KindNotFoundError(kind, "node", {
9915
+ throw new chunkDIK74MXX_cjs.KindNotFoundError(kind, "node", {
9916
9916
  graphId: this.#context.graphId,
9917
9917
  suggestion: "Compile-time kinds come from defineGraph; extension kinds appear after store.evolve() returns. Check store.introspect() for the registered set."
9918
9918
  });
@@ -9986,7 +9986,7 @@ function buildIncompatibleChangeError(classification, nonEmpty, graphId) {
9986
9986
  }
9987
9987
  const all = [...classification.incompatible, ...promoted];
9988
9988
  if (all.length === 0) return void 0;
9989
- return new chunkFL472AMI_cjs.IncompatibleChangeError(all, graphId);
9989
+ return new chunkJ3LEGNQB_cjs.IncompatibleChangeError(all, graphId);
9990
9990
  }
9991
9991
  function classifyNode(kind, existing, next, recorders) {
9992
9992
  classifyProperties(kind, existing.properties, next.properties, recorders);
@@ -10286,7 +10286,7 @@ function planRemovals(graph, names) {
10286
10286
  if (namesSet.size === 0) {
10287
10287
  return { document, removedNodeKinds: [], removedEdgeKinds: [] };
10288
10288
  }
10289
- const { nodes: runtimeNodeNames, edges: runtimeEdgeNames } = chunkCK5BVQOW_cjs.extensionKindNames(document);
10289
+ const { nodes: runtimeNodeNames, edges: runtimeEdgeNames } = chunkPWGX5DF5_cjs.extensionKindNames(document);
10290
10290
  const compileTimeNodeNames = new Set(
10291
10291
  Object.keys(graph.nodes).filter((name) => !runtimeNodeNames.has(name))
10292
10292
  );
@@ -10295,10 +10295,10 @@ function planRemovals(graph, names) {
10295
10295
  );
10296
10296
  for (const name of namesSet) {
10297
10297
  if (compileTimeNodeNames.has(name)) {
10298
- throw new chunkFL472AMI_cjs.RemoveCompileTimeKindError(name, "node", graph.id);
10298
+ throw new chunkJ3LEGNQB_cjs.RemoveCompileTimeKindError(name, "node", graph.id);
10299
10299
  }
10300
10300
  if (compileTimeEdgeNames.has(name)) {
10301
- throw new chunkFL472AMI_cjs.RemoveCompileTimeKindError(name, "edge", graph.id);
10301
+ throw new chunkJ3LEGNQB_cjs.RemoveCompileTimeKindError(name, "edge", graph.id);
10302
10302
  }
10303
10303
  }
10304
10304
  const removedNodeKinds = [...namesSet].filter(
@@ -10314,7 +10314,7 @@ function planRemovals(graph, names) {
10314
10314
  for (const kindName of removedNodeKinds) {
10315
10315
  const referents = referentsByKind.get(kindName);
10316
10316
  if (referents !== void 0 && referents.length > 0) {
10317
- throw new chunkFL472AMI_cjs.KindHasReferentsError(kindName, referents, graph.id);
10317
+ throw new chunkJ3LEGNQB_cjs.KindHasReferentsError(kindName, referents, graph.id);
10318
10318
  }
10319
10319
  }
10320
10320
  if (document === void 0) {
@@ -10386,8 +10386,8 @@ function planRemovals(graph, names) {
10386
10386
  function stripGraphExtension(graph) {
10387
10387
  const document = graph.extension;
10388
10388
  if (document === void 0) return graph;
10389
- const { nodes: runtimeNodeNames, edges: runtimeEdgeNames } = chunkCK5BVQOW_cjs.extensionKindNames(document);
10390
- const runtimeOntologyKeys = chunkCK5BVQOW_cjs.buildGraphExtensionOntologyKeySet(document);
10389
+ const { nodes: runtimeNodeNames, edges: runtimeEdgeNames } = chunkPWGX5DF5_cjs.extensionKindNames(document);
10390
+ const runtimeOntologyKeys = chunkPWGX5DF5_cjs.buildGraphExtensionOntologyKeySet(document);
10391
10391
  const compileNodes = {};
10392
10392
  for (const [name, registration] of Object.entries(graph.nodes)) {
10393
10393
  if (runtimeNodeNames.has(name)) continue;
@@ -10399,7 +10399,7 @@ function stripGraphExtension(graph) {
10399
10399
  compileEdges[name] = registration;
10400
10400
  }
10401
10401
  const compileOntology = graph.ontology.filter(
10402
- (relation) => !runtimeOntologyKeys.has(chunkCK5BVQOW_cjs.compileTimeOntologyKey(relation))
10402
+ (relation) => !runtimeOntologyKeys.has(chunkPWGX5DF5_cjs.compileTimeOntologyKey(relation))
10403
10403
  );
10404
10404
  const compileIndexes = (graph.indexes ?? []).filter(
10405
10405
  (index) => index.origin !== "runtime"
@@ -10439,13 +10439,13 @@ function buildCompileTimeReferentIndex(graph, runtimeEdgeNames) {
10439
10439
  append(endpoint.kind, referent);
10440
10440
  }
10441
10441
  }
10442
- const runtimeOntologyKeys = chunkCK5BVQOW_cjs.buildGraphExtensionOntologyKeySet(
10442
+ const runtimeOntologyKeys = chunkPWGX5DF5_cjs.buildGraphExtensionOntologyKeySet(
10443
10443
  graph.extension
10444
10444
  );
10445
10445
  for (const relation of graph.ontology) {
10446
- if (runtimeOntologyKeys.has(chunkCK5BVQOW_cjs.compileTimeOntologyKey(relation))) continue;
10447
- const fromName = chunkCK5BVQOW_cjs.getTypeName(relation.from);
10448
- const toName = chunkCK5BVQOW_cjs.getTypeName(relation.to);
10446
+ if (runtimeOntologyKeys.has(chunkPWGX5DF5_cjs.compileTimeOntologyKey(relation))) continue;
10447
+ const fromName = chunkPWGX5DF5_cjs.getTypeName(relation.from);
10448
+ const toName = chunkPWGX5DF5_cjs.getTypeName(relation.to);
10449
10449
  const referent = {
10450
10450
  type: "compile-time-ontology",
10451
10451
  name: `${relation.metaEdge.name}(${fromName}, ${toName})`
@@ -10460,12 +10460,12 @@ function buildCompileTimeReferentIndex(graph, runtimeEdgeNames) {
10460
10460
  var DEFAULT_ALGORITHM_MAX_HOPS = 10;
10461
10461
  var DEFAULT_NEIGHBOR_DEPTH = 1;
10462
10462
  function resolveTemporalOptions(ctx, options) {
10463
- const { valid } = chunkXOX22WHL_cjs.resolveReadCoordinate(
10463
+ const { valid } = chunkZUNQ5BEP_cjs.resolveReadCoordinate(
10464
10464
  options.temporalMode ?? ctx.defaultTemporalMode,
10465
10465
  options.asOf
10466
10466
  );
10467
10467
  if (options.recordedAsOf !== void 0) {
10468
- chunkXOX22WHL_cjs.assertValidRecordedInstant(options.recordedAsOf, "recordedAsOf");
10468
+ chunkZUNQ5BEP_cjs.assertValidRecordedInstant(options.recordedAsOf, "recordedAsOf");
10469
10469
  }
10470
10470
  return {
10471
10471
  temporalMode: valid.mode,
@@ -10474,7 +10474,7 @@ function resolveTemporalOptions(ctx, options) {
10474
10474
  };
10475
10475
  }
10476
10476
  function resolveReadSchema(ctx, options) {
10477
- return chunkXOX22WHL_cjs.recordedReadSchemaFor(
10477
+ return chunkZUNQ5BEP_cjs.recordedReadSchemaFor(
10478
10478
  ctx.schema,
10479
10479
  options.recordedAsOf,
10480
10480
  ctx.recordedReadBinding,
@@ -10488,26 +10488,26 @@ function resolveTemporalFilter(ctx, options, tableAlias) {
10488
10488
  asOf: resolved.asOf,
10489
10489
  recordedAsOf: resolved.recordedAsOf,
10490
10490
  tableAlias,
10491
- currentTimestamp: chunk4TOD4LBZ_cjs.currentReadInstant()
10491
+ currentTimestamp: chunkX4JBT642_cjs.currentReadInstant()
10492
10492
  };
10493
- return chunk4TOD4LBZ_cjs.compileTemporalFilter(filterOptions);
10493
+ return chunkX4JBT642_cjs.compileTemporalFilter(filterOptions);
10494
10494
  }
10495
10495
  function resolveMaxHops(rawMaxHops, fallback, optionName) {
10496
10496
  const value = rawMaxHops ?? fallback;
10497
10497
  if (!Number.isFinite(value) || !Number.isInteger(value)) {
10498
- throw new chunkLGEALRC6_cjs.ConfigurationError(
10498
+ throw new chunkDIK74MXX_cjs.ConfigurationError(
10499
10499
  `Graph algorithm ${optionName} must be a finite integer, got ${String(value)}.`,
10500
10500
  { option: optionName, value }
10501
10501
  );
10502
10502
  }
10503
10503
  if (value < 1) {
10504
- throw new chunkLGEALRC6_cjs.ConfigurationError(
10504
+ throw new chunkDIK74MXX_cjs.ConfigurationError(
10505
10505
  `Graph algorithm ${optionName} must be at least 1, got ${value}.`,
10506
10506
  { option: optionName, value }
10507
10507
  );
10508
10508
  }
10509
10509
  if (value > MAX_EXPLICIT_RECURSIVE_DEPTH) {
10510
- throw new chunkLGEALRC6_cjs.ConfigurationError(
10510
+ throw new chunkDIK74MXX_cjs.ConfigurationError(
10511
10511
  `Graph algorithm ${optionName} (${value}) exceeds the maximum of ${MAX_EXPLICIT_RECURSIVE_DEPTH}.`,
10512
10512
  { option: optionName, value, limit: MAX_EXPLICIT_RECURSIVE_DEPTH }
10513
10513
  );
@@ -10516,7 +10516,7 @@ function resolveMaxHops(rawMaxHops, fallback, optionName) {
10516
10516
  }
10517
10517
  function assertEdgeKinds(edges) {
10518
10518
  if (edges.length === 0) {
10519
- throw new chunkLGEALRC6_cjs.ConfigurationError(
10519
+ throw new chunkDIK74MXX_cjs.ConfigurationError(
10520
10520
  `Graph algorithms require at least one edge kind in 'edges'.`,
10521
10521
  { edges }
10522
10522
  );
@@ -10535,7 +10535,7 @@ async function executeDegree(ctx, nodeId, options = {}) {
10535
10535
  compileDirectionFilter(ctx, direction, nodeId, schema.nodesTable)
10536
10536
  ];
10537
10537
  if (options.edges !== void 0) {
10538
- whereClauses.push(chunk4TOD4LBZ_cjs.compileKindFilter(drizzleOrm.sql.raw("kind"), options.edges));
10538
+ whereClauses.push(chunkX4JBT642_cjs.compileKindFilter(drizzleOrm.sql.raw("kind"), options.edges));
10539
10539
  }
10540
10540
  const countExpr = direction === "both" ? drizzleOrm.sql`COUNT(DISTINCT id)` : drizzleOrm.sql`COUNT(*)`;
10541
10541
  const query = drizzleOrm.sql`SELECT ${countExpr} AS count FROM ${schema.edgesTable} WHERE ${drizzleOrm.sql.join(whereClauses, drizzleOrm.sql` AND `)}`;
@@ -10717,7 +10717,7 @@ function createGraphAlgorithms(params) {
10717
10717
  registry: params.registry,
10718
10718
  backend: params.backend,
10719
10719
  dialect: chunkD7ZEOS56_cjs.getDialect(params.backend.dialect),
10720
- schema: params.schema ?? chunkXOX22WHL_cjs.createSqlSchema(params.backend.tableNames),
10720
+ schema: params.schema ?? chunkZUNQ5BEP_cjs.createSqlSchema(params.backend.tableNames),
10721
10721
  recordedReadBinding: params.recordedReadBinding,
10722
10722
  defaultTemporalMode: params.defaultTemporalMode
10723
10723
  };
@@ -10854,7 +10854,7 @@ function createEdgeCollection(config) {
10854
10854
  },
10855
10855
  async getByIds(ids, options) {
10856
10856
  if (ids.length === 0) return [];
10857
- const rowsById = await chunkXOX22WHL_cjs.getEdgeRowsByIds(backend, graphId, ids);
10857
+ const rowsById = await chunkZUNQ5BEP_cjs.getEdgeRowsByIds(backend, graphId, ids);
10858
10858
  const matches = temporalRowMatcher(options);
10859
10859
  return ids.map((id) => {
10860
10860
  const row = rowsById.get(id);
@@ -10908,7 +10908,7 @@ function createEdgeCollection(config) {
10908
10908
  async find(filter, temporal) {
10909
10909
  const untypedFilter = filter;
10910
10910
  if (untypedFilter?.where !== void 0) {
10911
- throw new chunkLGEALRC6_cjs.UnsupportedPredicateError(
10911
+ throw new chunkDIK74MXX_cjs.UnsupportedPredicateError(
10912
10912
  `store.edges.${kind}.find({ where }) is not supported. Use store.query().traverse(...).whereEdge(...) for edge property filters.`,
10913
10913
  { kind, operation: "find" }
10914
10914
  );
@@ -10956,33 +10956,71 @@ function createEdgeCollection(config) {
10956
10956
  if (items.length === 0) return [];
10957
10957
  const upsertAll = async (target) => {
10958
10958
  const ids = items.map((item) => item.id);
10959
- const existingMap = await chunkXOX22WHL_cjs.getEdgeRowsByIds(target, graphId, ids);
10959
+ const existingMap = await chunkZUNQ5BEP_cjs.getEdgeRowsByIds(target, graphId, ids);
10960
+ const results2 = Array.from({ length: items.length });
10960
10961
  const toCreate = [];
10961
10962
  const toUpdate = [];
10963
+ const pending = /* @__PURE__ */ new Map();
10964
+ const deferred = [];
10962
10965
  let itemIndex = 0;
10963
10966
  for (const item of items) {
10964
- const existing = existingMap.get(item.id);
10965
- if (existing) {
10966
- toUpdate.push({
10967
- index: itemIndex,
10968
- input: buildUpdateEdgeInput(item.id, item.props ?? {}, item),
10969
- clearDeleted: existing.deleted_at !== void 0
10970
- });
10971
- } else {
10967
+ const pendingEntry = pending.get(item.id);
10968
+ const original = existingMap.get(item.id);
10969
+ const inputProps = item.props ?? {};
10970
+ if (pendingEntry === void 0 && original === void 0) {
10972
10971
  toCreate.push({
10973
10972
  index: itemIndex,
10974
10973
  input: buildCreateEdgeInput(
10975
10974
  kind,
10976
10975
  item.from,
10977
10976
  item.to,
10978
- item.props ?? {},
10977
+ inputProps,
10979
10978
  item
10980
10979
  )
10981
10980
  });
10981
+ itemIndex++;
10982
+ continue;
10983
+ }
10984
+ const deletedAt = pendingEntry === void 0 ? original.deleted_at : void 0;
10985
+ let dirty;
10986
+ if (config.upsertDirtyCheck !== void 0) {
10987
+ const currentProps = pendingEntry?.props ?? chunkX4JBT642_cjs.rowPropsToObject(original.props);
10988
+ try {
10989
+ dirty = config.upsertDirtyCheck(
10990
+ original?.kind ?? kind,
10991
+ item.id,
10992
+ currentProps,
10993
+ inputProps
10994
+ );
10995
+ } catch {
10996
+ dirty = void 0;
10997
+ }
10998
+ }
10999
+ const coalesce = dirty?.unchanged === true && deletedAt === void 0 && item.validFrom === void 0 && item.validTo === void 0;
11000
+ if (coalesce) {
11001
+ if (pendingEntry === void 0) {
11002
+ results2[itemIndex] = narrowEdge(rowToEdge2(original));
11003
+ } else {
11004
+ deferred.push({
11005
+ index: itemIndex,
11006
+ sourceIndex: pendingEntry.sourceIndex
11007
+ });
11008
+ }
11009
+ } else {
11010
+ toUpdate.push({
11011
+ index: itemIndex,
11012
+ input: buildUpdateEdgeInput(item.id, inputProps, item),
11013
+ clearDeleted: deletedAt !== void 0
11014
+ });
11015
+ if (dirty !== void 0) {
11016
+ pending.set(item.id, {
11017
+ props: dirty.validatedProps,
11018
+ sourceIndex: itemIndex
11019
+ });
11020
+ }
10982
11021
  }
10983
11022
  itemIndex++;
10984
11023
  }
10985
- const results2 = Array.from({ length: items.length });
10986
11024
  if (toCreate.length > 0) {
10987
11025
  const createInputs = toCreate.map((entry2) => entry2.input);
10988
11026
  const created = await executeEdgeCreateBatch2(createInputs, target);
@@ -10996,10 +11034,13 @@ function createEdgeCollection(config) {
10996
11034
  });
10997
11035
  results2[entry2.index] = narrowEdge(result);
10998
11036
  }
10999
- return results2;
11037
+ for (const { index, sourceIndex } of deferred) {
11038
+ results2[index] = results2[sourceIndex];
11039
+ }
11040
+ return { results: results2, mutations: toCreate.length + toUpdate.length };
11000
11041
  };
11001
- const results = backend.capabilities.transactions && "transaction" in backend ? await backend.transaction(async (txBackend) => upsertAll(txBackend)) : await upsertAll(backend);
11002
- await config.maybeRefreshStatisticsAfterBulk?.(results.length);
11042
+ const { results, mutations } = backend.capabilities.transactions && "transaction" in backend ? await backend.transaction(async (txBackend) => upsertAll(txBackend)) : await upsertAll(backend);
11043
+ await config.maybeRefreshStatisticsAfterBulk?.(mutations);
11003
11044
  return results;
11004
11045
  },
11005
11046
  async bulkInsert(items) {
@@ -11093,6 +11134,18 @@ function createEdgeCollection(config) {
11093
11134
  };
11094
11135
  }
11095
11136
 
11137
+ // src/store/collections/coalesce.ts
11138
+ function shouldCoalesceUpsert(existing, options, runDirtyCheck) {
11139
+ if (runDirtyCheck === void 0 || existing.deleted_at !== void 0 || options?.validFrom !== void 0 || options?.validTo !== void 0) {
11140
+ return false;
11141
+ }
11142
+ try {
11143
+ return runDirtyCheck().unchanged;
11144
+ } catch {
11145
+ return false;
11146
+ }
11147
+ }
11148
+
11096
11149
  // src/store/collections/node-collection.ts
11097
11150
  function narrowNode(node) {
11098
11151
  return node;
@@ -11156,7 +11209,7 @@ function createNodeCollection(config) {
11156
11209
  },
11157
11210
  async getByIds(ids, options) {
11158
11211
  if (ids.length === 0) return [];
11159
- const rowsById = await chunkXOX22WHL_cjs.getNodeRowsByIds(backend, graphId, kind, ids);
11212
+ const rowsById = await chunkZUNQ5BEP_cjs.getNodeRowsByIds(backend, graphId, kind, ids);
11160
11213
  const matches = temporalRowMatcher(options);
11161
11214
  return ids.map((id) => {
11162
11215
  const row = rowsById.get(id);
@@ -11180,7 +11233,7 @@ function createNodeCollection(config) {
11180
11233
  },
11181
11234
  async find(filter, temporal) {
11182
11235
  if (filter?.where !== void 0 && createQuery === void 0) {
11183
- throw new chunkLGEALRC6_cjs.ConfigurationError(
11236
+ throw new chunkDIK74MXX_cjs.ConfigurationError(
11184
11237
  `store.nodes.${kind}.find({ where }) requires a query-capable store`,
11185
11238
  { kind, operation: "find" }
11186
11239
  );
@@ -11220,11 +11273,19 @@ function createNodeCollection(config) {
11220
11273
  async upsertByIdFromRecord(id, data, options) {
11221
11274
  const existing = await backend.getNode(graphId, kind, id);
11222
11275
  if (existing) {
11223
- const clearDeleted = existing.deleted_at !== void 0;
11276
+ const runDirtyCheck = config.upsertDirtyCheck && (() => config.upsertDirtyCheck(
11277
+ kind,
11278
+ id,
11279
+ chunkX4JBT642_cjs.rowPropsToObject(existing.props),
11280
+ data
11281
+ ));
11282
+ if (shouldCoalesceUpsert(existing, options, runDirtyCheck)) {
11283
+ return narrowNode(rowToNode2(existing));
11284
+ }
11224
11285
  const result2 = await executeNodeUpdate2(
11225
11286
  buildUpdateInput(kind, id, data, options),
11226
11287
  backend,
11227
- { clearDeleted }
11288
+ { clearDeleted: existing.deleted_at !== void 0 }
11228
11289
  );
11229
11290
  return narrowNode(result2);
11230
11291
  }
@@ -11265,26 +11326,63 @@ function createNodeCollection(config) {
11265
11326
  existingMap.set(row.id, row);
11266
11327
  }
11267
11328
  }
11329
+ const results2 = Array.from({ length: items.length });
11268
11330
  const toCreate = [];
11269
11331
  const toUpdate = [];
11332
+ const pending = /* @__PURE__ */ new Map();
11333
+ const deferred = [];
11270
11334
  let itemIndex = 0;
11271
11335
  for (const item of items) {
11272
- const existing = existingMap.get(item.id);
11273
- if (existing) {
11274
- toUpdate.push({
11336
+ const pendingEntry = pending.get(item.id);
11337
+ const original = existingMap.get(item.id);
11338
+ if (pendingEntry === void 0 && original === void 0) {
11339
+ toCreate.push({
11275
11340
  index: itemIndex,
11276
- input: buildUpdateInput(kind, item.id, item.props, item),
11277
- clearDeleted: existing.deleted_at !== void 0
11341
+ input: buildCreateInput(kind, item.props, item)
11278
11342
  });
11343
+ itemIndex++;
11344
+ continue;
11345
+ }
11346
+ const deletedAt = pendingEntry === void 0 ? original.deleted_at : void 0;
11347
+ let dirty;
11348
+ if (config.upsertDirtyCheck !== void 0) {
11349
+ const currentProps = pendingEntry?.props ?? chunkX4JBT642_cjs.rowPropsToObject(original.props);
11350
+ try {
11351
+ dirty = config.upsertDirtyCheck(
11352
+ kind,
11353
+ item.id,
11354
+ currentProps,
11355
+ item.props
11356
+ );
11357
+ } catch {
11358
+ dirty = void 0;
11359
+ }
11360
+ }
11361
+ const coalesce = dirty?.unchanged === true && deletedAt === void 0 && item.validFrom === void 0 && item.validTo === void 0;
11362
+ if (coalesce) {
11363
+ if (pendingEntry === void 0) {
11364
+ results2[itemIndex] = narrowNode(rowToNode2(original));
11365
+ } else {
11366
+ deferred.push({
11367
+ index: itemIndex,
11368
+ sourceIndex: pendingEntry.sourceIndex
11369
+ });
11370
+ }
11279
11371
  } else {
11280
- toCreate.push({
11372
+ toUpdate.push({
11281
11373
  index: itemIndex,
11282
- input: buildCreateInput(kind, item.props, item)
11374
+ input: buildUpdateInput(kind, item.id, item.props, item),
11375
+ clearDeleted: deletedAt !== void 0
11283
11376
  });
11377
+ if (dirty !== void 0) {
11378
+ pending.set(item.id, {
11379
+ props: dirty.validatedProps,
11380
+ sourceIndex: itemIndex
11381
+ });
11382
+ }
11284
11383
  }
11285
11384
  itemIndex++;
11286
11385
  }
11287
- const results2 = Array.from({ length: items.length });
11288
11386
  if (toCreate.length > 0) {
11289
11387
  const createInputs = toCreate.map((entry2) => entry2.input);
11290
11388
  const created = await executeNodeCreateBatch2(createInputs, target);
@@ -11298,10 +11396,13 @@ function createNodeCollection(config) {
11298
11396
  });
11299
11397
  results2[entry2.index] = narrowNode(result);
11300
11398
  }
11301
- return results2;
11399
+ for (const { index, sourceIndex } of deferred) {
11400
+ results2[index] = results2[sourceIndex];
11401
+ }
11402
+ return { results: results2, mutations: toCreate.length + toUpdate.length };
11302
11403
  };
11303
- const results = backend.capabilities.transactions && "transaction" in backend ? await backend.transaction(async (txBackend) => upsertAll(txBackend)) : await upsertAll(backend);
11304
- await config.maybeRefreshStatisticsAfterBulk?.(results.length);
11404
+ const { results, mutations } = backend.capabilities.transactions && "transaction" in backend ? await backend.transaction(async (txBackend) => upsertAll(txBackend)) : await upsertAll(backend);
11405
+ await config.maybeRefreshStatisticsAfterBulk?.(mutations);
11305
11406
  return results;
11306
11407
  },
11307
11408
  async bulkInsert(items) {
@@ -11408,7 +11509,7 @@ function createNodeCollectionsProxy(graph, graphId, registry, backend, operation
11408
11509
  return new Proxy({}, {
11409
11510
  get: (_, kind) => {
11410
11511
  if (!Object.hasOwn(graph.nodes, kind)) {
11411
- throw new chunkLGEALRC6_cjs.KindNotFoundError(kind, "node");
11512
+ throw new chunkDIK74MXX_cjs.KindNotFoundError(kind, "node");
11412
11513
  }
11413
11514
  const cached = collectionCache.get(kind);
11414
11515
  if (cached !== void 0) {
@@ -11430,7 +11531,7 @@ function createEdgeCollectionsProxy(graph, graphId, registry, backend, operation
11430
11531
  return new Proxy({}, {
11431
11532
  get: (_, kind) => {
11432
11533
  if (!Object.hasOwn(graph.edges, kind)) {
11433
- throw new chunkLGEALRC6_cjs.KindNotFoundError(kind, "edge");
11534
+ throw new chunkDIK74MXX_cjs.KindNotFoundError(kind, "edge");
11434
11535
  }
11435
11536
  const cached = collectionCache.get(kind);
11436
11537
  if (cached !== void 0) {
@@ -11451,7 +11552,7 @@ function createEdgeCollectionsProxy(graph, graphId, registry, backend, operation
11451
11552
  // src/store/introspect.ts
11452
11553
  function introspectSchema(graph, context) {
11453
11554
  const extension = graph.extension;
11454
- const { nodes: runtimeNodeNames, edges: runtimeEdgeNames } = chunkCK5BVQOW_cjs.extensionKindNames(extension);
11555
+ const { nodes: runtimeNodeNames, edges: runtimeEdgeNames } = chunkPWGX5DF5_cjs.extensionKindNames(extension);
11455
11556
  const deprecated = graph.deprecatedKinds;
11456
11557
  const kinds = [];
11457
11558
  for (const [name, registration] of Object.entries(graph.nodes)) {
@@ -11462,7 +11563,7 @@ function introspectSchema(graph, context) {
11462
11563
  description: reg.type.description,
11463
11564
  annotations: reg.type.annotations,
11464
11565
  deprecated: deprecated.has(name),
11465
- properties: chunkCK5BVQOW_cjs.serializeSchemaProperties(reg.type.schema),
11566
+ properties: chunkPWGX5DF5_cjs.serializeSchemaProperties(reg.type.schema),
11466
11567
  unique: (reg.unique ?? []).map((constraint) => ({
11467
11568
  name: constraint.name,
11468
11569
  fields: [...constraint.fields],
@@ -11483,17 +11584,17 @@ function introspectSchema(graph, context) {
11483
11584
  to: reg.to.map((entry2) => entry2.kind),
11484
11585
  cardinality: reg.cardinality ?? "many",
11485
11586
  endpointExistence: reg.endpointExistence ?? "notDeleted",
11486
- properties: chunkCK5BVQOW_cjs.serializeSchemaProperties(edgeType.schema),
11587
+ properties: chunkPWGX5DF5_cjs.serializeSchemaProperties(edgeType.schema),
11487
11588
  annotations: edgeType.annotations,
11488
11589
  deprecated: deprecated.has(name)
11489
11590
  });
11490
11591
  }
11491
- const runtimeOntologyKeys = chunkCK5BVQOW_cjs.buildGraphExtensionOntologyKeySet(extension);
11592
+ const runtimeOntologyKeys = chunkPWGX5DF5_cjs.buildGraphExtensionOntologyKeySet(extension);
11492
11593
  const ontology = graph.ontology.map((relation) => ({
11493
11594
  metaEdge: relation.metaEdge.name,
11494
- from: chunkCK5BVQOW_cjs.getTypeName(relation.from),
11495
- to: chunkCK5BVQOW_cjs.getTypeName(relation.to),
11496
- origin: runtimeOntologyKeys.has(chunkCK5BVQOW_cjs.compileTimeOntologyKey(relation)) ? "runtime" : "compile-time"
11595
+ from: chunkPWGX5DF5_cjs.getTypeName(relation.from),
11596
+ to: chunkPWGX5DF5_cjs.getTypeName(relation.to),
11597
+ origin: runtimeOntologyKeys.has(chunkPWGX5DF5_cjs.compileTimeOntologyKey(relation)) ? "runtime" : "compile-time"
11497
11598
  }));
11498
11599
  return {
11499
11600
  graphId: context.graphId,
@@ -11543,13 +11644,13 @@ function delay(ms) {
11543
11644
  async function materializeIndexes(context, options = {}) {
11544
11645
  const { graph, graphId, backend, schemaVersion } = context;
11545
11646
  if (backend.executeDdl === void 0) {
11546
- throw new chunkLGEALRC6_cjs.ConfigurationError(
11647
+ throw new chunkDIK74MXX_cjs.ConfigurationError(
11547
11648
  "store.materializeIndexes() requires a backend with `executeDdl` support. The bundled SQLite and Postgres backends provide it; a custom backend without `executeDdl` cannot run index DDL.",
11548
11649
  { code: "MATERIALIZE_BACKEND_UNSUPPORTED" }
11549
11650
  );
11550
11651
  }
11551
11652
  if (backend.getIndexMaterialization === void 0 || backend.recordIndexMaterialization === void 0) {
11552
- throw new chunkLGEALRC6_cjs.ConfigurationError(
11653
+ throw new chunkDIK74MXX_cjs.ConfigurationError(
11553
11654
  "store.materializeIndexes() requires a backend with index materialization status primitives. The bundled SQLite and Postgres backends provide them; a custom backend must implement `getIndexMaterialization` and `recordIndexMaterialization`.",
11554
11655
  { code: "MATERIALIZE_BACKEND_UNSUPPORTED" }
11555
11656
  );
@@ -11558,8 +11659,8 @@ async function materializeIndexes(context, options = {}) {
11558
11659
  const kindFilter = options.kinds === void 0 ? void 0 : new Set(options.kinds);
11559
11660
  if (kindFilter !== void 0) {
11560
11661
  for (const name of kindFilter) {
11561
- if (!chunkVPYHY3LJ_cjs.isKnownKind(graph, name)) {
11562
- throw new chunkLGEALRC6_cjs.KindNotFoundError(
11662
+ if (!chunk2THZ3TQI_cjs.isKnownKind(graph, name)) {
11663
+ throw new chunkDIK74MXX_cjs.KindNotFoundError(
11563
11664
  name,
11564
11665
  Object.hasOwn(graph.edges, name) ? "edge" : "node",
11565
11666
  {
@@ -11804,7 +11905,7 @@ async function materializeOne(declaration, backend, graphId, schemaVersion, acti
11804
11905
  }
11805
11906
  try {
11806
11907
  await run();
11807
- const attemptedAt = chunkBLZDPRXT_cjs.nowIso();
11908
+ const attemptedAt = chunkRSSQKPSZ_cjs.nowIso();
11808
11909
  await recordIndexMaterialization(
11809
11910
  buildAttempt({
11810
11911
  declaration,
@@ -11863,7 +11964,7 @@ async function materializeWithClaim(declaration, backend, graphId, schemaVersion
11863
11964
  const { statusKey, signature, driftLabel, run } = action;
11864
11965
  const statusOverride = statusKey === declaration.name ? void 0 : { statusName: statusKey };
11865
11966
  const recordIndexMaterialization = backend.recordIndexMaterialization;
11866
- const token = `${statusKey}:${chunkBLZDPRXT_cjs.nowIso()}:${Math.floor(performance.now() * 1e3)}`;
11967
+ const token = `${statusKey}:${chunkRSSQKPSZ_cjs.nowIso()}:${Math.floor(performance.now() * 1e3)}`;
11867
11968
  const deadline = Date.now() + CLAIM_WAIT_TIMEOUT_MS;
11868
11969
  for (; ; ) {
11869
11970
  const claimed = await backend.claimIndexMaterialization({
@@ -11912,7 +12013,7 @@ async function materializeWithClaim(declaration, backend, graphId, schemaVersion
11912
12013
  }
11913
12014
  try {
11914
12015
  await run();
11915
- const attemptedAt = chunkBLZDPRXT_cjs.nowIso();
12016
+ const attemptedAt = chunkRSSQKPSZ_cjs.nowIso();
11916
12017
  await recordIndexMaterialization(
11917
12018
  buildAttempt({
11918
12019
  declaration,
@@ -11977,7 +12078,7 @@ async function preloadInvalidIndexLeftovers(backend, physicalIndexNames) {
11977
12078
  SELECT c.relname AS name
11978
12079
  FROM pg_class c
11979
12080
  JOIN pg_index i ON i.indexrelid = c.oid
11980
- WHERE c.relname IN (${chunk4TOD4LBZ_cjs.sqlValueList(physicalIndexNames)})
12081
+ WHERE c.relname IN (${chunkX4JBT642_cjs.sqlValueList(physicalIndexNames)})
11981
12082
  AND NOT i.indisvalid
11982
12083
  `)
11983
12084
  );
@@ -12036,7 +12137,7 @@ function buildAttempt(args) {
12036
12137
  kind: args.declaration.kind,
12037
12138
  signature: args.signature,
12038
12139
  schemaVersion: args.schemaVersion,
12039
- attemptedAt: args.attemptedAt ?? chunkBLZDPRXT_cjs.nowIso(),
12140
+ attemptedAt: args.attemptedAt ?? chunkRSSQKPSZ_cjs.nowIso(),
12040
12141
  materializedAt: args.materializedAt,
12041
12142
  error: args.error?.message
12042
12143
  };
@@ -12045,7 +12146,7 @@ async function computeIndexSignature(dialect, targetTableName, declaration) {
12045
12146
  const hashable = {
12046
12147
  dialect,
12047
12148
  targetTableName,
12048
- declaration: chunkCK5BVQOW_cjs.serializeIndexDeclaration(declaration)
12149
+ declaration: chunkPWGX5DF5_cjs.serializeIndexDeclaration(declaration)
12049
12150
  };
12050
12151
  const json = JSON.stringify(hashable, chunkACSVZPK7_cjs.sortedReplacer);
12051
12152
  return chunkTEDRJXOG_cjs.sha256Hex(json, 16);
@@ -12057,7 +12158,7 @@ function buildPendingKindRemoval(args) {
12057
12158
  async function materializeRemovals(context, options = {}) {
12058
12159
  const { backend, graphId } = context;
12059
12160
  if (backend.executeDdl === void 0 || backend.recordKindRemoval === void 0 || backend.getPendingKindRemovals === void 0) {
12060
- throw new chunkLGEALRC6_cjs.ConfigurationError(
12161
+ throw new chunkDIK74MXX_cjs.ConfigurationError(
12061
12162
  "store.materializeRemovals() requires a backend with kind-removal primitives (executeDdl, recordKindRemoval, getPendingKindRemovals). The bundled SQLite and Postgres backends provide them.",
12062
12163
  { code: "MATERIALIZE_REMOVALS_BACKEND_UNSUPPORTED" }
12063
12164
  );
@@ -12085,7 +12186,7 @@ async function materializeRemovals(context, options = {}) {
12085
12186
  fulltextTable,
12086
12187
  uniquesTable,
12087
12188
  captureRecordedRemovals,
12088
- recordedSchema: captureRecordedRemovals ? context.recordedSchema ?? chunkXOX22WHL_cjs.createSqlSchema(backend.tableNames) : void 0
12189
+ recordedSchema: captureRecordedRemovals ? context.recordedSchema ?? chunkZUNQ5BEP_cjs.createSqlSchema(backend.tableNames) : void 0
12089
12190
  };
12090
12191
  return {
12091
12192
  results: await runMaterialization(
@@ -12116,14 +12217,14 @@ async function reconcilePendingRemovals(context) {
12116
12217
  const reconciliations = [];
12117
12218
  const stopAtVersion = marker ?? 1;
12118
12219
  let currentRow = activeRow;
12119
- let currentSchema = chunkCK5BVQOW_cjs.parseSerializedSchema(activeRow.schema_doc);
12220
+ let currentSchema = chunkPWGX5DF5_cjs.parseSerializedSchema(activeRow.schema_doc);
12120
12221
  while (currentRow.version > stopAtVersion) {
12121
12222
  const priorRow = await backend.getSchemaVersion(
12122
12223
  graphId,
12123
12224
  currentRow.version - 1
12124
12225
  );
12125
12226
  if (priorRow === void 0) break;
12126
- const priorSchema = chunkCK5BVQOW_cjs.parseSerializedSchema(priorRow.schema_doc);
12227
+ const priorSchema = chunkPWGX5DF5_cjs.parseSerializedSchema(priorRow.schema_doc);
12127
12228
  for (const entity of ENTITY_KINDS) {
12128
12229
  const priorEntries = priorSchema[entity === "node" ? "nodes" : "edges"];
12129
12230
  const currentEntries = currentSchema[entity === "node" ? "nodes" : "edges"];
@@ -12143,7 +12244,7 @@ async function reconcilePendingRemovals(context) {
12143
12244
  currentSchema = priorSchema;
12144
12245
  }
12145
12246
  if (reconciliations.length > 0) {
12146
- const attemptedAt = chunkBLZDPRXT_cjs.nowIso();
12247
+ const attemptedAt = chunkRSSQKPSZ_cjs.nowIso();
12147
12248
  await Promise.all(
12148
12249
  reconciliations.map(
12149
12250
  (entry2) => recordKindRemoval(
@@ -12170,7 +12271,7 @@ async function materializeOne2(row, ctx) {
12170
12271
  try {
12171
12272
  await closeRecordedAndDeleteLiveRows(ctx, row);
12172
12273
  await Promise.all(buildEmbeddingTableCleanup(ctx, row));
12173
- const removedAt = chunkBLZDPRXT_cjs.nowIso();
12274
+ const removedAt = chunkRSSQKPSZ_cjs.nowIso();
12174
12275
  await recordKindRemoval({
12175
12276
  graphId: ctx.graphId,
12176
12277
  kindName: row.kindName,
@@ -12192,7 +12293,7 @@ async function materializeOne2(row, ctx) {
12192
12293
  kindName: row.kindName,
12193
12294
  entity: row.entity,
12194
12295
  schemaVersion: row.schemaVersion,
12195
- attemptedAt: chunkBLZDPRXT_cjs.nowIso(),
12296
+ attemptedAt: chunkRSSQKPSZ_cjs.nowIso(),
12196
12297
  removedAt: void 0,
12197
12298
  error: error.message
12198
12299
  });
@@ -12213,7 +12314,7 @@ async function closeRecordedAndDeleteLiveRows(ctx, row) {
12213
12314
  const recordedSchema = ctx.recordedSchema;
12214
12315
  try {
12215
12316
  await ctx.backend.transaction(async (target) => {
12216
- await chunkXOX22WHL_cjs.closeRecordedHardDeletedKind(
12317
+ await chunkZUNQ5BEP_cjs.closeRecordedHardDeletedKind(
12217
12318
  target,
12218
12319
  recordedSchema,
12219
12320
  ctx.graphId,
@@ -12223,7 +12324,7 @@ async function closeRecordedAndDeleteLiveRows(ctx, row) {
12223
12324
  await executeDeleteStatements(target, deleteStatements);
12224
12325
  });
12225
12326
  } catch (error) {
12226
- if (!chunkBLZDPRXT_cjs.isMissingTableError(error)) throw error;
12327
+ if (!chunkRSSQKPSZ_cjs.isMissingTableError(error)) throw error;
12227
12328
  await executeDeleteStatements(ctx.backend, deleteStatements);
12228
12329
  }
12229
12330
  }
@@ -12252,7 +12353,7 @@ async function executeDeleteStatements(target, statements) {
12252
12353
  return;
12253
12354
  }
12254
12355
  if (target.executeDdl === void 0) {
12255
- throw new chunkLGEALRC6_cjs.ConfigurationError(
12356
+ throw new chunkDIK74MXX_cjs.ConfigurationError(
12256
12357
  "store.materializeRemovals() requires a backend that can execute cleanup statements.",
12257
12358
  { code: "MATERIALIZE_REMOVALS_BACKEND_UNSUPPORTED" }
12258
12359
  );
@@ -12281,7 +12382,7 @@ async function dropVectorSlotStorage(strategy, executeDdl, slot) {
12281
12382
  await executeDdl(ddl);
12282
12383
  }
12283
12384
  } catch (error) {
12284
- if (!chunkBLZDPRXT_cjs.isMissingTableError(error)) throw error;
12385
+ if (!chunkRSSQKPSZ_cjs.isMissingTableError(error)) throw error;
12285
12386
  }
12286
12387
  }
12287
12388
  async function resolveRemovedKindEmbeddingSlots(backend, row) {
@@ -12289,7 +12390,7 @@ async function resolveRemovedKindEmbeddingSlots(backend, row) {
12289
12390
  if (priorVersion < 1) return [];
12290
12391
  const priorRow = await backend.getSchemaVersion(row.graphId, priorVersion);
12291
12392
  if (priorRow === void 0) return [];
12292
- const priorSchema = chunkCK5BVQOW_cjs.parseSerializedSchema(priorRow.schema_doc);
12393
+ const priorSchema = chunkPWGX5DF5_cjs.parseSerializedSchema(priorRow.schema_doc);
12293
12394
  const slots = /* @__PURE__ */ new Map();
12294
12395
  for (const declaration of priorSchema.indexes ?? []) {
12295
12396
  if (declaration.entity === "vector" && declaration.kind === row.kindName) {
@@ -12319,7 +12420,7 @@ async function reclaimRemovedVectorFieldTables(context) {
12319
12420
  let perBackend = reclaimCache.get(backend);
12320
12421
  const cached = perBackend?.get(cacheKey);
12321
12422
  if (cached !== void 0) return cached;
12322
- const activeSchema = chunkCK5BVQOW_cjs.parseSerializedSchema(activeRow.schema_doc);
12423
+ const activeSchema = chunkPWGX5DF5_cjs.parseSerializedSchema(activeRow.schema_doc);
12323
12424
  const activeVectorFields = /* @__PURE__ */ new Set();
12324
12425
  for (const declaration of activeSchema.indexes ?? []) {
12325
12426
  if (declaration.entity === "vector") {
@@ -12333,7 +12434,7 @@ async function reclaimRemovedVectorFieldTables(context) {
12333
12434
  for (let version = activeRow.version - 1; version >= 1; version -= 1) {
12334
12435
  const priorRow = await backend.getSchemaVersion(graphId, version);
12335
12436
  if (priorRow === void 0) continue;
12336
- const priorSchema = chunkCK5BVQOW_cjs.parseSerializedSchema(priorRow.schema_doc);
12437
+ const priorSchema = chunkPWGX5DF5_cjs.parseSerializedSchema(priorRow.schema_doc);
12337
12438
  for (const declaration of priorSchema.indexes ?? []) {
12338
12439
  if (declaration.entity !== "vector") continue;
12339
12440
  const key = vectorFieldKey(declaration.kind, declaration.fieldPath);
@@ -12393,7 +12494,7 @@ function literal(value) {
12393
12494
  // src/store/operations/edge-operations.ts
12394
12495
  function getEdgeRegistration(graph, kind) {
12395
12496
  const registration = graph.edges[kind];
12396
- if (registration === void 0) throw new chunkLGEALRC6_cjs.KindNotFoundError(kind, "edge");
12497
+ if (registration === void 0) throw new chunkDIK74MXX_cjs.KindNotFoundError(kind, "edge");
12397
12498
  return registration;
12398
12499
  }
12399
12500
  function buildEdgeEndpointCacheKey(graphId, kind, id) {
@@ -12513,7 +12614,7 @@ function createEdgeBatchValidationBackend(backend) {
12513
12614
  pendingUniquePairs.add(uniqueCacheKey);
12514
12615
  }
12515
12616
  }
12516
- const validationBackend = chunk4TOD4LBZ_cjs.createBackendOverlay(backend, {
12617
+ const validationBackend = chunkX4JBT642_cjs.createBackendOverlay(backend, {
12517
12618
  getNode: getNodeCached,
12518
12619
  countEdgesFrom: countEdgesFromCached,
12519
12620
  edgeExistsBetween: edgeExistsBetweenCached
@@ -12530,7 +12631,7 @@ async function validateAndPrepareEdgeCreate(ctx, input, id, backend) {
12530
12631
  const toKind = input.toKind;
12531
12632
  const registration = getEdgeRegistration(ctx.graph, kind);
12532
12633
  const edgeKind = registration.type;
12533
- const endpointError = chunkXOX22WHL_cjs.validateEdgeEndpoints(
12634
+ const endpointError = chunkZUNQ5BEP_cjs.validateEdgeEndpoints(
12534
12635
  kind,
12535
12636
  fromKind,
12536
12637
  toKind,
@@ -12540,7 +12641,7 @@ async function validateAndPrepareEdgeCreate(ctx, input, id, backend) {
12540
12641
  if (endpointError) throw endpointError;
12541
12642
  const fromNode = await backend.getNode(ctx.graphId, fromKind, input.fromId);
12542
12643
  if (!fromNode || fromNode.deleted_at) {
12543
- throw new chunkLGEALRC6_cjs.EndpointNotFoundError({
12644
+ throw new chunkDIK74MXX_cjs.EndpointNotFoundError({
12544
12645
  edgeKind: kind,
12545
12646
  endpoint: "from",
12546
12647
  nodeKind: fromKind,
@@ -12549,29 +12650,29 @@ async function validateAndPrepareEdgeCreate(ctx, input, id, backend) {
12549
12650
  }
12550
12651
  const toNode = await backend.getNode(ctx.graphId, toKind, input.toId);
12551
12652
  if (!toNode || toNode.deleted_at) {
12552
- throw new chunkLGEALRC6_cjs.EndpointNotFoundError({
12653
+ throw new chunkDIK74MXX_cjs.EndpointNotFoundError({
12553
12654
  edgeKind: kind,
12554
12655
  endpoint: "to",
12555
12656
  nodeKind: toKind,
12556
12657
  nodeId: input.toId
12557
12658
  });
12558
12659
  }
12559
- const validatedProps = chunkVPYHY3LJ_cjs.validateEdgeProps(edgeKind.schema, input.props, {
12660
+ const validatedProps = chunk2THZ3TQI_cjs.validateEdgeProps(edgeKind.schema, input.props, {
12560
12661
  kind,
12561
12662
  operation: "create"
12562
12663
  });
12563
- const validFrom = chunkBLZDPRXT_cjs.validateOptionalCanonicalIsoDate(
12664
+ const validFrom = chunkRSSQKPSZ_cjs.validateOptionalCanonicalIsoDate(
12564
12665
  input.validFrom,
12565
12666
  "validFrom"
12566
12667
  );
12567
- const validTo = chunkBLZDPRXT_cjs.validateOptionalCanonicalIsoDate(input.validTo, "validTo");
12668
+ const validTo = chunkRSSQKPSZ_cjs.validateOptionalCanonicalIsoDate(input.validTo, "validTo");
12568
12669
  const cardinality = registration.cardinality ?? "many";
12569
12670
  const constraintContext = {
12570
12671
  graphId: ctx.graphId,
12571
12672
  registry: ctx.registry,
12572
12673
  backend
12573
12674
  };
12574
- await chunkWJT7OU7E_cjs.checkCardinalityConstraint(
12675
+ await chunk4CAXEB2F_cjs.checkCardinalityConstraint(
12575
12676
  constraintContext,
12576
12677
  kind,
12577
12678
  cardinality,
@@ -12599,22 +12700,22 @@ async function validateAndPrepareEdgeCreate(ctx, input, id, backend) {
12599
12700
  }
12600
12701
  async function executeEdgeCreateInternal(ctx, input, backend, options) {
12601
12702
  const kind = input.kind;
12602
- const id = input.id ?? chunkXOX22WHL_cjs.generateId();
12703
+ const id = input.id ?? chunkZUNQ5BEP_cjs.generateId();
12603
12704
  const opContext = ctx.createOperationContext("create", "edge", kind, id);
12604
- return chunkWJT7OU7E_cjs.runHookedWriteOperation(ctx, opContext, backend, async (target) => {
12705
+ return chunk4CAXEB2F_cjs.runHookedWriteOperation(ctx, opContext, backend, async (target) => {
12605
12706
  const prepared = await validateAndPrepareEdgeCreate(ctx, input, id, target);
12606
12707
  let row;
12607
12708
  {
12608
12709
  row = await target.insertEdge(prepared.insertParams);
12609
12710
  }
12610
12711
  if (row === void 0) return;
12611
- return chunkWJT7OU7E_cjs.rowToEdge(row);
12712
+ return chunk4CAXEB2F_cjs.rowToEdge(row);
12612
12713
  });
12613
12714
  }
12614
12715
  async function executeEdgeCreate(ctx, input, backend) {
12615
12716
  const result = await executeEdgeCreateInternal(ctx, input, backend);
12616
12717
  if (!result) {
12617
- throw new chunkLGEALRC6_cjs.DatabaseOperationError(
12718
+ throw new chunkDIK74MXX_cjs.DatabaseOperationError(
12618
12719
  "Edge create failed: expected created edge row",
12619
12720
  { operation: "insert", entity: "edge" }
12620
12721
  );
@@ -12651,7 +12752,7 @@ async function prepareEdgeBatchCreates(ctx, inputs, backend) {
12651
12752
  await primeEdgeBatchValidationCache(ctx, inputs, backend, seedEndpointRow);
12652
12753
  const preparedCreates = [];
12653
12754
  for (const input of inputs) {
12654
- const id = input.id ?? chunkXOX22WHL_cjs.generateId();
12755
+ const id = input.id ?? chunkZUNQ5BEP_cjs.generateId();
12655
12756
  const prepared = await validateAndPrepareEdgeCreate(
12656
12757
  ctx,
12657
12758
  input,
@@ -12673,48 +12774,72 @@ async function executeEdgeCreateNoReturnBatch(ctx, inputs, backend) {
12673
12774
  if (inputs.length === 0) {
12674
12775
  return;
12675
12776
  }
12676
- await chunkWJT7OU7E_cjs.runInWriteTransaction(ctx, backend, async (target) => {
12777
+ await chunk4CAXEB2F_cjs.runInWriteTransaction(ctx, backend, async (target) => {
12677
12778
  const { batchInsertParams } = await prepareEdgeBatchCreates(
12678
12779
  ctx,
12679
12780
  inputs,
12680
12781
  target
12681
12782
  );
12682
- await chunkXOX22WHL_cjs.runInsertBatch(chunkXOX22WHL_cjs.edgeInsertDispatch(target), batchInsertParams);
12783
+ await chunkZUNQ5BEP_cjs.runInsertBatch(chunkZUNQ5BEP_cjs.edgeInsertDispatch(target), batchInsertParams);
12683
12784
  });
12684
12785
  }
12685
12786
  async function executeEdgeCreateBatch(ctx, inputs, backend) {
12686
12787
  if (inputs.length === 0) {
12687
12788
  return [];
12688
12789
  }
12689
- return chunkWJT7OU7E_cjs.runInWriteTransaction(ctx, backend, async (target) => {
12790
+ return chunk4CAXEB2F_cjs.runInWriteTransaction(ctx, backend, async (target) => {
12690
12791
  const { batchInsertParams } = await prepareEdgeBatchCreates(
12691
12792
  ctx,
12692
12793
  inputs,
12693
12794
  target
12694
12795
  );
12695
- const rows = await chunkXOX22WHL_cjs.runInsertBatchReturning(
12696
- chunkXOX22WHL_cjs.edgeInsertDispatch(target),
12796
+ const rows = await chunkZUNQ5BEP_cjs.runInsertBatchReturning(
12797
+ chunkZUNQ5BEP_cjs.edgeInsertDispatch(target),
12697
12798
  batchInsertParams
12698
12799
  );
12699
- return rows.map((row) => chunkWJT7OU7E_cjs.rowToEdge(row));
12800
+ return rows.map((row) => chunk4CAXEB2F_cjs.rowToEdge(row));
12700
12801
  });
12701
12802
  }
12803
+ function computeEdgeUpdate(ctx, kind, id, existingProps, inputProps) {
12804
+ const registration = getEdgeRegistration(ctx.graph, kind);
12805
+ return chunk2THZ3TQI_cjs.validateEdgeProps(
12806
+ registration.type.schema,
12807
+ { ...existingProps, ...inputProps },
12808
+ { kind, operation: "update", id }
12809
+ );
12810
+ }
12811
+ function resolveEdgeUpdateProps(ctx, existing, inputProps) {
12812
+ const existingProps = chunkX4JBT642_cjs.rowPropsToObject(existing.props);
12813
+ const validatedProps = computeEdgeUpdate(
12814
+ ctx,
12815
+ existing.kind,
12816
+ existing.id,
12817
+ existingProps,
12818
+ inputProps
12819
+ );
12820
+ return { existingProps, validatedProps };
12821
+ }
12822
+ function edgeUpsertDirtyCheck(ctx, kind, id, existingProps, inputProps) {
12823
+ const validatedProps = computeEdgeUpdate(
12824
+ ctx,
12825
+ kind,
12826
+ id,
12827
+ existingProps,
12828
+ inputProps
12829
+ );
12830
+ return {
12831
+ validatedProps,
12832
+ unchanged: chunkACSVZPK7_cjs.canonicalEqual(validatedProps, existingProps)
12833
+ };
12834
+ }
12702
12835
  async function performEdgeUpdate(ctx, input, target, options) {
12703
12836
  const id = input.id;
12704
12837
  const existing = await target.getEdge(ctx.graphId, id);
12705
12838
  if (!existing || !options?.clearDeleted && existing.deleted_at) {
12706
- throw new chunkLGEALRC6_cjs.EdgeNotFoundError("unknown", id);
12839
+ throw new chunkDIK74MXX_cjs.EdgeNotFoundError("unknown", id);
12707
12840
  }
12708
- const registration = getEdgeRegistration(ctx.graph, existing.kind);
12709
- const edgeKind = registration.type;
12710
- const existingProps = chunk4TOD4LBZ_cjs.rowPropsToObject(existing.props);
12711
- const mergedProps = { ...existingProps, ...input.props };
12712
- const validatedProps = chunkVPYHY3LJ_cjs.validateEdgeProps(edgeKind.schema, mergedProps, {
12713
- kind: existing.kind,
12714
- operation: "update",
12715
- id
12716
- });
12717
- const validTo = chunkBLZDPRXT_cjs.validateOptionalCanonicalIsoDate(input.validTo, "validTo");
12841
+ const { validatedProps } = resolveEdgeUpdateProps(ctx, existing, input.props);
12842
+ const validTo = chunkRSSQKPSZ_cjs.validateOptionalCanonicalIsoDate(input.validTo, "validTo");
12718
12843
  const updateParams = {
12719
12844
  graphId: ctx.graphId,
12720
12845
  id,
@@ -12723,16 +12848,16 @@ async function performEdgeUpdate(ctx, input, target, options) {
12723
12848
  if (validTo !== void 0) updateParams.validTo = validTo;
12724
12849
  if (options?.clearDeleted) updateParams.clearDeleted = true;
12725
12850
  const row = await target.updateEdge(updateParams);
12726
- return chunkWJT7OU7E_cjs.rowToEdge(row);
12851
+ return chunk4CAXEB2F_cjs.rowToEdge(row);
12727
12852
  }
12728
12853
  async function executeEdgeUpdate(ctx, input, backend) {
12729
12854
  const id = input.id;
12730
12855
  const gate = await backend.getEdge(ctx.graphId, id);
12731
12856
  if (!gate || gate.deleted_at) {
12732
- throw new chunkLGEALRC6_cjs.EdgeNotFoundError("unknown", id);
12857
+ throw new chunkDIK74MXX_cjs.EdgeNotFoundError("unknown", id);
12733
12858
  }
12734
12859
  const opContext = ctx.createOperationContext("update", "edge", gate.kind, id);
12735
- return chunkWJT7OU7E_cjs.runHookedWriteOperation(
12860
+ return chunk4CAXEB2F_cjs.runHookedWriteOperation(
12736
12861
  ctx,
12737
12862
  opContext,
12738
12863
  backend,
@@ -12740,7 +12865,7 @@ async function executeEdgeUpdate(ctx, input, backend) {
12740
12865
  );
12741
12866
  }
12742
12867
  async function executeEdgeUpsertUpdate(ctx, input, backend, options) {
12743
- return chunkWJT7OU7E_cjs.runInWriteTransaction(
12868
+ return chunk4CAXEB2F_cjs.runInWriteTransaction(
12744
12869
  ctx,
12745
12870
  backend,
12746
12871
  (target) => performEdgeUpdate(ctx, input, target, options)
@@ -12750,7 +12875,7 @@ async function executeEdgeDelete(ctx, id, backend) {
12750
12875
  const gate = await backend.getEdge(ctx.graphId, id);
12751
12876
  if (!gate || gate.deleted_at) return;
12752
12877
  const opContext = ctx.createOperationContext("delete", "edge", gate.kind, id);
12753
- return chunkWJT7OU7E_cjs.runHookedWriteOperation(ctx, opContext, backend, async (target) => {
12878
+ return chunk4CAXEB2F_cjs.runHookedWriteOperation(ctx, opContext, backend, async (target) => {
12754
12879
  await target.deleteEdge({
12755
12880
  graphId: ctx.graphId,
12756
12881
  id
@@ -12761,7 +12886,7 @@ async function executeEdgeHardDelete(ctx, id, backend) {
12761
12886
  const gate = await backend.getEdge(ctx.graphId, id);
12762
12887
  if (!gate) return;
12763
12888
  const opContext = ctx.createOperationContext("delete", "edge", gate.kind, id);
12764
- return chunkWJT7OU7E_cjs.runHookedWriteOperation(ctx, opContext, backend, async (target) => {
12889
+ return chunk4CAXEB2F_cjs.runHookedWriteOperation(ctx, opContext, backend, async (target) => {
12765
12890
  await target.hardDeleteEdge({
12766
12891
  graphId: ctx.graphId,
12767
12892
  id
@@ -12775,7 +12900,7 @@ function validateMatchOnFields(schema, matchOn, edgeKind) {
12775
12900
  if (matchOn.length === 0) return;
12776
12901
  const shape = schema.shape;
12777
12902
  if (shape === void 0) {
12778
- throw new chunkLGEALRC6_cjs.ValidationError(
12903
+ throw new chunkDIK74MXX_cjs.ValidationError(
12779
12904
  `Edge kind "${edgeKind}" has no schema shape to validate matchOn fields against`,
12780
12905
  {
12781
12906
  kind: edgeKind,
@@ -12789,7 +12914,7 @@ function validateMatchOnFields(schema, matchOn, edgeKind) {
12789
12914
  }
12790
12915
  const invalidFields = matchOn.filter((field2) => !(field2 in shape));
12791
12916
  if (invalidFields.length > 0) {
12792
- throw new chunkLGEALRC6_cjs.ValidationError(
12917
+ throw new chunkDIK74MXX_cjs.ValidationError(
12793
12918
  `Invalid matchOn fields for edge kind "${edgeKind}": ${invalidFields.join(", ")}`,
12794
12919
  {
12795
12920
  kind: edgeKind,
@@ -12831,7 +12956,7 @@ function findMatchingEdge(rows, matchOn, inputProps) {
12831
12956
  let deletedRow;
12832
12957
  for (const row of rows) {
12833
12958
  if (matchOn.length > 0) {
12834
- const rowProps = chunk4TOD4LBZ_cjs.rowPropsToObject(row.props);
12959
+ const rowProps = chunkX4JBT642_cjs.rowPropsToObject(row.props);
12835
12960
  const matches = matchOn.every(
12836
12961
  (field2) => stableStringify(rowProps[field2]) === stableStringify(inputProps[field2])
12837
12962
  );
@@ -12868,16 +12993,16 @@ async function executeEdgeFindByEndpoints(ctx, kind, fromKind, fromId, toKind, t
12868
12993
  ...options?.asOf !== void 0 && { asOf: options.asOf }
12869
12994
  });
12870
12995
  if (candidateRows.length === 0) return void 0;
12871
- if (matchOn.length === 0) return chunkWJT7OU7E_cjs.rowToEdge(candidateRows[0]);
12996
+ if (matchOn.length === 0) return chunk4CAXEB2F_cjs.rowToEdge(candidateRows[0]);
12872
12997
  const { liveRow } = findMatchingEdge(candidateRows, matchOn, props);
12873
- return liveRow === void 0 ? void 0 : chunkWJT7OU7E_cjs.rowToEdge(liveRow);
12998
+ return liveRow === void 0 ? void 0 : chunk4CAXEB2F_cjs.rowToEdge(liveRow);
12874
12999
  }
12875
13000
  async function executeEdgeGetOrCreateByEndpoints(ctx, kind, fromKind, fromId, toKind, toId, props, backend, options) {
12876
13001
  const ifExists = options?.ifExists ?? "return";
12877
13002
  const matchOn = options?.matchOn ?? [];
12878
13003
  const registration = getEdgeRegistration(ctx.graph, kind);
12879
13004
  const edgeKind = registration.type;
12880
- const validatedProps = chunkVPYHY3LJ_cjs.validateEdgeProps(edgeKind.schema, props, {
13005
+ const validatedProps = chunk2THZ3TQI_cjs.validateEdgeProps(edgeKind.schema, props, {
12881
13006
  kind,
12882
13007
  operation: "create"
12883
13008
  });
@@ -12899,7 +13024,7 @@ async function executeEdgeGetOrCreateByEndpoints(ctx, kind, fromKind, fromId, to
12899
13024
  validatedProps
12900
13025
  );
12901
13026
  if (probedLiveRow !== void 0) {
12902
- return { edge: chunkWJT7OU7E_cjs.rowToEdge(probedLiveRow), action: "found" };
13027
+ return { edge: chunk4CAXEB2F_cjs.rowToEdge(probedLiveRow), action: "found" };
12903
13028
  }
12904
13029
  }
12905
13030
  async function attempt() {
@@ -12932,7 +13057,7 @@ async function executeEdgeGetOrCreateByEndpoints(ctx, kind, fromKind, fromId, to
12932
13057
  }
12933
13058
  if (liveRow !== void 0) {
12934
13059
  if (ifExists === "return") {
12935
- return { edge: chunkWJT7OU7E_cjs.rowToEdge(liveRow), action: "found" };
13060
+ return { edge: chunk4CAXEB2F_cjs.rowToEdge(liveRow), action: "found" };
12936
13061
  }
12937
13062
  const edge2 = await executeEdgeUpsertUpdate(
12938
13063
  ctx,
@@ -12952,7 +13077,7 @@ async function executeEdgeGetOrCreateByEndpoints(ctx, kind, fromKind, fromId, to
12952
13077
  registry: ctx.registry,
12953
13078
  backend
12954
13079
  };
12955
- await chunkWJT7OU7E_cjs.checkCardinalityConstraint(
13080
+ await chunk4CAXEB2F_cjs.checkCardinalityConstraint(
12956
13081
  constraintContext,
12957
13082
  kind,
12958
13083
  cardinality,
@@ -12973,7 +13098,7 @@ async function executeEdgeGetOrCreateByEndpoints(ctx, kind, fromKind, fromId, to
12973
13098
  try {
12974
13099
  return await attempt();
12975
13100
  } catch (error) {
12976
- if (!(error instanceof chunkLGEALRC6_cjs.CardinalityError)) throw error;
13101
+ if (!(error instanceof chunkDIK74MXX_cjs.CardinalityError)) throw error;
12977
13102
  return attempt();
12978
13103
  }
12979
13104
  }
@@ -12987,7 +13112,7 @@ async function executeEdgeBulkGetOrCreateByEndpoints(ctx, kind, items, backend,
12987
13112
  validateMatchOnFields(edgeKind.schema, matchOn, kind);
12988
13113
  const validated = [];
12989
13114
  for (const item of items) {
12990
- const validatedProps = chunkVPYHY3LJ_cjs.validateEdgeProps(edgeKind.schema, item.props, {
13115
+ const validatedProps = chunk2THZ3TQI_cjs.validateEdgeProps(edgeKind.schema, item.props, {
12991
13116
  kind,
12992
13117
  operation: "create"
12993
13118
  });
@@ -13098,7 +13223,7 @@ async function executeEdgeBulkGetOrCreateByEndpoints(ctx, kind, items, backend,
13098
13223
  if (allFoundLive) {
13099
13224
  const found = Array.from({ length: items.length });
13100
13225
  for (const entry2 of probe.toFetch) {
13101
- found[entry2.index] = { edge: chunkWJT7OU7E_cjs.rowToEdge(entry2.row), action: "found" };
13226
+ found[entry2.index] = { edge: chunk4CAXEB2F_cjs.rowToEdge(entry2.row), action: "found" };
13102
13227
  }
13103
13228
  for (const { index, sourceIndex } of probe.duplicateOf) {
13104
13229
  found[index] = { edge: found[sourceIndex].edge, action: "found" };
@@ -13106,7 +13231,7 @@ async function executeEdgeBulkGetOrCreateByEndpoints(ctx, kind, items, backend,
13106
13231
  return found;
13107
13232
  }
13108
13233
  }
13109
- return chunkWJT7OU7E_cjs.runInWriteTransaction(ctx, backend, async (target) => {
13234
+ return chunk4CAXEB2F_cjs.runInWriteTransaction(ctx, backend, async (target) => {
13110
13235
  const { toCreate, toFetch, duplicateOf } = partitionEntries(
13111
13236
  await fetchRowsByEndpoint(target)
13112
13237
  );
@@ -13133,7 +13258,7 @@ async function executeEdgeBulkGetOrCreateByEndpoints(ctx, kind, items, backend,
13133
13258
  registry: ctx.registry,
13134
13259
  backend: target
13135
13260
  };
13136
- await chunkWJT7OU7E_cjs.checkCardinalityConstraint(
13261
+ await chunk4CAXEB2F_cjs.checkCardinalityConstraint(
13137
13262
  constraintContext,
13138
13263
  kind,
13139
13264
  cardinality,
@@ -13158,7 +13283,7 @@ async function executeEdgeBulkGetOrCreateByEndpoints(ctx, kind, items, backend,
13158
13283
  );
13159
13284
  results[entry2.index] = { edge, action: "updated" };
13160
13285
  } else {
13161
- results[entry2.index] = { edge: chunkWJT7OU7E_cjs.rowToEdge(entry2.row), action: "found" };
13286
+ results[entry2.index] = { edge: chunk4CAXEB2F_cjs.rowToEdge(entry2.row), action: "found" };
13162
13287
  }
13163
13288
  }
13164
13289
  for (const { index, sourceIndex } of duplicateOf) {
@@ -13170,20 +13295,20 @@ async function executeEdgeBulkGetOrCreateByEndpoints(ctx, kind, items, backend,
13170
13295
  }
13171
13296
  var RECORDED_POINT_READ_FIXED_BIND_PARAMS = 8;
13172
13297
  function recordedPointReadIdChunk(backend) {
13173
- const budget = chunkXOX22WHL_cjs.recordedBindParamBudget(backend);
13298
+ const budget = chunkZUNQ5BEP_cjs.recordedBindParamBudget(backend);
13174
13299
  return Math.max(1, budget - RECORDED_POINT_READ_FIXED_BIND_PARAMS);
13175
13300
  }
13176
13301
  function recordedRelationErrorDetails(backend, surface) {
13177
13302
  return { dialect: backend.dialect, surface };
13178
13303
  }
13179
13304
  function withRelationsPrecondition(backend, promise, surface) {
13180
- return chunkBLZDPRXT_cjs.withRecordedRelationsPrecondition(
13305
+ return chunkRSSQKPSZ_cjs.withRecordedRelationsPrecondition(
13181
13306
  promise,
13182
13307
  recordedRelationErrorDetails(backend, surface)
13183
13308
  );
13184
13309
  }
13185
13310
  function createRecordedReadBackend(backend, surface) {
13186
- return chunk4TOD4LBZ_cjs.createBackendOverlay(backend, {
13311
+ return chunkX4JBT642_cjs.createBackendOverlay(backend, {
13187
13312
  execute: (query) => withRelationsPrecondition(backend, backend.execute(query), surface),
13188
13313
  ...backend.executeRaw === void 0 ? {} : {
13189
13314
  executeRaw: (sqlText, params) => withRelationsPrecondition(
@@ -13197,21 +13322,21 @@ function createRecordedReadBackend(backend, surface) {
13197
13322
  function recordedTemporalFilter(backend, coordinate, tableAlias) {
13198
13323
  const recordedAsOf = coordinate.recorded?.asOf;
13199
13324
  if (recordedAsOf === void 0) {
13200
- throw new chunkLGEALRC6_cjs.ConfigurationError(
13325
+ throw new chunkDIK74MXX_cjs.ConfigurationError(
13201
13326
  "Recorded point reads require a recorded-time coordinate.",
13202
13327
  { code: "RECORDED_POINT_READ_MISSING_COORDINATE" }
13203
13328
  );
13204
13329
  }
13205
- return chunk4TOD4LBZ_cjs.compileTemporalFilter({
13330
+ return chunkX4JBT642_cjs.compileTemporalFilter({
13206
13331
  mode: coordinate.valid.mode,
13207
13332
  asOf: coordinate.valid.asOf,
13208
13333
  recordedAsOf,
13209
13334
  tableAlias,
13210
- currentTimestamp: chunk4TOD4LBZ_cjs.currentReadInstant()
13335
+ currentTimestamp: chunkX4JBT642_cjs.currentReadInstant()
13211
13336
  });
13212
13337
  }
13213
13338
  function recordedRelationInvariantError(params) {
13214
- return new chunkLGEALRC6_cjs.ConfigurationError(
13339
+ return new chunkDIK74MXX_cjs.ConfigurationError(
13215
13340
  "Recorded relation invariant violation: more than one recorded row matched the requested point read.",
13216
13341
  {
13217
13342
  code: "RECORDED_RELATION_INVARIANT_VIOLATION",
@@ -13236,7 +13361,7 @@ function createRecordedReadService(params) {
13236
13361
  mapRecordedNodeRow,
13237
13362
  mapRecordedEdgeRow
13238
13363
  } = params;
13239
- const recordedSchema = recordedReadBinding === void 0 ? void 0 : chunkXOX22WHL_cjs.recordedReadSqlSchema(recordedReadBinding);
13364
+ const recordedSchema = recordedReadBinding === void 0 ? void 0 : chunkZUNQ5BEP_cjs.recordedReadSqlSchema(recordedReadBinding);
13240
13365
  async function recordedGetByIds(read) {
13241
13366
  const { table, alias, kind, ids, coordinate, toEntity, entity } = read;
13242
13367
  if (ids.length === 0) return [];
@@ -13246,13 +13371,13 @@ function createRecordedReadService(params) {
13246
13371
  const chunkResults = await withRelationsPrecondition(
13247
13372
  backend,
13248
13373
  Promise.all(
13249
- chunk4TOD4LBZ_cjs.chunk(uniqueIds, recordedPointReadIdChunk(backend)).map(
13374
+ chunkX4JBT642_cjs.chunk(uniqueIds, recordedPointReadIdChunk(backend)).map(
13250
13375
  (idChunk) => backend.execute(
13251
13376
  chunkEOLERH7Y_cjs.asCompiledRowsSql(drizzleOrm.sql`
13252
13377
  SELECT * FROM ${table} ${aliasSql}
13253
13378
  WHERE ${aliasSql}.graph_id = ${graphId}
13254
13379
  AND ${aliasSql}.kind = ${kind}
13255
- AND ${aliasSql}.id IN (${chunk4TOD4LBZ_cjs.sqlValueList(idChunk)})
13380
+ AND ${aliasSql}.id IN (${chunkX4JBT642_cjs.sqlValueList(idChunk)})
13256
13381
  AND ${temporalFilter}
13257
13382
  ORDER BY ${aliasSql}.recorded_from
13258
13383
  `)
@@ -13280,8 +13405,8 @@ function createRecordedReadService(params) {
13280
13405
  return ids.map((id) => byId.get(id));
13281
13406
  }
13282
13407
  function nodeGetByIds(kind, ids, coordinate) {
13283
- const schema = recordedSchema ?? chunkXOX22WHL_cjs.recordedReadSqlSchema(
13284
- chunkXOX22WHL_cjs.requireRecordedReadBinding(recordedReadBinding, "recorded-point-read")
13408
+ const schema = recordedSchema ?? chunkZUNQ5BEP_cjs.recordedReadSqlSchema(
13409
+ chunkZUNQ5BEP_cjs.requireRecordedReadBinding(recordedReadBinding, "recorded-point-read")
13285
13410
  );
13286
13411
  return recordedGetByIds({
13287
13412
  entity: "node",
@@ -13290,12 +13415,12 @@ function createRecordedReadService(params) {
13290
13415
  kind,
13291
13416
  ids,
13292
13417
  coordinate,
13293
- toEntity: (row) => chunkWJT7OU7E_cjs.rowToNode(mapRecordedNodeRow(row))
13418
+ toEntity: (row) => chunk4CAXEB2F_cjs.rowToNode(mapRecordedNodeRow(row))
13294
13419
  });
13295
13420
  }
13296
13421
  function edgeGetByIds(kind, ids, coordinate) {
13297
- const schema = recordedSchema ?? chunkXOX22WHL_cjs.recordedReadSqlSchema(
13298
- chunkXOX22WHL_cjs.requireRecordedReadBinding(recordedReadBinding, "recorded-point-read")
13422
+ const schema = recordedSchema ?? chunkZUNQ5BEP_cjs.recordedReadSqlSchema(
13423
+ chunkZUNQ5BEP_cjs.requireRecordedReadBinding(recordedReadBinding, "recorded-point-read")
13299
13424
  );
13300
13425
  return recordedGetByIds({
13301
13426
  entity: "edge",
@@ -13304,13 +13429,13 @@ function createRecordedReadService(params) {
13304
13429
  kind,
13305
13430
  ids,
13306
13431
  coordinate,
13307
- toEntity: (row) => chunkWJT7OU7E_cjs.rowToEdge(mapRecordedEdgeRow(row))
13432
+ toEntity: (row) => chunk4CAXEB2F_cjs.rowToEdge(mapRecordedEdgeRow(row))
13308
13433
  });
13309
13434
  }
13310
13435
  return {
13311
13436
  backendForCoordinate(coordinate, surface) {
13312
13437
  if (coordinate.recorded === void 0) return backend;
13313
- chunkXOX22WHL_cjs.requireRecordedReadBinding(recordedReadBinding, surface);
13438
+ chunkZUNQ5BEP_cjs.requireRecordedReadBinding(recordedReadBinding, surface);
13314
13439
  return createRecordedReadBackend(backend, surface);
13315
13440
  },
13316
13441
  async nodeGetById(kind, id, coordinate) {
@@ -13371,27 +13496,48 @@ function increment(counts, kind, count2) {
13371
13496
  counts[kind] = (counts[kind] ?? 0) + count2;
13372
13497
  }
13373
13498
  function createTransactionReceiptRecorder() {
13374
- const nodes = createCountBucket();
13375
- const edges = createCountBucket();
13376
- let total = 0;
13499
+ const counters = {
13500
+ nodes: createCountBucket(),
13501
+ edges: createCountBucket(),
13502
+ total: 0
13503
+ };
13504
+ let sealed = false;
13377
13505
  return {
13378
13506
  recordNode(kind, count2) {
13379
- increment(nodes, kind, count2);
13380
- total += count2;
13507
+ increment(counters.nodes, kind, count2);
13508
+ counters.total += count2;
13381
13509
  },
13382
13510
  recordEdge(kind, count2) {
13383
- increment(edges, kind, count2);
13384
- total += count2;
13511
+ increment(counters.edges, kind, count2);
13512
+ counters.total += count2;
13385
13513
  },
13386
13514
  snapshot(recorded) {
13387
13515
  return Object.freeze({
13388
13516
  writes: Object.freeze({
13389
- nodes: Object.freeze(Object.assign(createCountBucket(), nodes)),
13390
- edges: Object.freeze(Object.assign(createCountBucket(), edges)),
13391
- total
13517
+ nodes: Object.freeze(
13518
+ Object.assign(createCountBucket(), counters.nodes)
13519
+ ),
13520
+ edges: Object.freeze(
13521
+ Object.assign(createCountBucket(), counters.edges)
13522
+ ),
13523
+ total: counters.total
13392
13524
  }),
13393
13525
  ...recorded === void 0 ? {} : { recorded }
13394
13526
  });
13527
+ },
13528
+ seal() {
13529
+ sealed = true;
13530
+ },
13531
+ assertWritable() {
13532
+ if (sealed) {
13533
+ throw new chunkDIK74MXX_cjs.ConfigurationError(
13534
+ "Transaction context is sealed: a write happened through the receipt-tracked collections after the transaction callback returned.",
13535
+ {},
13536
+ {
13537
+ suggestion: "Perform all writes inside the transactionWithReceipt / withRecordedTransaction callback; do not reuse the transaction context after it returns."
13538
+ }
13539
+ );
13540
+ }
13395
13541
  }
13396
13542
  };
13397
13543
  }
@@ -13425,7 +13571,7 @@ function memoizedProxyGet(target, shouldWrap, wrap) {
13425
13571
  }
13426
13572
  });
13427
13573
  }
13428
- function wrapWriteCollection(collection, kind, surface, record) {
13574
+ function wrapWriteCollection(collection, kind, surface, record, assertWritable) {
13429
13575
  return memoizedProxyGet(
13430
13576
  collection,
13431
13577
  (property) => surface.methodNames.has(property),
@@ -13433,6 +13579,7 @@ function wrapWriteCollection(collection, kind, surface, record) {
13433
13579
  if (!isWrappedMethod(value)) return value;
13434
13580
  const method = property;
13435
13581
  const wrapped = async (...args) => {
13582
+ assertWritable();
13436
13583
  const count2 = surface.counters[method](args);
13437
13584
  const result = await Reflect.apply(value, collection, args);
13438
13585
  record(kind, count2);
@@ -13457,7 +13604,8 @@ function wrapTransactionCollections(nodes, edges, recorder) {
13457
13604
  collection,
13458
13605
  kind,
13459
13606
  NODE_WRITE_SURFACE,
13460
- recorder.recordNode
13607
+ recorder.recordNode,
13608
+ recorder.assertWritable
13461
13609
  )
13462
13610
  ),
13463
13611
  edges: wrapCollections(
@@ -13466,7 +13614,8 @@ function wrapTransactionCollections(nodes, edges, recorder) {
13466
13614
  collection,
13467
13615
  kind,
13468
13616
  EDGE_WRITE_SURFACE,
13469
- recorder.recordEdge
13617
+ recorder.recordEdge,
13618
+ recorder.assertWritable
13470
13619
  )
13471
13620
  )
13472
13621
  };
@@ -13502,17 +13651,18 @@ var CAUGHT_UP_VERB_DETAILS = {
13502
13651
  }
13503
13652
  };
13504
13653
  function rowMapperConfigFor(backend) {
13505
- return backend.dialect === "postgres" ? chunkCTTSDJLY_cjs.POSTGRES_ROW_MAPPER_CONFIG : chunkCTTSDJLY_cjs.SQLITE_ROW_MAPPER_CONFIG;
13654
+ return backend.dialect === "postgres" ? chunk5W4L6DLF_cjs.POSTGRES_ROW_MAPPER_CONFIG : chunk5W4L6DLF_cjs.SQLITE_ROW_MAPPER_CONFIG;
13506
13655
  }
13507
13656
  function asError(error) {
13508
13657
  return error instanceof Error ? error : new Error(String(error));
13509
13658
  }
13659
+ var EMPTY_RECORDED_FLUSH_INSTANTS = /* @__PURE__ */ new Map();
13510
13660
  function transactionOutcome(result, recorder, recordedByGraph, graphId) {
13511
13661
  const recorded = recordedByGraph?.get(graphId);
13512
13662
  return {
13513
13663
  result,
13514
13664
  receipt: recorder.snapshot(
13515
- recorded === void 0 ? void 0 : chunkXOX22WHL_cjs.asRecordedInstant(recorded)
13665
+ recorded === void 0 ? void 0 : chunkZUNQ5BEP_cjs.asRecordedInstant(recorded)
13516
13666
  )
13517
13667
  };
13518
13668
  }
@@ -13549,13 +13699,13 @@ var Store = class _Store {
13549
13699
  this.#captureEnabled = options?.history === true;
13550
13700
  this.#revisionTrackingEnabled = this.#captureEnabled || options?.revisionTracking === true;
13551
13701
  if (this.#revisionTrackingEnabled) {
13552
- chunkXOX22WHL_cjs.assertRevisionTrackableBackend(backend);
13702
+ chunkZUNQ5BEP_cjs.assertRevisionTrackableBackend(backend);
13553
13703
  }
13554
- const explicitSchema = options?.schema === void 0 ? void 0 : chunkXOX22WHL_cjs.requireSqlSchema(options.schema, "store schema");
13555
- const resolvedSchema = explicitSchema ?? (backend.tableNames ? chunkXOX22WHL_cjs.createSqlSchema(backend.tableNames) : void 0);
13556
- const readSchema = resolvedSchema ?? chunkXOX22WHL_cjs.createSqlSchema(backend.tableNames);
13704
+ const explicitSchema = options?.schema === void 0 ? void 0 : chunkZUNQ5BEP_cjs.requireSqlSchema(options.schema, "store schema");
13705
+ const resolvedSchema = explicitSchema ?? (backend.tableNames ? chunkZUNQ5BEP_cjs.createSqlSchema(backend.tableNames) : void 0);
13706
+ const readSchema = resolvedSchema ?? chunkZUNQ5BEP_cjs.createSqlSchema(backend.tableNames);
13557
13707
  if (this.#captureEnabled && options?.recordedRead !== void 0) {
13558
- throw new chunkLGEALRC6_cjs.ConfigurationError(
13708
+ throw new chunkDIK74MXX_cjs.ConfigurationError(
13559
13709
  "recordedRead cannot be combined with history: true.",
13560
13710
  { code: "RECORDED_READ_CONFLICTS_WITH_HISTORY" },
13561
13711
  {
@@ -13563,21 +13713,21 @@ var Store = class _Store {
13563
13713
  }
13564
13714
  );
13565
13715
  }
13566
- const externalRecordedRead = chunkXOX22WHL_cjs.requireExternalRecordedReadSource(
13716
+ const externalRecordedRead = chunkZUNQ5BEP_cjs.requireExternalRecordedReadSource(
13567
13717
  options?.recordedRead
13568
13718
  );
13569
- this.#recordedReadBinding = this.#captureEnabled ? chunkXOX22WHL_cjs.createRecordedReadBinding(readSchema) : externalRecordedRead;
13570
- this.#backend = this.#captureEnabled ? asGraphWriteBackend(chunkXOX22WHL_cjs.createRecordedBackend(backend, resolvedSchema)) : asGraphWriteBackend(backend);
13719
+ this.#recordedReadBinding = this.#captureEnabled ? chunkZUNQ5BEP_cjs.createRecordedReadBinding(readSchema) : externalRecordedRead;
13720
+ this.#backend = this.#captureEnabled ? asGraphWriteBackend(chunkZUNQ5BEP_cjs.createRecordedBackend(backend, resolvedSchema)) : asGraphWriteBackend(backend);
13571
13721
  this.#schema = resolvedSchema;
13572
13722
  const rowMapperConfig = rowMapperConfigFor(this.#backend);
13573
13723
  this.#recordedReads = createRecordedReadService({
13574
13724
  graphId: graph.id,
13575
13725
  backend: this.#backend,
13576
13726
  recordedReadBinding: this.#recordedReadBinding,
13577
- mapRecordedNodeRow: chunkCTTSDJLY_cjs.createNodeRowMapper(rowMapperConfig),
13578
- mapRecordedEdgeRow: chunkCTTSDJLY_cjs.createEdgeRowMapper(rowMapperConfig)
13727
+ mapRecordedNodeRow: chunk5W4L6DLF_cjs.createNodeRowMapper(rowMapperConfig),
13728
+ mapRecordedEdgeRow: chunk5W4L6DLF_cjs.createEdgeRowMapper(rowMapperConfig)
13579
13729
  });
13580
- this.#registry = chunkCK5BVQOW_cjs.buildKindRegistry(graph);
13730
+ this.#registry = chunkPWGX5DF5_cjs.buildKindRegistry(graph);
13581
13731
  this.#hooks = options?.hooks ?? {};
13582
13732
  this.#defaultTraversalExpansion = options?.queryDefaults?.traversalExpansion ?? "inverse";
13583
13733
  this.#options = options;
@@ -13761,7 +13911,7 @@ var Store = class _Store {
13761
13911
  getNodeCollectionOrThrow(kind) {
13762
13912
  const collection = this.getNodeCollection(kind);
13763
13913
  if (collection === void 0) {
13764
- throw new chunkLGEALRC6_cjs.KindNotFoundError(kind, "node", {
13914
+ throw new chunkDIK74MXX_cjs.KindNotFoundError(kind, "node", {
13765
13915
  graphId: this.graphId
13766
13916
  });
13767
13917
  }
@@ -13785,7 +13935,7 @@ var Store = class _Store {
13785
13935
  getEdgeCollectionOrThrow(kind) {
13786
13936
  const collection = this.getEdgeCollection(kind);
13787
13937
  if (collection === void 0) {
13788
- throw new chunkLGEALRC6_cjs.KindNotFoundError(kind, "edge", {
13938
+ throw new chunkDIK74MXX_cjs.KindNotFoundError(kind, "edge", {
13789
13939
  graphId: this.graphId
13790
13940
  });
13791
13941
  }
@@ -13811,7 +13961,7 @@ var Store = class _Store {
13811
13961
  getNodePropsSchemaOrThrow(kind) {
13812
13962
  const schema = this.getNodePropsSchema(kind);
13813
13963
  if (schema === void 0) {
13814
- throw new chunkLGEALRC6_cjs.KindNotFoundError(kind, "node", {
13964
+ throw new chunkDIK74MXX_cjs.KindNotFoundError(kind, "node", {
13815
13965
  graphId: this.graphId
13816
13966
  });
13817
13967
  }
@@ -13832,7 +13982,7 @@ var Store = class _Store {
13832
13982
  getEdgePropsSchemaOrThrow(kind) {
13833
13983
  const schema = this.getEdgePropsSchema(kind);
13834
13984
  if (schema === void 0) {
13835
- throw new chunkLGEALRC6_cjs.KindNotFoundError(kind, "edge", {
13985
+ throw new chunkDIK74MXX_cjs.KindNotFoundError(kind, "edge", {
13836
13986
  graphId: this.graphId
13837
13987
  });
13838
13988
  }
@@ -13889,23 +14039,27 @@ var Store = class _Store {
13889
14039
  #buildNodeOperations(ctx) {
13890
14040
  return {
13891
14041
  defaultTemporalMode: this.#graph.defaults.temporalMode,
13892
- rowToNode: (row) => chunkWJT7OU7E_cjs.rowToNode(row),
14042
+ rowToNode: (row) => chunk4CAXEB2F_cjs.rowToNode(row),
13893
14043
  maybeRefreshStatisticsAfterBulk: (rowCount) => this.#maybeRefreshStatisticsAfterBulk(rowCount),
13894
- executeCreate: (input, backend) => chunkWJT7OU7E_cjs.executeNodeCreate(ctx, input, backend),
13895
- executeCreateBatch: (inputs, backend) => chunkWJT7OU7E_cjs.executeNodeCreateBatch(ctx, inputs, backend),
13896
- executeCreateNoReturnBatch: (inputs, backend) => chunkWJT7OU7E_cjs.executeNodeCreateNoReturnBatch(ctx, inputs, backend),
13897
- executeUpdate: (input, backend, options) => chunkWJT7OU7E_cjs.executeNodeUpdate(ctx, { ...input, id: input.id }, backend, options),
13898
- executeUpsertUpdate: (input, backend, options) => chunkWJT7OU7E_cjs.executeNodeUpsertUpdate(
14044
+ executeCreate: (input, backend) => chunk4CAXEB2F_cjs.executeNodeCreate(ctx, input, backend),
14045
+ executeCreateBatch: (inputs, backend) => chunk4CAXEB2F_cjs.executeNodeCreateBatch(ctx, inputs, backend),
14046
+ executeCreateNoReturnBatch: (inputs, backend) => chunk4CAXEB2F_cjs.executeNodeCreateNoReturnBatch(ctx, inputs, backend),
14047
+ executeUpdate: (input, backend, options) => chunk4CAXEB2F_cjs.executeNodeUpdate(ctx, { ...input, id: input.id }, backend, options),
14048
+ executeUpsertUpdate: (input, backend, options) => chunk4CAXEB2F_cjs.executeNodeUpsertUpdate(
13899
14049
  ctx,
13900
14050
  { ...input, id: input.id },
13901
14051
  backend,
13902
14052
  options
13903
14053
  ),
13904
- executeDelete: (kind, id, backend) => chunkWJT7OU7E_cjs.executeNodeDelete(ctx, kind, id, backend),
13905
- executeHardDelete: (kind, id, backend) => chunkWJT7OU7E_cjs.executeNodeHardDelete(ctx, kind, id, backend),
14054
+ // Present only when opted in; its absence is the coalesce off switch.
14055
+ ...this.#options?.coalesceUnchangedUpserts === true && {
14056
+ upsertDirtyCheck: (kind, id, existingProps, inputProps) => chunk4CAXEB2F_cjs.nodeUpsertDirtyCheck(ctx, kind, id, existingProps, inputProps)
14057
+ },
14058
+ executeDelete: (kind, id, backend) => chunk4CAXEB2F_cjs.executeNodeDelete(ctx, kind, id, backend),
14059
+ executeHardDelete: (kind, id, backend) => chunk4CAXEB2F_cjs.executeNodeHardDelete(ctx, kind, id, backend),
13906
14060
  temporalRowMatcher: (options) => this.#temporalRowMatcher(options),
13907
14061
  createQuery: () => this.query(),
13908
- executeGetOrCreateByConstraint: (kind, constraintName, props, backend, options) => chunkWJT7OU7E_cjs.executeNodeGetOrCreateByConstraint(
14062
+ executeGetOrCreateByConstraint: (kind, constraintName, props, backend, options) => chunk4CAXEB2F_cjs.executeNodeGetOrCreateByConstraint(
13909
14063
  ctx,
13910
14064
  kind,
13911
14065
  constraintName,
@@ -13913,7 +14067,7 @@ var Store = class _Store {
13913
14067
  backend,
13914
14068
  options
13915
14069
  ),
13916
- executeBulkGetOrCreateByConstraint: (kind, constraintName, items, backend, options) => chunkWJT7OU7E_cjs.executeNodeBulkGetOrCreateByConstraint(
14070
+ executeBulkGetOrCreateByConstraint: (kind, constraintName, items, backend, options) => chunk4CAXEB2F_cjs.executeNodeBulkGetOrCreateByConstraint(
13917
14071
  ctx,
13918
14072
  kind,
13919
14073
  constraintName,
@@ -13921,15 +14075,15 @@ var Store = class _Store {
13921
14075
  backend,
13922
14076
  options
13923
14077
  ),
13924
- executeFindByConstraint: (kind, constraintName, props, backend) => chunkWJT7OU7E_cjs.executeNodeFindByConstraint(ctx, kind, constraintName, props, backend),
13925
- executeBulkFindByConstraint: (kind, constraintName, items, backend) => chunkWJT7OU7E_cjs.executeNodeBulkFindByConstraint(
14078
+ executeFindByConstraint: (kind, constraintName, props, backend) => chunk4CAXEB2F_cjs.executeNodeFindByConstraint(ctx, kind, constraintName, props, backend),
14079
+ executeBulkFindByConstraint: (kind, constraintName, items, backend) => chunk4CAXEB2F_cjs.executeNodeBulkFindByConstraint(
13926
14080
  ctx,
13927
14081
  kind,
13928
14082
  constraintName,
13929
14083
  items,
13930
14084
  backend
13931
14085
  ),
13932
- executeBulkFindByIndex: (kind, indexName, items, backend, options) => chunkWJT7OU7E_cjs.executeNodeBulkFindByIndex(
14086
+ executeBulkFindByIndex: (kind, indexName, items, backend, options) => chunk4CAXEB2F_cjs.executeNodeBulkFindByIndex(
13933
14087
  ctx,
13934
14088
  kind,
13935
14089
  indexName,
@@ -13948,13 +14102,17 @@ var Store = class _Store {
13948
14102
  #buildEdgeOperations(ctx) {
13949
14103
  return {
13950
14104
  defaultTemporalMode: this.#graph.defaults.temporalMode,
13951
- rowToEdge: (row) => chunkWJT7OU7E_cjs.rowToEdge(row),
14105
+ rowToEdge: (row) => chunk4CAXEB2F_cjs.rowToEdge(row),
13952
14106
  maybeRefreshStatisticsAfterBulk: (rowCount) => this.#maybeRefreshStatisticsAfterBulk(rowCount),
13953
14107
  executeCreate: (input, backend) => executeEdgeCreate(ctx, input, backend),
13954
14108
  executeCreateBatch: (inputs, backend) => executeEdgeCreateBatch(ctx, inputs, backend),
13955
14109
  executeCreateNoReturnBatch: (inputs, backend) => executeEdgeCreateNoReturnBatch(ctx, inputs, backend),
13956
14110
  executeUpdate: (input, backend) => executeEdgeUpdate(ctx, input, backend),
13957
14111
  executeUpsertUpdate: (input, backend, options) => executeEdgeUpsertUpdate(ctx, input, backend, options),
14112
+ // Present only when opted in; its absence is the coalesce off switch.
14113
+ ...this.#options?.coalesceUnchangedUpserts === true && {
14114
+ upsertDirtyCheck: (kind, id, existingProps, inputProps) => edgeUpsertDirtyCheck(ctx, kind, id, existingProps, inputProps)
14115
+ },
13958
14116
  executeDelete: (id, backend) => executeEdgeDelete(ctx, id, backend),
13959
14117
  executeHardDelete: (id, backend) => executeEdgeHardDelete(ctx, id, backend),
13960
14118
  temporalRowMatcher: (options) => this.#temporalRowMatcher(options),
@@ -14018,7 +14176,7 @@ var Store = class _Store {
14018
14176
  );
14019
14177
  }
14020
14178
  #sqlSchema() {
14021
- return this.#schema ?? chunkXOX22WHL_cjs.createSqlSchema(this.#backend.tableNames);
14179
+ return this.#schema ?? chunkZUNQ5BEP_cjs.createSqlSchema(this.#backend.tableNames);
14022
14180
  }
14023
14181
  /**
14024
14182
  * Internal seam for {@link RecordedStoreView}: reconstruct a node point read
@@ -14100,14 +14258,14 @@ var Store = class _Store {
14100
14258
  * may sort before the most recent commits and silently omit them.
14101
14259
  */
14102
14260
  asOfRecorded(recordedAsOf) {
14103
- const validCoordinate = chunkXOX22WHL_cjs.resolveReadCoordinate(
14261
+ const validCoordinate = chunkZUNQ5BEP_cjs.resolveReadCoordinate(
14104
14262
  "asOf",
14105
14263
  recordedAsOf,
14106
14264
  "Use await store.recordedNow() as the anchor, or asRecordedInstant(value) only for an instant previously read from recordedNow()."
14107
14265
  );
14108
14266
  return new RecordedStoreView(
14109
14267
  this,
14110
- chunkXOX22WHL_cjs.withRecordedCoordinate(validCoordinate, recordedAsOf)
14268
+ chunkZUNQ5BEP_cjs.withRecordedCoordinate(validCoordinate, recordedAsOf)
14111
14269
  );
14112
14270
  }
14113
14271
  /**
@@ -14135,7 +14293,7 @@ var Store = class _Store {
14135
14293
  */
14136
14294
  async recordedNow() {
14137
14295
  if (!this.#captureEnabled) {
14138
- throw new chunkLGEALRC6_cjs.ConfigurationError(
14296
+ throw new chunkDIK74MXX_cjs.ConfigurationError(
14139
14297
  "recordedNow() requires a store created with { history: true }.",
14140
14298
  { code: "RECORDED_NOW_REQUIRES_HISTORY" },
14141
14299
  {
@@ -14143,11 +14301,11 @@ var Store = class _Store {
14143
14301
  }
14144
14302
  );
14145
14303
  }
14146
- const recordedAt = await chunkBLZDPRXT_cjs.withRecordedRelationsPrecondition(
14147
- chunkXOX22WHL_cjs.readRecordedClock(this.#backend, this.#sqlSchema(), this.graphId),
14304
+ const recordedAt = await chunkRSSQKPSZ_cjs.withRecordedRelationsPrecondition(
14305
+ chunkZUNQ5BEP_cjs.readRecordedClock(this.#backend, this.#sqlSchema(), this.graphId),
14148
14306
  { dialect: this.#backend.dialect, surface: "recorded-now" }
14149
14307
  );
14150
- return recordedAt === void 0 ? void 0 : chunkXOX22WHL_cjs.asRecordedInstant(recordedAt);
14308
+ return recordedAt === void 0 ? void 0 : chunkZUNQ5BEP_cjs.asRecordedInstant(recordedAt);
14151
14309
  }
14152
14310
  /**
14153
14311
  * Returns the durable graph revision used by graph branching. It is undefined
@@ -14159,7 +14317,7 @@ var Store = class _Store {
14159
14317
  */
14160
14318
  async revisionNow() {
14161
14319
  if (!this.#revisionTrackingEnabled) return void 0;
14162
- return chunkXOX22WHL_cjs.readRecordedClock(this.#backend, this.#sqlSchema(), this.graphId);
14320
+ return chunkZUNQ5BEP_cjs.readRecordedClock(this.#backend, this.#sqlSchema(), this.graphId);
14163
14321
  }
14164
14322
  /**
14165
14323
  * Returns the durable random namespace for this graph's revision clock. A
@@ -14171,12 +14329,12 @@ var Store = class _Store {
14171
14329
  */
14172
14330
  async revisionOriginNow() {
14173
14331
  if (!this.#revisionTrackingEnabled) {
14174
- throw new chunkLGEALRC6_cjs.ConfigurationError(
14332
+ throw new chunkDIK74MXX_cjs.ConfigurationError(
14175
14333
  "revisionOriginNow() requires revisionTracking: true or history: true.",
14176
14334
  { code: "REVISION_ORIGIN_REQUIRES_TRACKING" }
14177
14335
  );
14178
14336
  }
14179
- const pendingOrigin = this.#revisionOrigin ?? chunkXOX22WHL_cjs.ensureRevisionOrigin(this.#baseBackend, this.#sqlSchema(), this.graphId);
14337
+ const pendingOrigin = this.#revisionOrigin ?? chunkZUNQ5BEP_cjs.ensureRevisionOrigin(this.#baseBackend, this.#sqlSchema(), this.graphId);
14180
14338
  this.#revisionOrigin = pendingOrigin;
14181
14339
  try {
14182
14340
  return await pendingOrigin;
@@ -14222,7 +14380,7 @@ var Store = class _Store {
14222
14380
  * ```
14223
14381
  */
14224
14382
  snapshot() {
14225
- return this.asOf(chunkBLZDPRXT_cjs.nowIso());
14383
+ return this.asOf(chunkRSSQKPSZ_cjs.nowIso());
14226
14384
  }
14227
14385
  // === Search ===
14228
14386
  /**
@@ -14301,7 +14459,7 @@ var Store = class _Store {
14301
14459
  * @returns A tuple with per-query typed results, preserving input order
14302
14460
  */
14303
14461
  async batch(...queries) {
14304
- return chunk4TOD4LBZ_cjs.runOptionallyInTransaction(this.#baseBackend, async (target) => {
14462
+ return chunkX4JBT642_cjs.runOptionallyInTransaction(this.#baseBackend, async (target) => {
14305
14463
  const results = [];
14306
14464
  for (const query of queries) {
14307
14465
  const result = await query.executeOn(target);
@@ -14354,11 +14512,11 @@ var Store = class _Store {
14354
14512
  * @internal
14355
14513
  */
14356
14514
  subgraphAtCoordinate(rootId, options) {
14357
- const coordinate = chunkXOX22WHL_cjs.resolveReadCoordinate(
14515
+ const coordinate = chunkZUNQ5BEP_cjs.resolveReadCoordinate(
14358
14516
  options.temporalMode ?? this.#graph.defaults.temporalMode,
14359
14517
  options.asOf
14360
14518
  );
14361
- const readCoordinate = options.recordedAsOf === void 0 ? coordinate : chunkXOX22WHL_cjs.withRecordedCoordinate(coordinate, options.recordedAsOf);
14519
+ const readCoordinate = options.recordedAsOf === void 0 ? coordinate : chunkZUNQ5BEP_cjs.withRecordedCoordinate(coordinate, options.recordedAsOf);
14362
14520
  return executeSubgraph({
14363
14521
  graph: this.#graph,
14364
14522
  graphId: this.graphId,
@@ -14424,9 +14582,11 @@ var Store = class _Store {
14424
14582
  receiptRecorder
14425
14583
  ));
14426
14584
  }
14427
- const result = await invoke({
14585
+ const fallbackContext = {
14428
14586
  nodes,
14429
14587
  edges,
14588
+ // No real transaction: `tx.sql` is absent and there is no atomicity.
14589
+ sqlAvailability: "unavailable",
14430
14590
  backend: this.#backend,
14431
14591
  getNodeCollection: (kind) => this.#resolveDynamicNodeCollection(nodes, kind),
14432
14592
  // No transaction, no deferral: operations apply as they happen, so
@@ -14435,13 +14595,16 @@ var Store = class _Store {
14435
14595
  this.#createOperationContext(operation, "node", kind, id),
14436
14596
  hookedFunction
14437
14597
  )
14438
- });
14598
+ };
14599
+ const result = await invoke(
14600
+ receiptRecorder === void 0 ? fallbackContext : this.#attachMeasure(fallbackContext)
14601
+ );
14439
14602
  return { result, recordedByGraph: void 0 };
14440
14603
  }
14441
14604
  const pending = [];
14442
14605
  const runHooks = this.#createBufferedHookRunner(pending);
14443
14606
  let recordedByGraph;
14444
- const transactionOptions = receiptRecorder !== void 0 && this.#captureEnabled ? chunkXOX22WHL_cjs.withRecordedFlushObserver(backendOptions, (instants) => {
14607
+ const transactionOptions = receiptRecorder !== void 0 && this.#captureEnabled ? chunkZUNQ5BEP_cjs.withRecordedFlushObserver(backendOptions, (instants) => {
14445
14608
  recordedByGraph = instants;
14446
14609
  }) : backendOptions;
14447
14610
  try {
@@ -14470,87 +14633,13 @@ var Store = class _Store {
14470
14633
  throw error;
14471
14634
  }
14472
14635
  }
14473
- /**
14474
- * Adopts a caller-owned, already-open Drizzle transaction so the graph
14475
- * store and the caller's relational writes commit or roll back as one
14476
- * Postgres/SQLite transaction (#134).
14477
- *
14478
- * Use this when the **relational layer owns the transaction**: the
14479
- * caller has opened a transaction and needs TypeGraph writes enlisted
14480
- * on the *same* connection. Unlike {@link transaction}, this opens no
14481
- * transaction — the caller's transaction is the single commit/rollback
14482
- * boundary.
14483
- *
14484
- * `withTransaction` is driver-agnostic; how the caller opens the
14485
- * transaction is not. **Async drivers** (node-postgres,
14486
- * `neon-serverless` Pool, libsql) use `db.transaction(async …)`.
14487
- * **Synchronous `better-sqlite3`** cannot — its driver rejects an
14488
- * `async` transaction callback (`Transaction function cannot return a
14489
- * promise`) and the async continuation would run outside the
14490
- * rolled-back transaction — so the caller opens the transaction with
14491
- * explicit `BEGIN`/`COMMIT`/`ROLLBACK` on the single connection
14492
- * instead. See the "Cross-Store Transactions" recipe for both shapes.
14493
- *
14494
- * The returned context reuses this store's already-resolved
14495
- * schema/registry: it runs **no** schema bootstrap, `evolve`, or
14496
- * migration, and emits **no DDL** inside the caller's transaction.
14497
- * Fulltext operations assert the durable materialization marker (a
14498
- * cached SELECT) and throw {@link StoreNotInitializedError} on a
14499
- * missing/stale/failed marker rather than migrating mid-transaction —
14500
- * so boot the parent store via `createStoreWithSchema` once at
14501
- * startup.
14502
- *
14503
- * @example
14504
- * ```typescript
14505
- * // Async driver (Postgres / libsql):
14506
- * await db.transaction(async (sqlTx) => {
14507
- * const connector = await createConnectorRow(sqlTx, input); // Drizzle
14508
- * const txStore = store.withTransaction(sqlTx);
14509
- * await txStore.nodes.ArtifactSource.create({ // TypeGraph
14510
- * connectorId: connector.id,
14511
- * });
14512
- * }); // one COMMIT / ROLLBACK across both layers
14513
- * ```
14514
- *
14515
- * **The caller owns the connection — don't overlap writes on it.** The graph
14516
- * store and your Drizzle writes share the one connection the caller's
14517
- * transaction pinned. TypeGraph serializes the statements *its* collections
14518
- * issue, but your raw Drizzle statements (and any graph write run alongside
14519
- * them) are yours to sequence: a `Promise.all` mixing the two races two
14520
- * queries on that connection — the overlap Postgres removes in `pg@9`. Await
14521
- * each write before starting the next.
14522
- *
14523
- * Not available when the store was created with `{ history: true }`: a
14524
- * caller-owned transaction context would let writes happen after capture has
14525
- * lost its flush point, so this throws `ConfigurationError`
14526
- * (`RECORDED_CAPTURE_REQUIRES_CALLBACK_TRANSACTION`). Use
14527
- * {@link Store.withRecordedTransaction} on a history-enabled store, which
14528
- * adopts the same external transaction but flushes recorded-time capture
14529
- * before the caller commits.
14530
- *
14531
- * @throws {ConfigurationError} when the store has history capture enabled
14532
- * (use {@link Store.withRecordedTransaction} instead), or when the backend
14533
- * cannot adopt an external transaction — either it is not a Drizzle
14534
- * Postgres/SQLite backend, or `backend.capabilities.transactions` is `false`
14535
- * (`drizzle-orm/neon-http`, Cloudflare D1, SQLite
14536
- * `transactionMode: "none"`). A non-atomic fallback is deliberately
14537
- * not offered here: the caller's relational write *would* still
14538
- * commit, defeating the purpose of cross-store atomicity.
14539
- * @throws {StoreNotInitializedError} at point of use, when a fulltext
14540
- * operation on the returned context observes a missing/stale/failed
14541
- * durable materialization marker (parent store not booted via
14542
- * `createStoreWithSchema`). Rolls back the caller's transaction
14543
- * without emitting any DDL.
14544
- */
14545
14636
  withTransaction(externalTx) {
14546
14637
  if (this.#captureEnabled) {
14547
- throw chunkXOX22WHL_cjs.recordedCaptureRequiresCallbackTransactionError({
14548
- code: "RECORDED_CAPTURE_REQUIRES_CALLBACK_TRANSACTION"
14549
- });
14638
+ throw chunkZUNQ5BEP_cjs.recordedCaptureRequiresCallbackTransactionError();
14550
14639
  }
14551
14640
  const adopt = this.#backend.adoptTransaction;
14552
14641
  if (!adopt) {
14553
- throw new chunkLGEALRC6_cjs.ConfigurationError(
14642
+ throw new chunkDIK74MXX_cjs.ConfigurationError(
14554
14643
  "This backend cannot adopt an external transaction for cross-store atomicity. adoptTransaction is provided only by the Drizzle Postgres/SQLite backends with transaction support. Check backend.capabilities.transactions, or run the relational and graph writes as separate transactions with manual compensation.",
14555
14644
  { capability: "adoptTransaction" }
14556
14645
  );
@@ -14560,7 +14649,7 @@ var Store = class _Store {
14560
14649
  async withRecordedTransaction(externalTx, fn) {
14561
14650
  const adopt = this.#baseBackend.adoptTransaction;
14562
14651
  if (!adopt) {
14563
- throw new chunkLGEALRC6_cjs.ConfigurationError(
14652
+ throw new chunkDIK74MXX_cjs.ConfigurationError(
14564
14653
  "This backend cannot adopt an external transaction for recorded-time capture.",
14565
14654
  { capability: "adoptTransaction" },
14566
14655
  {
@@ -14570,21 +14659,66 @@ var Store = class _Store {
14570
14659
  }
14571
14660
  const txBackend = adopt(externalTx);
14572
14661
  if (this.#captureEnabled) {
14573
- await chunkXOX22WHL_cjs.assertRecordedCaptureTransactionIsolation(txBackend);
14662
+ await chunkZUNQ5BEP_cjs.assertRecordedCaptureTransactionIsolation(txBackend);
14574
14663
  }
14575
- const scope = this.#captureEnabled ? chunkXOX22WHL_cjs.createRecordedTransactionScope(txBackend, this.#sqlSchema()) : {
14664
+ const scope = this.#captureEnabled ? chunkZUNQ5BEP_cjs.createRecordedTransactionScope(txBackend, this.#sqlSchema()) : {
14576
14665
  backend: txBackend,
14577
- flush: () => Promise.resolve()
14666
+ flush: () => Promise.resolve(EMPTY_RECORDED_FLUSH_INSTANTS)
14578
14667
  };
14579
14668
  if (this.#captureEnabled) {
14580
- await chunkXOX22WHL_cjs.lockRecordedGraphWrite(scope.backend, this.graphId);
14669
+ await chunkZUNQ5BEP_cjs.lockRecordedGraphWrite(scope.backend, this.graphId);
14581
14670
  }
14671
+ const receiptRecorder = createTransactionReceiptRecorder();
14582
14672
  const invoke = fn;
14583
14673
  const result = await invoke(
14584
- this.#buildTransactionContext(scope.backend, externalTx)
14674
+ this.#buildTransactionContext(
14675
+ scope.backend,
14676
+ externalTx,
14677
+ void 0,
14678
+ receiptRecorder
14679
+ )
14680
+ );
14681
+ const recordedByGraph = await scope.flush();
14682
+ if (!this.#captureEnabled) receiptRecorder.seal();
14683
+ return transactionOutcome(
14684
+ result,
14685
+ receiptRecorder,
14686
+ recordedByGraph,
14687
+ this.graphId
14585
14688
  );
14586
- await scope.flush();
14587
- return result;
14689
+ }
14690
+ /**
14691
+ * Decorates a receipt-enabled transaction `context` with `measure`.
14692
+ * Attribution is structural: `measure` wraps the context's *own* (already
14693
+ * outer-recording) collections a second time with a fresh scope recorder, so a
14694
+ * write through the scoped context counts in the scope and — via the inner
14695
+ * wrapper it delegates to — the outer receipt, while a write through the outer
14696
+ * `context` never reaches the scope recorder. This makes overlapping/concurrent
14697
+ * measures safe by construction (each holds its own scope recorder) and lets
14698
+ * scopes nest: the scoped context is itself decorated, so `scoped.measure(...)`
14699
+ * chains one more wrapper. The scoped context's `getNodeCollection` resolves
14700
+ * against the scope-wrapped map too, so dynamic-kind writes are attributed like
14701
+ * `scoped.nodes.<Kind>`. The scope receipt's `recorded` is always undefined —
14702
+ * the recorded instant is a whole-transaction flush concern.
14703
+ */
14704
+ #attachMeasure(context) {
14705
+ const measure = async (fn) => {
14706
+ const scopeRecorder = createTransactionReceiptRecorder();
14707
+ const { nodes, edges } = wrapTransactionCollections(
14708
+ context.nodes,
14709
+ context.edges,
14710
+ scopeRecorder
14711
+ );
14712
+ const scoped = this.#attachMeasure({
14713
+ ...context,
14714
+ nodes,
14715
+ edges,
14716
+ getNodeCollection: (kind) => this.#resolveDynamicNodeCollection(nodes, kind)
14717
+ });
14718
+ const result = await fn(scoped);
14719
+ return { result, receipt: scopeRecorder.snapshot() };
14720
+ };
14721
+ return { ...context, measure };
14588
14722
  }
14589
14723
  /**
14590
14724
  * Builds the `{ nodes, edges, sql }` projection bound to a
@@ -14630,24 +14764,20 @@ var Store = class _Store {
14630
14764
  ));
14631
14765
  }
14632
14766
  const getNodeCollection = (kind) => this.#resolveDynamicNodeCollection(nodes, kind);
14633
- if (sql17 === void 0) {
14634
- return {
14635
- nodes,
14636
- edges,
14637
- backend: txBackend,
14638
- getNodeCollection,
14639
- runNodeOperationHooks
14640
- };
14641
- }
14642
- const exposedSql = this.#captureEnabled ? chunkXOX22WHL_cjs.createHistoryUnsafeSqlRef() : this.#revisionTrackingEnabled ? chunkXOX22WHL_cjs.createRevisionTrackingUnsafeSqlRef() : sql17;
14643
- return {
14767
+ const sqlAvailability = this.#captureEnabled ? "history" : this.#revisionTrackingEnabled ? "revisionTracking" : sql17 === void 0 ? "unavailable" : "available";
14768
+ const base = {
14644
14769
  nodes,
14645
14770
  edges,
14646
- sql: exposedSql,
14771
+ sqlAvailability,
14647
14772
  backend: txBackend,
14648
14773
  getNodeCollection,
14649
14774
  runNodeOperationHooks
14650
14775
  };
14776
+ const withSql = sql17 === void 0 ? base : {
14777
+ ...base,
14778
+ sql: this.#captureEnabled ? chunkZUNQ5BEP_cjs.createHistoryUnsafeSqlRef() : this.#revisionTrackingEnabled ? chunkZUNQ5BEP_cjs.createRevisionTrackingUnsafeSqlRef() : sql17
14779
+ };
14780
+ return receiptRecorder === void 0 ? withSql : this.#attachMeasure(withSql);
14651
14781
  }
14652
14782
  // === Graph Lifecycle ===
14653
14783
  /**
@@ -14662,12 +14792,12 @@ var Store = class _Store {
14662
14792
  async clear() {
14663
14793
  const doClear = async (target) => {
14664
14794
  if (this.#revisionTrackingEnabled) {
14665
- await chunkXOX22WHL_cjs.lockRecordedGraphWrite(target, this.graphId);
14795
+ await chunkZUNQ5BEP_cjs.lockRecordedGraphWrite(target, this.graphId);
14666
14796
  }
14667
- const previousRevision = this.#revisionTrackingEnabled && !this.#captureEnabled ? await chunkXOX22WHL_cjs.readRecordedClock(target, this.#sqlSchema(), this.graphId) : void 0;
14797
+ const previousRevision = this.#revisionTrackingEnabled && !this.#captureEnabled ? await chunkZUNQ5BEP_cjs.readRecordedClock(target, this.#sqlSchema(), this.graphId) : void 0;
14668
14798
  await target.clearGraph(this.graphId);
14669
14799
  if (this.#revisionTrackingEnabled && !this.#captureEnabled) {
14670
- await chunkXOX22WHL_cjs.advanceRevisionClock(
14800
+ await chunkZUNQ5BEP_cjs.advanceRevisionClock(
14671
14801
  target,
14672
14802
  this.#sqlSchema(),
14673
14803
  this.graphId,
@@ -14795,7 +14925,7 @@ var Store = class _Store {
14795
14925
  */
14796
14926
  async evolve(extension, options) {
14797
14927
  const { activeRow, baseline } = await this.#loadCaughtUp("evolve");
14798
- const merged = chunkCK5BVQOW_cjs.mergeGraphExtension(baseline, extension);
14928
+ const merged = chunkPWGX5DF5_cjs.mergeGraphExtension(baseline, extension);
14799
14929
  if (merged === baseline) {
14800
14930
  if (baseline === this.#graph) {
14801
14931
  if (options?.ref !== void 0) options.ref.current = this;
@@ -14817,7 +14947,7 @@ var Store = class _Store {
14817
14947
  const baselineDocument = baseline.extension ?? Object.freeze({});
14818
14948
  const classification = classifyModifications(baselineDocument, extension);
14819
14949
  if (classification.incompatible.length > 0) {
14820
- throw new chunkFL472AMI_cjs.IncompatibleChangeError(
14950
+ throw new chunkJ3LEGNQB_cjs.IncompatibleChangeError(
14821
14951
  classification.incompatible,
14822
14952
  this.graphId
14823
14953
  );
@@ -14831,7 +14961,7 @@ var Store = class _Store {
14831
14961
  );
14832
14962
  if (error !== void 0) throw error;
14833
14963
  }
14834
- const committed = await chunkCK5BVQOW_cjs.commitNewSchemaVersion(
14964
+ const committed = await chunkPWGX5DF5_cjs.commitNewSchemaVersion(
14835
14965
  this.#backend,
14836
14966
  merged,
14837
14967
  activeRow.version
@@ -14849,7 +14979,7 @@ var Store = class _Store {
14849
14979
  async #runEagerOrThrow(store, eager) {
14850
14980
  const result = await store.materializeIndexes(eager);
14851
14981
  if (result.results.some((entry2) => entry2.status === "failed")) {
14852
- throw new chunkLGEALRC6_cjs.EagerMaterializationError(result, this.graphId);
14982
+ throw new chunkDIK74MXX_cjs.EagerMaterializationError(result, this.graphId);
14853
14983
  }
14854
14984
  }
14855
14985
  /**
@@ -14965,7 +15095,7 @@ var Store = class _Store {
14965
15095
  const backend = this.#baseBackend;
14966
15096
  const strategy = backend.vectorStrategy;
14967
15097
  if (strategy === void 0 || backend.executeDdl === void 0) {
14968
- throw new chunkLGEALRC6_cjs.ConfigurationError(
15098
+ throw new chunkDIK74MXX_cjs.ConfigurationError(
14969
15099
  "reembedVectorField requires a backend with a vector strategy and executeDdl.",
14970
15100
  {
14971
15101
  backend: backend.dialect,
@@ -14978,7 +15108,7 @@ var Store = class _Store {
14978
15108
  (candidate) => candidate.entity === "vector" && candidate.kind === kind && candidate.fieldPath === fieldPath
14979
15109
  );
14980
15110
  if (declaration === void 0) {
14981
- throw new chunkLGEALRC6_cjs.ConfigurationError(
15111
+ throw new chunkDIK74MXX_cjs.ConfigurationError(
14982
15112
  `No embedding field "${kind}.${fieldPath}" is declared in the active schema.`,
14983
15113
  { kind, fieldPath, operation: "reembed" }
14984
15114
  );
@@ -15024,7 +15154,7 @@ var Store = class _Store {
15024
15154
  tableName,
15025
15155
  declaration
15026
15156
  );
15027
- const now = chunkBLZDPRXT_cjs.nowIso();
15157
+ const now = chunkRSSQKPSZ_cjs.nowIso();
15028
15158
  await backend.recordIndexMaterialization({
15029
15159
  indexName: vectorStatusKey(this.graphId, declaration.name),
15030
15160
  graphId: this.graphId,
@@ -15041,7 +15171,7 @@ var Store = class _Store {
15041
15171
  return { recreated: true, reembedded: 0 };
15042
15172
  }
15043
15173
  if (backend.upsertEmbedding === void 0) {
15044
- throw new chunkLGEALRC6_cjs.ConfigurationError(
15174
+ throw new chunkDIK74MXX_cjs.ConfigurationError(
15045
15175
  "reembedVectorField with an `embed` callback requires a backend that supports upsertEmbedding.",
15046
15176
  {
15047
15177
  backend: backend.dialect,
@@ -15127,9 +15257,9 @@ var Store = class _Store {
15127
15257
  );
15128
15258
  }
15129
15259
  const compileTimeGraph = stripGraphExtension(this.#graph);
15130
- const merged = plan.document === void 0 ? compileTimeGraph : chunkCK5BVQOW_cjs.mergeGraphExtension(compileTimeGraph, plan.document);
15131
- const finalGraph = chunkCK5BVQOW_cjs.applyDeprecatedKinds(merged, baseline.deprecatedKinds);
15132
- const committedRow = await chunkCK5BVQOW_cjs.commitNewSchemaVersion(
15260
+ const merged = plan.document === void 0 ? compileTimeGraph : chunkPWGX5DF5_cjs.mergeGraphExtension(compileTimeGraph, plan.document);
15261
+ const finalGraph = chunkPWGX5DF5_cjs.applyDeprecatedKinds(merged, baseline.deprecatedKinds);
15262
+ const committedRow = await chunkPWGX5DF5_cjs.commitNewSchemaVersion(
15133
15263
  this.#backend,
15134
15264
  finalGraph,
15135
15265
  activeRow.version
@@ -15139,7 +15269,7 @@ var Store = class _Store {
15139
15269
  if (this.#backend.ensureKindRemovalsTable !== void 0) {
15140
15270
  await this.#backend.ensureKindRemovalsTable();
15141
15271
  }
15142
- const attemptedAt = chunkBLZDPRXT_cjs.nowIso();
15272
+ const attemptedAt = chunkRSSQKPSZ_cjs.nowIso();
15143
15273
  const newSchemaVersion = committedRow.version;
15144
15274
  const queue = (kindName, entity) => recordKindRemoval(
15145
15275
  buildPendingKindRemoval({
@@ -15191,8 +15321,8 @@ var Store = class _Store {
15191
15321
  const nextSet = new Set(baseline.deprecatedKinds);
15192
15322
  if (direction === "add") {
15193
15323
  for (const name of names) {
15194
- if (!chunkVPYHY3LJ_cjs.isKnownKind(baseline, name)) {
15195
- throw new chunkLGEALRC6_cjs.KindNotFoundError(
15324
+ if (!chunk2THZ3TQI_cjs.isKnownKind(baseline, name)) {
15325
+ throw new chunkDIK74MXX_cjs.KindNotFoundError(
15196
15326
  name,
15197
15327
  isKnownEdgeKind(baseline, name) ? "edge" : "node",
15198
15328
  {
@@ -15217,8 +15347,8 @@ var Store = class _Store {
15217
15347
  schemaMetadataFromRow(activeRow)
15218
15348
  );
15219
15349
  }
15220
- const merged = chunkCK5BVQOW_cjs.applyDeprecatedKinds(baseline, nextSet);
15221
- const result = await chunkCK5BVQOW_cjs.ensureSchema(this.#backend, merged, {
15350
+ const merged = chunkPWGX5DF5_cjs.applyDeprecatedKinds(baseline, nextSet);
15351
+ const result = await chunkPWGX5DF5_cjs.ensureSchema(this.#backend, merged, {
15222
15352
  preloaded: { activeRow, storedSchema },
15223
15353
  autoMigrate: true
15224
15354
  });
@@ -15227,8 +15357,8 @@ var Store = class _Store {
15227
15357
  }
15228
15358
  #catchUpToStored(storedSchema) {
15229
15359
  const compileTimeGraph = stripGraphExtension(this.#graph);
15230
- const withGraphExtension = storedSchema.extension === void 0 ? compileTimeGraph : chunkCK5BVQOW_cjs.mergeGraphExtension(compileTimeGraph, storedSchema.extension);
15231
- return chunkCK5BVQOW_cjs.applyDeprecatedKinds(
15360
+ const withGraphExtension = storedSchema.extension === void 0 ? compileTimeGraph : chunkPWGX5DF5_cjs.mergeGraphExtension(compileTimeGraph, storedSchema.extension);
15361
+ return chunkPWGX5DF5_cjs.applyDeprecatedKinds(
15232
15362
  withGraphExtension,
15233
15363
  storedSchema.deprecatedKinds
15234
15364
  );
@@ -15246,18 +15376,18 @@ var Store = class _Store {
15246
15376
  * serializes the actual commit.
15247
15377
  */
15248
15378
  async #loadCaughtUp(verb) {
15249
- const activeRow = await chunkCK5BVQOW_cjs.loadActiveSchemaWithBootstrap(
15379
+ const activeRow = await chunkPWGX5DF5_cjs.loadActiveSchemaWithBootstrap(
15250
15380
  this.#backend,
15251
15381
  this.graphId
15252
15382
  );
15253
15383
  if (activeRow === void 0) {
15254
15384
  const { phrase, code } = CAUGHT_UP_VERB_DETAILS[verb];
15255
- throw new chunkLGEALRC6_cjs.ConfigurationError(
15385
+ throw new chunkDIK74MXX_cjs.ConfigurationError(
15256
15386
  `Cannot ${phrase} graph "${this.graphId}": no schema has been initialized. Call createStoreWithSchema first.`,
15257
15387
  { code }
15258
15388
  );
15259
15389
  }
15260
- const storedSchema = chunkCK5BVQOW_cjs.parseSerializedSchema(activeRow.schema_doc);
15390
+ const storedSchema = chunkPWGX5DF5_cjs.parseSerializedSchema(activeRow.schema_doc);
15261
15391
  const baseline = this.#catchUpToStored(storedSchema);
15262
15392
  return { activeRow, storedSchema, baseline };
15263
15393
  }
@@ -15351,7 +15481,7 @@ var Store = class _Store {
15351
15481
  // === Internal: Hook Helpers ===
15352
15482
  #createHookContext() {
15353
15483
  return {
15354
- operationId: chunkXOX22WHL_cjs.generateId(),
15484
+ operationId: chunkZUNQ5BEP_cjs.generateId(),
15355
15485
  graphId: this.graphId,
15356
15486
  startedAt: /* @__PURE__ */ new Date()
15357
15487
  };
@@ -15484,8 +15614,8 @@ async function createStoreWithSchema(graph, backend, options) {
15484
15614
  graph: merged,
15485
15615
  activeRow,
15486
15616
  storedSchema
15487
- } = await chunkCK5BVQOW_cjs.loadAndMergeGraphExtensionDocument(backend, graph);
15488
- const result = await chunkCK5BVQOW_cjs.ensureSchema(backend, merged, {
15617
+ } = await chunkPWGX5DF5_cjs.loadAndMergeGraphExtensionDocument(backend, graph);
15618
+ const result = await chunkPWGX5DF5_cjs.ensureSchema(backend, merged, {
15489
15619
  ...options,
15490
15620
  preloaded: { activeRow, storedSchema }
15491
15621
  });
@@ -15503,7 +15633,7 @@ async function createVerifiedStore(graph, backend, options) {
15503
15633
  graph: merged,
15504
15634
  activeRow,
15505
15635
  result
15506
- } = await chunkCK5BVQOW_cjs.loadAndVerifyGraph(backend, graph);
15636
+ } = await chunkPWGX5DF5_cjs.loadAndVerifyGraph(backend, graph);
15507
15637
  const store = new Store(
15508
15638
  merged,
15509
15639
  backend,
@@ -15548,5 +15678,5 @@ exports.min = min;
15548
15678
  exports.offsetFragment = offsetFragment;
15549
15679
  exports.orderByFragment = orderByFragment;
15550
15680
  exports.sum = sum;
15551
- //# sourceMappingURL=chunk-J7WFGBJR.cjs.map
15552
- //# sourceMappingURL=chunk-J7WFGBJR.cjs.map
15681
+ //# sourceMappingURL=chunk-7BQLPXK6.cjs.map
15682
+ //# sourceMappingURL=chunk-7BQLPXK6.cjs.map