@lunora/shard-engine 1.0.0-alpha.13 → 1.0.0-alpha.130
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.
- package/README.md +1 -1
- package/dist/conformance/index.mjs +1 -1
- package/dist/index.d.mts +761 -158
- package/dist/index.d.ts +761 -158
- package/dist/index.mjs +1 -1
- package/dist/packem_shared/ADMIN_FUNCTIONS-B0QCN3HM.mjs +1 -0
- package/dist/packem_shared/AGGREGATE_SQL_FUNCTION-C_ZipS9R.mjs +1 -0
- package/dist/packem_shared/AGG_COUNT-CBe5drFS.mjs +1 -0
- package/dist/packem_shared/AUDIT_LOG_TABLE-CuIP7PJ0.mjs +8 -0
- package/dist/packem_shared/BIGINT_KEY_DIGITS-DE6yshOt.mjs +1 -0
- package/dist/packem_shared/CDC_LOG_TABLE-DsCz-DAV.mjs +18 -0
- package/dist/packem_shared/CLIENT_WATERMARK_TABLE-_CkdMnT2.mjs +7 -0
- package/dist/packem_shared/COMMIT_SEQ_FIELD-BcUO15fR.mjs +4 -0
- package/dist/packem_shared/CURSOR_PREFIX-6offuG6M.mjs +1 -0
- package/dist/packem_shared/CountRlsUnsupportedError-BvsDqfO2.mjs +1 -0
- package/dist/packem_shared/DATA_MIGRATION_STATE_TABLE-CmsAKy5V.mjs +31 -0
- package/dist/packem_shared/DEFAULT_MAX_RELATION_KEYS-BYfAkNAH.mjs +1 -0
- package/dist/packem_shared/DEFAULT_MAX_RELAYS-ZRhh4qpX.mjs +8 -0
- package/dist/packem_shared/DEFAULT_PROMOTION_THRESHOLDS-B3pRMuqb.mjs +1 -0
- package/dist/packem_shared/DEFAULT_TRANSACTION_LIMITS-Dmj5VBrV.mjs +1 -0
- package/dist/packem_shared/DurableStreamRunner-Dzge_ywD.mjs +1 -0
- package/dist/packem_shared/GEO_DEFAULT_PRECISION-CqpQZ-J_.mjs +1 -0
- package/dist/packem_shared/GLOBAL_SHAPE_SNAPSHOT_TABLE-Du0PbPdS.mjs +7 -0
- package/dist/packem_shared/GlobalPollTick-BNK4o-XT.mjs +1 -0
- package/dist/packem_shared/IDEMPOTENCY_TABLE-CymJf4r0.mjs +7 -0
- package/dist/packem_shared/MAIL_RETENTION-BP1GSXQ0.mjs +18 -0
- package/dist/packem_shared/MAX_SQL_ROWS-Dh_Ty0Zo.mjs +4 -0
- package/dist/packem_shared/MAX_TOKEN_LENGTH-BakL9FUy-B3VwYY8C.mjs +1 -0
- package/dist/packem_shared/NotUniqueError-CApXRyGS.mjs +1 -0
- package/dist/packem_shared/QUEUE_TABLE-jEc6-2wm.mjs +17 -0
- package/dist/packem_shared/RANK_TIEBREAK-D3ye2GsL.mjs +1 -0
- package/dist/packem_shared/REACTOR_STATE_TABLE-DHaBP_vb.mjs +28 -0
- package/dist/packem_shared/RELATED_DEFAULT_LIMIT-CVqN4JEu.mjs +1 -0
- package/dist/packem_shared/RELATION_EXISTS_KEY-wxgj6rSL.mjs +1 -0
- package/dist/packem_shared/REPROJECTION_MIGRATION_PREFIX-Czcb6_mO.mjs +1 -0
- package/dist/packem_shared/RLS_UNWRAP_SYMBOL-DQt9luIF.mjs +1 -0
- package/dist/packem_shared/ReactiveCache-DHhhLJtN.mjs +1 -0
- package/dist/packem_shared/SCAN_DEP-D7qE3iUe.mjs +1 -0
- package/dist/packem_shared/SCHEDULE_OUTBOX_TABLE-C_Me442c.mjs +11 -0
- package/dist/packem_shared/SCHEMA_HISTORY_MAX_VERSIONS-SQVxBlum.mjs +6 -0
- package/dist/packem_shared/SEARCH_STATE_TABLE-BThmEiED.mjs +1 -0
- package/dist/packem_shared/SHAPE_POKE_CURSOR_TABLE-B6MXBH-p.mjs +8 -0
- package/dist/packem_shared/ShapeDiffCache-iNO-hUiy.mjs +1 -0
- package/dist/packem_shared/ShardRunner-CrveaPId.mjs +1 -0
- package/dist/packem_shared/UNVOUCHABLE_DEP-C68htACn.mjs +1 -0
- package/dist/packem_shared/VECTOR_BACKFILL_MAX_PAGES-DY_3FYts.mjs +1 -0
- package/dist/packem_shared/WORKERD_SQLITE_LIMITS-BdNnnMj0.mjs +1 -0
- package/dist/packem_shared/accepts-null-D1zmJbyR.mjs +1 -0
- package/dist/packem_shared/aggregateTableName-B_CtIQCS.mjs +1 -0
- package/dist/packem_shared/appendStreamChunk-DF_Jrgpy.mjs +17 -0
- package/dist/packem_shared/applyOnDelete-BwxDC4lU.mjs +1 -0
- package/dist/packem_shared/archiveCdcSegment-CIiYU1FU.mjs +4 -0
- package/dist/packem_shared/{armRestore-BNzdvQ_o.mjs → armRestore-Bu1_8SUa.mjs} +1 -1
- package/dist/packem_shared/assertPatchAllowed-CA_H466g.mjs +1 -0
- package/dist/packem_shared/awaitWsDrain-N-oR29RI.mjs +1 -0
- package/dist/packem_shared/backfillAggregateIndexes-Dw4Azd33.mjs +1 -0
- package/dist/packem_shared/buildIndexRange-DQ3eWAGd.mjs +1 -0
- package/dist/packem_shared/buildPokeFrames-WR-hp0mX.mjs +1 -0
- package/dist/packem_shared/buildReprojectionMigration-DQV0q3w9.mjs +1 -0
- package/dist/packem_shared/buildSettings-BRkZd6_E.mjs +1 -0
- package/dist/packem_shared/buildShapeDiff-BHr3i1m6.mjs +1 -0
- package/dist/packem_shared/clearCompanionSignatures-8uVX84aT.mjs +1 -0
- package/dist/packem_shared/clearMemoryTables-Lu0S2GOb.mjs +1 -0
- package/dist/packem_shared/compileWhereSql-CKoO19by.mjs +1 -0
- package/dist/packem_shared/computeRankPage-DLSi_oBt.mjs +1 -0
- package/dist/packem_shared/createCompanionSync-DhYLePyV.mjs +1 -0
- package/dist/packem_shared/createReplicaLink-Bd7jCjDt.mjs +7 -0
- package/dist/packem_shared/createSystemReader-DcDLFfC-.mjs +1 -0
- package/dist/packem_shared/ctx-db-relay-shapes-CPwELrMf.mjs +17 -0
- package/dist/packem_shared/ctx-db-search-state-CrTLPmFN.mjs +1 -0
- package/dist/packem_shared/defineEngineContractSuite-CMbAZiZB.mjs +1 -0
- package/dist/packem_shared/describeRelationWrites-omar6-u9.mjs +1 -0
- package/dist/packem_shared/diffExternalSource-B0FZlDoL.mjs +1 -0
- package/dist/packem_shared/do-sql-DqU-17Fs.mjs +1 -0
- package/dist/packem_shared/effective-kind-BmG_zCAy.mjs +1 -0
- package/dist/packem_shared/envOptionalPositiveInt-D2pY-c64.mjs +1 -0
- package/dist/packem_shared/estimate-bytes-_k74s6LZ.mjs +1 -0
- package/dist/packem_shared/exportShardRows-yxw7vFf9.mjs +1 -0
- package/dist/packem_shared/fts-companion-DzfEHonU.mjs +1 -0
- package/dist/packem_shared/ftsCompanionDdl-Cka6_-Fm.mjs +1 -0
- package/dist/packem_shared/hasTrigger-CjlwI4le.mjs +1 -0
- package/dist/packem_shared/isInternalTableName-BoljO2tP.mjs +1 -0
- package/dist/packem_shared/isPushableWhere-BeYAOjUb.mjs +1 -0
- package/dist/packem_shared/isSoftDeleted-D5MeQSk0.mjs +9 -0
- package/dist/packem_shared/json-field-path-DeJW4U9z.mjs +1 -0
- package/dist/packem_shared/liftSourceId-CA3ENhXj.mjs +1 -0
- package/dist/packem_shared/materializeExternalRows-D2zEvCAa.mjs +1 -0
- package/dist/packem_shared/mergeChangedKeys-CF2mjYuy.mjs +1 -0
- package/dist/packem_shared/relation-operators-BEg-CvCH.mjs +1 -0
- package/dist/packem_shared/runDrizzle-B2GG3IJa.mjs +1 -0
- package/dist/packem_shared/runShardMigrations-BeqUbznb.mjs +5 -0
- package/dist/packem_shared/runSocketPool-CZJ2X9cF.mjs +1 -0
- package/dist/packem_shared/selectExpiredIds-B8PxwbIr.mjs +1 -0
- package/dist/packem_shared/selectShapeMembers-B1MIaRkE.mjs +1 -0
- package/dist/packem_shared/serializeSqlValue-DeoBMpZ2.mjs +1 -0
- package/dist/packem_shared/stubByName-C_P73AOx.mjs +1 -0
- package/dist/packem_shared/where-sql-DO1vOrhc.mjs +1 -0
- package/package.json +5 -4
- package/dist/packem_shared/ADMIN_FUNCTIONS-xKxYOiRC.mjs +0 -1
- package/dist/packem_shared/AGGREGATE_SQL_FUNCTION-CTo0-9iZ.mjs +0 -1
- package/dist/packem_shared/AGG_COUNT-B0Pb1nQZ.mjs +0 -1
- package/dist/packem_shared/AUDIT_LOG_TABLE-C6nwXFPd.mjs +0 -8
- package/dist/packem_shared/CDC_LOG_TABLE-D__2M4gX.mjs +0 -8
- package/dist/packem_shared/CLIENT_WATERMARK_TABLE-CzApRlyv.mjs +0 -7
- package/dist/packem_shared/CountRlsUnsupportedError-8BqPYQoP.mjs +0 -1
- package/dist/packem_shared/DATA_MIGRATION_STATE_TABLE-BrpAGtXf.mjs +0 -31
- package/dist/packem_shared/DEFAULT_MAX_RELATION_KEYS-C7Iky4H5.mjs +0 -1
- package/dist/packem_shared/DEFAULT_MAX_RELAYS-AcHLNxha.mjs +0 -1
- package/dist/packem_shared/DEFAULT_PROMOTION_THRESHOLDS-BdmnUGLO.mjs +0 -1
- package/dist/packem_shared/DEFAULT_TRANSACTION_LIMITS-BH5q0Ror.mjs +0 -1
- package/dist/packem_shared/GEO_DEFAULT_PRECISION-DyI5zggj.mjs +0 -1
- package/dist/packem_shared/GLOBAL_SHAPE_SNAPSHOT_TABLE-soMJDSBs.mjs +0 -7
- package/dist/packem_shared/IDEMPOTENCY_TABLE-Bvu9JkiL.mjs +0 -7
- package/dist/packem_shared/MAIL_RETENTION-BefR9Sei.mjs +0 -18
- package/dist/packem_shared/MAX_SQL_ROWS-nMwkxv5f.mjs +0 -2
- package/dist/packem_shared/NotUniqueError-GHJiYnzm.mjs +0 -1
- package/dist/packem_shared/QUEUE_TABLE-DgBqWrXX.mjs +0 -17
- package/dist/packem_shared/RANK_TIEBREAK-D541BOFR.mjs +0 -1
- package/dist/packem_shared/RELATION_EXISTS_KEY-BaqSIFU1.mjs +0 -1
- package/dist/packem_shared/RLS_UNWRAP_SYMBOL-DcqORh2s.mjs +0 -1
- package/dist/packem_shared/ReactiveCache-iWA9VRqk.mjs +0 -1
- package/dist/packem_shared/SCAN_DEP-D_yR9EeV.mjs +0 -1
- package/dist/packem_shared/SCHEMA_HISTORY_MAX_VERSIONS-BEU0CuW5.mjs +0 -6
- package/dist/packem_shared/SEARCH_STATE_TABLE-BZ_fxI5l.mjs +0 -1
- package/dist/packem_shared/ShardRunner-DIqVdWtk.mjs +0 -1
- package/dist/packem_shared/aggregateTableName-DKo6dwBP.mjs +0 -1
- package/dist/packem_shared/applyOnDelete-CxpItW0j.mjs +0 -1
- package/dist/packem_shared/applySelect-BjgwvZmI.mjs +0 -1
- package/dist/packem_shared/awaitWsDrain-DKycCSBS.mjs +0 -1
- package/dist/packem_shared/backfillAggregateIndexes-BVNrfFcI.mjs +0 -1
- package/dist/packem_shared/buildIndexRange-DFsdtPjD.mjs +0 -1
- package/dist/packem_shared/buildPokeFrames-CCxYXd2V.mjs +0 -1
- package/dist/packem_shared/buildSettings-COIJsw7a.mjs +0 -1
- package/dist/packem_shared/compileWhereSql-B4rPariq.mjs +0 -1
- package/dist/packem_shared/computeRankPage-B7U6t1fW.mjs +0 -1
- package/dist/packem_shared/createCompanionSync-Dym8huD9.mjs +0 -1
- package/dist/packem_shared/createReadFootprint-DIrrxRTE.mjs +0 -1
- package/dist/packem_shared/createSystemReader-DcDcrtM3.mjs +0 -1
- package/dist/packem_shared/ctx-db-companions-7fIu-E2H.mjs +0 -1
- package/dist/packem_shared/defineEngineContractSuite-Zg5xN9h4.mjs +0 -1
- package/dist/packem_shared/diffExternalSource-DMpkJta1.mjs +0 -1
- package/dist/packem_shared/estimate-bytes-DwQON1Ky.mjs +0 -1
- package/dist/packem_shared/exportShardRows-Bbi_JGfn.mjs +0 -1
- package/dist/packem_shared/hasTrigger-CbkOHExZ.mjs +0 -1
- package/dist/packem_shared/isSoftDeleted-doD_8AwX.mjs +0 -9
- package/dist/packem_shared/liftSourceId-DApAbu7Q.mjs +0 -1
- package/dist/packem_shared/materializeExternalRows-BR8MvZTz.mjs +0 -1
- package/dist/packem_shared/mergeChangedKeys-BXtUgIPW.mjs +0 -1
- package/dist/packem_shared/param-B5lF5Jd9.mjs +0 -1
- package/dist/packem_shared/runDrizzle-B6rnz3so.mjs +0 -1
- package/dist/packem_shared/runShardMigrations-DhZLG0bn.mjs +0 -5
- package/dist/packem_shared/runSocketPool-DPQLVyWF.mjs +0 -1
- package/dist/packem_shared/selectExpiredIds-DxFEwNlT.mjs +0 -1
- package/dist/packem_shared/selectShapeMemberIds-BD3JiZn-.mjs +0 -1
- package/dist/packem_shared/serializeSqlValue-DnpyaLcw.mjs +0 -1
- package/dist/packem_shared/stableStringify-BjLh4gvA.mjs +0 -1
- package/dist/packem_shared/stableWireKey-C4JfdJ_e.mjs +0 -1
- package/dist/packem_shared/wire-codec-D_fiax9d.mjs +0 -1
package/dist/index.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { LunoraError } from '@lunora/errors';
|
|
2
|
+
import { R2BucketLike, ShardHost, SocketHost, SocketHandle } from '@lunora/platform';
|
|
2
3
|
import { SQL, Name } from 'drizzle-orm';
|
|
3
|
-
|
|
4
|
+
export { stableStringify, stableWireKey } from '@lunora/wire';
|
|
4
5
|
interface KeyRange {
|
|
5
6
|
hi: string;
|
|
6
7
|
index: string;
|
|
@@ -22,15 +23,43 @@ declare const indexKeysForRow: (indexes: ReadonlyArray<{
|
|
|
22
23
|
name: string;
|
|
23
24
|
}>, row: Record<string, unknown>, serialize: (value: unknown) => unknown) => IndexKeyEntry[];
|
|
24
25
|
declare const keysTouchRanges: (ranges: ReadonlyArray<KeyRange> | undefined, keys: ReadonlyArray<IndexKeyEntry> | undefined) => boolean;
|
|
26
|
+
interface RelationWriteBase {
|
|
27
|
+
readonly colocated: boolean;
|
|
28
|
+
readonly refusal?: string;
|
|
29
|
+
readonly table: string;
|
|
30
|
+
}
|
|
31
|
+
interface KeyedRelationWriteInfo extends RelationWriteBase {
|
|
32
|
+
readonly field: string;
|
|
33
|
+
readonly kind: "many" | "one";
|
|
34
|
+
readonly nullable: boolean;
|
|
35
|
+
readonly references: string;
|
|
36
|
+
readonly refusalNow?: never;
|
|
37
|
+
readonly through?: never;
|
|
38
|
+
}
|
|
39
|
+
interface ThroughRelationWriteInfo extends RelationWriteBase {
|
|
40
|
+
readonly kind: "many";
|
|
41
|
+
readonly pairIsOnlyUnique: boolean;
|
|
42
|
+
readonly refusalNow: () => string | undefined;
|
|
43
|
+
readonly through: {
|
|
44
|
+
readonly from: string;
|
|
45
|
+
readonly table: string;
|
|
46
|
+
readonly to: string;
|
|
47
|
+
};
|
|
48
|
+
}
|
|
49
|
+
type RelationWriteInfo = KeyedRelationWriteInfo | ThroughRelationWriteInfo;
|
|
50
|
+
type RelationWriteMap = Readonly<Record<string, Readonly<Record<string, RelationWriteInfo>>>>;
|
|
51
|
+
declare const describeRelationWrites: (schema: SchemaLike, inTransaction?: () => boolean) => RelationWriteMap;
|
|
25
52
|
type SystemTableName = "_scheduled_functions" | "_storage";
|
|
26
53
|
interface ScheduledFunctionDoc {
|
|
27
54
|
args: Record<string, unknown>;
|
|
28
55
|
attempts?: number;
|
|
29
56
|
enqueuedAt: number;
|
|
30
|
-
functionPath
|
|
57
|
+
functionPath?: string;
|
|
31
58
|
id: string;
|
|
59
|
+
pool?: string;
|
|
32
60
|
scheduledFor: number;
|
|
33
61
|
shardKey?: string;
|
|
62
|
+
workflow?: string;
|
|
34
63
|
}
|
|
35
64
|
interface StorageMetadata {
|
|
36
65
|
contentType?: string;
|
|
@@ -86,6 +115,75 @@ interface WhereInput {
|
|
|
86
115
|
OR?: WhereInput[];
|
|
87
116
|
}
|
|
88
117
|
declare const RELATION_EXISTS_KEY = "__relationExists";
|
|
118
|
+
interface SubscriptionQuery {
|
|
119
|
+
args?: Record<string, unknown>;
|
|
120
|
+
functionPath?: string;
|
|
121
|
+
sinceEpoch?: string;
|
|
122
|
+
sinceSeq?: number;
|
|
123
|
+
table?: string;
|
|
124
|
+
}
|
|
125
|
+
interface ShapeSubscriptionQuery {
|
|
126
|
+
args?: Record<string, unknown>;
|
|
127
|
+
name: string;
|
|
128
|
+
sinceEpoch?: string;
|
|
129
|
+
sinceSeq?: number;
|
|
130
|
+
}
|
|
131
|
+
interface SubscriptionEnvelope {
|
|
132
|
+
caps?: string[];
|
|
133
|
+
clientId?: string;
|
|
134
|
+
context?: Record<string, unknown>;
|
|
135
|
+
data?: unknown;
|
|
136
|
+
generation?: number;
|
|
137
|
+
id: string;
|
|
138
|
+
query?: SubscriptionQuery;
|
|
139
|
+
shape?: {
|
|
140
|
+
args?: Record<string, unknown>;
|
|
141
|
+
name: string;
|
|
142
|
+
};
|
|
143
|
+
sinceCheckpoint?: number;
|
|
144
|
+
sinceChunk?: number;
|
|
145
|
+
sinceEpoch?: string;
|
|
146
|
+
topic?: string;
|
|
147
|
+
type: "ack" | "connect" | "shape_subscribe" | "shape_unsubscribe" | "stream" | "subscribe" | "unsubscribe" | "whisper" | "whisper_subscribe" | "whisper_unsubscribe";
|
|
148
|
+
}
|
|
149
|
+
interface RpcRequest {
|
|
150
|
+
args?: Record<string, unknown>;
|
|
151
|
+
functionPath: string;
|
|
152
|
+
}
|
|
153
|
+
interface SocketAttachment {
|
|
154
|
+
admin?: boolean;
|
|
155
|
+
adminBinding?: string;
|
|
156
|
+
clientId?: string;
|
|
157
|
+
connected?: boolean;
|
|
158
|
+
connectionId?: string;
|
|
159
|
+
context?: Record<string, unknown>;
|
|
160
|
+
expiresAt?: number;
|
|
161
|
+
identity?: Record<string, unknown>;
|
|
162
|
+
ip?: string;
|
|
163
|
+
pageDeltas?: boolean;
|
|
164
|
+
shapes?: Record<string, ShapeSubscriptionQuery>;
|
|
165
|
+
subs: Record<string, SubscriptionQuery>;
|
|
166
|
+
userId?: string;
|
|
167
|
+
whispers?: string[];
|
|
168
|
+
}
|
|
169
|
+
interface ResolvedShape {
|
|
170
|
+
columns?: ReadonlyArray<string>;
|
|
171
|
+
effectiveWhere?: WhereInput;
|
|
172
|
+
global?: boolean;
|
|
173
|
+
table: string;
|
|
174
|
+
}
|
|
175
|
+
interface SubscriptionIdentity {
|
|
176
|
+
identity?: Record<string, unknown>;
|
|
177
|
+
ip?: string;
|
|
178
|
+
userId?: string;
|
|
179
|
+
}
|
|
180
|
+
interface ShardSocketLike {
|
|
181
|
+
readonly bufferedAmount?: number;
|
|
182
|
+
close?: (code?: number, reason?: string) => void;
|
|
183
|
+
deserializeAttachment?: () => unknown;
|
|
184
|
+
send: (data: string) => void;
|
|
185
|
+
serializeAttachment?: (value: unknown) => void;
|
|
186
|
+
}
|
|
89
187
|
type AggregateOp = "avg" | "count" | "max" | "min" | "sum";
|
|
90
188
|
interface AggregateIndexDefinitionLike {
|
|
91
189
|
readonly by?: ReadonlyArray<string>;
|
|
@@ -137,6 +235,11 @@ interface ColumnMetaLike {
|
|
|
137
235
|
interface ValidatorLike {
|
|
138
236
|
readonly _meta?: {
|
|
139
237
|
readonly column?: ColumnMetaLike;
|
|
238
|
+
readonly inner?: ValidatorLike;
|
|
239
|
+
readonly members?: ReadonlyArray<ValidatorLike>;
|
|
240
|
+
readonly shape?: Readonly<Record<string, ValidatorLike>>;
|
|
241
|
+
readonly tableName?: string;
|
|
242
|
+
readonly value?: unknown;
|
|
140
243
|
};
|
|
141
244
|
readonly kind?: string;
|
|
142
245
|
readonly parse?: (value: unknown) => unknown;
|
|
@@ -144,7 +247,7 @@ interface ValidatorLike {
|
|
|
144
247
|
type TriggerTimingLike = "after" | "before";
|
|
145
248
|
type TriggerOpLike = "delete" | "insert" | "update";
|
|
146
249
|
interface SchedulableWorkflowReferenceLike {
|
|
147
|
-
readonly
|
|
250
|
+
readonly className?: string;
|
|
148
251
|
readonly isLunoraWorkflow: true;
|
|
149
252
|
readonly name?: string;
|
|
150
253
|
}
|
|
@@ -178,11 +281,18 @@ interface SchemaLike {
|
|
|
178
281
|
readonly rlsMode?: "required";
|
|
179
282
|
readonly tables: Record<string, TableDefinitionLike>;
|
|
180
283
|
}
|
|
284
|
+
type PatchVerifier = (previous: Record<string, unknown>, next: Record<string, unknown>) => boolean;
|
|
285
|
+
interface PatchWriteOptions {
|
|
286
|
+
verify?: PatchVerifier;
|
|
287
|
+
}
|
|
181
288
|
interface TableDefinitionLike {
|
|
182
289
|
readonly aggregateIndexes?: ReadonlyArray<AggregateIndexDefinitionLike>;
|
|
290
|
+
readonly commitOrderedMode?: boolean;
|
|
291
|
+
readonly dropStalePatchesMode?: boolean;
|
|
183
292
|
readonly geoIndexes?: ReadonlyArray<GeoIndexDefinitionLike>;
|
|
184
293
|
readonly indexes: ReadonlyArray<IndexDefinitionLike>;
|
|
185
294
|
readonly isPublic?: boolean;
|
|
295
|
+
readonly memoryMode?: boolean;
|
|
186
296
|
readonly rankIndexes?: ReadonlyArray<RankIndexDefinitionLike>;
|
|
187
297
|
readonly relationMap?: Record<string, RelationDefinitionLike>;
|
|
188
298
|
readonly searchIndexes?: ReadonlyArray<SearchIndexDefinitionLike>;
|
|
@@ -200,13 +310,25 @@ interface TableDefinitionLike {
|
|
|
200
310
|
field: string;
|
|
201
311
|
};
|
|
202
312
|
}
|
|
203
|
-
interface
|
|
313
|
+
interface KeyedRelationDefinitionLike {
|
|
204
314
|
readonly field: string;
|
|
205
315
|
readonly kind: "many" | "one";
|
|
206
316
|
readonly onDelete?: OnDeleteActionLike;
|
|
207
317
|
readonly references: string;
|
|
208
318
|
readonly table: string;
|
|
319
|
+
readonly through?: never;
|
|
320
|
+
}
|
|
321
|
+
interface RelationThroughLike {
|
|
322
|
+
readonly from: string;
|
|
323
|
+
readonly table: string;
|
|
324
|
+
readonly to: string;
|
|
325
|
+
}
|
|
326
|
+
interface ThroughRelationDefinitionLike {
|
|
327
|
+
readonly kind: "many";
|
|
328
|
+
readonly table: string;
|
|
329
|
+
readonly through: RelationThroughLike;
|
|
209
330
|
}
|
|
331
|
+
type RelationDefinitionLike = KeyedRelationDefinitionLike | ThroughRelationDefinitionLike;
|
|
210
332
|
type OnDeleteActionLike = "cascade" | "restrict" | "set null";
|
|
211
333
|
interface NestedWith {
|
|
212
334
|
limit?: number;
|
|
@@ -219,17 +341,16 @@ interface WithInput {
|
|
|
219
341
|
[relationName: string]: NestedWith | Record<string, true> | boolean | undefined;
|
|
220
342
|
_count?: Record<string, true>;
|
|
221
343
|
}
|
|
222
|
-
interface
|
|
223
|
-
|
|
224
|
-
relation: RelationDefinitionLike;
|
|
225
|
-
row: Record<string, unknown>;
|
|
226
|
-
tableName: string;
|
|
344
|
+
interface FanOutBudget {
|
|
345
|
+
remaining: number;
|
|
227
346
|
}
|
|
228
347
|
interface ResolveWithOptions {
|
|
348
|
+
fanOutBudget?: FanOutBudget;
|
|
229
349
|
fetcher: (tableName: string, args: QueryArgs) => Promise<QueryPage>;
|
|
230
350
|
groupedCounter: (tableName: string, whereField: string, values: unknown[], policyWhere?: WhereInput) => Promise<Map<unknown, number>>;
|
|
231
351
|
parents: Record<string, unknown>[];
|
|
232
352
|
relationBaseWhere?: (table: string) => undefined | WhereInput;
|
|
353
|
+
relationMask?: RelationMask;
|
|
233
354
|
schema: {
|
|
234
355
|
readonly tables: Record<string, TableDefinitionLike>;
|
|
235
356
|
};
|
|
@@ -242,28 +363,85 @@ interface ResolveWithResult {
|
|
|
242
363
|
rows: Record<string, unknown>[];
|
|
243
364
|
}
|
|
244
365
|
type SortDirection = "asc" | "desc";
|
|
245
|
-
type
|
|
366
|
+
type NullPlacement = "first" | "last";
|
|
367
|
+
type OrderByInput = Record<string, SortDirection | {
|
|
368
|
+
nulls: NullPlacement;
|
|
369
|
+
sort: SortDirection;
|
|
370
|
+
}>;
|
|
246
371
|
interface QueryArgs {
|
|
247
372
|
baseWhere?: WhereInput;
|
|
248
373
|
cursor?: null | string;
|
|
249
374
|
includeDeleted?: boolean;
|
|
250
375
|
limit?: number;
|
|
376
|
+
omitContinueCursor?: boolean;
|
|
251
377
|
orderBy?: OrderByInput[];
|
|
252
378
|
relationBaseWhere?: (table: string) => undefined | WhereInput;
|
|
379
|
+
relationMask?: RelationMask;
|
|
253
380
|
restrictsCounts?: boolean;
|
|
254
381
|
select?: ReadonlyArray<string>;
|
|
255
382
|
where?: WhereInput;
|
|
256
383
|
with?: WithInput;
|
|
257
384
|
}
|
|
385
|
+
interface CrossShardReadArgs {
|
|
386
|
+
orderBy?: OrderByInput[];
|
|
387
|
+
relationPolicies?: Record<string, WhereInput>;
|
|
388
|
+
where?: WhereInput;
|
|
389
|
+
with?: WithInput;
|
|
390
|
+
}
|
|
391
|
+
type RelationMask = (table: string, rows: Record<string, unknown>[]) => Record<string, unknown>[];
|
|
392
|
+
interface QueryPlan {
|
|
393
|
+
params: unknown[];
|
|
394
|
+
plan: string[];
|
|
395
|
+
sql: string;
|
|
396
|
+
}
|
|
258
397
|
interface QueryPage {
|
|
259
398
|
continueCursor: null | string;
|
|
260
399
|
isDone: boolean;
|
|
261
400
|
page: Record<string, unknown>[];
|
|
262
401
|
splitCursor?: null | string;
|
|
263
402
|
}
|
|
403
|
+
interface RelationEdge {
|
|
404
|
+
readonly array: boolean;
|
|
405
|
+
readonly column: string;
|
|
406
|
+
readonly name: string;
|
|
407
|
+
readonly sourceTable: string;
|
|
408
|
+
readonly targetTable: string;
|
|
409
|
+
}
|
|
410
|
+
interface RelatedStartReference {
|
|
411
|
+
id: string;
|
|
412
|
+
table: string;
|
|
413
|
+
}
|
|
414
|
+
type RelatedStart = (Record<string, unknown> & {
|
|
415
|
+
_id: string;
|
|
416
|
+
}) | RelatedStartReference;
|
|
417
|
+
type RelatedDirection = "both" | "in" | "out";
|
|
418
|
+
interface RelatedOptions {
|
|
419
|
+
cursor?: null | string;
|
|
420
|
+
depth?: number;
|
|
421
|
+
direction?: RelatedDirection;
|
|
422
|
+
edges?: ReadonlyArray<string>;
|
|
423
|
+
limit?: number;
|
|
424
|
+
relationBaseWhere?: (table: string) => undefined | WhereInput;
|
|
425
|
+
relationMask?: RelationMask;
|
|
426
|
+
}
|
|
427
|
+
interface RelatedNode {
|
|
428
|
+
depth: number;
|
|
429
|
+
document: Record<string, unknown>;
|
|
430
|
+
path: ReadonlyArray<string>;
|
|
431
|
+
pathIds: ReadonlyArray<string>;
|
|
432
|
+
score: number;
|
|
433
|
+
table: string;
|
|
434
|
+
}
|
|
435
|
+
interface RelatedPage {
|
|
436
|
+
continueCursor: null | string;
|
|
437
|
+
isDone: boolean;
|
|
438
|
+
nodes: RelatedNode[];
|
|
439
|
+
}
|
|
264
440
|
interface OrderKey {
|
|
265
441
|
direction: SortDirection;
|
|
266
442
|
field: string;
|
|
443
|
+
nullable: boolean;
|
|
444
|
+
nulls?: NullPlacement;
|
|
267
445
|
}
|
|
268
446
|
interface RestrictableQueryOptions {
|
|
269
447
|
baseWhere?: WhereInput;
|
|
@@ -399,10 +577,8 @@ interface LifecycleEvent {
|
|
|
399
577
|
shardKey: string;
|
|
400
578
|
userId: string | null;
|
|
401
579
|
}
|
|
402
|
-
interface LifecycleDispatchInfo {
|
|
580
|
+
interface LifecycleDispatchInfo extends SubscriptionIdentity {
|
|
403
581
|
event: LifecycleEvent;
|
|
404
|
-
identity: Record<string, unknown> | undefined;
|
|
405
|
-
userId: string | undefined;
|
|
406
582
|
}
|
|
407
583
|
interface MutationDelta {
|
|
408
584
|
indexKeys?: ReadonlyArray<IndexKeyEntry>;
|
|
@@ -414,6 +590,14 @@ interface MutationDelta {
|
|
|
414
590
|
interface DatabaseWriterLike {
|
|
415
591
|
aggregate: (tableName: string, options: AggregateOptions) => Promise<AggregateResult>;
|
|
416
592
|
asId?: (tableName: string, id: string) => string;
|
|
593
|
+
assertPatchAllowed?: (id: string, expectedTable?: string) => Promise<void>;
|
|
594
|
+
cdcChangedTables?: (sinceSeq: number, options?: {
|
|
595
|
+
cursorOnly?: boolean;
|
|
596
|
+
}) => Promise<{
|
|
597
|
+
cursor: number;
|
|
598
|
+
floor?: number;
|
|
599
|
+
tables: string[];
|
|
600
|
+
} | undefined>;
|
|
417
601
|
count: (tableName: string, where?: RestrictableQueryOptions | WhereInput) => Promise<number>;
|
|
418
602
|
delete: (id: string, expectedTable?: string, options?: {
|
|
419
603
|
hard?: boolean;
|
|
@@ -429,11 +613,13 @@ interface DatabaseWriterLike {
|
|
|
429
613
|
}, expectedTable?: string) => Promise<{
|
|
430
614
|
deleted: number;
|
|
431
615
|
}>;
|
|
616
|
+
deleteRereadTables?: ReadonlySet<string>;
|
|
432
617
|
deleteWhere?: (tableName: string, where: WhereInput, options?: {
|
|
433
618
|
limit?: number;
|
|
434
619
|
}) => Promise<{
|
|
435
620
|
deleted: number;
|
|
436
621
|
}>;
|
|
622
|
+
explain: (tableName: string, args?: QueryArgs) => Promise<QueryPlan>;
|
|
437
623
|
findFirst: (tableName: string, args?: QueryArgs) => Promise<Record<string, unknown> | null>;
|
|
438
624
|
findFirstOrThrow: (tableName: string, args?: QueryArgs) => Promise<Record<string, unknown>>;
|
|
439
625
|
findMany: (tableName: string, args?: QueryArgs) => Promise<QueryPage>;
|
|
@@ -456,7 +642,15 @@ interface DatabaseWriterLike {
|
|
|
456
642
|
tableName: string;
|
|
457
643
|
}>;
|
|
458
644
|
normalizeId: (tableName: string, id: string) => null | string;
|
|
459
|
-
patch: (id: string, patch: Record<string, unknown>, expectedTable?: string) => Promise<void>;
|
|
645
|
+
patch: (id: string, patch: Record<string, unknown>, expectedTable?: string, options?: PatchWriteOptions) => Promise<void>;
|
|
646
|
+
patchIf?: (tableName: string, id: string, args: {
|
|
647
|
+
patch: Record<string, unknown>;
|
|
648
|
+
verify?: PatchVerifier;
|
|
649
|
+
where: WhereInput;
|
|
650
|
+
}) => Promise<{
|
|
651
|
+
applied: boolean;
|
|
652
|
+
doc: Record<string, unknown> | null;
|
|
653
|
+
}>;
|
|
460
654
|
patchMany?: (patches: ReadonlyArray<{
|
|
461
655
|
id: string;
|
|
462
656
|
patch: Record<string, unknown>;
|
|
@@ -478,6 +672,9 @@ interface DatabaseWriterLike {
|
|
|
478
672
|
rankBefore?: (tableName: string, indexName: string, options: RankBeforeOptions) => Promise<RankBeforeResult>;
|
|
479
673
|
rankPage: (tableName: string, indexName: string, options?: RankPageOptions) => Promise<RankPage>;
|
|
480
674
|
rankPageRows?: (tableName: string, indexName: string, options?: RankPageOptions) => Promise<ShardRankPageResult>;
|
|
675
|
+
related?: (start: RelatedStart, options?: RelatedOptions) => Promise<RelatedPage>;
|
|
676
|
+
relationEdges?: ReadonlyArray<RelationEdge>;
|
|
677
|
+
relationWrites?: RelationWriteMap;
|
|
481
678
|
replace: (id: string, document: Record<string, unknown>, expectedTable?: string, options?: {
|
|
482
679
|
allowExplicitId?: boolean;
|
|
483
680
|
}) => Promise<void>;
|
|
@@ -516,7 +713,6 @@ interface ImportShardResult {
|
|
|
516
713
|
inserted: Record<string, number>;
|
|
517
714
|
}
|
|
518
715
|
declare const selectExportTables: (schema: SchemaLike, requested?: ReadonlyArray<string>) => string[];
|
|
519
|
-
declare const exportShardTable: (writer: DatabaseWriterLike, table: string, batchSize?: number) => AsyncGenerator<ExportRow, void, undefined>;
|
|
520
716
|
declare const exportShardRows: (writer: DatabaseWriterLike, schema: SchemaLike, args: ExportShardArgs) => AsyncGenerator<ExportRow, void, undefined>;
|
|
521
717
|
declare const validateImportRow: (schema: SchemaLike, table: string, record: Record<string, unknown>) => string | undefined;
|
|
522
718
|
declare const importShardRows: (writer: DatabaseWriterLike, schema: SchemaLike, args: ImportShardArgs) => Promise<ImportShardResult>;
|
|
@@ -564,8 +760,6 @@ declare const selectIndexForGroupBy: (indexes: ReadonlyArray<AggregateIndexDefin
|
|
|
564
760
|
index: AggregateIndexDefinitionLike;
|
|
565
761
|
partial: Record<string, unknown>;
|
|
566
762
|
};
|
|
567
|
-
declare const stableStringify: (value: unknown) => string;
|
|
568
|
-
declare const stableWireKey: (value: unknown) => string;
|
|
569
763
|
interface CacheEntry {
|
|
570
764
|
bytes: number;
|
|
571
765
|
deps: Set<string>;
|
|
@@ -591,6 +785,7 @@ declare class ReactiveCache {
|
|
|
591
785
|
private readonly maxBytes;
|
|
592
786
|
private readonly now;
|
|
593
787
|
private monotonic;
|
|
788
|
+
private generation;
|
|
594
789
|
constructor(options?: ReactiveCacheOptions);
|
|
595
790
|
run<R>(key: string, deps: Set<string>, run: () => Promise<R>, ranges?: () => ReadonlyArray<KeyRange>): Promise<R>;
|
|
596
791
|
invalidate(table: string, id: string, indexKeys?: ReadonlyArray<IndexKeyEntry>): string[];
|
|
@@ -651,12 +846,18 @@ interface RunTriggersOptions {
|
|
|
651
846
|
}
|
|
652
847
|
declare const runTriggers: (options: RunTriggersOptions) => Promise<void>;
|
|
653
848
|
declare const hasTrigger: (schema: SchemaLike, tableName: string, op: TriggerOpLike) => boolean;
|
|
849
|
+
interface SearchBackfillProgress {
|
|
850
|
+
done: boolean;
|
|
851
|
+
pages: number;
|
|
852
|
+
}
|
|
654
853
|
declare const backfillAggregateIndexes: (sql: SqlExec, schema: SchemaLike) => void;
|
|
655
854
|
declare const backfillRankIndexes: (sql: SqlExec, schema: SchemaLike) => void;
|
|
656
855
|
declare const backfillSearchIndexesForTable: (sql: SqlExec, tableName: string, definition: {
|
|
657
856
|
searchIndexes?: ReadonlyArray<SearchIndexDefinitionLike>;
|
|
658
857
|
}) => void;
|
|
659
|
-
declare const backfillSearchIndexes: (sql: SqlExec, schema: SchemaLike
|
|
858
|
+
declare const backfillSearchIndexes: (sql: SqlExec, schema: SchemaLike, options?: {
|
|
859
|
+
maxPages?: number;
|
|
860
|
+
}) => SearchBackfillProgress;
|
|
660
861
|
declare const CDC_LOG_TABLE = "__cdc_log";
|
|
661
862
|
interface CdcChange {
|
|
662
863
|
doc?: Record<string, unknown>;
|
|
@@ -666,19 +867,35 @@ interface CdcChange {
|
|
|
666
867
|
table: string;
|
|
667
868
|
ts: number;
|
|
668
869
|
}
|
|
669
|
-
declare const
|
|
870
|
+
declare const CDC_LOG_TABLE_SEQ_INDEX = "__cdc_log_table_seq";
|
|
871
|
+
declare const migrateCdcLog: (sql: SqlExec, options?: {
|
|
872
|
+
rowHistoryIndex?: boolean;
|
|
873
|
+
}) => void;
|
|
670
874
|
declare const appendCdcChange: (sql: SqlExec, ts: number, table: string, id: string, op: CdcChange["op"], doc: Record<string, unknown> | undefined) => void;
|
|
671
875
|
declare const readCdcChanges: (sql: SqlExec, options?: {
|
|
672
876
|
limit?: number;
|
|
673
877
|
sinceSeq?: number;
|
|
674
|
-
tables?: ReadonlySet<string>;
|
|
675
878
|
}) => {
|
|
676
879
|
changes: CdcChange[];
|
|
677
880
|
cursor: number;
|
|
678
881
|
};
|
|
679
|
-
declare const
|
|
882
|
+
declare const cdcTouchesTables: (sql: SqlExec, sinceSeq: number, tables: ReadonlySet<string>) => boolean;
|
|
883
|
+
declare const cdcCanVouchFor: (sql: SqlExec, deps: ReadonlySet<string>) => boolean;
|
|
884
|
+
interface CdcChangeKey {
|
|
885
|
+
id: string;
|
|
886
|
+
op: CdcChange["op"];
|
|
887
|
+
seq: number;
|
|
888
|
+
}
|
|
889
|
+
declare const readCdcChangeKeys: (sql: SqlExec, table: string, sinceSeq: number, upTo: number) => CdcChangeKey[];
|
|
890
|
+
declare const trimCdcChanges: (sql: SqlExec, throughSeq: number, maxRows: number) => void;
|
|
891
|
+
declare const compactCdcDocs: (sql: SqlExec, throughSeq: number, maxRows: number) => void;
|
|
892
|
+
declare const cdcSeqLeavingRows: (sql: SqlExec, keep: number) => number | undefined;
|
|
680
893
|
declare const readCdcCursor: (sql: SqlExec) => number;
|
|
894
|
+
declare const cursorBelowRetainedFloor: (floor: number | undefined, sinceSeq: number) => boolean;
|
|
895
|
+
declare const cdcTrimmedError: (floor: number, sinceSeq: number, scope: "global" | "shard") => LunoraError;
|
|
896
|
+
declare const cdcForkedError: (cursor: number, sinceSeq: number, scope: "global" | "shard", epoch?: string) => LunoraError;
|
|
681
897
|
declare const minCdcSeq: (sql: SqlExec) => number | undefined;
|
|
898
|
+
declare const minCdcReplayableSeq: (sql: SqlExec) => number | undefined;
|
|
682
899
|
declare const CDC_META_TABLE = "__cdc_meta";
|
|
683
900
|
declare const migrateCdcMeta: (sql: SqlExec) => void;
|
|
684
901
|
declare const readCdcEpoch: (sql: SqlExec) => string;
|
|
@@ -688,12 +905,6 @@ declare const CLIENT_WATERMARK_TABLE = "__client_watermark";
|
|
|
688
905
|
declare const migrateClientWatermark: (sql: SqlExec) => void;
|
|
689
906
|
declare const readClientWatermark: (sql: SqlExec, identity: string, clientId: string) => number;
|
|
690
907
|
declare const advanceClientWatermark: (sql: SqlExec, identity: string, clientId: string, mutationId: number) => void;
|
|
691
|
-
declare const GLOBAL_SHAPE_SNAPSHOT_TABLE = "__global_shape_snapshot";
|
|
692
|
-
declare const migrateGlobalShapeSnapshot: (sql: SqlExec) => void;
|
|
693
|
-
declare const readGlobalShapeSnapshot: (sql: SqlExec, connectionId: string, subId: string) => Map<string, string>;
|
|
694
|
-
declare const writeGlobalShapeSnapshot: (sql: SqlExec, connectionId: string, subId: string, snapshot: Map<string, string>) => void;
|
|
695
|
-
declare const deleteGlobalShapeSnapshot: (sql: SqlExec, connectionId: string, subId: string) => void;
|
|
696
|
-
declare const deleteGlobalShapeSnapshotsForConnection: (sql: SqlExec, connectionId: string) => void;
|
|
697
908
|
declare const IDEMPOTENCY_TABLE = "__idempotency";
|
|
698
909
|
interface IdempotentRecord {
|
|
699
910
|
resultJson: string;
|
|
@@ -710,50 +921,19 @@ declare const runShardMigrations: (sql: SqlExec, schema: SchemaLike, options?: {
|
|
|
710
921
|
json: string;
|
|
711
922
|
};
|
|
712
923
|
}) => void;
|
|
713
|
-
/**
|
|
714
|
-
* How far a search companion's backfill has progressed, and what the next pass
|
|
715
|
-
* should do about it.
|
|
716
|
-
*
|
|
717
|
-
* Neither stored analysis nor query policy, which is why it is its own module
|
|
718
|
-
* rather than a third responsibility bolted onto one of them: it is *progress*,
|
|
719
|
-
* the one piece of search state that is written as the index is built rather
|
|
720
|
-
* than decided when it is read.
|
|
721
|
-
*
|
|
722
|
-
* The policy below is shared because when each engine owned a copy they
|
|
723
|
-
* immediately disagreed about exactly the two cases that matter — whether a row
|
|
724
|
-
* with no recorded profile may be resumed (it may not; nothing says what
|
|
725
|
-
* analyzed it) and whether a never-started index is worth wiping (it is not;
|
|
726
|
-
* there is nothing in it).
|
|
727
|
-
*/
|
|
728
|
-
/**
|
|
729
|
-
* How far a companion's backfill has progressed, and under which analysis.
|
|
730
|
-
* Declared here rather than beside either engine's state table: both record the
|
|
731
|
-
* same three facts, and the decisions made from them are the shared policy
|
|
732
|
-
* below.
|
|
733
|
-
*/
|
|
734
|
-
interface SearchBackfillState {
|
|
735
|
-
/** Last `id` indexed, or `undefined` when no page has run yet. */
|
|
736
|
-
cursor: string | undefined;
|
|
737
|
-
/** True once a page came back short — the table is fully indexed. */
|
|
738
|
-
done: boolean;
|
|
739
|
-
/** Analyzer profile the stored rows were built with; `undefined` predates profile tracking. */
|
|
740
|
-
profile: string | undefined;
|
|
741
|
-
}
|
|
742
|
-
declare const SEARCH_STATE_TABLE = "__lunora_search_state";
|
|
743
|
-
declare const migrateSearchState: (sql: SqlExec) => void;
|
|
744
|
-
declare const readSearchBackfillState: (sql: SqlExec, companion: string) => SearchBackfillState;
|
|
745
|
-
declare const writeSearchBackfillState: (sql: SqlExec, companion: string, cursor: string | undefined, done: boolean, profile: string) => void;
|
|
746
924
|
interface ShapeRow {
|
|
747
925
|
doc: Record<string, unknown>;
|
|
748
926
|
id: string;
|
|
749
927
|
}
|
|
750
928
|
declare const selectShapeRows: (sql: SqlExec, table: string, effectiveWhere: WhereInput | undefined) => ShapeRow[];
|
|
751
|
-
declare const
|
|
929
|
+
declare const selectShapeMembers: (sql: SqlExec, table: string, effectiveWhere: WhereInput | undefined, ids: ReadonlyArray<string>) => Map<string, Record<string, unknown>>;
|
|
752
930
|
interface SqlExec {
|
|
753
931
|
exec: <Row = Record<string, unknown>>(sql: string, ...params: unknown[]) => SqlCursor<Row>;
|
|
754
932
|
}
|
|
755
933
|
interface SqlCursor<Row> extends Iterable<Row> {
|
|
934
|
+
readonly columnNames?: string[];
|
|
756
935
|
one: () => Row;
|
|
936
|
+
raw?: () => IterableIterator<unknown[]>;
|
|
757
937
|
toArray: () => Row[];
|
|
758
938
|
}
|
|
759
939
|
type IndexUseHook = (table: string, indexName: string, kind: "geo" | "index" | "rank" | "search") => void;
|
|
@@ -769,6 +949,7 @@ interface WriteEvent {
|
|
|
769
949
|
type WriteHook = (event: WriteEvent) => Promise<void> | void;
|
|
770
950
|
interface CtxDbOptions {
|
|
771
951
|
auth?: ServerDefaultContextLike["auth"];
|
|
952
|
+
baselineSeq?: () => number | undefined;
|
|
772
953
|
broadcast?: BroadcastDelta;
|
|
773
954
|
cache?: ReactiveCache;
|
|
774
955
|
cdc?: boolean;
|
|
@@ -777,10 +958,16 @@ interface CtxDbOptions {
|
|
|
777
958
|
globalDb?: DatabaseWriterLike;
|
|
778
959
|
headroom?: TransactionHeadroomTracker;
|
|
779
960
|
idGenerator?: IdGenerator;
|
|
961
|
+
inTransaction?: () => boolean;
|
|
780
962
|
maxRelationKeys?: number;
|
|
781
963
|
onIndexUse?: IndexUseHook;
|
|
782
964
|
onRead?: ReadHook;
|
|
783
965
|
onReadRange?: (range: KeyRange) => void;
|
|
966
|
+
onStalePatchDropped?: (event: {
|
|
967
|
+
fields: string[];
|
|
968
|
+
id: string;
|
|
969
|
+
table: string;
|
|
970
|
+
}) => void;
|
|
784
971
|
onWrite?: WriteHook;
|
|
785
972
|
relationExistsPushDown?: "always" | "auto" | "never";
|
|
786
973
|
scheduler?: SchedulerLike;
|
|
@@ -793,6 +980,8 @@ declare class NotUniqueError extends LunoraError {
|
|
|
793
980
|
constructor(message?: string);
|
|
794
981
|
}
|
|
795
982
|
declare const normalizeIdStructurally: (schema: SchemaLike, tableName: string, id: string) => null | string;
|
|
983
|
+
declare const assertNoExplicitUndefined: (op: "patch" | "patchIf" | "replace", document: Record<string, unknown>) => void;
|
|
984
|
+
declare const stripReservedPatchFields: (patch: Record<string, unknown>) => Record<string, unknown>;
|
|
796
985
|
declare const createShardCtxDb: (options: CtxDbOptions) => DatabaseWriterLike;
|
|
797
986
|
declare const AUDIT_LOG_TABLE = "__lunora_audit__";
|
|
798
987
|
interface AuditEntry {
|
|
@@ -816,68 +1005,24 @@ declare const readAuditLog: (sql: SqlExec, options?: {
|
|
|
816
1005
|
limit?: number;
|
|
817
1006
|
sinceSeq?: number;
|
|
818
1007
|
}) => AuditEntry[];
|
|
819
|
-
interface
|
|
820
|
-
|
|
821
|
-
|
|
822
|
-
|
|
823
|
-
|
|
824
|
-
|
|
825
|
-
|
|
826
|
-
|
|
827
|
-
|
|
828
|
-
|
|
829
|
-
|
|
830
|
-
|
|
831
|
-
|
|
832
|
-
|
|
833
|
-
|
|
834
|
-
|
|
835
|
-
|
|
836
|
-
|
|
837
|
-
query?: SubscriptionQuery;
|
|
838
|
-
shape?: {
|
|
839
|
-
args?: Record<string, unknown>;
|
|
840
|
-
name: string;
|
|
841
|
-
};
|
|
842
|
-
sinceCheckpoint?: number;
|
|
843
|
-
sinceEpoch?: string;
|
|
844
|
-
topic?: string;
|
|
845
|
-
type: "ack" | "connect" | "shape_subscribe" | "shape_unsubscribe" | "stream" | "subscribe" | "unsubscribe" | "whisper" | "whisper_subscribe" | "whisper_unsubscribe";
|
|
846
|
-
}
|
|
847
|
-
interface RpcRequest {
|
|
848
|
-
args?: Record<string, unknown>;
|
|
849
|
-
functionPath: string;
|
|
850
|
-
}
|
|
851
|
-
interface SocketAttachment {
|
|
852
|
-
admin?: boolean;
|
|
853
|
-
clientId?: string;
|
|
854
|
-
connected?: boolean;
|
|
855
|
-
connectionId?: string;
|
|
856
|
-
context?: Record<string, unknown>;
|
|
857
|
-
expiresAt?: number;
|
|
858
|
-
identity?: Record<string, unknown>;
|
|
859
|
-
shapes?: Record<string, ShapeSubscriptionQuery>;
|
|
860
|
-
subs: Record<string, SubscriptionQuery>;
|
|
861
|
-
userId?: string;
|
|
862
|
-
whispers?: string[];
|
|
863
|
-
}
|
|
864
|
-
interface ResolvedShape {
|
|
865
|
-
columns?: ReadonlyArray<string>;
|
|
866
|
-
effectiveWhere?: WhereInput;
|
|
867
|
-
global?: boolean;
|
|
868
|
-
table: string;
|
|
869
|
-
}
|
|
870
|
-
interface SubscriptionIdentity {
|
|
871
|
-
identity?: Record<string, unknown>;
|
|
872
|
-
userId?: string;
|
|
873
|
-
}
|
|
874
|
-
interface ShardSocketLike {
|
|
875
|
-
readonly bufferedAmount?: number;
|
|
876
|
-
close?: (code?: number, reason?: string) => void;
|
|
877
|
-
deserializeAttachment?: () => unknown;
|
|
878
|
-
send: (data: string) => void;
|
|
879
|
-
serializeAttachment?: (value: unknown) => void;
|
|
880
|
-
}
|
|
1008
|
+
interface CdcArchiveScope {
|
|
1009
|
+
epoch: string;
|
|
1010
|
+
shard: string;
|
|
1011
|
+
}
|
|
1012
|
+
declare const readCdcArchivedThrough: (sql: SqlExec) => number;
|
|
1013
|
+
declare const writeCdcArchivedThrough: (sql: SqlExec, seq: number) => void;
|
|
1014
|
+
declare const archiveCdcSegment: (bucket: R2BucketLike, scope: CdcArchiveScope, changes: CdcChange[]) => Promise<void>;
|
|
1015
|
+
declare const cdcArchiveRewound: (bucket: R2BucketLike, scope: CdcArchiveScope, archivedThrough: number) => Promise<boolean>;
|
|
1016
|
+
declare const readArchivedCdcChanges: (bucket: R2BucketLike, scope: CdcArchiveScope, sinceSeq: number, limit: number | undefined) => Promise<{
|
|
1017
|
+
changes: CdcChange[];
|
|
1018
|
+
cursor: number;
|
|
1019
|
+
} | undefined>;
|
|
1020
|
+
declare const COMMIT_SEQ_TABLE = "__commit_seq";
|
|
1021
|
+
declare const COMMIT_SEQ_FIELD = "_commitSeq";
|
|
1022
|
+
declare const migrateCommitSeq: (sql: SqlExec) => void;
|
|
1023
|
+
declare const readCommitSeq: (sql: SqlExec) => number;
|
|
1024
|
+
declare const allocateCommitSeq: (sql: SqlExec) => number;
|
|
1025
|
+
declare const clearCompanionSignatures: (sql: SqlExec) => void;
|
|
881
1026
|
interface CompanionSyncDeps {
|
|
882
1027
|
broadcast: (delta: MutationDelta) => void;
|
|
883
1028
|
indexKeysFor: (table: string, document?: Record<string, unknown>) => ReadonlyArray<{
|
|
@@ -901,6 +1046,19 @@ interface CompanionSync {
|
|
|
901
1046
|
syncSearch: (tableName: string, id: string, document: Record<string, unknown> | undefined, previous?: Record<string, unknown>) => void;
|
|
902
1047
|
}
|
|
903
1048
|
declare const createCompanionSync: (deps: CompanionSyncDeps) => CompanionSync;
|
|
1049
|
+
declare const GLOBAL_SHAPE_SNAPSHOT_TABLE = "__global_shape_snapshot";
|
|
1050
|
+
declare const migrateGlobalShapeSnapshot: (sql: SqlExec) => void;
|
|
1051
|
+
declare const readGlobalShapeSnapshot: (sql: SqlExec, connectionId: string, subId: string) => Map<string, string> | undefined;
|
|
1052
|
+
declare const writeGlobalShapeSnapshot: (sql: SqlExec, connectionId: string, subId: string, snapshot: Map<string, string>) => void;
|
|
1053
|
+
declare const deleteGlobalShapeSnapshot: (sql: SqlExec, connectionId: string, subId: string) => void;
|
|
1054
|
+
declare const deleteGlobalShapeSnapshotsForConnection: (sql: SqlExec, connectionId: string) => void;
|
|
1055
|
+
declare const isMemoryTable: (definition: TableDefinitionLike | undefined) => boolean;
|
|
1056
|
+
declare const memoryTableNames: (schema: SchemaLike) => string[];
|
|
1057
|
+
declare const clearMemoryTables: (sql: SqlExec, schema: SchemaLike) => number;
|
|
1058
|
+
declare const resolveRankSeekTuple: (options: {
|
|
1059
|
+
after?: RankPageRowKey;
|
|
1060
|
+
cursor?: null | string;
|
|
1061
|
+
}) => unknown[] | undefined;
|
|
904
1062
|
interface RankPageDeps {
|
|
905
1063
|
assertRankPartitionLocal: (tableName: string, definition: TableDefinitionLike, index: RankIndexDefinitionLike) => void;
|
|
906
1064
|
ensureRankBackfilled: (tableName: string, index: RankIndexDefinitionLike) => void;
|
|
@@ -918,8 +1076,68 @@ interface RankPageComputation {
|
|
|
918
1076
|
key: RankPageRowKey;
|
|
919
1077
|
}[];
|
|
920
1078
|
}
|
|
921
|
-
declare const hydrateDocsById: (deps: RankPageDeps, tableName: string, ids: ReadonlyArray<string>) => Map<string, Record<string, unknown>>;
|
|
922
1079
|
declare const computeRankPage: (deps: RankPageDeps, tableName: string, indexName: string, rankPageOptions: RankPageOptions) => RankPageComputation;
|
|
1080
|
+
declare const SCHEDULE_OUTBOX_TABLE = "__schedule_outbox";
|
|
1081
|
+
interface ScheduleOutboxRow {
|
|
1082
|
+
attempts: number;
|
|
1083
|
+
envelopeJson: string;
|
|
1084
|
+
id: string;
|
|
1085
|
+
nextAttemptAt: number;
|
|
1086
|
+
}
|
|
1087
|
+
interface ScheduleOutboxEnvelope {
|
|
1088
|
+
args: unknown;
|
|
1089
|
+
options: Record<string, unknown> | undefined;
|
|
1090
|
+
target: unknown;
|
|
1091
|
+
when: number;
|
|
1092
|
+
}
|
|
1093
|
+
interface ScheduleOutbox {
|
|
1094
|
+
admit: (target: string) => number | undefined;
|
|
1095
|
+
forget: (id: string) => void;
|
|
1096
|
+
record: (id: string, envelope: ScheduleOutboxEnvelope) => void;
|
|
1097
|
+
wake: () => void;
|
|
1098
|
+
}
|
|
1099
|
+
declare const migrateScheduleOutbox: (sql: SqlExec) => void;
|
|
1100
|
+
declare const recordScheduleOutbox: (sql: SqlExec, id: string, envelopeJson: string, now: number) => void;
|
|
1101
|
+
declare const forgetScheduleOutbox: (sql: SqlExec, id: string) => void;
|
|
1102
|
+
declare const readDueScheduleOutbox: (sql: SqlExec, nowMs: number, limit: number) => ScheduleOutboxRow[];
|
|
1103
|
+
declare const deferScheduleOutbox: (sql: SqlExec, id: string, attempts: number, nextAttemptAt: number) => void;
|
|
1104
|
+
declare const parkScheduleOutbox: (sql: SqlExec, id: string, attempts: number) => void;
|
|
1105
|
+
declare const probeScheduleOutbox: (sql: SqlExec) => {
|
|
1106
|
+
dueAt: number | undefined;
|
|
1107
|
+
populated: boolean;
|
|
1108
|
+
};
|
|
1109
|
+
declare const trimScheduleOutbox: (sql: SqlExec, olderThanTs: number) => void;
|
|
1110
|
+
/**
|
|
1111
|
+
* How far a companion's backfill has progressed, and under which analysis.
|
|
1112
|
+
* Declared here rather than beside either engine's state table: both record the
|
|
1113
|
+
* same three facts, and the decisions made from them are the shared policy
|
|
1114
|
+
* below.
|
|
1115
|
+
*/
|
|
1116
|
+
interface BackfillState {
|
|
1117
|
+
/** Last `id` indexed, or `undefined` when no page has run yet. */
|
|
1118
|
+
cursor: string | undefined;
|
|
1119
|
+
/** True once a page came back short — the table is fully indexed. */
|
|
1120
|
+
done: boolean;
|
|
1121
|
+
/** Analyzer profile the stored rows were built with; `undefined` predates profile tracking. */
|
|
1122
|
+
profile: string | undefined;
|
|
1123
|
+
}
|
|
1124
|
+
declare const SEARCH_STATE_TABLE = "__lunora_search_state";
|
|
1125
|
+
declare const migrateSearchState: (sql: SqlExec) => void;
|
|
1126
|
+
declare const readSearchBackfillState: (sql: SqlExec, companion: string) => BackfillState;
|
|
1127
|
+
declare const writeSearchBackfillState: (sql: SqlExec, companion: string, cursor: string | undefined, done: boolean, profile: string) => void;
|
|
1128
|
+
declare const SHAPE_POKE_CURSOR_TABLE = "__shape_poke_cursor";
|
|
1129
|
+
declare const migrateShapePokeCursor: (sql: SqlExec) => void;
|
|
1130
|
+
declare const readShapePokeCursor: (sql: SqlExec, connectionId: string, subId: string) => number | undefined;
|
|
1131
|
+
declare const writeShapePokeCursor: (sql: SqlExec, connectionId: string, subId: string, cursor: number) => void;
|
|
1132
|
+
interface ShapePokeCursorRow {
|
|
1133
|
+
connectionId: string;
|
|
1134
|
+
cursor: number;
|
|
1135
|
+
subId: string;
|
|
1136
|
+
}
|
|
1137
|
+
declare const writeShapePokeCursors: (sql: SqlExec, rows: ReadonlyArray<ShapePokeCursorRow>) => void;
|
|
1138
|
+
declare const minShapePokeCursor: (sql: SqlExec) => number | undefined;
|
|
1139
|
+
declare const deleteShapePokeCursor: (sql: SqlExec, connectionId: string, subId: string) => void;
|
|
1140
|
+
declare const deleteShapePokeCursorsForConnection: (sql: SqlExec, connectionId: string) => void;
|
|
923
1141
|
declare const DATA_MIGRATION_STATE_TABLE = "__lunora_migrations";
|
|
924
1142
|
type MigrationDirection = "down" | "up";
|
|
925
1143
|
type MigrationStatus = "completed" | "failed" | "in_progress";
|
|
@@ -983,6 +1201,29 @@ interface DependencyTracker {
|
|
|
983
1201
|
declare const createDependencyTracker: () => DependencyTracker;
|
|
984
1202
|
declare const runSql: <Row = Record<string, unknown>>(sql: SqlExec, query: string, ...params: unknown[]) => SqlCursor<Row>;
|
|
985
1203
|
declare const runDrizzle: <Row = Record<string, unknown>>(exec: SqlExec, query: SQL) => SqlCursor<Row>;
|
|
1204
|
+
type RangeOperandType = "boolean" | "number" | "string";
|
|
1205
|
+
interface WhereFragments<T> {
|
|
1206
|
+
binary: (reference: T, comparator: string, value: unknown) => T;
|
|
1207
|
+
connect: (left: T, right: T, connector: "AND" | "OR") => T;
|
|
1208
|
+
constant: (value: boolean) => T;
|
|
1209
|
+
contains: (reference: T, term: T) => T;
|
|
1210
|
+
inList: (reference: T, items: ReadonlyArray<unknown>, negated: boolean, budget: number) => T;
|
|
1211
|
+
negate: (inner: T) => T;
|
|
1212
|
+
nullCheck: (reference: T, negated: boolean) => T;
|
|
1213
|
+
value: (value: unknown) => T;
|
|
1214
|
+
}
|
|
1215
|
+
type FieldRefSql<T> = (field: string) => T;
|
|
1216
|
+
type SerializeValue = (value: unknown, field: string) => unknown;
|
|
1217
|
+
interface WhereSqlStrategy<T = SQL> {
|
|
1218
|
+
containsExpr?: (reference: T, term: T) => T;
|
|
1219
|
+
fieldRef: FieldRefSql<T>;
|
|
1220
|
+
inList?: (reference: T, items: ReadonlyArray<unknown>, negated: boolean, budget?: number) => T;
|
|
1221
|
+
rangeTypeGuard: (field: string, type: RangeOperandType) => T;
|
|
1222
|
+
relationExists?: (request: unknown) => T;
|
|
1223
|
+
serialize: SerializeValue;
|
|
1224
|
+
}
|
|
1225
|
+
declare const serverInList: (engine: "mysql" | "postgres") => (reference: SQL, items: ReadonlyArray<unknown>, negated: boolean, budget?: number) => SQL;
|
|
1226
|
+
declare const compileWhereSql: <T = SQL>(where: WhereInput | undefined, strategy: WhereSqlStrategy<T>, fragments?: WhereFragments<T>, reservedParams?: number) => T | undefined;
|
|
986
1227
|
declare const quoteIdentifier: (name: string) => string;
|
|
987
1228
|
declare const serializeSqlValue: (value: unknown) => unknown;
|
|
988
1229
|
declare const DOC_COLUMN = "__doc__";
|
|
@@ -996,10 +1237,16 @@ declare const AGG_KEY: Name;
|
|
|
996
1237
|
declare const AGG_VALUE: Name;
|
|
997
1238
|
declare const AGG_COUNT: Name;
|
|
998
1239
|
declare const aggUpsertSql: (aggTable: string, key: unknown, value: unknown, count: unknown, set: SQL) => SQL;
|
|
999
|
-
declare const tableColumns: (definition: TableDefinitionLike) => [string, ColumnMetaLike]
|
|
1240
|
+
declare const tableColumns: (definition: TableDefinitionLike) => ReadonlyArray<readonly [string, ColumnMetaLike]>;
|
|
1000
1241
|
declare const rowToDocument: (row: Record<string, unknown> | undefined) => Record<string, unknown> | undefined;
|
|
1001
1242
|
declare const tryRowToDocument: (row: Record<string, unknown> | undefined) => Record<string, unknown> | undefined;
|
|
1002
1243
|
declare const isFtsAvailable: (sql: SqlExec) => boolean;
|
|
1244
|
+
declare const WORKERD_SQLITE_LIMITS: {
|
|
1245
|
+
readonly boundParams: 100;
|
|
1246
|
+
readonly compoundSelect: 5;
|
|
1247
|
+
readonly likePattern: 50;
|
|
1248
|
+
readonly sqlTextLength: 100000;
|
|
1249
|
+
};
|
|
1003
1250
|
type SqlEngine = "mysql" | "postgres" | "sqlite";
|
|
1004
1251
|
interface RenderedSql {
|
|
1005
1252
|
params: unknown[];
|
|
@@ -1007,6 +1254,79 @@ interface RenderedSql {
|
|
|
1007
1254
|
}
|
|
1008
1255
|
declare const renderSql: (engine: SqlEngine, query: SQL) => RenderedSql;
|
|
1009
1256
|
declare const param: (value: unknown) => SQL;
|
|
1257
|
+
declare const unionAll: (branches: ReadonlyArray<SQL>) => SQL;
|
|
1258
|
+
declare const sqliteInList: (reference: SQL, items: ReadonlyArray<unknown>, negated: boolean, budget?: number) => SQL;
|
|
1259
|
+
type DurableStreamStatus = "complete" | "error" | "running";
|
|
1260
|
+
interface DurableStreamRun {
|
|
1261
|
+
error?: string;
|
|
1262
|
+
errorCode?: string;
|
|
1263
|
+
lastSeq: number;
|
|
1264
|
+
startedAt: number;
|
|
1265
|
+
status: DurableStreamStatus;
|
|
1266
|
+
}
|
|
1267
|
+
interface DurableStreamChunk {
|
|
1268
|
+
dataJson: string;
|
|
1269
|
+
seq: number;
|
|
1270
|
+
}
|
|
1271
|
+
declare const migrateDurableStreams: (sql: SqlExec) => void;
|
|
1272
|
+
declare const readStreamRun: (sql: SqlExec, runKey: string) => DurableStreamRun | undefined;
|
|
1273
|
+
declare const claimStreamRun: (sql: SqlExec, runKey: string, startedAt: number, ttlMs: number) => boolean;
|
|
1274
|
+
declare const deleteStreamRun: (sql: SqlExec, runKey: string) => void;
|
|
1275
|
+
declare const appendStreamChunk: (sql: SqlExec, runKey: string, seq: number, dataJson: string) => void;
|
|
1276
|
+
declare const readStreamChunks: (sql: SqlExec, runKey: string, sinceSeq: number) => DurableStreamChunk[];
|
|
1277
|
+
declare const finishStreamRun: (sql: SqlExec, runKey: string, status: "complete" | "error", lastSeq: number, failure?: {
|
|
1278
|
+
code: string;
|
|
1279
|
+
message: string;
|
|
1280
|
+
}) => void;
|
|
1281
|
+
declare const trimStreamRuns: (sql: SqlExec, now: number, live: ReadonlySet<string>) => void;
|
|
1282
|
+
declare const MAX_DURABLE_STREAM_CHUNKS = 50000;
|
|
1283
|
+
declare const MAX_DURABLE_STREAM_BYTES: number;
|
|
1284
|
+
interface DurableStreamSink {
|
|
1285
|
+
readonly chunk: (chunk: {
|
|
1286
|
+
data: unknown;
|
|
1287
|
+
generation?: number;
|
|
1288
|
+
seq: number;
|
|
1289
|
+
}) => boolean;
|
|
1290
|
+
readonly complete: () => void;
|
|
1291
|
+
readonly fail: (failure: {
|
|
1292
|
+
code: string;
|
|
1293
|
+
message: string;
|
|
1294
|
+
}) => void;
|
|
1295
|
+
}
|
|
1296
|
+
type DurableAttachDecision = "attach" | "interrupted" | "reclaim" | "replay-terminal";
|
|
1297
|
+
declare const decideDurableAttach: (run: DurableStreamRun | undefined, context: {
|
|
1298
|
+
generation?: number;
|
|
1299
|
+
live?: {
|
|
1300
|
+
generation: number;
|
|
1301
|
+
};
|
|
1302
|
+
resuming: boolean;
|
|
1303
|
+
}) => DurableAttachDecision;
|
|
1304
|
+
interface DurableStreamAttach {
|
|
1305
|
+
readonly generation?: number;
|
|
1306
|
+
readonly iterator: (signal: AbortSignal) => AsyncIterable<unknown>;
|
|
1307
|
+
readonly runKey: string;
|
|
1308
|
+
readonly sinceChunk: number;
|
|
1309
|
+
readonly sink: DurableStreamSink;
|
|
1310
|
+
readonly ttlMs?: number;
|
|
1311
|
+
}
|
|
1312
|
+
declare class DurableStreamRunner {
|
|
1313
|
+
private lastTrimAt;
|
|
1314
|
+
private readonly runs;
|
|
1315
|
+
private readonly sql;
|
|
1316
|
+
private readonly waitUntil;
|
|
1317
|
+
constructor(dependencies: {
|
|
1318
|
+
sql: () => SqlExec;
|
|
1319
|
+
waitUntil?: (promise: Promise<unknown>) => void;
|
|
1320
|
+
});
|
|
1321
|
+
attach(request: DurableStreamAttach): Promise<void>;
|
|
1322
|
+
detach(runKey: string, sink: DurableStreamSink): void;
|
|
1323
|
+
isLive(runKey: string): boolean;
|
|
1324
|
+
private attachOrThrow;
|
|
1325
|
+
private produce;
|
|
1326
|
+
private trim;
|
|
1327
|
+
}
|
|
1328
|
+
declare const envPositiveInt: (env: unknown, key: string, fallback: number) => number;
|
|
1329
|
+
declare const envOptionalPositiveInt: (env: unknown, key: string) => number | undefined;
|
|
1010
1330
|
interface ExternalSourceDiffResult {
|
|
1011
1331
|
changes: CdcChange[];
|
|
1012
1332
|
nextBaseline: Map<string, string>;
|
|
@@ -1071,6 +1391,16 @@ declare const isSoftDeleted: (row: Record<string, unknown>, column: string) => b
|
|
|
1071
1391
|
declare const pullExternalSourceIncrementalTick: (sql: SqlExec, writer: DatabaseWriterLike, client: SourceClientLike, table: string, source: ExternalSourceLike, shardKey: string, nowMs: number) => Promise<{
|
|
1072
1392
|
applied: number;
|
|
1073
1393
|
}>;
|
|
1394
|
+
declare const ftsRowidMapName: (companion: string) => string;
|
|
1395
|
+
interface FtsWriteOptions {
|
|
1396
|
+
guard?: SQL;
|
|
1397
|
+
unmappedRowids?: ReadonlyArray<number>;
|
|
1398
|
+
}
|
|
1399
|
+
declare const ftsCompanionDdl: (companion: string) => SQL[];
|
|
1400
|
+
declare const ftsWriteDocument: (companion: string, id: string, text: string, options?: FtsWriteOptions) => SQL[];
|
|
1401
|
+
declare const ftsPurgeDocument: (companion: string, id: string, options?: FtsWriteOptions) => SQL[];
|
|
1402
|
+
declare const ftsUnmappedPage: (companion: string, limit: number, after?: number) => SQL;
|
|
1403
|
+
declare const groupUnmappedRows: (rows: ReadonlyArray<Record<string, unknown>>) => Map<string, number[]>;
|
|
1074
1404
|
declare const GEO_DEFAULT_PRECISION = 9;
|
|
1075
1405
|
interface GeoPoint {
|
|
1076
1406
|
lat: number;
|
|
@@ -1086,6 +1416,20 @@ declare const coveringGeohashes: (center: GeoPoint, radiusMeters: number) => str
|
|
|
1086
1416
|
declare const pointInBoundingBox: (point: GeoPoint, box: GeoBoundingBox) => boolean;
|
|
1087
1417
|
declare const boundingBoxCenter: (box: GeoBoundingBox) => GeoPoint;
|
|
1088
1418
|
declare const boundingBoxGeohashes: (box: GeoBoundingBox) => string[];
|
|
1419
|
+
declare class GlobalPollTick {
|
|
1420
|
+
private readonly changedTables;
|
|
1421
|
+
private readonly reads;
|
|
1422
|
+
private resync;
|
|
1423
|
+
private skippedCount;
|
|
1424
|
+
constructor(changedTables?: Set<string>);
|
|
1425
|
+
get readCount(): number;
|
|
1426
|
+
get resyncRequested(): boolean;
|
|
1427
|
+
get skipped(): number;
|
|
1428
|
+
requestResync(): void;
|
|
1429
|
+
rows(key: string | undefined, load: () => Promise<ShapeRow[]>): Promise<ShapeRow[]>;
|
|
1430
|
+
shouldRead(table: string): boolean;
|
|
1431
|
+
}
|
|
1432
|
+
declare const isInternalTableName: (name: string) => boolean;
|
|
1089
1433
|
declare const ADMIN_FUNCTION_PREFIX = "__lunora_admin__:";
|
|
1090
1434
|
declare const RELATION_FUNCTION_PREFIX = "__lunora_relation__:";
|
|
1091
1435
|
declare const FLAGS_FUNCTION_PREFIX = "__lunora_flags__:";
|
|
@@ -1096,6 +1440,8 @@ declare const ADMIN_FUNCTIONS: {
|
|
|
1096
1440
|
readonly aiGenerateSql: "__lunora_admin__:aiGenerateSql";
|
|
1097
1441
|
readonly aiTableFilter: "__lunora_admin__:aiTableFilter";
|
|
1098
1442
|
readonly assignIssue: "__lunora_admin__:assignIssue";
|
|
1443
|
+
readonly backfillSearch: "__lunora_admin__:backfillSearch";
|
|
1444
|
+
readonly backfillVectors: "__lunora_admin__:backfillVectors";
|
|
1099
1445
|
readonly backRelationCounts: "__lunora_admin__:backRelationCounts";
|
|
1100
1446
|
readonly cdcSync: "__lunora_admin__:cdcSync";
|
|
1101
1447
|
readonly clearCapturedMail: "__lunora_admin__:clearCapturedMail";
|
|
@@ -1108,6 +1454,7 @@ declare const ADMIN_FUNCTIONS: {
|
|
|
1108
1454
|
readonly explainIssue: "__lunora_admin__:explainIssue";
|
|
1109
1455
|
readonly exportShard: "__lunora_admin__:exportShard";
|
|
1110
1456
|
readonly facetColumn: "__lunora_admin__:facetColumn";
|
|
1457
|
+
readonly findRelated: "__lunora_admin__:findRelated";
|
|
1111
1458
|
readonly getAdvisories: "__lunora_admin__:getAdvisories";
|
|
1112
1459
|
readonly getAdvisorProcedures: "__lunora_admin__:getAdvisorProcedures";
|
|
1113
1460
|
readonly getAuditLog: "__lunora_admin__:getAuditLog";
|
|
@@ -1134,20 +1481,24 @@ declare const ADMIN_FUNCTIONS: {
|
|
|
1134
1481
|
readonly ignoreIssue: "__lunora_admin__:ignoreIssue";
|
|
1135
1482
|
readonly importShard: "__lunora_admin__:importShard";
|
|
1136
1483
|
readonly listFlags: "__lunora_admin__:listFlags";
|
|
1484
|
+
readonly listReactors: "__lunora_admin__:listReactors";
|
|
1137
1485
|
readonly listQueues: "__lunora_admin__:listQueues";
|
|
1138
1486
|
readonly lintSql: "__lunora_admin__:lintSql";
|
|
1139
1487
|
readonly listTables: "__lunora_admin__:listTables";
|
|
1140
1488
|
readonly listWorkflows: "__lunora_admin__:listWorkflows";
|
|
1141
1489
|
readonly maskPolicies: "__lunora_admin__:maskPolicies";
|
|
1142
1490
|
readonly migrationStatus: "__lunora_admin__:migrationStatus";
|
|
1491
|
+
readonly patchRows: "__lunora_admin__:patchRows";
|
|
1143
1492
|
readonly pitrRestore: "__lunora_admin__:pitrRestore";
|
|
1144
1493
|
readonly rankBefore: "__lunora_admin__:rankBefore";
|
|
1145
1494
|
readonly rankPage: "__lunora_admin__:rankPage";
|
|
1146
1495
|
readonly readTablePage: "__lunora_admin__:readTablePage";
|
|
1496
|
+
readonly rebuildCompanions: "__lunora_admin__:rebuildCompanions";
|
|
1147
1497
|
readonly recordAuthEvent: "__lunora_admin__:recordAuthEvent";
|
|
1148
1498
|
readonly recordContainerEvent: "__lunora_admin__:recordContainerEvent";
|
|
1149
1499
|
readonly recordMail: "__lunora_admin__:recordMail";
|
|
1150
1500
|
readonly recordQueueMessage: "__lunora_admin__:recordQueueMessage";
|
|
1501
|
+
readonly releaseShardRegistration: "__lunora_admin__:releaseShardRegistration";
|
|
1151
1502
|
readonly replayQueueMessage: "__lunora_admin__:replayQueueMessage";
|
|
1152
1503
|
readonly resolveIssue: "__lunora_admin__:resolveIssue";
|
|
1153
1504
|
readonly rlsPolicies: "__lunora_admin__:rlsPolicies";
|
|
@@ -1217,8 +1568,12 @@ interface TablesIndexesResult {
|
|
|
1217
1568
|
indexesByTable: Record<string, TableIndexInfo[]>;
|
|
1218
1569
|
}
|
|
1219
1570
|
interface ColumnMeta {
|
|
1571
|
+
bucket?: string;
|
|
1572
|
+
enumValues?: string[];
|
|
1220
1573
|
isStorage?: boolean;
|
|
1221
1574
|
name: string;
|
|
1575
|
+
nullable?: boolean;
|
|
1576
|
+
onDelete?: "cascade" | "restrict" | "set null";
|
|
1222
1577
|
optional: boolean;
|
|
1223
1578
|
pk?: boolean;
|
|
1224
1579
|
ref?: string;
|
|
@@ -1315,6 +1670,12 @@ interface StudioFeaturesResult {
|
|
|
1315
1670
|
mail: boolean;
|
|
1316
1671
|
notifications: boolean;
|
|
1317
1672
|
payments: boolean;
|
|
1673
|
+
platform?: {
|
|
1674
|
+
id: string;
|
|
1675
|
+
name: string;
|
|
1676
|
+
unsupported: string[];
|
|
1677
|
+
};
|
|
1678
|
+
privacy: boolean;
|
|
1318
1679
|
queues: boolean;
|
|
1319
1680
|
scheduler: boolean;
|
|
1320
1681
|
storage: boolean;
|
|
@@ -1333,8 +1694,20 @@ interface FlagsResult {
|
|
|
1333
1694
|
configured: boolean;
|
|
1334
1695
|
flags: FlagEvaluation[];
|
|
1335
1696
|
}
|
|
1697
|
+
interface ReactorMetadata {
|
|
1698
|
+
errors: number;
|
|
1699
|
+
lastError?: string;
|
|
1700
|
+
lastRanAt?: number;
|
|
1701
|
+
path: string;
|
|
1702
|
+
runs: number;
|
|
1703
|
+
state: "active" | "failing" | "idle";
|
|
1704
|
+
suppressed: number;
|
|
1705
|
+
tables?: ReadonlyArray<string>;
|
|
1706
|
+
}
|
|
1707
|
+
interface ReactorsResult {
|
|
1708
|
+
reactors: ReactorMetadata[];
|
|
1709
|
+
}
|
|
1336
1710
|
interface WorkflowMetadata {
|
|
1337
|
-
binding: string;
|
|
1338
1711
|
className: string;
|
|
1339
1712
|
exportName: string;
|
|
1340
1713
|
name: string;
|
|
@@ -1348,6 +1721,7 @@ interface QueueMetadata {
|
|
|
1348
1721
|
exportName: string;
|
|
1349
1722
|
mode: "pull" | "push";
|
|
1350
1723
|
name: string;
|
|
1724
|
+
topic?: string;
|
|
1351
1725
|
}
|
|
1352
1726
|
interface QueuesResult {
|
|
1353
1727
|
queues: QueueMetadata[];
|
|
@@ -1391,8 +1765,10 @@ interface TablePage {
|
|
|
1391
1765
|
columns: string[];
|
|
1392
1766
|
refs?: Record<string, string>;
|
|
1393
1767
|
rows: Record<string, unknown>[];
|
|
1768
|
+
sqlColumns: string[];
|
|
1394
1769
|
total?: number;
|
|
1395
1770
|
}
|
|
1771
|
+
type ColumnKinds = Readonly<Record<string, string>>;
|
|
1396
1772
|
type FilterOperator = "contains" | "eq" | "gt" | "gte" | "lt" | "lte" | "ne";
|
|
1397
1773
|
interface FilterClause {
|
|
1398
1774
|
column: string;
|
|
@@ -1404,6 +1780,7 @@ interface OrderByClause {
|
|
|
1404
1780
|
direction: SortDirection;
|
|
1405
1781
|
}
|
|
1406
1782
|
interface ReadTablePageOptions {
|
|
1783
|
+
columnKinds?: ColumnKinds;
|
|
1407
1784
|
filters?: FilterClause[];
|
|
1408
1785
|
limit?: number;
|
|
1409
1786
|
offset?: number;
|
|
@@ -1414,6 +1791,8 @@ interface ReadTablePageOptions {
|
|
|
1414
1791
|
table: string;
|
|
1415
1792
|
}
|
|
1416
1793
|
interface SelectMatchingIdsOptions {
|
|
1794
|
+
after?: string;
|
|
1795
|
+
columnKinds?: ColumnKinds;
|
|
1417
1796
|
filters?: FilterClause[];
|
|
1418
1797
|
limit?: number;
|
|
1419
1798
|
search?: string;
|
|
@@ -1421,6 +1800,7 @@ interface SelectMatchingIdsOptions {
|
|
|
1421
1800
|
}
|
|
1422
1801
|
interface FacetColumnOptions {
|
|
1423
1802
|
column: string;
|
|
1803
|
+
columnKinds?: ColumnKinds;
|
|
1424
1804
|
filters?: FilterClause[];
|
|
1425
1805
|
limit?: number;
|
|
1426
1806
|
search?: string;
|
|
@@ -1436,6 +1816,7 @@ interface FacetColumnResult {
|
|
|
1436
1816
|
}
|
|
1437
1817
|
declare const MAX_PAGE_SIZE = 500;
|
|
1438
1818
|
declare const listTables: (sql: SqlExec) => TableInfo[];
|
|
1819
|
+
declare const isVacuousFilterClause: (clause: FilterClause) => boolean;
|
|
1439
1820
|
declare const readTablePage: (sql: SqlExec, options: ReadTablePageOptions) => TablePage;
|
|
1440
1821
|
declare const selectMatchingIds: (sql: SqlExec, options: SelectMatchingIdsOptions) => {
|
|
1441
1822
|
hasMore: boolean;
|
|
@@ -1470,12 +1851,22 @@ interface FanoutPathCounters {
|
|
|
1470
1851
|
socketsIterated: number;
|
|
1471
1852
|
totalMs: number;
|
|
1472
1853
|
}
|
|
1854
|
+
interface ShapeProbeCounters {
|
|
1855
|
+
run: number;
|
|
1856
|
+
served: number;
|
|
1857
|
+
}
|
|
1858
|
+
interface GlobalPollCounters {
|
|
1859
|
+
drains: number;
|
|
1860
|
+
pairsSkipped: number;
|
|
1861
|
+
}
|
|
1473
1862
|
interface FanoutMetricsResult {
|
|
1863
|
+
globalPoll: GlobalPollCounters;
|
|
1474
1864
|
maxRelays: number;
|
|
1475
1865
|
peakSubscribers: number;
|
|
1476
1866
|
promoted: boolean;
|
|
1477
1867
|
relayCount: number;
|
|
1478
1868
|
shapePoke: FanoutPathCounters;
|
|
1869
|
+
shapeProbe: ShapeProbeCounters;
|
|
1479
1870
|
sinceMs: number;
|
|
1480
1871
|
topics: FanoutTopicStat[];
|
|
1481
1872
|
totalConnections: number;
|
|
@@ -1489,6 +1880,10 @@ interface FanoutAttachmentLike {
|
|
|
1489
1880
|
}
|
|
1490
1881
|
declare const DEFAULT_FANOUT_TOPIC_LIMIT = 20;
|
|
1491
1882
|
declare const createFanoutCounters: () => FanoutPathCounters;
|
|
1883
|
+
declare const createShapeProbeCounters: () => ShapeProbeCounters;
|
|
1884
|
+
declare const createGlobalPollCounters: () => GlobalPollCounters;
|
|
1885
|
+
declare const recordGlobalPollPass: (counters: GlobalPollCounters, drains: number, pairsSkipped: number) => GlobalPollCounters;
|
|
1886
|
+
declare const recordShapeProbePass: (counters: ShapeProbeCounters, run: number, served: number) => ShapeProbeCounters;
|
|
1492
1887
|
declare const recordFanoutPass: (counters: FanoutPathCounters, iterated: number, delivered: number, ms: number) => FanoutPathCounters;
|
|
1493
1888
|
declare const summarizeFanoutTopics: (attachments: FanoutAttachmentLike[], limit?: number) => {
|
|
1494
1889
|
peakSubscribers: number;
|
|
@@ -1536,6 +1931,11 @@ declare const clearCapturedMail: (sql: SqlExec) => {
|
|
|
1536
1931
|
declare class NotFoundError extends LunoraError {
|
|
1537
1932
|
constructor(message?: string);
|
|
1538
1933
|
}
|
|
1934
|
+
declare const operatorFields: (definition: TableDefinitionLike, patch: Record<string, unknown>) => ReadonlySet<string>;
|
|
1935
|
+
declare const resolvePatch: (definition: TableDefinitionLike, patch: Record<string, unknown>, current: Record<string, unknown>) => Record<string, unknown>;
|
|
1936
|
+
declare const patchDependsOnRow: (definition: TableDefinitionLike, patch: Record<string, unknown>) => boolean;
|
|
1937
|
+
declare const assertPatchAllowed: (options: PatchWriteOptions | undefined, previous: Record<string, unknown>, next: Record<string, unknown>) => void;
|
|
1938
|
+
declare const readPatchField: (document: Record<string, unknown>, field: string) => unknown;
|
|
1539
1939
|
interface PitrStorage {
|
|
1540
1940
|
getBookmarkForTime?: (time: Date | number) => Promise<string>;
|
|
1541
1941
|
getCurrentBookmark?: () => Promise<string>;
|
|
@@ -1557,7 +1957,22 @@ interface PitrRestoreArgs {
|
|
|
1557
1957
|
}
|
|
1558
1958
|
declare const readBookmark: (storage: PitrStorage, time?: number | string) => Promise<PitrBookmarkResult>;
|
|
1559
1959
|
declare const armRestore: (storage: PitrStorage, args: PitrRestoreArgs) => Promise<Omit<PitrRestoreResult, "restarted">>;
|
|
1560
|
-
declare const
|
|
1960
|
+
declare const tiebreakDirectionFor: (keys: ReadonlyArray<{
|
|
1961
|
+
direction?: string;
|
|
1962
|
+
}>) => SortDirection;
|
|
1963
|
+
declare const equalityPinnedFields: (where: undefined | WhereInput) => ReadonlySet<string>;
|
|
1964
|
+
declare const uniqueIndexFields: (indexes: ReadonlyArray<{
|
|
1965
|
+
fields: ReadonlyArray<string>;
|
|
1966
|
+
unique?: boolean;
|
|
1967
|
+
}> | undefined, shape: Record<string, ValidatorLike> | undefined) => ReadonlyArray<ReadonlyArray<string>>;
|
|
1968
|
+
interface OrderKeyConstraints {
|
|
1969
|
+
pinned?: ReadonlySet<string>;
|
|
1970
|
+
uniqueBy?: ReadonlyArray<ReadonlyArray<string>>;
|
|
1971
|
+
}
|
|
1972
|
+
declare const nullsFirstOf: (key: Pick<OrderKey, "direction" | "nulls">) => boolean;
|
|
1973
|
+
declare const nullsOrderSuffix: (nullsFirst: boolean) => string;
|
|
1974
|
+
declare const normalizeOrderKeys: (orderBy: OrderByInput[] | undefined, shape?: Record<string, ValidatorLike>, constraints?: OrderKeyConstraints) => OrderKey[];
|
|
1975
|
+
declare const CURSOR_PREFIX = "~4";
|
|
1561
1976
|
declare const encodeCursor: (record: Record<string, unknown>, keys: OrderKey[]) => string;
|
|
1562
1977
|
declare const decodeCursor: (cursor: string) => unknown[];
|
|
1563
1978
|
declare const buildSeekWhere: (keys: OrderKey[], cursorValues: unknown[]) => WhereInput;
|
|
@@ -1617,7 +2032,36 @@ declare const rankKeyFromDocument: (index: RankIndexDefinitionLike, document_: R
|
|
|
1617
2032
|
rowId: string;
|
|
1618
2033
|
sortValues: unknown[];
|
|
1619
2034
|
};
|
|
2035
|
+
declare const rankPivotConditionSql: (column: string, value: unknown, direction: "asc" | "desc", wantLater: boolean) => SQL | undefined;
|
|
1620
2036
|
declare const matchesRankStaticWhere: (document: Record<string, unknown>, predicate: Record<string, unknown>) => boolean;
|
|
2037
|
+
declare const REACTOR_STATE_TABLE = "__reactor_state";
|
|
2038
|
+
interface ReactorState {
|
|
2039
|
+
digest: string;
|
|
2040
|
+
lastError?: string;
|
|
2041
|
+
lastRanAt: number;
|
|
2042
|
+
stats: ReactorStats;
|
|
2043
|
+
tables?: ReadonlyArray<string>;
|
|
2044
|
+
}
|
|
2045
|
+
interface ReactorStats {
|
|
2046
|
+
errors: number;
|
|
2047
|
+
runs: number;
|
|
2048
|
+
suppressed: number;
|
|
2049
|
+
}
|
|
2050
|
+
declare const migrateReactorState: (sql: SqlExec) => void;
|
|
2051
|
+
declare const readReactorState: (sql: SqlExec, path: string) => ReactorState | undefined;
|
|
2052
|
+
declare const listReactorStates: (sql: SqlExec) => {
|
|
2053
|
+
path: string;
|
|
2054
|
+
state: ReactorState;
|
|
2055
|
+
}[];
|
|
2056
|
+
type ReactorDispatchResult = "error" | "ran" | "suppressed";
|
|
2057
|
+
declare const writeReactorState: (sql: SqlExec, path: string, outcome: {
|
|
2058
|
+
digest?: string;
|
|
2059
|
+
error?: string;
|
|
2060
|
+
now: number;
|
|
2061
|
+
result: ReactorDispatchResult;
|
|
2062
|
+
tables?: ReadonlyArray<string>;
|
|
2063
|
+
}) => void;
|
|
2064
|
+
declare const reactorNeedsRun: (state: Pick<ReactorState, "tables"> | undefined, changed: ReadonlySet<string>) => boolean;
|
|
1621
2065
|
interface ReadFootprint {
|
|
1622
2066
|
onRead: (table: string, idOrScan?: string) => void;
|
|
1623
2067
|
onReadRange: (range: KeyRange) => void;
|
|
@@ -1625,16 +2069,33 @@ interface ReadFootprint {
|
|
|
1625
2069
|
tables: Set<string>;
|
|
1626
2070
|
}
|
|
1627
2071
|
declare const createReadFootprint: () => ReadFootprint;
|
|
2072
|
+
declare const UNVOUCHABLE_DEP = "!unvouchable";
|
|
2073
|
+
declare const markUnvouchableReads: <T extends object>(facade: T, onRead: ReadFootprint["onRead"] | undefined, methods: ReadonlyArray<string>) => T;
|
|
2074
|
+
declare const WHERE_FILTER: unique symbol;
|
|
2075
|
+
type RowPredicate = (document: Record<string, unknown>) => boolean;
|
|
2076
|
+
type WhereFilter = RowPredicate & {
|
|
2077
|
+
readonly [WHERE_FILTER]: WhereInput;
|
|
2078
|
+
};
|
|
2079
|
+
declare const whereFilter: (where: WhereInput, predicate: RowPredicate) => WhereFilter;
|
|
2080
|
+
declare const whereOfFilter: (predicate: RowPredicate) => undefined | WhereInput;
|
|
2081
|
+
declare const isPushableWhere: (where: WhereInput, shape: Readonly<Record<string, ValidatorLike>>, exactText?: boolean) => boolean;
|
|
2082
|
+
declare const RELATED_MAX_DEPTH = 4;
|
|
2083
|
+
declare const RELATED_DEFAULT_LIMIT = 50;
|
|
2084
|
+
declare const RELATED_MAX_LIMIT = 200;
|
|
2085
|
+
declare const RELATED_DEPTH_DECAY = 0.5;
|
|
2086
|
+
declare const deriveRelationEdges: (schema: SchemaLike) => RelationEdge[];
|
|
2087
|
+
type RelationGraphReader = Pick<DatabaseWriterLike, "findMany"> & Pick<Partial<DatabaseWriterLike>, "lookupById">;
|
|
2088
|
+
declare const findRelated: (reader: RelationGraphReader, edges: ReadonlyArray<RelationEdge>, start: RelatedStart, options?: RelatedOptions) => Promise<RelatedPage>;
|
|
1628
2089
|
declare const DEFAULT_MAX_RELATION_KEYS = 5000;
|
|
1629
2090
|
interface RelationExistsMarker {
|
|
1630
2091
|
childWhere: WhereInput;
|
|
1631
2092
|
negated: boolean;
|
|
1632
2093
|
parentTable: string;
|
|
1633
|
-
relation:
|
|
2094
|
+
relation: KeyedRelationDefinitionLike;
|
|
1634
2095
|
}
|
|
1635
2096
|
type ExistsPushMode = "always" | "auto";
|
|
1636
2097
|
interface ResolveRelationPredicatesOptions {
|
|
1637
|
-
canPushExists?: (relation:
|
|
2098
|
+
canPushExists?: (relation: KeyedRelationDefinitionLike) => boolean;
|
|
1638
2099
|
existsPushMode?: ExistsPushMode;
|
|
1639
2100
|
fetcher: (tableName: string, args: QueryArgs) => Promise<QueryPage>;
|
|
1640
2101
|
maxRelationKeys?: number;
|
|
@@ -1645,7 +2106,7 @@ interface ResolveRelationPredicatesOptions {
|
|
|
1645
2106
|
tableName: string;
|
|
1646
2107
|
}
|
|
1647
2108
|
interface ResolveContext {
|
|
1648
|
-
canPushExists?: (relation:
|
|
2109
|
+
canPushExists?: (relation: KeyedRelationDefinitionLike) => boolean;
|
|
1649
2110
|
existsPushMode: ExistsPushMode;
|
|
1650
2111
|
fetcher: (tableName: string, args: QueryArgs) => Promise<QueryPage>;
|
|
1651
2112
|
maxRelationKeys: number;
|
|
@@ -1658,7 +2119,14 @@ declare const isRelationPredicate: (value: unknown) => value is Record<string, W
|
|
|
1658
2119
|
declare const containsRelationPredicate: (where: WhereInput, schema: ResolveContext["schema"], tableName: string) => boolean;
|
|
1659
2120
|
declare const assertFlatPredicate: (where: WhereInput | undefined, schema: ResolveContext["schema"], tableName: string, op: string) => void;
|
|
1660
2121
|
declare const resolveRelationPredicates: (where: WhereInput | undefined, options: ResolveRelationPredicatesOptions) => Promise<WhereInput | undefined>;
|
|
2122
|
+
declare const composeReadPredicate: (definition: TableDefinitionLike, args: QueryArgs, relation: Omit<ResolveRelationPredicatesOptions, "relationBaseWhere">) => Promise<{
|
|
2123
|
+
fetchLimit: number | undefined;
|
|
2124
|
+
limit: number | undefined;
|
|
2125
|
+
orderKeys: OrderKey[];
|
|
2126
|
+
predicate: WhereInput | undefined;
|
|
2127
|
+
}>;
|
|
1661
2128
|
declare const assertShapeShardable: (effectiveWhere: WhereInput | undefined, schema: ResolveContext["schema"], table: string) => void;
|
|
2129
|
+
declare const relationHooks: (args: Pick<QueryArgs, "relationBaseWhere" | "relationMask">) => Pick<QueryArgs, "relationBaseWhere" | "relationMask"> & Pick<ResolveWithOptions, "fanOutBudget">;
|
|
1662
2130
|
declare const fanOutScalarCounts: (counter: (tableName: string, where?: WhereInput) => Promise<number>, tableName: string, whereField: string, values: unknown[], policyWhere: WhereInput | undefined) => Promise<Map<unknown, number>>;
|
|
1663
2131
|
declare const distinctValues: (rows: Record<string, unknown>[], field: string) => unknown[];
|
|
1664
2132
|
declare const resolveWith: (options: ResolveWithOptions) => Promise<void>;
|
|
@@ -1683,6 +2151,8 @@ interface ShapeRowOp {
|
|
|
1683
2151
|
value?: Record<string, unknown>;
|
|
1684
2152
|
}
|
|
1685
2153
|
interface ShapePokePart {
|
|
2154
|
+
baseCheckpoint?: number;
|
|
2155
|
+
reset?: boolean;
|
|
1686
2156
|
rowsPatch: ShapeRowOp[];
|
|
1687
2157
|
shapeId: string;
|
|
1688
2158
|
}
|
|
@@ -1743,6 +2213,12 @@ interface RelayShapeSubscribe {
|
|
|
1743
2213
|
type: "relay_shape_subscribe";
|
|
1744
2214
|
userId?: string;
|
|
1745
2215
|
}
|
|
2216
|
+
interface RelayShapeUnsubscribe {
|
|
2217
|
+
connectionId: string;
|
|
2218
|
+
relayIndex: number;
|
|
2219
|
+
subId?: string;
|
|
2220
|
+
type: "relay_shape_unsubscribe";
|
|
2221
|
+
}
|
|
1746
2222
|
interface RelayShapeSeed {
|
|
1747
2223
|
cursor?: number;
|
|
1748
2224
|
epoch?: string;
|
|
@@ -1762,22 +2238,19 @@ interface RelayShapePoke {
|
|
|
1762
2238
|
targetConnectionId?: string;
|
|
1763
2239
|
type: "relay_shape_poke";
|
|
1764
2240
|
}
|
|
1765
|
-
type OwnerRelayFrame = RelayAttach | RelayDetach | RelayFrame | RelayShapePoke | RelayShapeSubscribe;
|
|
1766
|
-
|
|
1767
|
-
interface RelayStub {
|
|
2241
|
+
type OwnerRelayFrame = RelayAttach | RelayDetach | RelayFrame | RelayShapePoke | RelayShapeSubscribe | RelayShapeUnsubscribe;
|
|
2242
|
+
interface SiblingStub {
|
|
1768
2243
|
fetch: (url: string, init?: RequestInit) => Promise<Response>;
|
|
1769
2244
|
}
|
|
1770
|
-
|
|
1771
|
-
|
|
1772
|
-
getByName?: (name: string) => RelayStub;
|
|
1773
|
-
idFromName: (name: string) => unknown;
|
|
1774
|
-
}
|
|
2245
|
+
declare const stubByName: (value: unknown, name: string, jurisdiction?: string) => SiblingStub | undefined;
|
|
2246
|
+
declare const DEFAULT_MAX_RELAYS = 8;
|
|
1775
2247
|
interface RelayHost {
|
|
1776
2248
|
buildShapeDiff: (resolved: ResolvedShape, fromCursor: number, toCursor: number) => ShapeRowOp[];
|
|
1777
2249
|
computeOpLogShapeSeed: (shape: ShapeSubscriptionQuery, resolved: ResolvedShape) => {
|
|
1778
2250
|
baseCheckpoint: number | undefined;
|
|
1779
2251
|
cursor: number;
|
|
1780
2252
|
epoch: string | undefined;
|
|
2253
|
+
reset: boolean;
|
|
1781
2254
|
rowsPatch: ShapeRowOp[];
|
|
1782
2255
|
};
|
|
1783
2256
|
currentCdcEpoch: () => string | undefined;
|
|
@@ -1792,8 +2265,13 @@ interface RelayHost {
|
|
|
1792
2265
|
resolveShape: (name: string, args: Record<string, unknown>, identity?: SubscriptionIdentity) => ResolvedShape | undefined;
|
|
1793
2266
|
rlsMetadata: () => RlsPoliciesResult;
|
|
1794
2267
|
shardBinding: () => string | undefined;
|
|
2268
|
+
shardJurisdiction: () => string | undefined;
|
|
1795
2269
|
sql: () => SqlExec;
|
|
1796
2270
|
}
|
|
2271
|
+
interface RelayPokeDelivery {
|
|
2272
|
+
delivered: number;
|
|
2273
|
+
matched: number;
|
|
2274
|
+
}
|
|
1797
2275
|
declare abstract class RelayLink {
|
|
1798
2276
|
protected readonly host: RelayHost;
|
|
1799
2277
|
protected readonly roleId: {
|
|
@@ -1807,7 +2285,8 @@ declare abstract class RelayLink {
|
|
|
1807
2285
|
handleControl(request: Request): Promise<Response>;
|
|
1808
2286
|
maxRelays(): number;
|
|
1809
2287
|
protected canAddressSiblings(): boolean;
|
|
1810
|
-
protected
|
|
2288
|
+
protected siblingStub(targetName: string): SiblingStub | undefined;
|
|
2289
|
+
protected bindingName(): string | undefined;
|
|
1811
2290
|
protected postRelayMessage(targetName: string, message: OwnerRelayFrame): Promise<void>;
|
|
1812
2291
|
protected requestRelayMessage(targetName: string, message: OwnerRelayFrame): Promise<Response | undefined>;
|
|
1813
2292
|
abstract forwardWhisper(topic: string, frame: string): Promise<void>;
|
|
@@ -1818,19 +2297,22 @@ declare abstract class RelayLink {
|
|
|
1818
2297
|
}>;
|
|
1819
2298
|
abstract announce(): Promise<void>;
|
|
1820
2299
|
abstract announceDrain(closing: ShardSocketLike): Promise<void>;
|
|
2300
|
+
abstract releaseRelayShapes(ws: ShardSocketLike, subId?: string): Promise<void>;
|
|
1821
2301
|
abstract relayCount(): number;
|
|
1822
2302
|
abstract isShapeRelayUniform(name: string, args: Record<string, unknown>): boolean;
|
|
2303
|
+
abstract minShapeCursor(): number | undefined;
|
|
1823
2304
|
protected abstract onAttach(index: number): void;
|
|
1824
2305
|
protected abstract onDetach(index: number): void;
|
|
1825
2306
|
protected abstract onWhisperFrame(message: RelayFrame): Promise<void>;
|
|
1826
2307
|
protected abstract onShapeSubscribe(message: RelayShapeSubscribe): RelayShapeSeed;
|
|
1827
|
-
protected abstract
|
|
2308
|
+
protected abstract onShapeUnsubscribe(message: RelayShapeUnsubscribe): void;
|
|
2309
|
+
protected abstract onShapePoke(poke: RelayShapePoke): RelayPokeDelivery;
|
|
1828
2310
|
}
|
|
1829
2311
|
declare class OwnerRelay extends RelayLink {
|
|
1830
2312
|
private readonly shapeUniformCache;
|
|
1831
2313
|
private relaySetCache;
|
|
1832
|
-
private
|
|
1833
|
-
private
|
|
2314
|
+
private registryCache;
|
|
2315
|
+
private recordedBinding;
|
|
1834
2316
|
private promotionState;
|
|
1835
2317
|
constructor(host: RelayHost, ownerKey: string);
|
|
1836
2318
|
forwardWhisper(topic: string, frame: string): Promise<void>;
|
|
@@ -1841,18 +2323,26 @@ declare class OwnerRelay extends RelayLink {
|
|
|
1841
2323
|
}>;
|
|
1842
2324
|
announce(): Promise<void>;
|
|
1843
2325
|
announceDrain(): Promise<void>;
|
|
2326
|
+
releaseRelayShapes(): Promise<void>;
|
|
1844
2327
|
relayCount(): number;
|
|
2328
|
+
minShapeCursor(): number | undefined;
|
|
1845
2329
|
isShapeRelayUniform(name: string, args: Record<string, unknown>): boolean;
|
|
2330
|
+
protected onShapeUnsubscribe(message: RelayShapeUnsubscribe): void;
|
|
1846
2331
|
protected onAttach(index: number): void;
|
|
1847
2332
|
protected onDetach(index: number): void;
|
|
1848
2333
|
protected onWhisperFrame(message: RelayFrame): Promise<void>;
|
|
1849
2334
|
protected onShapeSubscribe(message: RelayShapeSubscribe): RelayShapeSeed;
|
|
1850
|
-
protected onShapePoke():
|
|
2335
|
+
protected onShapePoke(): RelayPokeDelivery;
|
|
1851
2336
|
private buildShapePoke;
|
|
1852
2337
|
private multicastShapePokes;
|
|
2338
|
+
private multicastToRelays;
|
|
1853
2339
|
private proxyShapePokes;
|
|
2340
|
+
private proxyToRelay;
|
|
1854
2341
|
private buildShapeSeedFrames;
|
|
1855
|
-
private
|
|
2342
|
+
private ensureRelayTables;
|
|
2343
|
+
protected bindingName(): string | undefined;
|
|
2344
|
+
private relayShapes;
|
|
2345
|
+
private rewindShapeCursor;
|
|
1856
2346
|
private ownerRelaySet;
|
|
1857
2347
|
private addRelayToSet;
|
|
1858
2348
|
private removeRelayFromSet;
|
|
@@ -1861,7 +2351,8 @@ declare class OwnerRelay extends RelayLink {
|
|
|
1861
2351
|
}
|
|
1862
2352
|
declare class RelayMember extends RelayLink {
|
|
1863
2353
|
private relayAnnounced;
|
|
1864
|
-
private
|
|
2354
|
+
private relayMemoCache;
|
|
2355
|
+
private readonly shapeControl;
|
|
1865
2356
|
constructor(host: RelayHost, ownerKey: string, relayIndex: number);
|
|
1866
2357
|
forwardWhisper(topic: string, frame: string): Promise<void>;
|
|
1867
2358
|
onFlush(): Promise<void>;
|
|
@@ -1871,17 +2362,81 @@ declare class RelayMember extends RelayLink {
|
|
|
1871
2362
|
}>;
|
|
1872
2363
|
announce(): Promise<void>;
|
|
1873
2364
|
announceDrain(closing: ShardSocketLike): Promise<void>;
|
|
2365
|
+
releaseRelayShapes(ws: ShardSocketLike, subId?: string): Promise<void>;
|
|
1874
2366
|
relayCount(): number;
|
|
1875
2367
|
isShapeRelayUniform(): boolean;
|
|
2368
|
+
minShapeCursor(): number | undefined;
|
|
1876
2369
|
protected onAttach(): void;
|
|
1877
2370
|
protected onDetach(): void;
|
|
1878
2371
|
protected onWhisperFrame(): Promise<void>;
|
|
1879
2372
|
protected onShapeSubscribe(): RelayShapeSeed;
|
|
1880
|
-
protected
|
|
2373
|
+
protected onShapeUnsubscribe(): void;
|
|
2374
|
+
protected onShapePoke(poke: RelayShapePoke): RelayPokeDelivery;
|
|
2375
|
+
private queueShapeControl;
|
|
2376
|
+
private relayMemos;
|
|
2377
|
+
private connectionMemos;
|
|
1881
2378
|
private recordRelayShapeMemo;
|
|
2379
|
+
private forgetRelayShapeMemos;
|
|
1882
2380
|
private deliverShapePoke;
|
|
2381
|
+
private pokeSocketShapes;
|
|
1883
2382
|
}
|
|
1884
2383
|
declare const createRelayLink: (host: RelayHost) => OwnerRelay | RelayMember | undefined;
|
|
2384
|
+
declare const REGION_HINTS: readonly ["wnam", "enam", "sam", "weur", "eeur", "apac", "apac-ne", "apac-se", "oc", "afr", "me"];
|
|
2385
|
+
type RegionHint = (typeof REGION_HINTS)[number];
|
|
2386
|
+
type ReplicaReadiness = "fresh" | "stale" | "unavailable";
|
|
2387
|
+
interface ShardSiblingHost {
|
|
2388
|
+
doName: () => string | undefined;
|
|
2389
|
+
env: () => unknown;
|
|
2390
|
+
shardBinding: () => string | undefined;
|
|
2391
|
+
shardJurisdiction: () => string | undefined;
|
|
2392
|
+
sql: () => SqlExec;
|
|
2393
|
+
}
|
|
2394
|
+
interface ReplicaOwnerHost extends ShardSiblingHost {
|
|
2395
|
+
exportRows: () => Promise<ExportRow[]>;
|
|
2396
|
+
ownerCursor: () => number | undefined;
|
|
2397
|
+
ownerEpoch: () => string | undefined;
|
|
2398
|
+
ownerFloor: () => number | undefined;
|
|
2399
|
+
readChanges: (sinceSeq: number, limit: number) => {
|
|
2400
|
+
changes: CdcChange[];
|
|
2401
|
+
cursor: number;
|
|
2402
|
+
};
|
|
2403
|
+
rowCount: () => number;
|
|
2404
|
+
}
|
|
2405
|
+
interface ReplicaFollowerHost extends ShardSiblingHost {
|
|
2406
|
+
applyChanges: (changes: ReadonlyArray<CdcChange>) => Promise<number>;
|
|
2407
|
+
importRows: (rows: ReadonlyArray<ExportRow>) => Promise<{
|
|
2408
|
+
errors: ReadonlyArray<unknown>;
|
|
2409
|
+
}>;
|
|
2410
|
+
}
|
|
2411
|
+
declare const handleReplicaControl: (host: ReplicaOwnerHost, request: Request) => Promise<Response>;
|
|
2412
|
+
declare class ShardReplica {
|
|
2413
|
+
private readonly host;
|
|
2414
|
+
readonly ownerKey: string;
|
|
2415
|
+
readonly region: RegionHint;
|
|
2416
|
+
private divergent;
|
|
2417
|
+
private inFlight;
|
|
2418
|
+
constructor(host: ReplicaFollowerHost, ownerKey: string, region: RegionHint);
|
|
2419
|
+
ensureFresh(minSeq?: number): Promise<ReplicaReadiness>;
|
|
2420
|
+
appliedSeq(): number;
|
|
2421
|
+
isDivergent(): boolean;
|
|
2422
|
+
private advance;
|
|
2423
|
+
private isCaughtUp;
|
|
2424
|
+
private catchUp;
|
|
2425
|
+
private applyPage;
|
|
2426
|
+
private hasDiverged;
|
|
2427
|
+
private bootstrap;
|
|
2428
|
+
private isFreshEnough;
|
|
2429
|
+
private pull;
|
|
2430
|
+
private request;
|
|
2431
|
+
}
|
|
2432
|
+
declare const createReplicaLink: (host: ReplicaFollowerHost) => ShardReplica | undefined;
|
|
2433
|
+
declare const gateReplicaDispatch: (replica: ShardReplica, request: Request, functionPath: string) => Promise<Response | undefined>;
|
|
2434
|
+
declare const REPROJECTION_MIGRATION_PREFIX = "__lunora_reproject__";
|
|
2435
|
+
declare const reprojectionMigrationId: (table: string) => string;
|
|
2436
|
+
declare const reprojectableFields: (definition: TableDefinitionLike) => string[];
|
|
2437
|
+
declare const reprojectionTables: (schema: SchemaLike) => string[];
|
|
2438
|
+
declare const countLegacyRows: (sql: SqlExec, table: string, fields: ReadonlyArray<string>) => number;
|
|
2439
|
+
declare const buildReprojectionMigration: (id: string, schema: SchemaLike, sql: SqlExec) => DataMigrationLike | undefined;
|
|
1885
2440
|
declare const RLS_UNWRAP_SYMBOL: symbol;
|
|
1886
2441
|
declare class RlsRequiredError extends LunoraError {
|
|
1887
2442
|
readonly table: string;
|
|
@@ -1898,7 +2453,7 @@ interface GuardableSchema {
|
|
|
1898
2453
|
}
|
|
1899
2454
|
type TableOfId = (id: string, expectedTable?: string) => Promise<string | undefined> | string | undefined;
|
|
1900
2455
|
type TablesOfIds = (ids: ReadonlyArray<string>, expectedTable?: string) => Promise<ReadonlyMap<string, string>> | ReadonlyMap<string, string>;
|
|
1901
|
-
declare const guardWriter: <W>(raw: W, schema: GuardableSchema, tableOfId: TableOfId, tablesOfIds?: TablesOfIds) => W;
|
|
2456
|
+
declare const guardWriter: <W>(raw: W, schema: GuardableSchema, tableOfId: TableOfId, tablesOfIds?: TablesOfIds, relationEdges?: ReadonlyArray<RelationEdge>) => W;
|
|
1902
2457
|
declare const SCHEMA_HISTORY_MAX_VERSIONS = 50;
|
|
1903
2458
|
interface SchemaVersionRow {
|
|
1904
2459
|
appliedAt: number;
|
|
@@ -1909,8 +2464,24 @@ interface SchemaVersionRow {
|
|
|
1909
2464
|
declare const recordSchemaVersion: (sql: SqlExec, hash: string, snapshotJson: string, now?: number) => boolean;
|
|
1910
2465
|
declare const readSchemaHistory: (sql: SqlExec) => SchemaVersionRow[];
|
|
1911
2466
|
declare const readSchemaVersion: (sql: SqlExec, hash: string) => SchemaVersionRow | undefined;
|
|
2467
|
+
declare const readDeployInfo: (rawEnv: unknown) => DeployInfo;
|
|
1912
2468
|
declare const isDevEnvironment: (rawEnv: unknown) => boolean;
|
|
1913
2469
|
declare const buildSettings: (rawEnv: unknown) => SettingsResult;
|
|
2470
|
+
declare class ShapeDiffCache {
|
|
2471
|
+
private readonly keyScans;
|
|
2472
|
+
private readonly memberProbes;
|
|
2473
|
+
private run;
|
|
2474
|
+
private served;
|
|
2475
|
+
get probesRun(): number;
|
|
2476
|
+
get probesServed(): number;
|
|
2477
|
+
changedKeys(rangeKey: string, load: () => CdcChangeKey[]): ReadonlyArray<CdcChangeKey>;
|
|
2478
|
+
members(resolved: ResolvedShape, rangeKey: string, load: () => Map<string, Record<string, unknown>>): ReadonlyMap<string, Record<string, unknown>>;
|
|
2479
|
+
private getOrLoad;
|
|
2480
|
+
}
|
|
2481
|
+
declare const createShapeDiffCache: () => ShapeDiffCache;
|
|
2482
|
+
declare const globalShapeReadKey: (resolved: ResolvedShape, identity: SubscriptionIdentity) => string | undefined;
|
|
2483
|
+
type ReadShapeCdcKeys = (sql: SqlExec, table: string, sinceSeq: number, upTo: number) => CdcChangeKey[];
|
|
2484
|
+
declare const buildShapeDiff: (sql: SqlExec, resolved: ResolvedShape, sinceSeq: number, upTo: number, cache: ShapeDiffCache, readKeys?: ReadShapeCdcKeys) => ShapeRowOp[];
|
|
1914
2485
|
interface ShardRunnerOptions {
|
|
1915
2486
|
handlers?: {
|
|
1916
2487
|
handleAlarm?: () => Promise<void>;
|
|
@@ -1926,7 +2497,7 @@ declare class ShardRunner {
|
|
|
1926
2497
|
socketFor(raw: unknown): ShardSocketLike;
|
|
1927
2498
|
sockets(tag?: string): SocketHandle[];
|
|
1928
2499
|
background(work: Promise<unknown>): boolean;
|
|
1929
|
-
runInTransaction<T>(work: () => Promise<T
|
|
2500
|
+
runInTransaction<T>(work: () => Promise<T>, onCommitted?: () => void): Promise<T>;
|
|
1930
2501
|
handleFetch(request: Request): Promise<Response>;
|
|
1931
2502
|
handleAlarm(): Promise<void>;
|
|
1932
2503
|
}
|
|
@@ -1952,6 +2523,11 @@ interface SqlDiagnostic {
|
|
|
1952
2523
|
source: "gate" | "plan" | "syntax";
|
|
1953
2524
|
}
|
|
1954
2525
|
declare const lintReadonlySql: (sql: SqlExec, query: string) => SqlLintResult;
|
|
2526
|
+
declare const BIGINT_KEY_DIGITS = 39;
|
|
2527
|
+
declare const bigintSqlKey: (value: bigint) => string;
|
|
2528
|
+
declare const decodeBigintSqlKey: (raw: string) => bigint | undefined;
|
|
2529
|
+
declare const float64SqlKey: (value: number) => string;
|
|
2530
|
+
declare const decodeFloat64SqlKey: (raw: string) => number | undefined;
|
|
1955
2531
|
declare const subscriptionListDeltas: (previousJson: string, nextResult: unknown, table: string, frames?: string[]) => MutationDelta[] | undefined;
|
|
1956
2532
|
interface FrameSink {
|
|
1957
2533
|
send: (data: string) => void;
|
|
@@ -1960,7 +2536,17 @@ interface DrainableSink {
|
|
|
1960
2536
|
readonly bufferedAmount?: unknown;
|
|
1961
2537
|
}
|
|
1962
2538
|
declare const trySendFrame: (ws: FrameSink, frame: string) => boolean;
|
|
1963
|
-
|
|
2539
|
+
interface SubscriptionFrameInput {
|
|
2540
|
+
cursorSuffix: string;
|
|
2541
|
+
lastMutationId?: number;
|
|
2542
|
+
nextResult: unknown;
|
|
2543
|
+
pageDeltas?: boolean;
|
|
2544
|
+
previousJson?: string;
|
|
2545
|
+
snapshotJson: string;
|
|
2546
|
+
subId: string;
|
|
2547
|
+
table: string;
|
|
2548
|
+
}
|
|
2549
|
+
declare const subscriptionFrames: (input: SubscriptionFrameInput) => string[];
|
|
1964
2550
|
declare const awaitWsDrain: (ws: DrainableSink) => Promise<void>;
|
|
1965
2551
|
interface SubscriptionReadFootprint {
|
|
1966
2552
|
ranges?: Map<string, KeyRange[]>;
|
|
@@ -1988,13 +2574,30 @@ declare const selectExpiredIds: (sql: SqlExec, spec: TtlSweepSpec, now: number,
|
|
|
1988
2574
|
hasMore: boolean;
|
|
1989
2575
|
ids: string[];
|
|
1990
2576
|
};
|
|
1991
|
-
|
|
1992
|
-
|
|
1993
|
-
|
|
1994
|
-
|
|
1995
|
-
|
|
1996
|
-
|
|
1997
|
-
|
|
2577
|
+
declare const VECTOR_BACKFILL_MAX_PAGES = 20;
|
|
2578
|
+
interface VectorBackfillTarget {
|
|
2579
|
+
profile: string;
|
|
2580
|
+
table: string;
|
|
2581
|
+
}
|
|
2582
|
+
interface VectorBackfillProgress {
|
|
2583
|
+
done: boolean;
|
|
2584
|
+
error?: string;
|
|
2585
|
+
failed: number;
|
|
2586
|
+
failedIds: string[];
|
|
2587
|
+
pages: number;
|
|
2588
|
+
rows: number;
|
|
1998
2589
|
}
|
|
1999
|
-
|
|
2000
|
-
|
|
2590
|
+
type VectorPageSync = (table: string, rows: ReadonlyArray<{
|
|
2591
|
+
doc: Record<string, unknown>;
|
|
2592
|
+
id: string;
|
|
2593
|
+
}>) => Promise<ReadonlyArray<{
|
|
2594
|
+
error: unknown;
|
|
2595
|
+
id: string;
|
|
2596
|
+
}>>;
|
|
2597
|
+
type OrderedAfterWrites = <T, U>(read: () => T, work: (value: T) => Promise<U>) => Promise<U>;
|
|
2598
|
+
declare const backfillVectorIndexes: (sql: SqlExec, targets: ReadonlyArray<VectorBackfillTarget>, sync: VectorPageSync, options: {
|
|
2599
|
+
maxPages?: number;
|
|
2600
|
+
ordered: OrderedAfterWrites;
|
|
2601
|
+
restart?: boolean;
|
|
2602
|
+
}) => Promise<VectorBackfillProgress>;
|
|
2603
|
+
export { ADMIN_FUNCTIONS, ADMIN_FUNCTION_PREFIX, AGGREGATE_SQL_FUNCTION, AGG_COUNT, AGG_KEY, AGG_VALUE, AUDIT_LOG_TABLE, type AdvisorProcedure, type AdvisorProceduresResult, type AdvisoriesResult, type AdvisoryFinding, type AggregateIndexDefinitionLike, type AggregateOp, type AggregateOptions, type AggregateResult, type AggregateTally, type AppendAuditEntry, type ApplyOnDeleteOptions, type AuditEntry, type AuditLogResult, BIGINT_KEY_DIGITS, type BroadcastDelta, CDC_LOG_TABLE, CDC_LOG_TABLE_SEQ_INDEX, CDC_META_TABLE, CLIENT_WATERMARK_TABLE, COMMIT_SEQ_FIELD, COMMIT_SEQ_TABLE, CURSOR_PREFIX, type CacheEntry, type CapturedMailRow, type CdcArchiveScope, type CdcChange, type CdcChangeKey, type ChangedKeys, type Clock, type ColumnMeta, type ColumnMetaLike, type CompanionSync, type CompanionSyncDeps, ConflictError, type ConflictKind, type CountArgs, CountRlsUnsupportedError, type CreateWorkflowInstanceResult, type CrossShardReadArgs, type CtxDbOptions, DATA_MIGRATION_STATE_TABLE, DEFAULT_FANOUT_TOPIC_LIMIT, DEFAULT_MAX_RELATION_KEYS, DEFAULT_MAX_RELAYS, DEFAULT_PROMOTION_THRESHOLDS, DEFAULT_TRANSACTION_LIMITS, DOC_COLUMN, type DataMigrationDocument, type DataMigrationLike, type DataMigrationTransform, type DatabaseWriterLike, type DependencyTracker, type DeployInfo, type DurableAttachDecision, type DurableStreamAttach, type DurableStreamRun, DurableStreamRunner, type DurableStreamSink, type ExportRow, type ExportShardAdminArgs, type ExportShardArgs, type ExternalSourceDiffResult, type ExternalSourceLike, FLAGS_FUNCTION_PREFIX, type FacetColumnOptions, type FacetColumnResult, type FacetValue, type FanOutBudget, type FanoutMetricsResult, type FanoutPathCounters, type FanoutTopicStat, type FieldOperators, type FilterClause, type FilterOperator, type FlagEvaluation, type FlagsResult, type FtsWriteOptions, type FunctionCallStat, type FunctionScanAttribution, type FunctionStatsResult, GEO_DEFAULT_PRECISION, GLOBAL_SHAPE_SNAPSHOT_TABLE, type GeoBoundingBox, type GeoFilterBuilderLike, type GeoIndexDefinitionLike, type GeoPoint, type GeoScoredDocument, type GlobalPollCounters, GlobalPollTick, type GroupByEntry, type GroupByOptions, type GuardableSchema$1 as GuardableSchema, IDEMPOTENCY_TABLE, type IdGenerator, type IdempotentRecord, type ImportError, type ImportShardAdminArgs, type ImportShardArgs, type ImportShardResult, type IncrementalMaterializeResult, type IndexDefinitionLike, type IndexKeyEntry, type IndexRangeBuilderLike, type KeyRange, type KeyedRelationWriteInfo, type LifecycleDispatchInfo, type LifecycleEvent, MAIL_RETENTION, MAIL_TABLE, MAX_DURABLE_STREAM_BYTES, MAX_DURABLE_STREAM_CHUNKS, MAX_PAGE_SIZE, MAX_SQL_ROWS, type MaskColumnMetadata, type MaskPoliciesResult, type MaterializeResult, type MigrationDirection, type MigrationRunResult, type MigrationStatus, type MigrationStatusRow, type MutationDelta, type NestedWith, NotFoundError, NotUniqueError, type 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, 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 RelayShapePoke, type RelayShapeSeed, type RelayShapeSubscribe, type RelayShapeUnsubscribe, type RenderedSql, type ReplicaFollowerHost, type ReplicaOwnerHost, type ReplicaReadiness, type ResolveRelationPredicatesOptions, type ResolveWithOptions, type ResolveWithResult, type ResolvedShape, type RestrictableQueryOptions, type RlsPoliciesResult, type RlsPolicyMetadata, RlsRequiredError, type RlsRoleMetadata, type RpcRequest, type RunDataMigrationOptions, type RunTriggersOptions, SCAN_DEP, SCHEDULE_OUTBOX_TABLE, SCHEMA_HISTORY_MAX_VERSIONS, SEARCH_STATE_TABLE, SHAPE_POKE_CURSOR_TABLE, type SchedulableWorkflowReferenceLike, type ScheduleOutbox, type ScheduleOutboxEnvelope, type ScheduleOutboxRow, type ScheduledFunctionDoc, type SchedulerLike, type SchemaLike, type ScoredDocument, type SearchBackfillProgress, type SearchFilterBuilderLike, type SearchIndexDefinitionLike, type SearchScoredDocument, type SelectMatchingIdsOptions, type ServerDefaultContextLike, type SettingEntry, type SettingKind, type SettingsResult, ShapeDiffCache, type ShapePokeCursorRow, type ShapePokePart, type ShapeProbeCounters, type ShapeRow, type ShapeRowOp, type ShapeSubscriptionQuery, type ShardRankPageResult, ShardRunner, type ShardRunnerOptions, type ShardSiblingHost, type ShardSocketLike, type SocketAttachment, type SortDirection, type SourceClientLike, type SourceCursorLike, type SourceRefresh, type SqlConsoleResult, type SqlCursor, type SqlEngine, type SqlExec, type SqlLintResult, type StorageMetadata, type StorageReference, type StorageReferenceResult, type StorageRuleMetadata, type StorageRulesResult, type StudioFeaturesResult, type SubscriptionConnection, type SubscriptionEnvelope, type SubscriptionIdentity, type SubscriptionInfo, type SubscriptionQuery, type SubscriptionReadFootprint, type SubscriptionsResult, type SystemDatabaseReader, type SystemDoc, type SystemQuery, type SystemReaderOptions, type SystemReaderSchedulerLike, type SystemReaderStorageLike, type SystemTableName, type TableColumnsResult, type TableDefinitionLike, type TableIndexInfo, type TableIndexesResult, type TableInfo, type TablePage, type TableReaderLike, type TablesColumnsResult, type TablesIndexesResult, type ThroughRelationWriteInfo, type TransactionHeadroom, TransactionHeadroomTracker, type TransactionLimits, type TransactionSqlLike, type TriggerContextLike, type TriggerDefinitionLike, type TriggerEventLike, type TriggerOpLike, type TriggerTimingLike, type TtlSweepSpec, UNVOUCHABLE_DEP, VECTOR_BACKFILL_MAX_PAGES, type ValidatorLike, type VectorBackfillProgress, WORKERD_SQLITE_LIMITS, type WhereFilter, type WhereInput, type WhereSqlStrategy, type WithInput, type WorkflowInstanceState, type WorkflowInstanceStatusResult, type WorkflowMetadata, type WorkflowsResult, type WriteEvent, type WriteHook, advanceClientWatermark, aggUpsertSql, aggregateSqlFunction, aggregateTableName, allocateCommitSeq, appendAuditEntry, appendCdcChange, appendStreamChunk, applyCdcChanges, applyOnDelete, applySelect, archiveCdcSegment, armRestore, assertFlatPredicate, assertNoExplicitUndefined, assertPatchAllowed, assertReadonly, assertShapeShardable, assertValidClientId, awaitWsDrain, backfillAggregateIndexes, backfillRankIndexes, backfillSearchIndexes, backfillSearchIndexesForTable, backfillVectorIndexes, bigintSqlKey, boundingBoxCenter, boundingBoxGeohashes, buildIndexRange, buildPokeFrames, buildReprojectionMigration, buildSeekBeforeWhere, buildSeekWhere, buildSettings, buildShapeDiff, bumpCdcEpoch, cdcArchiveRewound, cdcCanVouchFor, cdcForkedError, cdcSeqLeavingRows, cdcTouchesTables, cdcTrimmedError, claimStreamRun, clampPromotionThresholds, clearCapturedMail, clearCompanionSignatures, clearMemoryTables, clearQueueMessages, coerceAggregateNumber, compactCdcDocs, compileWhereSql, composeReadPredicate, computeRankPage, containsRelationPredicate, countLegacyRows, coveringGeohashes, createCompanionSync, createDependencyTracker, createFanoutCounters, createGlobalPollCounters, createIndexSql, createReadFootprint, createRelayLink, createReplicaLink, createShapeDiffCache, createShapeProbeCounters, createShardCtxDb, createSystemReader, cursorBelowRetainedFloor, decideDurableAttach, decodeBigintSqlKey, decodeCursor, decodeFloat64SqlKey, deferScheduleOutbox, deleteGlobalShapeSnapshot, deleteGlobalShapeSnapshotsForConnection, deleteShapePokeCursor, deleteShapePokeCursorsForConnection, deleteStreamRun, depKey, deriveRelationEdges, describeRelationWrites, diffExternalSource, diffGlobalMembership, distinctValues, encodeAggregateKey, encodeCursor, encodeGeohash, encodePartitionKey, encodeRowsPatch, ensureAuditTable, ensureMailTable, envOptionalPositiveInt, envPositiveInt, equalityPinnedFields, exportShardRows, facetColumn, fanOutScalarCounts, findRelated, findStorageReferences, finishStreamRun, float64SqlKey, foldAggregateTally, forgetScheduleOutbox, ftsCompanionDdl, ftsPurgeDocument, ftsRowidMapName, ftsUnmappedPage, ftsWriteDocument, gateReplicaDispatch, geoTableName, globalShapeReadKey, groupUnmappedRows, guardWriter, handleReplicaControl, hasTrigger, haversineMeters, importShardRows, indexKeysForRow, isDevEnvironment, isFtsAvailable, isInternalTableName, isLossyBody, isMemoryTable, isPushableWhere, isRelationPredicate, isSoftDeleted, isSourceDue, isVacuousFilterClause, jsonPath, jsonPathSql, keysTouchRanges, liftSourceId, lintReadonlySql, listReactorStates, listTables, markUnvouchableReads, matchesRankStaticWhere, matchesStaticWhere, materializeExternalRows, materializeExternalRowsIncremental, memoryTableNames, mergeChangedKeys, mergeWhere, migrateCdcLog, migrateCdcMeta, migrateClientWatermark, migrateCommitSeq, migrateDurableStreams, migrateGlobalShapeSnapshot, migrateIdempotency, migrateReactorState, migrateScheduleOutbox, migrateSearchState, migrateShapePokeCursor, minCdcReplayableSeq, minCdcSeq, minShapePokeCursor, nextPromotionState, normalizeCountArgument, normalizeIdStructurally, normalizeOrderKeys, normalizeSourceDocument, normalizeSourceValue, nullsFirstOf, nullsOrderSuffix, operatorFields, param, parkScheduleOutbox, parseExportShardArgs, parseImportShardArgs, patchDependsOnRow, planAggregateLookup, pointInBoundingBox, probeScheduleOutbox, projectColumns, pullExternalSourceIncrementalTick, pullExternalSourceTick, qualifiedJsonPath, qualifiedJsonPathSql, quoteIdentifier, rankKeyFromDocument as rankKeyFromDoc, rankPivotConditionSql, rankTableName, reactiveCacheKey, reactorNeedsRun, readAggregateValue, readArchivedCdcChanges, readAuditLog, readBookmark, readCapturedMail, readCdcArchivedThrough, readCdcChangeKeys, readCdcChanges, readCdcCursor, readCdcEpoch, readClientWatermark, readCommitSeq, readDeployInfo, readDueScheduleOutbox, readExternalSourceBaseline, readGlobalShapeSnapshot, readIdempotent, readMigrationStatus, readPatchField, readQueueMessageById, readQueueMessages, readReactorState, readSchemaHistory, readSchemaVersion, readSearchBackfillState, readShapePokeCursor, readStreamChunks, readStreamRun, readTablePage, recordCapturedMail, recordChangedKeys, recordFanoutPass, recordGlobalPollPass, recordQueueMessages, recordScheduleOutbox, recordSchemaVersion, recordShapeProbePass, relationHooks, relayCountFor, renderSql, reprojectableFields, reprojectionMigrationId, reprojectionTables, resolvePatch, resolveRankPartition, resolveRankSeekTuple, resolveRelationPredicates, resolveWith, rowToDocument, runDataMigration, runDrizzle, runExternalSourceTick, runReadonlySql, runRowValidators, runShardMigrations, runSocketPool, runSql, runTriggers, selectExpiredIds, selectExportTables, selectIndexForAggregate, selectIndexForCount, selectIndexForGroupBy, selectMatchingIds, selectShapeMembers, selectShapeRows, serializeSqlValue, serverInList, shapeRoutingKey, softDeleteScope, sortColumnName, sqliteInList, stripReservedPatchFields, stubByName, subscriptionFrames, subscriptionListDeltas, summarizeFanoutTopics, summarizeSubscriptions, tableColumns, tableFromDepKey, throwingScheduler, tiebreakDirectionFor, trimCdcChanges, trimIdempotent, trimScheduleOutbox, trimStreamRuns, tryRowToDocument, trySendFrame, unionAll, uniqueIndexFields, validateImportRow, whereFilter, whereOfFilter, writeCdcArchivedThrough, writeGlobalShapeSnapshot, writeIdempotent, writeReactorState, writeSearchBackfillState, writeShapePokeCursor, writeShapePokeCursors, writeTouchesMemo };
|