@lunora/shard-engine 1.0.0-alpha.17 → 1.0.0-alpha.171

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 (164) hide show
  1. package/README.md +1 -1
  2. package/dist/conformance/index.mjs +1 -1
  3. package/dist/index.d.mts +897 -186
  4. package/dist/index.d.ts +897 -186
  5. package/dist/index.mjs +1 -1
  6. package/dist/packem_shared/ADMIN_FUNCTIONS-Dsiw5qoT.mjs +1 -0
  7. package/dist/packem_shared/AGGREGATE_SQL_FUNCTION-C_ZipS9R.mjs +1 -0
  8. package/dist/packem_shared/AGG_COUNT-Ctb5Pnyl.mjs +1 -0
  9. package/dist/packem_shared/AUDIT_LOG_TABLE-BFJ65SRS.mjs +8 -0
  10. package/dist/packem_shared/BIGINT_KEY_DIGITS-DE6yshOt.mjs +1 -0
  11. package/dist/packem_shared/CDC_LOG_TABLE-oPp25hdi.mjs +18 -0
  12. package/dist/packem_shared/CLIENT_WATERMARK_TABLE-De7z_OHV.mjs +7 -0
  13. package/dist/packem_shared/COMMIT_SEQ_FIELD-Da1DjGqo.mjs +4 -0
  14. package/dist/packem_shared/CURSOR_PREFIX-6offuG6M.mjs +1 -0
  15. package/dist/packem_shared/CompanionMemo-BXU5vfak.mjs +1 -0
  16. package/dist/packem_shared/CountRlsUnsupportedError-BvsDqfO2.mjs +1 -0
  17. package/dist/packem_shared/DATA_MIGRATION_STATE_TABLE-CFvBS9-M.mjs +31 -0
  18. package/dist/packem_shared/DEFAULT_MAX_RELATION_KEYS-9eOkadE4.mjs +1 -0
  19. package/dist/packem_shared/DEFAULT_MAX_RELAYS-BxlKyOuR.mjs +8 -0
  20. package/dist/packem_shared/DEFAULT_PROMOTION_THRESHOLDS-B3pRMuqb.mjs +1 -0
  21. package/dist/packem_shared/DEFAULT_TRANSACTION_LIMITS-Dmj5VBrV.mjs +1 -0
  22. package/dist/packem_shared/DurableStreamRunner-MMlV5qKQ.mjs +1 -0
  23. package/dist/packem_shared/GEO_DEFAULT_PRECISION-CqpQZ-J_.mjs +1 -0
  24. package/dist/packem_shared/GLOBAL_SHAPE_SNAPSHOT_TABLE-Bb6-aZuH.mjs +7 -0
  25. package/dist/packem_shared/GlobalPollTick-BNK4o-XT.mjs +1 -0
  26. package/dist/packem_shared/IDEMPOTENCY_TABLE-COrgeP3O.mjs +7 -0
  27. package/dist/packem_shared/MAIL_RETENTION-DMolrLYt.mjs +18 -0
  28. package/dist/packem_shared/MAX_SQL_ROWS-eRignWyO.mjs +4 -0
  29. package/dist/packem_shared/MAX_TOKEN_LENGTH-iFEGEcDL-DBPC6ZWl.mjs +1 -0
  30. package/dist/packem_shared/NotUniqueError-Cgu71D66.mjs +1 -0
  31. package/dist/packem_shared/QUEUE_TABLE-C-goXtGd.mjs +17 -0
  32. package/dist/packem_shared/RANK_TIEBREAK-D3ye2GsL.mjs +1 -0
  33. package/dist/packem_shared/REACTOR_STATE_TABLE-D2Mn204f.mjs +28 -0
  34. package/dist/packem_shared/RELATED_DEFAULT_LIMIT-CVqN4JEu.mjs +1 -0
  35. package/dist/packem_shared/RELATION_EXISTS_KEY-wxgj6rSL.mjs +1 -0
  36. package/dist/packem_shared/RELAY_SIGNATURE_HEADER-DP0glzE_.mjs +1 -0
  37. package/dist/packem_shared/REPROJECTION_MIGRATION_PREFIX-Czcb6_mO.mjs +1 -0
  38. package/dist/packem_shared/RLS_UNWRAP_SYMBOL-H6J96vgK.mjs +1 -0
  39. package/dist/packem_shared/ReactiveCache-Cy7oH_7w.mjs +1 -0
  40. package/dist/packem_shared/SCAN_DEP-D7qE3iUe.mjs +1 -0
  41. package/dist/packem_shared/SCHEDULE_OUTBOX_TABLE-DcZI7Yhl.mjs +11 -0
  42. package/dist/packem_shared/SCHEMA_HISTORY_MAX_VERSIONS-CEwFjj-O.mjs +6 -0
  43. package/dist/packem_shared/SEARCH_STATE_TABLE-D7w8mRsm.mjs +1 -0
  44. package/dist/packem_shared/SHAPE_POKE_CURSOR_TABLE-BGvY3sFI.mjs +8 -0
  45. package/dist/packem_shared/ShapeDiffCache-iNO-hUiy.mjs +1 -0
  46. package/dist/packem_shared/ShardRunner-CrveaPId.mjs +1 -0
  47. package/dist/packem_shared/UNVOUCHABLE_DEP-Ds9gxVqs.mjs +1 -0
  48. package/dist/packem_shared/VECTOR_BACKFILL_MAX_PAGES-DntvQ2eS.mjs +1 -0
  49. package/dist/packem_shared/WORKERD_SQLITE_LIMITS-B_4w7tzY.mjs +1 -0
  50. package/dist/packem_shared/accepts-null-D1zmJbyR.mjs +1 -0
  51. package/dist/packem_shared/aggregateTableName-B_CtIQCS.mjs +1 -0
  52. package/dist/packem_shared/appendStreamChunk-BZYgGE9Y.mjs +17 -0
  53. package/dist/packem_shared/applyInsertDefaults-B0NXPs2x.mjs +1 -0
  54. package/dist/packem_shared/archiveCdcSegment-Cr8oGLfB.mjs +4 -0
  55. package/dist/packem_shared/{armRestore-BNzdvQ_o.mjs → armRestore-Bu1_8SUa.mjs} +1 -1
  56. package/dist/packem_shared/assertPatchAllowed-CA_H466g.mjs +1 -0
  57. package/dist/packem_shared/awaitWsDrain-DMcWBQ7I.mjs +1 -0
  58. package/dist/packem_shared/backfillAggregateIndexes-CSROhPJq.mjs +1 -0
  59. package/dist/packem_shared/buildIndexRange-BTChxh3k.mjs +1 -0
  60. package/dist/packem_shared/buildPokeFrames-WR-hp0mX.mjs +1 -0
  61. package/dist/packem_shared/buildReprojectionMigration-Ds2JaFo7.mjs +1 -0
  62. package/dist/packem_shared/buildSettings-BRkZd6_E.mjs +1 -0
  63. package/dist/packem_shared/buildShapeDiff-BfTX-roE.mjs +1 -0
  64. package/dist/packem_shared/clearMemoryTables-aMRERF0w.mjs +1 -0
  65. package/dist/packem_shared/compileWhereSql-TgKZIvWM.mjs +1 -0
  66. package/dist/packem_shared/computeRankPage-BZIpATcs.mjs +1 -0
  67. package/dist/packem_shared/createCompanionSync-_zfDTDoO.mjs +1 -0
  68. package/dist/packem_shared/createReplicaLink-CbXW6X7p.mjs +7 -0
  69. package/dist/packem_shared/createSystemReader-DcDLFfC-.mjs +1 -0
  70. package/dist/packem_shared/ctx-db-relay-shapes-DV0VO4HG.mjs +17 -0
  71. package/dist/packem_shared/ctx-db-search-state-CPKPy8N6.mjs +1 -0
  72. package/dist/packem_shared/defineEngineContractSuite-DB_czsoy.mjs +1 -0
  73. package/dist/packem_shared/describeRelationWrites-omar6-u9.mjs +1 -0
  74. package/dist/packem_shared/diffExternalSource-B0FZlDoL.mjs +1 -0
  75. package/dist/packem_shared/do-sql-BWrJQAOh.mjs +1 -0
  76. package/dist/packem_shared/effective-kind-BmG_zCAy.mjs +1 -0
  77. package/dist/packem_shared/envOptionalPositiveInt-D2pY-c64.mjs +1 -0
  78. package/dist/packem_shared/estimate-bytes-_k74s6LZ.mjs +1 -0
  79. package/dist/packem_shared/exportShardRows-2xl7lIcj.mjs +1 -0
  80. package/dist/packem_shared/fts-companion-CE3EmIjk.mjs +1 -0
  81. package/dist/packem_shared/ftsCompanionDdl-B0bFCy6d.mjs +1 -0
  82. package/dist/packem_shared/hasTrigger-CjlwI4le.mjs +1 -0
  83. package/dist/packem_shared/isInternalTableName-BoljO2tP.mjs +1 -0
  84. package/dist/packem_shared/isPushableWhere-BeYAOjUb.mjs +1 -0
  85. package/dist/packem_shared/isSoftDeleted-BYZ0sPyu.mjs +9 -0
  86. package/dist/packem_shared/isTtlExpired-CozZXOL3.mjs +1 -0
  87. package/dist/packem_shared/json-field-path-DeJW4U9z.mjs +1 -0
  88. package/dist/packem_shared/liftSourceId-CA3ENhXj.mjs +1 -0
  89. package/dist/packem_shared/materializeExternalRows-DzUChRJ-.mjs +1 -0
  90. package/dist/packem_shared/mergeChangedKeys-DPKhen6e.mjs +1 -0
  91. package/dist/packem_shared/relation-operators-BEg-CvCH.mjs +1 -0
  92. package/dist/packem_shared/runDrizzle-RC09zZrh.mjs +1 -0
  93. package/dist/packem_shared/runShardMigrations-DMDT1blz.mjs +5 -0
  94. package/dist/packem_shared/runSocketPool-CZJ2X9cF.mjs +1 -0
  95. package/dist/packem_shared/selectShapeMembers-BCfKypfN.mjs +1 -0
  96. package/dist/packem_shared/serializeSqlValue-DeoBMpZ2.mjs +1 -0
  97. package/dist/packem_shared/stubByName-B8cFYipA.mjs +1 -0
  98. package/dist/packem_shared/where-sql-BjY4rnqb.mjs +1 -0
  99. package/package.json +5 -4
  100. package/dist/packem_shared/ADMIN_FUNCTIONS-OnYxyTXW.mjs +0 -1
  101. package/dist/packem_shared/AGGREGATE_SQL_FUNCTION-CTo0-9iZ.mjs +0 -1
  102. package/dist/packem_shared/AGG_COUNT-CqQLWpb4.mjs +0 -1
  103. package/dist/packem_shared/AUDIT_LOG_TABLE-C6nwXFPd.mjs +0 -8
  104. package/dist/packem_shared/CDC_LOG_TABLE-ZqcflEen.mjs +0 -8
  105. package/dist/packem_shared/CLIENT_WATERMARK_TABLE-CzApRlyv.mjs +0 -7
  106. package/dist/packem_shared/CountRlsUnsupportedError-8BqPYQoP.mjs +0 -1
  107. package/dist/packem_shared/DATA_MIGRATION_STATE_TABLE-BrpAGtXf.mjs +0 -31
  108. package/dist/packem_shared/DEFAULT_MAX_RELATION_KEYS-sPcXaWFW.mjs +0 -1
  109. package/dist/packem_shared/DEFAULT_MAX_RELAYS-CPBmX1FO.mjs +0 -1
  110. package/dist/packem_shared/DEFAULT_PROMOTION_THRESHOLDS-B2rUe1bg.mjs +0 -1
  111. package/dist/packem_shared/DEFAULT_TRANSACTION_LIMITS-q7ouI3i0.mjs +0 -1
  112. package/dist/packem_shared/GEO_DEFAULT_PRECISION-DyI5zggj.mjs +0 -1
  113. package/dist/packem_shared/GLOBAL_SHAPE_SNAPSHOT_TABLE-soMJDSBs.mjs +0 -7
  114. package/dist/packem_shared/IDEMPOTENCY_TABLE-Bvu9JkiL.mjs +0 -7
  115. package/dist/packem_shared/MAIL_RETENTION-BefR9Sei.mjs +0 -18
  116. package/dist/packem_shared/MAX_SQL_ROWS-nMwkxv5f.mjs +0 -2
  117. package/dist/packem_shared/NotUniqueError-BItFDsAw.mjs +0 -1
  118. package/dist/packem_shared/QUEUE_TABLE-DgBqWrXX.mjs +0 -17
  119. package/dist/packem_shared/RANK_TIEBREAK-DYDRmLKH.mjs +0 -1
  120. package/dist/packem_shared/RELATION_EXISTS_KEY-BaqSIFU1.mjs +0 -1
  121. package/dist/packem_shared/REPROJECTION_MIGRATION_PREFIX-D2dltRFC.mjs +0 -1
  122. package/dist/packem_shared/RLS_UNWRAP_SYMBOL-DcqORh2s.mjs +0 -1
  123. package/dist/packem_shared/ReactiveCache-Cu8IfE1M.mjs +0 -1
  124. package/dist/packem_shared/SCAN_DEP-D_yR9EeV.mjs +0 -1
  125. package/dist/packem_shared/SCHEMA_HISTORY_MAX_VERSIONS-BEU0CuW5.mjs +0 -6
  126. package/dist/packem_shared/SEARCH_STATE_TABLE-BZ_fxI5l.mjs +0 -1
  127. package/dist/packem_shared/ShardRunner-DIqVdWtk.mjs +0 -1
  128. package/dist/packem_shared/aggregateTableName-DV-K7ft2.mjs +0 -1
  129. package/dist/packem_shared/applyOnDelete-BB6tr2G0.mjs +0 -1
  130. package/dist/packem_shared/applySelect-i17LYhIU.mjs +0 -1
  131. package/dist/packem_shared/awaitWsDrain-Bp2jKzIb.mjs +0 -1
  132. package/dist/packem_shared/backfillAggregateIndexes-tK0jrl43.mjs +0 -1
  133. package/dist/packem_shared/base64-fKomMf5D.mjs +0 -1
  134. package/dist/packem_shared/buildIndexRange-DFsdtPjD.mjs +0 -1
  135. package/dist/packem_shared/buildPokeFrames-CqxaN8_H.mjs +0 -1
  136. package/dist/packem_shared/buildReprojectionMigration-Ctl4r84d.mjs +0 -1
  137. package/dist/packem_shared/buildSettings-COIJsw7a.mjs +0 -1
  138. package/dist/packem_shared/compileWhereSql-B4rPariq.mjs +0 -1
  139. package/dist/packem_shared/computeRankPage-CRFgJbuz.mjs +0 -1
  140. package/dist/packem_shared/createCompanionSync-Gp-AesYj.mjs +0 -1
  141. package/dist/packem_shared/createReadFootprint-DIrrxRTE.mjs +0 -1
  142. package/dist/packem_shared/createSystemReader-DcDcrtM3.mjs +0 -1
  143. package/dist/packem_shared/ctx-db-companions-CAJOSdN-.mjs +0 -1
  144. package/dist/packem_shared/defineEngineContractSuite-CZccUN4c.mjs +0 -1
  145. package/dist/packem_shared/diffExternalSource-DMpkJta1.mjs +0 -1
  146. package/dist/packem_shared/do-sql-1Yi1_Yq0.mjs +0 -1
  147. package/dist/packem_shared/estimate-bytes-Drp8rhPs.mjs +0 -1
  148. package/dist/packem_shared/exportShardRows-Bbi_JGfn.mjs +0 -1
  149. package/dist/packem_shared/hasTrigger-CbkOHExZ.mjs +0 -1
  150. package/dist/packem_shared/isSoftDeleted-Bo-y3DOe.mjs +0 -9
  151. package/dist/packem_shared/liftSourceId-DApAbu7Q.mjs +0 -1
  152. package/dist/packem_shared/materializeExternalRows-DcCENzpV.mjs +0 -1
  153. package/dist/packem_shared/mergeChangedKeys-BXtUgIPW.mjs +0 -1
  154. package/dist/packem_shared/param-B5lF5Jd9.mjs +0 -1
  155. package/dist/packem_shared/runDrizzle-B6rnz3so.mjs +0 -1
  156. package/dist/packem_shared/runShardMigrations-n2dKcH5E.mjs +0 -5
  157. package/dist/packem_shared/runSocketPool-DPQLVyWF.mjs +0 -1
  158. package/dist/packem_shared/selectExpiredIds-C6nQK7E2.mjs +0 -1
  159. package/dist/packem_shared/selectShapeMemberIds-BdBcbrUP.mjs +0 -1
  160. package/dist/packem_shared/serializeSqlValue-BR4UOWoP.mjs +0 -1
  161. package/dist/packem_shared/sql-projection-jfoe331H.mjs +0 -1
  162. package/dist/packem_shared/stableStringify-BjLh4gvA.mjs +0 -1
  163. package/dist/packem_shared/stableWireKey-l3cjIt-9.mjs +0 -1
  164. package/dist/packem_shared/wire-codec-Dsy70M3Q.mjs +0 -1
package/dist/index.d.mts CHANGED
@@ -1,6 +1,7 @@
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
+ export { stableStringify, stableWireKey } from '@lunora/wire';
4
5
  interface KeyRange {
5
6
  hi: string;
6
7
  index: string;
@@ -22,15 +23,43 @@ declare const indexKeysForRow: (indexes: ReadonlyArray<{
22
23
  name: string;
23
24
  }>, row: Record<string, unknown>, serialize: (value: unknown) => unknown) => IndexKeyEntry[];
24
25
  declare const keysTouchRanges: (ranges: ReadonlyArray<KeyRange> | undefined, keys: ReadonlyArray<IndexKeyEntry> | undefined) => boolean;
26
+ interface RelationWriteBase {
27
+ readonly colocated: boolean;
28
+ readonly refusal?: string;
29
+ readonly table: string;
30
+ }
31
+ interface KeyedRelationWriteInfo extends RelationWriteBase {
32
+ readonly field: string;
33
+ readonly kind: "many" | "one";
34
+ readonly nullable: boolean;
35
+ readonly references: string;
36
+ readonly refusalNow?: never;
37
+ readonly through?: never;
38
+ }
39
+ interface ThroughRelationWriteInfo extends RelationWriteBase {
40
+ readonly kind: "many";
41
+ readonly pairIsOnlyUnique: boolean;
42
+ readonly refusalNow: () => string | undefined;
43
+ readonly through: {
44
+ readonly from: string;
45
+ readonly table: string;
46
+ readonly to: string;
47
+ };
48
+ }
49
+ type RelationWriteInfo = KeyedRelationWriteInfo | ThroughRelationWriteInfo;
50
+ type RelationWriteMap = Readonly<Record<string, Readonly<Record<string, RelationWriteInfo>>>>;
51
+ declare const describeRelationWrites: (schema: SchemaLike, inTransaction?: () => boolean) => RelationWriteMap;
25
52
  type SystemTableName = "_scheduled_functions" | "_storage";
26
53
  interface ScheduledFunctionDoc {
27
54
  args: Record<string, unknown>;
28
55
  attempts?: number;
29
56
  enqueuedAt: number;
30
- functionPath: string;
57
+ functionPath?: string;
31
58
  id: string;
59
+ pool?: string;
32
60
  scheduledFor: number;
33
61
  shardKey?: string;
62
+ workflow?: string;
34
63
  }
35
64
  interface StorageMetadata {
36
65
  contentType?: string;
@@ -86,6 +115,86 @@ interface WhereInput {
86
115
  OR?: WhereInput[];
87
116
  }
88
117
  declare const RELATION_EXISTS_KEY = "__relationExists";
118
+ interface SubscriptionQuery {
119
+ args?: Record<string, unknown>;
120
+ functionPath?: string;
121
+ sinceEpoch?: string;
122
+ sinceSeq?: number;
123
+ table?: string;
124
+ }
125
+ interface ShapeSubscriptionQuery {
126
+ args?: Record<string, unknown>;
127
+ name: string;
128
+ sinceEpoch?: string;
129
+ sinceSeq?: number;
130
+ }
131
+ interface SubscriptionEnvelope {
132
+ caps?: string[];
133
+ clientId?: string;
134
+ context?: Record<string, unknown>;
135
+ data?: unknown;
136
+ generation?: number;
137
+ id: string;
138
+ query?: SubscriptionQuery;
139
+ shape?: {
140
+ args?: Record<string, unknown>;
141
+ name: string;
142
+ };
143
+ sinceCheckpoint?: number;
144
+ sinceChunk?: number;
145
+ sinceEpoch?: string;
146
+ token?: string;
147
+ topic?: string;
148
+ type: "ack" | "connect" | "shape_subscribe" | "shape_unsubscribe" | "stream" | "subscribe" | "unsubscribe" | "whisper" | "whisper_subscribe" | "whisper_unsubscribe";
149
+ }
150
+ interface RpcRequest {
151
+ args?: Record<string, unknown>;
152
+ functionPath: string;
153
+ }
154
+ interface SocketAttachment {
155
+ admin?: boolean;
156
+ adminBinding?: string;
157
+ authenticated?: boolean;
158
+ clientId?: string;
159
+ connected?: boolean;
160
+ connectionId?: string;
161
+ context?: Record<string, unknown>;
162
+ deliveryPermits?: Record<string, {
163
+ epoch: number;
164
+ scope: string;
165
+ }>;
166
+ expiresAt?: number;
167
+ identity?: Record<string, unknown>;
168
+ ip?: string;
169
+ liveGrants?: Record<string, string>;
170
+ pageDeltas?: boolean;
171
+ pendingSince?: number;
172
+ refreshBatch?: boolean;
173
+ shapes?: Record<string, ShapeSubscriptionQuery>;
174
+ socketFunction?: string;
175
+ socketPath?: string;
176
+ subs: Record<string, SubscriptionQuery>;
177
+ userId?: string;
178
+ whispers?: string[];
179
+ }
180
+ interface ResolvedShape {
181
+ columns?: ReadonlyArray<string>;
182
+ effectiveWhere?: WhereInput;
183
+ global?: boolean;
184
+ table: string;
185
+ }
186
+ interface SubscriptionIdentity {
187
+ identity?: Record<string, unknown>;
188
+ ip?: string;
189
+ userId?: string;
190
+ }
191
+ interface ShardSocketLike {
192
+ readonly bufferedAmount?: number;
193
+ close?: (code?: number, reason?: string) => void;
194
+ deserializeAttachment?: () => unknown;
195
+ send: (data: string) => void;
196
+ serializeAttachment?: (value: unknown) => void;
197
+ }
89
198
  type AggregateOp = "avg" | "count" | "max" | "min" | "sum";
90
199
  interface AggregateIndexDefinitionLike {
91
200
  readonly by?: ReadonlyArray<string>;
@@ -137,6 +246,11 @@ interface ColumnMetaLike {
137
246
  interface ValidatorLike {
138
247
  readonly _meta?: {
139
248
  readonly column?: ColumnMetaLike;
249
+ readonly inner?: ValidatorLike;
250
+ readonly members?: ReadonlyArray<ValidatorLike>;
251
+ readonly shape?: Readonly<Record<string, ValidatorLike>>;
252
+ readonly tableName?: string;
253
+ readonly value?: unknown;
140
254
  };
141
255
  readonly kind?: string;
142
256
  readonly parse?: (value: unknown) => unknown;
@@ -144,7 +258,7 @@ interface ValidatorLike {
144
258
  type TriggerTimingLike = "after" | "before";
145
259
  type TriggerOpLike = "delete" | "insert" | "update";
146
260
  interface SchedulableWorkflowReferenceLike {
147
- readonly binding?: string;
261
+ readonly className?: string;
148
262
  readonly isLunoraWorkflow: true;
149
263
  readonly name?: string;
150
264
  }
@@ -178,11 +292,18 @@ interface SchemaLike {
178
292
  readonly rlsMode?: "required";
179
293
  readonly tables: Record<string, TableDefinitionLike>;
180
294
  }
295
+ type PatchVerifier = (previous: Record<string, unknown>, next: Record<string, unknown>) => boolean;
296
+ interface PatchWriteOptions {
297
+ verify?: PatchVerifier;
298
+ }
181
299
  interface TableDefinitionLike {
182
300
  readonly aggregateIndexes?: ReadonlyArray<AggregateIndexDefinitionLike>;
301
+ readonly commitOrderedMode?: boolean;
302
+ readonly dropStalePatchesMode?: boolean;
183
303
  readonly geoIndexes?: ReadonlyArray<GeoIndexDefinitionLike>;
184
304
  readonly indexes: ReadonlyArray<IndexDefinitionLike>;
185
305
  readonly isPublic?: boolean;
306
+ readonly memoryMode?: boolean;
186
307
  readonly rankIndexes?: ReadonlyArray<RankIndexDefinitionLike>;
187
308
  readonly relationMap?: Record<string, RelationDefinitionLike>;
188
309
  readonly searchIndexes?: ReadonlyArray<SearchIndexDefinitionLike>;
@@ -200,13 +321,25 @@ interface TableDefinitionLike {
200
321
  field: string;
201
322
  };
202
323
  }
203
- interface RelationDefinitionLike {
324
+ interface KeyedRelationDefinitionLike {
204
325
  readonly field: string;
205
326
  readonly kind: "many" | "one";
206
327
  readonly onDelete?: OnDeleteActionLike;
207
328
  readonly references: string;
208
329
  readonly table: string;
330
+ readonly through?: never;
331
+ }
332
+ interface RelationThroughLike {
333
+ readonly from: string;
334
+ readonly table: string;
335
+ readonly to: string;
209
336
  }
337
+ interface ThroughRelationDefinitionLike {
338
+ readonly kind: "many";
339
+ readonly table: string;
340
+ readonly through: RelationThroughLike;
341
+ }
342
+ type RelationDefinitionLike = KeyedRelationDefinitionLike | ThroughRelationDefinitionLike;
210
343
  type OnDeleteActionLike = "cascade" | "restrict" | "set null";
211
344
  interface NestedWith {
212
345
  limit?: number;
@@ -219,13 +352,11 @@ interface WithInput {
219
352
  [relationName: string]: NestedWith | Record<string, true> | boolean | undefined;
220
353
  _count?: Record<string, true>;
221
354
  }
222
- interface ApplyOnDeleteOptions$1 {
223
- database: DatabaseWriterLike;
224
- relation: RelationDefinitionLike;
225
- row: Record<string, unknown>;
226
- tableName: string;
355
+ interface FanOutBudget {
356
+ remaining: number;
227
357
  }
228
358
  interface ResolveWithOptions {
359
+ fanOutBudget?: FanOutBudget;
229
360
  fetcher: (tableName: string, args: QueryArgs) => Promise<QueryPage>;
230
361
  groupedCounter: (tableName: string, whereField: string, values: unknown[], policyWhere?: WhereInput) => Promise<Map<unknown, number>>;
231
362
  parents: Record<string, unknown>[];
@@ -243,12 +374,17 @@ interface ResolveWithResult {
243
374
  rows: Record<string, unknown>[];
244
375
  }
245
376
  type SortDirection = "asc" | "desc";
246
- type OrderByInput = Record<string, SortDirection>;
377
+ type NullPlacement = "first" | "last";
378
+ type OrderByInput = Record<string, SortDirection | {
379
+ nulls: NullPlacement;
380
+ sort: SortDirection;
381
+ }>;
247
382
  interface QueryArgs {
248
383
  baseWhere?: WhereInput;
249
384
  cursor?: null | string;
250
385
  includeDeleted?: boolean;
251
386
  limit?: number;
387
+ omitContinueCursor?: boolean;
252
388
  orderBy?: OrderByInput[];
253
389
  relationBaseWhere?: (table: string) => undefined | WhereInput;
254
390
  relationMask?: RelationMask;
@@ -264,15 +400,59 @@ interface CrossShardReadArgs {
264
400
  with?: WithInput;
265
401
  }
266
402
  type RelationMask = (table: string, rows: Record<string, unknown>[]) => Record<string, unknown>[];
403
+ interface QueryPlan {
404
+ params: unknown[];
405
+ plan: string[];
406
+ sql: string;
407
+ }
267
408
  interface QueryPage {
268
409
  continueCursor: null | string;
269
410
  isDone: boolean;
270
411
  page: Record<string, unknown>[];
271
412
  splitCursor?: null | string;
272
413
  }
414
+ interface RelationEdge {
415
+ readonly array: boolean;
416
+ readonly column: string;
417
+ readonly name: string;
418
+ readonly sourceTable: string;
419
+ readonly targetTable: string;
420
+ }
421
+ interface RelatedStartReference {
422
+ id: string;
423
+ table: string;
424
+ }
425
+ type RelatedStart = (Record<string, unknown> & {
426
+ _id: string;
427
+ }) | RelatedStartReference;
428
+ type RelatedDirection = "both" | "in" | "out";
429
+ interface RelatedOptions {
430
+ cursor?: null | string;
431
+ depth?: number;
432
+ direction?: RelatedDirection;
433
+ edges?: ReadonlyArray<string>;
434
+ limit?: number;
435
+ relationBaseWhere?: (table: string) => undefined | WhereInput;
436
+ relationMask?: RelationMask;
437
+ }
438
+ interface RelatedNode {
439
+ depth: number;
440
+ document: Record<string, unknown>;
441
+ path: ReadonlyArray<string>;
442
+ pathIds: ReadonlyArray<string>;
443
+ score: number;
444
+ table: string;
445
+ }
446
+ interface RelatedPage {
447
+ continueCursor: null | string;
448
+ isDone: boolean;
449
+ nodes: RelatedNode[];
450
+ }
273
451
  interface OrderKey {
274
452
  direction: SortDirection;
275
453
  field: string;
454
+ nullable: boolean;
455
+ nulls?: NullPlacement;
276
456
  }
277
457
  interface RestrictableQueryOptions {
278
458
  baseWhere?: WhereInput;
@@ -401,17 +581,15 @@ interface IndexRangeBuilderLike {
401
581
  lte: (field: string, value: unknown) => IndexRangeBuilderLike;
402
582
  }
403
583
  type BroadcastDelta = (delta: MutationDelta) => void;
404
- type ReadHook = (table: string, idOrScan?: string) => void;
584
+ type ReadHook = (table: string, idOrScan?: string, exact?: boolean) => void;
405
585
  interface LifecycleEvent {
406
586
  connectionId: string;
407
587
  context?: Record<string, unknown>;
408
588
  shardKey: string;
409
589
  userId: string | null;
410
590
  }
411
- interface LifecycleDispatchInfo {
591
+ interface LifecycleDispatchInfo extends SubscriptionIdentity {
412
592
  event: LifecycleEvent;
413
- identity: Record<string, unknown> | undefined;
414
- userId: string | undefined;
415
593
  }
416
594
  interface MutationDelta {
417
595
  indexKeys?: ReadonlyArray<IndexKeyEntry>;
@@ -423,8 +601,16 @@ interface MutationDelta {
423
601
  interface DatabaseWriterLike {
424
602
  aggregate: (tableName: string, options: AggregateOptions) => Promise<AggregateResult>;
425
603
  asId?: (tableName: string, id: string) => string;
604
+ assertPatchAllowed?: (table: string, id: string) => Promise<void>;
605
+ cdcChangedTables?: (sinceSeq: number, options?: {
606
+ cursorOnly?: boolean;
607
+ }) => Promise<{
608
+ cursor: number;
609
+ floor?: number;
610
+ tables: string[];
611
+ } | undefined>;
426
612
  count: (tableName: string, where?: RestrictableQueryOptions | WhereInput) => Promise<number>;
427
- delete: (id: string, expectedTable?: string, options?: {
613
+ delete: (table: string, id: string, options?: {
428
614
  hard?: boolean;
429
615
  }) => Promise<void>;
430
616
  deleteAll?: (tableName: string, options?: {
@@ -433,20 +619,22 @@ interface DatabaseWriterLike {
433
619
  }) => Promise<{
434
620
  deleted: number;
435
621
  }>;
436
- deleteMany?: (ids: ReadonlyArray<string>, options?: {
622
+ deleteMany?: (table: string, ids: ReadonlyArray<string>, options?: {
437
623
  limit?: number;
438
- }, expectedTable?: string) => Promise<{
624
+ }) => Promise<{
439
625
  deleted: number;
440
626
  }>;
627
+ deleteRereadTables?: ReadonlySet<string>;
441
628
  deleteWhere?: (tableName: string, where: WhereInput, options?: {
442
629
  limit?: number;
443
630
  }) => Promise<{
444
631
  deleted: number;
445
632
  }>;
633
+ explain: (tableName: string, args?: QueryArgs) => Promise<QueryPlan>;
446
634
  findFirst: (tableName: string, args?: QueryArgs) => Promise<Record<string, unknown> | null>;
447
635
  findFirstOrThrow: (tableName: string, args?: QueryArgs) => Promise<Record<string, unknown>>;
448
636
  findMany: (tableName: string, args?: QueryArgs) => Promise<QueryPage>;
449
- get: (id: string, expectedTable?: string) => Promise<Record<string, unknown> | null>;
637
+ get: (table: string, id: string) => Promise<Record<string, unknown> | null>;
450
638
  groupBy: (tableName: string, options: GroupByOptions) => Promise<ReadonlyArray<GroupByEntry>>;
451
639
  insert: (tableName: string, document: Record<string, unknown>, options?: {
452
640
  allowExplicitId?: boolean;
@@ -460,18 +648,27 @@ interface DatabaseWriterLike {
460
648
  allowExplicitId?: boolean;
461
649
  limit?: number;
462
650
  }) => Promise<string[]>;
651
+ inTransaction?: () => boolean;
463
652
  lookupById?: (id: string, expectedTable?: string) => Promise<null | {
464
653
  row: Record<string, unknown>;
465
654
  tableName: string;
466
655
  }>;
467
656
  normalizeId: (tableName: string, id: string) => null | string;
468
- patch: (id: string, patch: Record<string, unknown>, expectedTable?: string) => Promise<void>;
469
- patchMany?: (patches: ReadonlyArray<{
657
+ patch: (table: string, id: string, patch: Record<string, unknown>, options?: PatchWriteOptions) => Promise<void>;
658
+ patchIf?: (tableName: string, id: string, args: {
659
+ patch: Record<string, unknown>;
660
+ verify?: PatchVerifier;
661
+ where: WhereInput;
662
+ }) => Promise<{
663
+ applied: boolean;
664
+ doc: Record<string, unknown> | null;
665
+ }>;
666
+ patchMany?: (table: string, patches: ReadonlyArray<{
470
667
  id: string;
471
668
  patch: Record<string, unknown>;
472
669
  }>, options?: {
473
670
  limit?: number;
474
- }, expectedTable?: string) => Promise<{
671
+ }) => Promise<{
475
672
  patched: number;
476
673
  }>;
477
674
  patchWhere?: (tableName: string, args: {
@@ -487,10 +684,14 @@ interface DatabaseWriterLike {
487
684
  rankBefore?: (tableName: string, indexName: string, options: RankBeforeOptions) => Promise<RankBeforeResult>;
488
685
  rankPage: (tableName: string, indexName: string, options?: RankPageOptions) => Promise<RankPage>;
489
686
  rankPageRows?: (tableName: string, indexName: string, options?: RankPageOptions) => Promise<ShardRankPageResult>;
490
- replace: (id: string, document: Record<string, unknown>, expectedTable?: string, options?: {
687
+ related?: (start: RelatedStart, options?: RelatedOptions) => Promise<RelatedPage>;
688
+ relationEdges?: ReadonlyArray<RelationEdge>;
689
+ relationWrites?: RelationWriteMap;
690
+ replace: (table: string, id: string, document: Record<string, unknown>, options?: {
491
691
  allowExplicitId?: boolean;
492
692
  }) => Promise<void>;
493
- restore?: (id: string, expectedTable?: string) => Promise<void>;
693
+ restore?: (table: string, id: string) => Promise<void>;
694
+ softDeleteFields?: ReadonlyMap<string, string>;
494
695
  system?: SystemDatabaseReader;
495
696
  wipeShard?: (options?: {
496
697
  chunkSize?: number;
@@ -515,7 +716,10 @@ interface ExportShardArgs {
515
716
  batchSize?: number;
516
717
  tables?: ReadonlyArray<string>;
517
718
  }
719
+ type ImportConflictMode = "replace" | "skip";
518
720
  interface ImportShardArgs {
721
+ dryRun?: boolean;
722
+ onConflict?: ImportConflictMode;
519
723
  rows: ReadonlyArray<ExportRow>;
520
724
  startLine?: number;
521
725
  }
@@ -523,9 +727,9 @@ interface ImportShardResult {
523
727
  conflicts: number;
524
728
  errors: ImportError[];
525
729
  inserted: Record<string, number>;
730
+ replaced: number;
526
731
  }
527
732
  declare const selectExportTables: (schema: SchemaLike, requested?: ReadonlyArray<string>) => string[];
528
- declare const exportShardTable: (writer: DatabaseWriterLike, table: string, batchSize?: number) => AsyncGenerator<ExportRow, void, undefined>;
529
733
  declare const exportShardRows: (writer: DatabaseWriterLike, schema: SchemaLike, args: ExportShardArgs) => AsyncGenerator<ExportRow, void, undefined>;
530
734
  declare const validateImportRow: (schema: SchemaLike, table: string, record: Record<string, unknown>) => string | undefined;
531
735
  declare const importShardRows: (writer: DatabaseWriterLike, schema: SchemaLike, args: ImportShardArgs) => Promise<ImportShardResult>;
@@ -534,6 +738,8 @@ interface ExportShardAdminArgs {
534
738
  tables?: ReadonlyArray<string>;
535
739
  }
536
740
  interface ImportShardAdminArgs {
741
+ dryRun: boolean;
742
+ onConflict: ImportConflictMode;
537
743
  rows: ReadonlyArray<ExportRow>;
538
744
  startLine?: number;
539
745
  }
@@ -573,8 +779,11 @@ declare const selectIndexForGroupBy: (indexes: ReadonlyArray<AggregateIndexDefin
573
779
  index: AggregateIndexDefinitionLike;
574
780
  partial: Record<string, unknown>;
575
781
  };
576
- declare const stableStringify: (value: unknown) => string;
577
- declare const stableWireKey: (value: unknown) => string;
782
+ declare const clearCompanionSignatures: (sql: SqlExec) => void;
783
+ declare class CompanionMemo {
784
+ readonly verified: Set<string>;
785
+ invalidate(): void;
786
+ }
578
787
  interface CacheEntry {
579
788
  bytes: number;
580
789
  deps: Set<string>;
@@ -600,6 +809,7 @@ declare class ReactiveCache {
600
809
  private readonly maxBytes;
601
810
  private readonly now;
602
811
  private monotonic;
812
+ private generation;
603
813
  constructor(options?: ReactiveCacheOptions);
604
814
  run<R>(key: string, deps: Set<string>, run: () => Promise<R>, ranges?: () => ReadonlyArray<KeyRange>): Promise<R>;
605
815
  invalidate(table: string, id: string, indexKeys?: ReadonlyArray<IndexKeyEntry>): string[];
@@ -660,12 +870,18 @@ interface RunTriggersOptions {
660
870
  }
661
871
  declare const runTriggers: (options: RunTriggersOptions) => Promise<void>;
662
872
  declare const hasTrigger: (schema: SchemaLike, tableName: string, op: TriggerOpLike) => boolean;
873
+ interface SearchBackfillProgress {
874
+ done: boolean;
875
+ pages: number;
876
+ }
663
877
  declare const backfillAggregateIndexes: (sql: SqlExec, schema: SchemaLike) => void;
664
878
  declare const backfillRankIndexes: (sql: SqlExec, schema: SchemaLike) => void;
665
879
  declare const backfillSearchIndexesForTable: (sql: SqlExec, tableName: string, definition: {
666
880
  searchIndexes?: ReadonlyArray<SearchIndexDefinitionLike>;
667
881
  }) => void;
668
- declare const backfillSearchIndexes: (sql: SqlExec, schema: SchemaLike) => void;
882
+ declare const backfillSearchIndexes: (sql: SqlExec, schema: SchemaLike, options?: {
883
+ maxPages?: number;
884
+ }) => SearchBackfillProgress;
669
885
  declare const CDC_LOG_TABLE = "__cdc_log";
670
886
  interface CdcChange {
671
887
  doc?: Record<string, unknown>;
@@ -675,19 +891,35 @@ interface CdcChange {
675
891
  table: string;
676
892
  ts: number;
677
893
  }
678
- declare const migrateCdcLog: (sql: SqlExec) => void;
894
+ declare const CDC_LOG_TABLE_SEQ_INDEX = "__cdc_log_table_seq";
895
+ declare const migrateCdcLog: (sql: SqlExec, options?: {
896
+ rowHistoryIndex?: boolean;
897
+ }) => void;
679
898
  declare const appendCdcChange: (sql: SqlExec, ts: number, table: string, id: string, op: CdcChange["op"], doc: Record<string, unknown> | undefined) => void;
680
899
  declare const readCdcChanges: (sql: SqlExec, options?: {
681
900
  limit?: number;
682
901
  sinceSeq?: number;
683
- tables?: ReadonlySet<string>;
684
902
  }) => {
685
903
  changes: CdcChange[];
686
904
  cursor: number;
687
905
  };
688
- declare const trimCdcChanges: (sql: SqlExec, throughSeq: number) => void;
906
+ declare const cdcTouchesTables: (sql: SqlExec, sinceSeq: number, tables: ReadonlySet<string>) => boolean;
907
+ declare const cdcCanVouchFor: (sql: SqlExec, deps: ReadonlySet<string>) => boolean;
908
+ interface CdcChangeKey {
909
+ id: string;
910
+ op: CdcChange["op"];
911
+ seq: number;
912
+ }
913
+ declare const readCdcChangeKeys: (sql: SqlExec, table: string, sinceSeq: number, upTo: number) => CdcChangeKey[];
914
+ declare const trimCdcChanges: (sql: SqlExec, throughSeq: number, maxRows: number) => void;
915
+ declare const compactCdcDocs: (sql: SqlExec, throughSeq: number, maxRows: number) => void;
916
+ declare const cdcSeqLeavingRows: (sql: SqlExec, keep: number) => number | undefined;
689
917
  declare const readCdcCursor: (sql: SqlExec) => number;
918
+ declare const cursorBelowRetainedFloor: (floor: number | undefined, sinceSeq: number) => boolean;
919
+ declare const cdcTrimmedError: (floor: number, sinceSeq: number, scope: "global" | "shard") => LunoraError;
920
+ declare const cdcForkedError: (cursor: number, sinceSeq: number, scope: "global" | "shard", epoch?: string) => LunoraError;
690
921
  declare const minCdcSeq: (sql: SqlExec) => number | undefined;
922
+ declare const minCdcReplayableSeq: (sql: SqlExec) => number | undefined;
691
923
  declare const CDC_META_TABLE = "__cdc_meta";
692
924
  declare const migrateCdcMeta: (sql: SqlExec) => void;
693
925
  declare const readCdcEpoch: (sql: SqlExec) => string;
@@ -697,12 +929,6 @@ declare const CLIENT_WATERMARK_TABLE = "__client_watermark";
697
929
  declare const migrateClientWatermark: (sql: SqlExec) => void;
698
930
  declare const readClientWatermark: (sql: SqlExec, identity: string, clientId: string) => number;
699
931
  declare const advanceClientWatermark: (sql: SqlExec, identity: string, clientId: string, mutationId: number) => void;
700
- declare const GLOBAL_SHAPE_SNAPSHOT_TABLE = "__global_shape_snapshot";
701
- declare const migrateGlobalShapeSnapshot: (sql: SqlExec) => void;
702
- declare const readGlobalShapeSnapshot: (sql: SqlExec, connectionId: string, subId: string) => Map<string, string>;
703
- declare const writeGlobalShapeSnapshot: (sql: SqlExec, connectionId: string, subId: string, snapshot: Map<string, string>) => void;
704
- declare const deleteGlobalShapeSnapshot: (sql: SqlExec, connectionId: string, subId: string) => void;
705
- declare const deleteGlobalShapeSnapshotsForConnection: (sql: SqlExec, connectionId: string) => void;
706
932
  declare const IDEMPOTENCY_TABLE = "__idempotency";
707
933
  interface IdempotentRecord {
708
934
  resultJson: string;
@@ -714,61 +940,32 @@ declare const writeIdempotent: (sql: SqlExec, identity: string, mutationId: stri
714
940
  declare const trimIdempotent: (sql: SqlExec, olderThanTs: number) => void;
715
941
  declare const runShardMigrations: (sql: SqlExec, schema: SchemaLike, options?: {
716
942
  cdc?: boolean;
943
+ deferBlockedUniqueIndexes?: boolean;
717
944
  schemaSnapshot?: {
718
945
  hash: string;
719
946
  json: string;
720
947
  };
721
- }) => void;
722
- /**
723
- * How far a search companion's backfill has progressed, and what the next pass
724
- * should do about it.
725
- *
726
- * Neither stored analysis nor query policy, which is why it is its own module
727
- * rather than a third responsibility bolted onto one of them: it is *progress*,
728
- * the one piece of search state that is written as the index is built rather
729
- * than decided when it is read.
730
- *
731
- * The policy below is shared because when each engine owned a copy they
732
- * immediately disagreed about exactly the two cases that matter — whether a row
733
- * with no recorded profile may be resumed (it may not; nothing says what
734
- * analyzed it) and whether a never-started index is worth wiping (it is not;
735
- * there is nothing in it).
736
- */
737
- /**
738
- * How far a companion's backfill has progressed, and under which analysis.
739
- * Declared here rather than beside either engine's state table: both record the
740
- * same three facts, and the decisions made from them are the shared policy
741
- * below.
742
- */
743
- interface SearchBackfillState {
744
- /** Last `id` indexed, or `undefined` when no page has run yet. */
745
- cursor: string | undefined;
746
- /** True once a page came back short — the table is fully indexed. */
747
- done: boolean;
748
- /** Analyzer profile the stored rows were built with; `undefined` predates profile tracking. */
749
- profile: string | undefined;
750
- }
751
- declare const SEARCH_STATE_TABLE = "__lunora_search_state";
752
- declare const migrateSearchState: (sql: SqlExec) => void;
753
- declare const readSearchBackfillState: (sql: SqlExec, companion: string) => SearchBackfillState;
754
- declare const writeSearchBackfillState: (sql: SqlExec, companion: string, cursor: string | undefined, done: boolean, profile: string) => void;
948
+ }) => ReadonlyArray<string>;
755
949
  interface ShapeRow {
756
950
  doc: Record<string, unknown>;
757
951
  id: string;
758
952
  }
759
953
  declare const selectShapeRows: (sql: SqlExec, table: string, effectiveWhere: WhereInput | undefined) => ShapeRow[];
760
- declare const selectShapeMemberIds: (sql: SqlExec, table: string, effectiveWhere: WhereInput | undefined, ids: ReadonlyArray<string>) => Set<string>;
954
+ declare const selectShapeMembers: (sql: SqlExec, table: string, effectiveWhere: WhereInput | undefined, ids: ReadonlyArray<string>) => Map<string, Record<string, unknown>>;
761
955
  interface SqlExec {
762
956
  exec: <Row = Record<string, unknown>>(sql: string, ...params: unknown[]) => SqlCursor<Row>;
763
957
  }
764
958
  interface SqlCursor<Row> extends Iterable<Row> {
959
+ readonly columnNames?: string[];
765
960
  one: () => Row;
961
+ raw?: () => IterableIterator<unknown[]>;
766
962
  toArray: () => Row[];
767
963
  }
768
964
  type IndexUseHook = (table: string, indexName: string, kind: "geo" | "index" | "rank" | "search") => void;
769
965
  type Clock = () => number;
770
966
  type IdGenerator = () => string;
771
967
  declare const assertValidClientId: (clientId: string) => void;
968
+ declare const assertStorableRowId: (id: string) => void;
772
969
  interface WriteEvent {
773
970
  doc?: Record<string, unknown>;
774
971
  id: string;
@@ -778,18 +975,26 @@ interface WriteEvent {
778
975
  type WriteHook = (event: WriteEvent) => Promise<void> | void;
779
976
  interface CtxDbOptions {
780
977
  auth?: ServerDefaultContextLike["auth"];
978
+ baselineSeq?: () => number | undefined;
781
979
  broadcast?: BroadcastDelta;
782
980
  cache?: ReactiveCache;
783
981
  cdc?: boolean;
784
982
  clock?: Clock;
983
+ companionMemo?: CompanionMemo;
785
984
  enforceRls?: boolean;
786
985
  globalDb?: DatabaseWriterLike;
787
986
  headroom?: TransactionHeadroomTracker;
788
987
  idGenerator?: IdGenerator;
988
+ inTransaction?: () => boolean;
789
989
  maxRelationKeys?: number;
790
990
  onIndexUse?: IndexUseHook;
791
991
  onRead?: ReadHook;
792
992
  onReadRange?: (range: KeyRange) => void;
993
+ onStalePatchDropped?: (event: {
994
+ fields: string[];
995
+ id: string;
996
+ table: string;
997
+ }) => void;
793
998
  onWrite?: WriteHook;
794
999
  relationExistsPushDown?: "always" | "auto" | "never";
795
1000
  scheduler?: SchedulerLike;
@@ -802,6 +1007,8 @@ declare class NotUniqueError extends LunoraError {
802
1007
  constructor(message?: string);
803
1008
  }
804
1009
  declare const normalizeIdStructurally: (schema: SchemaLike, tableName: string, id: string) => null | string;
1010
+ declare const assertNoExplicitUndefined: (op: "patch" | "patchIf" | "replace", document: Record<string, unknown>) => void;
1011
+ declare const stripReservedPatchFields: (patch: Record<string, unknown>) => Record<string, unknown>;
805
1012
  declare const createShardCtxDb: (options: CtxDbOptions) => DatabaseWriterLike;
806
1013
  declare const AUDIT_LOG_TABLE = "__lunora_audit__";
807
1014
  interface AuditEntry {
@@ -825,68 +1032,23 @@ declare const readAuditLog: (sql: SqlExec, options?: {
825
1032
  limit?: number;
826
1033
  sinceSeq?: number;
827
1034
  }) => AuditEntry[];
828
- interface SubscriptionQuery {
829
- args?: Record<string, unknown>;
830
- functionPath?: string;
831
- sinceEpoch?: string;
832
- sinceSeq?: number;
833
- table?: string;
834
- }
835
- interface ShapeSubscriptionQuery {
836
- args?: Record<string, unknown>;
837
- name: string;
838
- sinceEpoch?: string;
839
- sinceSeq?: number;
840
- }
841
- interface SubscriptionEnvelope {
842
- clientId?: string;
843
- context?: Record<string, unknown>;
844
- data?: unknown;
845
- id: string;
846
- query?: SubscriptionQuery;
847
- shape?: {
848
- args?: Record<string, unknown>;
849
- name: string;
850
- };
851
- sinceCheckpoint?: number;
852
- sinceEpoch?: string;
853
- topic?: string;
854
- type: "ack" | "connect" | "shape_subscribe" | "shape_unsubscribe" | "stream" | "subscribe" | "unsubscribe" | "whisper" | "whisper_subscribe" | "whisper_unsubscribe";
855
- }
856
- interface RpcRequest {
857
- args?: Record<string, unknown>;
858
- functionPath: string;
859
- }
860
- interface SocketAttachment {
861
- admin?: boolean;
862
- clientId?: string;
863
- connected?: boolean;
864
- connectionId?: string;
865
- context?: Record<string, unknown>;
866
- expiresAt?: number;
867
- identity?: Record<string, unknown>;
868
- shapes?: Record<string, ShapeSubscriptionQuery>;
869
- subs: Record<string, SubscriptionQuery>;
870
- userId?: string;
871
- whispers?: string[];
872
- }
873
- interface ResolvedShape {
874
- columns?: ReadonlyArray<string>;
875
- effectiveWhere?: WhereInput;
876
- global?: boolean;
877
- table: string;
878
- }
879
- interface SubscriptionIdentity {
880
- identity?: Record<string, unknown>;
881
- userId?: string;
882
- }
883
- interface ShardSocketLike {
884
- readonly bufferedAmount?: number;
885
- close?: (code?: number, reason?: string) => void;
886
- deserializeAttachment?: () => unknown;
887
- send: (data: string) => void;
888
- serializeAttachment?: (value: unknown) => void;
889
- }
1035
+ interface CdcArchiveScope {
1036
+ epoch: string;
1037
+ shard: string;
1038
+ }
1039
+ declare const readCdcArchivedThrough: (sql: SqlExec) => number;
1040
+ declare const writeCdcArchivedThrough: (sql: SqlExec, seq: number) => void;
1041
+ declare const archiveCdcSegment: (bucket: R2BucketLike, scope: CdcArchiveScope, changes: CdcChange[]) => Promise<void>;
1042
+ declare const cdcArchiveRewound: (bucket: R2BucketLike, scope: CdcArchiveScope, archivedThrough: number) => Promise<boolean>;
1043
+ declare const readArchivedCdcChanges: (bucket: R2BucketLike, scope: CdcArchiveScope, sinceSeq: number, limit: number | undefined) => Promise<{
1044
+ changes: CdcChange[];
1045
+ cursor: number;
1046
+ } | undefined>;
1047
+ declare const COMMIT_SEQ_TABLE = "__commit_seq";
1048
+ declare const COMMIT_SEQ_FIELD = "_commitSeq";
1049
+ declare const migrateCommitSeq: (sql: SqlExec) => void;
1050
+ declare const readCommitSeq: (sql: SqlExec) => number;
1051
+ declare const allocateCommitSeq: (sql: SqlExec) => number;
890
1052
  interface CompanionSyncDeps {
891
1053
  broadcast: (delta: MutationDelta) => void;
892
1054
  indexKeysFor: (table: string, document?: Record<string, unknown>) => ReadonlyArray<{
@@ -897,6 +1059,7 @@ interface CompanionSyncDeps {
897
1059
  recordCdc: (table: string, id: string, op: "delete" | "insert" | "update", doc?: Record<string, unknown>) => void;
898
1060
  schema: SchemaLike;
899
1061
  sql: SqlExec;
1062
+ verified?: Set<string>;
900
1063
  }
901
1064
  interface CompanionSync {
902
1065
  ensureBackfilledForTable: (tableName: string) => void;
@@ -910,6 +1073,19 @@ interface CompanionSync {
910
1073
  syncSearch: (tableName: string, id: string, document: Record<string, unknown> | undefined, previous?: Record<string, unknown>) => void;
911
1074
  }
912
1075
  declare const createCompanionSync: (deps: CompanionSyncDeps) => CompanionSync;
1076
+ declare const GLOBAL_SHAPE_SNAPSHOT_TABLE = "__global_shape_snapshot";
1077
+ declare const migrateGlobalShapeSnapshot: (sql: SqlExec) => void;
1078
+ declare const readGlobalShapeSnapshot: (sql: SqlExec, connectionId: string, subId: string) => Map<string, string> | undefined;
1079
+ declare const writeGlobalShapeSnapshot: (sql: SqlExec, connectionId: string, subId: string, snapshot: Map<string, string>) => void;
1080
+ declare const deleteGlobalShapeSnapshot: (sql: SqlExec, connectionId: string, subId: string) => void;
1081
+ declare const deleteGlobalShapeSnapshotsForConnection: (sql: SqlExec, connectionId: string) => void;
1082
+ declare const isMemoryTable: (definition: TableDefinitionLike | undefined) => boolean;
1083
+ declare const memoryTableNames: (schema: SchemaLike) => string[];
1084
+ declare const clearMemoryTables: (sql: SqlExec, schema: SchemaLike) => number;
1085
+ declare const resolveRankSeekTuple: (options: {
1086
+ after?: RankPageRowKey;
1087
+ cursor?: null | string;
1088
+ }) => unknown[] | undefined;
913
1089
  interface RankPageDeps {
914
1090
  assertRankPartitionLocal: (tableName: string, definition: TableDefinitionLike, index: RankIndexDefinitionLike) => void;
915
1091
  ensureRankBackfilled: (tableName: string, index: RankIndexDefinitionLike) => void;
@@ -927,8 +1103,68 @@ interface RankPageComputation {
927
1103
  key: RankPageRowKey;
928
1104
  }[];
929
1105
  }
930
- declare const hydrateDocsById: (deps: RankPageDeps, tableName: string, ids: ReadonlyArray<string>) => Map<string, Record<string, unknown>>;
931
1106
  declare const computeRankPage: (deps: RankPageDeps, tableName: string, indexName: string, rankPageOptions: RankPageOptions) => RankPageComputation;
1107
+ declare const SCHEDULE_OUTBOX_TABLE = "__schedule_outbox";
1108
+ interface ScheduleOutboxRow {
1109
+ attempts: number;
1110
+ envelopeJson: string;
1111
+ id: string;
1112
+ nextAttemptAt: number;
1113
+ }
1114
+ interface ScheduleOutboxEnvelope {
1115
+ args: unknown;
1116
+ options: Record<string, unknown> | undefined;
1117
+ target: unknown;
1118
+ when: number;
1119
+ }
1120
+ interface ScheduleOutbox {
1121
+ admit: (target: string) => number | undefined;
1122
+ forget: (id: string) => void;
1123
+ record: (id: string, envelope: ScheduleOutboxEnvelope) => void;
1124
+ wake: () => void;
1125
+ }
1126
+ declare const migrateScheduleOutbox: (sql: SqlExec) => void;
1127
+ declare const recordScheduleOutbox: (sql: SqlExec, id: string, envelopeJson: string, now: number) => void;
1128
+ declare const forgetScheduleOutbox: (sql: SqlExec, id: string) => void;
1129
+ declare const readDueScheduleOutbox: (sql: SqlExec, nowMs: number, limit: number) => ScheduleOutboxRow[];
1130
+ declare const deferScheduleOutbox: (sql: SqlExec, id: string, attempts: number, nextAttemptAt: number) => void;
1131
+ declare const parkScheduleOutbox: (sql: SqlExec, id: string, attempts: number) => void;
1132
+ declare const probeScheduleOutbox: (sql: SqlExec) => {
1133
+ dueAt: number | undefined;
1134
+ populated: boolean;
1135
+ };
1136
+ declare const trimScheduleOutbox: (sql: SqlExec, olderThanTs: number) => void;
1137
+ /**
1138
+ * How far a companion's backfill has progressed, and under which analysis.
1139
+ * Declared here rather than beside either engine's state table: both record the
1140
+ * same three facts, and the decisions made from them are the shared policy
1141
+ * below.
1142
+ */
1143
+ interface BackfillState {
1144
+ /** Last `id` indexed, or `undefined` when no page has run yet. */
1145
+ cursor: string | undefined;
1146
+ /** True once a page came back short — the table is fully indexed. */
1147
+ done: boolean;
1148
+ /** Analyzer profile the stored rows were built with; `undefined` predates profile tracking. */
1149
+ profile: string | undefined;
1150
+ }
1151
+ declare const SEARCH_STATE_TABLE = "__lunora_search_state";
1152
+ declare const migrateSearchState: (sql: SqlExec) => void;
1153
+ declare const readSearchBackfillState: (sql: SqlExec, companion: string) => BackfillState;
1154
+ declare const writeSearchBackfillState: (sql: SqlExec, companion: string, cursor: string | undefined, done: boolean, profile: string) => void;
1155
+ declare const SHAPE_POKE_CURSOR_TABLE = "__shape_poke_cursor";
1156
+ declare const migrateShapePokeCursor: (sql: SqlExec) => void;
1157
+ declare const readShapePokeCursor: (sql: SqlExec, connectionId: string, subId: string) => number | undefined;
1158
+ declare const writeShapePokeCursor: (sql: SqlExec, connectionId: string, subId: string, cursor: number) => void;
1159
+ interface ShapePokeCursorRow {
1160
+ connectionId: string;
1161
+ cursor: number;
1162
+ subId: string;
1163
+ }
1164
+ declare const writeShapePokeCursors: (sql: SqlExec, rows: ReadonlyArray<ShapePokeCursorRow>) => void;
1165
+ declare const minShapePokeCursor: (sql: SqlExec) => number | undefined;
1166
+ declare const deleteShapePokeCursor: (sql: SqlExec, connectionId: string, subId: string) => void;
1167
+ declare const deleteShapePokeCursorsForConnection: (sql: SqlExec, connectionId: string) => void;
932
1168
  declare const DATA_MIGRATION_STATE_TABLE = "__lunora_migrations";
933
1169
  type MigrationDirection = "down" | "up";
934
1170
  type MigrationStatus = "completed" | "failed" | "in_progress";
@@ -992,6 +1228,29 @@ interface DependencyTracker {
992
1228
  declare const createDependencyTracker: () => DependencyTracker;
993
1229
  declare const runSql: <Row = Record<string, unknown>>(sql: SqlExec, query: string, ...params: unknown[]) => SqlCursor<Row>;
994
1230
  declare const runDrizzle: <Row = Record<string, unknown>>(exec: SqlExec, query: SQL) => SqlCursor<Row>;
1231
+ type RangeOperandType = "boolean" | "number" | "string";
1232
+ interface WhereFragments<T> {
1233
+ binary: (reference: T, comparator: string, value: unknown) => T;
1234
+ connect: (left: T, right: T, connector: "AND" | "OR") => T;
1235
+ constant: (value: boolean) => T;
1236
+ contains: (reference: T, term: T) => T;
1237
+ inList: (reference: T, items: ReadonlyArray<unknown>, negated: boolean, budget: number) => T;
1238
+ negate: (inner: T) => T;
1239
+ nullCheck: (reference: T, negated: boolean) => T;
1240
+ value: (value: unknown) => T;
1241
+ }
1242
+ type FieldRefSql<T> = (field: string) => T;
1243
+ type SerializeValue = (value: unknown, field: string) => unknown;
1244
+ interface WhereSqlStrategy<T = SQL> {
1245
+ containsExpr?: (reference: T, term: T) => T;
1246
+ fieldRef: FieldRefSql<T>;
1247
+ inList?: (reference: T, items: ReadonlyArray<unknown>, negated: boolean, budget?: number) => T;
1248
+ rangeTypeGuard: (field: string, type: RangeOperandType) => T;
1249
+ relationExists?: (request: unknown) => T;
1250
+ serialize: SerializeValue;
1251
+ }
1252
+ declare const serverInList: (engine: "mysql" | "postgres") => (reference: SQL, items: ReadonlyArray<unknown>, negated: boolean, budget?: number) => SQL;
1253
+ declare const compileWhereSql: <T = SQL>(where: WhereInput | undefined, strategy: WhereSqlStrategy<T>, fragments?: WhereFragments<T>, reservedParams?: number) => T | undefined;
995
1254
  declare const quoteIdentifier: (name: string) => string;
996
1255
  declare const serializeSqlValue: (value: unknown) => unknown;
997
1256
  declare const DOC_COLUMN = "__doc__";
@@ -1005,10 +1264,16 @@ declare const AGG_KEY: Name;
1005
1264
  declare const AGG_VALUE: Name;
1006
1265
  declare const AGG_COUNT: Name;
1007
1266
  declare const aggUpsertSql: (aggTable: string, key: unknown, value: unknown, count: unknown, set: SQL) => SQL;
1008
- declare const tableColumns: (definition: TableDefinitionLike) => [string, ColumnMetaLike][];
1267
+ declare const tableColumns: (definition: TableDefinitionLike) => ReadonlyArray<readonly [string, ColumnMetaLike]>;
1009
1268
  declare const rowToDocument: (row: Record<string, unknown> | undefined) => Record<string, unknown> | undefined;
1010
1269
  declare const tryRowToDocument: (row: Record<string, unknown> | undefined) => Record<string, unknown> | undefined;
1011
1270
  declare const isFtsAvailable: (sql: SqlExec) => boolean;
1271
+ declare const WORKERD_SQLITE_LIMITS: {
1272
+ readonly boundParams: 100;
1273
+ readonly compoundSelect: 5;
1274
+ readonly likePattern: 50;
1275
+ readonly sqlTextLength: 100000;
1276
+ };
1012
1277
  type SqlEngine = "mysql" | "postgres" | "sqlite";
1013
1278
  interface RenderedSql {
1014
1279
  params: unknown[];
@@ -1016,6 +1281,79 @@ interface RenderedSql {
1016
1281
  }
1017
1282
  declare const renderSql: (engine: SqlEngine, query: SQL) => RenderedSql;
1018
1283
  declare const param: (value: unknown) => SQL;
1284
+ declare const unionAll: (branches: ReadonlyArray<SQL>) => SQL;
1285
+ declare const sqliteInList: (reference: SQL, items: ReadonlyArray<unknown>, negated: boolean, budget?: number) => SQL;
1286
+ type DurableStreamStatus = "complete" | "error" | "running";
1287
+ interface DurableStreamRun {
1288
+ error?: string;
1289
+ errorCode?: string;
1290
+ lastSeq: number;
1291
+ startedAt: number;
1292
+ status: DurableStreamStatus;
1293
+ }
1294
+ interface DurableStreamChunk {
1295
+ dataJson: string;
1296
+ seq: number;
1297
+ }
1298
+ declare const migrateDurableStreams: (sql: SqlExec) => void;
1299
+ declare const readStreamRun: (sql: SqlExec, runKey: string) => DurableStreamRun | undefined;
1300
+ declare const claimStreamRun: (sql: SqlExec, runKey: string, startedAt: number, ttlMs: number) => boolean;
1301
+ declare const deleteStreamRun: (sql: SqlExec, runKey: string) => void;
1302
+ declare const appendStreamChunk: (sql: SqlExec, runKey: string, seq: number, dataJson: string) => void;
1303
+ declare const readStreamChunks: (sql: SqlExec, runKey: string, sinceSeq: number) => DurableStreamChunk[];
1304
+ declare const finishStreamRun: (sql: SqlExec, runKey: string, status: "complete" | "error", lastSeq: number, failure?: {
1305
+ code: string;
1306
+ message: string;
1307
+ }) => void;
1308
+ declare const trimStreamRuns: (sql: SqlExec, now: number, live: ReadonlySet<string>) => void;
1309
+ declare const MAX_DURABLE_STREAM_CHUNKS = 50000;
1310
+ declare const MAX_DURABLE_STREAM_BYTES: number;
1311
+ interface DurableStreamSink {
1312
+ readonly chunk: (chunk: {
1313
+ data: unknown;
1314
+ generation?: number;
1315
+ seq: number;
1316
+ }) => boolean;
1317
+ readonly complete: () => void;
1318
+ readonly fail: (failure: {
1319
+ code: string;
1320
+ message: string;
1321
+ }) => void;
1322
+ }
1323
+ type DurableAttachDecision = "attach" | "interrupted" | "reclaim" | "replay-terminal";
1324
+ declare const decideDurableAttach: (run: DurableStreamRun | undefined, context: {
1325
+ generation?: number;
1326
+ live?: {
1327
+ generation: number;
1328
+ };
1329
+ resuming: boolean;
1330
+ }) => DurableAttachDecision;
1331
+ interface DurableStreamAttach {
1332
+ readonly generation?: number;
1333
+ readonly iterator: (signal: AbortSignal) => AsyncIterable<unknown>;
1334
+ readonly runKey: string;
1335
+ readonly sinceChunk: number;
1336
+ readonly sink: DurableStreamSink;
1337
+ readonly ttlMs?: number;
1338
+ }
1339
+ declare class DurableStreamRunner {
1340
+ private lastTrimAt;
1341
+ private readonly runs;
1342
+ private readonly sql;
1343
+ private readonly waitUntil;
1344
+ constructor(dependencies: {
1345
+ sql: () => SqlExec;
1346
+ waitUntil?: (promise: Promise<unknown>) => void;
1347
+ });
1348
+ attach(request: DurableStreamAttach): Promise<void>;
1349
+ detach(runKey: string, sink: DurableStreamSink): void;
1350
+ isLive(runKey: string): boolean;
1351
+ private attachOrThrow;
1352
+ private produce;
1353
+ private trim;
1354
+ }
1355
+ declare const envPositiveInt: (env: unknown, key: string, fallback: number) => number;
1356
+ declare const envOptionalPositiveInt: (env: unknown, key: string) => number | undefined;
1019
1357
  interface ExternalSourceDiffResult {
1020
1358
  changes: CdcChange[];
1021
1359
  nextBaseline: Map<string, string>;
@@ -1080,6 +1418,16 @@ declare const isSoftDeleted: (row: Record<string, unknown>, column: string) => b
1080
1418
  declare const pullExternalSourceIncrementalTick: (sql: SqlExec, writer: DatabaseWriterLike, client: SourceClientLike, table: string, source: ExternalSourceLike, shardKey: string, nowMs: number) => Promise<{
1081
1419
  applied: number;
1082
1420
  }>;
1421
+ declare const ftsRowidMapName: (companion: string) => string;
1422
+ interface FtsWriteOptions {
1423
+ guard?: SQL;
1424
+ unmappedRowids?: ReadonlyArray<number>;
1425
+ }
1426
+ declare const ftsCompanionDdl: (companion: string) => SQL[];
1427
+ declare const ftsWriteDocument: (companion: string, id: string, text: string, options?: FtsWriteOptions) => SQL[];
1428
+ declare const ftsPurgeDocument: (companion: string, id: string, options?: FtsWriteOptions) => SQL[];
1429
+ declare const ftsUnmappedPage: (companion: string, limit: number, after?: number) => SQL;
1430
+ declare const groupUnmappedRows: (rows: ReadonlyArray<Record<string, unknown>>) => Map<string, number[]>;
1083
1431
  declare const GEO_DEFAULT_PRECISION = 9;
1084
1432
  interface GeoPoint {
1085
1433
  lat: number;
@@ -1095,6 +1443,20 @@ declare const coveringGeohashes: (center: GeoPoint, radiusMeters: number) => str
1095
1443
  declare const pointInBoundingBox: (point: GeoPoint, box: GeoBoundingBox) => boolean;
1096
1444
  declare const boundingBoxCenter: (box: GeoBoundingBox) => GeoPoint;
1097
1445
  declare const boundingBoxGeohashes: (box: GeoBoundingBox) => string[];
1446
+ declare class GlobalPollTick {
1447
+ private readonly changedTables;
1448
+ private readonly reads;
1449
+ private resync;
1450
+ private skippedCount;
1451
+ constructor(changedTables?: Set<string>);
1452
+ get readCount(): number;
1453
+ get resyncRequested(): boolean;
1454
+ get skipped(): number;
1455
+ requestResync(): void;
1456
+ rows(key: string | undefined, load: () => Promise<ShapeRow[]>): Promise<ShapeRow[]>;
1457
+ shouldRead(table: string): boolean;
1458
+ }
1459
+ declare const isInternalTableName: (name: string) => boolean;
1098
1460
  declare const ADMIN_FUNCTION_PREFIX = "__lunora_admin__:";
1099
1461
  declare const RELATION_FUNCTION_PREFIX = "__lunora_relation__:";
1100
1462
  declare const FLAGS_FUNCTION_PREFIX = "__lunora_flags__:";
@@ -1105,6 +1467,8 @@ declare const ADMIN_FUNCTIONS: {
1105
1467
  readonly aiGenerateSql: "__lunora_admin__:aiGenerateSql";
1106
1468
  readonly aiTableFilter: "__lunora_admin__:aiTableFilter";
1107
1469
  readonly assignIssue: "__lunora_admin__:assignIssue";
1470
+ readonly backfillSearch: "__lunora_admin__:backfillSearch";
1471
+ readonly backfillVectors: "__lunora_admin__:backfillVectors";
1108
1472
  readonly backRelationCounts: "__lunora_admin__:backRelationCounts";
1109
1473
  readonly cdcSync: "__lunora_admin__:cdcSync";
1110
1474
  readonly clearCapturedMail: "__lunora_admin__:clearCapturedMail";
@@ -1117,6 +1481,7 @@ declare const ADMIN_FUNCTIONS: {
1117
1481
  readonly explainIssue: "__lunora_admin__:explainIssue";
1118
1482
  readonly exportShard: "__lunora_admin__:exportShard";
1119
1483
  readonly facetColumn: "__lunora_admin__:facetColumn";
1484
+ readonly findRelated: "__lunora_admin__:findRelated";
1120
1485
  readonly getAdvisories: "__lunora_admin__:getAdvisories";
1121
1486
  readonly getAdvisorProcedures: "__lunora_admin__:getAdvisorProcedures";
1122
1487
  readonly getAuditLog: "__lunora_admin__:getAuditLog";
@@ -1143,20 +1508,24 @@ declare const ADMIN_FUNCTIONS: {
1143
1508
  readonly ignoreIssue: "__lunora_admin__:ignoreIssue";
1144
1509
  readonly importShard: "__lunora_admin__:importShard";
1145
1510
  readonly listFlags: "__lunora_admin__:listFlags";
1511
+ readonly listReactors: "__lunora_admin__:listReactors";
1146
1512
  readonly listQueues: "__lunora_admin__:listQueues";
1147
1513
  readonly lintSql: "__lunora_admin__:lintSql";
1148
1514
  readonly listTables: "__lunora_admin__:listTables";
1149
1515
  readonly listWorkflows: "__lunora_admin__:listWorkflows";
1150
1516
  readonly maskPolicies: "__lunora_admin__:maskPolicies";
1151
1517
  readonly migrationStatus: "__lunora_admin__:migrationStatus";
1518
+ readonly patchRows: "__lunora_admin__:patchRows";
1152
1519
  readonly pitrRestore: "__lunora_admin__:pitrRestore";
1153
1520
  readonly rankBefore: "__lunora_admin__:rankBefore";
1154
1521
  readonly rankPage: "__lunora_admin__:rankPage";
1155
1522
  readonly readTablePage: "__lunora_admin__:readTablePage";
1523
+ readonly rebuildCompanions: "__lunora_admin__:rebuildCompanions";
1156
1524
  readonly recordAuthEvent: "__lunora_admin__:recordAuthEvent";
1157
1525
  readonly recordContainerEvent: "__lunora_admin__:recordContainerEvent";
1158
1526
  readonly recordMail: "__lunora_admin__:recordMail";
1159
1527
  readonly recordQueueMessage: "__lunora_admin__:recordQueueMessage";
1528
+ readonly releaseShardRegistration: "__lunora_admin__:releaseShardRegistration";
1160
1529
  readonly replayQueueMessage: "__lunora_admin__:replayQueueMessage";
1161
1530
  readonly resolveIssue: "__lunora_admin__:resolveIssue";
1162
1531
  readonly rlsPolicies: "__lunora_admin__:rlsPolicies";
@@ -1167,6 +1536,7 @@ declare const ADMIN_FUNCTIONS: {
1167
1536
  readonly runSql: "__lunora_admin__:runSql";
1168
1537
  readonly sendQueueMessage: "__lunora_admin__:sendQueueMessage";
1169
1538
  readonly sendTestMail: "__lunora_admin__:sendTestMail";
1539
+ readonly sendWorkflowEvent: "__lunora_admin__:sendWorkflowEvent";
1170
1540
  readonly setIssueSeverity: "__lunora_admin__:setIssueSeverity";
1171
1541
  readonly storageOrphans: "__lunora_admin__:storageOrphans";
1172
1542
  readonly storageReferences: "__lunora_admin__:storageReferences";
@@ -1226,8 +1596,12 @@ interface TablesIndexesResult {
1226
1596
  indexesByTable: Record<string, TableIndexInfo[]>;
1227
1597
  }
1228
1598
  interface ColumnMeta {
1599
+ bucket?: string;
1600
+ enumValues?: string[];
1229
1601
  isStorage?: boolean;
1230
1602
  name: string;
1603
+ nullable?: boolean;
1604
+ onDelete?: "cascade" | "restrict" | "set null";
1231
1605
  optional: boolean;
1232
1606
  pk?: boolean;
1233
1607
  ref?: string;
@@ -1324,6 +1698,12 @@ interface StudioFeaturesResult {
1324
1698
  mail: boolean;
1325
1699
  notifications: boolean;
1326
1700
  payments: boolean;
1701
+ platform?: {
1702
+ id: string;
1703
+ name: string;
1704
+ unsupported: string[];
1705
+ };
1706
+ privacy: boolean;
1327
1707
  queues: boolean;
1328
1708
  scheduler: boolean;
1329
1709
  storage: boolean;
@@ -1342,13 +1722,26 @@ interface FlagsResult {
1342
1722
  configured: boolean;
1343
1723
  flags: FlagEvaluation[];
1344
1724
  }
1725
+ interface ReactorMetadata {
1726
+ errors: number;
1727
+ lastError?: string;
1728
+ lastRanAt?: number;
1729
+ path: string;
1730
+ runs: number;
1731
+ state: "active" | "failing" | "idle";
1732
+ suppressed: number;
1733
+ tables?: ReadonlyArray<string>;
1734
+ }
1735
+ interface ReactorsResult {
1736
+ reactors: ReactorMetadata[];
1737
+ }
1345
1738
  interface WorkflowMetadata {
1346
- binding: string;
1347
1739
  className: string;
1348
1740
  exportName: string;
1349
1741
  name: string;
1350
1742
  }
1351
1743
  interface WorkflowsResult {
1744
+ eventTypes?: string[];
1352
1745
  workflows: WorkflowMetadata[];
1353
1746
  }
1354
1747
  interface QueueMetadata {
@@ -1357,11 +1750,12 @@ interface QueueMetadata {
1357
1750
  exportName: string;
1358
1751
  mode: "pull" | "push";
1359
1752
  name: string;
1753
+ topic?: string;
1360
1754
  }
1361
1755
  interface QueuesResult {
1362
1756
  queues: QueueMetadata[];
1363
1757
  }
1364
- type WorkflowInstanceState = "complete" | "errored" | "paused" | "queued" | "running" | "terminated" | "unknown" | "waiting" | "waitingForPause";
1758
+ type WorkflowInstanceState = "complete" | "errored" | "paused" | "queued" | "rollingBack" | "running" | "terminated" | "unknown" | "waiting" | "waitingForPause";
1365
1759
  interface CreateWorkflowInstanceResult {
1366
1760
  id: string;
1367
1761
  status: WorkflowInstanceState;
@@ -1400,12 +1794,15 @@ interface TablePage {
1400
1794
  columns: string[];
1401
1795
  refs?: Record<string, string>;
1402
1796
  rows: Record<string, unknown>[];
1797
+ sqlColumns: string[];
1403
1798
  total?: number;
1404
1799
  }
1405
- type FilterOperator = "contains" | "eq" | "gt" | "gte" | "lt" | "lte" | "ne";
1800
+ type ColumnKinds = Readonly<Record<string, string>>;
1801
+ type FilterOperator = "contains" | "eq" | "gt" | "gte" | "has" | "lt" | "lte" | "ne";
1406
1802
  interface FilterClause {
1407
1803
  column: string;
1408
1804
  operator: FilterOperator;
1805
+ path?: string[];
1409
1806
  value?: unknown;
1410
1807
  }
1411
1808
  interface OrderByClause {
@@ -1413,6 +1810,7 @@ interface OrderByClause {
1413
1810
  direction: SortDirection;
1414
1811
  }
1415
1812
  interface ReadTablePageOptions {
1813
+ columnKinds?: ColumnKinds;
1416
1814
  filters?: FilterClause[];
1417
1815
  limit?: number;
1418
1816
  offset?: number;
@@ -1423,6 +1821,8 @@ interface ReadTablePageOptions {
1423
1821
  table: string;
1424
1822
  }
1425
1823
  interface SelectMatchingIdsOptions {
1824
+ after?: string;
1825
+ columnKinds?: ColumnKinds;
1426
1826
  filters?: FilterClause[];
1427
1827
  limit?: number;
1428
1828
  search?: string;
@@ -1430,6 +1830,7 @@ interface SelectMatchingIdsOptions {
1430
1830
  }
1431
1831
  interface FacetColumnOptions {
1432
1832
  column: string;
1833
+ columnKinds?: ColumnKinds;
1433
1834
  filters?: FilterClause[];
1434
1835
  limit?: number;
1435
1836
  search?: string;
@@ -1445,6 +1846,7 @@ interface FacetColumnResult {
1445
1846
  }
1446
1847
  declare const MAX_PAGE_SIZE = 500;
1447
1848
  declare const listTables: (sql: SqlExec) => TableInfo[];
1849
+ declare const isVacuousFilterClause: (clause: FilterClause) => boolean;
1448
1850
  declare const readTablePage: (sql: SqlExec, options: ReadTablePageOptions) => TablePage;
1449
1851
  declare const selectMatchingIds: (sql: SqlExec, options: SelectMatchingIdsOptions) => {
1450
1852
  hasMore: boolean;
@@ -1463,6 +1865,7 @@ interface StorageReferenceResult {
1463
1865
  declare const findStorageReferences: (sql: SqlExec, storageColumns: Record<string, string[]>, keys: string[]) => StorageReferenceResult;
1464
1866
  interface SocketAttachmentLike {
1465
1867
  admin?: boolean;
1868
+ authenticated?: boolean;
1466
1869
  subs?: Record<string, SubscriptionInfo>;
1467
1870
  }
1468
1871
  declare const summarizeSubscriptions: (attachments: SocketAttachmentLike[]) => SubscriptionsResult;
@@ -1479,18 +1882,29 @@ interface FanoutPathCounters {
1479
1882
  socketsIterated: number;
1480
1883
  totalMs: number;
1481
1884
  }
1885
+ interface ShapeProbeCounters {
1886
+ run: number;
1887
+ served: number;
1888
+ }
1889
+ interface GlobalPollCounters {
1890
+ drains: number;
1891
+ pairsSkipped: number;
1892
+ }
1482
1893
  interface FanoutMetricsResult {
1894
+ globalPoll: GlobalPollCounters;
1483
1895
  maxRelays: number;
1484
1896
  peakSubscribers: number;
1485
1897
  promoted: boolean;
1486
1898
  relayCount: number;
1487
1899
  shapePoke: FanoutPathCounters;
1900
+ shapeProbe: ShapeProbeCounters;
1488
1901
  sinceMs: number;
1489
1902
  topics: FanoutTopicStat[];
1490
1903
  totalConnections: number;
1491
1904
  whisper: FanoutPathCounters;
1492
1905
  }
1493
1906
  interface FanoutAttachmentLike {
1907
+ authenticated?: boolean;
1494
1908
  shapes?: Record<string, {
1495
1909
  name?: string;
1496
1910
  }>;
@@ -1498,6 +1912,10 @@ interface FanoutAttachmentLike {
1498
1912
  }
1499
1913
  declare const DEFAULT_FANOUT_TOPIC_LIMIT = 20;
1500
1914
  declare const createFanoutCounters: () => FanoutPathCounters;
1915
+ declare const createShapeProbeCounters: () => ShapeProbeCounters;
1916
+ declare const createGlobalPollCounters: () => GlobalPollCounters;
1917
+ declare const recordGlobalPollPass: (counters: GlobalPollCounters, drains: number, pairsSkipped: number) => GlobalPollCounters;
1918
+ declare const recordShapeProbePass: (counters: ShapeProbeCounters, run: number, served: number) => ShapeProbeCounters;
1501
1919
  declare const recordFanoutPass: (counters: FanoutPathCounters, iterated: number, delivered: number, ms: number) => FanoutPathCounters;
1502
1920
  declare const summarizeFanoutTopics: (attachments: FanoutAttachmentLike[], limit?: number) => {
1503
1921
  peakSubscribers: number;
@@ -1545,6 +1963,11 @@ declare const clearCapturedMail: (sql: SqlExec) => {
1545
1963
  declare class NotFoundError extends LunoraError {
1546
1964
  constructor(message?: string);
1547
1965
  }
1966
+ declare const operatorFields: (definition: TableDefinitionLike, patch: Record<string, unknown>) => ReadonlySet<string>;
1967
+ declare const resolvePatch: (definition: TableDefinitionLike, patch: Record<string, unknown>, current: Record<string, unknown>) => Record<string, unknown>;
1968
+ declare const patchDependsOnRow: (definition: TableDefinitionLike, patch: Record<string, unknown>) => boolean;
1969
+ declare const assertPatchAllowed: (options: PatchWriteOptions | undefined, previous: Record<string, unknown>, next: Record<string, unknown>) => void;
1970
+ declare const readPatchField: (document: Record<string, unknown>, field: string) => unknown;
1548
1971
  interface PitrStorage {
1549
1972
  getBookmarkForTime?: (time: Date | number) => Promise<string>;
1550
1973
  getCurrentBookmark?: () => Promise<string>;
@@ -1566,7 +1989,22 @@ interface PitrRestoreArgs {
1566
1989
  }
1567
1990
  declare const readBookmark: (storage: PitrStorage, time?: number | string) => Promise<PitrBookmarkResult>;
1568
1991
  declare const armRestore: (storage: PitrStorage, args: PitrRestoreArgs) => Promise<Omit<PitrRestoreResult, "restarted">>;
1569
- declare const normalizeOrderKeys: (orderBy: OrderByInput[] | undefined) => OrderKey[];
1992
+ declare const tiebreakDirectionFor: (keys: ReadonlyArray<{
1993
+ direction?: string;
1994
+ }>) => SortDirection;
1995
+ declare const equalityPinnedFields: (where: undefined | WhereInput) => ReadonlySet<string>;
1996
+ declare const uniqueIndexFields: (indexes: ReadonlyArray<{
1997
+ fields: ReadonlyArray<string>;
1998
+ unique?: boolean;
1999
+ }> | undefined, shape: Record<string, ValidatorLike> | undefined) => ReadonlyArray<ReadonlyArray<string>>;
2000
+ interface OrderKeyConstraints {
2001
+ pinned?: ReadonlySet<string>;
2002
+ uniqueBy?: ReadonlyArray<ReadonlyArray<string>>;
2003
+ }
2004
+ declare const nullsFirstOf: (key: Pick<OrderKey, "direction" | "nulls">) => boolean;
2005
+ declare const nullsOrderSuffix: (nullsFirst: boolean) => string;
2006
+ declare const normalizeOrderKeys: (orderBy: OrderByInput[] | undefined, shape?: Record<string, ValidatorLike>, constraints?: OrderKeyConstraints) => OrderKey[];
2007
+ declare const CURSOR_PREFIX = "~4";
1570
2008
  declare const encodeCursor: (record: Record<string, unknown>, keys: OrderKey[]) => string;
1571
2009
  declare const decodeCursor: (cursor: string) => unknown[];
1572
2010
  declare const buildSeekWhere: (keys: OrderKey[], cursorValues: unknown[]) => WhereInput;
@@ -1626,24 +2064,70 @@ declare const rankKeyFromDocument: (index: RankIndexDefinitionLike, document_: R
1626
2064
  rowId: string;
1627
2065
  sortValues: unknown[];
1628
2066
  };
2067
+ declare const rankPivotConditionSql: (column: string, value: unknown, direction: "asc" | "desc", wantLater: boolean) => SQL | undefined;
1629
2068
  declare const matchesRankStaticWhere: (document: Record<string, unknown>, predicate: Record<string, unknown>) => boolean;
2069
+ declare const REACTOR_STATE_TABLE = "__reactor_state";
2070
+ interface ReactorState {
2071
+ digest: string;
2072
+ lastError?: string;
2073
+ lastRanAt: number;
2074
+ stats: ReactorStats;
2075
+ tables?: ReadonlyArray<string>;
2076
+ }
2077
+ interface ReactorStats {
2078
+ errors: number;
2079
+ runs: number;
2080
+ suppressed: number;
2081
+ }
2082
+ declare const migrateReactorState: (sql: SqlExec) => void;
2083
+ declare const readReactorState: (sql: SqlExec, path: string) => ReactorState | undefined;
2084
+ declare const listReactorStates: (sql: SqlExec) => {
2085
+ path: string;
2086
+ state: ReactorState;
2087
+ }[];
2088
+ type ReactorDispatchResult = "error" | "ran" | "suppressed";
2089
+ declare const writeReactorState: (sql: SqlExec, path: string, outcome: {
2090
+ digest?: string;
2091
+ error?: string;
2092
+ now: number;
2093
+ result: ReactorDispatchResult;
2094
+ tables?: ReadonlyArray<string>;
2095
+ }) => void;
2096
+ declare const reactorNeedsRun: (state: Pick<ReactorState, "tables"> | undefined, changed: ReadonlySet<string>) => boolean;
1630
2097
  interface ReadFootprint {
1631
- onRead: (table: string, idOrScan?: string) => void;
2098
+ onRead: (table: string, idOrScan?: string, exact?: boolean) => void;
1632
2099
  onReadRange: (range: KeyRange) => void;
1633
2100
  ranges: () => Map<string, KeyRange[]> | undefined;
1634
2101
  tables: Set<string>;
1635
2102
  }
1636
2103
  declare const createReadFootprint: () => ReadFootprint;
2104
+ declare const UNVOUCHABLE_DEP = "!unvouchable";
2105
+ declare const markUnvouchableReads: <T extends object>(facade: T, onRead: ReadFootprint["onRead"] | undefined, methods: ReadonlyArray<string>) => T;
2106
+ declare const WHERE_FILTER: unique symbol;
2107
+ type RowPredicate = (document: Record<string, unknown>) => boolean;
2108
+ type WhereFilter = RowPredicate & {
2109
+ readonly [WHERE_FILTER]: WhereInput;
2110
+ };
2111
+ declare const whereFilter: (where: WhereInput, predicate: RowPredicate) => WhereFilter;
2112
+ declare const whereOfFilter: (predicate: RowPredicate) => undefined | WhereInput;
2113
+ declare const isPushableWhere: (where: WhereInput, shape: Readonly<Record<string, ValidatorLike>>, exactText?: boolean) => boolean;
2114
+ declare const RELATED_MAX_DEPTH = 4;
2115
+ declare const RELATED_DEFAULT_LIMIT = 50;
2116
+ declare const RELATED_MAX_LIMIT = 200;
2117
+ declare const RELATED_DEPTH_DECAY = 0.5;
2118
+ declare const deriveRelationEdges: (schema: SchemaLike) => RelationEdge[];
2119
+ type RelationGraphReader = Pick<DatabaseWriterLike, "findMany"> & Pick<Partial<DatabaseWriterLike>, "lookupById">;
2120
+ declare const findRelated: (reader: RelationGraphReader, edges: ReadonlyArray<RelationEdge>, start: RelatedStart, options?: RelatedOptions) => Promise<RelatedPage>;
1637
2121
  declare const DEFAULT_MAX_RELATION_KEYS = 5000;
1638
2122
  interface RelationExistsMarker {
1639
2123
  childWhere: WhereInput;
1640
2124
  negated: boolean;
1641
2125
  parentTable: string;
1642
- relation: RelationDefinitionLike;
2126
+ relation: KeyedRelationDefinitionLike;
1643
2127
  }
1644
2128
  type ExistsPushMode = "always" | "auto";
1645
2129
  interface ResolveRelationPredicatesOptions {
1646
- canPushExists?: (relation: RelationDefinitionLike) => boolean;
2130
+ canPushExists?: (relation: KeyedRelationDefinitionLike) => boolean;
1647
2131
  existsPushMode?: ExistsPushMode;
1648
2132
  fetcher: (tableName: string, args: QueryArgs) => Promise<QueryPage>;
1649
2133
  maxRelationKeys?: number;
@@ -1654,7 +2138,7 @@ interface ResolveRelationPredicatesOptions {
1654
2138
  tableName: string;
1655
2139
  }
1656
2140
  interface ResolveContext {
1657
- canPushExists?: (relation: RelationDefinitionLike) => boolean;
2141
+ canPushExists?: (relation: KeyedRelationDefinitionLike) => boolean;
1658
2142
  existsPushMode: ExistsPushMode;
1659
2143
  fetcher: (tableName: string, args: QueryArgs) => Promise<QueryPage>;
1660
2144
  maxRelationKeys: number;
@@ -1667,15 +2151,24 @@ declare const isRelationPredicate: (value: unknown) => value is Record<string, W
1667
2151
  declare const containsRelationPredicate: (where: WhereInput, schema: ResolveContext["schema"], tableName: string) => boolean;
1668
2152
  declare const assertFlatPredicate: (where: WhereInput | undefined, schema: ResolveContext["schema"], tableName: string, op: string) => void;
1669
2153
  declare const resolveRelationPredicates: (where: WhereInput | undefined, options: ResolveRelationPredicatesOptions) => Promise<WhereInput | undefined>;
2154
+ declare const composeReadPredicate: (definition: TableDefinitionLike, args: QueryArgs, relation: Omit<ResolveRelationPredicatesOptions, "relationBaseWhere">) => Promise<{
2155
+ fetchLimit: number | undefined;
2156
+ limit: number | undefined;
2157
+ orderKeys: OrderKey[];
2158
+ predicate: WhereInput | undefined;
2159
+ }>;
1670
2160
  declare const assertShapeShardable: (effectiveWhere: WhereInput | undefined, schema: ResolveContext["schema"], table: string) => void;
1671
- declare const relationHooks: (args: Pick<QueryArgs, "relationBaseWhere" | "relationMask">) => Pick<QueryArgs, "relationBaseWhere" | "relationMask">;
2161
+ declare const relationHooks: (args: Pick<QueryArgs, "relationBaseWhere" | "relationMask">) => Pick<QueryArgs, "relationBaseWhere" | "relationMask"> & Pick<ResolveWithOptions, "fanOutBudget">;
1672
2162
  declare const fanOutScalarCounts: (counter: (tableName: string, where?: WhereInput) => Promise<number>, tableName: string, whereField: string, values: unknown[], policyWhere: WhereInput | undefined) => Promise<Map<unknown, number>>;
1673
2163
  declare const distinctValues: (rows: Record<string, unknown>[], field: string) => unknown[];
1674
2164
  declare const resolveWith: (options: ResolveWithOptions) => Promise<void>;
1675
2165
  interface ApplyOnDeleteOptions {
1676
2166
  deletedId: string;
1677
2167
  deletedReference: (references: string) => unknown;
1678
- findHolders: (holderTable: string, field: string, value: unknown) => Promise<Record<string, unknown>[]>;
2168
+ findHolders: (holderTable: string, field: string, value: unknown, page: {
2169
+ limit: number;
2170
+ select?: ReadonlyArray<string>;
2171
+ }) => Promise<Record<string, unknown>[]>;
1679
2172
  onCascade: (holderTable: string, id: string) => Promise<void>;
1680
2173
  onRestrict: (message: string) => never;
1681
2174
  onSetNull: (holderTable: string, id: string, field: string) => Promise<void>;
@@ -1685,7 +2178,15 @@ interface ApplyOnDeleteOptions {
1685
2178
  tableName: string;
1686
2179
  }
1687
2180
  declare const applyOnDelete: (options: ApplyOnDeleteOptions) => Promise<void>;
1688
- declare const runRowValidators: (definition: TableDefinitionLike, document: Record<string, unknown>, tolerateStoredNull?: boolean) => void;
2181
+ interface RowValidatorOptions {
2182
+ only?: ReadonlySet<string>;
2183
+ previous?: () => Readonly<Record<string, unknown>> | undefined;
2184
+ supplied?: Readonly<Record<string, unknown>>;
2185
+ tolerateStoredNull?: boolean;
2186
+ trusted?: boolean;
2187
+ }
2188
+ declare const applyInsertDefaults: (definition: TableDefinitionLike, document: Record<string, unknown>, auth: ServerDefaultContextLike["auth"]) => Record<string, unknown>;
2189
+ declare const runRowValidators: (definition: TableDefinitionLike, document: Record<string, unknown>, options?: RowValidatorOptions) => Record<string, unknown>;
1689
2190
  interface ShapeRowOp {
1690
2191
  key: string;
1691
2192
  op: "delete" | "insert" | "update";
@@ -1693,6 +2194,8 @@ interface ShapeRowOp {
1693
2194
  value?: Record<string, unknown>;
1694
2195
  }
1695
2196
  interface ShapePokePart {
2197
+ baseCheckpoint?: number;
2198
+ reset?: boolean;
1696
2199
  rowsPatch: ShapeRowOp[];
1697
2200
  shapeId: string;
1698
2201
  }
@@ -1727,15 +2230,18 @@ declare const clampPromotionThresholds: (tUp: number, tDownRaw: number) => Promo
1727
2230
  declare const relayCountFor: (subscribers: number, perRelayCapacity: number, maxRelays: number) => number;
1728
2231
  interface RelayAttach {
1729
2232
  relayIndex: number;
2233
+ seq?: number;
1730
2234
  type: "relay_attach";
1731
2235
  }
1732
2236
  interface RelayDetach {
1733
2237
  relayIndex: number;
2238
+ seq?: number;
1734
2239
  type: "relay_detach";
1735
2240
  }
1736
2241
  interface RelayFrame {
1737
2242
  cursor?: number;
1738
2243
  epoch?: string;
2244
+ exceptConnectionId?: string;
1739
2245
  frame: string;
1740
2246
  originRelay?: number;
1741
2247
  topic: string;
@@ -1753,6 +2259,12 @@ interface RelayShapeSubscribe {
1753
2259
  type: "relay_shape_subscribe";
1754
2260
  userId?: string;
1755
2261
  }
2262
+ interface RelayShapeUnsubscribe {
2263
+ connectionId: string;
2264
+ relayIndex: number;
2265
+ subId?: string;
2266
+ type: "relay_shape_unsubscribe";
2267
+ }
1756
2268
  interface RelayShapeSeed {
1757
2269
  cursor?: number;
1758
2270
  epoch?: string;
@@ -1772,44 +2284,86 @@ interface RelayShapePoke {
1772
2284
  targetConnectionId?: string;
1773
2285
  type: "relay_shape_poke";
1774
2286
  }
1775
- type OwnerRelayFrame = RelayAttach | RelayDetach | RelayFrame | RelayShapePoke | RelayShapeSubscribe;
1776
- declare const DEFAULT_MAX_RELAYS = 8;
1777
- interface RelayStub {
1778
- fetch: (url: string, init?: RequestInit) => Promise<Response>;
2287
+ interface RelayRoomEvent {
2288
+ attachment: Pick<SocketAttachment, "connectionId" | "context" | "identity" | "ip" | "userId">;
2289
+ connectionId: string;
2290
+ data?: unknown;
2291
+ kind: "join" | "leave" | "message";
2292
+ relayIndex: number;
2293
+ topic: string;
2294
+ type: "relay_room_event";
2295
+ }
2296
+ interface RelayRoomVerdict {
2297
+ admitted: boolean;
2298
+ }
2299
+ interface LiveSocketControlCall {
2300
+ action: unknown;
2301
+ callerId: string;
2302
+ connectionId: string;
2303
+ identity?: Record<string, unknown>;
2304
+ identityExpiry?: number;
2305
+ key: string;
2306
+ seq?: number;
2307
+ subscriptionId: string;
2308
+ }
2309
+ interface RelayLiveControl {
2310
+ control: LiveSocketControlCall;
2311
+ type: "relay_live_control";
1779
2312
  }
1780
- interface RelayNamespaceLike {
1781
- get: (id: unknown) => RelayStub;
1782
- getByName?: (name: string) => RelayStub;
1783
- idFromName: (name: string) => unknown;
2313
+ interface RelayLiveFrame {
2314
+ frame: string;
2315
+ key: string;
2316
+ topic: string;
2317
+ type: "relay_live_frame";
2318
+ }
2319
+ type OwnerRelayFrame = RelayAttach | RelayDetach | RelayFrame | RelayLiveControl | RelayLiveFrame | RelayRoomEvent | RelayShapePoke | RelayShapeSubscribe | RelayShapeUnsubscribe;
2320
+ declare const RELAY_SIGNATURE_HEADER = "x-lunora-relay-sig";
2321
+ declare const siblingSecretOf: (env: unknown) => string | undefined;
2322
+ declare const signSiblingBody: (secret: string, body: string) => Promise<string>;
2323
+ declare const verifySiblingBody: (env: unknown, supplied: null | string, raw: string) => Promise<boolean>;
2324
+ interface SiblingStub {
2325
+ fetch: (url: string, init?: RequestInit) => Promise<Response>;
1784
2326
  }
2327
+ declare const stubByName: (value: unknown, name: string, jurisdiction?: string) => SiblingStub | undefined;
2328
+ declare const DEFAULT_MAX_RELAYS = 8;
1785
2329
  interface RelayHost {
1786
2330
  buildShapeDiff: (resolved: ResolvedShape, fromCursor: number, toCursor: number) => ShapeRowOp[];
1787
2331
  computeOpLogShapeSeed: (shape: ShapeSubscriptionQuery, resolved: ResolvedShape) => {
1788
2332
  baseCheckpoint: number | undefined;
1789
2333
  cursor: number;
1790
2334
  epoch: string | undefined;
2335
+ reset: boolean;
1791
2336
  rowsPatch: ShapeRowOp[];
1792
2337
  };
1793
2338
  currentCdcEpoch: () => string | undefined;
2339
+ deliverLiveLocal: (topic: string, key: string, frame: string) => number;
1794
2340
  deliverWhisperLocal: (topic: string, frame: string, exclude: undefined | ShardSocketLike) => number;
1795
2341
  doName: () => string | undefined;
1796
2342
  env: () => unknown;
1797
2343
  getWebSockets: () => ShardSocketLike[];
2344
+ liveControl: (control: LiveSocketControlCall) => Promise<Response>;
1798
2345
  maskMetadata: () => MaskPoliciesResult;
1799
2346
  nextPokeId: () => string;
1800
2347
  readAttachment: (ws: ShardSocketLike) => SocketAttachment;
1801
2348
  recordShapePokeFanout: (iterated: number, delivered: number, elapsedMs: number) => void;
2349
+ relayRoomEvent: (event: RelayRoomEvent) => Promise<RelayRoomVerdict>;
1802
2350
  resolveShape: (name: string, args: Record<string, unknown>, identity?: SubscriptionIdentity) => ResolvedShape | undefined;
1803
2351
  rlsMetadata: () => RlsPoliciesResult;
1804
2352
  shardBinding: () => string | undefined;
2353
+ shardJurisdiction: () => string | undefined;
1805
2354
  sql: () => SqlExec;
1806
2355
  }
2356
+ interface RelayPokeDelivery {
2357
+ delivered: number;
2358
+ matched: number;
2359
+ }
1807
2360
  declare abstract class RelayLink {
1808
2361
  protected readonly host: RelayHost;
1809
2362
  protected readonly roleId: {
1810
2363
  ownerKey: string;
1811
2364
  relayIndex?: number;
1812
2365
  };
2366
+ private lastSequence;
1813
2367
  protected constructor(host: RelayHost, roleId: {
1814
2368
  ownerKey: string;
1815
2369
  relayIndex?: number;
@@ -1817,81 +2371,188 @@ declare abstract class RelayLink {
1817
2371
  handleControl(request: Request): Promise<Response>;
1818
2372
  maxRelays(): number;
1819
2373
  protected canAddressSiblings(): boolean;
1820
- protected relayNamespace(): RelayNamespaceLike | undefined;
2374
+ protected isAdmitted(ws: ShardSocketLike): boolean;
2375
+ protected siblingStub(targetName: string): SiblingStub | undefined;
2376
+ protected bindingName(): string | undefined;
2377
+ protected nextRelaySeq(): number;
1821
2378
  protected postRelayMessage(targetName: string, message: OwnerRelayFrame): Promise<void>;
1822
2379
  protected requestRelayMessage(targetName: string, message: OwnerRelayFrame): Promise<Response | undefined>;
1823
- abstract forwardWhisper(topic: string, frame: string): Promise<void>;
2380
+ abstract forwardWhisper(topic: string, frame: string, exceptConnectionId?: string): Promise<void>;
1824
2381
  abstract onFlush(changed: Set<string>, frameCursor: number): Promise<void>;
1825
2382
  abstract seedRelayShape(ws: ShardSocketLike, subId: string, shape: ShapeSubscriptionQuery, identity: SubscriptionIdentity): Promise<"ok" | undefined | {
1826
2383
  code: string;
1827
2384
  message: string;
1828
2385
  }>;
1829
- abstract announce(): Promise<void>;
2386
+ abstract announce(): Promise<boolean>;
1830
2387
  abstract announceDrain(closing: ShardSocketLike): Promise<void>;
2388
+ abstract releaseRelayShapes(ws: ShardSocketLike, subId?: string): Promise<void>;
1831
2389
  abstract relayCount(): number;
1832
2390
  abstract isShapeRelayUniform(name: string, args: Record<string, unknown>): boolean;
1833
- protected abstract onAttach(index: number): void;
1834
- protected abstract onDetach(index: number): void;
2391
+ abstract minShapeCursor(): number | undefined;
2392
+ protected abstract onAttach(index: number, seq: number | undefined): boolean;
2393
+ protected abstract onDetach(index: number, seq: number | undefined): boolean;
2394
+ protected abstract onLiveControl(control: LiveSocketControlCall): Promise<Response>;
1835
2395
  protected abstract onWhisperFrame(message: RelayFrame): Promise<void>;
2396
+ protected abstract refusesAsIdle(): boolean;
1836
2397
  protected abstract onShapeSubscribe(message: RelayShapeSubscribe): RelayShapeSeed;
1837
- protected abstract onShapePoke(poke: RelayShapePoke): number;
2398
+ protected abstract onShapeUnsubscribe(message: RelayShapeUnsubscribe): void;
2399
+ protected abstract onShapePoke(poke: RelayShapePoke): RelayPokeDelivery;
1838
2400
  }
1839
2401
  declare class OwnerRelay extends RelayLink {
1840
2402
  private readonly shapeUniformCache;
1841
2403
  private relaySetCache;
1842
- private readonly relayShapeRegistry;
1843
- private readonly relayShapeProxies;
2404
+ private liveGrantRelayCache;
2405
+ private relayTablesReady;
2406
+ private readonly relaySeqMarks;
2407
+ private readonly pendingSubscribeRelays;
2408
+ private registryCache;
2409
+ private recorded;
1844
2410
  private promotionState;
1845
2411
  constructor(host: RelayHost, ownerKey: string);
1846
- forwardWhisper(topic: string, frame: string): Promise<void>;
2412
+ forwardWhisper(topic: string, frame: string, exceptConnectionId?: string): Promise<void>;
2413
+ forwardLiveControl(call: LiveSocketControlCall): Promise<Response | undefined>;
2414
+ forwardLiveFrame(topic: string, key: string, frame: string): Promise<void>;
1847
2415
  onFlush(changed: Set<string>, frameCursor: number): Promise<void>;
1848
2416
  seedRelayShape(): Promise<"ok" | undefined | {
1849
2417
  code: string;
1850
2418
  message: string;
1851
2419
  }>;
1852
- announce(): Promise<void>;
2420
+ announce(): Promise<boolean>;
1853
2421
  announceDrain(): Promise<void>;
2422
+ releaseRelayShapes(): Promise<void>;
1854
2423
  relayCount(): number;
2424
+ minShapeCursor(): number | undefined;
1855
2425
  isShapeRelayUniform(name: string, args: Record<string, unknown>): boolean;
1856
- protected onAttach(index: number): void;
1857
- protected onDetach(index: number): void;
2426
+ protected onShapeUnsubscribe(message: RelayShapeUnsubscribe): void;
2427
+ protected onAttach(index: number, seq: number | undefined): boolean;
2428
+ protected onDetach(index: number, seq: number | undefined): boolean;
2429
+ protected refusesAsIdle(): boolean;
2430
+ protected onLiveControl(control: LiveSocketControlCall): Promise<Response>;
1858
2431
  protected onWhisperFrame(message: RelayFrame): Promise<void>;
1859
2432
  protected onShapeSubscribe(message: RelayShapeSubscribe): RelayShapeSeed;
1860
- protected onShapePoke(): number;
2433
+ protected onShapePoke(): RelayPokeDelivery;
2434
+ private relaySeqMark;
2435
+ private recordRelaySeq;
2436
+ private acceptRelaySeq;
1861
2437
  private buildShapePoke;
1862
2438
  private multicastShapePokes;
2439
+ private multicastToRelays;
1863
2440
  private proxyShapePokes;
2441
+ private proxyToRelay;
1864
2442
  private buildShapeSeedFrames;
1865
- private ensureRelayTable;
2443
+ private ensureRelayTables;
2444
+ protected bindingName(): string | undefined;
2445
+ private relayShapes;
2446
+ private rewindShapeCursor;
1866
2447
  private ownerRelaySet;
2448
+ private liveGrantRelaySet;
2449
+ private recordLiveGrantRelay;
1867
2450
  private addRelayToSet;
2451
+ private forwardToRelay;
2452
+ private requestDroppingIdle;
1868
2453
  private removeRelayFromSet;
1869
2454
  private probeShapeRelayUniform;
1870
2455
  private tableHasAnyMask;
2456
+ private liveControlAnswer;
1871
2457
  }
1872
2458
  declare class RelayMember extends RelayLink {
1873
2459
  private relayAnnounced;
1874
- private readonly shapeRelayMemos;
2460
+ private readonly liveControlSeqs;
2461
+ private pendingAnnounce;
2462
+ private announceGeneration;
2463
+ private pendingDetach;
2464
+ private relayMemoCache;
2465
+ private readonly shapeControl;
1875
2466
  constructor(host: RelayHost, ownerKey: string, relayIndex: number);
1876
2467
  forwardWhisper(topic: string, frame: string): Promise<void>;
2468
+ forwardRoomEvent(event: Omit<RelayRoomEvent, "relayIndex" | "type">): Promise<boolean>;
1877
2469
  onFlush(): Promise<void>;
1878
2470
  seedRelayShape(ws: ShardSocketLike, subId: string, shape: ShapeSubscriptionQuery, identity: SubscriptionIdentity): Promise<"ok" | {
1879
2471
  code: string;
1880
2472
  message: string;
1881
2473
  }>;
1882
- announce(): Promise<void>;
2474
+ announce(): Promise<boolean>;
1883
2475
  announceDrain(closing: ShardSocketLike): Promise<void>;
2476
+ releaseRelayShapes(ws: ShardSocketLike, subId?: string): Promise<void>;
1884
2477
  relayCount(): number;
1885
2478
  isShapeRelayUniform(): boolean;
1886
- protected onAttach(): void;
1887
- protected onDetach(): void;
2479
+ minShapeCursor(): number | undefined;
2480
+ protected onAttach(): boolean;
2481
+ protected refusesAsIdle(): boolean;
2482
+ protected onDetach(): boolean;
2483
+ protected onLiveControl(control: LiveSocketControlCall): Promise<Response>;
1888
2484
  protected onWhisperFrame(): Promise<void>;
1889
2485
  protected onShapeSubscribe(): RelayShapeSeed;
1890
- protected onShapePoke(poke: RelayShapePoke): number;
2486
+ protected onShapeUnsubscribe(): void;
2487
+ protected onShapePoke(poke: RelayShapePoke): RelayPokeDelivery;
2488
+ private queueShapeControl;
2489
+ private relayMemos;
2490
+ private connectionMemos;
1891
2491
  private recordRelayShapeMemo;
2492
+ private forgetRelayShapeMemos;
1892
2493
  private deliverShapePoke;
2494
+ private pokeSocketShapes;
1893
2495
  }
1894
2496
  declare const createRelayLink: (host: RelayHost) => OwnerRelay | RelayMember | undefined;
2497
+ declare const REGION_HINTS: readonly ["wnam", "enam", "sam", "weur", "eeur", "apac", "apac-ne", "apac-se", "oc", "afr", "me"];
2498
+ type RegionHint = (typeof REGION_HINTS)[number];
2499
+ type ReplicaReadiness = "fresh" | "stale" | "unavailable";
2500
+ interface ShardSiblingHost {
2501
+ doName: () => string | undefined;
2502
+ env: () => unknown;
2503
+ shardBinding: () => string | undefined;
2504
+ shardJurisdiction: () => string | undefined;
2505
+ sql: () => SqlExec;
2506
+ }
2507
+ interface ReplicaOwnerHost extends ShardSiblingHost {
2508
+ exportRows: () => Promise<ExportRow[]>;
2509
+ ownerCursor: () => number | undefined;
2510
+ ownerEpoch: () => string | undefined;
2511
+ ownerFloor: () => number | undefined;
2512
+ readChanges: (sinceSeq: number, limit: number) => {
2513
+ changes: CdcChange[];
2514
+ cursor: number;
2515
+ };
2516
+ rowCount: () => number;
2517
+ }
2518
+ interface ReplicaFollowerHost extends ShardSiblingHost {
2519
+ applyChanges: (changes: ReadonlyArray<CdcChange>) => Promise<number>;
2520
+ exportRows: () => Promise<ExportRow[]>;
2521
+ importRows: (rows: ReadonlyArray<ExportRow>) => Promise<{
2522
+ errors: ReadonlyArray<unknown>;
2523
+ }>;
2524
+ reportError?: (scope: string, error: unknown) => void;
2525
+ transactionLimits: () => Partial<TransactionLimits>;
2526
+ }
2527
+ declare const handleReplicaControl: (host: ReplicaOwnerHost, request: Request) => Promise<Response>;
2528
+ declare class ShardReplica {
2529
+ private readonly host;
2530
+ readonly ownerKey: string;
2531
+ readonly region: RegionHint;
2532
+ private divergent;
2533
+ private inFlight;
2534
+ constructor(host: ReplicaFollowerHost, ownerKey: string, region: RegionHint);
2535
+ ensureFresh(minSeq?: number): Promise<ReplicaReadiness>;
2536
+ appliedSeq(): number;
2537
+ isDivergent(): boolean;
2538
+ private advance;
2539
+ private isCaughtUp;
2540
+ private catchUp;
2541
+ private verdict;
2542
+ private recover;
2543
+ private whenOwnerUnreachable;
2544
+ private applyPage;
2545
+ private applyAtomically;
2546
+ private fetchSnapshot;
2547
+ private resnapshot;
2548
+ private overWriteBudget;
2549
+ private bootstrap;
2550
+ private isFreshEnough;
2551
+ private pull;
2552
+ private request;
2553
+ }
2554
+ declare const createReplicaLink: (host: ReplicaFollowerHost) => ShardReplica | undefined;
2555
+ declare const gateReplicaDispatch: (replica: ShardReplica, request: Request, functionPath: string) => Promise<Response | undefined>;
1895
2556
  declare const REPROJECTION_MIGRATION_PREFIX = "__lunora_reproject__";
1896
2557
  declare const reprojectionMigrationId: (table: string) => string;
1897
2558
  declare const reprojectableFields: (definition: TableDefinitionLike) => string[];
@@ -1913,8 +2574,7 @@ interface GuardableSchema {
1913
2574
  }>;
1914
2575
  }
1915
2576
  type TableOfId = (id: string, expectedTable?: string) => Promise<string | undefined> | string | undefined;
1916
- type TablesOfIds = (ids: ReadonlyArray<string>, expectedTable?: string) => Promise<ReadonlyMap<string, string>> | ReadonlyMap<string, string>;
1917
- declare const guardWriter: <W>(raw: W, schema: GuardableSchema, tableOfId: TableOfId, tablesOfIds?: TablesOfIds) => W;
2577
+ declare const guardWriter: <W>(raw: W, schema: GuardableSchema, tableOfId: TableOfId, relationEdges?: ReadonlyArray<RelationEdge>) => W;
1918
2578
  declare const SCHEMA_HISTORY_MAX_VERSIONS = 50;
1919
2579
  interface SchemaVersionRow {
1920
2580
  appliedAt: number;
@@ -1925,8 +2585,24 @@ interface SchemaVersionRow {
1925
2585
  declare const recordSchemaVersion: (sql: SqlExec, hash: string, snapshotJson: string, now?: number) => boolean;
1926
2586
  declare const readSchemaHistory: (sql: SqlExec) => SchemaVersionRow[];
1927
2587
  declare const readSchemaVersion: (sql: SqlExec, hash: string) => SchemaVersionRow | undefined;
2588
+ declare const readDeployInfo: (rawEnv: unknown) => DeployInfo;
1928
2589
  declare const isDevEnvironment: (rawEnv: unknown) => boolean;
1929
2590
  declare const buildSettings: (rawEnv: unknown) => SettingsResult;
2591
+ declare class ShapeDiffCache {
2592
+ private readonly keyScans;
2593
+ private readonly memberProbes;
2594
+ private run;
2595
+ private served;
2596
+ get probesRun(): number;
2597
+ get probesServed(): number;
2598
+ changedKeys(rangeKey: string, load: () => CdcChangeKey[]): ReadonlyArray<CdcChangeKey>;
2599
+ members(resolved: ResolvedShape, rangeKey: string, load: () => Map<string, Record<string, unknown>>): ReadonlyMap<string, Record<string, unknown>>;
2600
+ private getOrLoad;
2601
+ }
2602
+ declare const createShapeDiffCache: () => ShapeDiffCache;
2603
+ declare const globalShapeReadKey: (resolved: ResolvedShape, identity: SubscriptionIdentity) => string | undefined;
2604
+ type ReadShapeCdcKeys = (sql: SqlExec, table: string, sinceSeq: number, upTo: number) => CdcChangeKey[];
2605
+ declare const buildShapeDiff: (sql: SqlExec, resolved: ResolvedShape, sinceSeq: number, upTo: number, cache: ShapeDiffCache, readKeys?: ReadShapeCdcKeys) => ShapeRowOp[];
1930
2606
  interface ShardRunnerOptions {
1931
2607
  handlers?: {
1932
2608
  handleAlarm?: () => Promise<void>;
@@ -1942,7 +2618,7 @@ declare class ShardRunner {
1942
2618
  socketFor(raw: unknown): ShardSocketLike;
1943
2619
  sockets(tag?: string): SocketHandle[];
1944
2620
  background(work: Promise<unknown>): boolean;
1945
- runInTransaction<T>(work: () => Promise<T>): Promise<T>;
2621
+ runInTransaction<T>(work: () => Promise<T>, onCommitted?: () => void): Promise<T>;
1946
2622
  handleFetch(request: Request): Promise<Response>;
1947
2623
  handleAlarm(): Promise<void>;
1948
2624
  }
@@ -1968,6 +2644,11 @@ interface SqlDiagnostic {
1968
2644
  source: "gate" | "plan" | "syntax";
1969
2645
  }
1970
2646
  declare const lintReadonlySql: (sql: SqlExec, query: string) => SqlLintResult;
2647
+ declare const BIGINT_KEY_DIGITS = 39;
2648
+ declare const bigintSqlKey: (value: bigint) => string;
2649
+ declare const decodeBigintSqlKey: (raw: string) => bigint | undefined;
2650
+ declare const float64SqlKey: (value: number) => string;
2651
+ declare const decodeFloat64SqlKey: (raw: string) => number | undefined;
1971
2652
  declare const subscriptionListDeltas: (previousJson: string, nextResult: unknown, table: string, frames?: string[]) => MutationDelta[] | undefined;
1972
2653
  interface FrameSink {
1973
2654
  send: (data: string) => void;
@@ -1976,7 +2657,18 @@ interface DrainableSink {
1976
2657
  readonly bufferedAmount?: unknown;
1977
2658
  }
1978
2659
  declare const trySendFrame: (ws: FrameSink, frame: string) => boolean;
1979
- declare const sendDeltaFrames: (ws: FrameSink, subId: string, deltaFrames: ReadonlyArray<string>, cursorSuffix: string, lastMutationId?: number) => boolean;
2660
+ interface SubscriptionFrameInput {
2661
+ cursorSuffix: string;
2662
+ diffKey?: object;
2663
+ lastMutationId?: number;
2664
+ nextResult: unknown;
2665
+ pageDeltas?: boolean;
2666
+ previousJson?: string;
2667
+ snapshotJson: string;
2668
+ subId: string;
2669
+ table: string;
2670
+ }
2671
+ declare const subscriptionFrames: (input: SubscriptionFrameInput) => string[];
1980
2672
  declare const awaitWsDrain: (ws: DrainableSink) => Promise<void>;
1981
2673
  interface SubscriptionReadFootprint {
1982
2674
  ranges?: Map<string, KeyRange[]>;
@@ -2004,13 +2696,32 @@ declare const selectExpiredIds: (sql: SqlExec, spec: TtlSweepSpec, now: number,
2004
2696
  hasMore: boolean;
2005
2697
  ids: string[];
2006
2698
  };
2007
- type FieldRefSql = (field: string) => SQL;
2008
- type SerializeValue = (value: unknown) => unknown;
2009
- interface WhereSqlStrategy {
2010
- fieldRef: FieldRefSql;
2011
- likeContains?: (reference: SQL, term: SQL) => SQL;
2012
- relationExists?: (request: unknown) => SQL;
2013
- serialize: SerializeValue;
2699
+ declare const isTtlExpired: (sql: SqlExec, spec: TtlSweepSpec, id: string, now: number) => boolean;
2700
+ declare const nextTtlExpiry: (sql: SqlExec, spec: TtlSweepSpec) => number | undefined;
2701
+ declare const VECTOR_BACKFILL_MAX_PAGES = 20;
2702
+ interface VectorBackfillTarget {
2703
+ profile: string;
2704
+ table: string;
2705
+ }
2706
+ interface VectorBackfillProgress {
2707
+ done: boolean;
2708
+ error?: string;
2709
+ failed: number;
2710
+ failedIds: string[];
2711
+ pages: number;
2712
+ rows: number;
2014
2713
  }
2015
- declare const compileWhereSql: (where: WhereInput | undefined, strategy: WhereSqlStrategy) => SQL | undefined;
2016
- export { ADMIN_FUNCTIONS, ADMIN_FUNCTION_PREFIX, AGGREGATE_SQL_FUNCTION, AGG_COUNT, AGG_KEY, AGG_VALUE, AUDIT_LOG_TABLE, type AdvisorProcedure, type AdvisorProceduresResult, type AdvisoriesResult, type AdvisoryFinding, type AggregateIndexDefinitionLike, type AggregateOp, type AggregateOptions, type AggregateResult, type AggregateTally, type AppendAuditEntry, type ApplyOnDeleteOptions$1 as ApplyOnDeleteOptions, type AuditEntry, type AuditLogResult, type BroadcastDelta, CDC_LOG_TABLE, CDC_META_TABLE, CLIENT_WATERMARK_TABLE, type CacheEntry, type CapturedMailRow, type CdcChange, type ChangedKeys, type Clock, type ColumnMeta, type ColumnMetaLike, type CompanionSync, type CompanionSyncDeps, ConflictError, type ConflictKind, type CountArgs, CountRlsUnsupportedError, type CreateWorkflowInstanceResult, type CrossShardReadArgs, type CtxDbOptions, DATA_MIGRATION_STATE_TABLE, DEFAULT_FANOUT_TOPIC_LIMIT, DEFAULT_MAX_RELATION_KEYS, DEFAULT_MAX_RELAYS, DEFAULT_PROMOTION_THRESHOLDS, DEFAULT_TRANSACTION_LIMITS, DOC_COLUMN, type DataMigrationDocument, type DataMigrationLike, type DataMigrationTransform, type DatabaseWriterLike, type DependencyTracker, type DeployInfo, type ExportRow, type ExportShardAdminArgs, type ExportShardArgs, type ExternalSourceDiffResult, type ExternalSourceLike, FLAGS_FUNCTION_PREFIX, type FacetColumnOptions, type FacetColumnResult, type FacetValue, type FanoutMetricsResult, type FanoutPathCounters, type FanoutTopicStat, type FieldOperators, type FilterClause, type FilterOperator, type FlagEvaluation, type FlagsResult, type FunctionCallStat, type FunctionScanAttribution, type FunctionStatsResult, GEO_DEFAULT_PRECISION, GLOBAL_SHAPE_SNAPSHOT_TABLE, type GeoBoundingBox, type GeoFilterBuilderLike, type GeoIndexDefinitionLike, type GeoPoint, type GeoScoredDocument, type GroupByEntry, type GroupByOptions, type GuardableSchema$1 as GuardableSchema, IDEMPOTENCY_TABLE, type IdGenerator, type IdempotentRecord, type ImportError, type ImportShardAdminArgs, type ImportShardArgs, type ImportShardResult, type IncrementalMaterializeResult, type IndexDefinitionLike, type IndexKeyEntry, type IndexRangeBuilderLike, type KeyRange, type LifecycleDispatchInfo, type LifecycleEvent, MAIL_RETENTION, MAIL_TABLE, MAX_PAGE_SIZE, MAX_SQL_ROWS, type MaskColumnMetadata, type MaskPoliciesResult, type MaterializeResult, type MigrationDirection, type MigrationRunResult, type MigrationStatus, type MigrationStatusRow, type MutationDelta, type NestedWith, NotFoundError, NotUniqueError, type OnDeleteActionLike, type OrderByClause, type OrderByInput, type OrderKey, OwnerRelay, type OwnerRelayFrame, type PaginationOptions, type PitrBookmarkResult, type PitrRestoreArgs, type PitrRestoreResult, type PitrStorage, type PokeFrameMeta, type PromotionState, type PromotionThresholds, QUEUE_TABLE, type QueryArgs, type QueryPage, type QueueMessageOutcome, type QueueMessageRow, type QueueMetadata, type QueuesResult, RANK_TIEBREAK, RELATION_EXISTS_KEY, RELATION_FUNCTION_PREFIX, REPROJECTION_MIGRATION_PREFIX, RLS_UNWRAP_SYMBOL, type RankBeforeOptions, type RankBeforeResult, type RankDirection, type RankIndexDefinitionLike, type RankOptions, type RankPage, type RankPageComputation, type RankPageDeps, type RankPageOptions, type RankPageRow, type RankPageRowKey, type RankResult, type RankSortKeyLike, ReactiveCache, type ReactiveCacheOptions, type ReadFootprint, type ReadHook, type ReadTablePageOptions, type RecordMailInput, type RecordQueueMessageInput, type RelationDefinitionLike, type RelationExistsMarker, type RelayAttach, type RelayDetach, type RelayFrame, type RelayHost, RelayMember, type RelayShapePoke, type RelayShapeSeed, type RelayShapeSubscribe, type RenderedSql, type 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, buildReprojectionMigration, buildSeekBeforeWhere, buildSeekWhere, buildSettings, bumpCdcEpoch, clampPromotionThresholds, clearCapturedMail, clearQueueMessages, coerceAggregateNumber, compileWhereSql, computeRankPage, containsRelationPredicate, countLegacyRows, 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, relationHooks, relayCountFor, renderSql, reprojectableFields, reprojectionMigrationId, reprojectionTables, resolveRankPartition, resolveRelationPredicates, resolveWith, rowToDocument, runDataMigration, runDrizzle, runExternalSourceTick, runReadonlySql, runRowValidators, runShardMigrations, runSocketPool, runSql, runTriggers, selectExpiredIds, selectExportTables, selectIndexForAggregate, selectIndexForCount, selectIndexForGroupBy, selectMatchingIds, selectShapeMemberIds, selectShapeRows, sendDeltaFrames, serializeSqlValue, shapeRoutingKey, softDeleteScope, sortColumnName, stableStringify, stableWireKey, subscriptionListDeltas, summarizeFanoutTopics, summarizeSubscriptions, tableColumns, tableFromDepKey, throwingScheduler, trimCdcChanges, trimIdempotent, tryRowToDocument, trySendFrame, validateImportRow, writeGlobalShapeSnapshot, writeIdempotent, writeSearchBackfillState, writeTouchesMemo };
2714
+ type VectorPageSync = (table: string, rows: ReadonlyArray<{
2715
+ doc: Record<string, unknown>;
2716
+ id: string;
2717
+ }>) => Promise<ReadonlyArray<{
2718
+ error: unknown;
2719
+ id: string;
2720
+ }>>;
2721
+ type OrderedAfterWrites = <T, U>(read: () => T, work: (value: T) => Promise<U>) => Promise<U>;
2722
+ declare const backfillVectorIndexes: (sql: SqlExec, targets: ReadonlyArray<VectorBackfillTarget>, sync: VectorPageSync, options: {
2723
+ maxPages?: number;
2724
+ ordered: OrderedAfterWrites;
2725
+ restart?: boolean;
2726
+ }) => Promise<VectorBackfillProgress>;
2727
+ 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, CompanionMemo, 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 ImportConflictMode, type ImportError, type ImportShardAdminArgs, type ImportShardArgs, type ImportShardResult, type IncrementalMaterializeResult, type IndexDefinitionLike, type IndexKeyEntry, type IndexRangeBuilderLike, type KeyRange, type KeyedRelationWriteInfo, type LifecycleDispatchInfo, type LifecycleEvent, type LiveSocketControlCall, 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 NullPlacement, type OnDeleteActionLike, type OrderByClause, type OrderByInput, type OrderKey, type OrderKeyConstraints, OwnerRelay, type OwnerRelayFrame, type PaginationOptions, type PatchVerifier, type PatchWriteOptions, type PitrBookmarkResult, type PitrRestoreArgs, type PitrRestoreResult, type PitrStorage, type PokeFrameMeta, type PromotionState, type PromotionThresholds, QUEUE_TABLE, type QueryArgs, type QueryPage, type QueryPlan, 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, RELAY_SIGNATURE_HEADER, REPROJECTION_MIGRATION_PREFIX, RLS_UNWRAP_SYMBOL, type RangeOperandType, 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 RelationWriteInfo, type RelationWriteMap, type RelayAttach, type RelayDetach, type RelayFrame, type RelayHost, RelayMember, type RelayPokeDelivery, type RelayRoomEvent, type RelayRoomVerdict, 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 ThroughRelationWriteInfo, 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, applyInsertDefaults, applyOnDelete, applySelect, archiveCdcSegment, armRestore, assertFlatPredicate, assertNoExplicitUndefined, assertPatchAllowed, assertReadonly, assertShapeShardable, assertStorableRowId, 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, composeReadPredicate, 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, describeRelationWrites, 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, isTtlExpired, 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, nextTtlExpiry, normalizeCountArgument, normalizeIdStructurally, normalizeOrderKeys, normalizeSourceDocument, normalizeSourceValue, nullsFirstOf, nullsOrderSuffix, operatorFields, param, parkScheduleOutbox, parseExportShardArgs, parseImportShardArgs, patchDependsOnRow, 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, readPatchField, readQueueMessageById, readQueueMessages, readReactorState, readSchemaHistory, readSchemaVersion, readSearchBackfillState, readShapePokeCursor, readStreamChunks, readStreamRun, readTablePage, recordCapturedMail, recordChangedKeys, recordFanoutPass, recordGlobalPollPass, recordQueueMessages, recordScheduleOutbox, recordSchemaVersion, recordShapeProbePass, relationHooks, relayCountFor, renderSql, reprojectableFields, reprojectionMigrationId, reprojectionTables, resolvePatch, 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, siblingSecretOf, signSiblingBody, softDeleteScope, sortColumnName, sqliteInList, stripReservedPatchFields, stubByName, subscriptionFrames, subscriptionListDeltas, summarizeFanoutTopics, summarizeSubscriptions, tableColumns, tableFromDepKey, throwingScheduler, tiebreakDirectionFor, trimCdcChanges, trimIdempotent, trimScheduleOutbox, trimStreamRuns, tryRowToDocument, trySendFrame, unionAll, uniqueIndexFields, validateImportRow, verifySiblingBody, whereFilter, whereOfFilter, writeCdcArchivedThrough, writeGlobalShapeSnapshot, writeIdempotent, writeReactorState, writeSearchBackfillState, writeShapePokeCursor, writeShapePokeCursors, writeTouchesMemo };