@lunora/shard-engine 1.0.0-alpha.4 → 1.0.0-alpha.40

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 (146) hide show
  1. package/dist/conformance/index.mjs +1 -1
  2. package/dist/index.d.mts +345 -26
  3. package/dist/index.d.ts +345 -26
  4. package/dist/index.mjs +1 -1
  5. package/dist/packem_shared/ADMIN_FUNCTIONS-DcSYybsq.mjs +1 -0
  6. package/dist/packem_shared/AGGREGATE_SQL_FUNCTION-m1iUU1rv.mjs +1 -0
  7. package/dist/packem_shared/AGG_COUNT-B6_CmAZD.mjs +1 -0
  8. package/dist/packem_shared/AUDIT_LOG_TABLE-uNVU9O1W.mjs +8 -0
  9. package/dist/packem_shared/CDC_LOG_TABLE-CW0wHEgW.mjs +15 -0
  10. package/dist/packem_shared/CLIENT_WATERMARK_TABLE-BoS1HEqz.mjs +7 -0
  11. package/dist/packem_shared/COMMIT_SEQ_FIELD-CSe_oNZu.mjs +4 -0
  12. package/dist/packem_shared/CountRlsUnsupportedError-Bdfupt3g.mjs +1 -0
  13. package/dist/packem_shared/DATA_MIGRATION_STATE_TABLE-4l6aU1Vc.mjs +31 -0
  14. package/dist/packem_shared/DEFAULT_MAX_RELATION_KEYS-BAWGIEvC.mjs +1 -0
  15. package/dist/packem_shared/DEFAULT_MAX_RELAYS-BPv7jVgK.mjs +1 -0
  16. package/dist/packem_shared/DEFAULT_PROMOTION_THRESHOLDS-H2sHFvlw.mjs +1 -0
  17. package/dist/packem_shared/DEFAULT_TRANSACTION_LIMITS-Bcoi7Bvf.mjs +1 -0
  18. package/dist/packem_shared/DurableStreamRunner-DDBi1UXj.mjs +1 -0
  19. package/dist/packem_shared/GEO_DEFAULT_PRECISION-CqpQZ-J_.mjs +1 -0
  20. package/dist/packem_shared/GLOBAL_SHAPE_SNAPSHOT_TABLE-NWaL77m5.mjs +7 -0
  21. package/dist/packem_shared/GlobalPollTick-BNK4o-XT.mjs +1 -0
  22. package/dist/packem_shared/IDEMPOTENCY_TABLE-DKVe2Ohf.mjs +7 -0
  23. package/dist/packem_shared/MAIL_RETENTION-Cig9Dmc8.mjs +18 -0
  24. package/dist/packem_shared/MAX_SQL_ROWS-gsiUV0Eo.mjs +5 -0
  25. package/dist/packem_shared/NotUniqueError-Dnik6z41.mjs +1 -0
  26. package/dist/packem_shared/QUEUE_TABLE-zj9Tt6tk.mjs +17 -0
  27. package/dist/packem_shared/RANK_TIEBREAK-ci3MaM65.mjs +1 -0
  28. package/dist/packem_shared/REACTOR_STATE_TABLE-Cr9Orfp8.mjs +28 -0
  29. package/dist/packem_shared/RELATION_EXISTS_KEY-CFUhnZSZ.mjs +1 -0
  30. package/dist/packem_shared/REPROJECTION_MIGRATION_PREFIX-Czcb6_mO.mjs +1 -0
  31. package/dist/packem_shared/RLS_UNWRAP_SYMBOL-BWloGsd3.mjs +1 -0
  32. package/dist/packem_shared/ReactiveCache-DlJ38txF.mjs +1 -0
  33. package/dist/packem_shared/SCAN_DEP-D7qE3iUe.mjs +1 -0
  34. package/dist/packem_shared/SCHEMA_HISTORY_MAX_VERSIONS-DsycDXWm.mjs +6 -0
  35. package/dist/packem_shared/SEARCH_STATE_TABLE-Dju8ebbU.mjs +1 -0
  36. package/dist/packem_shared/SHAPE_POKE_CURSOR_TABLE-BBuXXk5v.mjs +7 -0
  37. package/dist/packem_shared/ShapeDiffCache-mE7ZzdPr.mjs +1 -0
  38. package/dist/packem_shared/ShardRunner-C9p5DVOx.mjs +1 -0
  39. package/dist/packem_shared/UNVOUCHABLE_DEP-C68htACn.mjs +1 -0
  40. package/dist/packem_shared/aggregateTableName-Cy5e03oz.mjs +1 -0
  41. package/dist/packem_shared/appendStreamChunk-CH4e4nJn.mjs +19 -0
  42. package/dist/packem_shared/applyOnDelete-BlcwKjuO.mjs +1 -0
  43. package/dist/packem_shared/applySelect-BQbHyo-W.mjs +1 -0
  44. package/dist/packem_shared/{armRestore-BNzdvQ_o.mjs → armRestore-Bu1_8SUa.mjs} +1 -1
  45. package/dist/packem_shared/awaitWsDrain-CeaR5jj8.mjs +1 -0
  46. package/dist/packem_shared/backfillAggregateIndexes-C9wGiPH4.mjs +1 -0
  47. package/dist/packem_shared/base64-DfpzS4o_.mjs +1 -0
  48. package/dist/packem_shared/buildIndexRange-CBKQmHSS.mjs +1 -0
  49. package/dist/packem_shared/buildPokeFrames-BhYUbqzO.mjs +1 -0
  50. package/dist/packem_shared/buildReprojectionMigration-D0f-sshM.mjs +1 -0
  51. package/dist/packem_shared/buildSettings-B4igo4rJ.mjs +1 -0
  52. package/dist/packem_shared/buildShapeDiff-C3sZW3bZ.mjs +1 -0
  53. package/dist/packem_shared/clearMemoryTables-CXULwypv.mjs +1 -0
  54. package/dist/packem_shared/compileWhereSql-JBpSfQm9.mjs +1 -0
  55. package/dist/packem_shared/computeRankPage-Bby1Npkd.mjs +1 -0
  56. package/dist/packem_shared/createCompanionSync-Cfju9Ng2.mjs +1 -0
  57. package/dist/packem_shared/createReplicaLink-Bv7250Ef.mjs +7 -0
  58. package/dist/packem_shared/createSystemReader-BtYeSMDb.mjs +1 -0
  59. package/dist/packem_shared/ctx-db-companions-BQRTS_WY.mjs +1 -0
  60. package/dist/packem_shared/ctx-db-relay-shapes-Jf5xpD1r.mjs +17 -0
  61. package/dist/packem_shared/defineEngineContractSuite-CjxJNwwG.mjs +1 -0
  62. package/dist/packem_shared/diffExternalSource-DbHrcoZK.mjs +1 -0
  63. package/dist/packem_shared/do-sql-DbEszTyj.mjs +1 -0
  64. package/dist/packem_shared/envOptionalPositiveInt-D2pY-c64.mjs +1 -0
  65. package/dist/packem_shared/estimate-bytes-CzG5x1f8.mjs +1 -0
  66. package/dist/packem_shared/exportShardRows-Cgt3ITwH.mjs +1 -0
  67. package/dist/packem_shared/hasTrigger-CjlwI4le.mjs +1 -0
  68. package/dist/packem_shared/isSoftDeleted-D0iaSrDV.mjs +9 -0
  69. package/dist/packem_shared/liftSourceId-CA3ENhXj.mjs +1 -0
  70. package/dist/packem_shared/materializeExternalRows-CX55UoV7.mjs +1 -0
  71. package/dist/packem_shared/mergeChangedKeys-D1T-TPUb.mjs +1 -0
  72. package/dist/packem_shared/param-Ib8WHnrF.mjs +1 -0
  73. package/dist/packem_shared/quoteIdentifier-CObIFRhb.mjs +1 -0
  74. package/dist/packem_shared/runDrizzle-it6rL9bR.mjs +1 -0
  75. package/dist/packem_shared/runShardMigrations-DFc_LoP-.mjs +5 -0
  76. package/dist/packem_shared/runSocketPool-CZJ2X9cF.mjs +1 -0
  77. package/dist/packem_shared/selectExpiredIds-w4fPtlwT.mjs +1 -0
  78. package/dist/packem_shared/selectShapeMembers-C0vtU60D.mjs +1 -0
  79. package/dist/packem_shared/serializeSqlValue-DbI1VQYM.mjs +1 -0
  80. package/dist/packem_shared/sibling-channel-Cxvk0Zca.mjs +1 -0
  81. package/dist/packem_shared/sql-projection-BqmxFxQU.mjs +1 -0
  82. package/dist/packem_shared/stableStringify-G9OF5wcs.mjs +1 -0
  83. package/dist/packem_shared/stableWireKey-DSCJB6E7.mjs +1 -0
  84. package/dist/packem_shared/wire-codec-BU9T2xJ7.mjs +1 -0
  85. package/package.json +3 -3
  86. package/dist/packem_shared/ADMIN_FUNCTIONS-B0xlQJ4w.mjs +0 -1
  87. package/dist/packem_shared/AGGREGATE_SQL_FUNCTION-QYaiuty4.mjs +0 -1
  88. package/dist/packem_shared/AGG_COUNT-BWXe3gtQ.mjs +0 -1
  89. package/dist/packem_shared/AUDIT_LOG_TABLE-CaA0jL0L.mjs +0 -8
  90. package/dist/packem_shared/CDC_LOG_TABLE-BnqlH2eZ.mjs +0 -8
  91. package/dist/packem_shared/CLIENT_WATERMARK_TABLE-CXsSLU8D.mjs +0 -7
  92. package/dist/packem_shared/CountRlsUnsupportedError-B2WKJD9v.mjs +0 -1
  93. package/dist/packem_shared/DATA_MIGRATION_STATE_TABLE-BZMVrLcy.mjs +0 -31
  94. package/dist/packem_shared/DEFAULT_MAX_RELATION_KEYS-bq00btqV.mjs +0 -1
  95. package/dist/packem_shared/DEFAULT_MAX_RELAYS-CnCyh6oX.mjs +0 -1
  96. package/dist/packem_shared/DEFAULT_PROMOTION_THRESHOLDS-Dteg0sZF.mjs +0 -1
  97. package/dist/packem_shared/DEFAULT_TRANSACTION_LIMITS--TtB8Gpo.mjs +0 -1
  98. package/dist/packem_shared/FTS_COUNT_COLUMN-D1gY3wwZ-CZHdaRrd.mjs +0 -1
  99. package/dist/packem_shared/GEO_DEFAULT_PRECISION-okRCkZ6r.mjs +0 -1
  100. package/dist/packem_shared/GLOBAL_SHAPE_SNAPSHOT_TABLE-DX-6-gBP.mjs +0 -7
  101. package/dist/packem_shared/IDEMPOTENCY_TABLE-DjkEMp6w.mjs +0 -7
  102. package/dist/packem_shared/MAIL_RETENTION-KmozO2NQ.mjs +0 -18
  103. package/dist/packem_shared/MAX_SQL_ROWS-nMwkxv5f.mjs +0 -2
  104. package/dist/packem_shared/NotUniqueError-iGKd9wRR.mjs +0 -1
  105. package/dist/packem_shared/QUEUE_TABLE-DYCDvzTG.mjs +0 -17
  106. package/dist/packem_shared/RANK_TIEBREAK-9NU5s_mi.mjs +0 -1
  107. package/dist/packem_shared/RELATION_EXISTS_KEY-BaqSIFU1.mjs +0 -1
  108. package/dist/packem_shared/RLS_UNWRAP_SYMBOL-C6_WX3dG.mjs +0 -1
  109. package/dist/packem_shared/ReactiveCache-CF21t8IB.mjs +0 -1
  110. package/dist/packem_shared/SCAN_DEP-D_yR9EeV.mjs +0 -1
  111. package/dist/packem_shared/SCHEMA_HISTORY_MAX_VERSIONS-CHXz6p_z.mjs +0 -6
  112. package/dist/packem_shared/SEARCH_STATE_TABLE-eLN8U5tz.mjs +0 -1
  113. package/dist/packem_shared/ShardRunner-DIqVdWtk.mjs +0 -1
  114. package/dist/packem_shared/aggregateTableName-G-eXyjcz.mjs +0 -1
  115. package/dist/packem_shared/applyOnDelete-uFRC5p1d.mjs +0 -1
  116. package/dist/packem_shared/applySelect-B0CF8T7y.mjs +0 -1
  117. package/dist/packem_shared/awaitWsDrain-Dk50ISgE.mjs +0 -1
  118. package/dist/packem_shared/backfillAggregateIndexes-BHiewuB-.mjs +0 -1
  119. package/dist/packem_shared/buildIndexRange-DIjFVgeO.mjs +0 -1
  120. package/dist/packem_shared/buildPokeFrames-DaPpm5Ss.mjs +0 -1
  121. package/dist/packem_shared/buildSettings-DT18_DkX.mjs +0 -1
  122. package/dist/packem_shared/compileWhereSql-BLcfs4QW.mjs +0 -1
  123. package/dist/packem_shared/computeRankPage-IUSS-zIB.mjs +0 -1
  124. package/dist/packem_shared/createCompanionSync-DWK0Vlg1.mjs +0 -1
  125. package/dist/packem_shared/createReadFootprint-DIrrxRTE.mjs +0 -1
  126. package/dist/packem_shared/createSystemReader-DcDcrtM3.mjs +0 -1
  127. package/dist/packem_shared/defineEngineContractSuite-BefTibvY.mjs +0 -1
  128. package/dist/packem_shared/diffExternalSource-DMpkJta1.mjs +0 -1
  129. package/dist/packem_shared/estimate-bytes-DzD3PdCc.mjs +0 -1
  130. package/dist/packem_shared/exportShardRows-kt42wijd.mjs +0 -1
  131. package/dist/packem_shared/hasTrigger-CbkOHExZ.mjs +0 -1
  132. package/dist/packem_shared/isSoftDeleted-B-SXkGUo.mjs +0 -9
  133. package/dist/packem_shared/liftSourceId-DApAbu7Q.mjs +0 -1
  134. package/dist/packem_shared/materializeExternalRows-DOQJV9p2.mjs +0 -1
  135. package/dist/packem_shared/mergeChangedKeys-CvSHlkv-.mjs +0 -1
  136. package/dist/packem_shared/param-B5lF5Jd9.mjs +0 -1
  137. package/dist/packem_shared/quote-identifier-CGiYFBvY.mjs +0 -1
  138. package/dist/packem_shared/runDrizzle-GKR3y97k.mjs +0 -1
  139. package/dist/packem_shared/runShardMigrations-CPxqCh3O.mjs +0 -5
  140. package/dist/packem_shared/runSocketPool-DPQLVyWF.mjs +0 -1
  141. package/dist/packem_shared/selectExpiredIds-FzhIEeG1.mjs +0 -1
  142. package/dist/packem_shared/selectShapeMemberIds-DvE7K6zG.mjs +0 -1
  143. package/dist/packem_shared/serializeSqlValue-DnpyaLcw.mjs +0 -1
  144. package/dist/packem_shared/stableStringify-BjLh4gvA.mjs +0 -1
  145. package/dist/packem_shared/stableWireKey-YEHLaX6X.mjs +0 -1
  146. package/dist/packem_shared/wire-codec-Ctnni0h6.mjs +0 -1
package/dist/index.d.mts CHANGED
@@ -180,9 +180,11 @@ interface SchemaLike {
180
180
  }
181
181
  interface TableDefinitionLike {
182
182
  readonly aggregateIndexes?: ReadonlyArray<AggregateIndexDefinitionLike>;
183
+ readonly commitOrderedMode?: boolean;
183
184
  readonly geoIndexes?: ReadonlyArray<GeoIndexDefinitionLike>;
184
185
  readonly indexes: ReadonlyArray<IndexDefinitionLike>;
185
186
  readonly isPublic?: boolean;
187
+ readonly memoryMode?: boolean;
186
188
  readonly rankIndexes?: ReadonlyArray<RankIndexDefinitionLike>;
187
189
  readonly relationMap?: Record<string, RelationDefinitionLike>;
188
190
  readonly searchIndexes?: ReadonlyArray<SearchIndexDefinitionLike>;
@@ -230,6 +232,7 @@ interface ResolveWithOptions {
230
232
  groupedCounter: (tableName: string, whereField: string, values: unknown[], policyWhere?: WhereInput) => Promise<Map<unknown, number>>;
231
233
  parents: Record<string, unknown>[];
232
234
  relationBaseWhere?: (table: string) => undefined | WhereInput;
235
+ relationMask?: RelationMask;
233
236
  schema: {
234
237
  readonly tables: Record<string, TableDefinitionLike>;
235
238
  };
@@ -250,11 +253,19 @@ interface QueryArgs {
250
253
  limit?: number;
251
254
  orderBy?: OrderByInput[];
252
255
  relationBaseWhere?: (table: string) => undefined | WhereInput;
256
+ relationMask?: RelationMask;
253
257
  restrictsCounts?: boolean;
254
258
  select?: ReadonlyArray<string>;
255
259
  where?: WhereInput;
256
260
  with?: WithInput;
257
261
  }
262
+ interface CrossShardReadArgs {
263
+ orderBy?: OrderByInput[];
264
+ relationPolicies?: Record<string, WhereInput>;
265
+ where?: WhereInput;
266
+ with?: WithInput;
267
+ }
268
+ type RelationMask = (table: string, rows: Record<string, unknown>[]) => Record<string, unknown>[];
258
269
  interface QueryPage {
259
270
  continueCursor: null | string;
260
271
  isDone: boolean;
@@ -359,9 +370,21 @@ interface GeoFilterBuilderLike {
359
370
  };
360
371
  }) => GeoFilterBuilderLike;
361
372
  }
373
+ type ScoredDocument = GeoScoredDocument | SearchScoredDocument;
374
+ interface GeoScoredDocument {
375
+ distanceMeters: null | number;
376
+ document: Record<string, unknown>;
377
+ score?: never;
378
+ }
379
+ interface SearchScoredDocument {
380
+ distanceMeters?: never;
381
+ document: Record<string, unknown>;
382
+ score: number;
383
+ }
362
384
  interface TableReaderLike {
363
385
  [Symbol.asyncIterator]: () => AsyncIterator<Record<string, unknown>>;
364
386
  collect: () => Promise<Record<string, unknown>[]>;
387
+ collectWithScores: () => Promise<ScoredDocument[]>;
365
388
  filter: (predicate: (document: Record<string, unknown>) => boolean) => TableReaderLike;
366
389
  first: () => Promise<Record<string, unknown> | null>;
367
390
  order: (direction: "asc" | "desc") => TableReaderLike;
@@ -402,6 +425,13 @@ interface MutationDelta {
402
425
  interface DatabaseWriterLike {
403
426
  aggregate: (tableName: string, options: AggregateOptions) => Promise<AggregateResult>;
404
427
  asId?: (tableName: string, id: string) => string;
428
+ cdcChangedTables?: (sinceSeq: number, options?: {
429
+ cursorOnly?: boolean;
430
+ }) => Promise<{
431
+ cursor: number;
432
+ floor?: number;
433
+ tables: string[];
434
+ } | undefined>;
405
435
  count: (tableName: string, where?: RestrictableQueryOptions | WhereInput) => Promise<number>;
406
436
  delete: (id: string, expectedTable?: string, options?: {
407
437
  hard?: boolean;
@@ -600,6 +630,7 @@ declare class ReactiveCache {
600
630
  };
601
631
  private dropRangeDeps;
602
632
  private collectAndDrop;
633
+ private dropKeys;
603
634
  private dropEntry;
604
635
  private evict;
605
636
  }
@@ -638,12 +669,18 @@ interface RunTriggersOptions {
638
669
  }
639
670
  declare const runTriggers: (options: RunTriggersOptions) => Promise<void>;
640
671
  declare const hasTrigger: (schema: SchemaLike, tableName: string, op: TriggerOpLike) => boolean;
672
+ interface SearchBackfillProgress {
673
+ done: boolean;
674
+ pages: number;
675
+ }
641
676
  declare const backfillAggregateIndexes: (sql: SqlExec, schema: SchemaLike) => void;
642
677
  declare const backfillRankIndexes: (sql: SqlExec, schema: SchemaLike) => void;
643
678
  declare const backfillSearchIndexesForTable: (sql: SqlExec, tableName: string, definition: {
644
679
  searchIndexes?: ReadonlyArray<SearchIndexDefinitionLike>;
645
680
  }) => void;
646
- declare const backfillSearchIndexes: (sql: SqlExec, schema: SchemaLike) => void;
681
+ declare const backfillSearchIndexes: (sql: SqlExec, schema: SchemaLike, options?: {
682
+ maxPages?: number;
683
+ }) => SearchBackfillProgress;
647
684
  declare const CDC_LOG_TABLE = "__cdc_log";
648
685
  interface CdcChange {
649
686
  doc?: Record<string, unknown>;
@@ -653,6 +690,7 @@ interface CdcChange {
653
690
  table: string;
654
691
  ts: number;
655
692
  }
693
+ declare const CDC_LOG_TABLE_SEQ_INDEX = "__cdc_log_table_seq";
656
694
  declare const migrateCdcLog: (sql: SqlExec) => void;
657
695
  declare const appendCdcChange: (sql: SqlExec, ts: number, table: string, id: string, op: CdcChange["op"], doc: Record<string, unknown> | undefined) => void;
658
696
  declare const readCdcChanges: (sql: SqlExec, options?: {
@@ -663,9 +701,22 @@ declare const readCdcChanges: (sql: SqlExec, options?: {
663
701
  changes: CdcChange[];
664
702
  cursor: number;
665
703
  };
666
- declare const trimCdcChanges: (sql: SqlExec, throughSeq: number) => void;
704
+ declare const cdcTouchesTables: (sql: SqlExec, sinceSeq: number, tables: ReadonlySet<string>) => boolean;
705
+ declare const cdcCanVouchFor: (sql: SqlExec, deps: ReadonlySet<string>) => boolean;
706
+ interface CdcChangeKey {
707
+ id: string;
708
+ op: CdcChange["op"];
709
+ seq: number;
710
+ }
711
+ declare const readCdcChangeKeys: (sql: SqlExec, table: string, sinceSeq: number, upTo: number) => CdcChangeKey[];
712
+ declare const trimCdcChanges: (sql: SqlExec, throughSeq: number, maxRows: number) => void;
713
+ declare const compactCdcDocs: (sql: SqlExec, throughSeq: number, maxRows: number) => void;
714
+ declare const cdcSeqLeavingRows: (sql: SqlExec, keep: number) => number | undefined;
667
715
  declare const readCdcCursor: (sql: SqlExec) => number;
716
+ declare const cursorBelowRetainedFloor: (floor: number | undefined, sinceSeq: number) => boolean;
717
+ declare const cdcTrimmedError: (floor: number, sinceSeq: number, scope: "global" | "shard") => LunoraError;
668
718
  declare const minCdcSeq: (sql: SqlExec) => number | undefined;
719
+ declare const minCdcReplayableSeq: (sql: SqlExec) => number | undefined;
669
720
  declare const CDC_META_TABLE = "__cdc_meta";
670
721
  declare const migrateCdcMeta: (sql: SqlExec) => void;
671
722
  declare const readCdcEpoch: (sql: SqlExec) => string;
@@ -735,7 +786,7 @@ interface ShapeRow {
735
786
  id: string;
736
787
  }
737
788
  declare const selectShapeRows: (sql: SqlExec, table: string, effectiveWhere: WhereInput | undefined) => ShapeRow[];
738
- declare const selectShapeMemberIds: (sql: SqlExec, table: string, effectiveWhere: WhereInput | undefined, ids: ReadonlyArray<string>) => Set<string>;
789
+ declare const selectShapeMembers: (sql: SqlExec, table: string, effectiveWhere: WhereInput | undefined, ids: ReadonlyArray<string>) => Map<string, Record<string, unknown>>;
739
790
  interface SqlExec {
740
791
  exec: <Row = Record<string, unknown>>(sql: string, ...params: unknown[]) => SqlCursor<Row>;
741
792
  }
@@ -764,6 +815,7 @@ interface CtxDbOptions {
764
815
  globalDb?: DatabaseWriterLike;
765
816
  headroom?: TransactionHeadroomTracker;
766
817
  idGenerator?: IdGenerator;
818
+ inTransaction?: () => boolean;
767
819
  maxRelationKeys?: number;
768
820
  onIndexUse?: IndexUseHook;
769
821
  onRead?: ReadHook;
@@ -803,6 +855,11 @@ declare const readAuditLog: (sql: SqlExec, options?: {
803
855
  limit?: number;
804
856
  sinceSeq?: number;
805
857
  }) => AuditEntry[];
858
+ declare const COMMIT_SEQ_TABLE = "__commit_seq";
859
+ declare const COMMIT_SEQ_FIELD = "_commitSeq";
860
+ declare const migrateCommitSeq: (sql: SqlExec) => void;
861
+ declare const readCommitSeq: (sql: SqlExec) => number;
862
+ declare const allocateCommitSeq: (sql: SqlExec) => number;
806
863
  interface SubscriptionQuery {
807
864
  args?: Record<string, unknown>;
808
865
  functionPath?: string;
@@ -817,9 +874,11 @@ interface ShapeSubscriptionQuery {
817
874
  sinceSeq?: number;
818
875
  }
819
876
  interface SubscriptionEnvelope {
877
+ caps?: string[];
820
878
  clientId?: string;
821
879
  context?: Record<string, unknown>;
822
880
  data?: unknown;
881
+ generation?: number;
823
882
  id: string;
824
883
  query?: SubscriptionQuery;
825
884
  shape?: {
@@ -827,6 +886,7 @@ interface SubscriptionEnvelope {
827
886
  name: string;
828
887
  };
829
888
  sinceCheckpoint?: number;
889
+ sinceChunk?: number;
830
890
  sinceEpoch?: string;
831
891
  topic?: string;
832
892
  type: "ack" | "connect" | "shape_subscribe" | "shape_unsubscribe" | "stream" | "subscribe" | "unsubscribe" | "whisper" | "whisper_subscribe" | "whisper_unsubscribe";
@@ -843,6 +903,7 @@ interface SocketAttachment {
843
903
  context?: Record<string, unknown>;
844
904
  expiresAt?: number;
845
905
  identity?: Record<string, unknown>;
906
+ pageDeltas?: boolean;
846
907
  shapes?: Record<string, ShapeSubscriptionQuery>;
847
908
  subs: Record<string, SubscriptionQuery>;
848
909
  userId?: string;
@@ -888,6 +949,9 @@ interface CompanionSync {
888
949
  syncSearch: (tableName: string, id: string, document: Record<string, unknown> | undefined, previous?: Record<string, unknown>) => void;
889
950
  }
890
951
  declare const createCompanionSync: (deps: CompanionSyncDeps) => CompanionSync;
952
+ declare const isMemoryTable: (definition: TableDefinitionLike | undefined) => boolean;
953
+ declare const memoryTableNames: (schema: SchemaLike) => string[];
954
+ declare const clearMemoryTables: (sql: SqlExec, schema: SchemaLike) => number;
891
955
  interface RankPageDeps {
892
956
  assertRankPartitionLocal: (tableName: string, definition: TableDefinitionLike, index: RankIndexDefinitionLike) => void;
893
957
  ensureRankBackfilled: (tableName: string, index: RankIndexDefinitionLike) => void;
@@ -907,6 +971,13 @@ interface RankPageComputation {
907
971
  }
908
972
  declare const hydrateDocsById: (deps: RankPageDeps, tableName: string, ids: ReadonlyArray<string>) => Map<string, Record<string, unknown>>;
909
973
  declare const computeRankPage: (deps: RankPageDeps, tableName: string, indexName: string, rankPageOptions: RankPageOptions) => RankPageComputation;
974
+ declare const SHAPE_POKE_CURSOR_TABLE = "__shape_poke_cursor";
975
+ declare const migrateShapePokeCursor: (sql: SqlExec) => void;
976
+ declare const readShapePokeCursor: (sql: SqlExec, connectionId: string, subId: string) => number | undefined;
977
+ declare const writeShapePokeCursor: (sql: SqlExec, connectionId: string, subId: string, cursor: number) => void;
978
+ declare const minShapePokeCursor: (sql: SqlExec) => number | undefined;
979
+ declare const deleteShapePokeCursor: (sql: SqlExec, connectionId: string, subId: string) => void;
980
+ declare const deleteShapePokeCursorsForConnection: (sql: SqlExec, connectionId: string) => void;
910
981
  declare const DATA_MIGRATION_STATE_TABLE = "__lunora_migrations";
911
982
  type MigrationDirection = "down" | "up";
912
983
  type MigrationStatus = "completed" | "failed" | "in_progress";
@@ -970,10 +1041,10 @@ interface DependencyTracker {
970
1041
  declare const createDependencyTracker: () => DependencyTracker;
971
1042
  declare const runSql: <Row = Record<string, unknown>>(sql: SqlExec, query: string, ...params: unknown[]) => SqlCursor<Row>;
972
1043
  declare const runDrizzle: <Row = Record<string, unknown>>(exec: SqlExec, query: SQL) => SqlCursor<Row>;
1044
+ declare const quoteIdentifier: (name: string) => string;
973
1045
  declare const serializeSqlValue: (value: unknown) => unknown;
974
1046
  declare const DOC_COLUMN = "__doc__";
975
1047
  declare const geoTableName: (table: string, indexName: string) => string;
976
- declare const quoteIdentifier: (name: string) => string;
977
1048
  declare const jsonPath: (field: string) => string;
978
1049
  declare const jsonPathSql: (field: string) => SQL;
979
1050
  declare const qualifiedJsonPath: (table: string, field: string) => string;
@@ -983,7 +1054,7 @@ declare const AGG_KEY: Name;
983
1054
  declare const AGG_VALUE: Name;
984
1055
  declare const AGG_COUNT: Name;
985
1056
  declare const aggUpsertSql: (aggTable: string, key: unknown, value: unknown, count: unknown, set: SQL) => SQL;
986
- declare const tableColumns: (definition: TableDefinitionLike) => [string, ColumnMetaLike][];
1057
+ declare const tableColumns: (definition: TableDefinitionLike) => ReadonlyArray<readonly [string, ColumnMetaLike]>;
987
1058
  declare const rowToDocument: (row: Record<string, unknown> | undefined) => Record<string, unknown> | undefined;
988
1059
  declare const tryRowToDocument: (row: Record<string, unknown> | undefined) => Record<string, unknown> | undefined;
989
1060
  declare const isFtsAvailable: (sql: SqlExec) => boolean;
@@ -994,6 +1065,79 @@ interface RenderedSql {
994
1065
  }
995
1066
  declare const renderSql: (engine: SqlEngine, query: SQL) => RenderedSql;
996
1067
  declare const param: (value: unknown) => SQL;
1068
+ declare const unionAll: (branches: ReadonlyArray<SQL>) => SQL;
1069
+ declare const sqliteInList: (reference: SQL, items: ReadonlyArray<unknown>, negated: boolean, budget?: number) => SQL;
1070
+ type DurableStreamStatus = "complete" | "error" | "running";
1071
+ interface DurableStreamRun {
1072
+ error?: string;
1073
+ errorCode?: string;
1074
+ lastSeq: number;
1075
+ startedAt: number;
1076
+ status: DurableStreamStatus;
1077
+ }
1078
+ interface DurableStreamChunk {
1079
+ dataJson: string;
1080
+ seq: number;
1081
+ }
1082
+ declare const migrateDurableStreams: (sql: SqlExec) => void;
1083
+ declare const readStreamRun: (sql: SqlExec, runKey: string) => DurableStreamRun | undefined;
1084
+ declare const claimStreamRun: (sql: SqlExec, runKey: string, startedAt: number, ttlMs: number) => boolean;
1085
+ declare const deleteStreamRun: (sql: SqlExec, runKey: string) => void;
1086
+ declare const appendStreamChunk: (sql: SqlExec, runKey: string, seq: number, dataJson: string) => void;
1087
+ declare const readStreamChunks: (sql: SqlExec, runKey: string, sinceSeq: number) => DurableStreamChunk[];
1088
+ declare const finishStreamRun: (sql: SqlExec, runKey: string, status: "complete" | "error", lastSeq: number, failure?: {
1089
+ code: string;
1090
+ message: string;
1091
+ }) => void;
1092
+ declare const trimStreamRuns: (sql: SqlExec, now: number) => void;
1093
+ declare const MAX_DURABLE_STREAM_CHUNKS = 50000;
1094
+ declare const MAX_DURABLE_STREAM_BYTES: number;
1095
+ interface DurableStreamSink {
1096
+ readonly chunk: (chunk: {
1097
+ data: unknown;
1098
+ generation?: number;
1099
+ seq: number;
1100
+ }) => boolean;
1101
+ readonly complete: () => void;
1102
+ readonly fail: (failure: {
1103
+ code: string;
1104
+ message: string;
1105
+ }) => void;
1106
+ }
1107
+ type DurableAttachDecision = "attach" | "interrupted" | "reclaim" | "replay-terminal";
1108
+ declare const decideDurableAttach: (run: DurableStreamRun | undefined, context: {
1109
+ generation?: number;
1110
+ live?: {
1111
+ generation: number;
1112
+ };
1113
+ resuming: boolean;
1114
+ }) => DurableAttachDecision;
1115
+ interface DurableStreamAttach {
1116
+ readonly generation?: number;
1117
+ readonly iterator: (signal: AbortSignal) => AsyncIterable<unknown>;
1118
+ readonly runKey: string;
1119
+ readonly sinceChunk: number;
1120
+ readonly sink: DurableStreamSink;
1121
+ readonly ttlMs?: number;
1122
+ }
1123
+ declare class DurableStreamRunner {
1124
+ private lastTrimAt;
1125
+ private readonly runs;
1126
+ private readonly sql;
1127
+ private readonly waitUntil;
1128
+ constructor(dependencies: {
1129
+ sql: () => SqlExec;
1130
+ waitUntil?: (promise: Promise<unknown>) => void;
1131
+ });
1132
+ attach(request: DurableStreamAttach): Promise<void>;
1133
+ detach(runKey: string, sink: DurableStreamSink): void;
1134
+ isLive(runKey: string): boolean;
1135
+ private attachOrThrow;
1136
+ private produce;
1137
+ private trim;
1138
+ }
1139
+ declare const envPositiveInt: (env: unknown, key: string, fallback: number) => number;
1140
+ declare const envOptionalPositiveInt: (env: unknown, key: string) => number | undefined;
997
1141
  interface ExternalSourceDiffResult {
998
1142
  changes: CdcChange[];
999
1143
  nextBaseline: Map<string, string>;
@@ -1073,6 +1217,19 @@ declare const coveringGeohashes: (center: GeoPoint, radiusMeters: number) => str
1073
1217
  declare const pointInBoundingBox: (point: GeoPoint, box: GeoBoundingBox) => boolean;
1074
1218
  declare const boundingBoxCenter: (box: GeoBoundingBox) => GeoPoint;
1075
1219
  declare const boundingBoxGeohashes: (box: GeoBoundingBox) => string[];
1220
+ declare class GlobalPollTick {
1221
+ private readonly changedTables;
1222
+ private readonly reads;
1223
+ private resync;
1224
+ private skippedCount;
1225
+ constructor(changedTables?: Set<string>);
1226
+ get readCount(): number;
1227
+ get resyncRequested(): boolean;
1228
+ get skipped(): number;
1229
+ requestResync(): void;
1230
+ rows(key: string | undefined, load: () => Promise<ShapeRow[]>): Promise<ShapeRow[]>;
1231
+ shouldRead(table: string): boolean;
1232
+ }
1076
1233
  declare const ADMIN_FUNCTION_PREFIX = "__lunora_admin__:";
1077
1234
  declare const RELATION_FUNCTION_PREFIX = "__lunora_relation__:";
1078
1235
  declare const FLAGS_FUNCTION_PREFIX = "__lunora_flags__:";
@@ -1083,6 +1240,7 @@ declare const ADMIN_FUNCTIONS: {
1083
1240
  readonly aiGenerateSql: "__lunora_admin__:aiGenerateSql";
1084
1241
  readonly aiTableFilter: "__lunora_admin__:aiTableFilter";
1085
1242
  readonly assignIssue: "__lunora_admin__:assignIssue";
1243
+ readonly backfillSearch: "__lunora_admin__:backfillSearch";
1086
1244
  readonly backRelationCounts: "__lunora_admin__:backRelationCounts";
1087
1245
  readonly cdcSync: "__lunora_admin__:cdcSync";
1088
1246
  readonly clearCapturedMail: "__lunora_admin__:clearCapturedMail";
@@ -1107,6 +1265,7 @@ declare const ADMIN_FUNCTIONS: {
1107
1265
  readonly getMetricSeries: "__lunora_admin__:getMetricSeries";
1108
1266
  readonly listSubscriptions: "__lunora_admin__:listSubscriptions";
1109
1267
  readonly listTableIndexes: "__lunora_admin__:listTableIndexes";
1268
+ readonly listTablesIndexes: "__lunora_admin__:listTablesIndexes";
1110
1269
  readonly getLogs: "__lunora_admin__:getLogs";
1111
1270
  readonly getMetrics: "__lunora_admin__:getMetrics";
1112
1271
  readonly getPitrBookmark: "__lunora_admin__:getPitrBookmark";
@@ -1120,6 +1279,7 @@ declare const ADMIN_FUNCTIONS: {
1120
1279
  readonly ignoreIssue: "__lunora_admin__:ignoreIssue";
1121
1280
  readonly importShard: "__lunora_admin__:importShard";
1122
1281
  readonly listFlags: "__lunora_admin__:listFlags";
1282
+ readonly listReactors: "__lunora_admin__:listReactors";
1123
1283
  readonly listQueues: "__lunora_admin__:listQueues";
1124
1284
  readonly lintSql: "__lunora_admin__:lintSql";
1125
1285
  readonly listTables: "__lunora_admin__:listTables";
@@ -1199,9 +1359,15 @@ interface TableIndexInfo {
1199
1359
  interface TableIndexesResult {
1200
1360
  indexes: TableIndexInfo[];
1201
1361
  }
1362
+ interface TablesIndexesResult {
1363
+ indexesByTable: Record<string, TableIndexInfo[]>;
1364
+ }
1202
1365
  interface ColumnMeta {
1366
+ bucket?: string;
1367
+ enumValues?: string[];
1203
1368
  isStorage?: boolean;
1204
1369
  name: string;
1370
+ nullable?: boolean;
1205
1371
  optional: boolean;
1206
1372
  pk?: boolean;
1207
1373
  ref?: string;
@@ -1229,12 +1395,13 @@ interface AdvisoriesResult {
1229
1395
  advisories: AdvisoryFinding[];
1230
1396
  }
1231
1397
  interface AdvisorProcedure {
1232
- callsMail: boolean;
1398
+ analyzableBody?: boolean;
1399
+ callsMail?: boolean;
1233
1400
  emitsEvent?: boolean;
1234
1401
  exempt?: boolean;
1235
1402
  exemptReason?: string;
1236
1403
  exportName: string;
1237
- fanOut: boolean;
1404
+ fanOut?: boolean;
1238
1405
  file: string;
1239
1406
  handlesErrors?: boolean;
1240
1407
  hasEmailArg?: boolean;
@@ -1242,15 +1409,15 @@ interface AdvisorProcedure {
1242
1409
  reachesOutbound?: boolean;
1243
1410
  runsAiGeneration?: boolean;
1244
1411
  throwsBareError?: boolean;
1245
- unboundedAiGeneration: boolean;
1412
+ unboundedAiGeneration?: boolean;
1246
1413
  usesCaptcha: boolean;
1247
1414
  usesEmailGate: boolean;
1248
- usesInsertManyUnsafe: boolean;
1415
+ usesInsertManyUnsafe?: boolean;
1249
1416
  usesMask: boolean;
1250
1417
  usesRateLimit: boolean;
1251
1418
  usesRls: boolean;
1252
1419
  visibility: "internal" | "public";
1253
- writesUserTable: boolean;
1420
+ writesUserTable?: boolean;
1254
1421
  }
1255
1422
  interface AdvisorProceduresResult {
1256
1423
  procedures: AdvisorProcedure[];
@@ -1315,6 +1482,19 @@ interface FlagsResult {
1315
1482
  configured: boolean;
1316
1483
  flags: FlagEvaluation[];
1317
1484
  }
1485
+ interface ReactorMetadata {
1486
+ errors: number;
1487
+ lastError?: string;
1488
+ lastRanAt?: number;
1489
+ path: string;
1490
+ runs: number;
1491
+ state: "active" | "failing" | "idle";
1492
+ suppressed: number;
1493
+ tables?: ReadonlyArray<string>;
1494
+ }
1495
+ interface ReactorsResult {
1496
+ reactors: ReactorMetadata[];
1497
+ }
1318
1498
  interface WorkflowMetadata {
1319
1499
  binding: string;
1320
1500
  className: string;
@@ -1452,12 +1632,22 @@ interface FanoutPathCounters {
1452
1632
  socketsIterated: number;
1453
1633
  totalMs: number;
1454
1634
  }
1635
+ interface ShapeProbeCounters {
1636
+ run: number;
1637
+ served: number;
1638
+ }
1639
+ interface GlobalPollCounters {
1640
+ drains: number;
1641
+ pairsSkipped: number;
1642
+ }
1455
1643
  interface FanoutMetricsResult {
1644
+ globalPoll: GlobalPollCounters;
1456
1645
  maxRelays: number;
1457
1646
  peakSubscribers: number;
1458
1647
  promoted: boolean;
1459
1648
  relayCount: number;
1460
1649
  shapePoke: FanoutPathCounters;
1650
+ shapeProbe: ShapeProbeCounters;
1461
1651
  sinceMs: number;
1462
1652
  topics: FanoutTopicStat[];
1463
1653
  totalConnections: number;
@@ -1471,6 +1661,10 @@ interface FanoutAttachmentLike {
1471
1661
  }
1472
1662
  declare const DEFAULT_FANOUT_TOPIC_LIMIT = 20;
1473
1663
  declare const createFanoutCounters: () => FanoutPathCounters;
1664
+ declare const createShapeProbeCounters: () => ShapeProbeCounters;
1665
+ declare const createGlobalPollCounters: () => GlobalPollCounters;
1666
+ declare const recordGlobalPollPass: (counters: GlobalPollCounters, drains: number, pairsSkipped: number) => GlobalPollCounters;
1667
+ declare const recordShapeProbePass: (counters: ShapeProbeCounters, run: number, served: number) => ShapeProbeCounters;
1474
1668
  declare const recordFanoutPass: (counters: FanoutPathCounters, iterated: number, delivered: number, ms: number) => FanoutPathCounters;
1475
1669
  declare const summarizeFanoutTopics: (attachments: FanoutAttachmentLike[], limit?: number) => {
1476
1670
  peakSubscribers: number;
@@ -1592,7 +1786,6 @@ declare const clearQueueMessages: (sql: SqlExec) => {
1592
1786
  declare const encodePartitionKey: (partitionBy: ReadonlyArray<string>, source: Record<string, unknown>) => string;
1593
1787
  declare const RANK_TIEBREAK = "__id__";
1594
1788
  declare const sortColumnName: (i: number) => string;
1595
- declare const matchesRankStaticWhere: (document: Record<string, unknown>, predicate: Record<string, unknown>) => boolean;
1596
1789
  declare const resolveRankPartition: (index: RankIndexDefinitionLike, where: Record<string, unknown> | undefined) => Record<string, unknown> | undefined;
1597
1790
  declare const rankTableName: (table: string, indexName: string) => string;
1598
1791
  declare const rankKeyFromDocument: (index: RankIndexDefinitionLike, document_: Record<string, unknown>) => {
@@ -1600,6 +1793,35 @@ declare const rankKeyFromDocument: (index: RankIndexDefinitionLike, document_: R
1600
1793
  rowId: string;
1601
1794
  sortValues: unknown[];
1602
1795
  };
1796
+ declare const matchesRankStaticWhere: (document: Record<string, unknown>, predicate: Record<string, unknown>) => boolean;
1797
+ declare const REACTOR_STATE_TABLE = "__reactor_state";
1798
+ interface ReactorState {
1799
+ digest: string;
1800
+ lastError?: string;
1801
+ lastRanAt: number;
1802
+ stats: ReactorStats;
1803
+ tables?: ReadonlyArray<string>;
1804
+ }
1805
+ interface ReactorStats {
1806
+ errors: number;
1807
+ runs: number;
1808
+ suppressed: number;
1809
+ }
1810
+ declare const migrateReactorState: (sql: SqlExec) => void;
1811
+ declare const readReactorState: (sql: SqlExec, path: string) => ReactorState | undefined;
1812
+ declare const listReactorStates: (sql: SqlExec) => {
1813
+ path: string;
1814
+ state: ReactorState;
1815
+ }[];
1816
+ type ReactorDispatchResult = "error" | "ran" | "suppressed";
1817
+ declare const writeReactorState: (sql: SqlExec, path: string, outcome: {
1818
+ digest?: string;
1819
+ error?: string;
1820
+ now: number;
1821
+ result: ReactorDispatchResult;
1822
+ tables?: ReadonlyArray<string>;
1823
+ }) => void;
1824
+ declare const reactorNeedsRun: (state: Pick<ReactorState, "tables"> | undefined, changed: ReadonlySet<string>) => boolean;
1603
1825
  interface ReadFootprint {
1604
1826
  onRead: (table: string, idOrScan?: string) => void;
1605
1827
  onReadRange: (range: KeyRange) => void;
@@ -1607,6 +1829,8 @@ interface ReadFootprint {
1607
1829
  tables: Set<string>;
1608
1830
  }
1609
1831
  declare const createReadFootprint: () => ReadFootprint;
1832
+ declare const UNVOUCHABLE_DEP = "!unvouchable";
1833
+ declare const markUnvouchableReads: <T extends object>(facade: T, onRead: ReadFootprint["onRead"] | undefined, methods: ReadonlyArray<string>) => T;
1610
1834
  declare const DEFAULT_MAX_RELATION_KEYS = 5000;
1611
1835
  interface RelationExistsMarker {
1612
1836
  childWhere: WhereInput;
@@ -1641,6 +1865,7 @@ declare const containsRelationPredicate: (where: WhereInput, schema: ResolveCont
1641
1865
  declare const assertFlatPredicate: (where: WhereInput | undefined, schema: ResolveContext["schema"], tableName: string, op: string) => void;
1642
1866
  declare const resolveRelationPredicates: (where: WhereInput | undefined, options: ResolveRelationPredicatesOptions) => Promise<WhereInput | undefined>;
1643
1867
  declare const assertShapeShardable: (effectiveWhere: WhereInput | undefined, schema: ResolveContext["schema"], table: string) => void;
1868
+ declare const relationHooks: (args: Pick<QueryArgs, "relationBaseWhere" | "relationMask">) => Pick<QueryArgs, "relationBaseWhere" | "relationMask">;
1644
1869
  declare const fanOutScalarCounts: (counter: (tableName: string, where?: WhereInput) => Promise<number>, tableName: string, whereField: string, values: unknown[], policyWhere: WhereInput | undefined) => Promise<Map<unknown, number>>;
1645
1870
  declare const distinctValues: (rows: Record<string, unknown>[], field: string) => unknown[];
1646
1871
  declare const resolveWith: (options: ResolveWithOptions) => Promise<void>;
@@ -1665,6 +1890,8 @@ interface ShapeRowOp {
1665
1890
  value?: Record<string, unknown>;
1666
1891
  }
1667
1892
  interface ShapePokePart {
1893
+ baseCheckpoint?: number;
1894
+ reset?: boolean;
1668
1895
  rowsPatch: ShapeRowOp[];
1669
1896
  shapeId: string;
1670
1897
  }
@@ -1745,21 +1972,17 @@ interface RelayShapePoke {
1745
1972
  type: "relay_shape_poke";
1746
1973
  }
1747
1974
  type OwnerRelayFrame = RelayAttach | RelayDetach | RelayFrame | RelayShapePoke | RelayShapeSubscribe;
1748
- declare const DEFAULT_MAX_RELAYS = 8;
1749
- interface RelayStub {
1975
+ interface SiblingStub {
1750
1976
  fetch: (url: string, init?: RequestInit) => Promise<Response>;
1751
1977
  }
1752
- interface RelayNamespaceLike {
1753
- get: (id: unknown) => RelayStub;
1754
- getByName?: (name: string) => RelayStub;
1755
- idFromName: (name: string) => unknown;
1756
- }
1978
+ declare const DEFAULT_MAX_RELAYS = 8;
1757
1979
  interface RelayHost {
1758
1980
  buildShapeDiff: (resolved: ResolvedShape, fromCursor: number, toCursor: number) => ShapeRowOp[];
1759
1981
  computeOpLogShapeSeed: (shape: ShapeSubscriptionQuery, resolved: ResolvedShape) => {
1760
1982
  baseCheckpoint: number | undefined;
1761
1983
  cursor: number;
1762
1984
  epoch: string | undefined;
1985
+ reset: boolean;
1763
1986
  rowsPatch: ShapeRowOp[];
1764
1987
  };
1765
1988
  currentCdcEpoch: () => string | undefined;
@@ -1789,7 +2012,8 @@ declare abstract class RelayLink {
1789
2012
  handleControl(request: Request): Promise<Response>;
1790
2013
  maxRelays(): number;
1791
2014
  protected canAddressSiblings(): boolean;
1792
- protected relayNamespace(): RelayNamespaceLike | undefined;
2015
+ protected siblingStub(targetName: string): SiblingStub | undefined;
2016
+ protected bindingName(): string | undefined;
1793
2017
  protected postRelayMessage(targetName: string, message: OwnerRelayFrame): Promise<void>;
1794
2018
  protected requestRelayMessage(targetName: string, message: OwnerRelayFrame): Promise<Response | undefined>;
1795
2019
  abstract forwardWhisper(topic: string, frame: string): Promise<void>;
@@ -1802,6 +2026,7 @@ declare abstract class RelayLink {
1802
2026
  abstract announceDrain(closing: ShardSocketLike): Promise<void>;
1803
2027
  abstract relayCount(): number;
1804
2028
  abstract isShapeRelayUniform(name: string, args: Record<string, unknown>): boolean;
2029
+ abstract minShapeCursor(): number | undefined;
1805
2030
  protected abstract onAttach(index: number): void;
1806
2031
  protected abstract onDetach(index: number): void;
1807
2032
  protected abstract onWhisperFrame(message: RelayFrame): Promise<void>;
@@ -1811,8 +2036,8 @@ declare abstract class RelayLink {
1811
2036
  declare class OwnerRelay extends RelayLink {
1812
2037
  private readonly shapeUniformCache;
1813
2038
  private relaySetCache;
1814
- private readonly relayShapeRegistry;
1815
- private readonly relayShapeProxies;
2039
+ private registryCache;
2040
+ private recordedBinding;
1816
2041
  private promotionState;
1817
2042
  constructor(host: RelayHost, ownerKey: string);
1818
2043
  forwardWhisper(topic: string, frame: string): Promise<void>;
@@ -1824,16 +2049,23 @@ declare class OwnerRelay extends RelayLink {
1824
2049
  announce(): Promise<void>;
1825
2050
  announceDrain(): Promise<void>;
1826
2051
  relayCount(): number;
2052
+ minShapeCursor(): number | undefined;
1827
2053
  isShapeRelayUniform(name: string, args: Record<string, unknown>): boolean;
1828
2054
  protected onAttach(index: number): void;
1829
2055
  protected onDetach(index: number): void;
1830
2056
  protected onWhisperFrame(message: RelayFrame): Promise<void>;
1831
2057
  protected onShapeSubscribe(message: RelayShapeSubscribe): RelayShapeSeed;
1832
2058
  protected onShapePoke(): number;
2059
+ private buildShapePoke;
1833
2060
  private multicastShapePokes;
2061
+ private multicastToRelays;
1834
2062
  private proxyShapePokes;
2063
+ private proxyToRelay;
1835
2064
  private buildShapeSeedFrames;
1836
- private ensureRelayTable;
2065
+ private ensureRelayTables;
2066
+ protected bindingName(): string | undefined;
2067
+ private relayShapes;
2068
+ private rewindShapeCursor;
1837
2069
  private ownerRelaySet;
1838
2070
  private addRelayToSet;
1839
2071
  private removeRelayFromSet;
@@ -1854,6 +2086,7 @@ declare class RelayMember extends RelayLink {
1854
2086
  announceDrain(closing: ShardSocketLike): Promise<void>;
1855
2087
  relayCount(): number;
1856
2088
  isShapeRelayUniform(): boolean;
2089
+ minShapeCursor(): number | undefined;
1857
2090
  protected onAttach(): void;
1858
2091
  protected onDetach(): void;
1859
2092
  protected onWhisperFrame(): Promise<void>;
@@ -1863,6 +2096,61 @@ declare class RelayMember extends RelayLink {
1863
2096
  private deliverShapePoke;
1864
2097
  }
1865
2098
  declare const createRelayLink: (host: RelayHost) => OwnerRelay | RelayMember | undefined;
2099
+ declare const REGION_HINTS: readonly ["wnam", "enam", "sam", "weur", "eeur", "apac", "apac-ne", "apac-se", "oc", "afr", "me"];
2100
+ type RegionHint = (typeof REGION_HINTS)[number];
2101
+ type ReplicaReadiness = "fresh" | "stale" | "unavailable";
2102
+ interface ShardSiblingHost {
2103
+ doName: () => string | undefined;
2104
+ env: () => unknown;
2105
+ shardBinding: () => string | undefined;
2106
+ sql: () => SqlExec;
2107
+ }
2108
+ interface ReplicaOwnerHost extends ShardSiblingHost {
2109
+ exportRows: () => Promise<ExportRow[]>;
2110
+ ownerCursor: () => number | undefined;
2111
+ ownerEpoch: () => string | undefined;
2112
+ ownerFloor: () => number | undefined;
2113
+ readChanges: (sinceSeq: number, limit: number) => {
2114
+ changes: CdcChange[];
2115
+ cursor: number;
2116
+ };
2117
+ rowCount: () => number;
2118
+ }
2119
+ interface ReplicaFollowerHost extends ShardSiblingHost {
2120
+ applyChanges: (changes: ReadonlyArray<CdcChange>) => Promise<number>;
2121
+ importRows: (rows: ReadonlyArray<ExportRow>) => Promise<{
2122
+ errors: ReadonlyArray<unknown>;
2123
+ }>;
2124
+ }
2125
+ declare const handleReplicaControl: (host: ReplicaOwnerHost, request: Request) => Promise<Response>;
2126
+ declare class ShardReplica {
2127
+ private readonly host;
2128
+ readonly ownerKey: string;
2129
+ readonly region: RegionHint;
2130
+ private divergent;
2131
+ private inFlight;
2132
+ constructor(host: ReplicaFollowerHost, ownerKey: string, region: RegionHint);
2133
+ ensureFresh(minSeq?: number): Promise<ReplicaReadiness>;
2134
+ appliedSeq(): number;
2135
+ isDivergent(): boolean;
2136
+ private advance;
2137
+ private isCaughtUp;
2138
+ private catchUp;
2139
+ private applyPage;
2140
+ private hasDiverged;
2141
+ private bootstrap;
2142
+ private isFreshEnough;
2143
+ private pull;
2144
+ private request;
2145
+ }
2146
+ declare const createReplicaLink: (host: ReplicaFollowerHost) => ShardReplica | undefined;
2147
+ declare const gateReplicaDispatch: (replica: ShardReplica, request: Request, functionPath: string) => Promise<Response | undefined>;
2148
+ declare const REPROJECTION_MIGRATION_PREFIX = "__lunora_reproject__";
2149
+ declare const reprojectionMigrationId: (table: string) => string;
2150
+ declare const reprojectableFields: (definition: TableDefinitionLike) => string[];
2151
+ declare const reprojectionTables: (schema: SchemaLike) => string[];
2152
+ declare const countLegacyRows: (sql: SqlExec, table: string, fields: ReadonlyArray<string>) => number;
2153
+ declare const buildReprojectionMigration: (id: string, schema: SchemaLike, sql: SqlExec) => DataMigrationLike | undefined;
1866
2154
  declare const RLS_UNWRAP_SYMBOL: symbol;
1867
2155
  declare class RlsRequiredError extends LunoraError {
1868
2156
  readonly table: string;
@@ -1878,7 +2166,8 @@ interface GuardableSchema {
1878
2166
  }>;
1879
2167
  }
1880
2168
  type TableOfId = (id: string, expectedTable?: string) => Promise<string | undefined> | string | undefined;
1881
- declare const guardWriter: <W>(raw: W, schema: GuardableSchema, tableOfId: TableOfId) => W;
2169
+ type TablesOfIds = (ids: ReadonlyArray<string>, expectedTable?: string) => Promise<ReadonlyMap<string, string>> | ReadonlyMap<string, string>;
2170
+ declare const guardWriter: <W>(raw: W, schema: GuardableSchema, tableOfId: TableOfId, tablesOfIds?: TablesOfIds) => W;
1882
2171
  declare const SCHEMA_HISTORY_MAX_VERSIONS = 50;
1883
2172
  interface SchemaVersionRow {
1884
2173
  appliedAt: number;
@@ -1891,6 +2180,24 @@ declare const readSchemaHistory: (sql: SqlExec) => SchemaVersionRow[];
1891
2180
  declare const readSchemaVersion: (sql: SqlExec, hash: string) => SchemaVersionRow | undefined;
1892
2181
  declare const isDevEnvironment: (rawEnv: unknown) => boolean;
1893
2182
  declare const buildSettings: (rawEnv: unknown) => SettingsResult;
2183
+ declare class ShapeDiffCache {
2184
+ private readonly keyScans;
2185
+ private readonly memberProbes;
2186
+ private run;
2187
+ private served;
2188
+ get probesRun(): number;
2189
+ get probesServed(): number;
2190
+ changedKeys(rangeKey: string, load: () => CdcChangeKey[]): ReadonlyArray<CdcChangeKey>;
2191
+ members(resolved: ResolvedShape, rangeKey: string, load: () => Map<string, Record<string, unknown>>): ReadonlyMap<string, Record<string, unknown>>;
2192
+ private getOrLoad;
2193
+ }
2194
+ declare const createShapeDiffCache: () => ShapeDiffCache;
2195
+ declare const globalShapeReadKey: (resolved: ResolvedShape, identity: {
2196
+ identity?: Record<string, unknown>;
2197
+ userId?: string;
2198
+ }) => string | undefined;
2199
+ type ReadShapeCdcKeys = (sql: SqlExec, table: string, sinceSeq: number, upTo: number) => CdcChangeKey[];
2200
+ declare const buildShapeDiff: (sql: SqlExec, resolved: ResolvedShape, sinceSeq: number, upTo: number, cache: ShapeDiffCache, readKeys?: ReadShapeCdcKeys) => ShapeRowOp[];
1894
2201
  interface ShardRunnerOptions {
1895
2202
  handlers?: {
1896
2203
  handleAlarm?: () => Promise<void>;
@@ -1940,7 +2247,17 @@ interface DrainableSink {
1940
2247
  readonly bufferedAmount?: unknown;
1941
2248
  }
1942
2249
  declare const trySendFrame: (ws: FrameSink, frame: string) => boolean;
1943
- declare const sendDeltaFrames: (ws: FrameSink, subId: string, deltaFrames: ReadonlyArray<string>, cursorSuffix: string) => boolean;
2250
+ interface SubscriptionFrameInput {
2251
+ cursorSuffix: string;
2252
+ lastMutationId?: number;
2253
+ nextResult: unknown;
2254
+ pageDeltas?: boolean;
2255
+ previousJson?: string;
2256
+ snapshotJson: string;
2257
+ subId: string;
2258
+ table: string;
2259
+ }
2260
+ declare const subscriptionFrames: (input: SubscriptionFrameInput) => string[];
1944
2261
  declare const awaitWsDrain: (ws: DrainableSink) => Promise<void>;
1945
2262
  interface SubscriptionReadFootprint {
1946
2263
  ranges?: Map<string, KeyRange[]>;
@@ -1971,10 +2288,12 @@ declare const selectExpiredIds: (sql: SqlExec, spec: TtlSweepSpec, now: number,
1971
2288
  type FieldRefSql = (field: string) => SQL;
1972
2289
  type SerializeValue = (value: unknown) => unknown;
1973
2290
  interface WhereSqlStrategy {
2291
+ containsExpr?: (reference: SQL, term: SQL) => SQL;
1974
2292
  fieldRef: FieldRefSql;
1975
- likeContains?: (reference: SQL, term: SQL) => SQL;
2293
+ inList?: (reference: SQL, items: ReadonlyArray<unknown>, negated: boolean, budget?: number) => SQL;
1976
2294
  relationExists?: (request: unknown) => SQL;
1977
2295
  serialize: SerializeValue;
1978
2296
  }
2297
+ declare const literalInList: (reference: SQL, items: ReadonlyArray<unknown>, negated: boolean) => SQL;
1979
2298
  declare const compileWhereSql: (where: WhereInput | undefined, strategy: WhereSqlStrategy) => SQL | undefined;
1980
- export { ADMIN_FUNCTIONS, ADMIN_FUNCTION_PREFIX, AGGREGATE_SQL_FUNCTION, AGG_COUNT, AGG_KEY, AGG_VALUE, AUDIT_LOG_TABLE, type AdvisorProcedure, type AdvisorProceduresResult, type AdvisoriesResult, type AdvisoryFinding, type AggregateIndexDefinitionLike, type AggregateOp, type AggregateOptions, type AggregateResult, type AggregateTally, type AppendAuditEntry, type ApplyOnDeleteOptions$1 as ApplyOnDeleteOptions, type AuditEntry, type AuditLogResult, type BroadcastDelta, CDC_LOG_TABLE, CDC_META_TABLE, CLIENT_WATERMARK_TABLE, type CacheEntry, type CapturedMailRow, type CdcChange, type ChangedKeys, type Clock, type ColumnMeta, type ColumnMetaLike, type CompanionSync, type CompanionSyncDeps, ConflictError, type ConflictKind, type CountArgs, CountRlsUnsupportedError, type CreateWorkflowInstanceResult, type CtxDbOptions, DATA_MIGRATION_STATE_TABLE, DEFAULT_FANOUT_TOPIC_LIMIT, DEFAULT_MAX_RELATION_KEYS, DEFAULT_MAX_RELAYS, DEFAULT_PROMOTION_THRESHOLDS, DEFAULT_TRANSACTION_LIMITS, DOC_COLUMN, type DataMigrationDocument, type DataMigrationLike, type DataMigrationTransform, type DatabaseWriterLike, type DependencyTracker, type DeployInfo, type ExportRow, type ExportShardAdminArgs, type ExportShardArgs, type ExternalSourceDiffResult, type ExternalSourceLike, FLAGS_FUNCTION_PREFIX, type FacetColumnOptions, type FacetColumnResult, type FacetValue, type FanoutMetricsResult, type FanoutPathCounters, type FanoutTopicStat, type FieldOperators, type FilterClause, type FilterOperator, type FlagEvaluation, type FlagsResult, type FunctionCallStat, type FunctionScanAttribution, type FunctionStatsResult, GEO_DEFAULT_PRECISION, GLOBAL_SHAPE_SNAPSHOT_TABLE, type GeoBoundingBox, type GeoFilterBuilderLike, type GeoIndexDefinitionLike, type GeoPoint, type GroupByEntry, type GroupByOptions, type GuardableSchema$1 as GuardableSchema, IDEMPOTENCY_TABLE, type IdGenerator, type IdempotentRecord, type ImportError, type ImportShardAdminArgs, type ImportShardArgs, type ImportShardResult, type IncrementalMaterializeResult, type IndexDefinitionLike, type IndexKeyEntry, type IndexRangeBuilderLike, type KeyRange, type LifecycleDispatchInfo, type LifecycleEvent, MAIL_RETENTION, MAIL_TABLE, MAX_PAGE_SIZE, MAX_SQL_ROWS, type MaskColumnMetadata, type MaskPoliciesResult, type MaterializeResult, type MigrationDirection, type MigrationRunResult, type MigrationStatus, type MigrationStatusRow, type MutationDelta, type NestedWith, NotFoundError, NotUniqueError, type OnDeleteActionLike, type OrderByClause, type OrderByInput, type OrderKey, OwnerRelay, type OwnerRelayFrame, type PaginationOptions, type PitrBookmarkResult, type PitrRestoreArgs, type PitrRestoreResult, type PitrStorage, type PokeFrameMeta, type PromotionState, type PromotionThresholds, QUEUE_TABLE, type QueryArgs, type QueryPage, type QueueMessageOutcome, type QueueMessageRow, type QueueMetadata, type QueuesResult, RANK_TIEBREAK, RELATION_EXISTS_KEY, RELATION_FUNCTION_PREFIX, RLS_UNWRAP_SYMBOL, type RankBeforeOptions, type RankBeforeResult, type RankDirection, type RankIndexDefinitionLike, type RankOptions, type RankPage, type RankPageComputation, type RankPageDeps, type RankPageOptions, type RankPageRow, type RankPageRowKey, type RankResult, type RankSortKeyLike, ReactiveCache, type ReactiveCacheOptions, type ReadFootprint, type ReadHook, type ReadTablePageOptions, type RecordMailInput, type RecordQueueMessageInput, type RelationDefinitionLike, type RelationExistsMarker, type RelayAttach, type RelayDetach, type RelayFrame, type RelayHost, RelayMember, type RelayShapePoke, type RelayShapeSeed, type RelayShapeSubscribe, type RenderedSql, type ResolveRelationPredicatesOptions, type ResolveWithOptions, type ResolveWithResult, type ResolvedShape, type RestrictableQueryOptions, type RlsPoliciesResult, type RlsPolicyMetadata, RlsRequiredError, type RlsRoleMetadata, type RpcRequest, type RunDataMigrationOptions, type RunTriggersOptions, SCAN_DEP, SCHEMA_HISTORY_MAX_VERSIONS, SEARCH_STATE_TABLE, type SchedulableWorkflowReferenceLike, type ScheduledFunctionDoc, type SchedulerLike, type SchemaLike, type SearchFilterBuilderLike, type SearchIndexDefinitionLike, type SelectMatchingIdsOptions, type ServerDefaultContextLike, type SettingEntry, type SettingKind, type SettingsResult, type ShapePokePart, type ShapeRow, type ShapeRowOp, type ShapeSubscriptionQuery, type ShardRankPageResult, ShardRunner, type ShardRunnerOptions, type ShardSocketLike, type SocketAttachment, type SortDirection, type SourceClientLike, type SourceCursorLike, type SourceRefresh, type SqlConsoleResult, type SqlCursor, type SqlEngine, type SqlExec, type SqlLintResult, type StorageMetadata, type StorageReference, type StorageReferenceResult, type StorageRuleMetadata, type StorageRulesResult, type StudioFeaturesResult, type SubscriptionConnection, type SubscriptionEnvelope, type SubscriptionIdentity, type SubscriptionInfo, type SubscriptionQuery, type SubscriptionReadFootprint, type SubscriptionsResult, type SystemDatabaseReader, type SystemDoc, type SystemQuery, type SystemReaderOptions, type SystemReaderSchedulerLike, type SystemReaderStorageLike, type SystemTableName, type TableColumnsResult, type TableDefinitionLike, type TableIndexInfo, type TableIndexesResult, type TableInfo, type TablePage, type TableReaderLike, type TablesColumnsResult, type TransactionHeadroom, TransactionHeadroomTracker, type TransactionLimits, type TransactionSqlLike, type TriggerContextLike, type TriggerDefinitionLike, type TriggerEventLike, type TriggerOpLike, type TriggerTimingLike, type TtlSweepSpec, type ValidatorLike, type WhereInput, type WhereSqlStrategy, type WithInput, type WorkflowInstanceState, type WorkflowInstanceStatusResult, type WorkflowMetadata, type WorkflowsResult, type WriteEvent, type WriteHook, advanceClientWatermark, aggUpsertSql, aggregateSqlFunction, aggregateTableName, appendAuditEntry, appendCdcChange, applyCdcChanges, applyOnDelete, applySelect, armRestore, assertFlatPredicate, assertReadonly, assertShapeShardable, assertValidClientId, awaitWsDrain, backfillAggregateIndexes, backfillRankIndexes, backfillSearchIndexes, backfillSearchIndexesForTable, boundingBoxCenter, boundingBoxGeohashes, buildIndexRange, buildPokeFrames, buildSeekBeforeWhere, buildSeekWhere, buildSettings, bumpCdcEpoch, clampPromotionThresholds, clearCapturedMail, clearQueueMessages, coerceAggregateNumber, compileWhereSql, computeRankPage, containsRelationPredicate, coveringGeohashes, createCompanionSync, createDependencyTracker, createFanoutCounters, createIndexSql, createReadFootprint, createRelayLink, createShardCtxDb, createSystemReader, decodeCursor, deleteGlobalShapeSnapshot, deleteGlobalShapeSnapshotsForConnection, depKey, diffExternalSource, diffGlobalMembership, distinctValues, encodeAggregateKey, encodeCursor, encodeGeohash, encodePartitionKey, encodeRowsPatch, ensureAuditTable, ensureMailTable, exportShardRows, exportShardTable, facetColumn, fanOutScalarCounts, findStorageReferences, foldAggregateTally, geoTableName, guardWriter, hasTrigger, haversineMeters, hydrateDocsById, importShardRows, indexKeysForRow, isDevEnvironment, isFtsAvailable, isLossyBody, isRelationPredicate, isSoftDeleted, isSourceDue, jsonPath, jsonPathSql, keysTouchRanges, liftSourceId, lintReadonlySql, listTables, matchesRankStaticWhere, matchesStaticWhere, materializeExternalRows, materializeExternalRowsIncremental, mergeChangedKeys, mergeWhere, migrateCdcLog, migrateCdcMeta, migrateClientWatermark, migrateGlobalShapeSnapshot, migrateIdempotency, migrateSearchState, minCdcSeq, nextPromotionState, normalizeCountArgument, normalizeIdStructurally, normalizeOrderKeys, normalizeSourceDocument, normalizeSourceValue, param, parseExportShardArgs, parseImportShardArgs, planAggregateLookup, pointInBoundingBox, projectColumns, pullExternalSourceIncrementalTick, pullExternalSourceTick, qualifiedJsonPath, qualifiedJsonPathSql, quoteIdentifier, rankKeyFromDocument as rankKeyFromDoc, rankTableName, reactiveCacheKey, readAggregateValue, readAuditLog, readBookmark, readCapturedMail, readCdcChanges, readCdcCursor, readCdcEpoch, readClientWatermark, readExternalSourceBaseline, readGlobalShapeSnapshot, readIdempotent, readMigrationStatus, readQueueMessageById, readQueueMessages, readSchemaHistory, readSchemaVersion, readSearchBackfillState, readTablePage, recordCapturedMail, recordChangedKeys, recordFanoutPass, recordQueueMessages, recordSchemaVersion, relayCountFor, renderSql, resolveRankPartition, resolveRelationPredicates, resolveWith, rowToDocument, runDataMigration, runDrizzle, runExternalSourceTick, runReadonlySql, runRowValidators, runShardMigrations, runSocketPool, runSql, runTriggers, selectExpiredIds, selectExportTables, selectIndexForAggregate, selectIndexForCount, selectIndexForGroupBy, selectMatchingIds, selectShapeMemberIds, selectShapeRows, sendDeltaFrames, serializeSqlValue, shapeRoutingKey, softDeleteScope, sortColumnName, stableStringify, stableWireKey, subscriptionListDeltas, summarizeFanoutTopics, summarizeSubscriptions, tableColumns, tableFromDepKey, throwingScheduler, trimCdcChanges, trimIdempotent, tryRowToDocument, trySendFrame, validateImportRow, writeGlobalShapeSnapshot, writeIdempotent, writeSearchBackfillState, writeTouchesMemo };
2299
+ export { ADMIN_FUNCTIONS, ADMIN_FUNCTION_PREFIX, AGGREGATE_SQL_FUNCTION, AGG_COUNT, AGG_KEY, AGG_VALUE, AUDIT_LOG_TABLE, type AdvisorProcedure, type AdvisorProceduresResult, type AdvisoriesResult, type AdvisoryFinding, type AggregateIndexDefinitionLike, type AggregateOp, type AggregateOptions, type AggregateResult, type AggregateTally, type AppendAuditEntry, type ApplyOnDeleteOptions$1 as ApplyOnDeleteOptions, type AuditEntry, type AuditLogResult, type BroadcastDelta, CDC_LOG_TABLE, CDC_LOG_TABLE_SEQ_INDEX, CDC_META_TABLE, CLIENT_WATERMARK_TABLE, COMMIT_SEQ_FIELD, COMMIT_SEQ_TABLE, type CacheEntry, type CapturedMailRow, type CdcChange, type CdcChangeKey, type ChangedKeys, type Clock, type ColumnMeta, type ColumnMetaLike, type CompanionSync, type CompanionSyncDeps, ConflictError, type ConflictKind, type CountArgs, CountRlsUnsupportedError, type CreateWorkflowInstanceResult, type CrossShardReadArgs, type CtxDbOptions, DATA_MIGRATION_STATE_TABLE, DEFAULT_FANOUT_TOPIC_LIMIT, DEFAULT_MAX_RELATION_KEYS, DEFAULT_MAX_RELAYS, DEFAULT_PROMOTION_THRESHOLDS, DEFAULT_TRANSACTION_LIMITS, DOC_COLUMN, type DataMigrationDocument, type DataMigrationLike, type DataMigrationTransform, type DatabaseWriterLike, type DependencyTracker, type DeployInfo, type DurableAttachDecision, type DurableStreamAttach, type DurableStreamRun, DurableStreamRunner, type DurableStreamSink, type ExportRow, type ExportShardAdminArgs, type ExportShardArgs, type ExternalSourceDiffResult, type ExternalSourceLike, FLAGS_FUNCTION_PREFIX, type FacetColumnOptions, type FacetColumnResult, type FacetValue, type FanoutMetricsResult, type FanoutPathCounters, type FanoutTopicStat, type FieldOperators, type FilterClause, type FilterOperator, type FlagEvaluation, type FlagsResult, type FunctionCallStat, type FunctionScanAttribution, type FunctionStatsResult, GEO_DEFAULT_PRECISION, GLOBAL_SHAPE_SNAPSHOT_TABLE, type GeoBoundingBox, type GeoFilterBuilderLike, type GeoIndexDefinitionLike, type GeoPoint, type GeoScoredDocument, type GlobalPollCounters, GlobalPollTick, type GroupByEntry, type GroupByOptions, type GuardableSchema$1 as GuardableSchema, IDEMPOTENCY_TABLE, type IdGenerator, type IdempotentRecord, type ImportError, type ImportShardAdminArgs, type ImportShardArgs, type ImportShardResult, type IncrementalMaterializeResult, type IndexDefinitionLike, type IndexKeyEntry, type IndexRangeBuilderLike, type KeyRange, type LifecycleDispatchInfo, type LifecycleEvent, MAIL_RETENTION, MAIL_TABLE, MAX_DURABLE_STREAM_BYTES, MAX_DURABLE_STREAM_CHUNKS, MAX_PAGE_SIZE, MAX_SQL_ROWS, type MaskColumnMetadata, type MaskPoliciesResult, type MaterializeResult, type MigrationDirection, type MigrationRunResult, type MigrationStatus, type MigrationStatusRow, type MutationDelta, type NestedWith, NotFoundError, NotUniqueError, type OnDeleteActionLike, type OrderByClause, type OrderByInput, type OrderKey, OwnerRelay, type OwnerRelayFrame, type PaginationOptions, type PitrBookmarkResult, type PitrRestoreArgs, type PitrRestoreResult, type PitrStorage, type PokeFrameMeta, type PromotionState, type PromotionThresholds, QUEUE_TABLE, type QueryArgs, type QueryPage, type QueueMessageOutcome, type QueueMessageRow, type QueueMetadata, type QueuesResult, RANK_TIEBREAK, REACTOR_STATE_TABLE, RELATION_EXISTS_KEY, RELATION_FUNCTION_PREFIX, REPROJECTION_MIGRATION_PREFIX, RLS_UNWRAP_SYMBOL, type RankBeforeOptions, type RankBeforeResult, type RankDirection, type RankIndexDefinitionLike, type RankOptions, type RankPage, type RankPageComputation, type RankPageDeps, type RankPageOptions, type RankPageRow, type RankPageRowKey, type RankResult, type RankSortKeyLike, ReactiveCache, type ReactiveCacheOptions, type ReactorDispatchResult, type ReactorMetadata, type ReactorState, type ReactorStats, type ReactorsResult, type ReadFootprint, type ReadHook, type ReadTablePageOptions, type RecordMailInput, type RecordQueueMessageInput, type RelationDefinitionLike, type RelationExistsMarker, type RelayAttach, type RelayDetach, type RelayFrame, type RelayHost, RelayMember, type RelayShapePoke, type RelayShapeSeed, type RelayShapeSubscribe, type RenderedSql, type ReplicaFollowerHost, type ReplicaOwnerHost, type ReplicaReadiness, type ResolveRelationPredicatesOptions, type ResolveWithOptions, type ResolveWithResult, type ResolvedShape, type RestrictableQueryOptions, type RlsPoliciesResult, type RlsPolicyMetadata, RlsRequiredError, type RlsRoleMetadata, type RpcRequest, type RunDataMigrationOptions, type RunTriggersOptions, SCAN_DEP, SCHEMA_HISTORY_MAX_VERSIONS, SEARCH_STATE_TABLE, SHAPE_POKE_CURSOR_TABLE, type SchedulableWorkflowReferenceLike, type ScheduledFunctionDoc, type SchedulerLike, type SchemaLike, type ScoredDocument, type SearchBackfillProgress, type SearchFilterBuilderLike, type SearchIndexDefinitionLike, type SearchScoredDocument, type SelectMatchingIdsOptions, type ServerDefaultContextLike, type SettingEntry, type SettingKind, type SettingsResult, ShapeDiffCache, type ShapePokePart, type ShapeProbeCounters, type ShapeRow, type ShapeRowOp, type ShapeSubscriptionQuery, type ShardRankPageResult, ShardRunner, type ShardRunnerOptions, type ShardSiblingHost, type ShardSocketLike, type SocketAttachment, type SortDirection, type SourceClientLike, type SourceCursorLike, type SourceRefresh, type SqlConsoleResult, type SqlCursor, type SqlEngine, type SqlExec, type SqlLintResult, type StorageMetadata, type StorageReference, type StorageReferenceResult, type StorageRuleMetadata, type StorageRulesResult, type StudioFeaturesResult, type SubscriptionConnection, type SubscriptionEnvelope, type SubscriptionIdentity, type SubscriptionInfo, type SubscriptionQuery, type SubscriptionReadFootprint, type SubscriptionsResult, type SystemDatabaseReader, type SystemDoc, type SystemQuery, type SystemReaderOptions, type SystemReaderSchedulerLike, type SystemReaderStorageLike, type SystemTableName, type TableColumnsResult, type TableDefinitionLike, type TableIndexInfo, type TableIndexesResult, type TableInfo, type TablePage, type TableReaderLike, type TablesColumnsResult, type TablesIndexesResult, type TransactionHeadroom, TransactionHeadroomTracker, type TransactionLimits, type TransactionSqlLike, type TriggerContextLike, type TriggerDefinitionLike, type TriggerEventLike, type TriggerOpLike, type TriggerTimingLike, type TtlSweepSpec, UNVOUCHABLE_DEP, type ValidatorLike, type WhereInput, type WhereSqlStrategy, type WithInput, type WorkflowInstanceState, type WorkflowInstanceStatusResult, type WorkflowMetadata, type WorkflowsResult, type WriteEvent, type WriteHook, advanceClientWatermark, aggUpsertSql, aggregateSqlFunction, aggregateTableName, allocateCommitSeq, appendAuditEntry, appendCdcChange, appendStreamChunk, applyCdcChanges, applyOnDelete, applySelect, armRestore, assertFlatPredicate, assertReadonly, assertShapeShardable, assertValidClientId, awaitWsDrain, backfillAggregateIndexes, backfillRankIndexes, backfillSearchIndexes, backfillSearchIndexesForTable, boundingBoxCenter, boundingBoxGeohashes, buildIndexRange, buildPokeFrames, buildReprojectionMigration, buildSeekBeforeWhere, buildSeekWhere, buildSettings, buildShapeDiff, bumpCdcEpoch, cdcCanVouchFor, cdcSeqLeavingRows, cdcTouchesTables, cdcTrimmedError, claimStreamRun, clampPromotionThresholds, clearCapturedMail, clearMemoryTables, clearQueueMessages, coerceAggregateNumber, compactCdcDocs, compileWhereSql, computeRankPage, containsRelationPredicate, countLegacyRows, coveringGeohashes, createCompanionSync, createDependencyTracker, createFanoutCounters, createGlobalPollCounters, createIndexSql, createReadFootprint, createRelayLink, createReplicaLink, createShapeDiffCache, createShapeProbeCounters, createShardCtxDb, createSystemReader, cursorBelowRetainedFloor, decideDurableAttach, decodeCursor, deleteGlobalShapeSnapshot, deleteGlobalShapeSnapshotsForConnection, deleteShapePokeCursor, deleteShapePokeCursorsForConnection, deleteStreamRun, depKey, diffExternalSource, diffGlobalMembership, distinctValues, encodeAggregateKey, encodeCursor, encodeGeohash, encodePartitionKey, encodeRowsPatch, ensureAuditTable, ensureMailTable, envOptionalPositiveInt, envPositiveInt, exportShardRows, exportShardTable, facetColumn, fanOutScalarCounts, findStorageReferences, finishStreamRun, foldAggregateTally, gateReplicaDispatch, geoTableName, globalShapeReadKey, guardWriter, handleReplicaControl, hasTrigger, haversineMeters, hydrateDocsById, importShardRows, indexKeysForRow, isDevEnvironment, isFtsAvailable, isLossyBody, isMemoryTable, isRelationPredicate, isSoftDeleted, isSourceDue, jsonPath, jsonPathSql, keysTouchRanges, liftSourceId, lintReadonlySql, listReactorStates, listTables, literalInList, markUnvouchableReads, matchesRankStaticWhere, matchesStaticWhere, materializeExternalRows, materializeExternalRowsIncremental, memoryTableNames, mergeChangedKeys, mergeWhere, migrateCdcLog, migrateCdcMeta, migrateClientWatermark, migrateCommitSeq, migrateDurableStreams, migrateGlobalShapeSnapshot, migrateIdempotency, migrateReactorState, migrateSearchState, migrateShapePokeCursor, minCdcReplayableSeq, minCdcSeq, minShapePokeCursor, nextPromotionState, normalizeCountArgument, normalizeIdStructurally, normalizeOrderKeys, normalizeSourceDocument, normalizeSourceValue, param, parseExportShardArgs, parseImportShardArgs, planAggregateLookup, pointInBoundingBox, projectColumns, pullExternalSourceIncrementalTick, pullExternalSourceTick, qualifiedJsonPath, qualifiedJsonPathSql, quoteIdentifier, rankKeyFromDocument as rankKeyFromDoc, rankTableName, reactiveCacheKey, reactorNeedsRun, readAggregateValue, readAuditLog, readBookmark, readCapturedMail, readCdcChangeKeys, readCdcChanges, readCdcCursor, readCdcEpoch, readClientWatermark, readCommitSeq, readExternalSourceBaseline, readGlobalShapeSnapshot, readIdempotent, readMigrationStatus, readQueueMessageById, readQueueMessages, readReactorState, readSchemaHistory, readSchemaVersion, readSearchBackfillState, readShapePokeCursor, readStreamChunks, readStreamRun, readTablePage, recordCapturedMail, recordChangedKeys, recordFanoutPass, recordGlobalPollPass, recordQueueMessages, recordSchemaVersion, recordShapeProbePass, relationHooks, relayCountFor, renderSql, reprojectableFields, reprojectionMigrationId, reprojectionTables, resolveRankPartition, resolveRelationPredicates, resolveWith, rowToDocument, runDataMigration, runDrizzle, runExternalSourceTick, runReadonlySql, runRowValidators, runShardMigrations, runSocketPool, runSql, runTriggers, selectExpiredIds, selectExportTables, selectIndexForAggregate, selectIndexForCount, selectIndexForGroupBy, selectMatchingIds, selectShapeMembers, selectShapeRows, serializeSqlValue, shapeRoutingKey, softDeleteScope, sortColumnName, sqliteInList, stableStringify, stableWireKey, subscriptionFrames, subscriptionListDeltas, summarizeFanoutTopics, summarizeSubscriptions, tableColumns, tableFromDepKey, throwingScheduler, trimCdcChanges, trimIdempotent, trimStreamRuns, tryRowToDocument, trySendFrame, unionAll, validateImportRow, writeGlobalShapeSnapshot, writeIdempotent, writeReactorState, writeSearchBackfillState, writeShapePokeCursor, writeTouchesMemo };