@nicia-ai/typegraph 0.38.0 → 0.39.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 (95) hide show
  1. package/dist/backend/postgres/index.cjs +16 -16
  2. package/dist/backend/postgres/index.js +3 -3
  3. package/dist/backend/postgres/pglite-store.cjs +11 -11
  4. package/dist/backend/postgres/pglite-store.d.cts +1 -1
  5. package/dist/backend/postgres/pglite-store.d.ts +1 -1
  6. package/dist/backend/postgres/pglite-store.js +8 -8
  7. package/dist/backend/postgres/pglite.cjs +5 -5
  8. package/dist/backend/postgres/pglite.js +4 -4
  9. package/dist/backend/sqlite/index.cjs +6 -6
  10. package/dist/backend/sqlite/index.js +3 -3
  11. package/dist/backend/sqlite/libsql.cjs +5 -5
  12. package/dist/backend/sqlite/libsql.js +3 -3
  13. package/dist/backend/sqlite/local-store.cjs +11 -11
  14. package/dist/backend/sqlite/local-store.d.cts +1 -1
  15. package/dist/backend/sqlite/local-store.d.ts +1 -1
  16. package/dist/backend/sqlite/local-store.js +9 -9
  17. package/dist/backend/sqlite/local.cjs +6 -6
  18. package/dist/backend/sqlite/local.js +4 -4
  19. package/dist/{chunk-UPXDVI3T.js → chunk-3SK4SVTW.js} +3 -3
  20. package/dist/{chunk-UPXDVI3T.js.map → chunk-3SK4SVTW.js.map} +1 -1
  21. package/dist/{chunk-NU23DUSJ.cjs → chunk-3YFDFOYB.cjs} +7 -7
  22. package/dist/{chunk-NU23DUSJ.cjs.map → chunk-3YFDFOYB.cjs.map} +1 -1
  23. package/dist/{chunk-NWYCOFEZ.cjs → chunk-5ELKD2FQ.cjs} +4 -4
  24. package/dist/chunk-5ELKD2FQ.cjs.map +1 -0
  25. package/dist/{chunk-2SL7OGPR.cjs → chunk-6SRLCSAV.cjs} +478 -338
  26. package/dist/chunk-6SRLCSAV.cjs.map +1 -0
  27. package/dist/{chunk-A2FGSWMQ.js → chunk-CBK2IVI2.js} +167 -27
  28. package/dist/chunk-CBK2IVI2.js.map +1 -0
  29. package/dist/{chunk-TE5ZA4VX.js → chunk-DOKUXLFH.js} +14 -10
  30. package/dist/chunk-DOKUXLFH.js.map +1 -0
  31. package/dist/{chunk-KCLZHYPU.cjs → chunk-E2Q7SP2K.cjs} +52 -52
  32. package/dist/{chunk-KCLZHYPU.cjs.map → chunk-E2Q7SP2K.cjs.map} +1 -1
  33. package/dist/{chunk-YLINFV7Z.cjs → chunk-GKQU44SQ.cjs} +67 -63
  34. package/dist/chunk-GKQU44SQ.cjs.map +1 -0
  35. package/dist/{chunk-O5H62ZWJ.cjs → chunk-HP6LWBLB.cjs} +14 -2
  36. package/dist/chunk-HP6LWBLB.cjs.map +1 -0
  37. package/dist/{chunk-7VLCN3JB.cjs → chunk-HTQOBY75.cjs} +59 -59
  38. package/dist/{chunk-7VLCN3JB.cjs.map → chunk-HTQOBY75.cjs.map} +1 -1
  39. package/dist/{chunk-RQPRCEIO.js → chunk-IFDXG2YJ.js} +3 -3
  40. package/dist/chunk-IFDXG2YJ.js.map +1 -0
  41. package/dist/{chunk-YJDSPA5E.js → chunk-IFRPHG7O.js} +4 -4
  42. package/dist/{chunk-YJDSPA5E.js.map → chunk-IFRPHG7O.js.map} +1 -1
  43. package/dist/{chunk-LZ3TVJY4.cjs → chunk-JD2YC62H.cjs} +17 -17
  44. package/dist/{chunk-LZ3TVJY4.cjs.map → chunk-JD2YC62H.cjs.map} +1 -1
  45. package/dist/{chunk-XD6X7O5R.js → chunk-KAFXPB2L.js} +4 -4
  46. package/dist/{chunk-XD6X7O5R.js.map → chunk-KAFXPB2L.js.map} +1 -1
  47. package/dist/{chunk-ZHX4KEM7.cjs → chunk-KIZSHRUI.cjs} +7 -7
  48. package/dist/{chunk-ZHX4KEM7.cjs.map → chunk-KIZSHRUI.cjs.map} +1 -1
  49. package/dist/{chunk-G32AO634.js → chunk-KXFUQNF2.js} +3 -3
  50. package/dist/{chunk-G32AO634.js.map → chunk-KXFUQNF2.js.map} +1 -1
  51. package/dist/{chunk-E6YZRKMM.js → chunk-NQBYTLPW.js} +4 -4
  52. package/dist/{chunk-E6YZRKMM.js.map → chunk-NQBYTLPW.js.map} +1 -1
  53. package/dist/{chunk-VBH7ZXSZ.js → chunk-SU7VQOJ3.js} +3 -3
  54. package/dist/{chunk-VBH7ZXSZ.js.map → chunk-SU7VQOJ3.js.map} +1 -1
  55. package/dist/{chunk-KFLXWVUJ.js → chunk-UUIBACKJ.js} +14 -3
  56. package/dist/chunk-UUIBACKJ.js.map +1 -0
  57. package/dist/{chunk-CQC6VBAF.cjs → chunk-VXAFOF6Z.cjs} +5 -5
  58. package/dist/{chunk-CQC6VBAF.cjs.map → chunk-VXAFOF6Z.cjs.map} +1 -1
  59. package/dist/{chunk-XFY73JWD.cjs → chunk-Y6UA55YS.cjs} +5 -5
  60. package/dist/{chunk-XFY73JWD.cjs.map → chunk-Y6UA55YS.cjs.map} +1 -1
  61. package/dist/{chunk-6G5CQ6JX.js → chunk-YPUNPG2T.js} +4 -4
  62. package/dist/{chunk-6G5CQ6JX.js.map → chunk-YPUNPG2T.js.map} +1 -1
  63. package/dist/graph-merge/index.cjs +30 -32
  64. package/dist/graph-merge/index.cjs.map +1 -1
  65. package/dist/graph-merge/index.d.cts +10 -5
  66. package/dist/graph-merge/index.d.ts +10 -5
  67. package/dist/graph-merge/index.js +9 -11
  68. package/dist/graph-merge/index.js.map +1 -1
  69. package/dist/index.cjs +68 -68
  70. package/dist/index.d.cts +2 -2
  71. package/dist/index.d.ts +2 -2
  72. package/dist/index.js +5 -5
  73. package/dist/interchange/index.cjs +23 -23
  74. package/dist/interchange/index.d.cts +1 -1
  75. package/dist/interchange/index.d.ts +1 -1
  76. package/dist/interchange/index.js +4 -4
  77. package/dist/profiler/index.d.cts +1 -1
  78. package/dist/profiler/index.d.ts +1 -1
  79. package/dist/provenance/index.cjs +11 -11
  80. package/dist/provenance/index.d.cts +1 -1
  81. package/dist/provenance/index.d.ts +1 -1
  82. package/dist/provenance/index.js +2 -2
  83. package/dist/schema/index.cjs +22 -22
  84. package/dist/schema/index.js +3 -3
  85. package/dist/{store-view-BoHqdHjB.d.cts → store-view-BJd6Vwpt.d.cts} +39 -17
  86. package/dist/{store-view-Ctq-3OHy.d.ts → store-view-CLIhwMMX.d.ts} +39 -17
  87. package/package.json +1 -1
  88. package/dist/chunk-2SL7OGPR.cjs.map +0 -1
  89. package/dist/chunk-A2FGSWMQ.js.map +0 -1
  90. package/dist/chunk-KFLXWVUJ.js.map +0 -1
  91. package/dist/chunk-NWYCOFEZ.cjs.map +0 -1
  92. package/dist/chunk-O5H62ZWJ.cjs.map +0 -1
  93. package/dist/chunk-RQPRCEIO.js.map +0 -1
  94. package/dist/chunk-TE5ZA4VX.js.map +0 -1
  95. package/dist/chunk-YLINFV7Z.cjs.map +0 -1
@@ -1,15 +1,15 @@
1
1
  import { compareStrings, compareCodePoints } from './chunk-DRACN6XG.js';
2
2
  import { createEdgeRowMapper, createNodeRowMapper, SQLITE_ROW_MAPPER_CONFIG, POSTGRES_ROW_MAPPER_CONFIG } from './chunk-AOL64O4Z.js';
3
- import { rowToNode, executeNodeBulkFindByIndex, executeNodeBulkFindByConstraint, executeNodeFindByConstraint, executeNodeBulkGetOrCreateByConstraint, executeNodeGetOrCreateByConstraint, executeNodeHardDelete, executeNodeDelete, nodeUpsertDirtyCheck, executeNodeUpsertUpdate, executeNodeUpdate, executeNodeCreateNoReturnBatch, executeNodeCreateBatch, executeNodeCreate, rowToEdge, runInWriteTransaction, checkCardinalityConstraint, runHookedWriteOperation, rowToNodeMeta, rowToEdgeMeta } from './chunk-UPXDVI3T.js';
4
- import { isParameterRef, fieldRef, buildFieldBuilderForTypeInfo, stringField, createFulltextAccessor, storeRuntime, CURRENT_READ_INSTANT_PLACEHOLDER, DEFAULT_SQL_SCHEMA, requireSqlSchema, recordedReadSchemaFor, withPinnedReadInstant, STORE_RUNTIME, assertRevisionTrackableBackend, createSqlSchema, requireExternalRecordedReadSource, createRecordedReadBinding, createRecordedBackend, readRecordedClock, ensureRevisionOrigin, TRANSACTION_RUNTIME, withRecordedFlushObserver, recordedCaptureRequiresCallbackTransactionError, assertRecordedCaptureTransactionIsolation, createRecordedTransactionScope, lockRecordedGraphWrite, generateId, createGraphBackendProjection, vectorSlotKey, baseField, objectField, arrayField, dateField, numberField, computeFulltextContent, AUTO_REFRESH_STATISTICS_ROW_THRESHOLD, throwHistoryUnsafeSqlAccess, throwRevisionTrackingUnsafeSqlAccess, advanceRevisionClock, recordedReadSqlSchema, requireRecordedReadBinding, runInsertBatch, edgeInsertDispatch, runInsertBatchReturning, projectBackendMembers, sqlValueList, getEmbeddingFields, getNodeRowsByIds, getEdgeRowsByIds, compileKindFilter, currentReadInstant, compileTemporalFilter, validateEdgeEndpoints, buildPredicateIndex, compileFieldValue, recordedBindParamBudget, extractVectorSimilarityPredicates, extractFulltextMatchPredicates, currentReadInstantFor, extractTemporalOptions, compilePredicateExpression, getPredicatesForAlias, getFieldPointer, getNodeKindsForAlias, getHybridTargetAlias, closeRecordedHardDeletedKind, compilePredicateClauses, ALIAS_CTE_PREFIX, EMBEDDINGS_CTE_ALIAS, FULLTEXT_CTE_ALIAS, HYBRID_CANDIDATES_CTE_ALIAS } from './chunk-RQPRCEIO.js';
3
+ import { rowToNode, executeNodeBulkFindByIndex, executeNodeBulkFindByConstraint, executeNodeFindByConstraint, executeNodeBulkGetOrCreateByConstraint, executeNodeGetOrCreateByConstraint, executeNodeHardDelete, executeNodeDelete, nodeUpsertDirtyCheck, executeNodeUpsertUpdate, executeNodeUpdate, executeNodeCreateNoReturnBatch, executeNodeCreateBatch, executeNodeCreate, rowToEdge, runInWriteTransaction, checkCardinalityConstraint, runHookedWriteOperation, rowToNodeMeta, rowToEdgeMeta } from './chunk-3SK4SVTW.js';
4
+ import { isParameterRef, fieldRef, buildFieldBuilderForTypeInfo, stringField, createFulltextAccessor, storeRuntime, CURRENT_READ_INSTANT_PLACEHOLDER, DEFAULT_SQL_SCHEMA, requireSqlSchema, recordedReadSchemaFor, withPinnedReadInstant, STORE_RUNTIME, assertRevisionTrackableBackend, createSqlSchema, requireExternalRecordedReadSource, createRecordedReadBinding, createRecordedBackend, readRecordedClock, ensureRevisionOrigin, TRANSACTION_RUNTIME, withRecordedFlushObserver, recordedCaptureRequiresCallbackTransactionError, assertRecordedCaptureTransactionIsolation, createRecordedTransactionScope, lockRecordedGraphWrite, generateId, createGraphBackendProjection, vectorSlotKey, baseField, objectField, arrayField, dateField, numberField, computeFulltextContent, AUTO_REFRESH_STATISTICS_ROW_THRESHOLD, advanceRevisionClock, recordedReadSqlSchema, requireRecordedReadBinding, runInsertBatch, edgeInsertDispatch, runInsertBatchReturning, projectBackendMembers, sqlValueList, getEmbeddingFields, getNodeRowsByIds, getEdgeRowsByIds, compileKindFilter, currentReadInstant, compileTemporalFilter, validateEdgeEndpoints, buildPredicateIndex, compileFieldValue, recordedBindParamBudget, extractVectorSimilarityPredicates, extractFulltextMatchPredicates, currentReadInstantFor, extractTemporalOptions, compilePredicateExpression, getPredicatesForAlias, getFieldPointer, getNodeKindsForAlias, getHybridTargetAlias, closeRecordedHardDeletedKind, throwHistoryUnsafeSqlAccess, throwRevisionTrackingUnsafeSqlAccess, compilePredicateClauses, ALIAS_CTE_PREFIX, EMBEDDINGS_CTE_ALIAS, FULLTEXT_CTE_ALIAS, HYBRID_CANDIDATES_CTE_ALIAS } from './chunk-IFDXG2YJ.js';
5
5
  import { chunk } from './chunk-35S6P5ZU.js';
6
6
  import { runOptionallyInTransaction, createTransactionReadBackend, rowPropsToObject, createBackendOverlay, INTERNAL_TEMPORARY_WRITES } from './chunk-PZHC5GCD.js';
7
7
  import { resolveReadCoordinate, withRecordedCoordinate, describeCoordinate, coordinateContext, asRecordedInstant, assertValidRecordedInstant } from './chunk-J6IJARLG.js';
8
- import { loadAndMergeGraphExtensionDocument, ensureSchema, loadAndVerifyGraph, buildKindRegistry, mergeGraphExtension, commitNewSchemaVersion, applyDeprecatedKinds, loadActiveSchemaWithBootstrap, parseSerializedSchema, extensionKindNames, serializeSchemaProperties, buildGraphExtensionOntologyKeySet, compileTimeOntologyKey, serializeIndexDeclaration } from './chunk-VBH7ZXSZ.js';
8
+ import { loadAndMergeGraphExtensionDocument, ensureSchema, loadAndVerifyGraph, buildKindRegistry, mergeGraphExtension, commitNewSchemaVersion, applyDeprecatedKinds, loadActiveSchemaWithBootstrap, parseSerializedSchema, extensionKindNames, serializeSchemaProperties, buildGraphExtensionOntologyKeySet, compileTimeOntologyKey, serializeIndexDeclaration } from './chunk-SU7VQOJ3.js';
9
9
  import { getTypeName } from './chunk-76HE7DJP.js';
10
10
  import { validateEdgeProps } from './chunk-ZE6NVENI.js';
11
11
  import { canonicalEqual, sortedReplacer } from './chunk-UR7W5YQK.js';
12
- import { withRecordedRelationsPrecondition, isMissingTableError } from './chunk-KFLXWVUJ.js';
12
+ import { withRecordedRelationsPrecondition, isMissingTableError } from './chunk-UUIBACKJ.js';
13
13
  import { isKnownKind } from './chunk-PH4IJ3V5.js';
14
14
  import { nowIso, validateOptionalCanonicalIsoDate } from './chunk-I6FX7AAG.js';
15
15
  import { generateIndexDDL } from './chunk-U4JDJKPD.js';
@@ -183,7 +183,7 @@ function createBatchReadRefusal(entity, method, coordinate) {
183
183
  function createRecordedUnsupportedRefusal(entity, method, coordinate) {
184
184
  return () => Promise.reject(
185
185
  new ConfigurationError(
186
- `'${method}' is not available on a RecordedStoreView (${describeCoordinate(coordinate)}). Recorded-time reads are reconstructing reads; this view exposes only query, subgraph, graph algorithms, and point getById/getByIds collection reads.`,
186
+ `'${method}' is not available on a RecordedStoreView (${describeCoordinate(coordinate)}). Recorded-time reads are reconstructing reads; this view exposes only query, subgraph, graph algorithms, and collection getById/getByIds/scan reads.`,
187
187
  {
188
188
  code: "RECORDED_STORE_VIEW_UNSUPPORTED",
189
189
  entity,
@@ -314,14 +314,16 @@ function pinnedEdgeCollectionsFor(store, coordinate, wrap) {
314
314
  function recordedNodeCollection(store, kind, live, coordinate) {
315
315
  const reads = {
316
316
  getById: (id) => storeRuntime(store).recordedNodeGetById(kind, id, coordinate),
317
- getByIds: (ids) => storeRuntime(store).recordedNodeGetByIds(kind, ids, coordinate)
317
+ getByIds: (ids) => storeRuntime(store).recordedNodeGetByIds(kind, ids, coordinate),
318
+ scan: (options) => storeRuntime(store).recordedNodeScan(kind, coordinate, options)
318
319
  };
319
320
  return recordedCollectionProxy(reads, live, coordinate, "node");
320
321
  }
321
322
  function recordedEdgeCollection(store, kind, live, coordinate) {
322
323
  const reads = {
323
324
  getById: (id) => storeRuntime(store).recordedEdgeGetById(kind, id, coordinate),
324
- getByIds: (ids) => storeRuntime(store).recordedEdgeGetByIds(kind, ids, coordinate)
325
+ getByIds: (ids) => storeRuntime(store).recordedEdgeGetByIds(kind, ids, coordinate),
326
+ scan: (options) => storeRuntime(store).recordedEdgeScan(kind, coordinate, options)
325
327
  };
326
328
  return recordedCollectionProxy(reads, live, coordinate, "edge");
327
329
  }
@@ -619,7 +621,7 @@ var RecordedStoreView = class extends CoordinatePinnedView {
619
621
  }
620
622
  return recorded.asOf;
621
623
  }
622
- /** Recorded-time node point-read collections. */
624
+ /** Recorded-time node reconstructing-read collections. */
623
625
  get nodes() {
624
626
  this.#nodes ??= pinnedNodeCollectionsFor(
625
627
  this.store,
@@ -628,7 +630,7 @@ var RecordedStoreView = class extends CoordinatePinnedView {
628
630
  );
629
631
  return this.#nodes;
630
632
  }
631
- /** Recorded-time edge point-read collections. */
633
+ /** Recorded-time edge reconstructing-read collections. */
632
634
  get edges() {
633
635
  this.#edges ??= pinnedEdgeCollectionsFor(
634
636
  this.store,
@@ -16352,6 +16354,7 @@ async function executeEdgeBulkGetOrCreateByEndpoints(ctx, kind, items, backend,
16352
16354
 
16353
16355
  // src/store/recorded-read-service.ts
16354
16356
  var RECORDED_POINT_READ_FIXED_BIND_PARAMS = 8;
16357
+ var RECORDED_SCAN_LIMIT = 1e3;
16355
16358
  function recordedPointReadIdChunk(backend) {
16356
16359
  const budget = recordedBindParamBudget(backend);
16357
16360
  return Math.max(1, budget - RECORDED_POINT_READ_FIXED_BIND_PARAMS);
@@ -16396,7 +16399,7 @@ function recordedTemporalFilter(backend, coordinate, tableAlias) {
16396
16399
  }
16397
16400
  function recordedRelationInvariantError(params) {
16398
16401
  return new ConfigurationError(
16399
- "Recorded relation invariant violation: more than one recorded row matched the requested point read.",
16402
+ "Recorded relation invariant violation: more than one recorded row matched the requested read.",
16400
16403
  {
16401
16404
  code: "RECORDED_RELATION_INVARIANT_VIOLATION",
16402
16405
  graphId: params.graphId,
@@ -16412,6 +16415,57 @@ function recordedRelationInvariantError(params) {
16412
16415
  }
16413
16416
  );
16414
16417
  }
16418
+ function validateRecordedScanLimit(limit) {
16419
+ if (limit === void 0) return RECORDED_SCAN_LIMIT;
16420
+ if (!Number.isInteger(limit) || limit <= 0 || limit > RECORDED_SCAN_LIMIT) {
16421
+ throw new ValidationError(
16422
+ `Recorded scan limit must be an integer between 1 and ${RECORDED_SCAN_LIMIT}, got: ${String(limit)}`,
16423
+ {
16424
+ issues: [
16425
+ {
16426
+ path: "limit",
16427
+ message: `Must be an integer between 1 and ${RECORDED_SCAN_LIMIT}.`
16428
+ }
16429
+ ]
16430
+ }
16431
+ );
16432
+ }
16433
+ return limit;
16434
+ }
16435
+ function recordedScanCursorScope(graphId, entity, kind, coordinate) {
16436
+ return JSON.stringify([
16437
+ "recorded-scan",
16438
+ graphId,
16439
+ entity,
16440
+ kind,
16441
+ coordinate.valid.mode,
16442
+ coordinate.valid.asOf,
16443
+ coordinate.recorded?.asOf
16444
+ ]);
16445
+ }
16446
+ function invalidRecordedScanCursor() {
16447
+ return new ValidationError(
16448
+ "Recorded scan cursor does not match this graph, collection, or temporal coordinate.",
16449
+ {
16450
+ issues: [
16451
+ {
16452
+ path: "after",
16453
+ message: "Use a cursor returned by the same recorded collection scan."
16454
+ }
16455
+ ]
16456
+ }
16457
+ );
16458
+ }
16459
+ function decodeRecordedScanCursor(cursor, expectedScope) {
16460
+ const decoded = decodeCursor(cursor);
16461
+ if (decoded.d !== "f" || decoded.cols.length !== 1 || decoded.cols[0] !== expectedScope || decoded.vals.length !== 1 || typeof decoded.vals[0] !== "string") {
16462
+ throw invalidRecordedScanCursor();
16463
+ }
16464
+ return decoded.vals[0];
16465
+ }
16466
+ function encodeRecordedScanCursor(id, scope) {
16467
+ return encodeCursor({ v: 1, d: "f", vals: [id], cols: [scope] });
16468
+ }
16415
16469
  function createRecordedReadService(params) {
16416
16470
  const {
16417
16471
  graphId,
@@ -16421,6 +16475,11 @@ function createRecordedReadService(params) {
16421
16475
  mapRecordedEdgeRow
16422
16476
  } = params;
16423
16477
  const recordedSchema = recordedReadBinding === void 0 ? void 0 : recordedReadSqlSchema(recordedReadBinding);
16478
+ function schemaForRecordedRead(surface) {
16479
+ return recordedSchema ?? recordedReadSqlSchema(
16480
+ requireRecordedReadBinding(recordedReadBinding, surface)
16481
+ );
16482
+ }
16424
16483
  async function recordedGetByIds(read) {
16425
16484
  const { table, alias, kind, ids, coordinate, toEntity, entity } = read;
16426
16485
  if (ids.length === 0) return [];
@@ -16463,10 +16522,51 @@ function createRecordedReadService(params) {
16463
16522
  }
16464
16523
  return ids.map((id) => byId.get(id));
16465
16524
  }
16525
+ async function recordedScan(scan) {
16526
+ const { table, alias, kind, coordinate, options, toEntity, entity } = scan;
16527
+ const limit = validateRecordedScanLimit(options?.limit);
16528
+ const scope = recordedScanCursorScope(graphId, entity, kind, coordinate);
16529
+ const after = options?.after === void 0 ? void 0 : decodeRecordedScanCursor(options.after, scope);
16530
+ const aliasSql = sql.raw(alias);
16531
+ const temporalFilter = recordedTemporalFilter(backend, coordinate, alias);
16532
+ const rows = await withRelationsPrecondition(
16533
+ backend,
16534
+ backend.execute(
16535
+ asCompiledRowsSql(sql`
16536
+ SELECT * FROM ${table} ${aliasSql}
16537
+ WHERE ${aliasSql}.graph_id = ${graphId}
16538
+ AND ${aliasSql}.kind = ${kind}
16539
+ ${after === void 0 ? sql.raw("") : sql`AND ${aliasSql}.id > ${after}`}
16540
+ AND ${temporalFilter}
16541
+ ORDER BY ${aliasSql}.id ASC, ${aliasSql}.recorded_from ASC
16542
+ LIMIT ${limit + 1}
16543
+ `)
16544
+ ),
16545
+ "recorded-scan"
16546
+ );
16547
+ const entities = rows.map((row) => toEntity(row));
16548
+ for (let index = 1; index < entities.length; index += 1) {
16549
+ const previous = requireDefined(entities[index - 1]);
16550
+ const current = requireDefined(entities[index]);
16551
+ if (previous.id !== current.id) continue;
16552
+ throw recordedRelationInvariantError({
16553
+ graphId,
16554
+ entity,
16555
+ kind,
16556
+ id: current.id,
16557
+ coordinate
16558
+ });
16559
+ }
16560
+ const hasNextPage = entities.length > limit;
16561
+ const data = hasNextPage ? entities.slice(0, limit) : entities;
16562
+ return {
16563
+ data,
16564
+ nextCursor: hasNextPage ? encodeRecordedScanCursor(requireDefined(data.at(-1)).id, scope) : void 0,
16565
+ hasNextPage
16566
+ };
16567
+ }
16466
16568
  function nodeGetByIds(kind, ids, coordinate) {
16467
- const schema = recordedSchema ?? recordedReadSqlSchema(
16468
- requireRecordedReadBinding(recordedReadBinding, "recorded-point-read")
16469
- );
16569
+ const schema = schemaForRecordedRead("recorded-point-read");
16470
16570
  return recordedGetByIds({
16471
16571
  entity: "node",
16472
16572
  table: schema.nodesTable,
@@ -16478,9 +16578,7 @@ function createRecordedReadService(params) {
16478
16578
  });
16479
16579
  }
16480
16580
  function edgeGetByIds(kind, ids, coordinate) {
16481
- const schema = recordedSchema ?? recordedReadSqlSchema(
16482
- requireRecordedReadBinding(recordedReadBinding, "recorded-point-read")
16483
- );
16581
+ const schema = schemaForRecordedRead("recorded-point-read");
16484
16582
  return recordedGetByIds({
16485
16583
  entity: "edge",
16486
16584
  table: schema.edgesTable,
@@ -16491,6 +16589,30 @@ function createRecordedReadService(params) {
16491
16589
  toEntity: (row) => rowToEdge(mapRecordedEdgeRow(row))
16492
16590
  });
16493
16591
  }
16592
+ function nodeScan(kind, coordinate, options) {
16593
+ const schema = schemaForRecordedRead("recorded-scan");
16594
+ return recordedScan({
16595
+ entity: "node",
16596
+ table: schema.nodesTable,
16597
+ alias: "n",
16598
+ kind,
16599
+ coordinate,
16600
+ options,
16601
+ toEntity: (row) => rowToNode(mapRecordedNodeRow(row))
16602
+ });
16603
+ }
16604
+ function edgeScan(kind, coordinate, options) {
16605
+ const schema = schemaForRecordedRead("recorded-scan");
16606
+ return recordedScan({
16607
+ entity: "edge",
16608
+ table: schema.edgesTable,
16609
+ alias: "e",
16610
+ kind,
16611
+ coordinate,
16612
+ options,
16613
+ toEntity: (row) => rowToEdge(mapRecordedEdgeRow(row))
16614
+ });
16615
+ }
16494
16616
  return {
16495
16617
  backendForCoordinate(coordinate, surface) {
16496
16618
  if (coordinate.recorded === void 0) return backend;
@@ -16502,11 +16624,13 @@ function createRecordedReadService(params) {
16502
16624
  return results[0];
16503
16625
  },
16504
16626
  nodeGetByIds,
16627
+ nodeScan,
16505
16628
  async edgeGetById(kind, id, coordinate) {
16506
16629
  const results = await edgeGetByIds(kind, [id], coordinate);
16507
16630
  return results[0];
16508
16631
  },
16509
- edgeGetByIds
16632
+ edgeGetByIds,
16633
+ edgeScan
16510
16634
  };
16511
16635
  }
16512
16636
 
@@ -16732,6 +16856,13 @@ function overlayPropertyDescriptors(base, overlay) {
16732
16856
  ...Object.getOwnPropertyDescriptors(overlay)
16733
16857
  });
16734
16858
  }
16859
+ function defineUnavailableSqlGuard(context, guard) {
16860
+ Object.defineProperty(context, "sql", {
16861
+ configurable: false,
16862
+ enumerable: true,
16863
+ get: guard
16864
+ });
16865
+ }
16735
16866
  function syncStoreReplacementRef(ref, replacement) {
16736
16867
  if (ref === void 0) return;
16737
16868
  ref.current = replacement;
@@ -16810,8 +16941,10 @@ var StoreImplementation = class _StoreImplementation {
16810
16941
  sealedQuery: (coordinate) => this.sealedQuery(coordinate),
16811
16942
  recordedNodeGetById: (kind, id, coordinate) => this.recordedNodeGetById(kind, id, coordinate),
16812
16943
  recordedNodeGetByIds: (kind, ids, coordinate) => this.recordedNodeGetByIds(kind, ids, coordinate),
16944
+ recordedNodeScan: (kind, coordinate, options2) => this.recordedNodeScan(kind, coordinate, options2),
16813
16945
  recordedEdgeGetById: (kind, id, coordinate) => this.recordedEdgeGetById(kind, id, coordinate),
16814
16946
  recordedEdgeGetByIds: (kind, ids, coordinate) => this.recordedEdgeGetByIds(kind, ids, coordinate),
16947
+ recordedEdgeScan: (kind, coordinate, options2) => this.recordedEdgeScan(kind, coordinate, options2),
16815
16948
  subgraphAtCoordinate: (rootId, subgraphOptions) => this.subgraphAtCoordinate(rootId, subgraphOptions),
16816
16949
  algorithmsAtCoordinate: (coordinate) => this.algorithmsAtCoordinate(coordinate)
16817
16950
  };
@@ -17287,6 +17420,10 @@ var StoreImplementation = class _StoreImplementation {
17287
17420
  async recordedNodeGetByIds(kind, ids, coordinate) {
17288
17421
  return this.#recordedReads.nodeGetByIds(kind, ids, coordinate);
17289
17422
  }
17423
+ /** @internal Bounded recorded-time node enumeration for RecordedStoreView. */
17424
+ async recordedNodeScan(kind, coordinate, options) {
17425
+ return this.#recordedReads.nodeScan(kind, coordinate, options);
17426
+ }
17290
17427
  /**
17291
17428
  * Internal seam for {@link RecordedStoreView}: reconstruct an edge point read
17292
17429
  * from the recorded-time relation while preserving live getById behavior.
@@ -17305,6 +17442,10 @@ var StoreImplementation = class _StoreImplementation {
17305
17442
  async recordedEdgeGetByIds(kind, ids, coordinate) {
17306
17443
  return this.#recordedReads.edgeGetByIds(kind, ids, coordinate);
17307
17444
  }
17445
+ /** @internal Bounded recorded-time edge enumeration for RecordedStoreView. */
17446
+ async recordedEdgeScan(kind, coordinate, options) {
17447
+ return this.#recordedReads.edgeScan(kind, coordinate, options);
17448
+ }
17308
17449
  // === Temporal Views ===
17309
17450
  /**
17310
17451
  * Returns a read-only {@link StoreView} pinned to a valid-time instant.
@@ -17950,19 +18091,18 @@ var StoreImplementation = class _StoreImplementation {
17950
18091
  if (this.#captureEnabled) {
17951
18092
  withSql = {
17952
18093
  ...base,
17953
- sqlAvailability: "history",
17954
- get sql() {
17955
- return throwHistoryUnsafeSqlAccess();
17956
- }
18094
+ sqlAvailability: "history"
17957
18095
  };
18096
+ defineUnavailableSqlGuard(withSql, () => throwHistoryUnsafeSqlAccess());
17958
18097
  } else if (this.#revisionTrackingEnabled) {
17959
18098
  withSql = {
17960
18099
  ...base,
17961
- sqlAvailability: "revisionTracking",
17962
- get sql() {
17963
- return throwRevisionTrackingUnsafeSqlAccess();
17964
- }
18100
+ sqlAvailability: "revisionTracking"
17965
18101
  };
18102
+ defineUnavailableSqlGuard(
18103
+ withSql,
18104
+ () => throwRevisionTrackingUnsafeSqlAccess()
18105
+ );
17966
18106
  } else if (sql2 === void 0) {
17967
18107
  withSql = { ...base, sqlAvailability: "unavailable" };
17968
18108
  } else {
@@ -19055,5 +19195,5 @@ async function createVerifiedAdapterStore(graph, backend, options) {
19055
19195
  }
19056
19196
 
19057
19197
  export { ExecutableAggregateQuery, ExecutableQuery, MAX_EXPLICIT_RECURSIVE_DEPTH, MAX_RECURSIVE_DEPTH, PreparedQuery, QueryBuilder, RecordedStoreView, StoreSearch, StoreView, UnionableQuery, avg, composeFragments, count, countDistinct, countDistinctEdges, countEdges, createAdapterStore, createAdapterStoreWithSchema, createFragment, createQueryBuilder, createStore, createStoreWithSchema, createVerifiedAdapterStore, createVerifiedStore, defineSubgraphProject, field, having, havingEq, havingGt, havingGte, havingLt, havingLte, limitFragment, max, min, offsetFragment, orderByFragment, sum };
19058
- //# sourceMappingURL=chunk-A2FGSWMQ.js.map
19059
- //# sourceMappingURL=chunk-A2FGSWMQ.js.map
19198
+ //# sourceMappingURL=chunk-CBK2IVI2.js.map
19199
+ //# sourceMappingURL=chunk-CBK2IVI2.js.map