@lunora/shard-engine 1.0.0-alpha.14 → 1.0.0-alpha.141
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 +849 -169
- package/dist/index.d.ts +849 -169
- 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-DwSg1Ecx.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-CNXsYOSU.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/RELAY_SIGNATURE_HEADER-C_P73AOx.mjs +1 -0
- package/dist/packem_shared/REPROJECTION_MIGRATION_PREFIX-Czcb6_mO.mjs +1 -0
- package/dist/packem_shared/RLS_UNWRAP_SYMBOL-J1tiBtRj.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-BqNxWyzF.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-DoGZerel.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/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.mts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { LunoraError } from '@lunora/errors';
|
|
2
|
+
import { R2BucketLike, ShardHost, SocketHost, SocketHandle } from '@lunora/platform';
|
|
2
3
|
import { SQL, Name } from 'drizzle-orm';
|
|
3
|
-
|
|
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,82 @@ 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
|
+
deliveryPermits?: Record<string, {
|
|
161
|
+
epoch: number;
|
|
162
|
+
scope: string;
|
|
163
|
+
}>;
|
|
164
|
+
expiresAt?: number;
|
|
165
|
+
identity?: Record<string, unknown>;
|
|
166
|
+
ip?: string;
|
|
167
|
+
liveGrants?: Record<string, string>;
|
|
168
|
+
pageDeltas?: boolean;
|
|
169
|
+
shapes?: Record<string, ShapeSubscriptionQuery>;
|
|
170
|
+
socketFunction?: string;
|
|
171
|
+
socketPath?: string;
|
|
172
|
+
subs: Record<string, SubscriptionQuery>;
|
|
173
|
+
userId?: string;
|
|
174
|
+
whispers?: string[];
|
|
175
|
+
}
|
|
176
|
+
interface ResolvedShape {
|
|
177
|
+
columns?: ReadonlyArray<string>;
|
|
178
|
+
effectiveWhere?: WhereInput;
|
|
179
|
+
global?: boolean;
|
|
180
|
+
table: string;
|
|
181
|
+
}
|
|
182
|
+
interface SubscriptionIdentity {
|
|
183
|
+
identity?: Record<string, unknown>;
|
|
184
|
+
ip?: string;
|
|
185
|
+
userId?: string;
|
|
186
|
+
}
|
|
187
|
+
interface ShardSocketLike {
|
|
188
|
+
readonly bufferedAmount?: number;
|
|
189
|
+
close?: (code?: number, reason?: string) => void;
|
|
190
|
+
deserializeAttachment?: () => unknown;
|
|
191
|
+
send: (data: string) => void;
|
|
192
|
+
serializeAttachment?: (value: unknown) => void;
|
|
193
|
+
}
|
|
89
194
|
type AggregateOp = "avg" | "count" | "max" | "min" | "sum";
|
|
90
195
|
interface AggregateIndexDefinitionLike {
|
|
91
196
|
readonly by?: ReadonlyArray<string>;
|
|
@@ -137,6 +242,11 @@ interface ColumnMetaLike {
|
|
|
137
242
|
interface ValidatorLike {
|
|
138
243
|
readonly _meta?: {
|
|
139
244
|
readonly column?: ColumnMetaLike;
|
|
245
|
+
readonly inner?: ValidatorLike;
|
|
246
|
+
readonly members?: ReadonlyArray<ValidatorLike>;
|
|
247
|
+
readonly shape?: Readonly<Record<string, ValidatorLike>>;
|
|
248
|
+
readonly tableName?: string;
|
|
249
|
+
readonly value?: unknown;
|
|
140
250
|
};
|
|
141
251
|
readonly kind?: string;
|
|
142
252
|
readonly parse?: (value: unknown) => unknown;
|
|
@@ -144,7 +254,7 @@ interface ValidatorLike {
|
|
|
144
254
|
type TriggerTimingLike = "after" | "before";
|
|
145
255
|
type TriggerOpLike = "delete" | "insert" | "update";
|
|
146
256
|
interface SchedulableWorkflowReferenceLike {
|
|
147
|
-
readonly
|
|
257
|
+
readonly className?: string;
|
|
148
258
|
readonly isLunoraWorkflow: true;
|
|
149
259
|
readonly name?: string;
|
|
150
260
|
}
|
|
@@ -178,11 +288,18 @@ interface SchemaLike {
|
|
|
178
288
|
readonly rlsMode?: "required";
|
|
179
289
|
readonly tables: Record<string, TableDefinitionLike>;
|
|
180
290
|
}
|
|
291
|
+
type PatchVerifier = (previous: Record<string, unknown>, next: Record<string, unknown>) => boolean;
|
|
292
|
+
interface PatchWriteOptions {
|
|
293
|
+
verify?: PatchVerifier;
|
|
294
|
+
}
|
|
181
295
|
interface TableDefinitionLike {
|
|
182
296
|
readonly aggregateIndexes?: ReadonlyArray<AggregateIndexDefinitionLike>;
|
|
297
|
+
readonly commitOrderedMode?: boolean;
|
|
298
|
+
readonly dropStalePatchesMode?: boolean;
|
|
183
299
|
readonly geoIndexes?: ReadonlyArray<GeoIndexDefinitionLike>;
|
|
184
300
|
readonly indexes: ReadonlyArray<IndexDefinitionLike>;
|
|
185
301
|
readonly isPublic?: boolean;
|
|
302
|
+
readonly memoryMode?: boolean;
|
|
186
303
|
readonly rankIndexes?: ReadonlyArray<RankIndexDefinitionLike>;
|
|
187
304
|
readonly relationMap?: Record<string, RelationDefinitionLike>;
|
|
188
305
|
readonly searchIndexes?: ReadonlyArray<SearchIndexDefinitionLike>;
|
|
@@ -200,13 +317,25 @@ interface TableDefinitionLike {
|
|
|
200
317
|
field: string;
|
|
201
318
|
};
|
|
202
319
|
}
|
|
203
|
-
interface
|
|
320
|
+
interface KeyedRelationDefinitionLike {
|
|
204
321
|
readonly field: string;
|
|
205
322
|
readonly kind: "many" | "one";
|
|
206
323
|
readonly onDelete?: OnDeleteActionLike;
|
|
207
324
|
readonly references: string;
|
|
208
325
|
readonly table: string;
|
|
326
|
+
readonly through?: never;
|
|
327
|
+
}
|
|
328
|
+
interface RelationThroughLike {
|
|
329
|
+
readonly from: string;
|
|
330
|
+
readonly table: string;
|
|
331
|
+
readonly to: string;
|
|
209
332
|
}
|
|
333
|
+
interface ThroughRelationDefinitionLike {
|
|
334
|
+
readonly kind: "many";
|
|
335
|
+
readonly table: string;
|
|
336
|
+
readonly through: RelationThroughLike;
|
|
337
|
+
}
|
|
338
|
+
type RelationDefinitionLike = KeyedRelationDefinitionLike | ThroughRelationDefinitionLike;
|
|
210
339
|
type OnDeleteActionLike = "cascade" | "restrict" | "set null";
|
|
211
340
|
interface NestedWith {
|
|
212
341
|
limit?: number;
|
|
@@ -219,17 +348,16 @@ interface WithInput {
|
|
|
219
348
|
[relationName: string]: NestedWith | Record<string, true> | boolean | undefined;
|
|
220
349
|
_count?: Record<string, true>;
|
|
221
350
|
}
|
|
222
|
-
interface
|
|
223
|
-
|
|
224
|
-
relation: RelationDefinitionLike;
|
|
225
|
-
row: Record<string, unknown>;
|
|
226
|
-
tableName: string;
|
|
351
|
+
interface FanOutBudget {
|
|
352
|
+
remaining: number;
|
|
227
353
|
}
|
|
228
354
|
interface ResolveWithOptions {
|
|
355
|
+
fanOutBudget?: FanOutBudget;
|
|
229
356
|
fetcher: (tableName: string, args: QueryArgs) => Promise<QueryPage>;
|
|
230
357
|
groupedCounter: (tableName: string, whereField: string, values: unknown[], policyWhere?: WhereInput) => Promise<Map<unknown, number>>;
|
|
231
358
|
parents: Record<string, unknown>[];
|
|
232
359
|
relationBaseWhere?: (table: string) => undefined | WhereInput;
|
|
360
|
+
relationMask?: RelationMask;
|
|
233
361
|
schema: {
|
|
234
362
|
readonly tables: Record<string, TableDefinitionLike>;
|
|
235
363
|
};
|
|
@@ -242,28 +370,85 @@ interface ResolveWithResult {
|
|
|
242
370
|
rows: Record<string, unknown>[];
|
|
243
371
|
}
|
|
244
372
|
type SortDirection = "asc" | "desc";
|
|
245
|
-
type
|
|
373
|
+
type NullPlacement = "first" | "last";
|
|
374
|
+
type OrderByInput = Record<string, SortDirection | {
|
|
375
|
+
nulls: NullPlacement;
|
|
376
|
+
sort: SortDirection;
|
|
377
|
+
}>;
|
|
246
378
|
interface QueryArgs {
|
|
247
379
|
baseWhere?: WhereInput;
|
|
248
380
|
cursor?: null | string;
|
|
249
381
|
includeDeleted?: boolean;
|
|
250
382
|
limit?: number;
|
|
383
|
+
omitContinueCursor?: boolean;
|
|
251
384
|
orderBy?: OrderByInput[];
|
|
252
385
|
relationBaseWhere?: (table: string) => undefined | WhereInput;
|
|
386
|
+
relationMask?: RelationMask;
|
|
253
387
|
restrictsCounts?: boolean;
|
|
254
388
|
select?: ReadonlyArray<string>;
|
|
255
389
|
where?: WhereInput;
|
|
256
390
|
with?: WithInput;
|
|
257
391
|
}
|
|
392
|
+
interface CrossShardReadArgs {
|
|
393
|
+
orderBy?: OrderByInput[];
|
|
394
|
+
relationPolicies?: Record<string, WhereInput>;
|
|
395
|
+
where?: WhereInput;
|
|
396
|
+
with?: WithInput;
|
|
397
|
+
}
|
|
398
|
+
type RelationMask = (table: string, rows: Record<string, unknown>[]) => Record<string, unknown>[];
|
|
399
|
+
interface QueryPlan {
|
|
400
|
+
params: unknown[];
|
|
401
|
+
plan: string[];
|
|
402
|
+
sql: string;
|
|
403
|
+
}
|
|
258
404
|
interface QueryPage {
|
|
259
405
|
continueCursor: null | string;
|
|
260
406
|
isDone: boolean;
|
|
261
407
|
page: Record<string, unknown>[];
|
|
262
408
|
splitCursor?: null | string;
|
|
263
409
|
}
|
|
410
|
+
interface RelationEdge {
|
|
411
|
+
readonly array: boolean;
|
|
412
|
+
readonly column: string;
|
|
413
|
+
readonly name: string;
|
|
414
|
+
readonly sourceTable: string;
|
|
415
|
+
readonly targetTable: string;
|
|
416
|
+
}
|
|
417
|
+
interface RelatedStartReference {
|
|
418
|
+
id: string;
|
|
419
|
+
table: string;
|
|
420
|
+
}
|
|
421
|
+
type RelatedStart = (Record<string, unknown> & {
|
|
422
|
+
_id: string;
|
|
423
|
+
}) | RelatedStartReference;
|
|
424
|
+
type RelatedDirection = "both" | "in" | "out";
|
|
425
|
+
interface RelatedOptions {
|
|
426
|
+
cursor?: null | string;
|
|
427
|
+
depth?: number;
|
|
428
|
+
direction?: RelatedDirection;
|
|
429
|
+
edges?: ReadonlyArray<string>;
|
|
430
|
+
limit?: number;
|
|
431
|
+
relationBaseWhere?: (table: string) => undefined | WhereInput;
|
|
432
|
+
relationMask?: RelationMask;
|
|
433
|
+
}
|
|
434
|
+
interface RelatedNode {
|
|
435
|
+
depth: number;
|
|
436
|
+
document: Record<string, unknown>;
|
|
437
|
+
path: ReadonlyArray<string>;
|
|
438
|
+
pathIds: ReadonlyArray<string>;
|
|
439
|
+
score: number;
|
|
440
|
+
table: string;
|
|
441
|
+
}
|
|
442
|
+
interface RelatedPage {
|
|
443
|
+
continueCursor: null | string;
|
|
444
|
+
isDone: boolean;
|
|
445
|
+
nodes: RelatedNode[];
|
|
446
|
+
}
|
|
264
447
|
interface OrderKey {
|
|
265
448
|
direction: SortDirection;
|
|
266
449
|
field: string;
|
|
450
|
+
nullable: boolean;
|
|
451
|
+
nulls?: NullPlacement;
|
|
267
452
|
}
|
|
268
453
|
interface RestrictableQueryOptions {
|
|
269
454
|
baseWhere?: WhereInput;
|
|
@@ -399,10 +584,8 @@ interface LifecycleEvent {
|
|
|
399
584
|
shardKey: string;
|
|
400
585
|
userId: string | null;
|
|
401
586
|
}
|
|
402
|
-
interface LifecycleDispatchInfo {
|
|
587
|
+
interface LifecycleDispatchInfo extends SubscriptionIdentity {
|
|
403
588
|
event: LifecycleEvent;
|
|
404
|
-
identity: Record<string, unknown> | undefined;
|
|
405
|
-
userId: string | undefined;
|
|
406
589
|
}
|
|
407
590
|
interface MutationDelta {
|
|
408
591
|
indexKeys?: ReadonlyArray<IndexKeyEntry>;
|
|
@@ -414,6 +597,14 @@ interface MutationDelta {
|
|
|
414
597
|
interface DatabaseWriterLike {
|
|
415
598
|
aggregate: (tableName: string, options: AggregateOptions) => Promise<AggregateResult>;
|
|
416
599
|
asId?: (tableName: string, id: string) => string;
|
|
600
|
+
assertPatchAllowed?: (id: string, expectedTable?: string) => Promise<void>;
|
|
601
|
+
cdcChangedTables?: (sinceSeq: number, options?: {
|
|
602
|
+
cursorOnly?: boolean;
|
|
603
|
+
}) => Promise<{
|
|
604
|
+
cursor: number;
|
|
605
|
+
floor?: number;
|
|
606
|
+
tables: string[];
|
|
607
|
+
} | undefined>;
|
|
417
608
|
count: (tableName: string, where?: RestrictableQueryOptions | WhereInput) => Promise<number>;
|
|
418
609
|
delete: (id: string, expectedTable?: string, options?: {
|
|
419
610
|
hard?: boolean;
|
|
@@ -429,11 +620,13 @@ interface DatabaseWriterLike {
|
|
|
429
620
|
}, expectedTable?: string) => Promise<{
|
|
430
621
|
deleted: number;
|
|
431
622
|
}>;
|
|
623
|
+
deleteRereadTables?: ReadonlySet<string>;
|
|
432
624
|
deleteWhere?: (tableName: string, where: WhereInput, options?: {
|
|
433
625
|
limit?: number;
|
|
434
626
|
}) => Promise<{
|
|
435
627
|
deleted: number;
|
|
436
628
|
}>;
|
|
629
|
+
explain: (tableName: string, args?: QueryArgs) => Promise<QueryPlan>;
|
|
437
630
|
findFirst: (tableName: string, args?: QueryArgs) => Promise<Record<string, unknown> | null>;
|
|
438
631
|
findFirstOrThrow: (tableName: string, args?: QueryArgs) => Promise<Record<string, unknown>>;
|
|
439
632
|
findMany: (tableName: string, args?: QueryArgs) => Promise<QueryPage>;
|
|
@@ -451,12 +644,21 @@ interface DatabaseWriterLike {
|
|
|
451
644
|
allowExplicitId?: boolean;
|
|
452
645
|
limit?: number;
|
|
453
646
|
}) => Promise<string[]>;
|
|
647
|
+
inTransaction?: () => boolean;
|
|
454
648
|
lookupById?: (id: string, expectedTable?: string) => Promise<null | {
|
|
455
649
|
row: Record<string, unknown>;
|
|
456
650
|
tableName: string;
|
|
457
651
|
}>;
|
|
458
652
|
normalizeId: (tableName: string, id: string) => null | string;
|
|
459
|
-
patch: (id: string, patch: Record<string, unknown>, expectedTable?: string) => Promise<void>;
|
|
653
|
+
patch: (id: string, patch: Record<string, unknown>, expectedTable?: string, options?: PatchWriteOptions) => Promise<void>;
|
|
654
|
+
patchIf?: (tableName: string, id: string, args: {
|
|
655
|
+
patch: Record<string, unknown>;
|
|
656
|
+
verify?: PatchVerifier;
|
|
657
|
+
where: WhereInput;
|
|
658
|
+
}) => Promise<{
|
|
659
|
+
applied: boolean;
|
|
660
|
+
doc: Record<string, unknown> | null;
|
|
661
|
+
}>;
|
|
460
662
|
patchMany?: (patches: ReadonlyArray<{
|
|
461
663
|
id: string;
|
|
462
664
|
patch: Record<string, unknown>;
|
|
@@ -478,10 +680,14 @@ interface DatabaseWriterLike {
|
|
|
478
680
|
rankBefore?: (tableName: string, indexName: string, options: RankBeforeOptions) => Promise<RankBeforeResult>;
|
|
479
681
|
rankPage: (tableName: string, indexName: string, options?: RankPageOptions) => Promise<RankPage>;
|
|
480
682
|
rankPageRows?: (tableName: string, indexName: string, options?: RankPageOptions) => Promise<ShardRankPageResult>;
|
|
683
|
+
related?: (start: RelatedStart, options?: RelatedOptions) => Promise<RelatedPage>;
|
|
684
|
+
relationEdges?: ReadonlyArray<RelationEdge>;
|
|
685
|
+
relationWrites?: RelationWriteMap;
|
|
481
686
|
replace: (id: string, document: Record<string, unknown>, expectedTable?: string, options?: {
|
|
482
687
|
allowExplicitId?: boolean;
|
|
483
688
|
}) => Promise<void>;
|
|
484
689
|
restore?: (id: string, expectedTable?: string) => Promise<void>;
|
|
690
|
+
softDeleteFields?: ReadonlyMap<string, string>;
|
|
485
691
|
system?: SystemDatabaseReader;
|
|
486
692
|
wipeShard?: (options?: {
|
|
487
693
|
chunkSize?: number;
|
|
@@ -516,7 +722,6 @@ interface ImportShardResult {
|
|
|
516
722
|
inserted: Record<string, number>;
|
|
517
723
|
}
|
|
518
724
|
declare const selectExportTables: (schema: SchemaLike, requested?: ReadonlyArray<string>) => string[];
|
|
519
|
-
declare const exportShardTable: (writer: DatabaseWriterLike, table: string, batchSize?: number) => AsyncGenerator<ExportRow, void, undefined>;
|
|
520
725
|
declare const exportShardRows: (writer: DatabaseWriterLike, schema: SchemaLike, args: ExportShardArgs) => AsyncGenerator<ExportRow, void, undefined>;
|
|
521
726
|
declare const validateImportRow: (schema: SchemaLike, table: string, record: Record<string, unknown>) => string | undefined;
|
|
522
727
|
declare const importShardRows: (writer: DatabaseWriterLike, schema: SchemaLike, args: ImportShardArgs) => Promise<ImportShardResult>;
|
|
@@ -564,8 +769,6 @@ declare const selectIndexForGroupBy: (indexes: ReadonlyArray<AggregateIndexDefin
|
|
|
564
769
|
index: AggregateIndexDefinitionLike;
|
|
565
770
|
partial: Record<string, unknown>;
|
|
566
771
|
};
|
|
567
|
-
declare const stableStringify: (value: unknown) => string;
|
|
568
|
-
declare const stableWireKey: (value: unknown) => string;
|
|
569
772
|
interface CacheEntry {
|
|
570
773
|
bytes: number;
|
|
571
774
|
deps: Set<string>;
|
|
@@ -591,6 +794,7 @@ declare class ReactiveCache {
|
|
|
591
794
|
private readonly maxBytes;
|
|
592
795
|
private readonly now;
|
|
593
796
|
private monotonic;
|
|
797
|
+
private generation;
|
|
594
798
|
constructor(options?: ReactiveCacheOptions);
|
|
595
799
|
run<R>(key: string, deps: Set<string>, run: () => Promise<R>, ranges?: () => ReadonlyArray<KeyRange>): Promise<R>;
|
|
596
800
|
invalidate(table: string, id: string, indexKeys?: ReadonlyArray<IndexKeyEntry>): string[];
|
|
@@ -651,12 +855,18 @@ interface RunTriggersOptions {
|
|
|
651
855
|
}
|
|
652
856
|
declare const runTriggers: (options: RunTriggersOptions) => Promise<void>;
|
|
653
857
|
declare const hasTrigger: (schema: SchemaLike, tableName: string, op: TriggerOpLike) => boolean;
|
|
858
|
+
interface SearchBackfillProgress {
|
|
859
|
+
done: boolean;
|
|
860
|
+
pages: number;
|
|
861
|
+
}
|
|
654
862
|
declare const backfillAggregateIndexes: (sql: SqlExec, schema: SchemaLike) => void;
|
|
655
863
|
declare const backfillRankIndexes: (sql: SqlExec, schema: SchemaLike) => void;
|
|
656
864
|
declare const backfillSearchIndexesForTable: (sql: SqlExec, tableName: string, definition: {
|
|
657
865
|
searchIndexes?: ReadonlyArray<SearchIndexDefinitionLike>;
|
|
658
866
|
}) => void;
|
|
659
|
-
declare const backfillSearchIndexes: (sql: SqlExec, schema: SchemaLike
|
|
867
|
+
declare const backfillSearchIndexes: (sql: SqlExec, schema: SchemaLike, options?: {
|
|
868
|
+
maxPages?: number;
|
|
869
|
+
}) => SearchBackfillProgress;
|
|
660
870
|
declare const CDC_LOG_TABLE = "__cdc_log";
|
|
661
871
|
interface CdcChange {
|
|
662
872
|
doc?: Record<string, unknown>;
|
|
@@ -666,19 +876,35 @@ interface CdcChange {
|
|
|
666
876
|
table: string;
|
|
667
877
|
ts: number;
|
|
668
878
|
}
|
|
669
|
-
declare const
|
|
879
|
+
declare const CDC_LOG_TABLE_SEQ_INDEX = "__cdc_log_table_seq";
|
|
880
|
+
declare const migrateCdcLog: (sql: SqlExec, options?: {
|
|
881
|
+
rowHistoryIndex?: boolean;
|
|
882
|
+
}) => void;
|
|
670
883
|
declare const appendCdcChange: (sql: SqlExec, ts: number, table: string, id: string, op: CdcChange["op"], doc: Record<string, unknown> | undefined) => void;
|
|
671
884
|
declare const readCdcChanges: (sql: SqlExec, options?: {
|
|
672
885
|
limit?: number;
|
|
673
886
|
sinceSeq?: number;
|
|
674
|
-
tables?: ReadonlySet<string>;
|
|
675
887
|
}) => {
|
|
676
888
|
changes: CdcChange[];
|
|
677
889
|
cursor: number;
|
|
678
890
|
};
|
|
679
|
-
declare const
|
|
891
|
+
declare const cdcTouchesTables: (sql: SqlExec, sinceSeq: number, tables: ReadonlySet<string>) => boolean;
|
|
892
|
+
declare const cdcCanVouchFor: (sql: SqlExec, deps: ReadonlySet<string>) => boolean;
|
|
893
|
+
interface CdcChangeKey {
|
|
894
|
+
id: string;
|
|
895
|
+
op: CdcChange["op"];
|
|
896
|
+
seq: number;
|
|
897
|
+
}
|
|
898
|
+
declare const readCdcChangeKeys: (sql: SqlExec, table: string, sinceSeq: number, upTo: number) => CdcChangeKey[];
|
|
899
|
+
declare const trimCdcChanges: (sql: SqlExec, throughSeq: number, maxRows: number) => void;
|
|
900
|
+
declare const compactCdcDocs: (sql: SqlExec, throughSeq: number, maxRows: number) => void;
|
|
901
|
+
declare const cdcSeqLeavingRows: (sql: SqlExec, keep: number) => number | undefined;
|
|
680
902
|
declare const readCdcCursor: (sql: SqlExec) => number;
|
|
903
|
+
declare const cursorBelowRetainedFloor: (floor: number | undefined, sinceSeq: number) => boolean;
|
|
904
|
+
declare const cdcTrimmedError: (floor: number, sinceSeq: number, scope: "global" | "shard") => LunoraError;
|
|
905
|
+
declare const cdcForkedError: (cursor: number, sinceSeq: number, scope: "global" | "shard", epoch?: string) => LunoraError;
|
|
681
906
|
declare const minCdcSeq: (sql: SqlExec) => number | undefined;
|
|
907
|
+
declare const minCdcReplayableSeq: (sql: SqlExec) => number | undefined;
|
|
682
908
|
declare const CDC_META_TABLE = "__cdc_meta";
|
|
683
909
|
declare const migrateCdcMeta: (sql: SqlExec) => void;
|
|
684
910
|
declare const readCdcEpoch: (sql: SqlExec) => string;
|
|
@@ -688,12 +914,6 @@ declare const CLIENT_WATERMARK_TABLE = "__client_watermark";
|
|
|
688
914
|
declare const migrateClientWatermark: (sql: SqlExec) => void;
|
|
689
915
|
declare const readClientWatermark: (sql: SqlExec, identity: string, clientId: string) => number;
|
|
690
916
|
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
917
|
declare const IDEMPOTENCY_TABLE = "__idempotency";
|
|
698
918
|
interface IdempotentRecord {
|
|
699
919
|
resultJson: string;
|
|
@@ -710,50 +930,19 @@ declare const runShardMigrations: (sql: SqlExec, schema: SchemaLike, options?: {
|
|
|
710
930
|
json: string;
|
|
711
931
|
};
|
|
712
932
|
}) => 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
933
|
interface ShapeRow {
|
|
747
934
|
doc: Record<string, unknown>;
|
|
748
935
|
id: string;
|
|
749
936
|
}
|
|
750
937
|
declare const selectShapeRows: (sql: SqlExec, table: string, effectiveWhere: WhereInput | undefined) => ShapeRow[];
|
|
751
|
-
declare const
|
|
938
|
+
declare const selectShapeMembers: (sql: SqlExec, table: string, effectiveWhere: WhereInput | undefined, ids: ReadonlyArray<string>) => Map<string, Record<string, unknown>>;
|
|
752
939
|
interface SqlExec {
|
|
753
940
|
exec: <Row = Record<string, unknown>>(sql: string, ...params: unknown[]) => SqlCursor<Row>;
|
|
754
941
|
}
|
|
755
942
|
interface SqlCursor<Row> extends Iterable<Row> {
|
|
943
|
+
readonly columnNames?: string[];
|
|
756
944
|
one: () => Row;
|
|
945
|
+
raw?: () => IterableIterator<unknown[]>;
|
|
757
946
|
toArray: () => Row[];
|
|
758
947
|
}
|
|
759
948
|
type IndexUseHook = (table: string, indexName: string, kind: "geo" | "index" | "rank" | "search") => void;
|
|
@@ -769,6 +958,7 @@ interface WriteEvent {
|
|
|
769
958
|
type WriteHook = (event: WriteEvent) => Promise<void> | void;
|
|
770
959
|
interface CtxDbOptions {
|
|
771
960
|
auth?: ServerDefaultContextLike["auth"];
|
|
961
|
+
baselineSeq?: () => number | undefined;
|
|
772
962
|
broadcast?: BroadcastDelta;
|
|
773
963
|
cache?: ReactiveCache;
|
|
774
964
|
cdc?: boolean;
|
|
@@ -777,10 +967,16 @@ interface CtxDbOptions {
|
|
|
777
967
|
globalDb?: DatabaseWriterLike;
|
|
778
968
|
headroom?: TransactionHeadroomTracker;
|
|
779
969
|
idGenerator?: IdGenerator;
|
|
970
|
+
inTransaction?: () => boolean;
|
|
780
971
|
maxRelationKeys?: number;
|
|
781
972
|
onIndexUse?: IndexUseHook;
|
|
782
973
|
onRead?: ReadHook;
|
|
783
974
|
onReadRange?: (range: KeyRange) => void;
|
|
975
|
+
onStalePatchDropped?: (event: {
|
|
976
|
+
fields: string[];
|
|
977
|
+
id: string;
|
|
978
|
+
table: string;
|
|
979
|
+
}) => void;
|
|
784
980
|
onWrite?: WriteHook;
|
|
785
981
|
relationExistsPushDown?: "always" | "auto" | "never";
|
|
786
982
|
scheduler?: SchedulerLike;
|
|
@@ -793,6 +989,8 @@ declare class NotUniqueError extends LunoraError {
|
|
|
793
989
|
constructor(message?: string);
|
|
794
990
|
}
|
|
795
991
|
declare const normalizeIdStructurally: (schema: SchemaLike, tableName: string, id: string) => null | string;
|
|
992
|
+
declare const assertNoExplicitUndefined: (op: "patch" | "patchIf" | "replace", document: Record<string, unknown>) => void;
|
|
993
|
+
declare const stripReservedPatchFields: (patch: Record<string, unknown>) => Record<string, unknown>;
|
|
796
994
|
declare const createShardCtxDb: (options: CtxDbOptions) => DatabaseWriterLike;
|
|
797
995
|
declare const AUDIT_LOG_TABLE = "__lunora_audit__";
|
|
798
996
|
interface AuditEntry {
|
|
@@ -816,68 +1014,24 @@ declare const readAuditLog: (sql: SqlExec, options?: {
|
|
|
816
1014
|
limit?: number;
|
|
817
1015
|
sinceSeq?: number;
|
|
818
1016
|
}) => 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
|
-
}
|
|
1017
|
+
interface CdcArchiveScope {
|
|
1018
|
+
epoch: string;
|
|
1019
|
+
shard: string;
|
|
1020
|
+
}
|
|
1021
|
+
declare const readCdcArchivedThrough: (sql: SqlExec) => number;
|
|
1022
|
+
declare const writeCdcArchivedThrough: (sql: SqlExec, seq: number) => void;
|
|
1023
|
+
declare const archiveCdcSegment: (bucket: R2BucketLike, scope: CdcArchiveScope, changes: CdcChange[]) => Promise<void>;
|
|
1024
|
+
declare const cdcArchiveRewound: (bucket: R2BucketLike, scope: CdcArchiveScope, archivedThrough: number) => Promise<boolean>;
|
|
1025
|
+
declare const readArchivedCdcChanges: (bucket: R2BucketLike, scope: CdcArchiveScope, sinceSeq: number, limit: number | undefined) => Promise<{
|
|
1026
|
+
changes: CdcChange[];
|
|
1027
|
+
cursor: number;
|
|
1028
|
+
} | undefined>;
|
|
1029
|
+
declare const COMMIT_SEQ_TABLE = "__commit_seq";
|
|
1030
|
+
declare const COMMIT_SEQ_FIELD = "_commitSeq";
|
|
1031
|
+
declare const migrateCommitSeq: (sql: SqlExec) => void;
|
|
1032
|
+
declare const readCommitSeq: (sql: SqlExec) => number;
|
|
1033
|
+
declare const allocateCommitSeq: (sql: SqlExec) => number;
|
|
1034
|
+
declare const clearCompanionSignatures: (sql: SqlExec) => void;
|
|
881
1035
|
interface CompanionSyncDeps {
|
|
882
1036
|
broadcast: (delta: MutationDelta) => void;
|
|
883
1037
|
indexKeysFor: (table: string, document?: Record<string, unknown>) => ReadonlyArray<{
|
|
@@ -901,6 +1055,19 @@ interface CompanionSync {
|
|
|
901
1055
|
syncSearch: (tableName: string, id: string, document: Record<string, unknown> | undefined, previous?: Record<string, unknown>) => void;
|
|
902
1056
|
}
|
|
903
1057
|
declare const createCompanionSync: (deps: CompanionSyncDeps) => CompanionSync;
|
|
1058
|
+
declare const GLOBAL_SHAPE_SNAPSHOT_TABLE = "__global_shape_snapshot";
|
|
1059
|
+
declare const migrateGlobalShapeSnapshot: (sql: SqlExec) => void;
|
|
1060
|
+
declare const readGlobalShapeSnapshot: (sql: SqlExec, connectionId: string, subId: string) => Map<string, string> | undefined;
|
|
1061
|
+
declare const writeGlobalShapeSnapshot: (sql: SqlExec, connectionId: string, subId: string, snapshot: Map<string, string>) => void;
|
|
1062
|
+
declare const deleteGlobalShapeSnapshot: (sql: SqlExec, connectionId: string, subId: string) => void;
|
|
1063
|
+
declare const deleteGlobalShapeSnapshotsForConnection: (sql: SqlExec, connectionId: string) => void;
|
|
1064
|
+
declare const isMemoryTable: (definition: TableDefinitionLike | undefined) => boolean;
|
|
1065
|
+
declare const memoryTableNames: (schema: SchemaLike) => string[];
|
|
1066
|
+
declare const clearMemoryTables: (sql: SqlExec, schema: SchemaLike) => number;
|
|
1067
|
+
declare const resolveRankSeekTuple: (options: {
|
|
1068
|
+
after?: RankPageRowKey;
|
|
1069
|
+
cursor?: null | string;
|
|
1070
|
+
}) => unknown[] | undefined;
|
|
904
1071
|
interface RankPageDeps {
|
|
905
1072
|
assertRankPartitionLocal: (tableName: string, definition: TableDefinitionLike, index: RankIndexDefinitionLike) => void;
|
|
906
1073
|
ensureRankBackfilled: (tableName: string, index: RankIndexDefinitionLike) => void;
|
|
@@ -918,8 +1085,68 @@ interface RankPageComputation {
|
|
|
918
1085
|
key: RankPageRowKey;
|
|
919
1086
|
}[];
|
|
920
1087
|
}
|
|
921
|
-
declare const hydrateDocsById: (deps: RankPageDeps, tableName: string, ids: ReadonlyArray<string>) => Map<string, Record<string, unknown>>;
|
|
922
1088
|
declare const computeRankPage: (deps: RankPageDeps, tableName: string, indexName: string, rankPageOptions: RankPageOptions) => RankPageComputation;
|
|
1089
|
+
declare const SCHEDULE_OUTBOX_TABLE = "__schedule_outbox";
|
|
1090
|
+
interface ScheduleOutboxRow {
|
|
1091
|
+
attempts: number;
|
|
1092
|
+
envelopeJson: string;
|
|
1093
|
+
id: string;
|
|
1094
|
+
nextAttemptAt: number;
|
|
1095
|
+
}
|
|
1096
|
+
interface ScheduleOutboxEnvelope {
|
|
1097
|
+
args: unknown;
|
|
1098
|
+
options: Record<string, unknown> | undefined;
|
|
1099
|
+
target: unknown;
|
|
1100
|
+
when: number;
|
|
1101
|
+
}
|
|
1102
|
+
interface ScheduleOutbox {
|
|
1103
|
+
admit: (target: string) => number | undefined;
|
|
1104
|
+
forget: (id: string) => void;
|
|
1105
|
+
record: (id: string, envelope: ScheduleOutboxEnvelope) => void;
|
|
1106
|
+
wake: () => void;
|
|
1107
|
+
}
|
|
1108
|
+
declare const migrateScheduleOutbox: (sql: SqlExec) => void;
|
|
1109
|
+
declare const recordScheduleOutbox: (sql: SqlExec, id: string, envelopeJson: string, now: number) => void;
|
|
1110
|
+
declare const forgetScheduleOutbox: (sql: SqlExec, id: string) => void;
|
|
1111
|
+
declare const readDueScheduleOutbox: (sql: SqlExec, nowMs: number, limit: number) => ScheduleOutboxRow[];
|
|
1112
|
+
declare const deferScheduleOutbox: (sql: SqlExec, id: string, attempts: number, nextAttemptAt: number) => void;
|
|
1113
|
+
declare const parkScheduleOutbox: (sql: SqlExec, id: string, attempts: number) => void;
|
|
1114
|
+
declare const probeScheduleOutbox: (sql: SqlExec) => {
|
|
1115
|
+
dueAt: number | undefined;
|
|
1116
|
+
populated: boolean;
|
|
1117
|
+
};
|
|
1118
|
+
declare const trimScheduleOutbox: (sql: SqlExec, olderThanTs: number) => void;
|
|
1119
|
+
/**
|
|
1120
|
+
* How far a companion's backfill has progressed, and under which analysis.
|
|
1121
|
+
* Declared here rather than beside either engine's state table: both record the
|
|
1122
|
+
* same three facts, and the decisions made from them are the shared policy
|
|
1123
|
+
* below.
|
|
1124
|
+
*/
|
|
1125
|
+
interface BackfillState {
|
|
1126
|
+
/** Last `id` indexed, or `undefined` when no page has run yet. */
|
|
1127
|
+
cursor: string | undefined;
|
|
1128
|
+
/** True once a page came back short — the table is fully indexed. */
|
|
1129
|
+
done: boolean;
|
|
1130
|
+
/** Analyzer profile the stored rows were built with; `undefined` predates profile tracking. */
|
|
1131
|
+
profile: string | undefined;
|
|
1132
|
+
}
|
|
1133
|
+
declare const SEARCH_STATE_TABLE = "__lunora_search_state";
|
|
1134
|
+
declare const migrateSearchState: (sql: SqlExec) => void;
|
|
1135
|
+
declare const readSearchBackfillState: (sql: SqlExec, companion: string) => BackfillState;
|
|
1136
|
+
declare const writeSearchBackfillState: (sql: SqlExec, companion: string, cursor: string | undefined, done: boolean, profile: string) => void;
|
|
1137
|
+
declare const SHAPE_POKE_CURSOR_TABLE = "__shape_poke_cursor";
|
|
1138
|
+
declare const migrateShapePokeCursor: (sql: SqlExec) => void;
|
|
1139
|
+
declare const readShapePokeCursor: (sql: SqlExec, connectionId: string, subId: string) => number | undefined;
|
|
1140
|
+
declare const writeShapePokeCursor: (sql: SqlExec, connectionId: string, subId: string, cursor: number) => void;
|
|
1141
|
+
interface ShapePokeCursorRow {
|
|
1142
|
+
connectionId: string;
|
|
1143
|
+
cursor: number;
|
|
1144
|
+
subId: string;
|
|
1145
|
+
}
|
|
1146
|
+
declare const writeShapePokeCursors: (sql: SqlExec, rows: ReadonlyArray<ShapePokeCursorRow>) => void;
|
|
1147
|
+
declare const minShapePokeCursor: (sql: SqlExec) => number | undefined;
|
|
1148
|
+
declare const deleteShapePokeCursor: (sql: SqlExec, connectionId: string, subId: string) => void;
|
|
1149
|
+
declare const deleteShapePokeCursorsForConnection: (sql: SqlExec, connectionId: string) => void;
|
|
923
1150
|
declare const DATA_MIGRATION_STATE_TABLE = "__lunora_migrations";
|
|
924
1151
|
type MigrationDirection = "down" | "up";
|
|
925
1152
|
type MigrationStatus = "completed" | "failed" | "in_progress";
|
|
@@ -983,6 +1210,29 @@ interface DependencyTracker {
|
|
|
983
1210
|
declare const createDependencyTracker: () => DependencyTracker;
|
|
984
1211
|
declare const runSql: <Row = Record<string, unknown>>(sql: SqlExec, query: string, ...params: unknown[]) => SqlCursor<Row>;
|
|
985
1212
|
declare const runDrizzle: <Row = Record<string, unknown>>(exec: SqlExec, query: SQL) => SqlCursor<Row>;
|
|
1213
|
+
type RangeOperandType = "boolean" | "number" | "string";
|
|
1214
|
+
interface WhereFragments<T> {
|
|
1215
|
+
binary: (reference: T, comparator: string, value: unknown) => T;
|
|
1216
|
+
connect: (left: T, right: T, connector: "AND" | "OR") => T;
|
|
1217
|
+
constant: (value: boolean) => T;
|
|
1218
|
+
contains: (reference: T, term: T) => T;
|
|
1219
|
+
inList: (reference: T, items: ReadonlyArray<unknown>, negated: boolean, budget: number) => T;
|
|
1220
|
+
negate: (inner: T) => T;
|
|
1221
|
+
nullCheck: (reference: T, negated: boolean) => T;
|
|
1222
|
+
value: (value: unknown) => T;
|
|
1223
|
+
}
|
|
1224
|
+
type FieldRefSql<T> = (field: string) => T;
|
|
1225
|
+
type SerializeValue = (value: unknown, field: string) => unknown;
|
|
1226
|
+
interface WhereSqlStrategy<T = SQL> {
|
|
1227
|
+
containsExpr?: (reference: T, term: T) => T;
|
|
1228
|
+
fieldRef: FieldRefSql<T>;
|
|
1229
|
+
inList?: (reference: T, items: ReadonlyArray<unknown>, negated: boolean, budget?: number) => T;
|
|
1230
|
+
rangeTypeGuard: (field: string, type: RangeOperandType) => T;
|
|
1231
|
+
relationExists?: (request: unknown) => T;
|
|
1232
|
+
serialize: SerializeValue;
|
|
1233
|
+
}
|
|
1234
|
+
declare const serverInList: (engine: "mysql" | "postgres") => (reference: SQL, items: ReadonlyArray<unknown>, negated: boolean, budget?: number) => SQL;
|
|
1235
|
+
declare const compileWhereSql: <T = SQL>(where: WhereInput | undefined, strategy: WhereSqlStrategy<T>, fragments?: WhereFragments<T>, reservedParams?: number) => T | undefined;
|
|
986
1236
|
declare const quoteIdentifier: (name: string) => string;
|
|
987
1237
|
declare const serializeSqlValue: (value: unknown) => unknown;
|
|
988
1238
|
declare const DOC_COLUMN = "__doc__";
|
|
@@ -996,10 +1246,16 @@ declare const AGG_KEY: Name;
|
|
|
996
1246
|
declare const AGG_VALUE: Name;
|
|
997
1247
|
declare const AGG_COUNT: Name;
|
|
998
1248
|
declare const aggUpsertSql: (aggTable: string, key: unknown, value: unknown, count: unknown, set: SQL) => SQL;
|
|
999
|
-
declare const tableColumns: (definition: TableDefinitionLike) => [string, ColumnMetaLike]
|
|
1249
|
+
declare const tableColumns: (definition: TableDefinitionLike) => ReadonlyArray<readonly [string, ColumnMetaLike]>;
|
|
1000
1250
|
declare const rowToDocument: (row: Record<string, unknown> | undefined) => Record<string, unknown> | undefined;
|
|
1001
1251
|
declare const tryRowToDocument: (row: Record<string, unknown> | undefined) => Record<string, unknown> | undefined;
|
|
1002
1252
|
declare const isFtsAvailable: (sql: SqlExec) => boolean;
|
|
1253
|
+
declare const WORKERD_SQLITE_LIMITS: {
|
|
1254
|
+
readonly boundParams: 100;
|
|
1255
|
+
readonly compoundSelect: 5;
|
|
1256
|
+
readonly likePattern: 50;
|
|
1257
|
+
readonly sqlTextLength: 100000;
|
|
1258
|
+
};
|
|
1003
1259
|
type SqlEngine = "mysql" | "postgres" | "sqlite";
|
|
1004
1260
|
interface RenderedSql {
|
|
1005
1261
|
params: unknown[];
|
|
@@ -1007,6 +1263,79 @@ interface RenderedSql {
|
|
|
1007
1263
|
}
|
|
1008
1264
|
declare const renderSql: (engine: SqlEngine, query: SQL) => RenderedSql;
|
|
1009
1265
|
declare const param: (value: unknown) => SQL;
|
|
1266
|
+
declare const unionAll: (branches: ReadonlyArray<SQL>) => SQL;
|
|
1267
|
+
declare const sqliteInList: (reference: SQL, items: ReadonlyArray<unknown>, negated: boolean, budget?: number) => SQL;
|
|
1268
|
+
type DurableStreamStatus = "complete" | "error" | "running";
|
|
1269
|
+
interface DurableStreamRun {
|
|
1270
|
+
error?: string;
|
|
1271
|
+
errorCode?: string;
|
|
1272
|
+
lastSeq: number;
|
|
1273
|
+
startedAt: number;
|
|
1274
|
+
status: DurableStreamStatus;
|
|
1275
|
+
}
|
|
1276
|
+
interface DurableStreamChunk {
|
|
1277
|
+
dataJson: string;
|
|
1278
|
+
seq: number;
|
|
1279
|
+
}
|
|
1280
|
+
declare const migrateDurableStreams: (sql: SqlExec) => void;
|
|
1281
|
+
declare const readStreamRun: (sql: SqlExec, runKey: string) => DurableStreamRun | undefined;
|
|
1282
|
+
declare const claimStreamRun: (sql: SqlExec, runKey: string, startedAt: number, ttlMs: number) => boolean;
|
|
1283
|
+
declare const deleteStreamRun: (sql: SqlExec, runKey: string) => void;
|
|
1284
|
+
declare const appendStreamChunk: (sql: SqlExec, runKey: string, seq: number, dataJson: string) => void;
|
|
1285
|
+
declare const readStreamChunks: (sql: SqlExec, runKey: string, sinceSeq: number) => DurableStreamChunk[];
|
|
1286
|
+
declare const finishStreamRun: (sql: SqlExec, runKey: string, status: "complete" | "error", lastSeq: number, failure?: {
|
|
1287
|
+
code: string;
|
|
1288
|
+
message: string;
|
|
1289
|
+
}) => void;
|
|
1290
|
+
declare const trimStreamRuns: (sql: SqlExec, now: number, live: ReadonlySet<string>) => void;
|
|
1291
|
+
declare const MAX_DURABLE_STREAM_CHUNKS = 50000;
|
|
1292
|
+
declare const MAX_DURABLE_STREAM_BYTES: number;
|
|
1293
|
+
interface DurableStreamSink {
|
|
1294
|
+
readonly chunk: (chunk: {
|
|
1295
|
+
data: unknown;
|
|
1296
|
+
generation?: number;
|
|
1297
|
+
seq: number;
|
|
1298
|
+
}) => boolean;
|
|
1299
|
+
readonly complete: () => void;
|
|
1300
|
+
readonly fail: (failure: {
|
|
1301
|
+
code: string;
|
|
1302
|
+
message: string;
|
|
1303
|
+
}) => void;
|
|
1304
|
+
}
|
|
1305
|
+
type DurableAttachDecision = "attach" | "interrupted" | "reclaim" | "replay-terminal";
|
|
1306
|
+
declare const decideDurableAttach: (run: DurableStreamRun | undefined, context: {
|
|
1307
|
+
generation?: number;
|
|
1308
|
+
live?: {
|
|
1309
|
+
generation: number;
|
|
1310
|
+
};
|
|
1311
|
+
resuming: boolean;
|
|
1312
|
+
}) => DurableAttachDecision;
|
|
1313
|
+
interface DurableStreamAttach {
|
|
1314
|
+
readonly generation?: number;
|
|
1315
|
+
readonly iterator: (signal: AbortSignal) => AsyncIterable<unknown>;
|
|
1316
|
+
readonly runKey: string;
|
|
1317
|
+
readonly sinceChunk: number;
|
|
1318
|
+
readonly sink: DurableStreamSink;
|
|
1319
|
+
readonly ttlMs?: number;
|
|
1320
|
+
}
|
|
1321
|
+
declare class DurableStreamRunner {
|
|
1322
|
+
private lastTrimAt;
|
|
1323
|
+
private readonly runs;
|
|
1324
|
+
private readonly sql;
|
|
1325
|
+
private readonly waitUntil;
|
|
1326
|
+
constructor(dependencies: {
|
|
1327
|
+
sql: () => SqlExec;
|
|
1328
|
+
waitUntil?: (promise: Promise<unknown>) => void;
|
|
1329
|
+
});
|
|
1330
|
+
attach(request: DurableStreamAttach): Promise<void>;
|
|
1331
|
+
detach(runKey: string, sink: DurableStreamSink): void;
|
|
1332
|
+
isLive(runKey: string): boolean;
|
|
1333
|
+
private attachOrThrow;
|
|
1334
|
+
private produce;
|
|
1335
|
+
private trim;
|
|
1336
|
+
}
|
|
1337
|
+
declare const envPositiveInt: (env: unknown, key: string, fallback: number) => number;
|
|
1338
|
+
declare const envOptionalPositiveInt: (env: unknown, key: string) => number | undefined;
|
|
1010
1339
|
interface ExternalSourceDiffResult {
|
|
1011
1340
|
changes: CdcChange[];
|
|
1012
1341
|
nextBaseline: Map<string, string>;
|
|
@@ -1071,6 +1400,16 @@ declare const isSoftDeleted: (row: Record<string, unknown>, column: string) => b
|
|
|
1071
1400
|
declare const pullExternalSourceIncrementalTick: (sql: SqlExec, writer: DatabaseWriterLike, client: SourceClientLike, table: string, source: ExternalSourceLike, shardKey: string, nowMs: number) => Promise<{
|
|
1072
1401
|
applied: number;
|
|
1073
1402
|
}>;
|
|
1403
|
+
declare const ftsRowidMapName: (companion: string) => string;
|
|
1404
|
+
interface FtsWriteOptions {
|
|
1405
|
+
guard?: SQL;
|
|
1406
|
+
unmappedRowids?: ReadonlyArray<number>;
|
|
1407
|
+
}
|
|
1408
|
+
declare const ftsCompanionDdl: (companion: string) => SQL[];
|
|
1409
|
+
declare const ftsWriteDocument: (companion: string, id: string, text: string, options?: FtsWriteOptions) => SQL[];
|
|
1410
|
+
declare const ftsPurgeDocument: (companion: string, id: string, options?: FtsWriteOptions) => SQL[];
|
|
1411
|
+
declare const ftsUnmappedPage: (companion: string, limit: number, after?: number) => SQL;
|
|
1412
|
+
declare const groupUnmappedRows: (rows: ReadonlyArray<Record<string, unknown>>) => Map<string, number[]>;
|
|
1074
1413
|
declare const GEO_DEFAULT_PRECISION = 9;
|
|
1075
1414
|
interface GeoPoint {
|
|
1076
1415
|
lat: number;
|
|
@@ -1086,6 +1425,20 @@ declare const coveringGeohashes: (center: GeoPoint, radiusMeters: number) => str
|
|
|
1086
1425
|
declare const pointInBoundingBox: (point: GeoPoint, box: GeoBoundingBox) => boolean;
|
|
1087
1426
|
declare const boundingBoxCenter: (box: GeoBoundingBox) => GeoPoint;
|
|
1088
1427
|
declare const boundingBoxGeohashes: (box: GeoBoundingBox) => string[];
|
|
1428
|
+
declare class GlobalPollTick {
|
|
1429
|
+
private readonly changedTables;
|
|
1430
|
+
private readonly reads;
|
|
1431
|
+
private resync;
|
|
1432
|
+
private skippedCount;
|
|
1433
|
+
constructor(changedTables?: Set<string>);
|
|
1434
|
+
get readCount(): number;
|
|
1435
|
+
get resyncRequested(): boolean;
|
|
1436
|
+
get skipped(): number;
|
|
1437
|
+
requestResync(): void;
|
|
1438
|
+
rows(key: string | undefined, load: () => Promise<ShapeRow[]>): Promise<ShapeRow[]>;
|
|
1439
|
+
shouldRead(table: string): boolean;
|
|
1440
|
+
}
|
|
1441
|
+
declare const isInternalTableName: (name: string) => boolean;
|
|
1089
1442
|
declare const ADMIN_FUNCTION_PREFIX = "__lunora_admin__:";
|
|
1090
1443
|
declare const RELATION_FUNCTION_PREFIX = "__lunora_relation__:";
|
|
1091
1444
|
declare const FLAGS_FUNCTION_PREFIX = "__lunora_flags__:";
|
|
@@ -1096,6 +1449,8 @@ declare const ADMIN_FUNCTIONS: {
|
|
|
1096
1449
|
readonly aiGenerateSql: "__lunora_admin__:aiGenerateSql";
|
|
1097
1450
|
readonly aiTableFilter: "__lunora_admin__:aiTableFilter";
|
|
1098
1451
|
readonly assignIssue: "__lunora_admin__:assignIssue";
|
|
1452
|
+
readonly backfillSearch: "__lunora_admin__:backfillSearch";
|
|
1453
|
+
readonly backfillVectors: "__lunora_admin__:backfillVectors";
|
|
1099
1454
|
readonly backRelationCounts: "__lunora_admin__:backRelationCounts";
|
|
1100
1455
|
readonly cdcSync: "__lunora_admin__:cdcSync";
|
|
1101
1456
|
readonly clearCapturedMail: "__lunora_admin__:clearCapturedMail";
|
|
@@ -1108,6 +1463,7 @@ declare const ADMIN_FUNCTIONS: {
|
|
|
1108
1463
|
readonly explainIssue: "__lunora_admin__:explainIssue";
|
|
1109
1464
|
readonly exportShard: "__lunora_admin__:exportShard";
|
|
1110
1465
|
readonly facetColumn: "__lunora_admin__:facetColumn";
|
|
1466
|
+
readonly findRelated: "__lunora_admin__:findRelated";
|
|
1111
1467
|
readonly getAdvisories: "__lunora_admin__:getAdvisories";
|
|
1112
1468
|
readonly getAdvisorProcedures: "__lunora_admin__:getAdvisorProcedures";
|
|
1113
1469
|
readonly getAuditLog: "__lunora_admin__:getAuditLog";
|
|
@@ -1134,20 +1490,24 @@ declare const ADMIN_FUNCTIONS: {
|
|
|
1134
1490
|
readonly ignoreIssue: "__lunora_admin__:ignoreIssue";
|
|
1135
1491
|
readonly importShard: "__lunora_admin__:importShard";
|
|
1136
1492
|
readonly listFlags: "__lunora_admin__:listFlags";
|
|
1493
|
+
readonly listReactors: "__lunora_admin__:listReactors";
|
|
1137
1494
|
readonly listQueues: "__lunora_admin__:listQueues";
|
|
1138
1495
|
readonly lintSql: "__lunora_admin__:lintSql";
|
|
1139
1496
|
readonly listTables: "__lunora_admin__:listTables";
|
|
1140
1497
|
readonly listWorkflows: "__lunora_admin__:listWorkflows";
|
|
1141
1498
|
readonly maskPolicies: "__lunora_admin__:maskPolicies";
|
|
1142
1499
|
readonly migrationStatus: "__lunora_admin__:migrationStatus";
|
|
1500
|
+
readonly patchRows: "__lunora_admin__:patchRows";
|
|
1143
1501
|
readonly pitrRestore: "__lunora_admin__:pitrRestore";
|
|
1144
1502
|
readonly rankBefore: "__lunora_admin__:rankBefore";
|
|
1145
1503
|
readonly rankPage: "__lunora_admin__:rankPage";
|
|
1146
1504
|
readonly readTablePage: "__lunora_admin__:readTablePage";
|
|
1505
|
+
readonly rebuildCompanions: "__lunora_admin__:rebuildCompanions";
|
|
1147
1506
|
readonly recordAuthEvent: "__lunora_admin__:recordAuthEvent";
|
|
1148
1507
|
readonly recordContainerEvent: "__lunora_admin__:recordContainerEvent";
|
|
1149
1508
|
readonly recordMail: "__lunora_admin__:recordMail";
|
|
1150
1509
|
readonly recordQueueMessage: "__lunora_admin__:recordQueueMessage";
|
|
1510
|
+
readonly releaseShardRegistration: "__lunora_admin__:releaseShardRegistration";
|
|
1151
1511
|
readonly replayQueueMessage: "__lunora_admin__:replayQueueMessage";
|
|
1152
1512
|
readonly resolveIssue: "__lunora_admin__:resolveIssue";
|
|
1153
1513
|
readonly rlsPolicies: "__lunora_admin__:rlsPolicies";
|
|
@@ -1217,8 +1577,12 @@ interface TablesIndexesResult {
|
|
|
1217
1577
|
indexesByTable: Record<string, TableIndexInfo[]>;
|
|
1218
1578
|
}
|
|
1219
1579
|
interface ColumnMeta {
|
|
1580
|
+
bucket?: string;
|
|
1581
|
+
enumValues?: string[];
|
|
1220
1582
|
isStorage?: boolean;
|
|
1221
1583
|
name: string;
|
|
1584
|
+
nullable?: boolean;
|
|
1585
|
+
onDelete?: "cascade" | "restrict" | "set null";
|
|
1222
1586
|
optional: boolean;
|
|
1223
1587
|
pk?: boolean;
|
|
1224
1588
|
ref?: string;
|
|
@@ -1315,6 +1679,12 @@ interface StudioFeaturesResult {
|
|
|
1315
1679
|
mail: boolean;
|
|
1316
1680
|
notifications: boolean;
|
|
1317
1681
|
payments: boolean;
|
|
1682
|
+
platform?: {
|
|
1683
|
+
id: string;
|
|
1684
|
+
name: string;
|
|
1685
|
+
unsupported: string[];
|
|
1686
|
+
};
|
|
1687
|
+
privacy: boolean;
|
|
1318
1688
|
queues: boolean;
|
|
1319
1689
|
scheduler: boolean;
|
|
1320
1690
|
storage: boolean;
|
|
@@ -1333,8 +1703,20 @@ interface FlagsResult {
|
|
|
1333
1703
|
configured: boolean;
|
|
1334
1704
|
flags: FlagEvaluation[];
|
|
1335
1705
|
}
|
|
1706
|
+
interface ReactorMetadata {
|
|
1707
|
+
errors: number;
|
|
1708
|
+
lastError?: string;
|
|
1709
|
+
lastRanAt?: number;
|
|
1710
|
+
path: string;
|
|
1711
|
+
runs: number;
|
|
1712
|
+
state: "active" | "failing" | "idle";
|
|
1713
|
+
suppressed: number;
|
|
1714
|
+
tables?: ReadonlyArray<string>;
|
|
1715
|
+
}
|
|
1716
|
+
interface ReactorsResult {
|
|
1717
|
+
reactors: ReactorMetadata[];
|
|
1718
|
+
}
|
|
1336
1719
|
interface WorkflowMetadata {
|
|
1337
|
-
binding: string;
|
|
1338
1720
|
className: string;
|
|
1339
1721
|
exportName: string;
|
|
1340
1722
|
name: string;
|
|
@@ -1348,6 +1730,7 @@ interface QueueMetadata {
|
|
|
1348
1730
|
exportName: string;
|
|
1349
1731
|
mode: "pull" | "push";
|
|
1350
1732
|
name: string;
|
|
1733
|
+
topic?: string;
|
|
1351
1734
|
}
|
|
1352
1735
|
interface QueuesResult {
|
|
1353
1736
|
queues: QueueMetadata[];
|
|
@@ -1391,8 +1774,10 @@ interface TablePage {
|
|
|
1391
1774
|
columns: string[];
|
|
1392
1775
|
refs?: Record<string, string>;
|
|
1393
1776
|
rows: Record<string, unknown>[];
|
|
1777
|
+
sqlColumns: string[];
|
|
1394
1778
|
total?: number;
|
|
1395
1779
|
}
|
|
1780
|
+
type ColumnKinds = Readonly<Record<string, string>>;
|
|
1396
1781
|
type FilterOperator = "contains" | "eq" | "gt" | "gte" | "lt" | "lte" | "ne";
|
|
1397
1782
|
interface FilterClause {
|
|
1398
1783
|
column: string;
|
|
@@ -1404,6 +1789,7 @@ interface OrderByClause {
|
|
|
1404
1789
|
direction: SortDirection;
|
|
1405
1790
|
}
|
|
1406
1791
|
interface ReadTablePageOptions {
|
|
1792
|
+
columnKinds?: ColumnKinds;
|
|
1407
1793
|
filters?: FilterClause[];
|
|
1408
1794
|
limit?: number;
|
|
1409
1795
|
offset?: number;
|
|
@@ -1414,6 +1800,8 @@ interface ReadTablePageOptions {
|
|
|
1414
1800
|
table: string;
|
|
1415
1801
|
}
|
|
1416
1802
|
interface SelectMatchingIdsOptions {
|
|
1803
|
+
after?: string;
|
|
1804
|
+
columnKinds?: ColumnKinds;
|
|
1417
1805
|
filters?: FilterClause[];
|
|
1418
1806
|
limit?: number;
|
|
1419
1807
|
search?: string;
|
|
@@ -1421,6 +1809,7 @@ interface SelectMatchingIdsOptions {
|
|
|
1421
1809
|
}
|
|
1422
1810
|
interface FacetColumnOptions {
|
|
1423
1811
|
column: string;
|
|
1812
|
+
columnKinds?: ColumnKinds;
|
|
1424
1813
|
filters?: FilterClause[];
|
|
1425
1814
|
limit?: number;
|
|
1426
1815
|
search?: string;
|
|
@@ -1436,6 +1825,7 @@ interface FacetColumnResult {
|
|
|
1436
1825
|
}
|
|
1437
1826
|
declare const MAX_PAGE_SIZE = 500;
|
|
1438
1827
|
declare const listTables: (sql: SqlExec) => TableInfo[];
|
|
1828
|
+
declare const isVacuousFilterClause: (clause: FilterClause) => boolean;
|
|
1439
1829
|
declare const readTablePage: (sql: SqlExec, options: ReadTablePageOptions) => TablePage;
|
|
1440
1830
|
declare const selectMatchingIds: (sql: SqlExec, options: SelectMatchingIdsOptions) => {
|
|
1441
1831
|
hasMore: boolean;
|
|
@@ -1470,12 +1860,22 @@ interface FanoutPathCounters {
|
|
|
1470
1860
|
socketsIterated: number;
|
|
1471
1861
|
totalMs: number;
|
|
1472
1862
|
}
|
|
1863
|
+
interface ShapeProbeCounters {
|
|
1864
|
+
run: number;
|
|
1865
|
+
served: number;
|
|
1866
|
+
}
|
|
1867
|
+
interface GlobalPollCounters {
|
|
1868
|
+
drains: number;
|
|
1869
|
+
pairsSkipped: number;
|
|
1870
|
+
}
|
|
1473
1871
|
interface FanoutMetricsResult {
|
|
1872
|
+
globalPoll: GlobalPollCounters;
|
|
1474
1873
|
maxRelays: number;
|
|
1475
1874
|
peakSubscribers: number;
|
|
1476
1875
|
promoted: boolean;
|
|
1477
1876
|
relayCount: number;
|
|
1478
1877
|
shapePoke: FanoutPathCounters;
|
|
1878
|
+
shapeProbe: ShapeProbeCounters;
|
|
1479
1879
|
sinceMs: number;
|
|
1480
1880
|
topics: FanoutTopicStat[];
|
|
1481
1881
|
totalConnections: number;
|
|
@@ -1489,6 +1889,10 @@ interface FanoutAttachmentLike {
|
|
|
1489
1889
|
}
|
|
1490
1890
|
declare const DEFAULT_FANOUT_TOPIC_LIMIT = 20;
|
|
1491
1891
|
declare const createFanoutCounters: () => FanoutPathCounters;
|
|
1892
|
+
declare const createShapeProbeCounters: () => ShapeProbeCounters;
|
|
1893
|
+
declare const createGlobalPollCounters: () => GlobalPollCounters;
|
|
1894
|
+
declare const recordGlobalPollPass: (counters: GlobalPollCounters, drains: number, pairsSkipped: number) => GlobalPollCounters;
|
|
1895
|
+
declare const recordShapeProbePass: (counters: ShapeProbeCounters, run: number, served: number) => ShapeProbeCounters;
|
|
1492
1896
|
declare const recordFanoutPass: (counters: FanoutPathCounters, iterated: number, delivered: number, ms: number) => FanoutPathCounters;
|
|
1493
1897
|
declare const summarizeFanoutTopics: (attachments: FanoutAttachmentLike[], limit?: number) => {
|
|
1494
1898
|
peakSubscribers: number;
|
|
@@ -1536,6 +1940,11 @@ declare const clearCapturedMail: (sql: SqlExec) => {
|
|
|
1536
1940
|
declare class NotFoundError extends LunoraError {
|
|
1537
1941
|
constructor(message?: string);
|
|
1538
1942
|
}
|
|
1943
|
+
declare const operatorFields: (definition: TableDefinitionLike, patch: Record<string, unknown>) => ReadonlySet<string>;
|
|
1944
|
+
declare const resolvePatch: (definition: TableDefinitionLike, patch: Record<string, unknown>, current: Record<string, unknown>) => Record<string, unknown>;
|
|
1945
|
+
declare const patchDependsOnRow: (definition: TableDefinitionLike, patch: Record<string, unknown>) => boolean;
|
|
1946
|
+
declare const assertPatchAllowed: (options: PatchWriteOptions | undefined, previous: Record<string, unknown>, next: Record<string, unknown>) => void;
|
|
1947
|
+
declare const readPatchField: (document: Record<string, unknown>, field: string) => unknown;
|
|
1539
1948
|
interface PitrStorage {
|
|
1540
1949
|
getBookmarkForTime?: (time: Date | number) => Promise<string>;
|
|
1541
1950
|
getCurrentBookmark?: () => Promise<string>;
|
|
@@ -1557,7 +1966,22 @@ interface PitrRestoreArgs {
|
|
|
1557
1966
|
}
|
|
1558
1967
|
declare const readBookmark: (storage: PitrStorage, time?: number | string) => Promise<PitrBookmarkResult>;
|
|
1559
1968
|
declare const armRestore: (storage: PitrStorage, args: PitrRestoreArgs) => Promise<Omit<PitrRestoreResult, "restarted">>;
|
|
1560
|
-
declare const
|
|
1969
|
+
declare const tiebreakDirectionFor: (keys: ReadonlyArray<{
|
|
1970
|
+
direction?: string;
|
|
1971
|
+
}>) => SortDirection;
|
|
1972
|
+
declare const equalityPinnedFields: (where: undefined | WhereInput) => ReadonlySet<string>;
|
|
1973
|
+
declare const uniqueIndexFields: (indexes: ReadonlyArray<{
|
|
1974
|
+
fields: ReadonlyArray<string>;
|
|
1975
|
+
unique?: boolean;
|
|
1976
|
+
}> | undefined, shape: Record<string, ValidatorLike> | undefined) => ReadonlyArray<ReadonlyArray<string>>;
|
|
1977
|
+
interface OrderKeyConstraints {
|
|
1978
|
+
pinned?: ReadonlySet<string>;
|
|
1979
|
+
uniqueBy?: ReadonlyArray<ReadonlyArray<string>>;
|
|
1980
|
+
}
|
|
1981
|
+
declare const nullsFirstOf: (key: Pick<OrderKey, "direction" | "nulls">) => boolean;
|
|
1982
|
+
declare const nullsOrderSuffix: (nullsFirst: boolean) => string;
|
|
1983
|
+
declare const normalizeOrderKeys: (orderBy: OrderByInput[] | undefined, shape?: Record<string, ValidatorLike>, constraints?: OrderKeyConstraints) => OrderKey[];
|
|
1984
|
+
declare const CURSOR_PREFIX = "~4";
|
|
1561
1985
|
declare const encodeCursor: (record: Record<string, unknown>, keys: OrderKey[]) => string;
|
|
1562
1986
|
declare const decodeCursor: (cursor: string) => unknown[];
|
|
1563
1987
|
declare const buildSeekWhere: (keys: OrderKey[], cursorValues: unknown[]) => WhereInput;
|
|
@@ -1617,7 +2041,36 @@ declare const rankKeyFromDocument: (index: RankIndexDefinitionLike, document_: R
|
|
|
1617
2041
|
rowId: string;
|
|
1618
2042
|
sortValues: unknown[];
|
|
1619
2043
|
};
|
|
2044
|
+
declare const rankPivotConditionSql: (column: string, value: unknown, direction: "asc" | "desc", wantLater: boolean) => SQL | undefined;
|
|
1620
2045
|
declare const matchesRankStaticWhere: (document: Record<string, unknown>, predicate: Record<string, unknown>) => boolean;
|
|
2046
|
+
declare const REACTOR_STATE_TABLE = "__reactor_state";
|
|
2047
|
+
interface ReactorState {
|
|
2048
|
+
digest: string;
|
|
2049
|
+
lastError?: string;
|
|
2050
|
+
lastRanAt: number;
|
|
2051
|
+
stats: ReactorStats;
|
|
2052
|
+
tables?: ReadonlyArray<string>;
|
|
2053
|
+
}
|
|
2054
|
+
interface ReactorStats {
|
|
2055
|
+
errors: number;
|
|
2056
|
+
runs: number;
|
|
2057
|
+
suppressed: number;
|
|
2058
|
+
}
|
|
2059
|
+
declare const migrateReactorState: (sql: SqlExec) => void;
|
|
2060
|
+
declare const readReactorState: (sql: SqlExec, path: string) => ReactorState | undefined;
|
|
2061
|
+
declare const listReactorStates: (sql: SqlExec) => {
|
|
2062
|
+
path: string;
|
|
2063
|
+
state: ReactorState;
|
|
2064
|
+
}[];
|
|
2065
|
+
type ReactorDispatchResult = "error" | "ran" | "suppressed";
|
|
2066
|
+
declare const writeReactorState: (sql: SqlExec, path: string, outcome: {
|
|
2067
|
+
digest?: string;
|
|
2068
|
+
error?: string;
|
|
2069
|
+
now: number;
|
|
2070
|
+
result: ReactorDispatchResult;
|
|
2071
|
+
tables?: ReadonlyArray<string>;
|
|
2072
|
+
}) => void;
|
|
2073
|
+
declare const reactorNeedsRun: (state: Pick<ReactorState, "tables"> | undefined, changed: ReadonlySet<string>) => boolean;
|
|
1621
2074
|
interface ReadFootprint {
|
|
1622
2075
|
onRead: (table: string, idOrScan?: string) => void;
|
|
1623
2076
|
onReadRange: (range: KeyRange) => void;
|
|
@@ -1625,16 +2078,33 @@ interface ReadFootprint {
|
|
|
1625
2078
|
tables: Set<string>;
|
|
1626
2079
|
}
|
|
1627
2080
|
declare const createReadFootprint: () => ReadFootprint;
|
|
2081
|
+
declare const UNVOUCHABLE_DEP = "!unvouchable";
|
|
2082
|
+
declare const markUnvouchableReads: <T extends object>(facade: T, onRead: ReadFootprint["onRead"] | undefined, methods: ReadonlyArray<string>) => T;
|
|
2083
|
+
declare const WHERE_FILTER: unique symbol;
|
|
2084
|
+
type RowPredicate = (document: Record<string, unknown>) => boolean;
|
|
2085
|
+
type WhereFilter = RowPredicate & {
|
|
2086
|
+
readonly [WHERE_FILTER]: WhereInput;
|
|
2087
|
+
};
|
|
2088
|
+
declare const whereFilter: (where: WhereInput, predicate: RowPredicate) => WhereFilter;
|
|
2089
|
+
declare const whereOfFilter: (predicate: RowPredicate) => undefined | WhereInput;
|
|
2090
|
+
declare const isPushableWhere: (where: WhereInput, shape: Readonly<Record<string, ValidatorLike>>, exactText?: boolean) => boolean;
|
|
2091
|
+
declare const RELATED_MAX_DEPTH = 4;
|
|
2092
|
+
declare const RELATED_DEFAULT_LIMIT = 50;
|
|
2093
|
+
declare const RELATED_MAX_LIMIT = 200;
|
|
2094
|
+
declare const RELATED_DEPTH_DECAY = 0.5;
|
|
2095
|
+
declare const deriveRelationEdges: (schema: SchemaLike) => RelationEdge[];
|
|
2096
|
+
type RelationGraphReader = Pick<DatabaseWriterLike, "findMany"> & Pick<Partial<DatabaseWriterLike>, "lookupById">;
|
|
2097
|
+
declare const findRelated: (reader: RelationGraphReader, edges: ReadonlyArray<RelationEdge>, start: RelatedStart, options?: RelatedOptions) => Promise<RelatedPage>;
|
|
1628
2098
|
declare const DEFAULT_MAX_RELATION_KEYS = 5000;
|
|
1629
2099
|
interface RelationExistsMarker {
|
|
1630
2100
|
childWhere: WhereInput;
|
|
1631
2101
|
negated: boolean;
|
|
1632
2102
|
parentTable: string;
|
|
1633
|
-
relation:
|
|
2103
|
+
relation: KeyedRelationDefinitionLike;
|
|
1634
2104
|
}
|
|
1635
2105
|
type ExistsPushMode = "always" | "auto";
|
|
1636
2106
|
interface ResolveRelationPredicatesOptions {
|
|
1637
|
-
canPushExists?: (relation:
|
|
2107
|
+
canPushExists?: (relation: KeyedRelationDefinitionLike) => boolean;
|
|
1638
2108
|
existsPushMode?: ExistsPushMode;
|
|
1639
2109
|
fetcher: (tableName: string, args: QueryArgs) => Promise<QueryPage>;
|
|
1640
2110
|
maxRelationKeys?: number;
|
|
@@ -1645,7 +2115,7 @@ interface ResolveRelationPredicatesOptions {
|
|
|
1645
2115
|
tableName: string;
|
|
1646
2116
|
}
|
|
1647
2117
|
interface ResolveContext {
|
|
1648
|
-
canPushExists?: (relation:
|
|
2118
|
+
canPushExists?: (relation: KeyedRelationDefinitionLike) => boolean;
|
|
1649
2119
|
existsPushMode: ExistsPushMode;
|
|
1650
2120
|
fetcher: (tableName: string, args: QueryArgs) => Promise<QueryPage>;
|
|
1651
2121
|
maxRelationKeys: number;
|
|
@@ -1658,7 +2128,14 @@ declare const isRelationPredicate: (value: unknown) => value is Record<string, W
|
|
|
1658
2128
|
declare const containsRelationPredicate: (where: WhereInput, schema: ResolveContext["schema"], tableName: string) => boolean;
|
|
1659
2129
|
declare const assertFlatPredicate: (where: WhereInput | undefined, schema: ResolveContext["schema"], tableName: string, op: string) => void;
|
|
1660
2130
|
declare const resolveRelationPredicates: (where: WhereInput | undefined, options: ResolveRelationPredicatesOptions) => Promise<WhereInput | undefined>;
|
|
2131
|
+
declare const composeReadPredicate: (definition: TableDefinitionLike, args: QueryArgs, relation: Omit<ResolveRelationPredicatesOptions, "relationBaseWhere">) => Promise<{
|
|
2132
|
+
fetchLimit: number | undefined;
|
|
2133
|
+
limit: number | undefined;
|
|
2134
|
+
orderKeys: OrderKey[];
|
|
2135
|
+
predicate: WhereInput | undefined;
|
|
2136
|
+
}>;
|
|
1661
2137
|
declare const assertShapeShardable: (effectiveWhere: WhereInput | undefined, schema: ResolveContext["schema"], table: string) => void;
|
|
2138
|
+
declare const relationHooks: (args: Pick<QueryArgs, "relationBaseWhere" | "relationMask">) => Pick<QueryArgs, "relationBaseWhere" | "relationMask"> & Pick<ResolveWithOptions, "fanOutBudget">;
|
|
1662
2139
|
declare const fanOutScalarCounts: (counter: (tableName: string, where?: WhereInput) => Promise<number>, tableName: string, whereField: string, values: unknown[], policyWhere: WhereInput | undefined) => Promise<Map<unknown, number>>;
|
|
1663
2140
|
declare const distinctValues: (rows: Record<string, unknown>[], field: string) => unknown[];
|
|
1664
2141
|
declare const resolveWith: (options: ResolveWithOptions) => Promise<void>;
|
|
@@ -1683,6 +2160,8 @@ interface ShapeRowOp {
|
|
|
1683
2160
|
value?: Record<string, unknown>;
|
|
1684
2161
|
}
|
|
1685
2162
|
interface ShapePokePart {
|
|
2163
|
+
baseCheckpoint?: number;
|
|
2164
|
+
reset?: boolean;
|
|
1686
2165
|
rowsPatch: ShapeRowOp[];
|
|
1687
2166
|
shapeId: string;
|
|
1688
2167
|
}
|
|
@@ -1717,15 +2196,18 @@ declare const clampPromotionThresholds: (tUp: number, tDownRaw: number) => Promo
|
|
|
1717
2196
|
declare const relayCountFor: (subscribers: number, perRelayCapacity: number, maxRelays: number) => number;
|
|
1718
2197
|
interface RelayAttach {
|
|
1719
2198
|
relayIndex: number;
|
|
2199
|
+
seq?: number;
|
|
1720
2200
|
type: "relay_attach";
|
|
1721
2201
|
}
|
|
1722
2202
|
interface RelayDetach {
|
|
1723
2203
|
relayIndex: number;
|
|
2204
|
+
seq?: number;
|
|
1724
2205
|
type: "relay_detach";
|
|
1725
2206
|
}
|
|
1726
2207
|
interface RelayFrame {
|
|
1727
2208
|
cursor?: number;
|
|
1728
2209
|
epoch?: string;
|
|
2210
|
+
exceptConnectionId?: string;
|
|
1729
2211
|
frame: string;
|
|
1730
2212
|
originRelay?: number;
|
|
1731
2213
|
topic: string;
|
|
@@ -1743,6 +2225,12 @@ interface RelayShapeSubscribe {
|
|
|
1743
2225
|
type: "relay_shape_subscribe";
|
|
1744
2226
|
userId?: string;
|
|
1745
2227
|
}
|
|
2228
|
+
interface RelayShapeUnsubscribe {
|
|
2229
|
+
connectionId: string;
|
|
2230
|
+
relayIndex: number;
|
|
2231
|
+
subId?: string;
|
|
2232
|
+
type: "relay_shape_unsubscribe";
|
|
2233
|
+
}
|
|
1746
2234
|
interface RelayShapeSeed {
|
|
1747
2235
|
cursor?: number;
|
|
1748
2236
|
epoch?: string;
|
|
@@ -1762,44 +2250,85 @@ interface RelayShapePoke {
|
|
|
1762
2250
|
targetConnectionId?: string;
|
|
1763
2251
|
type: "relay_shape_poke";
|
|
1764
2252
|
}
|
|
1765
|
-
|
|
1766
|
-
|
|
1767
|
-
|
|
1768
|
-
|
|
2253
|
+
interface RelayRoomEvent {
|
|
2254
|
+
attachment: Pick<SocketAttachment, "connectionId" | "context" | "identity" | "ip" | "userId">;
|
|
2255
|
+
connectionId: string;
|
|
2256
|
+
data?: unknown;
|
|
2257
|
+
kind: "join" | "leave" | "message";
|
|
2258
|
+
relayIndex: number;
|
|
2259
|
+
topic: string;
|
|
2260
|
+
type: "relay_room_event";
|
|
2261
|
+
}
|
|
2262
|
+
interface RelayRoomVerdict {
|
|
2263
|
+
admitted: boolean;
|
|
2264
|
+
}
|
|
2265
|
+
interface LiveSocketControlCall {
|
|
2266
|
+
action: unknown;
|
|
2267
|
+
callerId: string;
|
|
2268
|
+
connectionId: string;
|
|
2269
|
+
identityExpiry?: number;
|
|
2270
|
+
key: string;
|
|
2271
|
+
seq?: number;
|
|
2272
|
+
subscriptionId: string;
|
|
2273
|
+
}
|
|
2274
|
+
interface RelayLiveControl {
|
|
2275
|
+
control: LiveSocketControlCall;
|
|
2276
|
+
type: "relay_live_control";
|
|
1769
2277
|
}
|
|
1770
|
-
interface
|
|
1771
|
-
|
|
1772
|
-
|
|
1773
|
-
|
|
2278
|
+
interface RelayLiveFrame {
|
|
2279
|
+
frame: string;
|
|
2280
|
+
key: string;
|
|
2281
|
+
topic: string;
|
|
2282
|
+
type: "relay_live_frame";
|
|
2283
|
+
}
|
|
2284
|
+
type OwnerRelayFrame = RelayAttach | RelayDetach | RelayFrame | RelayLiveControl | RelayLiveFrame | RelayRoomEvent | RelayShapePoke | RelayShapeSubscribe | RelayShapeUnsubscribe;
|
|
2285
|
+
declare const RELAY_SIGNATURE_HEADER = "x-lunora-relay-sig";
|
|
2286
|
+
declare const siblingSecretOf: (env: unknown) => string | undefined;
|
|
2287
|
+
declare const signSiblingBody: (secret: string, body: string) => Promise<string>;
|
|
2288
|
+
declare const verifySiblingBody: (env: unknown, supplied: null | string, raw: string) => Promise<boolean>;
|
|
2289
|
+
interface SiblingStub {
|
|
2290
|
+
fetch: (url: string, init?: RequestInit) => Promise<Response>;
|
|
1774
2291
|
}
|
|
2292
|
+
declare const stubByName: (value: unknown, name: string, jurisdiction?: string) => SiblingStub | undefined;
|
|
2293
|
+
declare const DEFAULT_MAX_RELAYS = 8;
|
|
1775
2294
|
interface RelayHost {
|
|
1776
2295
|
buildShapeDiff: (resolved: ResolvedShape, fromCursor: number, toCursor: number) => ShapeRowOp[];
|
|
1777
2296
|
computeOpLogShapeSeed: (shape: ShapeSubscriptionQuery, resolved: ResolvedShape) => {
|
|
1778
2297
|
baseCheckpoint: number | undefined;
|
|
1779
2298
|
cursor: number;
|
|
1780
2299
|
epoch: string | undefined;
|
|
2300
|
+
reset: boolean;
|
|
1781
2301
|
rowsPatch: ShapeRowOp[];
|
|
1782
2302
|
};
|
|
1783
2303
|
currentCdcEpoch: () => string | undefined;
|
|
2304
|
+
deliverLiveLocal: (topic: string, key: string, frame: string) => number;
|
|
1784
2305
|
deliverWhisperLocal: (topic: string, frame: string, exclude: undefined | ShardSocketLike) => number;
|
|
1785
2306
|
doName: () => string | undefined;
|
|
1786
2307
|
env: () => unknown;
|
|
1787
2308
|
getWebSockets: () => ShardSocketLike[];
|
|
2309
|
+
liveControl: (control: LiveSocketControlCall) => Promise<Response>;
|
|
1788
2310
|
maskMetadata: () => MaskPoliciesResult;
|
|
1789
2311
|
nextPokeId: () => string;
|
|
1790
2312
|
readAttachment: (ws: ShardSocketLike) => SocketAttachment;
|
|
1791
2313
|
recordShapePokeFanout: (iterated: number, delivered: number, elapsedMs: number) => void;
|
|
2314
|
+
relayRoomEvent: (event: RelayRoomEvent) => Promise<RelayRoomVerdict>;
|
|
1792
2315
|
resolveShape: (name: string, args: Record<string, unknown>, identity?: SubscriptionIdentity) => ResolvedShape | undefined;
|
|
1793
2316
|
rlsMetadata: () => RlsPoliciesResult;
|
|
1794
2317
|
shardBinding: () => string | undefined;
|
|
2318
|
+
shardJurisdiction: () => string | undefined;
|
|
1795
2319
|
sql: () => SqlExec;
|
|
1796
2320
|
}
|
|
2321
|
+
interface RelayPokeDelivery {
|
|
2322
|
+
delivered: number;
|
|
2323
|
+
matched: number;
|
|
2324
|
+
}
|
|
1797
2325
|
declare abstract class RelayLink {
|
|
1798
2326
|
protected readonly host: RelayHost;
|
|
1799
2327
|
protected readonly roleId: {
|
|
1800
2328
|
ownerKey: string;
|
|
1801
2329
|
relayIndex?: number;
|
|
1802
2330
|
};
|
|
2331
|
+
private lastSequence;
|
|
1803
2332
|
protected constructor(host: RelayHost, roleId: {
|
|
1804
2333
|
ownerKey: string;
|
|
1805
2334
|
relayIndex?: number;
|
|
@@ -1807,81 +2336,184 @@ declare abstract class RelayLink {
|
|
|
1807
2336
|
handleControl(request: Request): Promise<Response>;
|
|
1808
2337
|
maxRelays(): number;
|
|
1809
2338
|
protected canAddressSiblings(): boolean;
|
|
1810
|
-
protected
|
|
2339
|
+
protected siblingStub(targetName: string): SiblingStub | undefined;
|
|
2340
|
+
protected bindingName(): string | undefined;
|
|
2341
|
+
protected nextRelaySeq(): number;
|
|
1811
2342
|
protected postRelayMessage(targetName: string, message: OwnerRelayFrame): Promise<void>;
|
|
1812
2343
|
protected requestRelayMessage(targetName: string, message: OwnerRelayFrame): Promise<Response | undefined>;
|
|
1813
|
-
abstract forwardWhisper(topic: string, frame: string): Promise<void>;
|
|
2344
|
+
abstract forwardWhisper(topic: string, frame: string, exceptConnectionId?: string): Promise<void>;
|
|
1814
2345
|
abstract onFlush(changed: Set<string>, frameCursor: number): Promise<void>;
|
|
1815
2346
|
abstract seedRelayShape(ws: ShardSocketLike, subId: string, shape: ShapeSubscriptionQuery, identity: SubscriptionIdentity): Promise<"ok" | undefined | {
|
|
1816
2347
|
code: string;
|
|
1817
2348
|
message: string;
|
|
1818
2349
|
}>;
|
|
1819
|
-
abstract announce(): Promise<
|
|
2350
|
+
abstract announce(): Promise<boolean>;
|
|
1820
2351
|
abstract announceDrain(closing: ShardSocketLike): Promise<void>;
|
|
2352
|
+
abstract releaseRelayShapes(ws: ShardSocketLike, subId?: string): Promise<void>;
|
|
1821
2353
|
abstract relayCount(): number;
|
|
1822
2354
|
abstract isShapeRelayUniform(name: string, args: Record<string, unknown>): boolean;
|
|
1823
|
-
|
|
1824
|
-
protected abstract
|
|
2355
|
+
abstract minShapeCursor(): number | undefined;
|
|
2356
|
+
protected abstract onAttach(index: number, seq: number | undefined): boolean;
|
|
2357
|
+
protected abstract onDetach(index: number, seq: number | undefined): boolean;
|
|
2358
|
+
protected abstract onLiveControl(control: LiveSocketControlCall): Promise<Response>;
|
|
1825
2359
|
protected abstract onWhisperFrame(message: RelayFrame): Promise<void>;
|
|
2360
|
+
protected abstract refusesAsIdle(): boolean;
|
|
1826
2361
|
protected abstract onShapeSubscribe(message: RelayShapeSubscribe): RelayShapeSeed;
|
|
1827
|
-
protected abstract
|
|
2362
|
+
protected abstract onShapeUnsubscribe(message: RelayShapeUnsubscribe): void;
|
|
2363
|
+
protected abstract onShapePoke(poke: RelayShapePoke): RelayPokeDelivery;
|
|
1828
2364
|
}
|
|
1829
2365
|
declare class OwnerRelay extends RelayLink {
|
|
1830
2366
|
private readonly shapeUniformCache;
|
|
1831
2367
|
private relaySetCache;
|
|
1832
|
-
private
|
|
1833
|
-
private
|
|
2368
|
+
private liveGrantRelayCache;
|
|
2369
|
+
private relayTablesReady;
|
|
2370
|
+
private readonly relaySeqMarks;
|
|
2371
|
+
private readonly pendingSubscribeRelays;
|
|
2372
|
+
private registryCache;
|
|
2373
|
+
private recordedBinding;
|
|
1834
2374
|
private promotionState;
|
|
1835
2375
|
constructor(host: RelayHost, ownerKey: string);
|
|
1836
|
-
forwardWhisper(topic: string, frame: string): Promise<void>;
|
|
2376
|
+
forwardWhisper(topic: string, frame: string, exceptConnectionId?: string): Promise<void>;
|
|
2377
|
+
forwardLiveControl(call: LiveSocketControlCall): Promise<Response | undefined>;
|
|
2378
|
+
forwardLiveFrame(topic: string, key: string, frame: string): Promise<void>;
|
|
1837
2379
|
onFlush(changed: Set<string>, frameCursor: number): Promise<void>;
|
|
1838
2380
|
seedRelayShape(): Promise<"ok" | undefined | {
|
|
1839
2381
|
code: string;
|
|
1840
2382
|
message: string;
|
|
1841
2383
|
}>;
|
|
1842
|
-
announce(): Promise<
|
|
2384
|
+
announce(): Promise<boolean>;
|
|
1843
2385
|
announceDrain(): Promise<void>;
|
|
2386
|
+
releaseRelayShapes(): Promise<void>;
|
|
1844
2387
|
relayCount(): number;
|
|
2388
|
+
minShapeCursor(): number | undefined;
|
|
1845
2389
|
isShapeRelayUniform(name: string, args: Record<string, unknown>): boolean;
|
|
1846
|
-
protected
|
|
1847
|
-
protected
|
|
2390
|
+
protected onShapeUnsubscribe(message: RelayShapeUnsubscribe): void;
|
|
2391
|
+
protected onAttach(index: number, seq: number | undefined): boolean;
|
|
2392
|
+
protected onDetach(index: number, seq: number | undefined): boolean;
|
|
2393
|
+
protected refusesAsIdle(): boolean;
|
|
2394
|
+
protected onLiveControl(control: LiveSocketControlCall): Promise<Response>;
|
|
1848
2395
|
protected onWhisperFrame(message: RelayFrame): Promise<void>;
|
|
1849
2396
|
protected onShapeSubscribe(message: RelayShapeSubscribe): RelayShapeSeed;
|
|
1850
|
-
protected onShapePoke():
|
|
2397
|
+
protected onShapePoke(): RelayPokeDelivery;
|
|
2398
|
+
private relaySeqMark;
|
|
2399
|
+
private recordRelaySeq;
|
|
2400
|
+
private acceptRelaySeq;
|
|
1851
2401
|
private buildShapePoke;
|
|
1852
2402
|
private multicastShapePokes;
|
|
2403
|
+
private multicastToRelays;
|
|
1853
2404
|
private proxyShapePokes;
|
|
2405
|
+
private proxyToRelay;
|
|
1854
2406
|
private buildShapeSeedFrames;
|
|
1855
|
-
private
|
|
2407
|
+
private ensureRelayTables;
|
|
2408
|
+
protected bindingName(): string | undefined;
|
|
2409
|
+
private relayShapes;
|
|
2410
|
+
private rewindShapeCursor;
|
|
1856
2411
|
private ownerRelaySet;
|
|
2412
|
+
private liveGrantRelaySet;
|
|
2413
|
+
private recordLiveGrantRelay;
|
|
1857
2414
|
private addRelayToSet;
|
|
2415
|
+
private forwardToRelay;
|
|
2416
|
+
private requestDroppingIdle;
|
|
1858
2417
|
private removeRelayFromSet;
|
|
1859
2418
|
private probeShapeRelayUniform;
|
|
1860
2419
|
private tableHasAnyMask;
|
|
2420
|
+
private liveControlAnswer;
|
|
1861
2421
|
}
|
|
1862
2422
|
declare class RelayMember extends RelayLink {
|
|
1863
2423
|
private relayAnnounced;
|
|
1864
|
-
private readonly
|
|
2424
|
+
private readonly liveControlSeqs;
|
|
2425
|
+
private pendingAnnounce;
|
|
2426
|
+
private announceGeneration;
|
|
2427
|
+
private pendingDetach;
|
|
2428
|
+
private relayMemoCache;
|
|
2429
|
+
private readonly shapeControl;
|
|
1865
2430
|
constructor(host: RelayHost, ownerKey: string, relayIndex: number);
|
|
1866
2431
|
forwardWhisper(topic: string, frame: string): Promise<void>;
|
|
2432
|
+
forwardRoomEvent(event: Omit<RelayRoomEvent, "relayIndex" | "type">): Promise<boolean>;
|
|
1867
2433
|
onFlush(): Promise<void>;
|
|
1868
2434
|
seedRelayShape(ws: ShardSocketLike, subId: string, shape: ShapeSubscriptionQuery, identity: SubscriptionIdentity): Promise<"ok" | {
|
|
1869
2435
|
code: string;
|
|
1870
2436
|
message: string;
|
|
1871
2437
|
}>;
|
|
1872
|
-
announce(): Promise<
|
|
2438
|
+
announce(): Promise<boolean>;
|
|
1873
2439
|
announceDrain(closing: ShardSocketLike): Promise<void>;
|
|
2440
|
+
releaseRelayShapes(ws: ShardSocketLike, subId?: string): Promise<void>;
|
|
1874
2441
|
relayCount(): number;
|
|
1875
2442
|
isShapeRelayUniform(): boolean;
|
|
1876
|
-
|
|
1877
|
-
protected
|
|
2443
|
+
minShapeCursor(): number | undefined;
|
|
2444
|
+
protected onAttach(): boolean;
|
|
2445
|
+
protected refusesAsIdle(): boolean;
|
|
2446
|
+
protected onDetach(): boolean;
|
|
2447
|
+
protected onLiveControl(control: LiveSocketControlCall): Promise<Response>;
|
|
1878
2448
|
protected onWhisperFrame(): Promise<void>;
|
|
1879
2449
|
protected onShapeSubscribe(): RelayShapeSeed;
|
|
1880
|
-
protected
|
|
2450
|
+
protected onShapeUnsubscribe(): void;
|
|
2451
|
+
protected onShapePoke(poke: RelayShapePoke): RelayPokeDelivery;
|
|
2452
|
+
private queueShapeControl;
|
|
2453
|
+
private relayMemos;
|
|
2454
|
+
private connectionMemos;
|
|
1881
2455
|
private recordRelayShapeMemo;
|
|
2456
|
+
private forgetRelayShapeMemos;
|
|
1882
2457
|
private deliverShapePoke;
|
|
2458
|
+
private pokeSocketShapes;
|
|
1883
2459
|
}
|
|
1884
2460
|
declare const createRelayLink: (host: RelayHost) => OwnerRelay | RelayMember | undefined;
|
|
2461
|
+
declare const REGION_HINTS: readonly ["wnam", "enam", "sam", "weur", "eeur", "apac", "apac-ne", "apac-se", "oc", "afr", "me"];
|
|
2462
|
+
type RegionHint = (typeof REGION_HINTS)[number];
|
|
2463
|
+
type ReplicaReadiness = "fresh" | "stale" | "unavailable";
|
|
2464
|
+
interface ShardSiblingHost {
|
|
2465
|
+
doName: () => string | undefined;
|
|
2466
|
+
env: () => unknown;
|
|
2467
|
+
shardBinding: () => string | undefined;
|
|
2468
|
+
shardJurisdiction: () => string | undefined;
|
|
2469
|
+
sql: () => SqlExec;
|
|
2470
|
+
}
|
|
2471
|
+
interface ReplicaOwnerHost extends ShardSiblingHost {
|
|
2472
|
+
exportRows: () => Promise<ExportRow[]>;
|
|
2473
|
+
ownerCursor: () => number | undefined;
|
|
2474
|
+
ownerEpoch: () => string | undefined;
|
|
2475
|
+
ownerFloor: () => number | undefined;
|
|
2476
|
+
readChanges: (sinceSeq: number, limit: number) => {
|
|
2477
|
+
changes: CdcChange[];
|
|
2478
|
+
cursor: number;
|
|
2479
|
+
};
|
|
2480
|
+
rowCount: () => number;
|
|
2481
|
+
}
|
|
2482
|
+
interface ReplicaFollowerHost extends ShardSiblingHost {
|
|
2483
|
+
applyChanges: (changes: ReadonlyArray<CdcChange>) => Promise<number>;
|
|
2484
|
+
importRows: (rows: ReadonlyArray<ExportRow>) => Promise<{
|
|
2485
|
+
errors: ReadonlyArray<unknown>;
|
|
2486
|
+
}>;
|
|
2487
|
+
}
|
|
2488
|
+
declare const handleReplicaControl: (host: ReplicaOwnerHost, request: Request) => Promise<Response>;
|
|
2489
|
+
declare class ShardReplica {
|
|
2490
|
+
private readonly host;
|
|
2491
|
+
readonly ownerKey: string;
|
|
2492
|
+
readonly region: RegionHint;
|
|
2493
|
+
private divergent;
|
|
2494
|
+
private inFlight;
|
|
2495
|
+
constructor(host: ReplicaFollowerHost, ownerKey: string, region: RegionHint);
|
|
2496
|
+
ensureFresh(minSeq?: number): Promise<ReplicaReadiness>;
|
|
2497
|
+
appliedSeq(): number;
|
|
2498
|
+
isDivergent(): boolean;
|
|
2499
|
+
private advance;
|
|
2500
|
+
private isCaughtUp;
|
|
2501
|
+
private catchUp;
|
|
2502
|
+
private applyPage;
|
|
2503
|
+
private hasDiverged;
|
|
2504
|
+
private bootstrap;
|
|
2505
|
+
private isFreshEnough;
|
|
2506
|
+
private pull;
|
|
2507
|
+
private request;
|
|
2508
|
+
}
|
|
2509
|
+
declare const createReplicaLink: (host: ReplicaFollowerHost) => ShardReplica | undefined;
|
|
2510
|
+
declare const gateReplicaDispatch: (replica: ShardReplica, request: Request, functionPath: string) => Promise<Response | undefined>;
|
|
2511
|
+
declare const REPROJECTION_MIGRATION_PREFIX = "__lunora_reproject__";
|
|
2512
|
+
declare const reprojectionMigrationId: (table: string) => string;
|
|
2513
|
+
declare const reprojectableFields: (definition: TableDefinitionLike) => string[];
|
|
2514
|
+
declare const reprojectionTables: (schema: SchemaLike) => string[];
|
|
2515
|
+
declare const countLegacyRows: (sql: SqlExec, table: string, fields: ReadonlyArray<string>) => number;
|
|
2516
|
+
declare const buildReprojectionMigration: (id: string, schema: SchemaLike, sql: SqlExec) => DataMigrationLike | undefined;
|
|
1885
2517
|
declare const RLS_UNWRAP_SYMBOL: symbol;
|
|
1886
2518
|
declare class RlsRequiredError extends LunoraError {
|
|
1887
2519
|
readonly table: string;
|
|
@@ -1898,7 +2530,7 @@ interface GuardableSchema {
|
|
|
1898
2530
|
}
|
|
1899
2531
|
type TableOfId = (id: string, expectedTable?: string) => Promise<string | undefined> | string | undefined;
|
|
1900
2532
|
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;
|
|
2533
|
+
declare const guardWriter: <W>(raw: W, schema: GuardableSchema, tableOfId: TableOfId, tablesOfIds?: TablesOfIds, relationEdges?: ReadonlyArray<RelationEdge>) => W;
|
|
1902
2534
|
declare const SCHEMA_HISTORY_MAX_VERSIONS = 50;
|
|
1903
2535
|
interface SchemaVersionRow {
|
|
1904
2536
|
appliedAt: number;
|
|
@@ -1909,8 +2541,24 @@ interface SchemaVersionRow {
|
|
|
1909
2541
|
declare const recordSchemaVersion: (sql: SqlExec, hash: string, snapshotJson: string, now?: number) => boolean;
|
|
1910
2542
|
declare const readSchemaHistory: (sql: SqlExec) => SchemaVersionRow[];
|
|
1911
2543
|
declare const readSchemaVersion: (sql: SqlExec, hash: string) => SchemaVersionRow | undefined;
|
|
2544
|
+
declare const readDeployInfo: (rawEnv: unknown) => DeployInfo;
|
|
1912
2545
|
declare const isDevEnvironment: (rawEnv: unknown) => boolean;
|
|
1913
2546
|
declare const buildSettings: (rawEnv: unknown) => SettingsResult;
|
|
2547
|
+
declare class ShapeDiffCache {
|
|
2548
|
+
private readonly keyScans;
|
|
2549
|
+
private readonly memberProbes;
|
|
2550
|
+
private run;
|
|
2551
|
+
private served;
|
|
2552
|
+
get probesRun(): number;
|
|
2553
|
+
get probesServed(): number;
|
|
2554
|
+
changedKeys(rangeKey: string, load: () => CdcChangeKey[]): ReadonlyArray<CdcChangeKey>;
|
|
2555
|
+
members(resolved: ResolvedShape, rangeKey: string, load: () => Map<string, Record<string, unknown>>): ReadonlyMap<string, Record<string, unknown>>;
|
|
2556
|
+
private getOrLoad;
|
|
2557
|
+
}
|
|
2558
|
+
declare const createShapeDiffCache: () => ShapeDiffCache;
|
|
2559
|
+
declare const globalShapeReadKey: (resolved: ResolvedShape, identity: SubscriptionIdentity) => string | undefined;
|
|
2560
|
+
type ReadShapeCdcKeys = (sql: SqlExec, table: string, sinceSeq: number, upTo: number) => CdcChangeKey[];
|
|
2561
|
+
declare const buildShapeDiff: (sql: SqlExec, resolved: ResolvedShape, sinceSeq: number, upTo: number, cache: ShapeDiffCache, readKeys?: ReadShapeCdcKeys) => ShapeRowOp[];
|
|
1914
2562
|
interface ShardRunnerOptions {
|
|
1915
2563
|
handlers?: {
|
|
1916
2564
|
handleAlarm?: () => Promise<void>;
|
|
@@ -1926,7 +2574,7 @@ declare class ShardRunner {
|
|
|
1926
2574
|
socketFor(raw: unknown): ShardSocketLike;
|
|
1927
2575
|
sockets(tag?: string): SocketHandle[];
|
|
1928
2576
|
background(work: Promise<unknown>): boolean;
|
|
1929
|
-
runInTransaction<T>(work: () => Promise<T
|
|
2577
|
+
runInTransaction<T>(work: () => Promise<T>, onCommitted?: () => void): Promise<T>;
|
|
1930
2578
|
handleFetch(request: Request): Promise<Response>;
|
|
1931
2579
|
handleAlarm(): Promise<void>;
|
|
1932
2580
|
}
|
|
@@ -1952,6 +2600,11 @@ interface SqlDiagnostic {
|
|
|
1952
2600
|
source: "gate" | "plan" | "syntax";
|
|
1953
2601
|
}
|
|
1954
2602
|
declare const lintReadonlySql: (sql: SqlExec, query: string) => SqlLintResult;
|
|
2603
|
+
declare const BIGINT_KEY_DIGITS = 39;
|
|
2604
|
+
declare const bigintSqlKey: (value: bigint) => string;
|
|
2605
|
+
declare const decodeBigintSqlKey: (raw: string) => bigint | undefined;
|
|
2606
|
+
declare const float64SqlKey: (value: number) => string;
|
|
2607
|
+
declare const decodeFloat64SqlKey: (raw: string) => number | undefined;
|
|
1955
2608
|
declare const subscriptionListDeltas: (previousJson: string, nextResult: unknown, table: string, frames?: string[]) => MutationDelta[] | undefined;
|
|
1956
2609
|
interface FrameSink {
|
|
1957
2610
|
send: (data: string) => void;
|
|
@@ -1960,7 +2613,17 @@ interface DrainableSink {
|
|
|
1960
2613
|
readonly bufferedAmount?: unknown;
|
|
1961
2614
|
}
|
|
1962
2615
|
declare const trySendFrame: (ws: FrameSink, frame: string) => boolean;
|
|
1963
|
-
|
|
2616
|
+
interface SubscriptionFrameInput {
|
|
2617
|
+
cursorSuffix: string;
|
|
2618
|
+
lastMutationId?: number;
|
|
2619
|
+
nextResult: unknown;
|
|
2620
|
+
pageDeltas?: boolean;
|
|
2621
|
+
previousJson?: string;
|
|
2622
|
+
snapshotJson: string;
|
|
2623
|
+
subId: string;
|
|
2624
|
+
table: string;
|
|
2625
|
+
}
|
|
2626
|
+
declare const subscriptionFrames: (input: SubscriptionFrameInput) => string[];
|
|
1964
2627
|
declare const awaitWsDrain: (ws: DrainableSink) => Promise<void>;
|
|
1965
2628
|
interface SubscriptionReadFootprint {
|
|
1966
2629
|
ranges?: Map<string, KeyRange[]>;
|
|
@@ -1988,13 +2651,30 @@ declare const selectExpiredIds: (sql: SqlExec, spec: TtlSweepSpec, now: number,
|
|
|
1988
2651
|
hasMore: boolean;
|
|
1989
2652
|
ids: string[];
|
|
1990
2653
|
};
|
|
1991
|
-
|
|
1992
|
-
|
|
1993
|
-
|
|
1994
|
-
|
|
1995
|
-
|
|
1996
|
-
|
|
1997
|
-
|
|
2654
|
+
declare const VECTOR_BACKFILL_MAX_PAGES = 20;
|
|
2655
|
+
interface VectorBackfillTarget {
|
|
2656
|
+
profile: string;
|
|
2657
|
+
table: string;
|
|
2658
|
+
}
|
|
2659
|
+
interface VectorBackfillProgress {
|
|
2660
|
+
done: boolean;
|
|
2661
|
+
error?: string;
|
|
2662
|
+
failed: number;
|
|
2663
|
+
failedIds: string[];
|
|
2664
|
+
pages: number;
|
|
2665
|
+
rows: number;
|
|
1998
2666
|
}
|
|
1999
|
-
|
|
2000
|
-
|
|
2667
|
+
type VectorPageSync = (table: string, rows: ReadonlyArray<{
|
|
2668
|
+
doc: Record<string, unknown>;
|
|
2669
|
+
id: string;
|
|
2670
|
+
}>) => Promise<ReadonlyArray<{
|
|
2671
|
+
error: unknown;
|
|
2672
|
+
id: string;
|
|
2673
|
+
}>>;
|
|
2674
|
+
type OrderedAfterWrites = <T, U>(read: () => T, work: (value: T) => Promise<U>) => Promise<U>;
|
|
2675
|
+
declare const backfillVectorIndexes: (sql: SqlExec, targets: ReadonlyArray<VectorBackfillTarget>, sync: VectorPageSync, options: {
|
|
2676
|
+
maxPages?: number;
|
|
2677
|
+
ordered: OrderedAfterWrites;
|
|
2678
|
+
restart?: boolean;
|
|
2679
|
+
}) => Promise<VectorBackfillProgress>;
|
|
2680
|
+
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, type LiveSocketControlCall, MAIL_RETENTION, MAIL_TABLE, MAX_DURABLE_STREAM_BYTES, MAX_DURABLE_STREAM_CHUNKS, MAX_PAGE_SIZE, MAX_SQL_ROWS, type MaskColumnMetadata, type MaskPoliciesResult, type MaterializeResult, type MigrationDirection, type MigrationRunResult, type MigrationStatus, type MigrationStatusRow, type MutationDelta, type NestedWith, NotFoundError, NotUniqueError, type NullPlacement, type OnDeleteActionLike, type OrderByClause, type OrderByInput, type OrderKey, type OrderKeyConstraints, OwnerRelay, type OwnerRelayFrame, type PaginationOptions, type PatchVerifier, type PatchWriteOptions, type PitrBookmarkResult, type PitrRestoreArgs, type PitrRestoreResult, type PitrStorage, type PokeFrameMeta, type PromotionState, type PromotionThresholds, QUEUE_TABLE, type QueryArgs, type QueryPage, type QueryPlan, type QueueMessageOutcome, type QueueMessageRow, type QueueMetadata, type QueuesResult, RANK_TIEBREAK, REACTOR_STATE_TABLE, RELATED_DEFAULT_LIMIT, RELATED_DEPTH_DECAY, RELATED_MAX_DEPTH, RELATED_MAX_LIMIT, RELATION_EXISTS_KEY, RELATION_FUNCTION_PREFIX, RELAY_SIGNATURE_HEADER, REPROJECTION_MIGRATION_PREFIX, RLS_UNWRAP_SYMBOL, type RangeOperandType, type RankBeforeOptions, type RankBeforeResult, type RankDirection, type RankIndexDefinitionLike, type RankOptions, type RankPage, type RankPageComputation, type RankPageDeps, type RankPageOptions, type RankPageRow, type RankPageRowKey, type RankResult, type RankSortKeyLike, ReactiveCache, type ReactiveCacheOptions, type ReactorDispatchResult, type ReactorMetadata, type ReactorState, type ReactorStats, type ReactorsResult, type ReadFootprint, type ReadHook, type ReadTablePageOptions, type RecordMailInput, type RecordQueueMessageInput, type RelatedDirection, type RelatedNode, type RelatedOptions, type RelatedPage, type RelatedStart, type RelatedStartReference, type RelationDefinitionLike, type RelationEdge, type RelationExistsMarker, type RelationGraphReader, type RelationWriteInfo, type RelationWriteMap, type RelayAttach, type RelayDetach, type RelayFrame, type RelayHost, RelayMember, type RelayPokeDelivery, type RelayRoomEvent, type RelayRoomVerdict, type RelayShapePoke, type RelayShapeSeed, type RelayShapeSubscribe, type RelayShapeUnsubscribe, type RenderedSql, type ReplicaFollowerHost, type ReplicaOwnerHost, type ReplicaReadiness, type ResolveRelationPredicatesOptions, type ResolveWithOptions, type ResolveWithResult, type ResolvedShape, type RestrictableQueryOptions, type RlsPoliciesResult, type RlsPolicyMetadata, RlsRequiredError, type RlsRoleMetadata, type RpcRequest, type RunDataMigrationOptions, type RunTriggersOptions, SCAN_DEP, SCHEDULE_OUTBOX_TABLE, SCHEMA_HISTORY_MAX_VERSIONS, SEARCH_STATE_TABLE, SHAPE_POKE_CURSOR_TABLE, type SchedulableWorkflowReferenceLike, type ScheduleOutbox, type ScheduleOutboxEnvelope, type ScheduleOutboxRow, type ScheduledFunctionDoc, type SchedulerLike, type SchemaLike, type ScoredDocument, type SearchBackfillProgress, type SearchFilterBuilderLike, type SearchIndexDefinitionLike, type SearchScoredDocument, type SelectMatchingIdsOptions, type ServerDefaultContextLike, type SettingEntry, type SettingKind, type SettingsResult, ShapeDiffCache, type ShapePokeCursorRow, type ShapePokePart, type ShapeProbeCounters, type ShapeRow, type ShapeRowOp, type ShapeSubscriptionQuery, type ShardRankPageResult, ShardRunner, type ShardRunnerOptions, type ShardSiblingHost, type ShardSocketLike, type SocketAttachment, type SortDirection, type SourceClientLike, type SourceCursorLike, type SourceRefresh, type SqlConsoleResult, type SqlCursor, type SqlEngine, type SqlExec, type SqlLintResult, type StorageMetadata, type StorageReference, type StorageReferenceResult, type StorageRuleMetadata, type StorageRulesResult, type StudioFeaturesResult, type SubscriptionConnection, type SubscriptionEnvelope, type SubscriptionIdentity, type SubscriptionInfo, type SubscriptionQuery, type SubscriptionReadFootprint, type SubscriptionsResult, type SystemDatabaseReader, type SystemDoc, type SystemQuery, type SystemReaderOptions, type SystemReaderSchedulerLike, type SystemReaderStorageLike, type SystemTableName, type TableColumnsResult, type TableDefinitionLike, type TableIndexInfo, type TableIndexesResult, type TableInfo, type TablePage, type TableReaderLike, type TablesColumnsResult, type TablesIndexesResult, type ThroughRelationWriteInfo, type TransactionHeadroom, TransactionHeadroomTracker, type TransactionLimits, type TransactionSqlLike, type TriggerContextLike, type TriggerDefinitionLike, type TriggerEventLike, type TriggerOpLike, type TriggerTimingLike, type TtlSweepSpec, UNVOUCHABLE_DEP, VECTOR_BACKFILL_MAX_PAGES, type ValidatorLike, type VectorBackfillProgress, WORKERD_SQLITE_LIMITS, type WhereFilter, type WhereInput, type WhereSqlStrategy, type WithInput, type WorkflowInstanceState, type WorkflowInstanceStatusResult, type WorkflowMetadata, type WorkflowsResult, type WriteEvent, type WriteHook, advanceClientWatermark, aggUpsertSql, aggregateSqlFunction, aggregateTableName, allocateCommitSeq, appendAuditEntry, appendCdcChange, appendStreamChunk, applyCdcChanges, 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, siblingSecretOf, signSiblingBody, softDeleteScope, sortColumnName, sqliteInList, stripReservedPatchFields, stubByName, subscriptionFrames, subscriptionListDeltas, summarizeFanoutTopics, summarizeSubscriptions, tableColumns, tableFromDepKey, throwingScheduler, tiebreakDirectionFor, trimCdcChanges, trimIdempotent, trimScheduleOutbox, trimStreamRuns, tryRowToDocument, trySendFrame, unionAll, uniqueIndexFields, validateImportRow, verifySiblingBody, whereFilter, whereOfFilter, writeCdcArchivedThrough, writeGlobalShapeSnapshot, writeIdempotent, writeReactorState, writeSearchBackfillState, writeShapePokeCursor, writeShapePokeCursors, writeTouchesMemo };
|