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

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-DlNAfu1a.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-C_pEZ8_E.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-DN1kL76Y.d.mts +886 -0
  61. package/dist/packem_shared/sql-engine.d-DN1kL76Y.d.ts +886 -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
package/dist/index.d.ts CHANGED
@@ -1,723 +1,8 @@
1
+ import { D as DatabaseWriterLike, d as SchemaLike, T as TriggerContextLike, e as TriggerEventLike, f as TriggerOpLike, g as TriggerTimingLike, S as SqlExec, h as SearchIndexDefinitionLike, W as WhereInput, i as RestrictableQueryOptions, j as SchedulerLike, A as AggregateIndexDefinitionLike, k as AggregateOp, l as RankIndexDefinitionLike, M as MutationDelta, m as TableDefinitionLike, n as RankDirection, o as RankPageRowKey, p as RankPageOptions, C as ColumnMetaLike, q as SortDirection, P as PatchWriteOptions, O as OrderKey, r as OrderByInput, V as ValidatorLike, K as KeyRange, s as RelationEdge, t as RelatedStart, u as RelatedOptions, v as RelatedPage, w as KeyedRelationDefinitionLike, Q as QueryArgs, x as QueryPage, y as ServerDefaultContextLike, z as ResolveWithOptions, B as SocketAttachment, E as ResolvedShape, F as ShapeSubscriptionQuery, G as ShardSocketLike, H as SubscriptionIdentity, I as TransactionLimits, a as SqlCursor, J as IndexKeyEntry } from "./packem_shared/sql-engine.d-DN1kL76Y.js";
2
+ export { type L as AggregateOptions, type N as AggregateResult, type U as BroadcastDelta, type X as CacheEntry, type Y as Clock, Z as CompanionMemo, type _ as CountArgs, type $ as CrossShardCountArgs, type a0 as CrossShardReadArgs, type a1 as CtxDbOptions, a2 as DEFAULT_TRANSACTION_LIMITS, type a3 as FanOutBudget, type a4 as FieldOperators, type a5 as GeoFilterBuilderLike, type a6 as GeoIndexDefinitionLike, type a7 as GeoScoredDocument, type a8 as GroupByEntry, type a9 as GroupByOptions, type aa as GuardableSchema, type ab as IdGenerator, type ac as IndexDefinitionLike, type ad as IndexRangeBuilderLike, type ae as KeyedRelationWriteInfo, type af as LifecycleDispatchInfo, type ag as LifecycleEvent, type ah as NestedWith, ai as NotUniqueError, type aj as NullPlacement, type ak as OnDeleteActionLike, type al as PaginationOptions, type am as PatchVerifier, type an as QueryPlan, ao as RELATION_EXISTS_KEY, type R as RangeOperandType, type ap as RankBeforeOptions, type aq as RankBeforeResult, type ar as RankOptions, type as as RankPage, type at as RankPageRow, type au as RankResult, type av as RankSortKeyLike, aw as ReactiveCache, type ax as ReactiveCacheOptions, type ay as ReadHook, type az as RelatedDirection, type aA as RelatedNode, type aB as RelatedStartReference, type aC as RelationDefinitionLike, type aD as RelationWriteInfo, type aE as RelationWriteMap, type c as RenderedSql, type aF as ResolveWithResult, type aG as RpcRequest, type aH as SchedulableWorkflowReferenceLike, type aI as ScheduledFunctionDoc, type aJ as ScoredDocument, type aK as SearchFilterBuilderLike, type aL as SearchScoredDocument, type aM as ShardRankPageResult, type b as SqlEngine, type aN as StorageMetadata, type aO as SubscriptionEnvelope, type aP as SubscriptionQuery, type aQ as SystemDatabaseReader, type aR as SystemDoc, type aS as SystemQuery, type aT as SystemReaderOptions, type aU as SystemReaderSchedulerLike, type aV as SystemReaderStorageLike, type aW as SystemTableName, type aX as TableReaderLike, type aY as ThroughRelationWriteInfo, type aZ as TransactionHeadroom, a_ as TransactionHeadroomTracker, type a$ as TransactionLimitKind, type b0 as TransactionLimitWarning, type b1 as TriggerDefinitionLike, b2 as WORKERD_SQLITE_LIMITS, type b3 as WithInput, type b4 as WriteEvent, type b5 as WriteHook, b6 as assertNoExplicitUndefined, b7 as assertStorableRowId, b8 as assertValidClientId, b9 as buildIndexRange, ba as clearCompanionSignatures, bb as createShardCtxDb, bc as createSystemReader, bd as describeRelationWrites, be as indexKeysForRow, bf as keysTouchRanges, bg as normalizeIdStructurally, bh as reactiveCacheKey, bi as stripReservedPatchFields } from "./packem_shared/sql-engine.d-DN1kL76Y.js";
1
3
  import { LunoraError } from '@lunora/errors';
2
4
  import { R2BucketLike, ShardHost, SocketHost, SocketHandle } from '@lunora/platform';
3
- import { SQL, Name } from 'drizzle-orm';
4
5
  export { stableStringify, stableWireKey } from '@lunora/wire';
5
- interface KeyRange {
6
- hi: string;
7
- index: string;
8
- lo: string;
9
- table: string;
10
- }
11
- interface IndexKeyEntry {
12
- index: string;
13
- key: string;
14
- }
15
- interface StagedCondition {
16
- comparator: string;
17
- field: string;
18
- value: unknown;
19
- }
20
- declare const buildIndexRange: (table: string, index: string, fields: ReadonlyArray<string>, conditions: ReadonlyArray<StagedCondition>, serialize: (value: unknown) => unknown) => KeyRange | undefined;
21
- declare const indexKeysForRow: (indexes: ReadonlyArray<{
22
- fields: ReadonlyArray<string>;
23
- name: string;
24
- }>, row: Record<string, unknown>, serialize: (value: unknown) => unknown) => IndexKeyEntry[];
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;
52
- type SystemTableName = "_scheduled_functions" | "_storage";
53
- interface ScheduledFunctionDoc {
54
- args: Record<string, unknown>;
55
- attempts?: number;
56
- completedAt?: number;
57
- enqueuedAt: number;
58
- error?: string;
59
- functionPath?: string;
60
- id: string;
61
- pool?: string;
62
- scheduledFor: number;
63
- shardKey?: string;
64
- state?: "canceled" | "failed" | "pending" | "running" | "succeeded";
65
- workflow?: string;
66
- }
67
- interface StorageMetadata {
68
- contentType?: string;
69
- customMetadata?: Record<string, string>;
70
- key: string;
71
- sha256?: string;
72
- size: number;
73
- uploaded?: number;
74
- }
75
- interface SystemDocMap {
76
- _scheduled_functions: ScheduledFunctionDoc;
77
- _storage: StorageMetadata;
78
- }
79
- type SystemDoc<T extends SystemTableName> = SystemDocMap[T];
80
- interface SystemQuery<T extends SystemTableName> {
81
- collect: () => Promise<SystemDoc<T>[]>;
82
- }
83
- interface SystemDatabaseReader {
84
- get: <T extends SystemTableName>(table: T, id: string) => Promise<SystemDoc<T> | null>;
85
- query: <T extends SystemTableName>(table: T) => SystemQuery<T>;
86
- }
87
- interface SystemReaderSchedulerLike {
88
- get: (id: string) => Promise<Record<string, unknown> | null>;
89
- list: () => Promise<ReadonlyArray<Record<string, unknown>>>;
90
- }
91
- interface SystemReaderStorageLike {
92
- getMetadata: (key: string) => Promise<StorageMetadata | null>;
93
- list: (prefix?: string, options?: Record<string, unknown>) => Promise<{
94
- objects: ReadonlyArray<Record<string, unknown>>;
95
- }>;
96
- }
97
- interface SystemReaderOptions {
98
- scheduler?: SystemReaderSchedulerLike;
99
- storage?: SystemReaderStorageLike;
100
- }
101
- declare const createSystemReader: (options?: SystemReaderOptions) => SystemDatabaseReader;
102
- interface FieldOperators {
103
- contains?: string;
104
- eq?: unknown;
105
- gt?: unknown;
106
- gte?: unknown;
107
- in?: unknown[];
108
- isNull?: boolean;
109
- lt?: unknown;
110
- lte?: unknown;
111
- ne?: unknown;
112
- notIn?: unknown[];
113
- }
114
- interface WhereInput {
115
- [field: string]: unknown;
116
- AND?: WhereInput[];
117
- NOT?: WhereInput;
118
- OR?: WhereInput[];
119
- }
120
- declare const RELATION_EXISTS_KEY = "__relationExists";
121
- interface SubscriptionQuery {
122
- args?: Record<string, unknown>;
123
- functionPath?: string;
124
- sinceClaims?: string;
125
- sinceEpoch?: string;
126
- sinceSeq?: number;
127
- table?: string;
128
- }
129
- interface ShapeSubscriptionQuery {
130
- args?: Record<string, unknown>;
131
- name: string;
132
- sinceEpoch?: string;
133
- sinceSeq?: number;
134
- }
135
- interface SubscriptionEnvelope {
136
- caps?: string[];
137
- clientId?: string;
138
- context?: Record<string, unknown>;
139
- data?: unknown;
140
- generation?: number;
141
- id: string;
142
- query?: SubscriptionQuery;
143
- shape?: {
144
- args?: Record<string, unknown>;
145
- name: string;
146
- };
147
- sinceCheckpoint?: number;
148
- sinceChunk?: number;
149
- sinceClaims?: string;
150
- sinceEpoch?: string;
151
- token?: string;
152
- topic?: string;
153
- type: "ack" | "connect" | "shape_subscribe" | "shape_unsubscribe" | "stream" | "subscribe" | "unsubscribe" | "whisper" | "whisper_subscribe" | "whisper_unsubscribe";
154
- }
155
- interface RpcRequest {
156
- args?: Record<string, unknown>;
157
- functionPath: string;
158
- }
159
- interface SocketAttachment {
160
- admin?: boolean;
161
- adminBinding?: string;
162
- authenticated?: boolean;
163
- broadcastSubs?: Record<string, string>;
164
- clientId?: string;
165
- connected?: boolean;
166
- connectionId?: string;
167
- context?: Record<string, unknown>;
168
- deliveryPermits?: Record<string, {
169
- epoch: number;
170
- scope: string;
171
- }>;
172
- expiresAt?: number;
173
- identity?: Record<string, unknown>;
174
- ip?: string;
175
- liveGrants?: Record<string, string>;
176
- pageDeltas?: boolean;
177
- pendingSince?: number;
178
- refreshBatch?: boolean;
179
- revalidateAt?: number;
180
- shapes?: Record<string, ShapeSubscriptionQuery>;
181
- socketFunction?: string;
182
- socketPath?: string;
183
- subs: Record<string, SubscriptionQuery>;
184
- subTables?: Record<string, string[]>;
185
- userId?: string;
186
- whispers?: string[];
187
- }
188
- interface ResolvedShape {
189
- columns?: ReadonlyArray<string>;
190
- effectiveWhere?: WhereInput;
191
- global?: boolean;
192
- table: string;
193
- }
194
- interface SubscriptionIdentity {
195
- identity?: Record<string, unknown>;
196
- ip?: string;
197
- userId?: string;
198
- }
199
- interface ShardSocketLike {
200
- readonly bufferedAmount?: number;
201
- close?: (code?: number, reason?: string) => void;
202
- deserializeAttachment?: () => unknown;
203
- send: (data: string) => void;
204
- serializeAttachment?: (value: unknown) => void;
205
- }
206
- type AggregateOp = "avg" | "count" | "max" | "min" | "sum";
207
- interface AggregateIndexDefinitionLike {
208
- readonly by?: ReadonlyArray<string>;
209
- readonly field?: string;
210
- readonly name: string;
211
- readonly on: string;
212
- readonly op: AggregateOp;
213
- readonly where?: Record<string, unknown>;
214
- }
215
- interface GeoIndexDefinitionLike {
216
- readonly field: string;
217
- readonly name: string;
218
- readonly precision?: number;
219
- }
220
- interface IndexDefinitionLike {
221
- readonly fields: ReadonlyArray<string>;
222
- readonly name: string;
223
- readonly unique?: boolean;
224
- }
225
- interface RankIndexDefinitionLike {
226
- readonly name: string;
227
- readonly on: string;
228
- readonly partitionBy?: ReadonlyArray<string>;
229
- readonly sortBy: ReadonlyArray<RankSortKeyLike>;
230
- readonly where?: Record<string, unknown>;
231
- }
232
- interface SearchIndexDefinitionLike {
233
- readonly field: string;
234
- readonly filterFields?: ReadonlyArray<string>;
235
- readonly language?: string;
236
- readonly name: string;
237
- readonly staged?: boolean;
238
- readonly strategy?: string;
239
- }
240
- interface ServerDefaultContextLike {
241
- readonly auth: {
242
- readonly identity: Record<string, unknown> | null;
243
- readonly userId: null | string;
244
- };
245
- }
246
- interface ColumnMetaLike {
247
- readonly defaultFn?: () => unknown;
248
- readonly defaultValue?: unknown;
249
- readonly notNull?: boolean;
250
- readonly onUpdateFn?: () => unknown;
251
- readonly serverDefault?: (context: ServerDefaultContextLike) => unknown;
252
- readonly unique?: boolean;
253
- }
254
- interface ValidatorLike {
255
- readonly _meta?: {
256
- readonly column?: ColumnMetaLike;
257
- readonly inner?: ValidatorLike;
258
- readonly members?: ReadonlyArray<ValidatorLike>;
259
- readonly shape?: Readonly<Record<string, ValidatorLike>>;
260
- readonly tableName?: string;
261
- readonly value?: unknown;
262
- };
263
- readonly kind?: string;
264
- readonly parse?: (value: unknown) => unknown;
265
- }
266
- type TriggerTimingLike = "after" | "before";
267
- type TriggerOpLike = "delete" | "insert" | "update";
268
- interface SchedulableWorkflowReferenceLike {
269
- readonly className?: string;
270
- readonly isLunoraWorkflow: true;
271
- readonly name?: string;
272
- }
273
- interface SchedulerLike {
274
- runAfter: (delayMs: number, target: SchedulableWorkflowReferenceLike | string, args?: Record<string, unknown>) => Promise<string>;
275
- runAt: (timestampMs: number, target: SchedulableWorkflowReferenceLike | string, args?: Record<string, unknown>) => Promise<string>;
276
- }
277
- interface TriggerEventLike {
278
- doc?: Record<string, unknown>;
279
- id: string;
280
- op: TriggerOpLike;
281
- previous?: Record<string, unknown>;
282
- table: string;
283
- }
284
- interface TriggerContextLike {
285
- db: DatabaseWriterLike;
286
- scheduler: SchedulerLike;
287
- }
288
- interface TriggerDefinitionLike {
289
- readonly handler: (context: TriggerContextLike, event: TriggerEventLike) => Promise<void> | void;
290
- readonly op: TriggerOpLike;
291
- readonly timing: TriggerTimingLike;
292
- }
293
- interface GuardableSchema$1 {
294
- readonly rlsMode?: "required";
295
- readonly tables: Record<string, {
296
- readonly isPublic?: boolean;
297
- }>;
298
- }
299
- interface SchemaLike {
300
- readonly rlsMode?: "required";
301
- readonly tables: Record<string, TableDefinitionLike>;
302
- }
303
- type PatchVerifier = (previous: Record<string, unknown>, next: Record<string, unknown>) => boolean;
304
- interface PatchWriteOptions {
305
- verify?: PatchVerifier;
306
- }
307
- interface TableDefinitionLike {
308
- readonly aggregateIndexes?: ReadonlyArray<AggregateIndexDefinitionLike>;
309
- readonly commitOrderedMode?: boolean;
310
- readonly dropStalePatchesMode?: boolean;
311
- readonly geoIndexes?: ReadonlyArray<GeoIndexDefinitionLike>;
312
- readonly indexes: ReadonlyArray<IndexDefinitionLike>;
313
- readonly isPublic?: boolean;
314
- readonly memoryMode?: boolean;
315
- readonly rankIndexes?: ReadonlyArray<RankIndexDefinitionLike>;
316
- readonly relationMap?: Record<string, RelationDefinitionLike>;
317
- readonly searchIndexes?: ReadonlyArray<SearchIndexDefinitionLike>;
318
- readonly shape: Record<string, ValidatorLike>;
319
- readonly shardMode?: {
320
- field?: string;
321
- kind: "global" | "root" | "shardBy";
322
- };
323
- readonly softDeleteMode?: {
324
- field: string;
325
- };
326
- readonly triggerMap?: Record<string, TriggerDefinitionLike>;
327
- readonly ttlPolicy?: {
328
- after?: number;
329
- field: string;
330
- };
331
- }
332
- interface KeyedRelationDefinitionLike {
333
- readonly field: string;
334
- readonly kind: "many" | "one";
335
- readonly onDelete?: OnDeleteActionLike;
336
- readonly references: string;
337
- readonly table: string;
338
- readonly through?: never;
339
- }
340
- interface RelationThroughLike {
341
- readonly from: string;
342
- readonly table: string;
343
- readonly to: string;
344
- }
345
- interface ThroughRelationDefinitionLike {
346
- readonly kind: "many";
347
- readonly table: string;
348
- readonly through: RelationThroughLike;
349
- }
350
- type RelationDefinitionLike = KeyedRelationDefinitionLike | ThroughRelationDefinitionLike;
351
- type OnDeleteActionLike = "cascade" | "restrict" | "set null";
352
- interface NestedWith {
353
- limit?: number;
354
- orderBy?: OrderByInput[];
355
- select?: ReadonlyArray<string>;
356
- where?: WhereInput;
357
- with?: WithInput;
358
- }
359
- interface WithInput {
360
- [relationName: string]: NestedWith | Record<string, true> | boolean | undefined;
361
- _count?: Record<string, true>;
362
- }
363
- interface FanOutBudget {
364
- remaining: number;
365
- }
366
- interface ResolveWithOptions {
367
- fanOutBudget?: FanOutBudget;
368
- fetcher: (tableName: string, args: QueryArgs) => Promise<QueryPage>;
369
- groupedCounter: (tableName: string, whereField: string, values: unknown[], policyWhere?: WhereInput, relationBaseWhere?: (table: string) => undefined | WhereInput) => Promise<Map<unknown, number>>;
370
- parents: Record<string, unknown>[];
371
- relationBaseWhere?: (table: string) => undefined | WhereInput;
372
- relationMask?: RelationMask;
373
- schema: {
374
- readonly tables: Record<string, TableDefinitionLike>;
375
- };
376
- tableName: string;
377
- with: WithInput;
378
- }
379
- interface ResolveWithResult {
380
- parent: Record<string, unknown>;
381
- relationName: string;
382
- rows: Record<string, unknown>[];
383
- }
384
- type SortDirection = "asc" | "desc";
385
- type NullPlacement = "first" | "last";
386
- type OrderByInput = Record<string, SortDirection | {
387
- nulls: NullPlacement;
388
- sort: SortDirection;
389
- }>;
390
- interface QueryArgs {
391
- baseWhere?: WhereInput;
392
- consistency?: "primary";
393
- cursor?: null | string;
394
- endCursor?: null | string;
395
- includeDeleted?: boolean;
396
- limit?: number;
397
- omitContinueCursor?: boolean;
398
- orderBy?: OrderByInput[];
399
- relationBaseWhere?: (table: string) => undefined | WhereInput;
400
- relationMask?: RelationMask;
401
- restrictsCounts?: boolean;
402
- select?: ReadonlyArray<string>;
403
- where?: WhereInput;
404
- with?: WithInput;
405
- }
406
- interface CrossShardReadArgs {
407
- orderBy?: OrderByInput[];
408
- relationPolicies?: Record<string, WhereInput>;
409
- where?: WhereInput;
410
- with?: WithInput;
411
- }
412
- interface CrossShardCountArgs {
413
- relationPolicies?: Record<string, WhereInput>;
414
- where?: WhereInput;
415
- }
416
- type RelationMask = (table: string, rows: Record<string, unknown>[]) => Record<string, unknown>[];
417
- interface QueryPlan {
418
- params: unknown[];
419
- plan: string[];
420
- sql: string;
421
- }
422
- interface QueryPage {
423
- continueCursor: null | string;
424
- isDone: boolean;
425
- page: Record<string, unknown>[];
426
- splitCursor?: null | string;
427
- splitRequired?: boolean;
428
- }
429
- interface RelationEdge {
430
- readonly array: boolean;
431
- readonly column: string;
432
- readonly name: string;
433
- readonly sourceTable: string;
434
- readonly targetTable: string;
435
- }
436
- interface RelatedStartReference {
437
- id: string;
438
- table: string;
439
- }
440
- type RelatedStart = (Record<string, unknown> & {
441
- _id: string;
442
- }) | RelatedStartReference;
443
- type RelatedDirection = "both" | "in" | "out";
444
- interface RelatedOptions {
445
- cursor?: null | string;
446
- depth?: number;
447
- direction?: RelatedDirection;
448
- edges?: ReadonlyArray<string>;
449
- limit?: number;
450
- relationBaseWhere?: (table: string) => undefined | WhereInput;
451
- relationMask?: RelationMask;
452
- }
453
- interface RelatedNode {
454
- depth: number;
455
- document: Record<string, unknown>;
456
- path: ReadonlyArray<string>;
457
- pathIds: ReadonlyArray<string>;
458
- score: number;
459
- table: string;
460
- }
461
- interface RelatedPage {
462
- continueCursor: null | string;
463
- isDone: boolean;
464
- nodes: RelatedNode[];
465
- }
466
- interface OrderKey {
467
- direction: SortDirection;
468
- field: string;
469
- nullable: boolean;
470
- nulls?: NullPlacement;
471
- }
472
- interface RestrictableQueryOptions {
473
- baseWhere?: WhereInput;
474
- relationBaseWhere?: (table: string) => undefined | WhereInput;
475
- restrictsCounts?: boolean;
476
- where?: WhereInput;
477
- }
478
- interface AggregateOptions extends RestrictableQueryOptions {
479
- field?: string;
480
- op: AggregateOp;
481
- }
482
- type AggregateResult = null | number;
483
- interface GroupByOptions extends RestrictableQueryOptions {
484
- agg?: {
485
- field?: string;
486
- op: AggregateOp;
487
- };
488
- by: ReadonlyArray<string>;
489
- }
490
- interface GroupByEntry {
491
- key: Record<string, unknown>;
492
- value: AggregateResult;
493
- }
494
- type RankDirection = "asc" | "desc";
495
- interface RankSortKeyLike {
496
- readonly direction: RankDirection;
497
- readonly field: string;
498
- }
499
- interface RankResult {
500
- position: number;
501
- total: number;
502
- }
503
- interface RankOptions extends RestrictableQueryOptions {
504
- row: Record<string, unknown> | string;
505
- }
506
- interface RankBeforeOptions {
507
- partitionKey: string;
508
- restrictsCounts?: boolean;
509
- rowId: string;
510
- sortValues: ReadonlyArray<unknown>;
511
- }
512
- interface RankBeforeResult {
513
- before: number;
514
- total: number;
515
- }
516
- interface RankPageOptions extends RestrictableQueryOptions {
517
- after?: RankPageRowKey;
518
- cursor?: null | string;
519
- partitionKey?: string;
520
- take?: number;
521
- }
522
- interface RankPage {
523
- continueCursor: null | string;
524
- isDone: boolean;
525
- page: Record<string, unknown>[];
526
- }
527
- interface RankPageRowKey {
528
- partitionKey: string;
529
- rowId: string;
530
- sortValues: ReadonlyArray<unknown>;
531
- }
532
- interface RankPageRow {
533
- doc: Record<string, unknown>;
534
- key: RankPageRowKey;
535
- }
536
- interface ShardRankPageResult {
537
- directions: ReadonlyArray<RankDirection>;
538
- hasMore: boolean;
539
- rows: ReadonlyArray<RankPageRow>;
540
- }
541
- interface PaginationOptions {
542
- cursor?: null | string;
543
- endCursor?: null | string;
544
- numItems: number;
545
- }
546
- interface SearchFilterBuilderLike {
547
- eq: (field: string, value: unknown) => SearchFilterBuilderLike;
548
- search: (field: string, query: string) => SearchFilterBuilderLike;
549
- }
550
- interface GeoFilterBuilderLike {
551
- near: (point: {
552
- lat: number;
553
- lng: number;
554
- }, radiusMeters: number) => GeoFilterBuilderLike;
555
- within: (box: {
556
- ne: {
557
- lat: number;
558
- lng: number;
559
- };
560
- sw: {
561
- lat: number;
562
- lng: number;
563
- };
564
- }) => GeoFilterBuilderLike;
565
- }
566
- type ScoredDocument = GeoScoredDocument | SearchScoredDocument;
567
- interface GeoScoredDocument {
568
- distanceMeters: null | number;
569
- document: Record<string, unknown>;
570
- score?: never;
571
- }
572
- interface SearchScoredDocument {
573
- distanceMeters?: never;
574
- document: Record<string, unknown>;
575
- score: number;
576
- }
577
- interface TableReaderLike {
578
- [Symbol.asyncIterator]: () => AsyncIterator<Record<string, unknown>>;
579
- collect: () => Promise<Record<string, unknown>[]>;
580
- collectWithScores: () => Promise<ScoredDocument[]>;
581
- filter: (predicate: (document: Record<string, unknown>) => boolean) => TableReaderLike;
582
- first: () => Promise<Record<string, unknown> | null>;
583
- order: (direction: "asc" | "desc") => TableReaderLike;
584
- paginate: (options: PaginationOptions) => Promise<QueryPage>;
585
- take: (limit: number) => Promise<Record<string, unknown>[]>;
586
- unique: () => Promise<Record<string, unknown> | null>;
587
- withGeoIndex: (indexName: string, build: (q: GeoFilterBuilderLike) => GeoFilterBuilderLike) => TableReaderLike;
588
- withIndex: (indexName: string, range?: (q: IndexRangeBuilderLike) => IndexRangeBuilderLike) => TableReaderLike;
589
- withSearchIndex: (indexName: string, search: (q: SearchFilterBuilderLike) => SearchFilterBuilderLike) => TableReaderLike;
590
- }
591
- interface IndexRangeBuilderLike {
592
- eq: (field: string, value: unknown) => IndexRangeBuilderLike;
593
- gt: (field: string, value: unknown) => IndexRangeBuilderLike;
594
- gte: (field: string, value: unknown) => IndexRangeBuilderLike;
595
- lt: (field: string, value: unknown) => IndexRangeBuilderLike;
596
- lte: (field: string, value: unknown) => IndexRangeBuilderLike;
597
- }
598
- type BroadcastDelta = (delta: MutationDelta) => void;
599
- type ReadHook = (table: string, idOrScan?: string, exact?: boolean) => void;
600
- interface LifecycleEvent {
601
- connectionId: string;
602
- context?: Record<string, unknown>;
603
- shardKey: string;
604
- userId: string | null;
605
- }
606
- interface LifecycleDispatchInfo extends SubscriptionIdentity {
607
- event: LifecycleEvent;
608
- }
609
- interface MutationDelta {
610
- indexKeys?: ReadonlyArray<IndexKeyEntry>;
611
- key: string;
612
- op: "insert" | "update" | "delete";
613
- row?: Record<string, unknown>;
614
- table: string;
615
- }
616
- interface DatabaseWriterLike {
617
- aggregate: (tableName: string, options: AggregateOptions) => Promise<AggregateResult>;
618
- asId?: (tableName: string, id: string) => string;
619
- assertPatchAllowed?: (table: string, id: string) => Promise<void>;
620
- cdcChangedTables?: (sinceSeq: number, options?: {
621
- cursorOnly?: boolean;
622
- }) => Promise<{
623
- cursor: number;
624
- floor?: number;
625
- tables: string[];
626
- } | undefined>;
627
- count: (tableName: string, where?: RestrictableQueryOptions | WhereInput) => Promise<number>;
628
- delete: (table: string, id: string, options?: {
629
- hard?: boolean;
630
- skipOnDelete?: boolean;
631
- }) => Promise<void>;
632
- deleteAll?: (tableName: string, options?: {
633
- chunkSize?: number;
634
- hard?: boolean;
635
- }) => Promise<{
636
- deleted: number;
637
- }>;
638
- deleteMany?: (table: string, ids: ReadonlyArray<string>, options?: {
639
- limit?: number;
640
- }) => Promise<{
641
- deleted: number;
642
- }>;
643
- deleteRereadTables?: ReadonlySet<string>;
644
- deleteWhere?: (tableName: string, where: WhereInput, options?: {
645
- limit?: number;
646
- }) => Promise<{
647
- deleted: number;
648
- }>;
649
- explain: (tableName: string, args?: QueryArgs) => Promise<QueryPlan>;
650
- findFirst: (tableName: string, args?: QueryArgs) => Promise<Record<string, unknown> | null>;
651
- findFirstOrThrow: (tableName: string, args?: QueryArgs) => Promise<Record<string, unknown>>;
652
- findMany: (tableName: string, args?: QueryArgs) => Promise<QueryPage>;
653
- get: (table: string, id: string) => Promise<Record<string, unknown> | null>;
654
- groupBy: (tableName: string, options: GroupByOptions) => Promise<ReadonlyArray<GroupByEntry>>;
655
- insert: (tableName: string, document: Record<string, unknown>, options?: {
656
- allowExplicitId?: boolean;
657
- clientId?: string;
658
- }) => Promise<string>;
659
- insertMany?: (tableName: string, documents: ReadonlyArray<Record<string, unknown>>, options?: {
660
- limit?: number;
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
6
  interface ExportRow {
722
7
  doc: Record<string, unknown>;
723
8
  table: string;
@@ -773,104 +58,6 @@ declare const parseExportShardArgs: (args: Record<string, unknown>) => ExportSha
773
58
  declare const parseImportShardArgs: (args: Record<string, unknown>) => ImportShardAdminArgs;
774
59
  declare const ADMIN_TOKEN_SCOPES: readonly ["migrations"];
775
60
  type AdminTokenScope = (typeof ADMIN_TOKEN_SCOPES)[number];
776
- declare const clearCompanionSignatures: (sql: SqlExec) => void;
777
- declare class CompanionMemo {
778
- readonly verified: Set<string>;
779
- invalidate(): void;
780
- }
781
- interface CacheEntry {
782
- bytes: number;
783
- deps: Set<string>;
784
- lastUsed: number;
785
- ranges: ReadonlyArray<KeyRange>;
786
- result: unknown;
787
- subscribers: Set<string>;
788
- }
789
- interface ReactiveCacheOptions {
790
- maxBytes?: number;
791
- maxEntries?: number;
792
- now?: () => number;
793
- }
794
- declare class ReactiveCache {
795
- private readonly entries;
796
- private readonly tableIndex;
797
- private readonly rangeIndex;
798
- private totalBytes;
799
- private hits;
800
- private misses;
801
- private evictions;
802
- private readonly maxEntries;
803
- private readonly maxBytes;
804
- private readonly now;
805
- private monotonic;
806
- private generation;
807
- constructor(options?: ReactiveCacheOptions);
808
- run<R>(key: string, deps: Set<string>, run: () => Promise<R>, ranges?: () => ReadonlyArray<KeyRange>): Promise<R>;
809
- invalidate(table: string, id: string, indexKeys?: ReadonlyArray<IndexKeyEntry>): string[];
810
- invalidateTable(table: string): string[];
811
- subscribe(key: string, subscriberId: string): void;
812
- unsubscribe(key: string, subscriberId: string): void;
813
- size(): {
814
- bytes: number;
815
- entries: number;
816
- };
817
- clear(): void;
818
- subscribers(key: string): string[];
819
- stats(): {
820
- bytes: number;
821
- entries: number;
822
- evictions: number;
823
- hits: number;
824
- misses: number;
825
- };
826
- private dropRangeDeps;
827
- private collectAndDrop;
828
- private dropKeys;
829
- private dropEntry;
830
- private evict;
831
- }
832
- declare const reactiveCacheKey: (functionPath: string, args: Record<string, unknown>, identity: null | string) => string;
833
- interface TransactionLimits {
834
- maxReadBytes: number;
835
- maxReadRows: number;
836
- maxWrittenBytes: number;
837
- maxWrittenRows: number;
838
- }
839
- interface TransactionHeadroom {
840
- readBytes: number;
841
- readRows: number;
842
- remainingReadBytes: number;
843
- remainingReadRows: number;
844
- remainingWrittenBytes: number;
845
- remainingWrittenRows: number;
846
- writtenBytes: number;
847
- writtenRows: number;
848
- }
849
- type TransactionLimitKind = "readBytes" | "readRows" | "writtenBytes" | "writtenRows";
850
- interface TransactionLimitWarning {
851
- kind: TransactionLimitKind;
852
- limit: number;
853
- used: number;
854
- }
855
- declare const DEFAULT_TRANSACTION_LIMITS: TransactionLimits;
856
- declare class TransactionHeadroomTracker {
857
- private readBytes;
858
- private readRows;
859
- private writtenRows;
860
- private writtenBytes;
861
- private readonly limits;
862
- private readonly onNearLimit;
863
- private readonly warned;
864
- private readonly chargedDocuments;
865
- constructor(limits?: Partial<TransactionLimits>, onNearLimit?: (warning: TransactionLimitWarning) => void);
866
- recordRead(count: number): void;
867
- recordReadBytes(bytes: number): void;
868
- recordDocumentRead(key: string, bytes: number): void;
869
- beginReadWindow(): void;
870
- recordWrite(row: unknown): void;
871
- headroom(): TransactionHeadroom;
872
- private check;
873
- }
874
61
  interface RunTriggersOptions {
875
62
  ctx: TriggerContextLike;
876
63
  event: TriggerEventLike;
@@ -963,64 +150,6 @@ interface ShapeRow {
963
150
  }
964
151
  declare const selectShapeRows: (sql: SqlExec, table: string, effectiveWhere: WhereInput | undefined) => ShapeRow[];
965
152
  declare const selectShapeMembers: (sql: SqlExec, table: string, effectiveWhere: WhereInput | undefined, ids: ReadonlyArray<string>) => Map<string, Record<string, unknown>>;
966
- interface SqlExec {
967
- exec: <Row = Record<string, unknown>>(sql: string, ...params: unknown[]) => SqlCursor<Row>;
968
- }
969
- interface SqlCursor<Row> extends Iterable<Row> {
970
- readonly columnNames?: string[];
971
- one: () => Row;
972
- raw?: () => IterableIterator<unknown[]>;
973
- toArray: () => Row[];
974
- }
975
- type IndexUseHook = (table: string, indexName: string, kind: "geo" | "index" | "rank" | "search") => void;
976
- type Clock = () => number;
977
- type IdGenerator = () => string;
978
- declare const assertValidClientId: (clientId: string) => void;
979
- declare const assertStorableRowId: (id: string) => void;
980
- interface WriteEvent {
981
- doc?: Record<string, unknown>;
982
- id: string;
983
- op: "delete" | "insert" | "update";
984
- table: string;
985
- }
986
- type WriteHook = (event: WriteEvent) => Promise<void> | void;
987
- interface CtxDbOptions {
988
- auth?: ServerDefaultContextLike["auth"];
989
- baselineSeq?: () => number | undefined;
990
- broadcast?: BroadcastDelta;
991
- cache?: ReactiveCache;
992
- cdc?: boolean;
993
- clock?: Clock;
994
- companionMemo?: CompanionMemo;
995
- enforceRls?: boolean;
996
- globalDb?: DatabaseWriterLike;
997
- headroom?: TransactionHeadroomTracker;
998
- idGenerator?: IdGenerator;
999
- inTransaction?: () => boolean;
1000
- maxRelationKeys?: number;
1001
- onIndexUse?: IndexUseHook;
1002
- onRead?: ReadHook;
1003
- onReadRange?: (range: KeyRange) => void;
1004
- onStalePatchDropped?: (event: {
1005
- fields: string[];
1006
- id: string;
1007
- table: string;
1008
- }) => void;
1009
- onWrite?: WriteHook;
1010
- relationExistsPushDown?: "always" | "auto" | "never";
1011
- scheduler?: SchedulerLike;
1012
- schema: SchemaLike;
1013
- sql: SqlExec;
1014
- storage?: SystemReaderStorageLike;
1015
- }
1016
- type CountArgs = RestrictableQueryOptions;
1017
- declare class NotUniqueError extends LunoraError {
1018
- constructor(message?: string);
1019
- }
1020
- declare const normalizeIdStructurally: (schema: SchemaLike, tableName: string, id: string) => null | string;
1021
- declare const assertNoExplicitUndefined: (op: "patch" | "patchIf" | "replace", document: Record<string, unknown>) => void;
1022
- declare const stripReservedPatchFields: (patch: Record<string, unknown>) => Record<string, unknown>;
1023
- declare const createShardCtxDb: (options: CtxDbOptions) => DatabaseWriterLike;
1024
153
  declare const ADMIN_TOKEN_TABLE = "__lunora_admin_tokens__";
1025
154
  interface AdminTokenSummary {
1026
155
  createdAt: number;
@@ -1318,63 +447,16 @@ interface DependencyTracker {
1318
447
  recordRead: (table: string, idOrScan: string) => void;
1319
448
  }
1320
449
  declare const createDependencyTracker: () => DependencyTracker;
1321
- declare const runSql: <Row = Record<string, unknown>>(sql: SqlExec, query: string, ...params: unknown[]) => SqlCursor<Row>;
1322
- declare const runDrizzle: <Row = Record<string, unknown>>(exec: SqlExec, query: SQL) => SqlCursor<Row>;
1323
- type RangeOperandType = "boolean" | "number" | "string";
1324
- interface WhereFragments<T> {
1325
- binary: (reference: T, comparator: string, value: unknown) => T;
1326
- connect: (left: T, right: T, connector: "AND" | "OR") => T;
1327
- constant: (value: boolean) => T;
1328
- contains: (reference: T, term: T) => T;
1329
- inList: (reference: T, items: ReadonlyArray<unknown>, negated: boolean, budget: number) => T;
1330
- negate: (inner: T) => T;
1331
- nullCheck: (reference: T, negated: boolean) => T;
1332
- value: (value: unknown) => T;
1333
- }
1334
- type FieldRefSql<T> = (field: string) => T;
1335
- type SerializeValue = (value: unknown, field: string) => unknown;
1336
- interface WhereSqlStrategy<T = SQL> {
1337
- containsExpr?: (reference: T, term: T) => T;
1338
- fieldRef: FieldRefSql<T>;
1339
- inList?: (reference: T, items: ReadonlyArray<unknown>, negated: boolean, budget?: number) => T;
1340
- rangeTypeGuard: (field: string, type: RangeOperandType) => T;
1341
- relationExists?: (request: unknown) => T;
1342
- serialize: SerializeValue;
1343
- }
1344
- declare const serverInList: (engine: "mysql" | "postgres") => (reference: SQL, items: ReadonlyArray<unknown>, negated: boolean, budget?: number) => SQL;
1345
- declare const compileWhereSql: <T = SQL>(where: WhereInput | undefined, strategy: WhereSqlStrategy<T>, fragments?: WhereFragments<T>, reservedParams?: number) => T | undefined;
1346
450
  declare const quoteIdentifier: (name: string) => string;
1347
451
  declare const serializeSqlValue: (value: unknown) => unknown;
1348
452
  declare const DOC_COLUMN = "__doc__";
1349
453
  declare const geoTableName: (table: string, indexName: string) => string;
1350
454
  declare const jsonPath: (field: string) => string;
1351
- declare const jsonPathSql: (field: string) => SQL;
1352
455
  declare const qualifiedJsonPath: (table: string, field: string) => string;
1353
- declare const qualifiedJsonPathSql: (table: string, field: string) => SQL;
1354
- declare const createIndexSql: (name: string, table: string, columns: SQL, unique: boolean) => SQL;
1355
- declare const AGG_KEY: Name;
1356
- declare const AGG_VALUE: Name;
1357
- declare const AGG_COUNT: Name;
1358
- declare const aggUpsertSql: (aggTable: string, key: unknown, value: unknown, count: unknown, set: SQL) => SQL;
1359
456
  declare const tableColumns: (definition: TableDefinitionLike) => ReadonlyArray<readonly [string, ColumnMetaLike]>;
1360
457
  declare const rowToDocument: (row: Record<string, unknown> | undefined) => Record<string, unknown> | undefined;
1361
458
  declare const tryRowToDocument: (row: Record<string, unknown> | undefined) => Record<string, unknown> | undefined;
1362
459
  declare const isFtsAvailable: (wrapper: SqlExec, existingFtsTable?: string) => boolean;
1363
- declare const WORKERD_SQLITE_LIMITS: {
1364
- readonly boundParams: 100;
1365
- readonly compoundSelect: 5;
1366
- readonly likePattern: 50;
1367
- readonly sqlTextLength: 100000;
1368
- };
1369
- type SqlEngine = "mysql" | "postgres" | "sqlite";
1370
- interface RenderedSql {
1371
- params: unknown[];
1372
- sql: string;
1373
- }
1374
- declare const renderSql: (engine: SqlEngine, query: SQL) => RenderedSql;
1375
- declare const param: (value: unknown) => SQL;
1376
- declare const unionAll: (branches: ReadonlyArray<SQL>) => SQL;
1377
- declare const sqliteInList: (reference: SQL, items: ReadonlyArray<unknown>, negated: boolean, budget?: number) => SQL;
1378
460
  type DurableStreamStatus = "complete" | "error" | "running";
1379
461
  interface DurableStreamRun {
1380
462
  error?: string;
@@ -1511,14 +593,6 @@ declare const pullExternalSourceIncrementalTick: (sql: SqlExec, writer: Database
1511
593
  applied: number;
1512
594
  }>;
1513
595
  declare const ftsRowidMapName: (companion: string) => string;
1514
- interface FtsWriteOptions {
1515
- guard?: SQL;
1516
- unmappedRowids?: ReadonlyArray<number>;
1517
- }
1518
- declare const ftsCompanionDdl: (companion: string) => SQL[];
1519
- declare const ftsWriteDocument: (companion: string, id: string, text: string, options?: FtsWriteOptions) => SQL[];
1520
- declare const ftsPurgeDocument: (companion: string, id: string, options?: FtsWriteOptions) => SQL[];
1521
- declare const ftsUnmappedPage: (companion: string, limit: number, after?: number) => SQL;
1522
596
  declare const groupUnmappedRows: (rows: ReadonlyArray<Record<string, unknown>>) => Map<string, number[]>;
1523
597
  declare const GEO_DEFAULT_PRECISION = 9;
1524
598
  interface GeoPoint {
@@ -2261,7 +1335,6 @@ declare const rankKeyFromDocument: (index: RankIndexDefinitionLike, document_: R
2261
1335
  rowId: string;
2262
1336
  sortValues: unknown[];
2263
1337
  };
2264
- declare const rankPivotConditionSql: (column: string, value: unknown, direction: "asc" | "desc", wantLater: boolean) => SQL | undefined;
2265
1338
  declare const matchesRankStaticWhere: (document: Record<string, unknown>, predicate: Record<string, unknown>) => boolean;
2266
1339
  declare const REACTOR_STATE_TABLE = "__reactor_state";
2267
1340
  interface ReactorState {
@@ -2789,6 +1862,7 @@ interface GuardableSchema {
2789
1862
  }
2790
1863
  type TableOfId = (id: string, expectedTable?: string) => Promise<string | undefined> | string | undefined;
2791
1864
  declare const guardWriter: <W>(raw: W, schema: GuardableSchema, tableOfId: TableOfId, relationEdges?: ReadonlyArray<RelationEdge>) => W;
1865
+ declare const runSql: <Row = Record<string, unknown>>(sql: SqlExec, query: string, ...params: unknown[]) => SqlCursor<Row>;
2792
1866
  declare const SCHEMA_HISTORY_MAX_VERSIONS = 50;
2793
1867
  interface SchemaVersionRow {
2794
1868
  appliedAt: number;
@@ -2940,4 +2014,4 @@ declare const backfillVectorIndexes: (sql: SqlExec, targets: ReadonlyArray<Vecto
2940
2014
  ordered: OrderedAfterWrites;
2941
2015
  restart?: boolean;
2942
2016
  }) => Promise<VectorBackfillProgress>;
2943
- export { ADMIN_FUNCTIONS, ADMIN_FUNCTION_PREFIX, ADMIN_TOKEN_TABLE, ADMIN_WILDCARD, AGGREGATE_SQL_FUNCTION, AGG_COUNT, AGG_KEY, AGG_VALUE, AUDIT_LOG_TABLE, type AdminTokenSummary, type AdvisorProcedure, 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 CrossShardCountArgs, 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, DELTA_PLACEHOLDER_TABLE, 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, IMPORT_MANIFEST_TTL_MS, IMPORT_STAGE_TTL_MS, type IdGenerator, type IdempotentRecord, type ImportConflictMode, type ImportError, type ImportManifest, type ImportRow, type ImportShardAdminArgs, type ImportShardArgs, type ImportShardResult, type ImportStepResult, 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 ManifestChange, type ManifestTouch, 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 ScheduleOutboxEntry, 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 StagedImportRow, 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 TransactionLimitKind, type TransactionLimitWarning, 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, adminTokenExists, advanceClientWatermark, advanceImportManifest, aggUpsertSql, aggregateSqlFunction, aggregateTableName, allocateCommitSeq, appendAuditEntry, appendCdcChange, appendStreamChunk, applyCdcChanges, applyInsertDefaults, applyOnDelete, applySelect, archiveCdcSegment, armRestore, assertFlatPredicate, assertImportSessionId, 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, createAdminTokenRecord, createCompanionSync, createDependencyTracker, createFanoutCounters, createGlobalPollCounters, createIndexSql, createReadFootprint, createRelayLink, createReplicaLink, createShapeDiffCache, createShapeProbeCounters, createShardCtxDb, createSystemReader, cursorBelowRetainedFloor, decideDurableAttach, decodeBigintSqlKey, decodeCursor, decodeFloat64SqlKey, deferScheduleOutbox, deleteGlobalShapeSnapshot, deleteGlobalShapeSnapshotsForConnection, deleteShapePokeCursor, deleteShapePokeCursorsForConnection, deleteStreamRun, deltaTableFor, depKey, deriveRelationEdges, describeRelationWrites, diffExternalSource, diffGlobalMembership, distinctValues, dropImportManifest, dropImportSession, dropScheduleOutbox, encodeAggregateKey, encodeCursor, encodeGeohash, encodePartitionKey, encodeRowsPatch, ensureAuditTable, ensureMailTable, envOptionalPositiveInt, envPositiveInt, equalityPinnedFields, exportShardRows, facetColumn, fanOutScalarCounts, findManyPage, findRelated, findStorageReferences, finishStreamRun, float64SqlKey, foldAggregateTally, forgetScheduleOutbox, ftsCompanionDdl, ftsPurgeDocument, ftsRowidMapName, ftsUnmappedPage, ftsWriteDocument, gateReplicaDispatch, geoTableName, globalShapeReadKey, groupUnmappedRows, guardWriter, handleReplicaControl, hasScheduleOutboxEntry, hasTrigger, haversineMeters, importShardRows, indexKeysForRow, isDevEnvironment, isFtsAvailable, isInternalTableName, isLossyBody, isMemoryTable, isPushableWhere, isRelationPredicate, isSoftDeleted, isSourceDue, isTtlExpired, isVacuousFilterClause, jsonPath, jsonPathSql, keysTouchRanges, liftSourceId, lintReadonlySql, listAdminTokens, listReactorStates, listTables, markShardImportCommitted, 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, readDueScheduleOutboxEntry, readExternalSourceBaseline, readGlobalShapeSnapshot, readIdempotent, readImportManifest, readMigrationStatus, readPatchField, readQueueMessageById, readQueueMessages, readReactorState, readScheduleOutbox, readScheduleOutboxState, readSchemaHistory, readSchemaVersion, readSearchBackfillState, readShapePokeCursor, readShardImportSession, readStreamChunks, readStreamRun, readTablePage, recordCapturedMail, recordChangedKeys, recordFanoutPass, recordGlobalPollPass, recordQueueMessages, recordScheduleOutbox, recordSchemaVersion, recordShapeProbePass, relationHooks, relayCountFor, renderSql, replaceRefusal, reprojectableFields, reprojectionMigrationId, reprojectionTables, requeueScheduleOutbox, resolvePatch, resolveRankPartition, resolveRankSeekTuple, resolveRelationPredicates, resolveWith, revokeAdminTokenRecord, 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, stageImportRows, stagedImportIds, stagedImportPage, stripReservedPatchFields, stubByName, subscriptionFrames, subscriptionListDeltas, summarizeFanoutTopics, summarizeSubscriptions, sweepImportStaging, tableColumns, tableFromDepKey, throwingScheduler, tiebreakDirectionFor, touchImportManifest, touchShardImportSession, trimCdcChanges, trimIdempotent, trimScheduleOutbox, trimStreamRuns, tryRowToDocument, trySendFrame, unionAll, uniqueIndexFields, validateImportRow, verifyAdminTokenDigest, verifySiblingBody, whereFilter, whereOfFilter, writeCdcArchivedThrough, writeGlobalShapeSnapshot, writeIdempotent, writeReactorState, writeSearchBackfillState, writeShapePokeCursor, writeShapePokeCursors, writeTouchesMemo };
2017
+ export { ADMIN_FUNCTIONS, ADMIN_FUNCTION_PREFIX, ADMIN_TOKEN_TABLE, ADMIN_WILDCARD, AGGREGATE_SQL_FUNCTION, AUDIT_LOG_TABLE, type AdminTokenSummary, type AdvisorProcedure, type AdvisoriesResult, type AdvisoryFinding, type AggregateIndexDefinitionLike, type AggregateOp, type AggregateTally, type AppendAuditEntry, type ApplyOnDeleteOptions, type AuditEntry, type AuditLogResult, BIGINT_KEY_DIGITS, CDC_LOG_TABLE, CDC_LOG_TABLE_SEQ_INDEX, CDC_META_TABLE, CLIENT_WATERMARK_TABLE, COMMIT_SEQ_FIELD, COMMIT_SEQ_TABLE, CURSOR_PREFIX, type CapturedMailRow, type CdcArchiveScope, type CdcChange, type CdcChangeKey, type ChangedKeys, type ColumnMeta, type ColumnMetaLike, type CompanionSync, type CompanionSyncDeps, ConflictError, type ConflictKind, CountRlsUnsupportedError, type CreateWorkflowInstanceResult, DATA_MIGRATION_STATE_TABLE, DEFAULT_FANOUT_TOPIC_LIMIT, DEFAULT_MAX_RELATION_KEYS, DEFAULT_MAX_RELAYS, DEFAULT_PROMOTION_THRESHOLDS, DELTA_PLACEHOLDER_TABLE, DOC_COLUMN, type DataMigrationDocument, type DataMigrationLike, type DataMigrationTransform, type DatabaseWriterLike, type DependencyTracker, type DeployInfo, type DurableAttachDecision, type DurableStreamAttach, type DurableStreamRun, DurableStreamRunner, type DurableStreamSink, type ExportRow, type ExportShardAdminArgs, type ExportShardArgs, type ExternalSourceDiffResult, type ExternalSourceLike, FLAGS_FUNCTION_PREFIX, type FacetColumnOptions, type FacetColumnResult, type FacetValue, type FanoutMetricsResult, type FanoutPathCounters, type FanoutTopicStat, type FilterClause, type FilterOperator, type FlagEvaluation, type FlagsResult, type FunctionCallStat, type FunctionScanAttribution, type FunctionStatsResult, GEO_DEFAULT_PRECISION, GLOBAL_SHAPE_SNAPSHOT_TABLE, type GeoBoundingBox, type GeoPoint, type GlobalPollCounters, GlobalPollTick, IDEMPOTENCY_TABLE, IMPORT_MANIFEST_TTL_MS, IMPORT_STAGE_TTL_MS, type IdempotentRecord, type ImportConflictMode, type ImportError, type ImportManifest, type ImportRow, type ImportShardAdminArgs, type ImportShardArgs, type ImportShardResult, type ImportStepResult, type IncrementalMaterializeResult, type IndexKeyEntry, type KeyRange, type LiveSocketControlCall, MAIL_RETENTION, MAIL_TABLE, MAX_DURABLE_STREAM_BYTES, MAX_DURABLE_STREAM_CHUNKS, MAX_PAGE_SIZE, MAX_SQL_ROWS, type ManifestChange, type ManifestTouch, type MaskColumnMetadata, type MaskPoliciesResult, type MaterializeResult, type MigrationDirection, type MigrationRunResult, type MigrationStatus, type MigrationStatusRow, type MutationDelta, NotFoundError, type OrderByClause, type OrderByInput, type OrderKey, type OrderKeyConstraints, OwnerRelay, type OwnerRelayFrame, type PatchWriteOptions, type PitrBookmarkResult, type PitrRestoreArgs, type PitrRestoreResult, type PitrStorage, type PokeFrameMeta, type PromotionState, type PromotionThresholds, QUEUE_TABLE, type QueryArgs, type QueryPage, type QueueMessageOutcome, type QueueMessageRow, type QueueMetadata, type QueuesResult, RANK_TIEBREAK, REACTOR_STATE_TABLE, RELATED_DEFAULT_LIMIT, RELATED_DEPTH_DECAY, RELATED_MAX_DEPTH, RELATED_MAX_LIMIT, RELATION_FUNCTION_PREFIX, RELAY_SIGNATURE_HEADER, REPROJECTION_MIGRATION_PREFIX, RLS_UNWRAP_SYMBOL, type RankDirection, type RankIndexDefinitionLike, type RankPageComputation, type RankPageDeps, type RankPageOptions, type RankPageRowKey, type ReactorDispatchResult, type ReactorMetadata, type ReactorState, type ReactorStats, type ReactorsResult, type ReadFootprint, type ReadTablePageOptions, type RecordMailInput, type RecordQueueMessageInput, type RelatedOptions, type RelatedPage, type RelatedStart, type RelationEdge, type RelationExistsMarker, type RelationGraphReader, type RelayAttach, type RelayDetach, type RelayFrame, type RelayHost, RelayMember, type RelayPokeDelivery, type RelayRoomEvent, type RelayRoomVerdict, type RelayShapePoke, type RelayShapeSeed, type RelayShapeSubscribe, type RelayShapeUnsubscribe, type ReplicaFollowerHost, type ReplicaOwnerHost, type ReplicaReadiness, type ResolveRelationPredicatesOptions, type ResolveWithOptions, type ResolvedShape, type RestrictableQueryOptions, type RlsPoliciesResult, type RlsPolicyMetadata, RlsRequiredError, type RlsRoleMetadata, type RunDataMigrationOptions, type RunTriggersOptions, SCAN_DEP, SCHEDULE_OUTBOX_TABLE, SCHEMA_HISTORY_MAX_VERSIONS, SEARCH_STATE_TABLE, SHAPE_POKE_CURSOR_TABLE, type ScheduleOutbox, type ScheduleOutboxEntry, type ScheduleOutboxEnvelope, type ScheduleOutboxRow, type SchedulerLike, type SchemaLike, type SearchBackfillProgress, type SearchIndexDefinitionLike, type SelectMatchingIdsOptions, type ServerDefaultContextLike, type SettingEntry, type SettingKind, type SettingsResult, ShapeDiffCache, type ShapePokeCursorRow, type ShapePokePart, type ShapeProbeCounters, type ShapeRow, type ShapeRowOp, type ShapeSubscriptionQuery, ShardRunner, type ShardRunnerOptions, type ShardSiblingHost, type ShardSocketLike, type SocketAttachment, type SortDirection, type SourceClientLike, type SourceCursorLike, type SourceRefresh, type SqlConsoleResult, type SqlCursor, type SqlExec, type SqlLintResult, type StagedImportRow, type StorageReference, type StorageReferenceResult, type StorageRuleMetadata, type StorageRulesResult, type StudioFeaturesResult, type SubscriptionConnection, type SubscriptionIdentity, type SubscriptionInfo, type SubscriptionReadFootprint, type SubscriptionsResult, type TableColumnsResult, type TableDefinitionLike, type TableIndexInfo, type TableIndexesResult, type TableInfo, type TablePage, type TablesColumnsResult, type TablesIndexesResult, type TransactionLimits, type TransactionSqlLike, type TriggerContextLike, type TriggerEventLike, type TriggerOpLike, type TriggerTimingLike, type TtlSweepSpec, UNVOUCHABLE_DEP, VECTOR_BACKFILL_MAX_PAGES, type ValidatorLike, type VectorBackfillProgress, type WhereFilter, type WhereInput, type WorkflowInstanceState, type WorkflowInstanceStatusResult, type WorkflowMetadata, type WorkflowsResult, adminTokenExists, advanceClientWatermark, advanceImportManifest, aggregateSqlFunction, aggregateTableName, allocateCommitSeq, appendAuditEntry, appendCdcChange, appendStreamChunk, applyCdcChanges, applyInsertDefaults, applyOnDelete, applySelect, archiveCdcSegment, armRestore, assertFlatPredicate, assertImportSessionId, assertPatchAllowed, assertReadonly, assertShapeShardable, awaitWsDrain, backfillAggregateIndexes, backfillRankIndexes, backfillSearchIndexes, backfillSearchIndexesForTable, backfillVectorIndexes, bigintSqlKey, boundingBoxCenter, boundingBoxGeohashes, buildPokeFrames, buildReprojectionMigration, buildSeekBeforeWhere, buildSeekWhere, buildSettings, buildShapeDiff, bumpCdcEpoch, cdcArchiveRewound, cdcCanVouchFor, cdcForkedError, cdcSeqLeavingRows, cdcTouchesTables, cdcTrimmedError, claimStreamRun, clampPromotionThresholds, clearCapturedMail, clearMemoryTables, clearQueueMessages, coerceAggregateNumber, compactCdcDocs, composeReadPredicate, computeRankPage, containsRelationPredicate, countLegacyRows, coveringGeohashes, createAdminTokenRecord, createCompanionSync, createDependencyTracker, createFanoutCounters, createGlobalPollCounters, createReadFootprint, createRelayLink, createReplicaLink, createShapeDiffCache, createShapeProbeCounters, cursorBelowRetainedFloor, decideDurableAttach, decodeBigintSqlKey, decodeCursor, decodeFloat64SqlKey, deferScheduleOutbox, deleteGlobalShapeSnapshot, deleteGlobalShapeSnapshotsForConnection, deleteShapePokeCursor, deleteShapePokeCursorsForConnection, deleteStreamRun, deltaTableFor, depKey, deriveRelationEdges, diffExternalSource, diffGlobalMembership, distinctValues, dropImportManifest, dropImportSession, dropScheduleOutbox, encodeAggregateKey, encodeCursor, encodeGeohash, encodePartitionKey, encodeRowsPatch, ensureAuditTable, ensureMailTable, envOptionalPositiveInt, envPositiveInt, equalityPinnedFields, exportShardRows, facetColumn, fanOutScalarCounts, findManyPage, findRelated, findStorageReferences, finishStreamRun, float64SqlKey, foldAggregateTally, forgetScheduleOutbox, ftsRowidMapName, gateReplicaDispatch, geoTableName, globalShapeReadKey, groupUnmappedRows, guardWriter, handleReplicaControl, hasScheduleOutboxEntry, hasTrigger, haversineMeters, importShardRows, isDevEnvironment, isFtsAvailable, isInternalTableName, isLossyBody, isMemoryTable, isPushableWhere, isRelationPredicate, isSoftDeleted, isSourceDue, isTtlExpired, isVacuousFilterClause, jsonPath, liftSourceId, lintReadonlySql, listAdminTokens, listReactorStates, listTables, markShardImportCommitted, 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, normalizeOrderKeys, normalizeSourceDocument, normalizeSourceValue, nullsFirstOf, nullsOrderSuffix, operatorFields, parkScheduleOutbox, parseExportShardArgs, parseImportShardArgs, patchDependsOnRow, planAggregateLookup, pointInBoundingBox, probeScheduleOutbox, projectColumns, pullExternalSourceIncrementalTick, pullExternalSourceTick, qualifiedJsonPath, quoteIdentifier, rankKeyFromDocument as rankKeyFromDoc, rankTableName, reactorNeedsRun, readAggregateValue, readArchivedCdcChanges, readAuditLog, readBookmark, readCapturedMail, readCdcArchivedThrough, readCdcChangeKeys, readCdcChanges, readCdcCursor, readCdcEpoch, readClientWatermark, readCommitSeq, readDeployInfo, readDueScheduleOutbox, readDueScheduleOutboxEntry, readExternalSourceBaseline, readGlobalShapeSnapshot, readIdempotent, readImportManifest, readMigrationStatus, readPatchField, readQueueMessageById, readQueueMessages, readReactorState, readScheduleOutbox, readScheduleOutboxState, readSchemaHistory, readSchemaVersion, readSearchBackfillState, readShapePokeCursor, readShardImportSession, readStreamChunks, readStreamRun, readTablePage, recordCapturedMail, recordChangedKeys, recordFanoutPass, recordGlobalPollPass, recordQueueMessages, recordScheduleOutbox, recordSchemaVersion, recordShapeProbePass, relationHooks, relayCountFor, replaceRefusal, reprojectableFields, reprojectionMigrationId, reprojectionTables, requeueScheduleOutbox, resolvePatch, resolveRankPartition, resolveRankSeekTuple, resolveRelationPredicates, resolveWith, revokeAdminTokenRecord, rowToDocument, runDataMigration, runExternalSourceTick, runReadonlySql, runRowValidators, runShardMigrations, runSocketPool, runSql, runTriggers, selectExpiredIds, selectExportTables, selectIndexForAggregate, selectIndexForCount, selectIndexForGroupBy, selectMatchingIds, selectShapeMembers, selectShapeRows, serializeSqlValue, shapeRoutingKey, siblingSecretOf, signSiblingBody, softDeleteScope, sortColumnName, stageImportRows, stagedImportIds, stagedImportPage, stubByName, subscriptionFrames, subscriptionListDeltas, summarizeFanoutTopics, summarizeSubscriptions, sweepImportStaging, tableColumns, tableFromDepKey, throwingScheduler, tiebreakDirectionFor, touchImportManifest, touchShardImportSession, trimCdcChanges, trimIdempotent, trimScheduleOutbox, trimStreamRuns, tryRowToDocument, trySendFrame, uniqueIndexFields, validateImportRow, verifyAdminTokenDigest, verifySiblingBody, whereFilter, whereOfFilter, writeCdcArchivedThrough, writeGlobalShapeSnapshot, writeIdempotent, writeReactorState, writeSearchBackfillState, writeShapePokeCursor, writeShapePokeCursors, writeTouchesMemo };