@lunora/shard-engine 1.0.0-alpha.12 → 1.0.0-alpha.121

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 (160) hide show
  1. package/README.md +1 -1
  2. package/dist/conformance/index.mjs +1 -1
  3. package/dist/index.d.mts +682 -151
  4. package/dist/index.d.ts +682 -151
  5. package/dist/index.mjs +1 -1
  6. package/dist/packem_shared/ADMIN_FUNCTIONS-BGXP6oxh.mjs +1 -0
  7. package/dist/packem_shared/AGGREGATE_SQL_FUNCTION-DDEoMnJR.mjs +1 -0
  8. package/dist/packem_shared/AGG_COUNT-BIGZgU8U.mjs +1 -0
  9. package/dist/packem_shared/AUDIT_LOG_TABLE-CZNxCRLv.mjs +8 -0
  10. package/dist/packem_shared/BIGINT_KEY_DIGITS-C9a7Ix7k.mjs +1 -0
  11. package/dist/packem_shared/CDC_LOG_TABLE-GKlDpuM2.mjs +18 -0
  12. package/dist/packem_shared/CLIENT_WATERMARK_TABLE-vLjfNhBR.mjs +7 -0
  13. package/dist/packem_shared/COMMIT_SEQ_FIELD-BY_vc9bw.mjs +4 -0
  14. package/dist/packem_shared/CURSOR_PREFIX-C1jsjAPd.mjs +1 -0
  15. package/dist/packem_shared/CountRlsUnsupportedError-BvsDqfO2.mjs +1 -0
  16. package/dist/packem_shared/DATA_MIGRATION_STATE_TABLE-DfqA-2Dj.mjs +31 -0
  17. package/dist/packem_shared/DEFAULT_MAX_RELATION_KEYS-CQLms3UG.mjs +1 -0
  18. package/dist/packem_shared/DEFAULT_MAX_RELAYS-BqSpObEl.mjs +8 -0
  19. package/dist/packem_shared/DEFAULT_PROMOTION_THRESHOLDS-DEURXMvk.mjs +1 -0
  20. package/dist/packem_shared/DEFAULT_TRANSACTION_LIMITS-DiR5z5EX.mjs +1 -0
  21. package/dist/packem_shared/DurableStreamRunner-y2CRbfuZ.mjs +1 -0
  22. package/dist/packem_shared/GEO_DEFAULT_PRECISION-CqpQZ-J_.mjs +1 -0
  23. package/dist/packem_shared/GLOBAL_SHAPE_SNAPSHOT_TABLE-pMxZ-obU.mjs +7 -0
  24. package/dist/packem_shared/GlobalPollTick-BNK4o-XT.mjs +1 -0
  25. package/dist/packem_shared/IDEMPOTENCY_TABLE-AOJCuq5U.mjs +7 -0
  26. package/dist/packem_shared/MAIL_RETENTION-BxAGL3hK.mjs +18 -0
  27. package/dist/packem_shared/MAX_SQL_ROWS-Dh_Ty0Zo.mjs +4 -0
  28. package/dist/packem_shared/MAX_TOKEN_LENGTH-BakL9FUy-B3VwYY8C.mjs +1 -0
  29. package/dist/packem_shared/NotUniqueError-thbeLn0g.mjs +1 -0
  30. package/dist/packem_shared/QUEUE_TABLE-DKANxmEZ.mjs +17 -0
  31. package/dist/packem_shared/RANK_TIEBREAK-DrISKVKe.mjs +1 -0
  32. package/dist/packem_shared/REACTOR_STATE_TABLE-B8IehLv8.mjs +28 -0
  33. package/dist/packem_shared/RELATED_DEFAULT_LIMIT-e7viSuiO.mjs +1 -0
  34. package/dist/packem_shared/RELATION_EXISTS_KEY-CFUhnZSZ.mjs +1 -0
  35. package/dist/packem_shared/REPROJECTION_MIGRATION_PREFIX-Czcb6_mO.mjs +1 -0
  36. package/dist/packem_shared/RLS_UNWRAP_SYMBOL-Dv9crDfv.mjs +1 -0
  37. package/dist/packem_shared/ReactiveCache-Bdzsahf3.mjs +1 -0
  38. package/dist/packem_shared/SCAN_DEP-D7qE3iUe.mjs +1 -0
  39. package/dist/packem_shared/SCHEDULE_OUTBOX_TABLE-CgLvGxpY.mjs +11 -0
  40. package/dist/packem_shared/SCHEMA_HISTORY_MAX_VERSIONS-BMcUIqBY.mjs +6 -0
  41. package/dist/packem_shared/SEARCH_STATE_TABLE-wgl-SePe.mjs +1 -0
  42. package/dist/packem_shared/SHAPE_POKE_CURSOR_TABLE-cn0stGAL.mjs +8 -0
  43. package/dist/packem_shared/ShapeDiffCache-Br3kxusw.mjs +1 -0
  44. package/dist/packem_shared/ShardRunner-CrveaPId.mjs +1 -0
  45. package/dist/packem_shared/UNVOUCHABLE_DEP-C68htACn.mjs +1 -0
  46. package/dist/packem_shared/VECTOR_BACKFILL_MAX_PAGES-CO1Ra57t.mjs +1 -0
  47. package/dist/packem_shared/WORKERD_SQLITE_LIMITS-DBH23L_S.mjs +1 -0
  48. package/dist/packem_shared/aggregateTableName-DbAttCNH.mjs +1 -0
  49. package/dist/packem_shared/appendStreamChunk-7ZyAZGg_.mjs +17 -0
  50. package/dist/packem_shared/applyOnDelete-8n5PzcI0.mjs +1 -0
  51. package/dist/packem_shared/archiveCdcSegment-BON69Nug.mjs +4 -0
  52. package/dist/packem_shared/{armRestore-BNzdvQ_o.mjs → armRestore-Bu1_8SUa.mjs} +1 -1
  53. package/dist/packem_shared/awaitWsDrain-D4E7Oiwo.mjs +1 -0
  54. package/dist/packem_shared/backfillAggregateIndexes-B1yVAkvK.mjs +1 -0
  55. package/dist/packem_shared/base64-DfpzS4o_.mjs +1 -0
  56. package/dist/packem_shared/buildIndexRange-6nIZDf4m.mjs +1 -0
  57. package/dist/packem_shared/buildPokeFrames-CDOP-XYp.mjs +1 -0
  58. package/dist/packem_shared/buildReprojectionMigration-BnUbAUwT.mjs +1 -0
  59. package/dist/packem_shared/buildSettings-BRkZd6_E.mjs +1 -0
  60. package/dist/packem_shared/buildShapeDiff-AxUzi_GL.mjs +1 -0
  61. package/dist/packem_shared/clearCompanionSignatures-C2CSfkeQ.mjs +1 -0
  62. package/dist/packem_shared/clearMemoryTables-CogAvVHR.mjs +1 -0
  63. package/dist/packem_shared/compileWhereSql-DLfUbHc-.mjs +1 -0
  64. package/dist/packem_shared/computeRankPage-BI2lNKPu.mjs +1 -0
  65. package/dist/packem_shared/createCompanionSync-hGCzG0O1.mjs +1 -0
  66. package/dist/packem_shared/createReplicaLink-CJn5lH0o.mjs +7 -0
  67. package/dist/packem_shared/createSystemReader-DcDLFfC-.mjs +1 -0
  68. package/dist/packem_shared/ctx-db-relay-shapes-kGRKSxRs.mjs +17 -0
  69. package/dist/packem_shared/ctx-db-search-state-DVCp4JQf.mjs +1 -0
  70. package/dist/packem_shared/defineEngineContractSuite-eCIuMGrM.mjs +1 -0
  71. package/dist/packem_shared/diffExternalSource-DgDJhslq.mjs +1 -0
  72. package/dist/packem_shared/do-sql-CyWszGdM.mjs +1 -0
  73. package/dist/packem_shared/effective-kind-BmG_zCAy.mjs +1 -0
  74. package/dist/packem_shared/envOptionalPositiveInt-D2pY-c64.mjs +1 -0
  75. package/dist/packem_shared/estimate-bytes-CTuiPWMD.mjs +1 -0
  76. package/dist/packem_shared/exportShardRows-CTDgQEF8.mjs +1 -0
  77. package/dist/packem_shared/fts-companion-pUdD6kF-.mjs +1 -0
  78. package/dist/packem_shared/ftsCompanionDdl-Co6WSyCB.mjs +1 -0
  79. package/dist/packem_shared/hasTrigger-CjlwI4le.mjs +1 -0
  80. package/dist/packem_shared/isInternalTableName-BoljO2tP.mjs +1 -0
  81. package/dist/packem_shared/isPushableWhere-BeYAOjUb.mjs +1 -0
  82. package/dist/packem_shared/isSoftDeleted-BHlFkAsr.mjs +9 -0
  83. package/dist/packem_shared/liftSourceId-CA3ENhXj.mjs +1 -0
  84. package/dist/packem_shared/materializeExternalRows-Csa8ELkU.mjs +1 -0
  85. package/dist/packem_shared/mergeChangedKeys-DH9RAARR.mjs +1 -0
  86. package/dist/packem_shared/quoteIdentifier-CObIFRhb.mjs +1 -0
  87. package/dist/packem_shared/relation-operators-BEg-CvCH.mjs +1 -0
  88. package/dist/packem_shared/runDrizzle-Du5HLitO.mjs +1 -0
  89. package/dist/packem_shared/runShardMigrations-3BBkjGHs.mjs +5 -0
  90. package/dist/packem_shared/runSocketPool-CZJ2X9cF.mjs +1 -0
  91. package/dist/packem_shared/selectExpiredIds-5bAT7X28.mjs +1 -0
  92. package/dist/packem_shared/selectShapeMembers-CNpeUQ-H.mjs +1 -0
  93. package/dist/packem_shared/serializeSqlValue-BbZ5hKM7.mjs +1 -0
  94. package/dist/packem_shared/stableStringify-DibjylKD.mjs +1 -0
  95. package/dist/packem_shared/stableWireKey-Bdh5JSdg.mjs +1 -0
  96. package/dist/packem_shared/stubByName-C_P73AOx.mjs +1 -0
  97. package/dist/packem_shared/where-sql-DFs8Zw7-.mjs +1 -0
  98. package/dist/packem_shared/wire-codec-BYCSiazv.mjs +1 -0
  99. package/package.json +4 -4
  100. package/dist/packem_shared/ADMIN_FUNCTIONS-vj2G8OR6.mjs +0 -1
  101. package/dist/packem_shared/AGGREGATE_SQL_FUNCTION-QYaiuty4.mjs +0 -1
  102. package/dist/packem_shared/AGG_COUNT-bU-IX6a9.mjs +0 -1
  103. package/dist/packem_shared/AUDIT_LOG_TABLE-CaA0jL0L.mjs +0 -8
  104. package/dist/packem_shared/CDC_LOG_TABLE-Bh1V4Kd6.mjs +0 -8
  105. package/dist/packem_shared/CLIENT_WATERMARK_TABLE-CXsSLU8D.mjs +0 -7
  106. package/dist/packem_shared/CountRlsUnsupportedError-B2WKJD9v.mjs +0 -1
  107. package/dist/packem_shared/DATA_MIGRATION_STATE_TABLE-BZMVrLcy.mjs +0 -31
  108. package/dist/packem_shared/DEFAULT_MAX_RELATION_KEYS-bq00btqV.mjs +0 -1
  109. package/dist/packem_shared/DEFAULT_MAX_RELAYS-CyHnBo4l.mjs +0 -1
  110. package/dist/packem_shared/DEFAULT_PROMOTION_THRESHOLDS-BdmnUGLO.mjs +0 -1
  111. package/dist/packem_shared/DEFAULT_TRANSACTION_LIMITS-BH5q0Ror.mjs +0 -1
  112. package/dist/packem_shared/FTS_COUNT_COLUMN-D1gY3wwZ-CZHdaRrd.mjs +0 -1
  113. package/dist/packem_shared/GEO_DEFAULT_PRECISION-okRCkZ6r.mjs +0 -1
  114. package/dist/packem_shared/GLOBAL_SHAPE_SNAPSHOT_TABLE-DX-6-gBP.mjs +0 -7
  115. package/dist/packem_shared/IDEMPOTENCY_TABLE-DjkEMp6w.mjs +0 -7
  116. package/dist/packem_shared/MAIL_RETENTION-KmozO2NQ.mjs +0 -18
  117. package/dist/packem_shared/MAX_SQL_ROWS-nMwkxv5f.mjs +0 -2
  118. package/dist/packem_shared/NotUniqueError-B6YgCluj.mjs +0 -1
  119. package/dist/packem_shared/QUEUE_TABLE-DYCDvzTG.mjs +0 -17
  120. package/dist/packem_shared/RANK_TIEBREAK-9NU5s_mi.mjs +0 -1
  121. package/dist/packem_shared/RELATION_EXISTS_KEY-BaqSIFU1.mjs +0 -1
  122. package/dist/packem_shared/RLS_UNWRAP_SYMBOL-CBYPlYBb.mjs +0 -1
  123. package/dist/packem_shared/ReactiveCache-DsugPL74.mjs +0 -1
  124. package/dist/packem_shared/SCAN_DEP-D_yR9EeV.mjs +0 -1
  125. package/dist/packem_shared/SCHEMA_HISTORY_MAX_VERSIONS-CHXz6p_z.mjs +0 -6
  126. package/dist/packem_shared/SEARCH_STATE_TABLE-eLN8U5tz.mjs +0 -1
  127. package/dist/packem_shared/ShardRunner-DIqVdWtk.mjs +0 -1
  128. package/dist/packem_shared/aggregateTableName-G-eXyjcz.mjs +0 -1
  129. package/dist/packem_shared/applyOnDelete-uFRC5p1d.mjs +0 -1
  130. package/dist/packem_shared/applySelect-B0CF8T7y.mjs +0 -1
  131. package/dist/packem_shared/awaitWsDrain-B6fvyq9n.mjs +0 -1
  132. package/dist/packem_shared/backfillAggregateIndexes-Bj8UVaWL.mjs +0 -1
  133. package/dist/packem_shared/buildIndexRange-DFsdtPjD.mjs +0 -1
  134. package/dist/packem_shared/buildPokeFrames-CCxYXd2V.mjs +0 -1
  135. package/dist/packem_shared/buildSettings-DT18_DkX.mjs +0 -1
  136. package/dist/packem_shared/compileWhereSql-BLcfs4QW.mjs +0 -1
  137. package/dist/packem_shared/computeRankPage-IUSS-zIB.mjs +0 -1
  138. package/dist/packem_shared/createCompanionSync-CGkMct7-.mjs +0 -1
  139. package/dist/packem_shared/createReadFootprint-DIrrxRTE.mjs +0 -1
  140. package/dist/packem_shared/createSystemReader-DcDcrtM3.mjs +0 -1
  141. package/dist/packem_shared/defineEngineContractSuite-DnGL8k8w.mjs +0 -1
  142. package/dist/packem_shared/diffExternalSource-DMpkJta1.mjs +0 -1
  143. package/dist/packem_shared/estimate-bytes-DwQON1Ky.mjs +0 -1
  144. package/dist/packem_shared/exportShardRows-kt42wijd.mjs +0 -1
  145. package/dist/packem_shared/hasTrigger-CbkOHExZ.mjs +0 -1
  146. package/dist/packem_shared/isSoftDeleted-DeUj28TM.mjs +0 -9
  147. package/dist/packem_shared/liftSourceId-DApAbu7Q.mjs +0 -1
  148. package/dist/packem_shared/materializeExternalRows-DH_xI7fa.mjs +0 -1
  149. package/dist/packem_shared/mergeChangedKeys-BXtUgIPW.mjs +0 -1
  150. package/dist/packem_shared/param-B5lF5Jd9.mjs +0 -1
  151. package/dist/packem_shared/quote-identifier-CGiYFBvY.mjs +0 -1
  152. package/dist/packem_shared/runDrizzle-GKR3y97k.mjs +0 -1
  153. package/dist/packem_shared/runShardMigrations-bUJf9Tc5.mjs +0 -5
  154. package/dist/packem_shared/runSocketPool-DPQLVyWF.mjs +0 -1
  155. package/dist/packem_shared/selectExpiredIds-DeNDLslI.mjs +0 -1
  156. package/dist/packem_shared/selectShapeMemberIds-C2z9QRg5.mjs +0 -1
  157. package/dist/packem_shared/serializeSqlValue-DnpyaLcw.mjs +0 -1
  158. package/dist/packem_shared/stableStringify-BjLh4gvA.mjs +0 -1
  159. package/dist/packem_shared/stableWireKey-C4JfdJ_e.mjs +0 -1
  160. package/dist/packem_shared/wire-codec-D_fiax9d.mjs +0 -1
package/dist/index.d.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  import { LunoraError } from '@lunora/errors';
2
+ import { R2BucketLike, ShardHost, SocketHost, SocketHandle } from '@lunora/platform';
2
3
  import { SQL, Name } from 'drizzle-orm';
3
- import { ShardHost, SocketHost, SocketHandle } from '@lunora/platform';
4
4
  interface KeyRange {
5
5
  hi: string;
6
6
  index: string;
@@ -27,10 +27,12 @@ interface ScheduledFunctionDoc {
27
27
  args: Record<string, unknown>;
28
28
  attempts?: number;
29
29
  enqueuedAt: number;
30
- functionPath: string;
30
+ functionPath?: string;
31
31
  id: string;
32
+ pool?: string;
32
33
  scheduledFor: number;
33
34
  shardKey?: string;
35
+ workflow?: string;
34
36
  }
35
37
  interface StorageMetadata {
36
38
  contentType?: string;
@@ -86,6 +88,75 @@ interface WhereInput {
86
88
  OR?: WhereInput[];
87
89
  }
88
90
  declare const RELATION_EXISTS_KEY = "__relationExists";
91
+ interface SubscriptionQuery {
92
+ args?: Record<string, unknown>;
93
+ functionPath?: string;
94
+ sinceEpoch?: string;
95
+ sinceSeq?: number;
96
+ table?: string;
97
+ }
98
+ interface ShapeSubscriptionQuery {
99
+ args?: Record<string, unknown>;
100
+ name: string;
101
+ sinceEpoch?: string;
102
+ sinceSeq?: number;
103
+ }
104
+ interface SubscriptionEnvelope {
105
+ caps?: string[];
106
+ clientId?: string;
107
+ context?: Record<string, unknown>;
108
+ data?: unknown;
109
+ generation?: number;
110
+ id: string;
111
+ query?: SubscriptionQuery;
112
+ shape?: {
113
+ args?: Record<string, unknown>;
114
+ name: string;
115
+ };
116
+ sinceCheckpoint?: number;
117
+ sinceChunk?: number;
118
+ sinceEpoch?: string;
119
+ topic?: string;
120
+ type: "ack" | "connect" | "shape_subscribe" | "shape_unsubscribe" | "stream" | "subscribe" | "unsubscribe" | "whisper" | "whisper_subscribe" | "whisper_unsubscribe";
121
+ }
122
+ interface RpcRequest {
123
+ args?: Record<string, unknown>;
124
+ functionPath: string;
125
+ }
126
+ interface SocketAttachment {
127
+ admin?: boolean;
128
+ adminBinding?: string;
129
+ clientId?: string;
130
+ connected?: boolean;
131
+ connectionId?: string;
132
+ context?: Record<string, unknown>;
133
+ expiresAt?: number;
134
+ identity?: Record<string, unknown>;
135
+ ip?: string;
136
+ pageDeltas?: boolean;
137
+ shapes?: Record<string, ShapeSubscriptionQuery>;
138
+ subs: Record<string, SubscriptionQuery>;
139
+ userId?: string;
140
+ whispers?: string[];
141
+ }
142
+ interface ResolvedShape {
143
+ columns?: ReadonlyArray<string>;
144
+ effectiveWhere?: WhereInput;
145
+ global?: boolean;
146
+ table: string;
147
+ }
148
+ interface SubscriptionIdentity {
149
+ identity?: Record<string, unknown>;
150
+ ip?: string;
151
+ userId?: string;
152
+ }
153
+ interface ShardSocketLike {
154
+ readonly bufferedAmount?: number;
155
+ close?: (code?: number, reason?: string) => void;
156
+ deserializeAttachment?: () => unknown;
157
+ send: (data: string) => void;
158
+ serializeAttachment?: (value: unknown) => void;
159
+ }
89
160
  type AggregateOp = "avg" | "count" | "max" | "min" | "sum";
90
161
  interface AggregateIndexDefinitionLike {
91
162
  readonly by?: ReadonlyArray<string>;
@@ -137,6 +208,10 @@ interface ColumnMetaLike {
137
208
  interface ValidatorLike {
138
209
  readonly _meta?: {
139
210
  readonly column?: ColumnMetaLike;
211
+ readonly inner?: ValidatorLike;
212
+ readonly members?: ReadonlyArray<ValidatorLike>;
213
+ readonly tableName?: string;
214
+ readonly value?: unknown;
140
215
  };
141
216
  readonly kind?: string;
142
217
  readonly parse?: (value: unknown) => unknown;
@@ -144,7 +219,7 @@ interface ValidatorLike {
144
219
  type TriggerTimingLike = "after" | "before";
145
220
  type TriggerOpLike = "delete" | "insert" | "update";
146
221
  interface SchedulableWorkflowReferenceLike {
147
- readonly binding?: string;
222
+ readonly className?: string;
148
223
  readonly isLunoraWorkflow: true;
149
224
  readonly name?: string;
150
225
  }
@@ -180,9 +255,12 @@ interface SchemaLike {
180
255
  }
181
256
  interface TableDefinitionLike {
182
257
  readonly aggregateIndexes?: ReadonlyArray<AggregateIndexDefinitionLike>;
258
+ readonly commitOrderedMode?: boolean;
259
+ readonly dropStalePatchesMode?: boolean;
183
260
  readonly geoIndexes?: ReadonlyArray<GeoIndexDefinitionLike>;
184
261
  readonly indexes: ReadonlyArray<IndexDefinitionLike>;
185
262
  readonly isPublic?: boolean;
263
+ readonly memoryMode?: boolean;
186
264
  readonly rankIndexes?: ReadonlyArray<RankIndexDefinitionLike>;
187
265
  readonly relationMap?: Record<string, RelationDefinitionLike>;
188
266
  readonly searchIndexes?: ReadonlyArray<SearchIndexDefinitionLike>;
@@ -219,17 +297,16 @@ interface WithInput {
219
297
  [relationName: string]: NestedWith | Record<string, true> | boolean | undefined;
220
298
  _count?: Record<string, true>;
221
299
  }
222
- interface ApplyOnDeleteOptions$1 {
223
- database: DatabaseWriterLike;
224
- relation: RelationDefinitionLike;
225
- row: Record<string, unknown>;
226
- tableName: string;
300
+ interface FanOutBudget {
301
+ remaining: number;
227
302
  }
228
303
  interface ResolveWithOptions {
304
+ fanOutBudget?: FanOutBudget;
229
305
  fetcher: (tableName: string, args: QueryArgs) => Promise<QueryPage>;
230
306
  groupedCounter: (tableName: string, whereField: string, values: unknown[], policyWhere?: WhereInput) => Promise<Map<unknown, number>>;
231
307
  parents: Record<string, unknown>[];
232
308
  relationBaseWhere?: (table: string) => undefined | WhereInput;
309
+ relationMask?: RelationMask;
233
310
  schema: {
234
311
  readonly tables: Record<string, TableDefinitionLike>;
235
312
  };
@@ -248,22 +325,69 @@ interface QueryArgs {
248
325
  cursor?: null | string;
249
326
  includeDeleted?: boolean;
250
327
  limit?: number;
328
+ omitContinueCursor?: boolean;
251
329
  orderBy?: OrderByInput[];
252
330
  relationBaseWhere?: (table: string) => undefined | WhereInput;
331
+ relationMask?: RelationMask;
253
332
  restrictsCounts?: boolean;
254
333
  select?: ReadonlyArray<string>;
255
334
  where?: WhereInput;
256
335
  with?: WithInput;
257
336
  }
337
+ interface CrossShardReadArgs {
338
+ orderBy?: OrderByInput[];
339
+ relationPolicies?: Record<string, WhereInput>;
340
+ where?: WhereInput;
341
+ with?: WithInput;
342
+ }
343
+ type RelationMask = (table: string, rows: Record<string, unknown>[]) => Record<string, unknown>[];
258
344
  interface QueryPage {
259
345
  continueCursor: null | string;
260
346
  isDone: boolean;
261
347
  page: Record<string, unknown>[];
262
348
  splitCursor?: null | string;
263
349
  }
350
+ interface RelationEdge {
351
+ readonly array: boolean;
352
+ readonly column: string;
353
+ readonly name: string;
354
+ readonly sourceTable: string;
355
+ readonly targetTable: string;
356
+ }
357
+ interface RelatedStartReference {
358
+ id: string;
359
+ table: string;
360
+ }
361
+ type RelatedStart = (Record<string, unknown> & {
362
+ _id: string;
363
+ }) | RelatedStartReference;
364
+ type RelatedDirection = "both" | "in" | "out";
365
+ interface RelatedOptions {
366
+ cursor?: null | string;
367
+ depth?: number;
368
+ direction?: RelatedDirection;
369
+ edges?: ReadonlyArray<string>;
370
+ limit?: number;
371
+ relationBaseWhere?: (table: string) => undefined | WhereInput;
372
+ relationMask?: RelationMask;
373
+ }
374
+ interface RelatedNode {
375
+ depth: number;
376
+ document: Record<string, unknown>;
377
+ path: ReadonlyArray<string>;
378
+ pathIds: ReadonlyArray<string>;
379
+ score: number;
380
+ table: string;
381
+ }
382
+ interface RelatedPage {
383
+ continueCursor: null | string;
384
+ isDone: boolean;
385
+ nodes: RelatedNode[];
386
+ }
264
387
  interface OrderKey {
265
388
  direction: SortDirection;
266
389
  field: string;
390
+ nullable: boolean;
267
391
  }
268
392
  interface RestrictableQueryOptions {
269
393
  baseWhere?: WhereInput;
@@ -399,10 +523,8 @@ interface LifecycleEvent {
399
523
  shardKey: string;
400
524
  userId: string | null;
401
525
  }
402
- interface LifecycleDispatchInfo {
526
+ interface LifecycleDispatchInfo extends SubscriptionIdentity {
403
527
  event: LifecycleEvent;
404
- identity: Record<string, unknown> | undefined;
405
- userId: string | undefined;
406
528
  }
407
529
  interface MutationDelta {
408
530
  indexKeys?: ReadonlyArray<IndexKeyEntry>;
@@ -414,6 +536,13 @@ interface MutationDelta {
414
536
  interface DatabaseWriterLike {
415
537
  aggregate: (tableName: string, options: AggregateOptions) => Promise<AggregateResult>;
416
538
  asId?: (tableName: string, id: string) => string;
539
+ cdcChangedTables?: (sinceSeq: number, options?: {
540
+ cursorOnly?: boolean;
541
+ }) => Promise<{
542
+ cursor: number;
543
+ floor?: number;
544
+ tables: string[];
545
+ } | undefined>;
417
546
  count: (tableName: string, where?: RestrictableQueryOptions | WhereInput) => Promise<number>;
418
547
  delete: (id: string, expectedTable?: string, options?: {
419
548
  hard?: boolean;
@@ -457,6 +586,13 @@ interface DatabaseWriterLike {
457
586
  }>;
458
587
  normalizeId: (tableName: string, id: string) => null | string;
459
588
  patch: (id: string, patch: Record<string, unknown>, expectedTable?: string) => Promise<void>;
589
+ patchIf?: (tableName: string, id: string, args: {
590
+ patch: Record<string, unknown>;
591
+ where: WhereInput;
592
+ }) => Promise<{
593
+ applied: boolean;
594
+ doc: Record<string, unknown> | null;
595
+ }>;
460
596
  patchMany?: (patches: ReadonlyArray<{
461
597
  id: string;
462
598
  patch: Record<string, unknown>;
@@ -478,6 +614,8 @@ interface DatabaseWriterLike {
478
614
  rankBefore?: (tableName: string, indexName: string, options: RankBeforeOptions) => Promise<RankBeforeResult>;
479
615
  rankPage: (tableName: string, indexName: string, options?: RankPageOptions) => Promise<RankPage>;
480
616
  rankPageRows?: (tableName: string, indexName: string, options?: RankPageOptions) => Promise<ShardRankPageResult>;
617
+ related?: (start: RelatedStart, options?: RelatedOptions) => Promise<RelatedPage>;
618
+ relationEdges?: ReadonlyArray<RelationEdge>;
481
619
  replace: (id: string, document: Record<string, unknown>, expectedTable?: string, options?: {
482
620
  allowExplicitId?: boolean;
483
621
  }) => Promise<void>;
@@ -516,7 +654,6 @@ interface ImportShardResult {
516
654
  inserted: Record<string, number>;
517
655
  }
518
656
  declare const selectExportTables: (schema: SchemaLike, requested?: ReadonlyArray<string>) => string[];
519
- declare const exportShardTable: (writer: DatabaseWriterLike, table: string, batchSize?: number) => AsyncGenerator<ExportRow, void, undefined>;
520
657
  declare const exportShardRows: (writer: DatabaseWriterLike, schema: SchemaLike, args: ExportShardArgs) => AsyncGenerator<ExportRow, void, undefined>;
521
658
  declare const validateImportRow: (schema: SchemaLike, table: string, record: Record<string, unknown>) => string | undefined;
522
659
  declare const importShardRows: (writer: DatabaseWriterLike, schema: SchemaLike, args: ImportShardArgs) => Promise<ImportShardResult>;
@@ -591,6 +728,7 @@ declare class ReactiveCache {
591
728
  private readonly maxBytes;
592
729
  private readonly now;
593
730
  private monotonic;
731
+ private generation;
594
732
  constructor(options?: ReactiveCacheOptions);
595
733
  run<R>(key: string, deps: Set<string>, run: () => Promise<R>, ranges?: () => ReadonlyArray<KeyRange>): Promise<R>;
596
734
  invalidate(table: string, id: string, indexKeys?: ReadonlyArray<IndexKeyEntry>): string[];
@@ -612,6 +750,7 @@ declare class ReactiveCache {
612
750
  };
613
751
  private dropRangeDeps;
614
752
  private collectAndDrop;
753
+ private dropKeys;
615
754
  private dropEntry;
616
755
  private evict;
617
756
  }
@@ -650,12 +789,18 @@ interface RunTriggersOptions {
650
789
  }
651
790
  declare const runTriggers: (options: RunTriggersOptions) => Promise<void>;
652
791
  declare const hasTrigger: (schema: SchemaLike, tableName: string, op: TriggerOpLike) => boolean;
792
+ interface SearchBackfillProgress {
793
+ done: boolean;
794
+ pages: number;
795
+ }
653
796
  declare const backfillAggregateIndexes: (sql: SqlExec, schema: SchemaLike) => void;
654
797
  declare const backfillRankIndexes: (sql: SqlExec, schema: SchemaLike) => void;
655
798
  declare const backfillSearchIndexesForTable: (sql: SqlExec, tableName: string, definition: {
656
799
  searchIndexes?: ReadonlyArray<SearchIndexDefinitionLike>;
657
800
  }) => void;
658
- declare const backfillSearchIndexes: (sql: SqlExec, schema: SchemaLike) => void;
801
+ declare const backfillSearchIndexes: (sql: SqlExec, schema: SchemaLike, options?: {
802
+ maxPages?: number;
803
+ }) => SearchBackfillProgress;
659
804
  declare const CDC_LOG_TABLE = "__cdc_log";
660
805
  interface CdcChange {
661
806
  doc?: Record<string, unknown>;
@@ -665,19 +810,35 @@ interface CdcChange {
665
810
  table: string;
666
811
  ts: number;
667
812
  }
668
- declare const migrateCdcLog: (sql: SqlExec) => void;
813
+ declare const CDC_LOG_TABLE_SEQ_INDEX = "__cdc_log_table_seq";
814
+ declare const migrateCdcLog: (sql: SqlExec, options?: {
815
+ rowHistoryIndex?: boolean;
816
+ }) => void;
669
817
  declare const appendCdcChange: (sql: SqlExec, ts: number, table: string, id: string, op: CdcChange["op"], doc: Record<string, unknown> | undefined) => void;
670
818
  declare const readCdcChanges: (sql: SqlExec, options?: {
671
819
  limit?: number;
672
820
  sinceSeq?: number;
673
- tables?: ReadonlySet<string>;
674
821
  }) => {
675
822
  changes: CdcChange[];
676
823
  cursor: number;
677
824
  };
678
- declare const trimCdcChanges: (sql: SqlExec, throughSeq: number) => void;
825
+ declare const cdcTouchesTables: (sql: SqlExec, sinceSeq: number, tables: ReadonlySet<string>) => boolean;
826
+ declare const cdcCanVouchFor: (sql: SqlExec, deps: ReadonlySet<string>) => boolean;
827
+ interface CdcChangeKey {
828
+ id: string;
829
+ op: CdcChange["op"];
830
+ seq: number;
831
+ }
832
+ declare const readCdcChangeKeys: (sql: SqlExec, table: string, sinceSeq: number, upTo: number) => CdcChangeKey[];
833
+ declare const trimCdcChanges: (sql: SqlExec, throughSeq: number, maxRows: number) => void;
834
+ declare const compactCdcDocs: (sql: SqlExec, throughSeq: number, maxRows: number) => void;
835
+ declare const cdcSeqLeavingRows: (sql: SqlExec, keep: number) => number | undefined;
679
836
  declare const readCdcCursor: (sql: SqlExec) => number;
837
+ declare const cursorBelowRetainedFloor: (floor: number | undefined, sinceSeq: number) => boolean;
838
+ declare const cdcTrimmedError: (floor: number, sinceSeq: number, scope: "global" | "shard") => LunoraError;
839
+ declare const cdcForkedError: (cursor: number, sinceSeq: number, scope: "global" | "shard", epoch?: string) => LunoraError;
680
840
  declare const minCdcSeq: (sql: SqlExec) => number | undefined;
841
+ declare const minCdcReplayableSeq: (sql: SqlExec) => number | undefined;
681
842
  declare const CDC_META_TABLE = "__cdc_meta";
682
843
  declare const migrateCdcMeta: (sql: SqlExec) => void;
683
844
  declare const readCdcEpoch: (sql: SqlExec) => string;
@@ -687,12 +848,6 @@ declare const CLIENT_WATERMARK_TABLE = "__client_watermark";
687
848
  declare const migrateClientWatermark: (sql: SqlExec) => void;
688
849
  declare const readClientWatermark: (sql: SqlExec, identity: string, clientId: string) => number;
689
850
  declare const advanceClientWatermark: (sql: SqlExec, identity: string, clientId: string, mutationId: number) => void;
690
- declare const GLOBAL_SHAPE_SNAPSHOT_TABLE = "__global_shape_snapshot";
691
- declare const migrateGlobalShapeSnapshot: (sql: SqlExec) => void;
692
- declare const readGlobalShapeSnapshot: (sql: SqlExec, connectionId: string, subId: string) => Map<string, string>;
693
- declare const writeGlobalShapeSnapshot: (sql: SqlExec, connectionId: string, subId: string, snapshot: Map<string, string>) => void;
694
- declare const deleteGlobalShapeSnapshot: (sql: SqlExec, connectionId: string, subId: string) => void;
695
- declare const deleteGlobalShapeSnapshotsForConnection: (sql: SqlExec, connectionId: string) => void;
696
851
  declare const IDEMPOTENCY_TABLE = "__idempotency";
697
852
  interface IdempotentRecord {
698
853
  resultJson: string;
@@ -709,50 +864,19 @@ declare const runShardMigrations: (sql: SqlExec, schema: SchemaLike, options?: {
709
864
  json: string;
710
865
  };
711
866
  }) => void;
712
- /**
713
- * How far a search companion's backfill has progressed, and what the next pass
714
- * should do about it.
715
- *
716
- * Neither stored analysis nor query policy, which is why it is its own module
717
- * rather than a third responsibility bolted onto one of them: it is *progress*,
718
- * the one piece of search state that is written as the index is built rather
719
- * than decided when it is read.
720
- *
721
- * The policy below is shared because when each engine owned a copy they
722
- * immediately disagreed about exactly the two cases that matter — whether a row
723
- * with no recorded profile may be resumed (it may not; nothing says what
724
- * analyzed it) and whether a never-started index is worth wiping (it is not;
725
- * there is nothing in it).
726
- */
727
- /**
728
- * How far a companion's backfill has progressed, and under which analysis.
729
- * Declared here rather than beside either engine's state table: both record the
730
- * same three facts, and the decisions made from them are the shared policy
731
- * below.
732
- */
733
- interface SearchBackfillState {
734
- /** Last `id` indexed, or `undefined` when no page has run yet. */
735
- cursor: string | undefined;
736
- /** True once a page came back short — the table is fully indexed. */
737
- done: boolean;
738
- /** Analyzer profile the stored rows were built with; `undefined` predates profile tracking. */
739
- profile: string | undefined;
740
- }
741
- declare const SEARCH_STATE_TABLE = "__lunora_search_state";
742
- declare const migrateSearchState: (sql: SqlExec) => void;
743
- declare const readSearchBackfillState: (sql: SqlExec, companion: string) => SearchBackfillState;
744
- declare const writeSearchBackfillState: (sql: SqlExec, companion: string, cursor: string | undefined, done: boolean, profile: string) => void;
745
867
  interface ShapeRow {
746
868
  doc: Record<string, unknown>;
747
869
  id: string;
748
870
  }
749
871
  declare const selectShapeRows: (sql: SqlExec, table: string, effectiveWhere: WhereInput | undefined) => ShapeRow[];
750
- declare const selectShapeMemberIds: (sql: SqlExec, table: string, effectiveWhere: WhereInput | undefined, ids: ReadonlyArray<string>) => Set<string>;
872
+ declare const selectShapeMembers: (sql: SqlExec, table: string, effectiveWhere: WhereInput | undefined, ids: ReadonlyArray<string>) => Map<string, Record<string, unknown>>;
751
873
  interface SqlExec {
752
874
  exec: <Row = Record<string, unknown>>(sql: string, ...params: unknown[]) => SqlCursor<Row>;
753
875
  }
754
876
  interface SqlCursor<Row> extends Iterable<Row> {
877
+ readonly columnNames?: string[];
755
878
  one: () => Row;
879
+ raw?: () => IterableIterator<unknown[]>;
756
880
  toArray: () => Row[];
757
881
  }
758
882
  type IndexUseHook = (table: string, indexName: string, kind: "geo" | "index" | "rank" | "search") => void;
@@ -768,6 +892,7 @@ interface WriteEvent {
768
892
  type WriteHook = (event: WriteEvent) => Promise<void> | void;
769
893
  interface CtxDbOptions {
770
894
  auth?: ServerDefaultContextLike["auth"];
895
+ baselineSeq?: () => number | undefined;
771
896
  broadcast?: BroadcastDelta;
772
897
  cache?: ReactiveCache;
773
898
  cdc?: boolean;
@@ -776,10 +901,16 @@ interface CtxDbOptions {
776
901
  globalDb?: DatabaseWriterLike;
777
902
  headroom?: TransactionHeadroomTracker;
778
903
  idGenerator?: IdGenerator;
904
+ inTransaction?: () => boolean;
779
905
  maxRelationKeys?: number;
780
906
  onIndexUse?: IndexUseHook;
781
907
  onRead?: ReadHook;
782
908
  onReadRange?: (range: KeyRange) => void;
909
+ onStalePatchDropped?: (event: {
910
+ fields: string[];
911
+ id: string;
912
+ table: string;
913
+ }) => void;
783
914
  onWrite?: WriteHook;
784
915
  relationExistsPushDown?: "always" | "auto" | "never";
785
916
  scheduler?: SchedulerLike;
@@ -792,6 +923,8 @@ declare class NotUniqueError extends LunoraError {
792
923
  constructor(message?: string);
793
924
  }
794
925
  declare const normalizeIdStructurally: (schema: SchemaLike, tableName: string, id: string) => null | string;
926
+ declare const assertNoExplicitUndefined: (op: "patch" | "patchIf" | "replace", document: Record<string, unknown>) => void;
927
+ declare const stripReservedPatchFields: (patch: Record<string, unknown>) => Record<string, unknown>;
795
928
  declare const createShardCtxDb: (options: CtxDbOptions) => DatabaseWriterLike;
796
929
  declare const AUDIT_LOG_TABLE = "__lunora_audit__";
797
930
  interface AuditEntry {
@@ -815,68 +948,24 @@ declare const readAuditLog: (sql: SqlExec, options?: {
815
948
  limit?: number;
816
949
  sinceSeq?: number;
817
950
  }) => AuditEntry[];
818
- interface SubscriptionQuery {
819
- args?: Record<string, unknown>;
820
- functionPath?: string;
821
- sinceEpoch?: string;
822
- sinceSeq?: number;
823
- table?: string;
824
- }
825
- interface ShapeSubscriptionQuery {
826
- args?: Record<string, unknown>;
827
- name: string;
828
- sinceEpoch?: string;
829
- sinceSeq?: number;
830
- }
831
- interface SubscriptionEnvelope {
832
- clientId?: string;
833
- context?: Record<string, unknown>;
834
- data?: unknown;
835
- id: string;
836
- query?: SubscriptionQuery;
837
- shape?: {
838
- args?: Record<string, unknown>;
839
- name: string;
840
- };
841
- sinceCheckpoint?: number;
842
- sinceEpoch?: string;
843
- topic?: string;
844
- type: "ack" | "connect" | "shape_subscribe" | "shape_unsubscribe" | "stream" | "subscribe" | "unsubscribe" | "whisper" | "whisper_subscribe" | "whisper_unsubscribe";
845
- }
846
- interface RpcRequest {
847
- args?: Record<string, unknown>;
848
- functionPath: string;
849
- }
850
- interface SocketAttachment {
851
- admin?: boolean;
852
- clientId?: string;
853
- connected?: boolean;
854
- connectionId?: string;
855
- context?: Record<string, unknown>;
856
- expiresAt?: number;
857
- identity?: Record<string, unknown>;
858
- shapes?: Record<string, ShapeSubscriptionQuery>;
859
- subs: Record<string, SubscriptionQuery>;
860
- userId?: string;
861
- whispers?: string[];
862
- }
863
- interface ResolvedShape {
864
- columns?: ReadonlyArray<string>;
865
- effectiveWhere?: WhereInput;
866
- global?: boolean;
867
- table: string;
868
- }
869
- interface SubscriptionIdentity {
870
- identity?: Record<string, unknown>;
871
- userId?: string;
872
- }
873
- interface ShardSocketLike {
874
- readonly bufferedAmount?: number;
875
- close?: (code?: number, reason?: string) => void;
876
- deserializeAttachment?: () => unknown;
877
- send: (data: string) => void;
878
- serializeAttachment?: (value: unknown) => void;
879
- }
951
+ interface CdcArchiveScope {
952
+ epoch: string;
953
+ shard: string;
954
+ }
955
+ declare const readCdcArchivedThrough: (sql: SqlExec) => number;
956
+ declare const writeCdcArchivedThrough: (sql: SqlExec, seq: number) => void;
957
+ declare const archiveCdcSegment: (bucket: R2BucketLike, scope: CdcArchiveScope, changes: CdcChange[]) => Promise<void>;
958
+ declare const cdcArchiveRewound: (bucket: R2BucketLike, scope: CdcArchiveScope, archivedThrough: number) => Promise<boolean>;
959
+ declare const readArchivedCdcChanges: (bucket: R2BucketLike, scope: CdcArchiveScope, sinceSeq: number, limit: number | undefined) => Promise<{
960
+ changes: CdcChange[];
961
+ cursor: number;
962
+ } | undefined>;
963
+ declare const COMMIT_SEQ_TABLE = "__commit_seq";
964
+ declare const COMMIT_SEQ_FIELD = "_commitSeq";
965
+ declare const migrateCommitSeq: (sql: SqlExec) => void;
966
+ declare const readCommitSeq: (sql: SqlExec) => number;
967
+ declare const allocateCommitSeq: (sql: SqlExec) => number;
968
+ declare const clearCompanionSignatures: (sql: SqlExec) => void;
880
969
  interface CompanionSyncDeps {
881
970
  broadcast: (delta: MutationDelta) => void;
882
971
  indexKeysFor: (table: string, document?: Record<string, unknown>) => ReadonlyArray<{
@@ -900,6 +989,19 @@ interface CompanionSync {
900
989
  syncSearch: (tableName: string, id: string, document: Record<string, unknown> | undefined, previous?: Record<string, unknown>) => void;
901
990
  }
902
991
  declare const createCompanionSync: (deps: CompanionSyncDeps) => CompanionSync;
992
+ declare const GLOBAL_SHAPE_SNAPSHOT_TABLE = "__global_shape_snapshot";
993
+ declare const migrateGlobalShapeSnapshot: (sql: SqlExec) => void;
994
+ declare const readGlobalShapeSnapshot: (sql: SqlExec, connectionId: string, subId: string) => Map<string, string> | undefined;
995
+ declare const writeGlobalShapeSnapshot: (sql: SqlExec, connectionId: string, subId: string, snapshot: Map<string, string>) => void;
996
+ declare const deleteGlobalShapeSnapshot: (sql: SqlExec, connectionId: string, subId: string) => void;
997
+ declare const deleteGlobalShapeSnapshotsForConnection: (sql: SqlExec, connectionId: string) => void;
998
+ declare const isMemoryTable: (definition: TableDefinitionLike | undefined) => boolean;
999
+ declare const memoryTableNames: (schema: SchemaLike) => string[];
1000
+ declare const clearMemoryTables: (sql: SqlExec, schema: SchemaLike) => number;
1001
+ declare const resolveRankSeekTuple: (options: {
1002
+ after?: RankPageRowKey;
1003
+ cursor?: null | string;
1004
+ }) => unknown[] | undefined;
903
1005
  interface RankPageDeps {
904
1006
  assertRankPartitionLocal: (tableName: string, definition: TableDefinitionLike, index: RankIndexDefinitionLike) => void;
905
1007
  ensureRankBackfilled: (tableName: string, index: RankIndexDefinitionLike) => void;
@@ -917,8 +1019,67 @@ interface RankPageComputation {
917
1019
  key: RankPageRowKey;
918
1020
  }[];
919
1021
  }
920
- declare const hydrateDocsById: (deps: RankPageDeps, tableName: string, ids: ReadonlyArray<string>) => Map<string, Record<string, unknown>>;
921
1022
  declare const computeRankPage: (deps: RankPageDeps, tableName: string, indexName: string, rankPageOptions: RankPageOptions) => RankPageComputation;
1023
+ declare const SCHEDULE_OUTBOX_TABLE = "__schedule_outbox";
1024
+ interface ScheduleOutboxRow {
1025
+ attempts: number;
1026
+ envelopeJson: string;
1027
+ id: string;
1028
+ nextAttemptAt: number;
1029
+ }
1030
+ interface ScheduleOutboxEnvelope {
1031
+ args: unknown;
1032
+ options: Record<string, unknown> | undefined;
1033
+ target: unknown;
1034
+ when: number;
1035
+ }
1036
+ interface ScheduleOutbox {
1037
+ forget: (id: string) => void;
1038
+ record: (id: string, envelope: ScheduleOutboxEnvelope) => void;
1039
+ wake: () => void;
1040
+ }
1041
+ declare const migrateScheduleOutbox: (sql: SqlExec) => void;
1042
+ declare const recordScheduleOutbox: (sql: SqlExec, id: string, envelopeJson: string, now: number) => void;
1043
+ declare const forgetScheduleOutbox: (sql: SqlExec, id: string) => void;
1044
+ declare const readDueScheduleOutbox: (sql: SqlExec, nowMs: number, limit: number) => ScheduleOutboxRow[];
1045
+ declare const deferScheduleOutbox: (sql: SqlExec, id: string, attempts: number, nextAttemptAt: number) => void;
1046
+ declare const parkScheduleOutbox: (sql: SqlExec, id: string, attempts: number) => void;
1047
+ declare const probeScheduleOutbox: (sql: SqlExec) => {
1048
+ dueAt: number | undefined;
1049
+ populated: boolean;
1050
+ };
1051
+ declare const trimScheduleOutbox: (sql: SqlExec, olderThanTs: number) => void;
1052
+ /**
1053
+ * How far a companion's backfill has progressed, and under which analysis.
1054
+ * Declared here rather than beside either engine's state table: both record the
1055
+ * same three facts, and the decisions made from them are the shared policy
1056
+ * below.
1057
+ */
1058
+ interface BackfillState {
1059
+ /** Last `id` indexed, or `undefined` when no page has run yet. */
1060
+ cursor: string | undefined;
1061
+ /** True once a page came back short — the table is fully indexed. */
1062
+ done: boolean;
1063
+ /** Analyzer profile the stored rows were built with; `undefined` predates profile tracking. */
1064
+ profile: string | undefined;
1065
+ }
1066
+ declare const SEARCH_STATE_TABLE = "__lunora_search_state";
1067
+ declare const migrateSearchState: (sql: SqlExec) => void;
1068
+ declare const readSearchBackfillState: (sql: SqlExec, companion: string) => BackfillState;
1069
+ declare const writeSearchBackfillState: (sql: SqlExec, companion: string, cursor: string | undefined, done: boolean, profile: string) => void;
1070
+ declare const SHAPE_POKE_CURSOR_TABLE = "__shape_poke_cursor";
1071
+ declare const migrateShapePokeCursor: (sql: SqlExec) => void;
1072
+ declare const readShapePokeCursor: (sql: SqlExec, connectionId: string, subId: string) => number | undefined;
1073
+ declare const writeShapePokeCursor: (sql: SqlExec, connectionId: string, subId: string, cursor: number) => void;
1074
+ interface ShapePokeCursorRow {
1075
+ connectionId: string;
1076
+ cursor: number;
1077
+ subId: string;
1078
+ }
1079
+ declare const writeShapePokeCursors: (sql: SqlExec, rows: ReadonlyArray<ShapePokeCursorRow>) => void;
1080
+ declare const minShapePokeCursor: (sql: SqlExec) => number | undefined;
1081
+ declare const deleteShapePokeCursor: (sql: SqlExec, connectionId: string, subId: string) => void;
1082
+ declare const deleteShapePokeCursorsForConnection: (sql: SqlExec, connectionId: string) => void;
922
1083
  declare const DATA_MIGRATION_STATE_TABLE = "__lunora_migrations";
923
1084
  type MigrationDirection = "down" | "up";
924
1085
  type MigrationStatus = "completed" | "failed" | "in_progress";
@@ -982,10 +1143,10 @@ interface DependencyTracker {
982
1143
  declare const createDependencyTracker: () => DependencyTracker;
983
1144
  declare const runSql: <Row = Record<string, unknown>>(sql: SqlExec, query: string, ...params: unknown[]) => SqlCursor<Row>;
984
1145
  declare const runDrizzle: <Row = Record<string, unknown>>(exec: SqlExec, query: SQL) => SqlCursor<Row>;
1146
+ declare const quoteIdentifier: (name: string) => string;
985
1147
  declare const serializeSqlValue: (value: unknown) => unknown;
986
1148
  declare const DOC_COLUMN = "__doc__";
987
1149
  declare const geoTableName: (table: string, indexName: string) => string;
988
- declare const quoteIdentifier: (name: string) => string;
989
1150
  declare const jsonPath: (field: string) => string;
990
1151
  declare const jsonPathSql: (field: string) => SQL;
991
1152
  declare const qualifiedJsonPath: (table: string, field: string) => string;
@@ -995,10 +1156,16 @@ declare const AGG_KEY: Name;
995
1156
  declare const AGG_VALUE: Name;
996
1157
  declare const AGG_COUNT: Name;
997
1158
  declare const aggUpsertSql: (aggTable: string, key: unknown, value: unknown, count: unknown, set: SQL) => SQL;
998
- declare const tableColumns: (definition: TableDefinitionLike) => [string, ColumnMetaLike][];
1159
+ declare const tableColumns: (definition: TableDefinitionLike) => ReadonlyArray<readonly [string, ColumnMetaLike]>;
999
1160
  declare const rowToDocument: (row: Record<string, unknown> | undefined) => Record<string, unknown> | undefined;
1000
1161
  declare const tryRowToDocument: (row: Record<string, unknown> | undefined) => Record<string, unknown> | undefined;
1001
1162
  declare const isFtsAvailable: (sql: SqlExec) => boolean;
1163
+ declare const WORKERD_SQLITE_LIMITS: {
1164
+ readonly boundParams: 100;
1165
+ readonly compoundSelect: 5;
1166
+ readonly likePattern: 50;
1167
+ readonly sqlTextLength: 100000;
1168
+ };
1002
1169
  type SqlEngine = "mysql" | "postgres" | "sqlite";
1003
1170
  interface RenderedSql {
1004
1171
  params: unknown[];
@@ -1006,6 +1173,79 @@ interface RenderedSql {
1006
1173
  }
1007
1174
  declare const renderSql: (engine: SqlEngine, query: SQL) => RenderedSql;
1008
1175
  declare const param: (value: unknown) => SQL;
1176
+ declare const unionAll: (branches: ReadonlyArray<SQL>) => SQL;
1177
+ declare const sqliteInList: (reference: SQL, items: ReadonlyArray<unknown>, negated: boolean, budget?: number) => SQL;
1178
+ type DurableStreamStatus = "complete" | "error" | "running";
1179
+ interface DurableStreamRun {
1180
+ error?: string;
1181
+ errorCode?: string;
1182
+ lastSeq: number;
1183
+ startedAt: number;
1184
+ status: DurableStreamStatus;
1185
+ }
1186
+ interface DurableStreamChunk {
1187
+ dataJson: string;
1188
+ seq: number;
1189
+ }
1190
+ declare const migrateDurableStreams: (sql: SqlExec) => void;
1191
+ declare const readStreamRun: (sql: SqlExec, runKey: string) => DurableStreamRun | undefined;
1192
+ declare const claimStreamRun: (sql: SqlExec, runKey: string, startedAt: number, ttlMs: number) => boolean;
1193
+ declare const deleteStreamRun: (sql: SqlExec, runKey: string) => void;
1194
+ declare const appendStreamChunk: (sql: SqlExec, runKey: string, seq: number, dataJson: string) => void;
1195
+ declare const readStreamChunks: (sql: SqlExec, runKey: string, sinceSeq: number) => DurableStreamChunk[];
1196
+ declare const finishStreamRun: (sql: SqlExec, runKey: string, status: "complete" | "error", lastSeq: number, failure?: {
1197
+ code: string;
1198
+ message: string;
1199
+ }) => void;
1200
+ declare const trimStreamRuns: (sql: SqlExec, now: number, live: ReadonlySet<string>) => void;
1201
+ declare const MAX_DURABLE_STREAM_CHUNKS = 50000;
1202
+ declare const MAX_DURABLE_STREAM_BYTES: number;
1203
+ interface DurableStreamSink {
1204
+ readonly chunk: (chunk: {
1205
+ data: unknown;
1206
+ generation?: number;
1207
+ seq: number;
1208
+ }) => boolean;
1209
+ readonly complete: () => void;
1210
+ readonly fail: (failure: {
1211
+ code: string;
1212
+ message: string;
1213
+ }) => void;
1214
+ }
1215
+ type DurableAttachDecision = "attach" | "interrupted" | "reclaim" | "replay-terminal";
1216
+ declare const decideDurableAttach: (run: DurableStreamRun | undefined, context: {
1217
+ generation?: number;
1218
+ live?: {
1219
+ generation: number;
1220
+ };
1221
+ resuming: boolean;
1222
+ }) => DurableAttachDecision;
1223
+ interface DurableStreamAttach {
1224
+ readonly generation?: number;
1225
+ readonly iterator: (signal: AbortSignal) => AsyncIterable<unknown>;
1226
+ readonly runKey: string;
1227
+ readonly sinceChunk: number;
1228
+ readonly sink: DurableStreamSink;
1229
+ readonly ttlMs?: number;
1230
+ }
1231
+ declare class DurableStreamRunner {
1232
+ private lastTrimAt;
1233
+ private readonly runs;
1234
+ private readonly sql;
1235
+ private readonly waitUntil;
1236
+ constructor(dependencies: {
1237
+ sql: () => SqlExec;
1238
+ waitUntil?: (promise: Promise<unknown>) => void;
1239
+ });
1240
+ attach(request: DurableStreamAttach): Promise<void>;
1241
+ detach(runKey: string, sink: DurableStreamSink): void;
1242
+ isLive(runKey: string): boolean;
1243
+ private attachOrThrow;
1244
+ private produce;
1245
+ private trim;
1246
+ }
1247
+ declare const envPositiveInt: (env: unknown, key: string, fallback: number) => number;
1248
+ declare const envOptionalPositiveInt: (env: unknown, key: string) => number | undefined;
1009
1249
  interface ExternalSourceDiffResult {
1010
1250
  changes: CdcChange[];
1011
1251
  nextBaseline: Map<string, string>;
@@ -1070,6 +1310,16 @@ declare const isSoftDeleted: (row: Record<string, unknown>, column: string) => b
1070
1310
  declare const pullExternalSourceIncrementalTick: (sql: SqlExec, writer: DatabaseWriterLike, client: SourceClientLike, table: string, source: ExternalSourceLike, shardKey: string, nowMs: number) => Promise<{
1071
1311
  applied: number;
1072
1312
  }>;
1313
+ declare const ftsRowidMapName: (companion: string) => string;
1314
+ interface FtsWriteOptions {
1315
+ guard?: SQL;
1316
+ unmappedRowids?: ReadonlyArray<number>;
1317
+ }
1318
+ declare const ftsCompanionDdl: (companion: string) => SQL[];
1319
+ declare const ftsWriteDocument: (companion: string, id: string, text: string, options?: FtsWriteOptions) => SQL[];
1320
+ declare const ftsPurgeDocument: (companion: string, id: string, options?: FtsWriteOptions) => SQL[];
1321
+ declare const ftsUnmappedPage: (companion: string, limit: number, after?: number) => SQL;
1322
+ declare const groupUnmappedRows: (rows: ReadonlyArray<Record<string, unknown>>) => Map<string, number[]>;
1073
1323
  declare const GEO_DEFAULT_PRECISION = 9;
1074
1324
  interface GeoPoint {
1075
1325
  lat: number;
@@ -1085,6 +1335,20 @@ declare const coveringGeohashes: (center: GeoPoint, radiusMeters: number) => str
1085
1335
  declare const pointInBoundingBox: (point: GeoPoint, box: GeoBoundingBox) => boolean;
1086
1336
  declare const boundingBoxCenter: (box: GeoBoundingBox) => GeoPoint;
1087
1337
  declare const boundingBoxGeohashes: (box: GeoBoundingBox) => string[];
1338
+ declare class GlobalPollTick {
1339
+ private readonly changedTables;
1340
+ private readonly reads;
1341
+ private resync;
1342
+ private skippedCount;
1343
+ constructor(changedTables?: Set<string>);
1344
+ get readCount(): number;
1345
+ get resyncRequested(): boolean;
1346
+ get skipped(): number;
1347
+ requestResync(): void;
1348
+ rows(key: string | undefined, load: () => Promise<ShapeRow[]>): Promise<ShapeRow[]>;
1349
+ shouldRead(table: string): boolean;
1350
+ }
1351
+ declare const isInternalTableName: (name: string) => boolean;
1088
1352
  declare const ADMIN_FUNCTION_PREFIX = "__lunora_admin__:";
1089
1353
  declare const RELATION_FUNCTION_PREFIX = "__lunora_relation__:";
1090
1354
  declare const FLAGS_FUNCTION_PREFIX = "__lunora_flags__:";
@@ -1095,6 +1359,8 @@ declare const ADMIN_FUNCTIONS: {
1095
1359
  readonly aiGenerateSql: "__lunora_admin__:aiGenerateSql";
1096
1360
  readonly aiTableFilter: "__lunora_admin__:aiTableFilter";
1097
1361
  readonly assignIssue: "__lunora_admin__:assignIssue";
1362
+ readonly backfillSearch: "__lunora_admin__:backfillSearch";
1363
+ readonly backfillVectors: "__lunora_admin__:backfillVectors";
1098
1364
  readonly backRelationCounts: "__lunora_admin__:backRelationCounts";
1099
1365
  readonly cdcSync: "__lunora_admin__:cdcSync";
1100
1366
  readonly clearCapturedMail: "__lunora_admin__:clearCapturedMail";
@@ -1107,6 +1373,7 @@ declare const ADMIN_FUNCTIONS: {
1107
1373
  readonly explainIssue: "__lunora_admin__:explainIssue";
1108
1374
  readonly exportShard: "__lunora_admin__:exportShard";
1109
1375
  readonly facetColumn: "__lunora_admin__:facetColumn";
1376
+ readonly findRelated: "__lunora_admin__:findRelated";
1110
1377
  readonly getAdvisories: "__lunora_admin__:getAdvisories";
1111
1378
  readonly getAdvisorProcedures: "__lunora_admin__:getAdvisorProcedures";
1112
1379
  readonly getAuditLog: "__lunora_admin__:getAuditLog";
@@ -1133,20 +1400,24 @@ declare const ADMIN_FUNCTIONS: {
1133
1400
  readonly ignoreIssue: "__lunora_admin__:ignoreIssue";
1134
1401
  readonly importShard: "__lunora_admin__:importShard";
1135
1402
  readonly listFlags: "__lunora_admin__:listFlags";
1403
+ readonly listReactors: "__lunora_admin__:listReactors";
1136
1404
  readonly listQueues: "__lunora_admin__:listQueues";
1137
1405
  readonly lintSql: "__lunora_admin__:lintSql";
1138
1406
  readonly listTables: "__lunora_admin__:listTables";
1139
1407
  readonly listWorkflows: "__lunora_admin__:listWorkflows";
1140
1408
  readonly maskPolicies: "__lunora_admin__:maskPolicies";
1141
1409
  readonly migrationStatus: "__lunora_admin__:migrationStatus";
1410
+ readonly patchRows: "__lunora_admin__:patchRows";
1142
1411
  readonly pitrRestore: "__lunora_admin__:pitrRestore";
1143
1412
  readonly rankBefore: "__lunora_admin__:rankBefore";
1144
1413
  readonly rankPage: "__lunora_admin__:rankPage";
1145
1414
  readonly readTablePage: "__lunora_admin__:readTablePage";
1415
+ readonly rebuildCompanions: "__lunora_admin__:rebuildCompanions";
1146
1416
  readonly recordAuthEvent: "__lunora_admin__:recordAuthEvent";
1147
1417
  readonly recordContainerEvent: "__lunora_admin__:recordContainerEvent";
1148
1418
  readonly recordMail: "__lunora_admin__:recordMail";
1149
1419
  readonly recordQueueMessage: "__lunora_admin__:recordQueueMessage";
1420
+ readonly releaseShardRegistration: "__lunora_admin__:releaseShardRegistration";
1150
1421
  readonly replayQueueMessage: "__lunora_admin__:replayQueueMessage";
1151
1422
  readonly resolveIssue: "__lunora_admin__:resolveIssue";
1152
1423
  readonly rlsPolicies: "__lunora_admin__:rlsPolicies";
@@ -1216,8 +1487,12 @@ interface TablesIndexesResult {
1216
1487
  indexesByTable: Record<string, TableIndexInfo[]>;
1217
1488
  }
1218
1489
  interface ColumnMeta {
1490
+ bucket?: string;
1491
+ enumValues?: string[];
1219
1492
  isStorage?: boolean;
1220
1493
  name: string;
1494
+ nullable?: boolean;
1495
+ onDelete?: "cascade" | "restrict" | "set null";
1221
1496
  optional: boolean;
1222
1497
  pk?: boolean;
1223
1498
  ref?: string;
@@ -1314,6 +1589,11 @@ interface StudioFeaturesResult {
1314
1589
  mail: boolean;
1315
1590
  notifications: boolean;
1316
1591
  payments: boolean;
1592
+ platform?: {
1593
+ id: string;
1594
+ name: string;
1595
+ unsupported: string[];
1596
+ };
1317
1597
  queues: boolean;
1318
1598
  scheduler: boolean;
1319
1599
  storage: boolean;
@@ -1332,8 +1612,20 @@ interface FlagsResult {
1332
1612
  configured: boolean;
1333
1613
  flags: FlagEvaluation[];
1334
1614
  }
1615
+ interface ReactorMetadata {
1616
+ errors: number;
1617
+ lastError?: string;
1618
+ lastRanAt?: number;
1619
+ path: string;
1620
+ runs: number;
1621
+ state: "active" | "failing" | "idle";
1622
+ suppressed: number;
1623
+ tables?: ReadonlyArray<string>;
1624
+ }
1625
+ interface ReactorsResult {
1626
+ reactors: ReactorMetadata[];
1627
+ }
1335
1628
  interface WorkflowMetadata {
1336
- binding: string;
1337
1629
  className: string;
1338
1630
  exportName: string;
1339
1631
  name: string;
@@ -1347,6 +1639,7 @@ interface QueueMetadata {
1347
1639
  exportName: string;
1348
1640
  mode: "pull" | "push";
1349
1641
  name: string;
1642
+ topic?: string;
1350
1643
  }
1351
1644
  interface QueuesResult {
1352
1645
  queues: QueueMetadata[];
@@ -1390,8 +1683,10 @@ interface TablePage {
1390
1683
  columns: string[];
1391
1684
  refs?: Record<string, string>;
1392
1685
  rows: Record<string, unknown>[];
1686
+ sqlColumns: string[];
1393
1687
  total?: number;
1394
1688
  }
1689
+ type ColumnKinds = Readonly<Record<string, string>>;
1395
1690
  type FilterOperator = "contains" | "eq" | "gt" | "gte" | "lt" | "lte" | "ne";
1396
1691
  interface FilterClause {
1397
1692
  column: string;
@@ -1403,6 +1698,7 @@ interface OrderByClause {
1403
1698
  direction: SortDirection;
1404
1699
  }
1405
1700
  interface ReadTablePageOptions {
1701
+ columnKinds?: ColumnKinds;
1406
1702
  filters?: FilterClause[];
1407
1703
  limit?: number;
1408
1704
  offset?: number;
@@ -1413,6 +1709,8 @@ interface ReadTablePageOptions {
1413
1709
  table: string;
1414
1710
  }
1415
1711
  interface SelectMatchingIdsOptions {
1712
+ after?: string;
1713
+ columnKinds?: ColumnKinds;
1416
1714
  filters?: FilterClause[];
1417
1715
  limit?: number;
1418
1716
  search?: string;
@@ -1420,6 +1718,7 @@ interface SelectMatchingIdsOptions {
1420
1718
  }
1421
1719
  interface FacetColumnOptions {
1422
1720
  column: string;
1721
+ columnKinds?: ColumnKinds;
1423
1722
  filters?: FilterClause[];
1424
1723
  limit?: number;
1425
1724
  search?: string;
@@ -1435,6 +1734,7 @@ interface FacetColumnResult {
1435
1734
  }
1436
1735
  declare const MAX_PAGE_SIZE = 500;
1437
1736
  declare const listTables: (sql: SqlExec) => TableInfo[];
1737
+ declare const isVacuousFilterClause: (clause: FilterClause) => boolean;
1438
1738
  declare const readTablePage: (sql: SqlExec, options: ReadTablePageOptions) => TablePage;
1439
1739
  declare const selectMatchingIds: (sql: SqlExec, options: SelectMatchingIdsOptions) => {
1440
1740
  hasMore: boolean;
@@ -1469,12 +1769,22 @@ interface FanoutPathCounters {
1469
1769
  socketsIterated: number;
1470
1770
  totalMs: number;
1471
1771
  }
1772
+ interface ShapeProbeCounters {
1773
+ run: number;
1774
+ served: number;
1775
+ }
1776
+ interface GlobalPollCounters {
1777
+ drains: number;
1778
+ pairsSkipped: number;
1779
+ }
1472
1780
  interface FanoutMetricsResult {
1781
+ globalPoll: GlobalPollCounters;
1473
1782
  maxRelays: number;
1474
1783
  peakSubscribers: number;
1475
1784
  promoted: boolean;
1476
1785
  relayCount: number;
1477
1786
  shapePoke: FanoutPathCounters;
1787
+ shapeProbe: ShapeProbeCounters;
1478
1788
  sinceMs: number;
1479
1789
  topics: FanoutTopicStat[];
1480
1790
  totalConnections: number;
@@ -1488,6 +1798,10 @@ interface FanoutAttachmentLike {
1488
1798
  }
1489
1799
  declare const DEFAULT_FANOUT_TOPIC_LIMIT = 20;
1490
1800
  declare const createFanoutCounters: () => FanoutPathCounters;
1801
+ declare const createShapeProbeCounters: () => ShapeProbeCounters;
1802
+ declare const createGlobalPollCounters: () => GlobalPollCounters;
1803
+ declare const recordGlobalPollPass: (counters: GlobalPollCounters, drains: number, pairsSkipped: number) => GlobalPollCounters;
1804
+ declare const recordShapeProbePass: (counters: ShapeProbeCounters, run: number, served: number) => ShapeProbeCounters;
1491
1805
  declare const recordFanoutPass: (counters: FanoutPathCounters, iterated: number, delivered: number, ms: number) => FanoutPathCounters;
1492
1806
  declare const summarizeFanoutTopics: (attachments: FanoutAttachmentLike[], limit?: number) => {
1493
1807
  peakSubscribers: number;
@@ -1556,7 +1870,20 @@ interface PitrRestoreArgs {
1556
1870
  }
1557
1871
  declare const readBookmark: (storage: PitrStorage, time?: number | string) => Promise<PitrBookmarkResult>;
1558
1872
  declare const armRestore: (storage: PitrStorage, args: PitrRestoreArgs) => Promise<Omit<PitrRestoreResult, "restarted">>;
1559
- declare const normalizeOrderKeys: (orderBy: OrderByInput[] | undefined) => OrderKey[];
1873
+ declare const tiebreakDirectionFor: (keys: ReadonlyArray<{
1874
+ direction?: string;
1875
+ }>) => SortDirection;
1876
+ declare const equalityPinnedFields: (where: undefined | WhereInput) => ReadonlySet<string>;
1877
+ declare const uniqueIndexFields: (indexes: ReadonlyArray<{
1878
+ fields: ReadonlyArray<string>;
1879
+ unique?: boolean;
1880
+ }> | undefined, shape: Record<string, ValidatorLike> | undefined) => ReadonlyArray<ReadonlyArray<string>>;
1881
+ interface OrderKeyConstraints {
1882
+ pinned?: ReadonlySet<string>;
1883
+ uniqueBy?: ReadonlyArray<ReadonlyArray<string>>;
1884
+ }
1885
+ declare const normalizeOrderKeys: (orderBy: OrderByInput[] | undefined, shape?: Record<string, ValidatorLike>, constraints?: OrderKeyConstraints) => OrderKey[];
1886
+ declare const CURSOR_PREFIX = "~4";
1560
1887
  declare const encodeCursor: (record: Record<string, unknown>, keys: OrderKey[]) => string;
1561
1888
  declare const decodeCursor: (cursor: string) => unknown[];
1562
1889
  declare const buildSeekWhere: (keys: OrderKey[], cursorValues: unknown[]) => WhereInput;
@@ -1609,7 +1936,6 @@ declare const clearQueueMessages: (sql: SqlExec) => {
1609
1936
  declare const encodePartitionKey: (partitionBy: ReadonlyArray<string>, source: Record<string, unknown>) => string;
1610
1937
  declare const RANK_TIEBREAK = "__id__";
1611
1938
  declare const sortColumnName: (i: number) => string;
1612
- declare const matchesRankStaticWhere: (document: Record<string, unknown>, predicate: Record<string, unknown>) => boolean;
1613
1939
  declare const resolveRankPartition: (index: RankIndexDefinitionLike, where: Record<string, unknown> | undefined) => Record<string, unknown> | undefined;
1614
1940
  declare const rankTableName: (table: string, indexName: string) => string;
1615
1941
  declare const rankKeyFromDocument: (index: RankIndexDefinitionLike, document_: Record<string, unknown>) => {
@@ -1617,6 +1943,36 @@ declare const rankKeyFromDocument: (index: RankIndexDefinitionLike, document_: R
1617
1943
  rowId: string;
1618
1944
  sortValues: unknown[];
1619
1945
  };
1946
+ declare const rankPivotConditionSql: (column: string, value: unknown, direction: "asc" | "desc", wantLater: boolean) => SQL | undefined;
1947
+ declare const matchesRankStaticWhere: (document: Record<string, unknown>, predicate: Record<string, unknown>) => boolean;
1948
+ declare const REACTOR_STATE_TABLE = "__reactor_state";
1949
+ interface ReactorState {
1950
+ digest: string;
1951
+ lastError?: string;
1952
+ lastRanAt: number;
1953
+ stats: ReactorStats;
1954
+ tables?: ReadonlyArray<string>;
1955
+ }
1956
+ interface ReactorStats {
1957
+ errors: number;
1958
+ runs: number;
1959
+ suppressed: number;
1960
+ }
1961
+ declare const migrateReactorState: (sql: SqlExec) => void;
1962
+ declare const readReactorState: (sql: SqlExec, path: string) => ReactorState | undefined;
1963
+ declare const listReactorStates: (sql: SqlExec) => {
1964
+ path: string;
1965
+ state: ReactorState;
1966
+ }[];
1967
+ type ReactorDispatchResult = "error" | "ran" | "suppressed";
1968
+ declare const writeReactorState: (sql: SqlExec, path: string, outcome: {
1969
+ digest?: string;
1970
+ error?: string;
1971
+ now: number;
1972
+ result: ReactorDispatchResult;
1973
+ tables?: ReadonlyArray<string>;
1974
+ }) => void;
1975
+ declare const reactorNeedsRun: (state: Pick<ReactorState, "tables"> | undefined, changed: ReadonlySet<string>) => boolean;
1620
1976
  interface ReadFootprint {
1621
1977
  onRead: (table: string, idOrScan?: string) => void;
1622
1978
  onReadRange: (range: KeyRange) => void;
@@ -1624,6 +1980,23 @@ interface ReadFootprint {
1624
1980
  tables: Set<string>;
1625
1981
  }
1626
1982
  declare const createReadFootprint: () => ReadFootprint;
1983
+ declare const UNVOUCHABLE_DEP = "!unvouchable";
1984
+ declare const markUnvouchableReads: <T extends object>(facade: T, onRead: ReadFootprint["onRead"] | undefined, methods: ReadonlyArray<string>) => T;
1985
+ declare const WHERE_FILTER: unique symbol;
1986
+ type RowPredicate = (document: Record<string, unknown>) => boolean;
1987
+ type WhereFilter = RowPredicate & {
1988
+ readonly [WHERE_FILTER]: WhereInput;
1989
+ };
1990
+ declare const whereFilter: (where: WhereInput, predicate: RowPredicate) => WhereFilter;
1991
+ declare const whereOfFilter: (predicate: RowPredicate) => undefined | WhereInput;
1992
+ declare const isPushableWhere: (where: WhereInput, shape: Readonly<Record<string, ValidatorLike>>, exactText?: boolean) => boolean;
1993
+ declare const RELATED_MAX_DEPTH = 4;
1994
+ declare const RELATED_DEFAULT_LIMIT = 50;
1995
+ declare const RELATED_MAX_LIMIT = 200;
1996
+ declare const RELATED_DEPTH_DECAY = 0.5;
1997
+ declare const deriveRelationEdges: (schema: SchemaLike) => RelationEdge[];
1998
+ type RelationGraphReader = Pick<DatabaseWriterLike, "findMany"> & Pick<Partial<DatabaseWriterLike>, "lookupById">;
1999
+ declare const findRelated: (reader: RelationGraphReader, edges: ReadonlyArray<RelationEdge>, start: RelatedStart, options?: RelatedOptions) => Promise<RelatedPage>;
1627
2000
  declare const DEFAULT_MAX_RELATION_KEYS = 5000;
1628
2001
  interface RelationExistsMarker {
1629
2002
  childWhere: WhereInput;
@@ -1658,6 +2031,7 @@ declare const containsRelationPredicate: (where: WhereInput, schema: ResolveCont
1658
2031
  declare const assertFlatPredicate: (where: WhereInput | undefined, schema: ResolveContext["schema"], tableName: string, op: string) => void;
1659
2032
  declare const resolveRelationPredicates: (where: WhereInput | undefined, options: ResolveRelationPredicatesOptions) => Promise<WhereInput | undefined>;
1660
2033
  declare const assertShapeShardable: (effectiveWhere: WhereInput | undefined, schema: ResolveContext["schema"], table: string) => void;
2034
+ declare const relationHooks: (args: Pick<QueryArgs, "relationBaseWhere" | "relationMask">) => Pick<QueryArgs, "relationBaseWhere" | "relationMask"> & Pick<ResolveWithOptions, "fanOutBudget">;
1661
2035
  declare const fanOutScalarCounts: (counter: (tableName: string, where?: WhereInput) => Promise<number>, tableName: string, whereField: string, values: unknown[], policyWhere: WhereInput | undefined) => Promise<Map<unknown, number>>;
1662
2036
  declare const distinctValues: (rows: Record<string, unknown>[], field: string) => unknown[];
1663
2037
  declare const resolveWith: (options: ResolveWithOptions) => Promise<void>;
@@ -1682,6 +2056,8 @@ interface ShapeRowOp {
1682
2056
  value?: Record<string, unknown>;
1683
2057
  }
1684
2058
  interface ShapePokePart {
2059
+ baseCheckpoint?: number;
2060
+ reset?: boolean;
1685
2061
  rowsPatch: ShapeRowOp[];
1686
2062
  shapeId: string;
1687
2063
  }
@@ -1742,6 +2118,12 @@ interface RelayShapeSubscribe {
1742
2118
  type: "relay_shape_subscribe";
1743
2119
  userId?: string;
1744
2120
  }
2121
+ interface RelayShapeUnsubscribe {
2122
+ connectionId: string;
2123
+ relayIndex: number;
2124
+ subId?: string;
2125
+ type: "relay_shape_unsubscribe";
2126
+ }
1745
2127
  interface RelayShapeSeed {
1746
2128
  cursor?: number;
1747
2129
  epoch?: string;
@@ -1761,22 +2143,19 @@ interface RelayShapePoke {
1761
2143
  targetConnectionId?: string;
1762
2144
  type: "relay_shape_poke";
1763
2145
  }
1764
- type OwnerRelayFrame = RelayAttach | RelayDetach | RelayFrame | RelayShapePoke | RelayShapeSubscribe;
1765
- declare const DEFAULT_MAX_RELAYS = 8;
1766
- interface RelayStub {
2146
+ type OwnerRelayFrame = RelayAttach | RelayDetach | RelayFrame | RelayShapePoke | RelayShapeSubscribe | RelayShapeUnsubscribe;
2147
+ interface SiblingStub {
1767
2148
  fetch: (url: string, init?: RequestInit) => Promise<Response>;
1768
2149
  }
1769
- interface RelayNamespaceLike {
1770
- get: (id: unknown) => RelayStub;
1771
- getByName?: (name: string) => RelayStub;
1772
- idFromName: (name: string) => unknown;
1773
- }
2150
+ declare const stubByName: (value: unknown, name: string, jurisdiction?: string) => SiblingStub | undefined;
2151
+ declare const DEFAULT_MAX_RELAYS = 8;
1774
2152
  interface RelayHost {
1775
2153
  buildShapeDiff: (resolved: ResolvedShape, fromCursor: number, toCursor: number) => ShapeRowOp[];
1776
2154
  computeOpLogShapeSeed: (shape: ShapeSubscriptionQuery, resolved: ResolvedShape) => {
1777
2155
  baseCheckpoint: number | undefined;
1778
2156
  cursor: number;
1779
2157
  epoch: string | undefined;
2158
+ reset: boolean;
1780
2159
  rowsPatch: ShapeRowOp[];
1781
2160
  };
1782
2161
  currentCdcEpoch: () => string | undefined;
@@ -1791,8 +2170,13 @@ interface RelayHost {
1791
2170
  resolveShape: (name: string, args: Record<string, unknown>, identity?: SubscriptionIdentity) => ResolvedShape | undefined;
1792
2171
  rlsMetadata: () => RlsPoliciesResult;
1793
2172
  shardBinding: () => string | undefined;
2173
+ shardJurisdiction: () => string | undefined;
1794
2174
  sql: () => SqlExec;
1795
2175
  }
2176
+ interface RelayPokeDelivery {
2177
+ delivered: number;
2178
+ matched: number;
2179
+ }
1796
2180
  declare abstract class RelayLink {
1797
2181
  protected readonly host: RelayHost;
1798
2182
  protected readonly roleId: {
@@ -1806,7 +2190,8 @@ declare abstract class RelayLink {
1806
2190
  handleControl(request: Request): Promise<Response>;
1807
2191
  maxRelays(): number;
1808
2192
  protected canAddressSiblings(): boolean;
1809
- protected relayNamespace(): RelayNamespaceLike | undefined;
2193
+ protected siblingStub(targetName: string): SiblingStub | undefined;
2194
+ protected bindingName(): string | undefined;
1810
2195
  protected postRelayMessage(targetName: string, message: OwnerRelayFrame): Promise<void>;
1811
2196
  protected requestRelayMessage(targetName: string, message: OwnerRelayFrame): Promise<Response | undefined>;
1812
2197
  abstract forwardWhisper(topic: string, frame: string): Promise<void>;
@@ -1817,19 +2202,22 @@ declare abstract class RelayLink {
1817
2202
  }>;
1818
2203
  abstract announce(): Promise<void>;
1819
2204
  abstract announceDrain(closing: ShardSocketLike): Promise<void>;
2205
+ abstract releaseRelayShapes(ws: ShardSocketLike, subId?: string): Promise<void>;
1820
2206
  abstract relayCount(): number;
1821
2207
  abstract isShapeRelayUniform(name: string, args: Record<string, unknown>): boolean;
2208
+ abstract minShapeCursor(): number | undefined;
1822
2209
  protected abstract onAttach(index: number): void;
1823
2210
  protected abstract onDetach(index: number): void;
1824
2211
  protected abstract onWhisperFrame(message: RelayFrame): Promise<void>;
1825
2212
  protected abstract onShapeSubscribe(message: RelayShapeSubscribe): RelayShapeSeed;
1826
- protected abstract onShapePoke(poke: RelayShapePoke): number;
2213
+ protected abstract onShapeUnsubscribe(message: RelayShapeUnsubscribe): void;
2214
+ protected abstract onShapePoke(poke: RelayShapePoke): RelayPokeDelivery;
1827
2215
  }
1828
2216
  declare class OwnerRelay extends RelayLink {
1829
2217
  private readonly shapeUniformCache;
1830
2218
  private relaySetCache;
1831
- private readonly relayShapeRegistry;
1832
- private readonly relayShapeProxies;
2219
+ private registryCache;
2220
+ private recordedBinding;
1833
2221
  private promotionState;
1834
2222
  constructor(host: RelayHost, ownerKey: string);
1835
2223
  forwardWhisper(topic: string, frame: string): Promise<void>;
@@ -1840,17 +2228,26 @@ declare class OwnerRelay extends RelayLink {
1840
2228
  }>;
1841
2229
  announce(): Promise<void>;
1842
2230
  announceDrain(): Promise<void>;
2231
+ releaseRelayShapes(): Promise<void>;
1843
2232
  relayCount(): number;
2233
+ minShapeCursor(): number | undefined;
1844
2234
  isShapeRelayUniform(name: string, args: Record<string, unknown>): boolean;
2235
+ protected onShapeUnsubscribe(message: RelayShapeUnsubscribe): void;
1845
2236
  protected onAttach(index: number): void;
1846
2237
  protected onDetach(index: number): void;
1847
2238
  protected onWhisperFrame(message: RelayFrame): Promise<void>;
1848
2239
  protected onShapeSubscribe(message: RelayShapeSubscribe): RelayShapeSeed;
1849
- protected onShapePoke(): number;
2240
+ protected onShapePoke(): RelayPokeDelivery;
2241
+ private buildShapePoke;
1850
2242
  private multicastShapePokes;
2243
+ private multicastToRelays;
1851
2244
  private proxyShapePokes;
2245
+ private proxyToRelay;
1852
2246
  private buildShapeSeedFrames;
1853
- private ensureRelayTable;
2247
+ private ensureRelayTables;
2248
+ protected bindingName(): string | undefined;
2249
+ private relayShapes;
2250
+ private rewindShapeCursor;
1854
2251
  private ownerRelaySet;
1855
2252
  private addRelayToSet;
1856
2253
  private removeRelayFromSet;
@@ -1859,7 +2256,8 @@ declare class OwnerRelay extends RelayLink {
1859
2256
  }
1860
2257
  declare class RelayMember extends RelayLink {
1861
2258
  private relayAnnounced;
1862
- private readonly shapeRelayMemos;
2259
+ private relayMemoCache;
2260
+ private readonly shapeControl;
1863
2261
  constructor(host: RelayHost, ownerKey: string, relayIndex: number);
1864
2262
  forwardWhisper(topic: string, frame: string): Promise<void>;
1865
2263
  onFlush(): Promise<void>;
@@ -1869,17 +2267,81 @@ declare class RelayMember extends RelayLink {
1869
2267
  }>;
1870
2268
  announce(): Promise<void>;
1871
2269
  announceDrain(closing: ShardSocketLike): Promise<void>;
2270
+ releaseRelayShapes(ws: ShardSocketLike, subId?: string): Promise<void>;
1872
2271
  relayCount(): number;
1873
2272
  isShapeRelayUniform(): boolean;
2273
+ minShapeCursor(): number | undefined;
1874
2274
  protected onAttach(): void;
1875
2275
  protected onDetach(): void;
1876
2276
  protected onWhisperFrame(): Promise<void>;
1877
2277
  protected onShapeSubscribe(): RelayShapeSeed;
1878
- protected onShapePoke(poke: RelayShapePoke): number;
2278
+ protected onShapeUnsubscribe(): void;
2279
+ protected onShapePoke(poke: RelayShapePoke): RelayPokeDelivery;
2280
+ private queueShapeControl;
2281
+ private relayMemos;
2282
+ private connectionMemos;
1879
2283
  private recordRelayShapeMemo;
2284
+ private forgetRelayShapeMemos;
1880
2285
  private deliverShapePoke;
2286
+ private pokeSocketShapes;
1881
2287
  }
1882
2288
  declare const createRelayLink: (host: RelayHost) => OwnerRelay | RelayMember | undefined;
2289
+ declare const REGION_HINTS: readonly ["wnam", "enam", "sam", "weur", "eeur", "apac", "apac-ne", "apac-se", "oc", "afr", "me"];
2290
+ type RegionHint = (typeof REGION_HINTS)[number];
2291
+ type ReplicaReadiness = "fresh" | "stale" | "unavailable";
2292
+ interface ShardSiblingHost {
2293
+ doName: () => string | undefined;
2294
+ env: () => unknown;
2295
+ shardBinding: () => string | undefined;
2296
+ shardJurisdiction: () => string | undefined;
2297
+ sql: () => SqlExec;
2298
+ }
2299
+ interface ReplicaOwnerHost extends ShardSiblingHost {
2300
+ exportRows: () => Promise<ExportRow[]>;
2301
+ ownerCursor: () => number | undefined;
2302
+ ownerEpoch: () => string | undefined;
2303
+ ownerFloor: () => number | undefined;
2304
+ readChanges: (sinceSeq: number, limit: number) => {
2305
+ changes: CdcChange[];
2306
+ cursor: number;
2307
+ };
2308
+ rowCount: () => number;
2309
+ }
2310
+ interface ReplicaFollowerHost extends ShardSiblingHost {
2311
+ applyChanges: (changes: ReadonlyArray<CdcChange>) => Promise<number>;
2312
+ importRows: (rows: ReadonlyArray<ExportRow>) => Promise<{
2313
+ errors: ReadonlyArray<unknown>;
2314
+ }>;
2315
+ }
2316
+ declare const handleReplicaControl: (host: ReplicaOwnerHost, request: Request) => Promise<Response>;
2317
+ declare class ShardReplica {
2318
+ private readonly host;
2319
+ readonly ownerKey: string;
2320
+ readonly region: RegionHint;
2321
+ private divergent;
2322
+ private inFlight;
2323
+ constructor(host: ReplicaFollowerHost, ownerKey: string, region: RegionHint);
2324
+ ensureFresh(minSeq?: number): Promise<ReplicaReadiness>;
2325
+ appliedSeq(): number;
2326
+ isDivergent(): boolean;
2327
+ private advance;
2328
+ private isCaughtUp;
2329
+ private catchUp;
2330
+ private applyPage;
2331
+ private hasDiverged;
2332
+ private bootstrap;
2333
+ private isFreshEnough;
2334
+ private pull;
2335
+ private request;
2336
+ }
2337
+ declare const createReplicaLink: (host: ReplicaFollowerHost) => ShardReplica | undefined;
2338
+ declare const gateReplicaDispatch: (replica: ShardReplica, request: Request, functionPath: string) => Promise<Response | undefined>;
2339
+ declare const REPROJECTION_MIGRATION_PREFIX = "__lunora_reproject__";
2340
+ declare const reprojectionMigrationId: (table: string) => string;
2341
+ declare const reprojectableFields: (definition: TableDefinitionLike) => string[];
2342
+ declare const reprojectionTables: (schema: SchemaLike) => string[];
2343
+ declare const countLegacyRows: (sql: SqlExec, table: string, fields: ReadonlyArray<string>) => number;
2344
+ declare const buildReprojectionMigration: (id: string, schema: SchemaLike, sql: SqlExec) => DataMigrationLike | undefined;
1883
2345
  declare const RLS_UNWRAP_SYMBOL: symbol;
1884
2346
  declare class RlsRequiredError extends LunoraError {
1885
2347
  readonly table: string;
@@ -1896,7 +2358,7 @@ interface GuardableSchema {
1896
2358
  }
1897
2359
  type TableOfId = (id: string, expectedTable?: string) => Promise<string | undefined> | string | undefined;
1898
2360
  type TablesOfIds = (ids: ReadonlyArray<string>, expectedTable?: string) => Promise<ReadonlyMap<string, string>> | ReadonlyMap<string, string>;
1899
- declare const guardWriter: <W>(raw: W, schema: GuardableSchema, tableOfId: TableOfId, tablesOfIds?: TablesOfIds) => W;
2361
+ declare const guardWriter: <W>(raw: W, schema: GuardableSchema, tableOfId: TableOfId, tablesOfIds?: TablesOfIds, relationEdges?: ReadonlyArray<RelationEdge>) => W;
1900
2362
  declare const SCHEMA_HISTORY_MAX_VERSIONS = 50;
1901
2363
  interface SchemaVersionRow {
1902
2364
  appliedAt: number;
@@ -1907,8 +2369,24 @@ interface SchemaVersionRow {
1907
2369
  declare const recordSchemaVersion: (sql: SqlExec, hash: string, snapshotJson: string, now?: number) => boolean;
1908
2370
  declare const readSchemaHistory: (sql: SqlExec) => SchemaVersionRow[];
1909
2371
  declare const readSchemaVersion: (sql: SqlExec, hash: string) => SchemaVersionRow | undefined;
2372
+ declare const readDeployInfo: (rawEnv: unknown) => DeployInfo;
1910
2373
  declare const isDevEnvironment: (rawEnv: unknown) => boolean;
1911
2374
  declare const buildSettings: (rawEnv: unknown) => SettingsResult;
2375
+ declare class ShapeDiffCache {
2376
+ private readonly keyScans;
2377
+ private readonly memberProbes;
2378
+ private run;
2379
+ private served;
2380
+ get probesRun(): number;
2381
+ get probesServed(): number;
2382
+ changedKeys(rangeKey: string, load: () => CdcChangeKey[]): ReadonlyArray<CdcChangeKey>;
2383
+ members(resolved: ResolvedShape, rangeKey: string, load: () => Map<string, Record<string, unknown>>): ReadonlyMap<string, Record<string, unknown>>;
2384
+ private getOrLoad;
2385
+ }
2386
+ declare const createShapeDiffCache: () => ShapeDiffCache;
2387
+ declare const globalShapeReadKey: (resolved: ResolvedShape, identity: SubscriptionIdentity) => string | undefined;
2388
+ type ReadShapeCdcKeys = (sql: SqlExec, table: string, sinceSeq: number, upTo: number) => CdcChangeKey[];
2389
+ declare const buildShapeDiff: (sql: SqlExec, resolved: ResolvedShape, sinceSeq: number, upTo: number, cache: ShapeDiffCache, readKeys?: ReadShapeCdcKeys) => ShapeRowOp[];
1912
2390
  interface ShardRunnerOptions {
1913
2391
  handlers?: {
1914
2392
  handleAlarm?: () => Promise<void>;
@@ -1924,7 +2402,7 @@ declare class ShardRunner {
1924
2402
  socketFor(raw: unknown): ShardSocketLike;
1925
2403
  sockets(tag?: string): SocketHandle[];
1926
2404
  background(work: Promise<unknown>): boolean;
1927
- runInTransaction<T>(work: () => Promise<T>): Promise<T>;
2405
+ runInTransaction<T>(work: () => Promise<T>, onCommitted?: () => void): Promise<T>;
1928
2406
  handleFetch(request: Request): Promise<Response>;
1929
2407
  handleAlarm(): Promise<void>;
1930
2408
  }
@@ -1950,6 +2428,11 @@ interface SqlDiagnostic {
1950
2428
  source: "gate" | "plan" | "syntax";
1951
2429
  }
1952
2430
  declare const lintReadonlySql: (sql: SqlExec, query: string) => SqlLintResult;
2431
+ declare const BIGINT_KEY_DIGITS = 39;
2432
+ declare const bigintSqlKey: (value: bigint) => string;
2433
+ declare const decodeBigintSqlKey: (raw: string) => bigint | undefined;
2434
+ declare const float64SqlKey: (value: number) => string;
2435
+ declare const decodeFloat64SqlKey: (raw: string) => number | undefined;
1953
2436
  declare const subscriptionListDeltas: (previousJson: string, nextResult: unknown, table: string, frames?: string[]) => MutationDelta[] | undefined;
1954
2437
  interface FrameSink {
1955
2438
  send: (data: string) => void;
@@ -1958,7 +2441,17 @@ interface DrainableSink {
1958
2441
  readonly bufferedAmount?: unknown;
1959
2442
  }
1960
2443
  declare const trySendFrame: (ws: FrameSink, frame: string) => boolean;
1961
- declare const sendDeltaFrames: (ws: FrameSink, subId: string, deltaFrames: ReadonlyArray<string>, cursorSuffix: string, lastMutationId?: number) => boolean;
2444
+ interface SubscriptionFrameInput {
2445
+ cursorSuffix: string;
2446
+ lastMutationId?: number;
2447
+ nextResult: unknown;
2448
+ pageDeltas?: boolean;
2449
+ previousJson?: string;
2450
+ snapshotJson: string;
2451
+ subId: string;
2452
+ table: string;
2453
+ }
2454
+ declare const subscriptionFrames: (input: SubscriptionFrameInput) => string[];
1962
2455
  declare const awaitWsDrain: (ws: DrainableSink) => Promise<void>;
1963
2456
  interface SubscriptionReadFootprint {
1964
2457
  ranges?: Map<string, KeyRange[]>;
@@ -1986,13 +2479,51 @@ declare const selectExpiredIds: (sql: SqlExec, spec: TtlSweepSpec, now: number,
1986
2479
  hasMore: boolean;
1987
2480
  ids: string[];
1988
2481
  };
1989
- type FieldRefSql = (field: string) => SQL;
1990
- type SerializeValue = (value: unknown) => unknown;
1991
- interface WhereSqlStrategy {
1992
- fieldRef: FieldRefSql;
1993
- likeContains?: (reference: SQL, term: SQL) => SQL;
1994
- relationExists?: (request: unknown) => SQL;
2482
+ declare const VECTOR_BACKFILL_MAX_PAGES = 20;
2483
+ interface VectorBackfillTarget {
2484
+ profile: string;
2485
+ table: string;
2486
+ }
2487
+ interface VectorBackfillProgress {
2488
+ done: boolean;
2489
+ error?: string;
2490
+ failed: number;
2491
+ failedIds: string[];
2492
+ pages: number;
2493
+ rows: number;
2494
+ }
2495
+ type VectorPageSync = (table: string, rows: ReadonlyArray<{
2496
+ doc: Record<string, unknown>;
2497
+ id: string;
2498
+ }>) => Promise<ReadonlyArray<{
2499
+ error: unknown;
2500
+ id: string;
2501
+ }>>;
2502
+ type OrderedAfterWrites = <T, U>(read: () => T, work: (value: T) => Promise<U>) => Promise<U>;
2503
+ declare const backfillVectorIndexes: (sql: SqlExec, targets: ReadonlyArray<VectorBackfillTarget>, sync: VectorPageSync, options: {
2504
+ maxPages?: number;
2505
+ ordered: OrderedAfterWrites;
2506
+ restart?: boolean;
2507
+ }) => Promise<VectorBackfillProgress>;
2508
+ interface WhereFragments<T> {
2509
+ binary: (reference: T, comparator: string, value: unknown) => T;
2510
+ connect: (left: T, right: T, connector: "AND" | "OR") => T;
2511
+ constant: (value: boolean) => T;
2512
+ contains: (reference: T, term: T) => T;
2513
+ inList: (reference: T, items: ReadonlyArray<unknown>, negated: boolean, budget: number) => T;
2514
+ negate: (inner: T) => T;
2515
+ nullCheck: (reference: T, negated: boolean) => T;
2516
+ value: (value: unknown) => T;
2517
+ }
2518
+ type FieldRefSql<T> = (field: string) => T;
2519
+ type SerializeValue = (value: unknown, field: string) => unknown;
2520
+ interface WhereSqlStrategy<T = SQL> {
2521
+ containsExpr?: (reference: T, term: T) => T;
2522
+ fieldRef: FieldRefSql<T>;
2523
+ inList?: (reference: T, items: ReadonlyArray<unknown>, negated: boolean, budget?: number) => T;
2524
+ relationExists?: (request: unknown) => T;
1995
2525
  serialize: SerializeValue;
1996
2526
  }
1997
- declare const compileWhereSql: (where: WhereInput | undefined, strategy: WhereSqlStrategy) => SQL | undefined;
1998
- 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 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, 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 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 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, 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 };
2527
+ declare const serverInList: (engine: "mysql" | "postgres") => (reference: SQL, items: ReadonlyArray<unknown>, negated: boolean, budget?: number) => SQL;
2528
+ declare const compileWhereSql: <T = SQL>(where: WhereInput | undefined, strategy: WhereSqlStrategy<T>, fragments?: WhereFragments<T>, reservedParams?: number) => T | undefined;
2529
+ 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, type AuditEntry, type AuditLogResult, BIGINT_KEY_DIGITS, type BroadcastDelta, CDC_LOG_TABLE, CDC_LOG_TABLE_SEQ_INDEX, CDC_META_TABLE, CLIENT_WATERMARK_TABLE, COMMIT_SEQ_FIELD, COMMIT_SEQ_TABLE, CURSOR_PREFIX, type CacheEntry, type CapturedMailRow, type CdcArchiveScope, 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 FanOutBudget, type FanoutMetricsResult, type FanoutPathCounters, type FanoutTopicStat, type FieldOperators, type FilterClause, type FilterOperator, type FlagEvaluation, type FlagsResult, type FtsWriteOptions, 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, type OrderKeyConstraints, 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, RELATED_DEFAULT_LIMIT, RELATED_DEPTH_DECAY, RELATED_MAX_DEPTH, RELATED_MAX_LIMIT, 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 RelatedDirection, type RelatedNode, type RelatedOptions, type RelatedPage, type RelatedStart, type RelatedStartReference, type RelationDefinitionLike, type RelationEdge, type RelationExistsMarker, type RelationGraphReader, type RelayAttach, type RelayDetach, type RelayFrame, type RelayHost, RelayMember, type RelayPokeDelivery, type RelayShapePoke, type RelayShapeSeed, type RelayShapeSubscribe, type RelayShapeUnsubscribe, 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, SCHEDULE_OUTBOX_TABLE, SCHEMA_HISTORY_MAX_VERSIONS, SEARCH_STATE_TABLE, SHAPE_POKE_CURSOR_TABLE, type SchedulableWorkflowReferenceLike, type ScheduleOutbox, type ScheduleOutboxEnvelope, type ScheduleOutboxRow, 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 ShapePokeCursorRow, 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, VECTOR_BACKFILL_MAX_PAGES, type ValidatorLike, type VectorBackfillProgress, WORKERD_SQLITE_LIMITS, type WhereFilter, 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, archiveCdcSegment, armRestore, assertFlatPredicate, assertNoExplicitUndefined, assertReadonly, assertShapeShardable, assertValidClientId, awaitWsDrain, backfillAggregateIndexes, backfillRankIndexes, backfillSearchIndexes, backfillSearchIndexesForTable, backfillVectorIndexes, bigintSqlKey, boundingBoxCenter, boundingBoxGeohashes, buildIndexRange, buildPokeFrames, buildReprojectionMigration, buildSeekBeforeWhere, buildSeekWhere, buildSettings, buildShapeDiff, bumpCdcEpoch, cdcArchiveRewound, cdcCanVouchFor, cdcForkedError, cdcSeqLeavingRows, cdcTouchesTables, cdcTrimmedError, claimStreamRun, clampPromotionThresholds, clearCapturedMail, clearCompanionSignatures, clearMemoryTables, clearQueueMessages, coerceAggregateNumber, compactCdcDocs, compileWhereSql, computeRankPage, containsRelationPredicate, countLegacyRows, coveringGeohashes, createCompanionSync, createDependencyTracker, createFanoutCounters, createGlobalPollCounters, createIndexSql, createReadFootprint, createRelayLink, createReplicaLink, createShapeDiffCache, createShapeProbeCounters, createShardCtxDb, createSystemReader, cursorBelowRetainedFloor, decideDurableAttach, decodeBigintSqlKey, decodeCursor, decodeFloat64SqlKey, deferScheduleOutbox, deleteGlobalShapeSnapshot, deleteGlobalShapeSnapshotsForConnection, deleteShapePokeCursor, deleteShapePokeCursorsForConnection, deleteStreamRun, depKey, deriveRelationEdges, diffExternalSource, diffGlobalMembership, distinctValues, encodeAggregateKey, encodeCursor, encodeGeohash, encodePartitionKey, encodeRowsPatch, ensureAuditTable, ensureMailTable, envOptionalPositiveInt, envPositiveInt, equalityPinnedFields, exportShardRows, facetColumn, fanOutScalarCounts, findRelated, findStorageReferences, finishStreamRun, float64SqlKey, foldAggregateTally, forgetScheduleOutbox, ftsCompanionDdl, ftsPurgeDocument, ftsRowidMapName, ftsUnmappedPage, ftsWriteDocument, gateReplicaDispatch, geoTableName, globalShapeReadKey, groupUnmappedRows, guardWriter, handleReplicaControl, hasTrigger, haversineMeters, importShardRows, indexKeysForRow, isDevEnvironment, isFtsAvailable, isInternalTableName, isLossyBody, isMemoryTable, isPushableWhere, isRelationPredicate, isSoftDeleted, isSourceDue, isVacuousFilterClause, jsonPath, jsonPathSql, keysTouchRanges, liftSourceId, lintReadonlySql, listReactorStates, listTables, markUnvouchableReads, matchesRankStaticWhere, matchesStaticWhere, materializeExternalRows, materializeExternalRowsIncremental, memoryTableNames, mergeChangedKeys, mergeWhere, migrateCdcLog, migrateCdcMeta, migrateClientWatermark, migrateCommitSeq, migrateDurableStreams, migrateGlobalShapeSnapshot, migrateIdempotency, migrateReactorState, migrateScheduleOutbox, migrateSearchState, migrateShapePokeCursor, minCdcReplayableSeq, minCdcSeq, minShapePokeCursor, nextPromotionState, normalizeCountArgument, normalizeIdStructurally, normalizeOrderKeys, normalizeSourceDocument, normalizeSourceValue, param, parkScheduleOutbox, parseExportShardArgs, parseImportShardArgs, planAggregateLookup, pointInBoundingBox, probeScheduleOutbox, projectColumns, pullExternalSourceIncrementalTick, pullExternalSourceTick, qualifiedJsonPath, qualifiedJsonPathSql, quoteIdentifier, rankKeyFromDocument as rankKeyFromDoc, rankPivotConditionSql, rankTableName, reactiveCacheKey, reactorNeedsRun, readAggregateValue, readArchivedCdcChanges, readAuditLog, readBookmark, readCapturedMail, readCdcArchivedThrough, readCdcChangeKeys, readCdcChanges, readCdcCursor, readCdcEpoch, readClientWatermark, readCommitSeq, readDeployInfo, readDueScheduleOutbox, readExternalSourceBaseline, readGlobalShapeSnapshot, readIdempotent, readMigrationStatus, readQueueMessageById, readQueueMessages, readReactorState, readSchemaHistory, readSchemaVersion, readSearchBackfillState, readShapePokeCursor, readStreamChunks, readStreamRun, readTablePage, recordCapturedMail, recordChangedKeys, recordFanoutPass, recordGlobalPollPass, recordQueueMessages, recordScheduleOutbox, recordSchemaVersion, recordShapeProbePass, relationHooks, relayCountFor, renderSql, reprojectableFields, reprojectionMigrationId, reprojectionTables, resolveRankPartition, resolveRankSeekTuple, resolveRelationPredicates, resolveWith, rowToDocument, runDataMigration, runDrizzle, runExternalSourceTick, runReadonlySql, runRowValidators, runShardMigrations, runSocketPool, runSql, runTriggers, selectExpiredIds, selectExportTables, selectIndexForAggregate, selectIndexForCount, selectIndexForGroupBy, selectMatchingIds, selectShapeMembers, selectShapeRows, serializeSqlValue, serverInList, shapeRoutingKey, softDeleteScope, sortColumnName, sqliteInList, stableStringify, stableWireKey, stripReservedPatchFields, stubByName, subscriptionFrames, subscriptionListDeltas, summarizeFanoutTopics, summarizeSubscriptions, tableColumns, tableFromDepKey, throwingScheduler, tiebreakDirectionFor, trimCdcChanges, trimIdempotent, trimScheduleOutbox, trimStreamRuns, tryRowToDocument, trySendFrame, unionAll, uniqueIndexFields, validateImportRow, whereFilter, whereOfFilter, writeCdcArchivedThrough, writeGlobalShapeSnapshot, writeIdempotent, writeReactorState, writeSearchBackfillState, writeShapePokeCursor, writeShapePokeCursors, writeTouchesMemo };