@lunora/shard-engine 1.0.0-alpha.2 → 1.0.0-alpha.21

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 (99) hide show
  1. package/dist/conformance/index.mjs +1 -1
  2. package/dist/index.d.mts +176 -22
  3. package/dist/index.d.ts +176 -22
  4. package/dist/index.mjs +1 -1
  5. package/dist/packem_shared/ADMIN_FUNCTIONS-OnYxyTXW.mjs +1 -0
  6. package/dist/packem_shared/AGGREGATE_SQL_FUNCTION-CTo0-9iZ.mjs +1 -0
  7. package/dist/packem_shared/AGG_COUNT-CqQLWpb4.mjs +1 -0
  8. package/dist/packem_shared/AUDIT_LOG_TABLE-C6nwXFPd.mjs +8 -0
  9. package/dist/packem_shared/CDC_LOG_TABLE-ZqcflEen.mjs +8 -0
  10. package/dist/packem_shared/{CLIENT_WATERMARK_TABLE-CXsSLU8D.mjs → CLIENT_WATERMARK_TABLE-CzApRlyv.mjs} +1 -1
  11. package/dist/packem_shared/CountRlsUnsupportedError-8BqPYQoP.mjs +1 -0
  12. package/dist/packem_shared/DATA_MIGRATION_STATE_TABLE-BrpAGtXf.mjs +31 -0
  13. package/dist/packem_shared/DEFAULT_MAX_RELATION_KEYS-DjKka36Z.mjs +1 -0
  14. package/dist/packem_shared/DEFAULT_MAX_RELAYS-B19vrJxP.mjs +1 -0
  15. package/dist/packem_shared/{DEFAULT_PROMOTION_THRESHOLDS-Dteg0sZF.mjs → DEFAULT_PROMOTION_THRESHOLDS-B2rUe1bg.mjs} +1 -1
  16. package/dist/packem_shared/DEFAULT_TRANSACTION_LIMITS-q7ouI3i0.mjs +1 -0
  17. package/dist/packem_shared/GEO_DEFAULT_PRECISION-DyI5zggj.mjs +1 -0
  18. package/dist/packem_shared/{GLOBAL_SHAPE_SNAPSHOT_TABLE-DX-6-gBP.mjs → GLOBAL_SHAPE_SNAPSHOT_TABLE-soMJDSBs.mjs} +1 -1
  19. package/dist/packem_shared/{IDEMPOTENCY_TABLE-DjkEMp6w.mjs → IDEMPOTENCY_TABLE-Bvu9JkiL.mjs} +1 -1
  20. package/dist/packem_shared/MAIL_RETENTION-BefR9Sei.mjs +18 -0
  21. package/dist/packem_shared/NotUniqueError-CVHdtVw6.mjs +1 -0
  22. package/dist/packem_shared/QUEUE_TABLE-DgBqWrXX.mjs +17 -0
  23. package/dist/packem_shared/RANK_TIEBREAK-DDtST3gN.mjs +1 -0
  24. package/dist/packem_shared/REPROJECTION_MIGRATION_PREFIX-D2dltRFC.mjs +1 -0
  25. package/dist/packem_shared/RLS_UNWRAP_SYMBOL-DcqORh2s.mjs +1 -0
  26. package/dist/packem_shared/ReactiveCache-Cu8IfE1M.mjs +1 -0
  27. package/dist/packem_shared/SCHEMA_HISTORY_MAX_VERSIONS-BEU0CuW5.mjs +6 -0
  28. package/dist/packem_shared/SEARCH_STATE_TABLE-BZ_fxI5l.mjs +1 -0
  29. package/dist/packem_shared/aggregateTableName-DgYMC5tr.mjs +1 -0
  30. package/dist/packem_shared/applyOnDelete-By23GK-k.mjs +1 -0
  31. package/dist/packem_shared/applySelect-UY-o13Ia.mjs +1 -0
  32. package/dist/packem_shared/awaitWsDrain-Bp2jKzIb.mjs +1 -0
  33. package/dist/packem_shared/backfillAggregateIndexes-DmqOHg0U.mjs +1 -0
  34. package/dist/packem_shared/base64-fKomMf5D.mjs +1 -0
  35. package/dist/packem_shared/buildIndexRange-DFsdtPjD.mjs +1 -0
  36. package/dist/packem_shared/{buildPokeFrames-DaPpm5Ss.mjs → buildPokeFrames-CqxaN8_H.mjs} +1 -1
  37. package/dist/packem_shared/buildReprojectionMigration-Ctl4r84d.mjs +1 -0
  38. package/dist/packem_shared/buildSettings-COIJsw7a.mjs +1 -0
  39. package/dist/packem_shared/compileWhereSql-B4rPariq.mjs +1 -0
  40. package/dist/packem_shared/computeRankPage-QK8SeTZ-.mjs +1 -0
  41. package/dist/packem_shared/createCompanionSync-COw1Uy6a.mjs +1 -0
  42. package/dist/packem_shared/createReadFootprint-DIrrxRTE.mjs +1 -0
  43. package/dist/packem_shared/createReplicaLink-BMNW0SX6.mjs +7 -0
  44. package/dist/packem_shared/ctx-db-companions-BTi8DLUl.mjs +1 -0
  45. package/dist/packem_shared/{defineEngineContractSuite-ii3_DS_I.mjs → defineEngineContractSuite-B6nrsKSE.mjs} +1 -1
  46. package/dist/packem_shared/do-sql-1Yi1_Yq0.mjs +1 -0
  47. package/dist/packem_shared/estimate-bytes-Drp8rhPs.mjs +1 -0
  48. package/dist/packem_shared/exportShardRows-Bbi_JGfn.mjs +1 -0
  49. package/dist/packem_shared/{isSoftDeleted-B-SXkGUo.mjs → isSoftDeleted-Bo-y3DOe.mjs} +1 -1
  50. package/dist/packem_shared/{materializeExternalRows-DOQJV9p2.mjs → materializeExternalRows-DcCENzpV.mjs} +1 -1
  51. package/dist/packem_shared/mergeChangedKeys-BXtUgIPW.mjs +1 -0
  52. package/dist/packem_shared/quoteIdentifier-CObIFRhb.mjs +1 -0
  53. package/dist/packem_shared/runDrizzle-B6rnz3so.mjs +1 -0
  54. package/dist/packem_shared/runShardMigrations-BqO6HPtX.mjs +5 -0
  55. package/dist/packem_shared/selectExpiredIds-C6nQK7E2.mjs +1 -0
  56. package/dist/packem_shared/selectShapeMemberIds-BdBcbrUP.mjs +1 -0
  57. package/dist/packem_shared/serializeSqlValue-BR4UOWoP.mjs +1 -0
  58. package/dist/packem_shared/sibling-channel-bg9FBL5s.mjs +1 -0
  59. package/dist/packem_shared/sql-projection-jfoe331H.mjs +1 -0
  60. package/dist/packem_shared/stableWireKey-l3cjIt-9.mjs +1 -0
  61. package/dist/packem_shared/wire-codec-Dsy70M3Q.mjs +1 -0
  62. package/package.json +3 -3
  63. package/dist/packem_shared/ADMIN_FUNCTIONS-B0xlQJ4w.mjs +0 -1
  64. package/dist/packem_shared/AGGREGATE_SQL_FUNCTION-QYaiuty4.mjs +0 -1
  65. package/dist/packem_shared/AGG_COUNT-BWXe3gtQ.mjs +0 -1
  66. package/dist/packem_shared/AUDIT_LOG_TABLE-CaA0jL0L.mjs +0 -8
  67. package/dist/packem_shared/CDC_LOG_TABLE-BnqlH2eZ.mjs +0 -8
  68. package/dist/packem_shared/CountRlsUnsupportedError-B2WKJD9v.mjs +0 -1
  69. package/dist/packem_shared/DATA_MIGRATION_STATE_TABLE-CaO6L0Ee.mjs +0 -31
  70. package/dist/packem_shared/DEFAULT_MAX_RELATION_KEYS-bq00btqV.mjs +0 -1
  71. package/dist/packem_shared/DEFAULT_MAX_RELAYS-CnCyh6oX.mjs +0 -1
  72. package/dist/packem_shared/FTS_COUNT_COLUMN-D1gY3wwZ-CZHdaRrd.mjs +0 -1
  73. package/dist/packem_shared/GEO_DEFAULT_PRECISION-okRCkZ6r.mjs +0 -1
  74. package/dist/packem_shared/MAIL_RETENTION-KmozO2NQ.mjs +0 -18
  75. package/dist/packem_shared/NotUniqueError-Bw1Oh2FL.mjs +0 -1
  76. package/dist/packem_shared/QUEUE_TABLE-DYCDvzTG.mjs +0 -17
  77. package/dist/packem_shared/RANK_TIEBREAK-9NU5s_mi.mjs +0 -1
  78. package/dist/packem_shared/RLS_UNWRAP_SYMBOL-C6_WX3dG.mjs +0 -1
  79. package/dist/packem_shared/ReactiveCache-1_9Rs7J_.mjs +0 -1
  80. package/dist/packem_shared/SCHEMA_HISTORY_MAX_VERSIONS-CHXz6p_z.mjs +0 -6
  81. package/dist/packem_shared/SEARCH_STATE_TABLE-eLN8U5tz.mjs +0 -1
  82. package/dist/packem_shared/aggregateTableName-G-eXyjcz.mjs +0 -1
  83. package/dist/packem_shared/applyOnDelete-uFRC5p1d.mjs +0 -1
  84. package/dist/packem_shared/applySelect-B0CF8T7y.mjs +0 -1
  85. package/dist/packem_shared/awaitWsDrain-Dk50ISgE.mjs +0 -1
  86. package/dist/packem_shared/backfillAggregateIndexes-BHiewuB-.mjs +0 -1
  87. package/dist/packem_shared/buildSettings-DT18_DkX.mjs +0 -1
  88. package/dist/packem_shared/compileWhereSql-BLcfs4QW.mjs +0 -1
  89. package/dist/packem_shared/computeRankPage-IUSS-zIB.mjs +0 -1
  90. package/dist/packem_shared/createCompanionSync-BCBUOnMk.mjs +0 -1
  91. package/dist/packem_shared/exportShardRows-kt42wijd.mjs +0 -1
  92. package/dist/packem_shared/quote-identifier-CGiYFBvY.mjs +0 -1
  93. package/dist/packem_shared/runDrizzle-GKR3y97k.mjs +0 -1
  94. package/dist/packem_shared/runShardMigrations-CPxqCh3O.mjs +0 -5
  95. package/dist/packem_shared/selectExpiredIds-FzhIEeG1.mjs +0 -1
  96. package/dist/packem_shared/selectShapeMemberIds-DvE7K6zG.mjs +0 -1
  97. package/dist/packem_shared/serializeSqlValue-DnpyaLcw.mjs +0 -1
  98. package/dist/packem_shared/stableWireKey-YEHLaX6X.mjs +0 -1
  99. package/dist/packem_shared/wire-codec-Ctnni0h6.mjs +0 -1
@@ -1 +1 @@
1
- import{defineEngineContractSuite as t}from"../packem_shared/defineEngineContractSuite-ii3_DS_I.mjs";export{t as defineEngineContractSuite};
1
+ import{defineEngineContractSuite as t}from"../packem_shared/defineEngineContractSuite-B6nrsKSE.mjs";export{t as defineEngineContractSuite};
package/dist/index.d.mts CHANGED
@@ -1,6 +1,27 @@
1
1
  import { LunoraError } from '@lunora/errors';
2
2
  import { SQL, Name } from 'drizzle-orm';
3
3
  import { ShardHost, SocketHost, SocketHandle } from '@lunora/platform';
4
+ interface KeyRange {
5
+ hi: string;
6
+ index: string;
7
+ lo: string;
8
+ table: string;
9
+ }
10
+ interface IndexKeyEntry {
11
+ index: string;
12
+ key: string;
13
+ }
14
+ interface StagedCondition {
15
+ comparator: string;
16
+ field: string;
17
+ value: unknown;
18
+ }
19
+ declare const buildIndexRange: (table: string, index: string, fields: ReadonlyArray<string>, conditions: ReadonlyArray<StagedCondition>, serialize: (value: unknown) => unknown) => KeyRange | undefined;
20
+ declare const indexKeysForRow: (indexes: ReadonlyArray<{
21
+ fields: ReadonlyArray<string>;
22
+ name: string;
23
+ }>, row: Record<string, unknown>, serialize: (value: unknown) => unknown) => IndexKeyEntry[];
24
+ declare const keysTouchRanges: (ranges: ReadonlyArray<KeyRange> | undefined, keys: ReadonlyArray<IndexKeyEntry> | undefined) => boolean;
4
25
  type SystemTableName = "_scheduled_functions" | "_storage";
5
26
  interface ScheduledFunctionDoc {
6
27
  args: Record<string, unknown>;
@@ -209,6 +230,7 @@ interface ResolveWithOptions {
209
230
  groupedCounter: (tableName: string, whereField: string, values: unknown[], policyWhere?: WhereInput) => Promise<Map<unknown, number>>;
210
231
  parents: Record<string, unknown>[];
211
232
  relationBaseWhere?: (table: string) => undefined | WhereInput;
233
+ relationMask?: RelationMask;
212
234
  schema: {
213
235
  readonly tables: Record<string, TableDefinitionLike>;
214
236
  };
@@ -229,11 +251,19 @@ interface QueryArgs {
229
251
  limit?: number;
230
252
  orderBy?: OrderByInput[];
231
253
  relationBaseWhere?: (table: string) => undefined | WhereInput;
254
+ relationMask?: RelationMask;
232
255
  restrictsCounts?: boolean;
233
256
  select?: ReadonlyArray<string>;
234
257
  where?: WhereInput;
235
258
  with?: WithInput;
236
259
  }
260
+ interface CrossShardReadArgs {
261
+ orderBy?: OrderByInput[];
262
+ relationPolicies?: Record<string, WhereInput>;
263
+ where?: WhereInput;
264
+ with?: WithInput;
265
+ }
266
+ type RelationMask = (table: string, rows: Record<string, unknown>[]) => Record<string, unknown>[];
237
267
  interface QueryPage {
238
268
  continueCursor: null | string;
239
269
  isDone: boolean;
@@ -338,9 +368,21 @@ interface GeoFilterBuilderLike {
338
368
  };
339
369
  }) => GeoFilterBuilderLike;
340
370
  }
371
+ type ScoredDocument = GeoScoredDocument | SearchScoredDocument;
372
+ interface GeoScoredDocument {
373
+ distanceMeters: null | number;
374
+ document: Record<string, unknown>;
375
+ score?: never;
376
+ }
377
+ interface SearchScoredDocument {
378
+ distanceMeters?: never;
379
+ document: Record<string, unknown>;
380
+ score: number;
381
+ }
341
382
  interface TableReaderLike {
342
383
  [Symbol.asyncIterator]: () => AsyncIterator<Record<string, unknown>>;
343
384
  collect: () => Promise<Record<string, unknown>[]>;
385
+ collectWithScores: () => Promise<ScoredDocument[]>;
344
386
  filter: (predicate: (document: Record<string, unknown>) => boolean) => TableReaderLike;
345
387
  first: () => Promise<Record<string, unknown> | null>;
346
388
  order: (direction: "asc" | "desc") => TableReaderLike;
@@ -372,6 +414,7 @@ interface LifecycleDispatchInfo {
372
414
  userId: string | undefined;
373
415
  }
374
416
  interface MutationDelta {
417
+ indexKeys?: ReadonlyArray<IndexKeyEntry>;
375
418
  key: string;
376
419
  op: "insert" | "update" | "delete";
377
420
  row?: Record<string, unknown>;
@@ -536,6 +579,7 @@ interface CacheEntry {
536
579
  bytes: number;
537
580
  deps: Set<string>;
538
581
  lastUsed: number;
582
+ ranges: ReadonlyArray<KeyRange>;
539
583
  result: unknown;
540
584
  subscribers: Set<string>;
541
585
  }
@@ -547,6 +591,7 @@ interface ReactiveCacheOptions {
547
591
  declare class ReactiveCache {
548
592
  private readonly entries;
549
593
  private readonly tableIndex;
594
+ private readonly rangeIndex;
550
595
  private totalBytes;
551
596
  private hits;
552
597
  private misses;
@@ -556,8 +601,8 @@ declare class ReactiveCache {
556
601
  private readonly now;
557
602
  private monotonic;
558
603
  constructor(options?: ReactiveCacheOptions);
559
- run<R>(key: string, deps: Set<string>, run: () => Promise<R>): Promise<R>;
560
- invalidate(table: string, id: string): string[];
604
+ run<R>(key: string, deps: Set<string>, run: () => Promise<R>, ranges?: () => ReadonlyArray<KeyRange>): Promise<R>;
605
+ invalidate(table: string, id: string, indexKeys?: ReadonlyArray<IndexKeyEntry>): string[];
561
606
  invalidateTable(table: string): string[];
562
607
  subscribe(key: string, subscriberId: string): void;
563
608
  unsubscribe(key: string, subscriberId: string): void;
@@ -574,11 +619,37 @@ declare class ReactiveCache {
574
619
  hits: number;
575
620
  misses: number;
576
621
  };
622
+ private dropRangeDeps;
577
623
  private collectAndDrop;
624
+ private dropKeys;
578
625
  private dropEntry;
579
626
  private evict;
580
627
  }
581
628
  declare const reactiveCacheKey: (functionPath: string, args: Record<string, unknown>, identity: null | string) => string;
629
+ interface TransactionLimits {
630
+ maxReadRows: number;
631
+ maxWrittenBytes: number;
632
+ maxWrittenRows: number;
633
+ }
634
+ interface TransactionHeadroom {
635
+ readRows: number;
636
+ remainingReadRows: number;
637
+ remainingWrittenBytes: number;
638
+ remainingWrittenRows: number;
639
+ writtenBytes: number;
640
+ writtenRows: number;
641
+ }
642
+ declare const DEFAULT_TRANSACTION_LIMITS: TransactionLimits;
643
+ declare class TransactionHeadroomTracker {
644
+ private readRows;
645
+ private writtenRows;
646
+ private writtenBytes;
647
+ private readonly limits;
648
+ constructor(limits?: Partial<TransactionLimits>);
649
+ recordRead(count: number): void;
650
+ recordWrite(row: unknown): void;
651
+ headroom(): TransactionHeadroom;
652
+ }
582
653
  interface RunTriggersOptions {
583
654
  ctx: TriggerContextLike;
584
655
  event: TriggerEventLike;
@@ -713,10 +784,12 @@ interface CtxDbOptions {
713
784
  clock?: Clock;
714
785
  enforceRls?: boolean;
715
786
  globalDb?: DatabaseWriterLike;
787
+ headroom?: TransactionHeadroomTracker;
716
788
  idGenerator?: IdGenerator;
717
789
  maxRelationKeys?: number;
718
790
  onIndexUse?: IndexUseHook;
719
791
  onRead?: ReadHook;
792
+ onReadRange?: (range: KeyRange) => void;
720
793
  onWrite?: WriteHook;
721
794
  relationExistsPushDown?: "always" | "auto" | "never";
722
795
  scheduler?: SchedulerLike;
@@ -816,7 +889,11 @@ interface ShardSocketLike {
816
889
  }
817
890
  interface CompanionSyncDeps {
818
891
  broadcast: (delta: MutationDelta) => void;
819
- invalidateCache: (table: string, id: string) => void;
892
+ indexKeysFor: (table: string, document?: Record<string, unknown>) => ReadonlyArray<{
893
+ index: string;
894
+ key: string;
895
+ }> | undefined;
896
+ invalidateCache: (table: string, id: string, document?: Record<string, unknown>) => void;
820
897
  recordCdc: (table: string, id: string, op: "delete" | "insert" | "update", doc?: Record<string, unknown>) => void;
821
898
  schema: SchemaLike;
822
899
  sql: SqlExec;
@@ -856,7 +933,11 @@ declare const DATA_MIGRATION_STATE_TABLE = "__lunora_migrations";
856
933
  type MigrationDirection = "down" | "up";
857
934
  type MigrationStatus = "completed" | "failed" | "in_progress";
858
935
  type DataMigrationDocument = Record<string, unknown>;
859
- type DataMigrationTransform = (document: DataMigrationDocument) => DataMigrationDocument | undefined;
936
+ type DataMigrationReader = Pick<DatabaseWriterLike, "count" | "findFirst" | "findMany" | "get">;
937
+ interface DataMigrationContext {
938
+ db: DataMigrationReader;
939
+ }
940
+ type DataMigrationTransform = (document: DataMigrationDocument, context: DataMigrationContext) => DataMigrationDocument | Promise<DataMigrationDocument | undefined> | undefined;
860
941
  interface DataMigrationLike {
861
942
  readonly batchSize?: number;
862
943
  readonly down?: DataMigrationTransform;
@@ -911,10 +992,10 @@ interface DependencyTracker {
911
992
  declare const createDependencyTracker: () => DependencyTracker;
912
993
  declare const runSql: <Row = Record<string, unknown>>(sql: SqlExec, query: string, ...params: unknown[]) => SqlCursor<Row>;
913
994
  declare const runDrizzle: <Row = Record<string, unknown>>(exec: SqlExec, query: SQL) => SqlCursor<Row>;
995
+ declare const quoteIdentifier: (name: string) => string;
914
996
  declare const serializeSqlValue: (value: unknown) => unknown;
915
997
  declare const DOC_COLUMN = "__doc__";
916
998
  declare const geoTableName: (table: string, indexName: string) => string;
917
- declare const quoteIdentifier: (name: string) => string;
918
999
  declare const jsonPath: (field: string) => string;
919
1000
  declare const jsonPathSql: (field: string) => SQL;
920
1001
  declare const qualifiedJsonPath: (table: string, field: string) => string;
@@ -1048,6 +1129,7 @@ declare const ADMIN_FUNCTIONS: {
1048
1129
  readonly getMetricSeries: "__lunora_admin__:getMetricSeries";
1049
1130
  readonly listSubscriptions: "__lunora_admin__:listSubscriptions";
1050
1131
  readonly listTableIndexes: "__lunora_admin__:listTableIndexes";
1132
+ readonly listTablesIndexes: "__lunora_admin__:listTablesIndexes";
1051
1133
  readonly getLogs: "__lunora_admin__:getLogs";
1052
1134
  readonly getMetrics: "__lunora_admin__:getMetrics";
1053
1135
  readonly getPitrBookmark: "__lunora_admin__:getPitrBookmark";
@@ -1140,6 +1222,9 @@ interface TableIndexInfo {
1140
1222
  interface TableIndexesResult {
1141
1223
  indexes: TableIndexInfo[];
1142
1224
  }
1225
+ interface TablesIndexesResult {
1226
+ indexesByTable: Record<string, TableIndexInfo[]>;
1227
+ }
1143
1228
  interface ColumnMeta {
1144
1229
  isStorage?: boolean;
1145
1230
  name: string;
@@ -1170,12 +1255,13 @@ interface AdvisoriesResult {
1170
1255
  advisories: AdvisoryFinding[];
1171
1256
  }
1172
1257
  interface AdvisorProcedure {
1173
- callsMail: boolean;
1258
+ analyzableBody?: boolean;
1259
+ callsMail?: boolean;
1174
1260
  emitsEvent?: boolean;
1175
1261
  exempt?: boolean;
1176
1262
  exemptReason?: string;
1177
1263
  exportName: string;
1178
- fanOut: boolean;
1264
+ fanOut?: boolean;
1179
1265
  file: string;
1180
1266
  handlesErrors?: boolean;
1181
1267
  hasEmailArg?: boolean;
@@ -1183,15 +1269,15 @@ interface AdvisorProcedure {
1183
1269
  reachesOutbound?: boolean;
1184
1270
  runsAiGeneration?: boolean;
1185
1271
  throwsBareError?: boolean;
1186
- unboundedAiGeneration: boolean;
1272
+ unboundedAiGeneration?: boolean;
1187
1273
  usesCaptcha: boolean;
1188
1274
  usesEmailGate: boolean;
1189
- usesInsertManyUnsafe: boolean;
1275
+ usesInsertManyUnsafe?: boolean;
1190
1276
  usesMask: boolean;
1191
1277
  usesRateLimit: boolean;
1192
1278
  usesRls: boolean;
1193
1279
  visibility: "internal" | "public";
1194
- writesUserTable: boolean;
1280
+ writesUserTable?: boolean;
1195
1281
  }
1196
1282
  interface AdvisorProceduresResult {
1197
1283
  procedures: AdvisorProcedure[];
@@ -1533,7 +1619,6 @@ declare const clearQueueMessages: (sql: SqlExec) => {
1533
1619
  declare const encodePartitionKey: (partitionBy: ReadonlyArray<string>, source: Record<string, unknown>) => string;
1534
1620
  declare const RANK_TIEBREAK = "__id__";
1535
1621
  declare const sortColumnName: (i: number) => string;
1536
- declare const matchesRankStaticWhere: (document: Record<string, unknown>, predicate: Record<string, unknown>) => boolean;
1537
1622
  declare const resolveRankPartition: (index: RankIndexDefinitionLike, where: Record<string, unknown> | undefined) => Record<string, unknown> | undefined;
1538
1623
  declare const rankTableName: (table: string, indexName: string) => string;
1539
1624
  declare const rankKeyFromDocument: (index: RankIndexDefinitionLike, document_: Record<string, unknown>) => {
@@ -1541,6 +1626,14 @@ declare const rankKeyFromDocument: (index: RankIndexDefinitionLike, document_: R
1541
1626
  rowId: string;
1542
1627
  sortValues: unknown[];
1543
1628
  };
1629
+ declare const matchesRankStaticWhere: (document: Record<string, unknown>, predicate: Record<string, unknown>) => boolean;
1630
+ interface ReadFootprint {
1631
+ onRead: (table: string, idOrScan?: string) => void;
1632
+ onReadRange: (range: KeyRange) => void;
1633
+ ranges: () => Map<string, KeyRange[]> | undefined;
1634
+ tables: Set<string>;
1635
+ }
1636
+ declare const createReadFootprint: () => ReadFootprint;
1544
1637
  declare const DEFAULT_MAX_RELATION_KEYS = 5000;
1545
1638
  interface RelationExistsMarker {
1546
1639
  childWhere: WhereInput;
@@ -1575,6 +1668,7 @@ declare const containsRelationPredicate: (where: WhereInput, schema: ResolveCont
1575
1668
  declare const assertFlatPredicate: (where: WhereInput | undefined, schema: ResolveContext["schema"], tableName: string, op: string) => void;
1576
1669
  declare const resolveRelationPredicates: (where: WhereInput | undefined, options: ResolveRelationPredicatesOptions) => Promise<WhereInput | undefined>;
1577
1670
  declare const assertShapeShardable: (effectiveWhere: WhereInput | undefined, schema: ResolveContext["schema"], table: string) => void;
1671
+ declare const relationHooks: (args: Pick<QueryArgs, "relationBaseWhere" | "relationMask">) => Pick<QueryArgs, "relationBaseWhere" | "relationMask">;
1578
1672
  declare const fanOutScalarCounts: (counter: (tableName: string, where?: WhereInput) => Promise<number>, tableName: string, whereField: string, values: unknown[], policyWhere: WhereInput | undefined) => Promise<Map<unknown, number>>;
1579
1673
  declare const distinctValues: (rows: Record<string, unknown>[], field: string) => unknown[];
1580
1674
  declare const resolveWith: (options: ResolveWithOptions) => Promise<void>;
@@ -1679,15 +1773,10 @@ interface RelayShapePoke {
1679
1773
  type: "relay_shape_poke";
1680
1774
  }
1681
1775
  type OwnerRelayFrame = RelayAttach | RelayDetach | RelayFrame | RelayShapePoke | RelayShapeSubscribe;
1682
- declare const DEFAULT_MAX_RELAYS = 8;
1683
- interface RelayStub {
1776
+ interface SiblingStub {
1684
1777
  fetch: (url: string, init?: RequestInit) => Promise<Response>;
1685
1778
  }
1686
- interface RelayNamespaceLike {
1687
- get: (id: unknown) => RelayStub;
1688
- getByName?: (name: string) => RelayStub;
1689
- idFromName: (name: string) => unknown;
1690
- }
1779
+ declare const DEFAULT_MAX_RELAYS = 8;
1691
1780
  interface RelayHost {
1692
1781
  buildShapeDiff: (resolved: ResolvedShape, fromCursor: number, toCursor: number) => ShapeRowOp[];
1693
1782
  computeOpLogShapeSeed: (shape: ShapeSubscriptionQuery, resolved: ResolvedShape) => {
@@ -1723,7 +1812,7 @@ declare abstract class RelayLink {
1723
1812
  handleControl(request: Request): Promise<Response>;
1724
1813
  maxRelays(): number;
1725
1814
  protected canAddressSiblings(): boolean;
1726
- protected relayNamespace(): RelayNamespaceLike | undefined;
1815
+ protected siblingStub(targetName: string): SiblingStub | undefined;
1727
1816
  protected postRelayMessage(targetName: string, message: OwnerRelayFrame): Promise<void>;
1728
1817
  protected requestRelayMessage(targetName: string, message: OwnerRelayFrame): Promise<Response | undefined>;
1729
1818
  abstract forwardWhisper(topic: string, frame: string): Promise<void>;
@@ -1764,6 +1853,7 @@ declare class OwnerRelay extends RelayLink {
1764
1853
  protected onWhisperFrame(message: RelayFrame): Promise<void>;
1765
1854
  protected onShapeSubscribe(message: RelayShapeSubscribe): RelayShapeSeed;
1766
1855
  protected onShapePoke(): number;
1856
+ private buildShapePoke;
1767
1857
  private multicastShapePokes;
1768
1858
  private proxyShapePokes;
1769
1859
  private buildShapeSeedFrames;
@@ -1797,6 +1887,61 @@ declare class RelayMember extends RelayLink {
1797
1887
  private deliverShapePoke;
1798
1888
  }
1799
1889
  declare const createRelayLink: (host: RelayHost) => OwnerRelay | RelayMember | undefined;
1890
+ declare const REGION_HINTS: readonly ["wnam", "enam", "sam", "weur", "eeur", "apac", "apac-ne", "apac-se", "oc", "afr", "me"];
1891
+ type RegionHint = (typeof REGION_HINTS)[number];
1892
+ type ReplicaReadiness = "fresh" | "stale" | "unavailable";
1893
+ interface ShardSiblingHost {
1894
+ doName: () => string | undefined;
1895
+ env: () => unknown;
1896
+ shardBinding: () => string | undefined;
1897
+ sql: () => SqlExec;
1898
+ }
1899
+ interface ReplicaOwnerHost extends ShardSiblingHost {
1900
+ exportRows: () => Promise<ExportRow[]>;
1901
+ ownerCursor: () => number | undefined;
1902
+ ownerEpoch: () => string | undefined;
1903
+ ownerFloor: () => number | undefined;
1904
+ readChanges: (sinceSeq: number, limit: number) => {
1905
+ changes: CdcChange[];
1906
+ cursor: number;
1907
+ };
1908
+ rowCount: () => number;
1909
+ }
1910
+ interface ReplicaFollowerHost extends ShardSiblingHost {
1911
+ applyChanges: (changes: ReadonlyArray<CdcChange>) => Promise<number>;
1912
+ importRows: (rows: ReadonlyArray<ExportRow>) => Promise<{
1913
+ errors: ReadonlyArray<unknown>;
1914
+ }>;
1915
+ }
1916
+ declare const handleReplicaControl: (host: ReplicaOwnerHost, request: Request) => Promise<Response>;
1917
+ declare class ShardReplica {
1918
+ private readonly host;
1919
+ readonly ownerKey: string;
1920
+ readonly region: RegionHint;
1921
+ private divergent;
1922
+ private inFlight;
1923
+ constructor(host: ReplicaFollowerHost, ownerKey: string, region: RegionHint);
1924
+ ensureFresh(minSeq?: number): Promise<ReplicaReadiness>;
1925
+ appliedSeq(): number;
1926
+ isDivergent(): boolean;
1927
+ private advance;
1928
+ private isCaughtUp;
1929
+ private catchUp;
1930
+ private applyPage;
1931
+ private hasDiverged;
1932
+ private bootstrap;
1933
+ private isFreshEnough;
1934
+ private pull;
1935
+ private request;
1936
+ }
1937
+ declare const createReplicaLink: (host: ReplicaFollowerHost) => ShardReplica | undefined;
1938
+ declare const gateReplicaDispatch: (replica: ShardReplica, request: Request, functionPath: string) => Promise<Response | undefined>;
1939
+ declare const REPROJECTION_MIGRATION_PREFIX = "__lunora_reproject__";
1940
+ declare const reprojectionMigrationId: (table: string) => string;
1941
+ declare const reprojectableFields: (definition: TableDefinitionLike) => string[];
1942
+ declare const reprojectionTables: (schema: SchemaLike) => string[];
1943
+ declare const countLegacyRows: (sql: SqlExec, table: string, fields: ReadonlyArray<string>) => number;
1944
+ declare const buildReprojectionMigration: (id: string, schema: SchemaLike, sql: SqlExec) => DataMigrationLike | undefined;
1800
1945
  declare const RLS_UNWRAP_SYMBOL: symbol;
1801
1946
  declare class RlsRequiredError extends LunoraError {
1802
1947
  readonly table: string;
@@ -1812,7 +1957,8 @@ interface GuardableSchema {
1812
1957
  }>;
1813
1958
  }
1814
1959
  type TableOfId = (id: string, expectedTable?: string) => Promise<string | undefined> | string | undefined;
1815
- declare const guardWriter: <W>(raw: W, schema: GuardableSchema, tableOfId: TableOfId) => W;
1960
+ type TablesOfIds = (ids: ReadonlyArray<string>, expectedTable?: string) => Promise<ReadonlyMap<string, string>> | ReadonlyMap<string, string>;
1961
+ declare const guardWriter: <W>(raw: W, schema: GuardableSchema, tableOfId: TableOfId, tablesOfIds?: TablesOfIds) => W;
1816
1962
  declare const SCHEMA_HISTORY_MAX_VERSIONS = 50;
1817
1963
  interface SchemaVersionRow {
1818
1964
  appliedAt: number;
@@ -1874,8 +2020,16 @@ interface DrainableSink {
1874
2020
  readonly bufferedAmount?: unknown;
1875
2021
  }
1876
2022
  declare const trySendFrame: (ws: FrameSink, frame: string) => boolean;
1877
- declare const sendDeltaFrames: (ws: FrameSink, subId: string, deltaFrames: ReadonlyArray<string>, cursorSuffix: string) => boolean;
2023
+ declare const sendDeltaFrames: (ws: FrameSink, subId: string, deltaFrames: ReadonlyArray<string>, cursorSuffix: string, lastMutationId?: number) => boolean;
1878
2024
  declare const awaitWsDrain: (ws: DrainableSink) => Promise<void>;
2025
+ interface SubscriptionReadFootprint {
2026
+ ranges?: Map<string, KeyRange[]>;
2027
+ tables: Set<string>;
2028
+ }
2029
+ type ChangedKeys = Map<string, IndexKeyEntry[] | undefined>;
2030
+ declare const mergeChangedKeys: (pending: ChangedKeys | undefined, incoming: ChangedKeys | undefined, changed: Set<string>) => ChangedKeys;
2031
+ declare const recordChangedKeys: (pending: ChangedKeys | undefined, table: string, indexKeys: ReadonlyArray<IndexKeyEntry> | undefined) => ChangedKeys;
2032
+ declare const writeTouchesMemo: (memo: SubscriptionReadFootprint, changed: Set<string>, changedKeys: ChangedKeys | undefined) => boolean;
1879
2033
  type ConflictKind = "conflict" | "occ" | "restrict" | "trigger" | "unique";
1880
2034
  declare class ConflictError extends LunoraError {
1881
2035
  readonly kind: ConflictKind;
@@ -1903,4 +2057,4 @@ interface WhereSqlStrategy {
1903
2057
  serialize: SerializeValue;
1904
2058
  }
1905
2059
  declare const compileWhereSql: (where: WhereInput | undefined, strategy: WhereSqlStrategy) => SQL | undefined;
1906
- 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 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, 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 IndexRangeBuilderLike, 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 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 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 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, buildPokeFrames, buildSeekBeforeWhere, buildSeekWhere, buildSettings, bumpCdcEpoch, clampPromotionThresholds, clearCapturedMail, clearQueueMessages, coerceAggregateNumber, compileWhereSql, computeRankPage, containsRelationPredicate, coveringGeohashes, createCompanionSync, createDependencyTracker, createFanoutCounters, createIndexSql, 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, isDevEnvironment, isFtsAvailable, isLossyBody, isRelationPredicate, isSoftDeleted, isSourceDue, jsonPath, jsonPathSql, liftSourceId, lintReadonlySql, listTables, matchesRankStaticWhere, matchesStaticWhere, materializeExternalRows, materializeExternalRowsIncremental, 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, 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 };
2060
+ 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 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 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 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, 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 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, type SchedulableWorkflowReferenceLike, type ScheduledFunctionDoc, type SchedulerLike, type SchemaLike, type ScoredDocument, type SearchFilterBuilderLike, type SearchIndexDefinitionLike, type SearchScoredDocument, type SelectMatchingIdsOptions, type ServerDefaultContextLike, type SettingEntry, type SettingKind, type SettingsResult, type ShapePokePart, 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, 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, buildReprojectionMigration, buildSeekBeforeWhere, buildSeekWhere, buildSettings, bumpCdcEpoch, clampPromotionThresholds, clearCapturedMail, clearQueueMessages, coerceAggregateNumber, compileWhereSql, computeRankPage, containsRelationPredicate, countLegacyRows, coveringGeohashes, createCompanionSync, createDependencyTracker, createFanoutCounters, createIndexSql, createReadFootprint, createRelayLink, createReplicaLink, createShardCtxDb, createSystemReader, decodeCursor, deleteGlobalShapeSnapshot, deleteGlobalShapeSnapshotsForConnection, depKey, diffExternalSource, diffGlobalMembership, distinctValues, encodeAggregateKey, encodeCursor, encodeGeohash, encodePartitionKey, encodeRowsPatch, ensureAuditTable, ensureMailTable, exportShardRows, exportShardTable, facetColumn, fanOutScalarCounts, findStorageReferences, foldAggregateTally, gateReplicaDispatch, geoTableName, guardWriter, handleReplicaControl, 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, 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, selectShapeMemberIds, selectShapeRows, sendDeltaFrames, serializeSqlValue, shapeRoutingKey, softDeleteScope, sortColumnName, stableStringify, stableWireKey, subscriptionListDeltas, summarizeFanoutTopics, summarizeSubscriptions, tableColumns, tableFromDepKey, throwingScheduler, trimCdcChanges, trimIdempotent, tryRowToDocument, trySendFrame, validateImportRow, writeGlobalShapeSnapshot, writeIdempotent, writeSearchBackfillState, writeTouchesMemo };