@lunora/shard-engine 1.0.0-alpha.213 → 1.0.0-alpha.215

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 (86) hide show
  1. package/dist/conformance/index.mjs +1 -1
  2. package/dist/index.d.mts +4 -930
  3. package/dist/index.d.ts +4 -930
  4. package/dist/index.mjs +1 -1
  5. package/dist/packem_shared/{ADMIN_FUNCTIONS-olXwJWFQ.mjs → ADMIN_FUNCTIONS-voPpYb3p.mjs} +1 -1
  6. package/dist/packem_shared/AGG_COUNT-DzvM-UU5.mjs +1 -0
  7. package/dist/packem_shared/{AUDIT_LOG_TABLE-BFJ65SRS.mjs → AUDIT_LOG_TABLE-CGyZ2LNx.mjs} +1 -1
  8. package/dist/packem_shared/{CDC_LOG_TABLE-fCPCjSE4.mjs → CDC_LOG_TABLE-DchHJJ5G.mjs} +6 -6
  9. package/dist/packem_shared/{CLIENT_WATERMARK_TABLE-De7z_OHV.mjs → CLIENT_WATERMARK_TABLE-CMUFBMfO.mjs} +1 -1
  10. package/dist/packem_shared/{COMMIT_SEQ_FIELD-Da1DjGqo.mjs → COMMIT_SEQ_FIELD-lEe6aaMv.mjs} +1 -1
  11. package/dist/packem_shared/CompanionMemo-CYnosDCb.mjs +1 -0
  12. package/dist/packem_shared/{DATA_MIGRATION_STATE_TABLE-CPWZjliE.mjs → DATA_MIGRATION_STATE_TABLE-D5giMetp.mjs} +1 -1
  13. package/dist/packem_shared/{DEFAULT_MAX_RELATION_KEYS-xz76_vX6.mjs → DEFAULT_MAX_RELATION_KEYS-UrlFzZB3.mjs} +1 -1
  14. package/dist/packem_shared/{DEFAULT_MAX_RELAYS-BZLpaaq1.mjs → DEFAULT_MAX_RELAYS-BcyWWSdU.mjs} +1 -1
  15. package/dist/packem_shared/DOC_COLUMN-BNhw3l1X.mjs +1 -0
  16. package/dist/packem_shared/{DurableStreamRunner-MMlV5qKQ.mjs → DurableStreamRunner-BikgXQLq.mjs} +1 -1
  17. package/dist/packem_shared/{GLOBAL_SHAPE_SNAPSHOT_TABLE-Bb6-aZuH.mjs → GLOBAL_SHAPE_SNAPSHOT_TABLE-Cdq1nHtu.mjs} +1 -1
  18. package/dist/packem_shared/{IDEMPOTENCY_TABLE-BVosXEq_.mjs → IDEMPOTENCY_TABLE-DyKgfnGa.mjs} +1 -1
  19. package/dist/packem_shared/IMPORT_MANIFEST_TTL_MS-g0o4UIT_.mjs +1 -0
  20. package/dist/packem_shared/{MAIL_RETENTION-DMolrLYt.mjs → MAIL_RETENTION-C0LZvTbG.mjs} +3 -3
  21. package/dist/packem_shared/NotUniqueError-C_IDBwvG.mjs +1 -0
  22. package/dist/packem_shared/{QUEUE_TABLE-C-goXtGd.mjs → QUEUE_TABLE-CWUNphDm.mjs} +3 -3
  23. package/dist/packem_shared/RANK_TIEBREAK-BknRdgt8.mjs +1 -0
  24. package/dist/packem_shared/{REACTOR_STATE_TABLE-D2Mn204f.mjs → REACTOR_STATE_TABLE-B2x69RYJ.mjs} +1 -1
  25. package/dist/packem_shared/{SCHEDULE_OUTBOX_TABLE-iyyiSjsO.mjs → SCHEDULE_OUTBOX_TABLE-BPs0yEDb.mjs} +1 -1
  26. package/dist/packem_shared/{SCHEMA_HISTORY_MAX_VERSIONS-CEwFjj-O.mjs → SCHEMA_HISTORY_MAX_VERSIONS-Cgw1Tg1r.mjs} +1 -1
  27. package/dist/packem_shared/{SEARCH_STATE_TABLE-D7w8mRsm.mjs → SEARCH_STATE_TABLE-DJywWtgJ.mjs} +1 -1
  28. package/dist/packem_shared/{SHAPE_POKE_CURSOR_TABLE-BGvY3sFI.mjs → SHAPE_POKE_CURSOR_TABLE-CKl7syse.mjs} +1 -1
  29. package/dist/packem_shared/VECTOR_BACKFILL_MAX_PAGES-CxiEhH8V.mjs +1 -0
  30. package/dist/packem_shared/WORKERD_SQLITE_LIMITS-C9dUlw3o.mjs +1 -0
  31. package/dist/packem_shared/{adminTokenExists-CQ0qedmu.mjs → adminTokenExists-CDwEWaFF.mjs} +1 -1
  32. package/dist/packem_shared/{appendStreamChunk-BZYgGE9Y.mjs → appendStreamChunk-DIxOE9q_.mjs} +1 -1
  33. package/dist/packem_shared/{applyInsertDefaults-CaVH3fJ7.mjs → applyInsertDefaults-Bt6LYmPD.mjs} +1 -1
  34. package/dist/packem_shared/{archiveCdcSegment-Cr8oGLfB.mjs → archiveCdcSegment-B3UKVQ9U.mjs} +1 -1
  35. package/dist/packem_shared/backfillAggregateIndexes-BkCo8Dpf.mjs +1 -0
  36. package/dist/packem_shared/buildReprojectionMigration-CCr-Pv9T.mjs +1 -0
  37. package/dist/packem_shared/{buildShapeDiff-DrXTkXKH.mjs → buildShapeDiff-CrLtKTuR.mjs} +1 -1
  38. package/dist/packem_shared/{clearMemoryTables-aMRERF0w.mjs → clearMemoryTables-CIfrwTj8.mjs} +1 -1
  39. package/dist/packem_shared/compileWhereSql-CEy6QwJx.mjs +1 -0
  40. package/dist/packem_shared/computeRankPage-De_JKnna.mjs +1 -0
  41. package/dist/packem_shared/createCompanionSync-D5cqtwqR.mjs +1 -0
  42. package/dist/packem_shared/{createReplicaLink-BapaAUfm.mjs → createReplicaLink-auEtD_6G.mjs} +1 -1
  43. package/dist/packem_shared/{ctx-db-relay-shapes-DBobAek2.mjs → ctx-db-relay-shapes-V1HnPPPX.mjs} +1 -1
  44. package/dist/packem_shared/{ctx-db-search-state-CPKPy8N6.mjs → ctx-db-search-state-Bv_NxB1g.mjs} +1 -1
  45. package/dist/packem_shared/{defineEngineContractSuite-BGiRhp-9.mjs → defineEngineContractSuite-IBU5qtmg.mjs} +1 -1
  46. package/dist/packem_shared/do-sql-DT8JBpG8.mjs +1 -0
  47. package/dist/packem_shared/{exportShardRows-BEzRTBwD.mjs → exportShardRows-BxhBKedl.mjs} +1 -1
  48. package/dist/packem_shared/fts-companion-Cfz-hJum.mjs +1 -0
  49. package/dist/packem_shared/ftsCompanionDdl-NFICsmqs.mjs +1 -0
  50. package/dist/packem_shared/ftsRowidMapName-CGnFBC6P.mjs +1 -0
  51. package/dist/packem_shared/{isSoftDeleted-By7iuPdW.mjs → isSoftDeleted-Dc3VHgrR.mjs} +1 -1
  52. package/dist/packem_shared/isTtlExpired-ktYeluAa.mjs +1 -0
  53. package/dist/packem_shared/{materializeExternalRows-gZqs4Rsj.mjs → materializeExternalRows-LugivbOG.mjs} +1 -1
  54. package/dist/packem_shared/param-Y0zw_1Cv.mjs +1 -0
  55. package/dist/packem_shared/rankPivotConditionSql-CUX4Vuhv.mjs +1 -0
  56. package/dist/packem_shared/runDrizzle-DAtZbzBn.mjs +1 -0
  57. package/dist/packem_shared/runShardMigrations-DeOECCjz.mjs +5 -0
  58. package/dist/packem_shared/runSql-BBRXi81G.mjs +1 -0
  59. package/dist/packem_shared/selectShapeMembers-BP30uxpp.mjs +1 -0
  60. package/dist/packem_shared/sql-engine.d-CMrMcDfK.d.mts +888 -0
  61. package/dist/packem_shared/sql-engine.d-CMrMcDfK.d.ts +888 -0
  62. package/dist/packem_shared/where-sql-AVR5KloI.mjs +1 -0
  63. package/dist/sql.d.mts +47 -0
  64. package/dist/sql.d.ts +47 -0
  65. package/dist/sql.mjs +1 -0
  66. package/package.json +5 -1
  67. package/dist/packem_shared/AGG_COUNT-BaMXGlVQ.mjs +0 -1
  68. package/dist/packem_shared/CompanionMemo-jmlDbPlr.mjs +0 -1
  69. package/dist/packem_shared/IMPORT_MANIFEST_TTL_MS-BrNT0vUO.mjs +0 -1
  70. package/dist/packem_shared/NotUniqueError-Cv97uGOS.mjs +0 -1
  71. package/dist/packem_shared/RANK_TIEBREAK-D3ye2GsL.mjs +0 -1
  72. package/dist/packem_shared/VECTOR_BACKFILL_MAX_PAGES-DbNHRd5m.mjs +0 -1
  73. package/dist/packem_shared/WORKERD_SQLITE_LIMITS-B_4w7tzY.mjs +0 -1
  74. package/dist/packem_shared/backfillAggregateIndexes-BfJ2FeLv.mjs +0 -1
  75. package/dist/packem_shared/buildReprojectionMigration-wSas3lLT.mjs +0 -1
  76. package/dist/packem_shared/compileWhereSql--dIcrS0b.mjs +0 -1
  77. package/dist/packem_shared/computeRankPage-B6umzbg4.mjs +0 -1
  78. package/dist/packem_shared/createCompanionSync-DmciS_rv.mjs +0 -1
  79. package/dist/packem_shared/do-sql-Cf2rnuLV.mjs +0 -1
  80. package/dist/packem_shared/fts-companion-CE3EmIjk.mjs +0 -1
  81. package/dist/packem_shared/ftsCompanionDdl-B0bFCy6d.mjs +0 -1
  82. package/dist/packem_shared/isTtlExpired-Bymg2-13.mjs +0 -1
  83. package/dist/packem_shared/runDrizzle-RC09zZrh.mjs +0 -1
  84. package/dist/packem_shared/runShardMigrations-4_ene2xR.mjs +0 -5
  85. package/dist/packem_shared/selectShapeMembers-Ce6pOHKe.mjs +0 -1
  86. package/dist/packem_shared/where-sql-Cb_dSAMj.mjs +0 -1
@@ -0,0 +1,888 @@
1
+ import { LunoraError } from '@lunora/errors';
2
+ type RangeOperandType = "boolean" | "number" | "string";
3
+ interface KeyRange {
4
+ hi: string;
5
+ index: string;
6
+ lo: string;
7
+ table: string;
8
+ }
9
+ interface IndexKeyEntry {
10
+ index: string;
11
+ key: string;
12
+ }
13
+ interface StagedCondition {
14
+ comparator: string;
15
+ field: string;
16
+ value: unknown;
17
+ }
18
+ declare const buildIndexRange: (table: string, index: string, fields: ReadonlyArray<string>, conditions: ReadonlyArray<StagedCondition>, serialize: (value: unknown) => unknown) => KeyRange | undefined;
19
+ declare const indexKeysForRow: (indexes: ReadonlyArray<{
20
+ fields: ReadonlyArray<string>;
21
+ name: string;
22
+ }>, row: Record<string, unknown>, serialize: (value: unknown) => unknown) => IndexKeyEntry[];
23
+ declare const keysTouchRanges: (ranges: ReadonlyArray<KeyRange> | undefined, keys: ReadonlyArray<IndexKeyEntry> | undefined) => boolean;
24
+ interface RelationWriteBase {
25
+ readonly colocated: boolean;
26
+ readonly refusal?: string;
27
+ readonly table: string;
28
+ }
29
+ interface KeyedRelationWriteInfo extends RelationWriteBase {
30
+ readonly field: string;
31
+ readonly kind: "many" | "one";
32
+ readonly nullable: boolean;
33
+ readonly references: string;
34
+ readonly refusalNow?: never;
35
+ readonly through?: never;
36
+ }
37
+ interface ThroughRelationWriteInfo extends RelationWriteBase {
38
+ readonly kind: "many";
39
+ readonly pairIsOnlyUnique: boolean;
40
+ readonly refusalNow: () => string | undefined;
41
+ readonly through: {
42
+ readonly from: string;
43
+ readonly table: string;
44
+ readonly to: string;
45
+ };
46
+ }
47
+ type RelationWriteInfo = KeyedRelationWriteInfo | ThroughRelationWriteInfo;
48
+ type RelationWriteMap = Readonly<Record<string, Readonly<Record<string, RelationWriteInfo>>>>;
49
+ declare const describeRelationWrites: (schema: SchemaLike, inTransaction?: () => boolean) => RelationWriteMap;
50
+ type SystemTableName = "_scheduled_functions" | "_storage";
51
+ interface ScheduledFunctionDoc {
52
+ args: Record<string, unknown>;
53
+ attempts?: number;
54
+ completedAt?: number;
55
+ enqueuedAt: number;
56
+ error?: string;
57
+ functionPath?: string;
58
+ id: string;
59
+ pool?: string;
60
+ scheduledFor: number;
61
+ shardKey?: string;
62
+ state?: "canceled" | "failed" | "pending" | "running" | "succeeded";
63
+ workflow?: string;
64
+ }
65
+ interface StorageMetadata {
66
+ contentType?: string;
67
+ customMetadata?: Record<string, string>;
68
+ key: string;
69
+ sha256?: string;
70
+ size: number;
71
+ uploaded?: number;
72
+ }
73
+ interface SystemDocMap {
74
+ _scheduled_functions: ScheduledFunctionDoc;
75
+ _storage: StorageMetadata;
76
+ }
77
+ type SystemDoc<T extends SystemTableName> = SystemDocMap[T];
78
+ interface SystemQuery<T extends SystemTableName> {
79
+ collect: () => Promise<SystemDoc<T>[]>;
80
+ }
81
+ interface SystemDatabaseReader {
82
+ get: <T extends SystemTableName>(table: T, id: string) => Promise<SystemDoc<T> | null>;
83
+ query: <T extends SystemTableName>(table: T) => SystemQuery<T>;
84
+ }
85
+ interface SystemReaderSchedulerLike {
86
+ get: (id: string) => Promise<Record<string, unknown> | null>;
87
+ list: () => Promise<ReadonlyArray<Record<string, unknown>>>;
88
+ }
89
+ interface SystemReaderStorageLike {
90
+ getMetadata: (key: string) => Promise<StorageMetadata | null>;
91
+ list: (prefix?: string, options?: Record<string, unknown>) => Promise<{
92
+ objects: ReadonlyArray<Record<string, unknown>>;
93
+ }>;
94
+ }
95
+ interface SystemReaderOptions {
96
+ scheduler?: SystemReaderSchedulerLike;
97
+ storage?: SystemReaderStorageLike;
98
+ }
99
+ declare const createSystemReader: (options?: SystemReaderOptions) => SystemDatabaseReader;
100
+ interface FieldOperators {
101
+ contains?: string;
102
+ eq?: unknown;
103
+ gt?: unknown;
104
+ gte?: unknown;
105
+ in?: unknown[];
106
+ isNull?: boolean;
107
+ lt?: unknown;
108
+ lte?: unknown;
109
+ ne?: unknown;
110
+ notIn?: unknown[];
111
+ }
112
+ interface WhereInput {
113
+ [field: string]: unknown;
114
+ AND?: WhereInput[];
115
+ NOT?: WhereInput;
116
+ OR?: WhereInput[];
117
+ }
118
+ declare const RELATION_EXISTS_KEY = "__relationExists";
119
+ interface SubscriptionQuery {
120
+ args?: Record<string, unknown>;
121
+ functionPath?: string;
122
+ sinceClaims?: string;
123
+ sinceEpoch?: string;
124
+ sinceSeq?: number;
125
+ table?: string;
126
+ }
127
+ interface ShapeSubscriptionQuery {
128
+ args?: Record<string, unknown>;
129
+ name: string;
130
+ sinceEpoch?: string;
131
+ sinceSeq?: number;
132
+ }
133
+ interface SubscriptionEnvelope {
134
+ caps?: string[];
135
+ clientId?: string;
136
+ context?: Record<string, unknown>;
137
+ data?: unknown;
138
+ generation?: number;
139
+ id: string;
140
+ query?: SubscriptionQuery;
141
+ shape?: {
142
+ args?: Record<string, unknown>;
143
+ name: string;
144
+ };
145
+ sinceCheckpoint?: number;
146
+ sinceChunk?: number;
147
+ sinceClaims?: string;
148
+ sinceEpoch?: string;
149
+ token?: string;
150
+ topic?: string;
151
+ type: "ack" | "connect" | "shape_subscribe" | "shape_unsubscribe" | "stream" | "subscribe" | "unsubscribe" | "whisper" | "whisper_subscribe" | "whisper_unsubscribe";
152
+ }
153
+ interface RpcRequest {
154
+ args?: Record<string, unknown>;
155
+ functionPath: string;
156
+ }
157
+ interface SocketAttachment {
158
+ admin?: boolean;
159
+ adminBinding?: string;
160
+ authenticated?: boolean;
161
+ broadcastSubs?: Record<string, string>;
162
+ clientId?: string;
163
+ connected?: boolean;
164
+ connectionId?: string;
165
+ context?: Record<string, unknown>;
166
+ deliveryPermits?: Record<string, {
167
+ epoch: number;
168
+ scope: string;
169
+ }>;
170
+ expiresAt?: number;
171
+ identity?: Record<string, unknown>;
172
+ ip?: string;
173
+ liveGrants?: Record<string, string>;
174
+ pageDeltas?: boolean;
175
+ pendingSince?: number;
176
+ refreshBatch?: boolean;
177
+ revalidateAt?: number;
178
+ shapes?: Record<string, ShapeSubscriptionQuery>;
179
+ socketFunction?: string;
180
+ socketPath?: string;
181
+ subs: Record<string, SubscriptionQuery>;
182
+ subTables?: Record<string, string[]>;
183
+ userId?: string;
184
+ whispers?: string[];
185
+ }
186
+ interface ResolvedShape {
187
+ columns?: ReadonlyArray<string>;
188
+ effectiveWhere?: WhereInput;
189
+ global?: boolean;
190
+ table: string;
191
+ }
192
+ interface SubscriptionIdentity {
193
+ identity?: Record<string, unknown>;
194
+ ip?: string;
195
+ userId?: string;
196
+ }
197
+ interface ShardSocketLike {
198
+ readonly bufferedAmount?: number;
199
+ close?: (code?: number, reason?: string) => void;
200
+ deserializeAttachment?: () => unknown;
201
+ send: (data: string) => void;
202
+ serializeAttachment?: (value: unknown) => void;
203
+ }
204
+ type AggregateOp = "avg" | "count" | "max" | "min" | "sum";
205
+ interface AggregateIndexDefinitionLike {
206
+ readonly by?: ReadonlyArray<string>;
207
+ readonly field?: string;
208
+ readonly name: string;
209
+ readonly on: string;
210
+ readonly op: AggregateOp;
211
+ readonly where?: Record<string, unknown>;
212
+ }
213
+ interface GeoIndexDefinitionLike {
214
+ readonly field: string;
215
+ readonly name: string;
216
+ readonly precision?: number;
217
+ }
218
+ interface IndexDefinitionLike {
219
+ readonly fields: ReadonlyArray<string>;
220
+ readonly name: string;
221
+ readonly unique?: boolean;
222
+ }
223
+ interface RankIndexDefinitionLike {
224
+ readonly name: string;
225
+ readonly on: string;
226
+ readonly partitionBy?: ReadonlyArray<string>;
227
+ readonly sortBy: ReadonlyArray<RankSortKeyLike>;
228
+ readonly where?: Record<string, unknown>;
229
+ }
230
+ interface SearchIndexDefinitionLike {
231
+ readonly field: string;
232
+ readonly filterFields?: ReadonlyArray<string>;
233
+ readonly language?: string;
234
+ readonly name: string;
235
+ readonly staged?: boolean;
236
+ readonly strategy?: string;
237
+ }
238
+ interface ServerDefaultContextLike {
239
+ readonly auth: {
240
+ readonly identity: Record<string, unknown> | null;
241
+ readonly userId: null | string;
242
+ };
243
+ }
244
+ interface ColumnMetaLike {
245
+ readonly defaultFn?: () => unknown;
246
+ readonly defaultValue?: unknown;
247
+ readonly notNull?: boolean;
248
+ readonly onUpdateFn?: () => unknown;
249
+ readonly serverDefault?: (context: ServerDefaultContextLike) => unknown;
250
+ readonly unique?: boolean;
251
+ }
252
+ interface ValidatorLike {
253
+ readonly _meta?: {
254
+ readonly column?: ColumnMetaLike;
255
+ readonly inner?: ValidatorLike;
256
+ readonly members?: ReadonlyArray<ValidatorLike>;
257
+ readonly shape?: Readonly<Record<string, ValidatorLike>>;
258
+ readonly tableName?: string;
259
+ readonly value?: unknown;
260
+ };
261
+ readonly kind?: string;
262
+ readonly parse?: (value: unknown) => unknown;
263
+ }
264
+ type TriggerTimingLike = "after" | "before";
265
+ type TriggerOpLike = "delete" | "insert" | "update";
266
+ interface SchedulableWorkflowReferenceLike {
267
+ readonly className?: string;
268
+ readonly isLunoraWorkflow: true;
269
+ readonly name?: string;
270
+ }
271
+ interface SchedulerLike {
272
+ runAfter: (delayMs: number, target: SchedulableWorkflowReferenceLike | string, args?: Record<string, unknown>) => Promise<string>;
273
+ runAt: (timestampMs: number, target: SchedulableWorkflowReferenceLike | string, args?: Record<string, unknown>) => Promise<string>;
274
+ }
275
+ interface TriggerEventLike {
276
+ doc?: Record<string, unknown>;
277
+ id: string;
278
+ op: TriggerOpLike;
279
+ previous?: Record<string, unknown>;
280
+ table: string;
281
+ }
282
+ interface TriggerContextLike {
283
+ db: DatabaseWriterLike;
284
+ scheduler: SchedulerLike;
285
+ }
286
+ interface TriggerDefinitionLike {
287
+ readonly handler: (context: TriggerContextLike, event: TriggerEventLike) => Promise<void> | void;
288
+ readonly op: TriggerOpLike;
289
+ readonly timing: TriggerTimingLike;
290
+ }
291
+ interface GuardableSchema {
292
+ readonly rlsMode?: "required";
293
+ readonly tables: Record<string, {
294
+ readonly isPublic?: boolean;
295
+ }>;
296
+ }
297
+ interface SchemaLike {
298
+ readonly rlsMode?: "required";
299
+ readonly tables: Record<string, TableDefinitionLike>;
300
+ }
301
+ type PatchVerifier = (previous: Record<string, unknown>, next: Record<string, unknown>) => boolean;
302
+ interface PatchWriteOptions {
303
+ verify?: PatchVerifier;
304
+ }
305
+ interface TableDefinitionLike {
306
+ readonly aggregateIndexes?: ReadonlyArray<AggregateIndexDefinitionLike>;
307
+ readonly commitOrderedMode?: boolean;
308
+ readonly dropStalePatchesMode?: boolean;
309
+ readonly geoIndexes?: ReadonlyArray<GeoIndexDefinitionLike>;
310
+ readonly indexes: ReadonlyArray<IndexDefinitionLike>;
311
+ readonly isPublic?: boolean;
312
+ readonly memoryMode?: boolean;
313
+ readonly rankIndexes?: ReadonlyArray<RankIndexDefinitionLike>;
314
+ readonly relationMap?: Record<string, RelationDefinitionLike>;
315
+ readonly searchIndexes?: ReadonlyArray<SearchIndexDefinitionLike>;
316
+ readonly shape: Record<string, ValidatorLike>;
317
+ readonly shardMode?: {
318
+ field?: string;
319
+ kind: "global" | "root" | "shardBy";
320
+ };
321
+ readonly softDeleteMode?: {
322
+ field: string;
323
+ };
324
+ readonly triggerMap?: Record<string, TriggerDefinitionLike>;
325
+ readonly ttlPolicy?: {
326
+ after?: number;
327
+ field: string;
328
+ };
329
+ }
330
+ interface KeyedRelationDefinitionLike {
331
+ readonly field: string;
332
+ readonly kind: "many" | "one";
333
+ readonly onDelete?: OnDeleteActionLike;
334
+ readonly references: string;
335
+ readonly table: string;
336
+ readonly through?: never;
337
+ }
338
+ interface RelationThroughLike {
339
+ readonly from: string;
340
+ readonly table: string;
341
+ readonly to: string;
342
+ }
343
+ interface ThroughRelationDefinitionLike {
344
+ readonly kind: "many";
345
+ readonly table: string;
346
+ readonly through: RelationThroughLike;
347
+ }
348
+ type RelationDefinitionLike = KeyedRelationDefinitionLike | ThroughRelationDefinitionLike;
349
+ type OnDeleteActionLike = "cascade" | "restrict" | "set null";
350
+ interface NestedWith {
351
+ limit?: number;
352
+ orderBy?: OrderByInput[];
353
+ select?: ReadonlyArray<string>;
354
+ where?: WhereInput;
355
+ with?: WithInput;
356
+ }
357
+ interface WithInput {
358
+ [relationName: string]: NestedWith | Record<string, true> | boolean | undefined;
359
+ _count?: Record<string, true>;
360
+ }
361
+ interface FanOutBudget {
362
+ remaining: number;
363
+ }
364
+ interface ResolveWithOptions {
365
+ fanOutBudget?: FanOutBudget;
366
+ fetcher: (tableName: string, args: QueryArgs) => Promise<QueryPage>;
367
+ groupedCounter: (tableName: string, whereField: string, values: unknown[], policyWhere?: WhereInput, relationBaseWhere?: (table: string) => undefined | WhereInput) => Promise<Map<unknown, number>>;
368
+ parents: Record<string, unknown>[];
369
+ relationBaseWhere?: (table: string) => undefined | WhereInput;
370
+ relationMask?: RelationMask;
371
+ schema: {
372
+ readonly tables: Record<string, TableDefinitionLike>;
373
+ };
374
+ tableName: string;
375
+ with: WithInput;
376
+ }
377
+ interface ResolveWithResult {
378
+ parent: Record<string, unknown>;
379
+ relationName: string;
380
+ rows: Record<string, unknown>[];
381
+ }
382
+ type SortDirection = "asc" | "desc";
383
+ type NullPlacement = "first" | "last";
384
+ type OrderByInput = Record<string, SortDirection | {
385
+ nulls: NullPlacement;
386
+ sort: SortDirection;
387
+ }>;
388
+ interface QueryArgs {
389
+ baseWhere?: WhereInput;
390
+ consistency?: "primary";
391
+ cursor?: null | string;
392
+ endCursor?: null | string;
393
+ includeDeleted?: boolean;
394
+ limit?: number;
395
+ omitContinueCursor?: boolean;
396
+ orderBy?: OrderByInput[];
397
+ relationBaseWhere?: (table: string) => undefined | WhereInput;
398
+ relationMask?: RelationMask;
399
+ restrictsCounts?: boolean;
400
+ select?: ReadonlyArray<string>;
401
+ where?: WhereInput;
402
+ with?: WithInput;
403
+ }
404
+ interface CrossShardReadArgs {
405
+ orderBy?: OrderByInput[];
406
+ relationPolicies?: Record<string, WhereInput>;
407
+ where?: WhereInput;
408
+ with?: WithInput;
409
+ }
410
+ interface CrossShardCountArgs {
411
+ relationPolicies?: Record<string, WhereInput>;
412
+ where?: WhereInput;
413
+ }
414
+ type RelationMask = (table: string, rows: Record<string, unknown>[]) => Record<string, unknown>[];
415
+ interface QueryPlan {
416
+ params: unknown[];
417
+ plan: string[];
418
+ sql: string;
419
+ }
420
+ interface QueryPage {
421
+ continueCursor: null | string;
422
+ isDone: boolean;
423
+ page: Record<string, unknown>[];
424
+ splitCursor?: null | string;
425
+ splitRequired?: boolean;
426
+ }
427
+ interface RelationEdge {
428
+ readonly array: boolean;
429
+ readonly column: string;
430
+ readonly name: string;
431
+ readonly sourceTable: string;
432
+ readonly targetTable: string;
433
+ }
434
+ interface RelatedStartReference {
435
+ id: string;
436
+ table: string;
437
+ }
438
+ type RelatedStart = (Record<string, unknown> & {
439
+ _id: string;
440
+ }) | RelatedStartReference;
441
+ type RelatedDirection = "both" | "in" | "out";
442
+ interface RelatedOptions {
443
+ cursor?: null | string;
444
+ depth?: number;
445
+ direction?: RelatedDirection;
446
+ edges?: ReadonlyArray<string>;
447
+ limit?: number;
448
+ relationBaseWhere?: (table: string) => undefined | WhereInput;
449
+ relationMask?: RelationMask;
450
+ }
451
+ interface RelatedNode {
452
+ depth: number;
453
+ document: Record<string, unknown>;
454
+ path: ReadonlyArray<string>;
455
+ pathIds: ReadonlyArray<string>;
456
+ score: number;
457
+ table: string;
458
+ }
459
+ interface RelatedPage {
460
+ continueCursor: null | string;
461
+ isDone: boolean;
462
+ nodes: RelatedNode[];
463
+ }
464
+ interface OrderKey {
465
+ direction: SortDirection;
466
+ field: string;
467
+ nullable: boolean;
468
+ nulls?: NullPlacement;
469
+ }
470
+ interface RestrictableQueryOptions {
471
+ baseWhere?: WhereInput;
472
+ relationBaseWhere?: (table: string) => undefined | WhereInput;
473
+ restrictsCounts?: boolean;
474
+ where?: WhereInput;
475
+ }
476
+ interface AggregateOptions extends RestrictableQueryOptions {
477
+ field?: string;
478
+ op: AggregateOp;
479
+ }
480
+ type AggregateResult = null | number;
481
+ interface GroupByOptions extends RestrictableQueryOptions {
482
+ agg?: {
483
+ field?: string;
484
+ op: AggregateOp;
485
+ };
486
+ by: ReadonlyArray<string>;
487
+ }
488
+ interface GroupByEntry {
489
+ key: Record<string, unknown>;
490
+ value: AggregateResult;
491
+ }
492
+ type RankDirection = "asc" | "desc";
493
+ interface RankSortKeyLike {
494
+ readonly direction: RankDirection;
495
+ readonly field: string;
496
+ }
497
+ interface RankResult {
498
+ position: number;
499
+ total: number;
500
+ }
501
+ interface RankOptions extends RestrictableQueryOptions {
502
+ row: Record<string, unknown> | string;
503
+ }
504
+ interface RankBeforeOptions {
505
+ partitionKey: string;
506
+ restrictsCounts?: boolean;
507
+ rowId: string;
508
+ sortValues: ReadonlyArray<unknown>;
509
+ }
510
+ interface RankBeforeResult {
511
+ before: number;
512
+ total: number;
513
+ }
514
+ interface RankPageOptions extends RestrictableQueryOptions {
515
+ after?: RankPageRowKey;
516
+ cursor?: null | string;
517
+ partitionKey?: string;
518
+ take?: number;
519
+ }
520
+ interface RankPage {
521
+ continueCursor: null | string;
522
+ isDone: boolean;
523
+ page: Record<string, unknown>[];
524
+ }
525
+ interface RankPageRowKey {
526
+ partitionKey: string;
527
+ rowId: string;
528
+ sortValues: ReadonlyArray<unknown>;
529
+ }
530
+ interface RankPageRow {
531
+ doc: Record<string, unknown>;
532
+ key: RankPageRowKey;
533
+ }
534
+ interface ShardRankPageResult {
535
+ directions: ReadonlyArray<RankDirection>;
536
+ hasMore: boolean;
537
+ rows: ReadonlyArray<RankPageRow>;
538
+ }
539
+ interface PaginationOptions {
540
+ cursor?: null | string;
541
+ endCursor?: null | string;
542
+ numItems: number;
543
+ }
544
+ interface SearchFilterBuilderLike {
545
+ eq: (field: string, value: unknown) => SearchFilterBuilderLike;
546
+ search: (field: string, query: string) => SearchFilterBuilderLike;
547
+ }
548
+ interface GeoFilterBuilderLike {
549
+ near: (point: {
550
+ lat: number;
551
+ lng: number;
552
+ }, radiusMeters: number) => GeoFilterBuilderLike;
553
+ within: (box: {
554
+ ne: {
555
+ lat: number;
556
+ lng: number;
557
+ };
558
+ sw: {
559
+ lat: number;
560
+ lng: number;
561
+ };
562
+ }) => GeoFilterBuilderLike;
563
+ }
564
+ type ScoredDocument = GeoScoredDocument | SearchScoredDocument;
565
+ interface GeoScoredDocument {
566
+ distanceMeters: null | number;
567
+ document: Record<string, unknown>;
568
+ score?: never;
569
+ }
570
+ interface SearchScoredDocument {
571
+ distanceMeters?: never;
572
+ document: Record<string, unknown>;
573
+ score: number;
574
+ }
575
+ interface TableReaderLike {
576
+ [Symbol.asyncIterator]: () => AsyncIterator<Record<string, unknown>>;
577
+ collect: () => Promise<Record<string, unknown>[]>;
578
+ collectWithScores: () => Promise<ScoredDocument[]>;
579
+ filter: (predicate: (document: Record<string, unknown>) => boolean) => TableReaderLike;
580
+ first: () => Promise<Record<string, unknown> | null>;
581
+ order: (direction: "asc" | "desc") => TableReaderLike;
582
+ paginate: (options: PaginationOptions) => Promise<QueryPage>;
583
+ take: (limit: number) => Promise<Record<string, unknown>[]>;
584
+ unique: () => Promise<Record<string, unknown> | null>;
585
+ withGeoIndex: (indexName: string, build: (q: GeoFilterBuilderLike) => GeoFilterBuilderLike) => TableReaderLike;
586
+ withIndex: (indexName: string, range?: (q: IndexRangeBuilderLike) => IndexRangeBuilderLike) => TableReaderLike;
587
+ withSearchIndex: (indexName: string, search: (q: SearchFilterBuilderLike) => SearchFilterBuilderLike) => TableReaderLike;
588
+ }
589
+ interface IndexRangeBuilderLike {
590
+ eq: (field: string, value: unknown) => IndexRangeBuilderLike;
591
+ gt: (field: string, value: unknown) => IndexRangeBuilderLike;
592
+ gte: (field: string, value: unknown) => IndexRangeBuilderLike;
593
+ lt: (field: string, value: unknown) => IndexRangeBuilderLike;
594
+ lte: (field: string, value: unknown) => IndexRangeBuilderLike;
595
+ }
596
+ type BroadcastDelta = (delta: MutationDelta) => void;
597
+ type ReadHook = (table: string, idOrScan?: string, exact?: boolean) => void;
598
+ interface LifecycleEvent {
599
+ connectionId: string;
600
+ context?: Record<string, unknown>;
601
+ shardKey: string;
602
+ userId: string | null;
603
+ }
604
+ interface LifecycleDispatchInfo extends SubscriptionIdentity {
605
+ event: LifecycleEvent;
606
+ }
607
+ interface MutationDelta {
608
+ indexKeys?: ReadonlyArray<IndexKeyEntry>;
609
+ key: string;
610
+ op: "insert" | "update" | "delete";
611
+ row?: Record<string, unknown>;
612
+ table: string;
613
+ }
614
+ interface DatabaseWriterLike {
615
+ aggregate: (tableName: string, options: AggregateOptions) => Promise<AggregateResult>;
616
+ asId?: (tableName: string, id: string) => string;
617
+ assertPatchAllowed?: (table: string, id: string) => Promise<void>;
618
+ cdcChangedTables?: (sinceSeq: number, options?: {
619
+ cursorOnly?: boolean;
620
+ }) => Promise<{
621
+ cursor: number;
622
+ floor?: number;
623
+ tables: string[];
624
+ } | undefined>;
625
+ count: (tableName: string, where?: RestrictableQueryOptions | WhereInput) => Promise<number>;
626
+ delete: (table: string, id: string, options?: {
627
+ hard?: boolean;
628
+ skipOnDelete?: boolean;
629
+ }) => Promise<void>;
630
+ deleteAll?: (tableName: string, options?: {
631
+ chunkSize?: number;
632
+ hard?: boolean;
633
+ }) => Promise<{
634
+ deleted: number;
635
+ }>;
636
+ deleteMany?: (table: string, ids: ReadonlyArray<string>, options?: {
637
+ limit?: number;
638
+ }) => Promise<{
639
+ deleted: number;
640
+ }>;
641
+ deleteRereadTables?: ReadonlySet<string>;
642
+ deleteWhere?: (tableName: string, where: WhereInput, options?: {
643
+ limit?: number;
644
+ }) => Promise<{
645
+ deleted: number;
646
+ }>;
647
+ explain: (tableName: string, args?: QueryArgs) => Promise<QueryPlan>;
648
+ findFirst: (tableName: string, args?: QueryArgs) => Promise<Record<string, unknown> | null>;
649
+ findFirstOrThrow: (tableName: string, args?: QueryArgs) => Promise<Record<string, unknown>>;
650
+ findMany: (tableName: string, args?: QueryArgs) => Promise<QueryPage>;
651
+ get: (table: string, id: string) => Promise<Record<string, unknown> | null>;
652
+ groupBy: (tableName: string, options: GroupByOptions) => Promise<ReadonlyArray<GroupByEntry>>;
653
+ insert: (tableName: string, document: Record<string, unknown>, options?: {
654
+ allowExplicitId?: boolean;
655
+ clientId?: string;
656
+ }) => Promise<string>;
657
+ insertMany?: (tableName: string, documents: ReadonlyArray<Record<string, unknown>>, options?: {
658
+ allowExplicitId?: boolean;
659
+ limit?: number;
660
+ onStored?: (ids: ReadonlyArray<string>, startIndex: number) => void;
661
+ skipDuplicates?: boolean;
662
+ }) => Promise<(string | null)[]>;
663
+ insertManyUnsafe?: (tableName: string, documents: ReadonlyArray<Record<string, unknown>>, options?: {
664
+ allowExplicitId?: boolean;
665
+ limit?: number;
666
+ }) => Promise<string[]>;
667
+ inTransaction?: () => boolean;
668
+ lookupById?: (id: string, expectedTable?: string) => Promise<null | {
669
+ row: Record<string, unknown>;
670
+ tableName: string;
671
+ }>;
672
+ normalizeId: (tableName: string, id: string) => null | string;
673
+ patch: (table: string, id: string, patch: Record<string, unknown>, options?: PatchWriteOptions) => Promise<void>;
674
+ patchIf?: (tableName: string, id: string, args: {
675
+ patch: Record<string, unknown>;
676
+ verify?: PatchVerifier;
677
+ where: WhereInput;
678
+ }) => Promise<{
679
+ applied: boolean;
680
+ doc: Record<string, unknown> | null;
681
+ }>;
682
+ patchMany?: (table: string, patches: ReadonlyArray<{
683
+ id: string;
684
+ patch: Record<string, unknown>;
685
+ }>, options?: {
686
+ limit?: number;
687
+ }) => Promise<{
688
+ patched: number;
689
+ }>;
690
+ patchWhere?: (tableName: string, args: {
691
+ patch: Record<string, unknown>;
692
+ where: WhereInput;
693
+ }, options?: {
694
+ limit?: number;
695
+ }) => Promise<{
696
+ patched: number;
697
+ }>;
698
+ query: (tableName: string) => TableReaderLike;
699
+ rank: (tableName: string, indexName: string, options: RankOptions) => Promise<null | RankResult>;
700
+ rankBefore?: (tableName: string, indexName: string, options: RankBeforeOptions) => Promise<RankBeforeResult>;
701
+ rankPage: (tableName: string, indexName: string, options?: RankPageOptions) => Promise<RankPage>;
702
+ rankPageRows?: (tableName: string, indexName: string, options?: RankPageOptions) => Promise<ShardRankPageResult>;
703
+ related?: (start: RelatedStart, options?: RelatedOptions) => Promise<RelatedPage>;
704
+ relationEdges?: ReadonlyArray<RelationEdge>;
705
+ relationWrites?: RelationWriteMap;
706
+ replace: (table: string, id: string, document: Record<string, unknown>, options?: {
707
+ allowExplicitId?: boolean;
708
+ }) => Promise<void>;
709
+ restore?: (table: string, id: string) => Promise<void>;
710
+ softDeleteFields?: ReadonlyMap<string, string>;
711
+ system?: SystemDatabaseReader;
712
+ wipeShard?: (options?: {
713
+ chunkSize?: number;
714
+ exclude?: ReadonlyArray<string>;
715
+ tables?: ReadonlyArray<string>;
716
+ }) => Promise<{
717
+ deleted: number;
718
+ tables: Record<string, number>;
719
+ }>;
720
+ }
721
+ declare const clearCompanionSignatures: (sql: SqlExec) => void;
722
+ declare class CompanionMemo {
723
+ readonly verified: Set<string>;
724
+ invalidate(): void;
725
+ }
726
+ interface CacheEntry {
727
+ bytes: number;
728
+ deps: Set<string>;
729
+ lastUsed: number;
730
+ ranges: ReadonlyArray<KeyRange>;
731
+ result: unknown;
732
+ subscribers: Set<string>;
733
+ }
734
+ interface ReactiveCacheOptions {
735
+ maxBytes?: number;
736
+ maxEntries?: number;
737
+ now?: () => number;
738
+ }
739
+ declare class ReactiveCache {
740
+ private readonly entries;
741
+ private readonly tableIndex;
742
+ private readonly rangeIndex;
743
+ private totalBytes;
744
+ private hits;
745
+ private misses;
746
+ private evictions;
747
+ private readonly maxEntries;
748
+ private readonly maxBytes;
749
+ private readonly now;
750
+ private monotonic;
751
+ private generation;
752
+ constructor(options?: ReactiveCacheOptions);
753
+ run<R>(key: string, deps: Set<string>, run: () => Promise<R>, ranges?: () => ReadonlyArray<KeyRange>): Promise<R>;
754
+ invalidate(table: string, id: string, indexKeys?: ReadonlyArray<IndexKeyEntry>): string[];
755
+ invalidateTable(table: string): string[];
756
+ subscribe(key: string, subscriberId: string): void;
757
+ unsubscribe(key: string, subscriberId: string): void;
758
+ size(): {
759
+ bytes: number;
760
+ entries: number;
761
+ };
762
+ clear(): void;
763
+ subscribers(key: string): string[];
764
+ stats(): {
765
+ bytes: number;
766
+ entries: number;
767
+ evictions: number;
768
+ hits: number;
769
+ misses: number;
770
+ };
771
+ private dropRangeDeps;
772
+ private collectAndDrop;
773
+ private dropKeys;
774
+ private dropEntry;
775
+ private evict;
776
+ }
777
+ declare const reactiveCacheKey: (functionPath: string, args: Record<string, unknown>, identity: null | string) => string;
778
+ interface TransactionLimits {
779
+ maxReadBytes: number;
780
+ maxReadRows: number;
781
+ maxWrittenBytes: number;
782
+ maxWrittenRows: number;
783
+ }
784
+ interface TransactionHeadroom {
785
+ readBytes: number;
786
+ readRows: number;
787
+ remainingReadBytes: number;
788
+ remainingReadRows: number;
789
+ remainingWrittenBytes: number;
790
+ remainingWrittenRows: number;
791
+ writtenBytes: number;
792
+ writtenRows: number;
793
+ }
794
+ type TransactionLimitKind = "readBytes" | "readRows" | "writtenBytes" | "writtenRows";
795
+ interface TransactionLimitWarning {
796
+ kind: TransactionLimitKind;
797
+ limit: number;
798
+ used: number;
799
+ }
800
+ declare const DEFAULT_TRANSACTION_LIMITS: TransactionLimits;
801
+ declare class TransactionHeadroomTracker {
802
+ private readBytes;
803
+ private readRows;
804
+ private writtenRows;
805
+ private writtenBytes;
806
+ private readonly limits;
807
+ private readonly onNearLimit;
808
+ private readonly warned;
809
+ private readonly chargedDocuments;
810
+ constructor(limits?: Partial<TransactionLimits>, onNearLimit?: (warning: TransactionLimitWarning) => void);
811
+ recordRead(count: number): void;
812
+ recordReadBytes(bytes: number): void;
813
+ recordDocumentRead(key: string, bytes: number): void;
814
+ beginReadWindow(): void;
815
+ recordWrite(row: unknown): void;
816
+ headroom(): TransactionHeadroom;
817
+ private check;
818
+ }
819
+ interface SqlExec {
820
+ exec: <Row = Record<string, unknown>>(sql: string, ...params: unknown[]) => SqlCursor<Row>;
821
+ }
822
+ interface SqlCursor<Row> extends Iterable<Row> {
823
+ readonly columnNames?: string[];
824
+ one: () => Row;
825
+ raw?: () => IterableIterator<unknown[]>;
826
+ toArray: () => Row[];
827
+ }
828
+ type IndexUseHook = (table: string, indexName: string, kind: "geo" | "index" | "rank" | "search") => void;
829
+ type Clock = () => number;
830
+ type IdGenerator = () => string;
831
+ declare const assertValidClientId: (clientId: string) => void;
832
+ declare const assertStorableRowId: (id: string) => void;
833
+ interface WriteEvent {
834
+ doc?: Record<string, unknown>;
835
+ id: string;
836
+ op: "delete" | "insert" | "update";
837
+ table: string;
838
+ }
839
+ type WriteHook = (event: WriteEvent) => Promise<void> | void;
840
+ interface CtxDbOptions {
841
+ auth?: ServerDefaultContextLike["auth"];
842
+ baselineSeq?: () => number | undefined;
843
+ broadcast?: BroadcastDelta;
844
+ cache?: ReactiveCache;
845
+ cdc?: boolean;
846
+ clock?: Clock;
847
+ companionMemo?: CompanionMemo;
848
+ enforceRls?: boolean;
849
+ globalDb?: DatabaseWriterLike;
850
+ headroom?: TransactionHeadroomTracker;
851
+ idGenerator?: IdGenerator;
852
+ inTransaction?: () => boolean;
853
+ maxRelationKeys?: number;
854
+ onIndexUse?: IndexUseHook;
855
+ onRead?: ReadHook;
856
+ onReadRange?: (range: KeyRange) => void;
857
+ onStalePatchDropped?: (event: {
858
+ fields: string[];
859
+ id: string;
860
+ table: string;
861
+ }) => void;
862
+ onWrite?: WriteHook;
863
+ relationExistsPushDown?: "always" | "auto" | "never";
864
+ scheduler?: SchedulerLike;
865
+ schema: SchemaLike;
866
+ sql: SqlExec;
867
+ storage?: SystemReaderStorageLike;
868
+ }
869
+ type CountArgs = RestrictableQueryOptions;
870
+ declare class NotUniqueError extends LunoraError {
871
+ constructor(message?: string);
872
+ }
873
+ declare const normalizeIdStructurally: (schema: SchemaLike, tableName: string, id: string) => null | string;
874
+ declare const assertNoExplicitUndefined: (op: "patch" | "patchIf" | "replace", document: Record<string, unknown>) => void;
875
+ declare const stripReservedPatchFields: (patch: Record<string, unknown>) => Record<string, unknown>;
876
+ declare const createShardCtxDb: (options: CtxDbOptions) => DatabaseWriterLike;
877
+ declare const WORKERD_SQLITE_LIMITS: {
878
+ readonly boundParams: 100;
879
+ readonly compoundSelect: 5;
880
+ readonly likePattern: 50;
881
+ readonly sqlTextLength: 100000;
882
+ };
883
+ type SqlEngine = "mysql" | "postgres" | "sqlite";
884
+ interface RenderedSql {
885
+ params: unknown[];
886
+ sql: string;
887
+ }
888
+ export { CrossShardCountArgs as $, AggregateIndexDefinitionLike as A, SocketAttachment as B, ColumnMetaLike as C, DatabaseWriterLike as D, ResolvedShape as E, ShapeSubscriptionQuery as F, ShardSocketLike as G, SubscriptionIdentity as H, TransactionLimits as I, IndexKeyEntry as J, KeyRange as K, AggregateOptions as L, MutationDelta as M, AggregateResult as N, OrderKey as O, PatchWriteOptions as P, QueryArgs as Q, RangeOperandType as R, SqlExec as S, TriggerContextLike as T, BroadcastDelta as U, ValidatorLike as V, WhereInput as W, CacheEntry as X, Clock as Y, CompanionMemo as Z, CountArgs as _, SqlCursor as a, TransactionLimitKind as a$, CrossShardReadArgs as a0, CtxDbOptions as a1, DEFAULT_TRANSACTION_LIMITS as a2, FanOutBudget as a3, FieldOperators as a4, GeoFilterBuilderLike as a5, GeoIndexDefinitionLike as a6, GeoScoredDocument as a7, GroupByEntry as a8, GroupByOptions as a9, RelatedNode as aA, RelatedStartReference as aB, RelationDefinitionLike as aC, RelationWriteInfo as aD, RelationWriteMap as aE, ResolveWithResult as aF, RpcRequest as aG, SchedulableWorkflowReferenceLike as aH, ScheduledFunctionDoc as aI, ScoredDocument as aJ, SearchFilterBuilderLike as aK, SearchScoredDocument as aL, ShardRankPageResult as aM, StorageMetadata as aN, SubscriptionEnvelope as aO, SubscriptionQuery as aP, SystemDatabaseReader as aQ, SystemDoc as aR, SystemQuery as aS, SystemReaderOptions as aT, SystemReaderSchedulerLike as aU, SystemReaderStorageLike as aV, SystemTableName as aW, TableReaderLike as aX, ThroughRelationWriteInfo as aY, TransactionHeadroom as aZ, TransactionHeadroomTracker as a_, GuardableSchema as aa, IdGenerator as ab, IndexDefinitionLike as ac, IndexRangeBuilderLike as ad, KeyedRelationWriteInfo as ae, LifecycleDispatchInfo as af, LifecycleEvent as ag, NestedWith as ah, NotUniqueError as ai, NullPlacement as aj, OnDeleteActionLike as ak, PaginationOptions as al, PatchVerifier as am, QueryPlan as an, RELATION_EXISTS_KEY as ao, RankBeforeOptions as ap, RankBeforeResult as aq, RankOptions as ar, RankPage as as, RankPageRow as at, RankResult as au, RankSortKeyLike as av, ReactiveCache as aw, ReactiveCacheOptions as ax, ReadHook as ay, RelatedDirection as az, SqlEngine as b, TransactionLimitWarning as b0, TriggerDefinitionLike as b1, WORKERD_SQLITE_LIMITS as b2, WithInput as b3, WriteEvent as b4, WriteHook as b5, assertNoExplicitUndefined as b6, assertStorableRowId as b7, assertValidClientId as b8, buildIndexRange as b9, clearCompanionSignatures as ba, createShardCtxDb as bb, createSystemReader as bc, describeRelationWrites as bd, indexKeysForRow as be, keysTouchRanges as bf, normalizeIdStructurally as bg, reactiveCacheKey as bh, stripReservedPatchFields as bi, RenderedSql as c, SchemaLike as d, TriggerEventLike as e, TriggerOpLike as f, TriggerTimingLike as g, SearchIndexDefinitionLike as h, RestrictableQueryOptions as i, SchedulerLike as j, AggregateOp as k, RankIndexDefinitionLike as l, TableDefinitionLike as m, RankDirection as n, RankPageRowKey as o, RankPageOptions as p, SortDirection as q, OrderByInput as r, RelationEdge as s, RelatedStart as t, RelatedOptions as u, RelatedPage as v, KeyedRelationDefinitionLike as w, QueryPage as x, ServerDefaultContextLike as y, ResolveWithOptions as z };