@lunora/shard-engine 1.0.0-alpha.21 → 1.0.0-alpha.210
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/LICENSE.md +201 -104
- package/README.md +1 -1
- package/dist/conformance/index.mjs +1 -1
- package/dist/index.d.mts +1101 -221
- package/dist/index.d.ts +1101 -221
- package/dist/index.mjs +1 -1
- package/dist/packem_shared/ADMIN_FUNCTIONS-olXwJWFQ.mjs +14 -0
- package/dist/packem_shared/ADMIN_TOKEN_TABLE-DfQ5osdI.mjs +1 -0
- package/dist/packem_shared/ADMIN_WILDCARD-BUrgWQ3-.mjs +1 -0
- package/dist/packem_shared/AGGREGATE_SQL_FUNCTION-C_ZipS9R.mjs +1 -0
- package/dist/packem_shared/AGG_COUNT-BaMXGlVQ.mjs +1 -0
- package/dist/packem_shared/AUDIT_LOG_TABLE-BFJ65SRS.mjs +8 -0
- package/dist/packem_shared/BIGINT_KEY_DIGITS-DE6yshOt.mjs +1 -0
- package/dist/packem_shared/CDC_LOG_TABLE-fCPCjSE4.mjs +18 -0
- package/dist/packem_shared/CLIENT_WATERMARK_TABLE-De7z_OHV.mjs +7 -0
- package/dist/packem_shared/COMMIT_SEQ_FIELD-Da1DjGqo.mjs +4 -0
- package/dist/packem_shared/CURSOR_PREFIX-rOdoinP8.mjs +1 -0
- package/dist/packem_shared/CompanionMemo-jmlDbPlr.mjs +1 -0
- package/dist/packem_shared/CountRlsUnsupportedError-BvsDqfO2.mjs +1 -0
- package/dist/packem_shared/DATA_MIGRATION_STATE_TABLE-CPWZjliE.mjs +31 -0
- package/dist/packem_shared/DEFAULT_MAX_RELATION_KEYS-DrcbZM0t.mjs +1 -0
- package/dist/packem_shared/DEFAULT_MAX_RELAYS-BZLpaaq1.mjs +8 -0
- package/dist/packem_shared/DEFAULT_PROMOTION_THRESHOLDS-VU44O5kq.mjs +1 -0
- package/dist/packem_shared/DEFAULT_TRANSACTION_LIMITS-D7p7Ys0M.mjs +1 -0
- package/dist/packem_shared/DELTA_PLACEHOLDER_TABLE-CHxtV9xh.mjs +1 -0
- package/dist/packem_shared/DurableStreamRunner-MMlV5qKQ.mjs +1 -0
- package/dist/packem_shared/GEO_DEFAULT_PRECISION-CqpQZ-J_.mjs +1 -0
- package/dist/packem_shared/GLOBAL_SHAPE_SNAPSHOT_TABLE-Bb6-aZuH.mjs +7 -0
- package/dist/packem_shared/GlobalPollTick-BNK4o-XT.mjs +1 -0
- package/dist/packem_shared/IDEMPOTENCY_TABLE-BVosXEq_.mjs +7 -0
- package/dist/packem_shared/IMPORT_MANIFEST_TTL_MS-BrNT0vUO.mjs +1 -0
- package/dist/packem_shared/MAIL_RETENTION-DMolrLYt.mjs +18 -0
- package/dist/packem_shared/MAX_SQL_ROWS-B4WlVI-e.mjs +5 -0
- package/dist/packem_shared/MAX_TOKEN_LENGTH-iFEGEcDL-DBPC6ZWl.mjs +1 -0
- package/dist/packem_shared/NotUniqueError-CDB9Ooq4.mjs +1 -0
- package/dist/packem_shared/QUEUE_TABLE-C-goXtGd.mjs +17 -0
- package/dist/packem_shared/RANK_TIEBREAK-D3ye2GsL.mjs +1 -0
- package/dist/packem_shared/REACTOR_STATE_TABLE-D2Mn204f.mjs +28 -0
- package/dist/packem_shared/RELATED_DEFAULT_LIMIT-CAh3WUMn.mjs +1 -0
- package/dist/packem_shared/RELATION_EXISTS_KEY-wxgj6rSL.mjs +1 -0
- package/dist/packem_shared/RELAY_SIGNATURE_HEADER-CAfC4tqg.mjs +1 -0
- package/dist/packem_shared/REPROJECTION_MIGRATION_PREFIX-Czcb6_mO.mjs +1 -0
- package/dist/packem_shared/RLS_UNWRAP_SYMBOL-CWo1Bk9y.mjs +1 -0
- package/dist/packem_shared/ReactiveCache-BG9z3FE9.mjs +1 -0
- package/dist/packem_shared/SCAN_DEP-B4Uu4g7l.mjs +1 -0
- package/dist/packem_shared/SCHEDULE_OUTBOX_TABLE-iyyiSjsO.mjs +18 -0
- package/dist/packem_shared/SCHEMA_HISTORY_MAX_VERSIONS-CEwFjj-O.mjs +6 -0
- package/dist/packem_shared/SEARCH_STATE_TABLE-D7w8mRsm.mjs +1 -0
- package/dist/packem_shared/SHAPE_POKE_CURSOR_TABLE-BGvY3sFI.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/VECTOR_BACKFILL_MAX_PAGES-DbNHRd5m.mjs +1 -0
- package/dist/packem_shared/WORKERD_SQLITE_LIMITS-B_4w7tzY.mjs +1 -0
- package/dist/packem_shared/accepts-null-D1zmJbyR.mjs +1 -0
- package/dist/packem_shared/adminTokenExists-CQ0qedmu.mjs +8 -0
- package/dist/packem_shared/aggregateTableName-B_CtIQCS.mjs +1 -0
- package/dist/packem_shared/appendStreamChunk-BZYgGE9Y.mjs +17 -0
- package/dist/packem_shared/applyInsertDefaults-CYSHgpFD.mjs +1 -0
- package/dist/packem_shared/archiveCdcSegment-Cr8oGLfB.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/backfillAggregateIndexes-BfJ2FeLv.mjs +1 -0
- package/dist/packem_shared/buildIndexRange-BTChxh3k.mjs +1 -0
- package/dist/packem_shared/buildPokeFrames-WR-hp0mX.mjs +1 -0
- package/dist/packem_shared/buildReprojectionMigration-wSas3lLT.mjs +1 -0
- package/dist/packem_shared/buildSettings-CFkvTaHx.mjs +1 -0
- package/dist/packem_shared/buildShapeDiff-DrXTkXKH.mjs +1 -0
- package/dist/packem_shared/clearMemoryTables-aMRERF0w.mjs +1 -0
- package/dist/packem_shared/compileWhereSql--dIcrS0b.mjs +1 -0
- package/dist/packem_shared/computeRankPage-B6umzbg4.mjs +1 -0
- package/dist/packem_shared/constant-time-equal-BRh9yUCr.mjs +1 -0
- package/dist/packem_shared/createCompanionSync-DmciS_rv.mjs +1 -0
- package/dist/packem_shared/createReplicaLink-BapaAUfm.mjs +7 -0
- package/dist/packem_shared/createSystemReader-BSCxr8Qs.mjs +1 -0
- package/dist/packem_shared/ctx-db-relay-shapes-DBobAek2.mjs +17 -0
- package/dist/packem_shared/ctx-db-search-state-CPKPy8N6.mjs +1 -0
- package/dist/packem_shared/defineEngineContractSuite-B_CuudJA.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-Cf2rnuLV.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-C-C35VXL.mjs +1 -0
- package/dist/packem_shared/exportShardRows-BEzRTBwD.mjs +1 -0
- package/dist/packem_shared/fts-companion-CE3EmIjk.mjs +1 -0
- package/dist/packem_shared/ftsCompanionDdl-B0bFCy6d.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-By7iuPdW.mjs +9 -0
- package/dist/packem_shared/isTtlExpired-Bymg2-13.mjs +1 -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-gZqs4Rsj.mjs +1 -0
- package/dist/packem_shared/mergeChangedKeys-DPKhen6e.mjs +1 -0
- package/dist/packem_shared/relation-operators-BEg-CvCH.mjs +1 -0
- package/dist/packem_shared/relay-CKEdfUjH.mjs +1 -0
- package/dist/packem_shared/runDrizzle-RC09zZrh.mjs +1 -0
- package/dist/packem_shared/runShardMigrations-4_ene2xR.mjs +5 -0
- package/dist/packem_shared/runSocketPool-CZJ2X9cF.mjs +1 -0
- package/dist/packem_shared/selectShapeMembers-Ce6pOHKe.mjs +1 -0
- package/dist/packem_shared/serializeSqlValue-DeoBMpZ2.mjs +1 -0
- package/dist/packem_shared/stubByName-DQSivmvb.mjs +1 -0
- package/dist/packem_shared/where-sql-Cb_dSAMj.mjs +1 -0
- package/package.json +6 -5
- package/dist/packem_shared/ADMIN_FUNCTIONS-OnYxyTXW.mjs +0 -1
- package/dist/packem_shared/AGGREGATE_SQL_FUNCTION-CTo0-9iZ.mjs +0 -1
- package/dist/packem_shared/AGG_COUNT-CqQLWpb4.mjs +0 -1
- package/dist/packem_shared/AUDIT_LOG_TABLE-C6nwXFPd.mjs +0 -8
- package/dist/packem_shared/CDC_LOG_TABLE-ZqcflEen.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-DjKka36Z.mjs +0 -1
- package/dist/packem_shared/DEFAULT_MAX_RELAYS-B19vrJxP.mjs +0 -1
- package/dist/packem_shared/DEFAULT_PROMOTION_THRESHOLDS-B2rUe1bg.mjs +0 -1
- package/dist/packem_shared/DEFAULT_TRANSACTION_LIMITS-q7ouI3i0.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-CVHdtVw6.mjs +0 -1
- package/dist/packem_shared/QUEUE_TABLE-DgBqWrXX.mjs +0 -17
- package/dist/packem_shared/RANK_TIEBREAK-DDtST3gN.mjs +0 -1
- package/dist/packem_shared/RELATION_EXISTS_KEY-BaqSIFU1.mjs +0 -1
- package/dist/packem_shared/REPROJECTION_MIGRATION_PREFIX-D2dltRFC.mjs +0 -1
- package/dist/packem_shared/RLS_UNWRAP_SYMBOL-DcqORh2s.mjs +0 -1
- package/dist/packem_shared/ReactiveCache-Cu8IfE1M.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-DgYMC5tr.mjs +0 -1
- package/dist/packem_shared/applyOnDelete-By23GK-k.mjs +0 -1
- package/dist/packem_shared/applySelect-UY-o13Ia.mjs +0 -1
- package/dist/packem_shared/awaitWsDrain-Bp2jKzIb.mjs +0 -1
- package/dist/packem_shared/backfillAggregateIndexes-DmqOHg0U.mjs +0 -1
- package/dist/packem_shared/base64-fKomMf5D.mjs +0 -1
- package/dist/packem_shared/buildIndexRange-DFsdtPjD.mjs +0 -1
- package/dist/packem_shared/buildPokeFrames-CqxaN8_H.mjs +0 -1
- package/dist/packem_shared/buildReprojectionMigration-Ctl4r84d.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-QK8SeTZ-.mjs +0 -1
- package/dist/packem_shared/createCompanionSync-COw1Uy6a.mjs +0 -1
- package/dist/packem_shared/createReadFootprint-DIrrxRTE.mjs +0 -1
- package/dist/packem_shared/createReplicaLink-BMNW0SX6.mjs +0 -7
- package/dist/packem_shared/createSystemReader-DcDcrtM3.mjs +0 -1
- package/dist/packem_shared/ctx-db-companions-BTi8DLUl.mjs +0 -1
- package/dist/packem_shared/defineEngineContractSuite-B6nrsKSE.mjs +0 -1
- package/dist/packem_shared/diffExternalSource-DMpkJta1.mjs +0 -1
- package/dist/packem_shared/do-sql-1Yi1_Yq0.mjs +0 -1
- package/dist/packem_shared/estimate-bytes-Drp8rhPs.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-Bo-y3DOe.mjs +0 -9
- package/dist/packem_shared/liftSourceId-DApAbu7Q.mjs +0 -1
- package/dist/packem_shared/materializeExternalRows-DcCENzpV.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-BqO6HPtX.mjs +0 -5
- package/dist/packem_shared/runSocketPool-DPQLVyWF.mjs +0 -1
- package/dist/packem_shared/selectExpiredIds-C6nQK7E2.mjs +0 -1
- package/dist/packem_shared/selectShapeMemberIds-BdBcbrUP.mjs +0 -1
- package/dist/packem_shared/serializeSqlValue-BR4UOWoP.mjs +0 -1
- package/dist/packem_shared/sibling-channel-bg9FBL5s.mjs +0 -1
- package/dist/packem_shared/sql-projection-jfoe331H.mjs +0 -1
- package/dist/packem_shared/stableStringify-BjLh4gvA.mjs +0 -1
- package/dist/packem_shared/stableWireKey-l3cjIt-9.mjs +0 -1
- package/dist/packem_shared/wire-codec-Dsy70M3Q.mjs +0 -1
package/dist/index.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { LunoraError } from '@lunora/errors';
|
|
2
|
+
import { R2BucketLike, ShardHost, SocketHost, SocketHandle } from '@lunora/platform';
|
|
2
3
|
import { SQL, Name } from 'drizzle-orm';
|
|
3
|
-
|
|
4
|
+
export { stableStringify, stableWireKey } from '@lunora/wire';
|
|
4
5
|
interface KeyRange {
|
|
5
6
|
hi: string;
|
|
6
7
|
index: string;
|
|
@@ -22,15 +23,46 @@ 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;
|
|
56
|
+
completedAt?: number;
|
|
29
57
|
enqueuedAt: number;
|
|
30
|
-
|
|
58
|
+
error?: string;
|
|
59
|
+
functionPath?: string;
|
|
31
60
|
id: string;
|
|
61
|
+
pool?: string;
|
|
32
62
|
scheduledFor: number;
|
|
33
63
|
shardKey?: string;
|
|
64
|
+
state?: "canceled" | "failed" | "pending" | "running" | "succeeded";
|
|
65
|
+
workflow?: string;
|
|
34
66
|
}
|
|
35
67
|
interface StorageMetadata {
|
|
36
68
|
contentType?: string;
|
|
@@ -86,6 +118,90 @@ interface WhereInput {
|
|
|
86
118
|
OR?: WhereInput[];
|
|
87
119
|
}
|
|
88
120
|
declare const RELATION_EXISTS_KEY = "__relationExists";
|
|
121
|
+
interface SubscriptionQuery {
|
|
122
|
+
args?: Record<string, unknown>;
|
|
123
|
+
functionPath?: string;
|
|
124
|
+
sinceClaims?: string;
|
|
125
|
+
sinceEpoch?: string;
|
|
126
|
+
sinceSeq?: number;
|
|
127
|
+
table?: string;
|
|
128
|
+
}
|
|
129
|
+
interface ShapeSubscriptionQuery {
|
|
130
|
+
args?: Record<string, unknown>;
|
|
131
|
+
name: string;
|
|
132
|
+
sinceEpoch?: string;
|
|
133
|
+
sinceSeq?: number;
|
|
134
|
+
}
|
|
135
|
+
interface SubscriptionEnvelope {
|
|
136
|
+
caps?: string[];
|
|
137
|
+
clientId?: string;
|
|
138
|
+
context?: Record<string, unknown>;
|
|
139
|
+
data?: unknown;
|
|
140
|
+
generation?: number;
|
|
141
|
+
id: string;
|
|
142
|
+
query?: SubscriptionQuery;
|
|
143
|
+
shape?: {
|
|
144
|
+
args?: Record<string, unknown>;
|
|
145
|
+
name: string;
|
|
146
|
+
};
|
|
147
|
+
sinceCheckpoint?: number;
|
|
148
|
+
sinceChunk?: number;
|
|
149
|
+
sinceClaims?: string;
|
|
150
|
+
sinceEpoch?: string;
|
|
151
|
+
token?: string;
|
|
152
|
+
topic?: string;
|
|
153
|
+
type: "ack" | "connect" | "shape_subscribe" | "shape_unsubscribe" | "stream" | "subscribe" | "unsubscribe" | "whisper" | "whisper_subscribe" | "whisper_unsubscribe";
|
|
154
|
+
}
|
|
155
|
+
interface RpcRequest {
|
|
156
|
+
args?: Record<string, unknown>;
|
|
157
|
+
functionPath: string;
|
|
158
|
+
}
|
|
159
|
+
interface SocketAttachment {
|
|
160
|
+
admin?: boolean;
|
|
161
|
+
adminBinding?: string;
|
|
162
|
+
authenticated?: boolean;
|
|
163
|
+
broadcastSubs?: Record<string, string>;
|
|
164
|
+
clientId?: string;
|
|
165
|
+
connected?: boolean;
|
|
166
|
+
connectionId?: string;
|
|
167
|
+
context?: Record<string, unknown>;
|
|
168
|
+
deliveryPermits?: Record<string, {
|
|
169
|
+
epoch: number;
|
|
170
|
+
scope: string;
|
|
171
|
+
}>;
|
|
172
|
+
expiresAt?: number;
|
|
173
|
+
identity?: Record<string, unknown>;
|
|
174
|
+
ip?: string;
|
|
175
|
+
liveGrants?: Record<string, string>;
|
|
176
|
+
pageDeltas?: boolean;
|
|
177
|
+
pendingSince?: number;
|
|
178
|
+
refreshBatch?: boolean;
|
|
179
|
+
revalidateAt?: number;
|
|
180
|
+
shapes?: Record<string, ShapeSubscriptionQuery>;
|
|
181
|
+
socketFunction?: string;
|
|
182
|
+
socketPath?: string;
|
|
183
|
+
subs: Record<string, SubscriptionQuery>;
|
|
184
|
+
userId?: string;
|
|
185
|
+
whispers?: string[];
|
|
186
|
+
}
|
|
187
|
+
interface ResolvedShape {
|
|
188
|
+
columns?: ReadonlyArray<string>;
|
|
189
|
+
effectiveWhere?: WhereInput;
|
|
190
|
+
global?: boolean;
|
|
191
|
+
table: string;
|
|
192
|
+
}
|
|
193
|
+
interface SubscriptionIdentity {
|
|
194
|
+
identity?: Record<string, unknown>;
|
|
195
|
+
ip?: string;
|
|
196
|
+
userId?: string;
|
|
197
|
+
}
|
|
198
|
+
interface ShardSocketLike {
|
|
199
|
+
readonly bufferedAmount?: number;
|
|
200
|
+
close?: (code?: number, reason?: string) => void;
|
|
201
|
+
deserializeAttachment?: () => unknown;
|
|
202
|
+
send: (data: string) => void;
|
|
203
|
+
serializeAttachment?: (value: unknown) => void;
|
|
204
|
+
}
|
|
89
205
|
type AggregateOp = "avg" | "count" | "max" | "min" | "sum";
|
|
90
206
|
interface AggregateIndexDefinitionLike {
|
|
91
207
|
readonly by?: ReadonlyArray<string>;
|
|
@@ -137,6 +253,11 @@ interface ColumnMetaLike {
|
|
|
137
253
|
interface ValidatorLike {
|
|
138
254
|
readonly _meta?: {
|
|
139
255
|
readonly column?: ColumnMetaLike;
|
|
256
|
+
readonly inner?: ValidatorLike;
|
|
257
|
+
readonly members?: ReadonlyArray<ValidatorLike>;
|
|
258
|
+
readonly shape?: Readonly<Record<string, ValidatorLike>>;
|
|
259
|
+
readonly tableName?: string;
|
|
260
|
+
readonly value?: unknown;
|
|
140
261
|
};
|
|
141
262
|
readonly kind?: string;
|
|
142
263
|
readonly parse?: (value: unknown) => unknown;
|
|
@@ -144,7 +265,7 @@ interface ValidatorLike {
|
|
|
144
265
|
type TriggerTimingLike = "after" | "before";
|
|
145
266
|
type TriggerOpLike = "delete" | "insert" | "update";
|
|
146
267
|
interface SchedulableWorkflowReferenceLike {
|
|
147
|
-
readonly
|
|
268
|
+
readonly className?: string;
|
|
148
269
|
readonly isLunoraWorkflow: true;
|
|
149
270
|
readonly name?: string;
|
|
150
271
|
}
|
|
@@ -178,11 +299,18 @@ interface SchemaLike {
|
|
|
178
299
|
readonly rlsMode?: "required";
|
|
179
300
|
readonly tables: Record<string, TableDefinitionLike>;
|
|
180
301
|
}
|
|
302
|
+
type PatchVerifier = (previous: Record<string, unknown>, next: Record<string, unknown>) => boolean;
|
|
303
|
+
interface PatchWriteOptions {
|
|
304
|
+
verify?: PatchVerifier;
|
|
305
|
+
}
|
|
181
306
|
interface TableDefinitionLike {
|
|
182
307
|
readonly aggregateIndexes?: ReadonlyArray<AggregateIndexDefinitionLike>;
|
|
308
|
+
readonly commitOrderedMode?: boolean;
|
|
309
|
+
readonly dropStalePatchesMode?: boolean;
|
|
183
310
|
readonly geoIndexes?: ReadonlyArray<GeoIndexDefinitionLike>;
|
|
184
311
|
readonly indexes: ReadonlyArray<IndexDefinitionLike>;
|
|
185
312
|
readonly isPublic?: boolean;
|
|
313
|
+
readonly memoryMode?: boolean;
|
|
186
314
|
readonly rankIndexes?: ReadonlyArray<RankIndexDefinitionLike>;
|
|
187
315
|
readonly relationMap?: Record<string, RelationDefinitionLike>;
|
|
188
316
|
readonly searchIndexes?: ReadonlyArray<SearchIndexDefinitionLike>;
|
|
@@ -200,13 +328,25 @@ interface TableDefinitionLike {
|
|
|
200
328
|
field: string;
|
|
201
329
|
};
|
|
202
330
|
}
|
|
203
|
-
interface
|
|
331
|
+
interface KeyedRelationDefinitionLike {
|
|
204
332
|
readonly field: string;
|
|
205
333
|
readonly kind: "many" | "one";
|
|
206
334
|
readonly onDelete?: OnDeleteActionLike;
|
|
207
335
|
readonly references: string;
|
|
208
336
|
readonly table: string;
|
|
337
|
+
readonly through?: never;
|
|
338
|
+
}
|
|
339
|
+
interface RelationThroughLike {
|
|
340
|
+
readonly from: string;
|
|
341
|
+
readonly table: string;
|
|
342
|
+
readonly to: string;
|
|
343
|
+
}
|
|
344
|
+
interface ThroughRelationDefinitionLike {
|
|
345
|
+
readonly kind: "many";
|
|
346
|
+
readonly table: string;
|
|
347
|
+
readonly through: RelationThroughLike;
|
|
209
348
|
}
|
|
349
|
+
type RelationDefinitionLike = KeyedRelationDefinitionLike | ThroughRelationDefinitionLike;
|
|
210
350
|
type OnDeleteActionLike = "cascade" | "restrict" | "set null";
|
|
211
351
|
interface NestedWith {
|
|
212
352
|
limit?: number;
|
|
@@ -219,15 +359,13 @@ interface WithInput {
|
|
|
219
359
|
[relationName: string]: NestedWith | Record<string, true> | boolean | undefined;
|
|
220
360
|
_count?: Record<string, true>;
|
|
221
361
|
}
|
|
222
|
-
interface
|
|
223
|
-
|
|
224
|
-
relation: RelationDefinitionLike;
|
|
225
|
-
row: Record<string, unknown>;
|
|
226
|
-
tableName: string;
|
|
362
|
+
interface FanOutBudget {
|
|
363
|
+
remaining: number;
|
|
227
364
|
}
|
|
228
365
|
interface ResolveWithOptions {
|
|
366
|
+
fanOutBudget?: FanOutBudget;
|
|
229
367
|
fetcher: (tableName: string, args: QueryArgs) => Promise<QueryPage>;
|
|
230
|
-
groupedCounter: (tableName: string, whereField: string, values: unknown[], policyWhere?: WhereInput) => Promise<Map<unknown, number>>;
|
|
368
|
+
groupedCounter: (tableName: string, whereField: string, values: unknown[], policyWhere?: WhereInput, relationBaseWhere?: (table: string) => undefined | WhereInput) => Promise<Map<unknown, number>>;
|
|
231
369
|
parents: Record<string, unknown>[];
|
|
232
370
|
relationBaseWhere?: (table: string) => undefined | WhereInput;
|
|
233
371
|
relationMask?: RelationMask;
|
|
@@ -243,12 +381,19 @@ interface ResolveWithResult {
|
|
|
243
381
|
rows: Record<string, unknown>[];
|
|
244
382
|
}
|
|
245
383
|
type SortDirection = "asc" | "desc";
|
|
246
|
-
type
|
|
384
|
+
type NullPlacement = "first" | "last";
|
|
385
|
+
type OrderByInput = Record<string, SortDirection | {
|
|
386
|
+
nulls: NullPlacement;
|
|
387
|
+
sort: SortDirection;
|
|
388
|
+
}>;
|
|
247
389
|
interface QueryArgs {
|
|
248
390
|
baseWhere?: WhereInput;
|
|
391
|
+
consistency?: "primary";
|
|
249
392
|
cursor?: null | string;
|
|
393
|
+
endCursor?: null | string;
|
|
250
394
|
includeDeleted?: boolean;
|
|
251
395
|
limit?: number;
|
|
396
|
+
omitContinueCursor?: boolean;
|
|
252
397
|
orderBy?: OrderByInput[];
|
|
253
398
|
relationBaseWhere?: (table: string) => undefined | WhereInput;
|
|
254
399
|
relationMask?: RelationMask;
|
|
@@ -263,16 +408,65 @@ interface CrossShardReadArgs {
|
|
|
263
408
|
where?: WhereInput;
|
|
264
409
|
with?: WithInput;
|
|
265
410
|
}
|
|
411
|
+
interface CrossShardCountArgs {
|
|
412
|
+
relationPolicies?: Record<string, WhereInput>;
|
|
413
|
+
where?: WhereInput;
|
|
414
|
+
}
|
|
266
415
|
type RelationMask = (table: string, rows: Record<string, unknown>[]) => Record<string, unknown>[];
|
|
416
|
+
interface QueryPlan {
|
|
417
|
+
params: unknown[];
|
|
418
|
+
plan: string[];
|
|
419
|
+
sql: string;
|
|
420
|
+
}
|
|
267
421
|
interface QueryPage {
|
|
268
422
|
continueCursor: null | string;
|
|
269
423
|
isDone: boolean;
|
|
270
424
|
page: Record<string, unknown>[];
|
|
271
425
|
splitCursor?: null | string;
|
|
426
|
+
splitRequired?: boolean;
|
|
427
|
+
}
|
|
428
|
+
interface RelationEdge {
|
|
429
|
+
readonly array: boolean;
|
|
430
|
+
readonly column: string;
|
|
431
|
+
readonly name: string;
|
|
432
|
+
readonly sourceTable: string;
|
|
433
|
+
readonly targetTable: string;
|
|
434
|
+
}
|
|
435
|
+
interface RelatedStartReference {
|
|
436
|
+
id: string;
|
|
437
|
+
table: string;
|
|
438
|
+
}
|
|
439
|
+
type RelatedStart = (Record<string, unknown> & {
|
|
440
|
+
_id: string;
|
|
441
|
+
}) | RelatedStartReference;
|
|
442
|
+
type RelatedDirection = "both" | "in" | "out";
|
|
443
|
+
interface RelatedOptions {
|
|
444
|
+
cursor?: null | string;
|
|
445
|
+
depth?: number;
|
|
446
|
+
direction?: RelatedDirection;
|
|
447
|
+
edges?: ReadonlyArray<string>;
|
|
448
|
+
limit?: number;
|
|
449
|
+
relationBaseWhere?: (table: string) => undefined | WhereInput;
|
|
450
|
+
relationMask?: RelationMask;
|
|
451
|
+
}
|
|
452
|
+
interface RelatedNode {
|
|
453
|
+
depth: number;
|
|
454
|
+
document: Record<string, unknown>;
|
|
455
|
+
path: ReadonlyArray<string>;
|
|
456
|
+
pathIds: ReadonlyArray<string>;
|
|
457
|
+
score: number;
|
|
458
|
+
table: string;
|
|
459
|
+
}
|
|
460
|
+
interface RelatedPage {
|
|
461
|
+
continueCursor: null | string;
|
|
462
|
+
isDone: boolean;
|
|
463
|
+
nodes: RelatedNode[];
|
|
272
464
|
}
|
|
273
465
|
interface OrderKey {
|
|
274
466
|
direction: SortDirection;
|
|
275
467
|
field: string;
|
|
468
|
+
nullable: boolean;
|
|
469
|
+
nulls?: NullPlacement;
|
|
276
470
|
}
|
|
277
471
|
interface RestrictableQueryOptions {
|
|
278
472
|
baseWhere?: WhereInput;
|
|
@@ -401,17 +595,15 @@ interface IndexRangeBuilderLike {
|
|
|
401
595
|
lte: (field: string, value: unknown) => IndexRangeBuilderLike;
|
|
402
596
|
}
|
|
403
597
|
type BroadcastDelta = (delta: MutationDelta) => void;
|
|
404
|
-
type ReadHook = (table: string, idOrScan?: string) => void;
|
|
598
|
+
type ReadHook = (table: string, idOrScan?: string, exact?: boolean) => void;
|
|
405
599
|
interface LifecycleEvent {
|
|
406
600
|
connectionId: string;
|
|
407
601
|
context?: Record<string, unknown>;
|
|
408
602
|
shardKey: string;
|
|
409
603
|
userId: string | null;
|
|
410
604
|
}
|
|
411
|
-
interface LifecycleDispatchInfo {
|
|
605
|
+
interface LifecycleDispatchInfo extends SubscriptionIdentity {
|
|
412
606
|
event: LifecycleEvent;
|
|
413
|
-
identity: Record<string, unknown> | undefined;
|
|
414
|
-
userId: string | undefined;
|
|
415
607
|
}
|
|
416
608
|
interface MutationDelta {
|
|
417
609
|
indexKeys?: ReadonlyArray<IndexKeyEntry>;
|
|
@@ -423,9 +615,18 @@ interface MutationDelta {
|
|
|
423
615
|
interface DatabaseWriterLike {
|
|
424
616
|
aggregate: (tableName: string, options: AggregateOptions) => Promise<AggregateResult>;
|
|
425
617
|
asId?: (tableName: string, id: string) => string;
|
|
618
|
+
assertPatchAllowed?: (table: string, id: string) => Promise<void>;
|
|
619
|
+
cdcChangedTables?: (sinceSeq: number, options?: {
|
|
620
|
+
cursorOnly?: boolean;
|
|
621
|
+
}) => Promise<{
|
|
622
|
+
cursor: number;
|
|
623
|
+
floor?: number;
|
|
624
|
+
tables: string[];
|
|
625
|
+
} | undefined>;
|
|
426
626
|
count: (tableName: string, where?: RestrictableQueryOptions | WhereInput) => Promise<number>;
|
|
427
|
-
delete: (
|
|
627
|
+
delete: (table: string, id: string, options?: {
|
|
428
628
|
hard?: boolean;
|
|
629
|
+
skipOnDelete?: boolean;
|
|
429
630
|
}) => Promise<void>;
|
|
430
631
|
deleteAll?: (tableName: string, options?: {
|
|
431
632
|
chunkSize?: number;
|
|
@@ -433,20 +634,22 @@ interface DatabaseWriterLike {
|
|
|
433
634
|
}) => Promise<{
|
|
434
635
|
deleted: number;
|
|
435
636
|
}>;
|
|
436
|
-
deleteMany?: (ids: ReadonlyArray<string>, options?: {
|
|
637
|
+
deleteMany?: (table: string, ids: ReadonlyArray<string>, options?: {
|
|
437
638
|
limit?: number;
|
|
438
|
-
}
|
|
639
|
+
}) => Promise<{
|
|
439
640
|
deleted: number;
|
|
440
641
|
}>;
|
|
642
|
+
deleteRereadTables?: ReadonlySet<string>;
|
|
441
643
|
deleteWhere?: (tableName: string, where: WhereInput, options?: {
|
|
442
644
|
limit?: number;
|
|
443
645
|
}) => Promise<{
|
|
444
646
|
deleted: number;
|
|
445
647
|
}>;
|
|
648
|
+
explain: (tableName: string, args?: QueryArgs) => Promise<QueryPlan>;
|
|
446
649
|
findFirst: (tableName: string, args?: QueryArgs) => Promise<Record<string, unknown> | null>;
|
|
447
650
|
findFirstOrThrow: (tableName: string, args?: QueryArgs) => Promise<Record<string, unknown>>;
|
|
448
651
|
findMany: (tableName: string, args?: QueryArgs) => Promise<QueryPage>;
|
|
449
|
-
get: (
|
|
652
|
+
get: (table: string, id: string) => Promise<Record<string, unknown> | null>;
|
|
450
653
|
groupBy: (tableName: string, options: GroupByOptions) => Promise<ReadonlyArray<GroupByEntry>>;
|
|
451
654
|
insert: (tableName: string, document: Record<string, unknown>, options?: {
|
|
452
655
|
allowExplicitId?: boolean;
|
|
@@ -460,18 +663,27 @@ interface DatabaseWriterLike {
|
|
|
460
663
|
allowExplicitId?: boolean;
|
|
461
664
|
limit?: number;
|
|
462
665
|
}) => Promise<string[]>;
|
|
666
|
+
inTransaction?: () => boolean;
|
|
463
667
|
lookupById?: (id: string, expectedTable?: string) => Promise<null | {
|
|
464
668
|
row: Record<string, unknown>;
|
|
465
669
|
tableName: string;
|
|
466
670
|
}>;
|
|
467
671
|
normalizeId: (tableName: string, id: string) => null | string;
|
|
468
|
-
patch: (id: string, patch: Record<string, unknown>,
|
|
469
|
-
|
|
672
|
+
patch: (table: string, id: string, patch: Record<string, unknown>, options?: PatchWriteOptions) => Promise<void>;
|
|
673
|
+
patchIf?: (tableName: string, id: string, args: {
|
|
674
|
+
patch: Record<string, unknown>;
|
|
675
|
+
verify?: PatchVerifier;
|
|
676
|
+
where: WhereInput;
|
|
677
|
+
}) => Promise<{
|
|
678
|
+
applied: boolean;
|
|
679
|
+
doc: Record<string, unknown> | null;
|
|
680
|
+
}>;
|
|
681
|
+
patchMany?: (table: string, patches: ReadonlyArray<{
|
|
470
682
|
id: string;
|
|
471
683
|
patch: Record<string, unknown>;
|
|
472
684
|
}>, options?: {
|
|
473
685
|
limit?: number;
|
|
474
|
-
}
|
|
686
|
+
}) => Promise<{
|
|
475
687
|
patched: number;
|
|
476
688
|
}>;
|
|
477
689
|
patchWhere?: (tableName: string, args: {
|
|
@@ -487,10 +699,14 @@ interface DatabaseWriterLike {
|
|
|
487
699
|
rankBefore?: (tableName: string, indexName: string, options: RankBeforeOptions) => Promise<RankBeforeResult>;
|
|
488
700
|
rankPage: (tableName: string, indexName: string, options?: RankPageOptions) => Promise<RankPage>;
|
|
489
701
|
rankPageRows?: (tableName: string, indexName: string, options?: RankPageOptions) => Promise<ShardRankPageResult>;
|
|
490
|
-
|
|
702
|
+
related?: (start: RelatedStart, options?: RelatedOptions) => Promise<RelatedPage>;
|
|
703
|
+
relationEdges?: ReadonlyArray<RelationEdge>;
|
|
704
|
+
relationWrites?: RelationWriteMap;
|
|
705
|
+
replace: (table: string, id: string, document: Record<string, unknown>, options?: {
|
|
491
706
|
allowExplicitId?: boolean;
|
|
492
707
|
}) => Promise<void>;
|
|
493
|
-
restore?: (
|
|
708
|
+
restore?: (table: string, id: string) => Promise<void>;
|
|
709
|
+
softDeleteFields?: ReadonlyMap<string, string>;
|
|
494
710
|
system?: SystemDatabaseReader;
|
|
495
711
|
wipeShard?: (options?: {
|
|
496
712
|
chunkSize?: number;
|
|
@@ -515,66 +731,52 @@ interface ExportShardArgs {
|
|
|
515
731
|
batchSize?: number;
|
|
516
732
|
tables?: ReadonlyArray<string>;
|
|
517
733
|
}
|
|
734
|
+
type ImportConflictMode = "replace" | "skip";
|
|
735
|
+
interface ImportRow extends ExportRow {
|
|
736
|
+
op?: string;
|
|
737
|
+
}
|
|
518
738
|
interface ImportShardArgs {
|
|
519
|
-
|
|
739
|
+
deletes?: boolean;
|
|
740
|
+
dryRun?: boolean;
|
|
741
|
+
keepIds?: ReadonlySet<string>;
|
|
742
|
+
onConflict?: ImportConflictMode;
|
|
743
|
+
replaceTables?: ReadonlyArray<string>;
|
|
744
|
+
rows: ReadonlyArray<ImportRow>;
|
|
520
745
|
startLine?: number;
|
|
521
746
|
}
|
|
522
747
|
interface ImportShardResult {
|
|
523
748
|
conflicts: number;
|
|
749
|
+
deleted: number;
|
|
524
750
|
errors: ImportError[];
|
|
525
751
|
inserted: Record<string, number>;
|
|
752
|
+
pruned?: Record<string, number>;
|
|
753
|
+
replaced: number;
|
|
526
754
|
}
|
|
527
755
|
declare const selectExportTables: (schema: SchemaLike, requested?: ReadonlyArray<string>) => string[];
|
|
528
|
-
declare const exportShardTable: (writer: DatabaseWriterLike, table: string, batchSize?: number) => AsyncGenerator<ExportRow, void, undefined>;
|
|
529
756
|
declare const exportShardRows: (writer: DatabaseWriterLike, schema: SchemaLike, args: ExportShardArgs) => AsyncGenerator<ExportRow, void, undefined>;
|
|
530
757
|
declare const validateImportRow: (schema: SchemaLike, table: string, record: Record<string, unknown>) => string | undefined;
|
|
758
|
+
declare const replaceRefusal: (scope: ReadonlySet<string>, row: ExportRow) => string | undefined;
|
|
531
759
|
declare const importShardRows: (writer: DatabaseWriterLike, schema: SchemaLike, args: ImportShardArgs) => Promise<ImportShardResult>;
|
|
532
760
|
interface ExportShardAdminArgs {
|
|
533
761
|
batchSize?: number;
|
|
534
762
|
tables?: ReadonlyArray<string>;
|
|
535
763
|
}
|
|
536
764
|
interface ImportShardAdminArgs {
|
|
537
|
-
|
|
765
|
+
deletes: boolean;
|
|
766
|
+
dryRun: boolean;
|
|
767
|
+
onConflict: ImportConflictMode;
|
|
768
|
+
rows: ReadonlyArray<ImportRow>;
|
|
538
769
|
startLine?: number;
|
|
539
770
|
}
|
|
540
771
|
declare const parseExportShardArgs: (args: Record<string, unknown>) => ExportShardAdminArgs;
|
|
541
772
|
declare const parseImportShardArgs: (args: Record<string, unknown>) => ImportShardAdminArgs;
|
|
542
|
-
declare const
|
|
543
|
-
|
|
544
|
-
declare const
|
|
545
|
-
declare
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
declare const coerceAggregateNumber: (value: unknown) => number | undefined;
|
|
549
|
-
interface AggregateTally {
|
|
550
|
-
count: number;
|
|
551
|
-
value: null | number;
|
|
552
|
-
}
|
|
553
|
-
declare const foldAggregateTally: (tallies: Map<string, AggregateTally>, encoded: string, index: AggregateIndexDefinitionLike, record: Record<string, unknown>) => void;
|
|
554
|
-
declare const readAggregateValue: (op: string, row: {
|
|
555
|
-
count: number;
|
|
556
|
-
value: null | number;
|
|
557
|
-
} | undefined) => null | number;
|
|
558
|
-
declare const encodeAggregateKey: (by: ReadonlyArray<string>, source: Record<string, unknown>) => string;
|
|
559
|
-
declare class CountRlsUnsupportedError extends LunoraError {
|
|
560
|
-
constructor(table?: string);
|
|
773
|
+
declare const ADMIN_TOKEN_SCOPES: readonly ["migrations"];
|
|
774
|
+
type AdminTokenScope = (typeof ADMIN_TOKEN_SCOPES)[number];
|
|
775
|
+
declare const clearCompanionSignatures: (sql: SqlExec) => void;
|
|
776
|
+
declare class CompanionMemo {
|
|
777
|
+
readonly verified: Set<string>;
|
|
778
|
+
invalidate(): void;
|
|
561
779
|
}
|
|
562
|
-
declare const mergeWhere: (left: undefined | WhereInput, right: undefined | WhereInput) => undefined | WhereInput;
|
|
563
|
-
declare const planAggregateLookup: (index: AggregateIndexDefinitionLike, requestedWhere: Record<string, unknown> | undefined) => Record<string, unknown> | undefined;
|
|
564
|
-
declare const selectIndexForCount: (indexes: ReadonlyArray<AggregateIndexDefinitionLike>, requestedWhere: Record<string, unknown> | undefined) => undefined | {
|
|
565
|
-
index: AggregateIndexDefinitionLike;
|
|
566
|
-
key: Record<string, unknown>;
|
|
567
|
-
};
|
|
568
|
-
declare const selectIndexForAggregate: (indexes: ReadonlyArray<AggregateIndexDefinitionLike>, op: AggregateOp, field: string, requestedWhere: Record<string, unknown> | undefined) => undefined | {
|
|
569
|
-
index: AggregateIndexDefinitionLike;
|
|
570
|
-
key: Record<string, unknown>;
|
|
571
|
-
};
|
|
572
|
-
declare const selectIndexForGroupBy: (indexes: ReadonlyArray<AggregateIndexDefinitionLike>, op: AggregateOp, field: string | undefined, by: ReadonlyArray<string>, requestedWhere: Record<string, unknown> | undefined) => undefined | {
|
|
573
|
-
index: AggregateIndexDefinitionLike;
|
|
574
|
-
partial: Record<string, unknown>;
|
|
575
|
-
};
|
|
576
|
-
declare const stableStringify: (value: unknown) => string;
|
|
577
|
-
declare const stableWireKey: (value: unknown) => string;
|
|
578
780
|
interface CacheEntry {
|
|
579
781
|
bytes: number;
|
|
580
782
|
deps: Set<string>;
|
|
@@ -600,6 +802,7 @@ declare class ReactiveCache {
|
|
|
600
802
|
private readonly maxBytes;
|
|
601
803
|
private readonly now;
|
|
602
804
|
private monotonic;
|
|
805
|
+
private generation;
|
|
603
806
|
constructor(options?: ReactiveCacheOptions);
|
|
604
807
|
run<R>(key: string, deps: Set<string>, run: () => Promise<R>, ranges?: () => ReadonlyArray<KeyRange>): Promise<R>;
|
|
605
808
|
invalidate(table: string, id: string, indexKeys?: ReadonlyArray<IndexKeyEntry>): string[];
|
|
@@ -627,28 +830,45 @@ declare class ReactiveCache {
|
|
|
627
830
|
}
|
|
628
831
|
declare const reactiveCacheKey: (functionPath: string, args: Record<string, unknown>, identity: null | string) => string;
|
|
629
832
|
interface TransactionLimits {
|
|
833
|
+
maxReadBytes: number;
|
|
630
834
|
maxReadRows: number;
|
|
631
835
|
maxWrittenBytes: number;
|
|
632
836
|
maxWrittenRows: number;
|
|
633
837
|
}
|
|
634
838
|
interface TransactionHeadroom {
|
|
839
|
+
readBytes: number;
|
|
635
840
|
readRows: number;
|
|
841
|
+
remainingReadBytes: number;
|
|
636
842
|
remainingReadRows: number;
|
|
637
843
|
remainingWrittenBytes: number;
|
|
638
844
|
remainingWrittenRows: number;
|
|
639
845
|
writtenBytes: number;
|
|
640
846
|
writtenRows: number;
|
|
641
847
|
}
|
|
848
|
+
type TransactionLimitKind = "readBytes" | "readRows" | "writtenBytes" | "writtenRows";
|
|
849
|
+
interface TransactionLimitWarning {
|
|
850
|
+
kind: TransactionLimitKind;
|
|
851
|
+
limit: number;
|
|
852
|
+
used: number;
|
|
853
|
+
}
|
|
642
854
|
declare const DEFAULT_TRANSACTION_LIMITS: TransactionLimits;
|
|
643
855
|
declare class TransactionHeadroomTracker {
|
|
856
|
+
private readBytes;
|
|
644
857
|
private readRows;
|
|
645
858
|
private writtenRows;
|
|
646
859
|
private writtenBytes;
|
|
647
860
|
private readonly limits;
|
|
648
|
-
|
|
861
|
+
private readonly onNearLimit;
|
|
862
|
+
private readonly warned;
|
|
863
|
+
private readonly chargedDocuments;
|
|
864
|
+
constructor(limits?: Partial<TransactionLimits>, onNearLimit?: (warning: TransactionLimitWarning) => void);
|
|
649
865
|
recordRead(count: number): void;
|
|
866
|
+
recordReadBytes(bytes: number): void;
|
|
867
|
+
recordDocumentRead(key: string, bytes: number): void;
|
|
868
|
+
beginReadWindow(): void;
|
|
650
869
|
recordWrite(row: unknown): void;
|
|
651
870
|
headroom(): TransactionHeadroom;
|
|
871
|
+
private check;
|
|
652
872
|
}
|
|
653
873
|
interface RunTriggersOptions {
|
|
654
874
|
ctx: TriggerContextLike;
|
|
@@ -660,12 +880,18 @@ interface RunTriggersOptions {
|
|
|
660
880
|
}
|
|
661
881
|
declare const runTriggers: (options: RunTriggersOptions) => Promise<void>;
|
|
662
882
|
declare const hasTrigger: (schema: SchemaLike, tableName: string, op: TriggerOpLike) => boolean;
|
|
883
|
+
interface SearchBackfillProgress {
|
|
884
|
+
done: boolean;
|
|
885
|
+
pages: number;
|
|
886
|
+
}
|
|
663
887
|
declare const backfillAggregateIndexes: (sql: SqlExec, schema: SchemaLike) => void;
|
|
664
888
|
declare const backfillRankIndexes: (sql: SqlExec, schema: SchemaLike) => void;
|
|
665
889
|
declare const backfillSearchIndexesForTable: (sql: SqlExec, tableName: string, definition: {
|
|
666
890
|
searchIndexes?: ReadonlyArray<SearchIndexDefinitionLike>;
|
|
667
891
|
}) => void;
|
|
668
|
-
declare const backfillSearchIndexes: (sql: SqlExec, schema: SchemaLike
|
|
892
|
+
declare const backfillSearchIndexes: (sql: SqlExec, schema: SchemaLike, options?: {
|
|
893
|
+
maxPages?: number;
|
|
894
|
+
}) => SearchBackfillProgress;
|
|
669
895
|
declare const CDC_LOG_TABLE = "__cdc_log";
|
|
670
896
|
interface CdcChange {
|
|
671
897
|
doc?: Record<string, unknown>;
|
|
@@ -675,19 +901,35 @@ interface CdcChange {
|
|
|
675
901
|
table: string;
|
|
676
902
|
ts: number;
|
|
677
903
|
}
|
|
678
|
-
declare const
|
|
904
|
+
declare const CDC_LOG_TABLE_SEQ_INDEX = "__cdc_log_table_seq";
|
|
905
|
+
declare const migrateCdcLog: (sql: SqlExec, options?: {
|
|
906
|
+
rowHistoryIndex?: boolean;
|
|
907
|
+
}) => void;
|
|
679
908
|
declare const appendCdcChange: (sql: SqlExec, ts: number, table: string, id: string, op: CdcChange["op"], doc: Record<string, unknown> | undefined) => void;
|
|
680
909
|
declare const readCdcChanges: (sql: SqlExec, options?: {
|
|
681
910
|
limit?: number;
|
|
682
911
|
sinceSeq?: number;
|
|
683
|
-
tables?: ReadonlySet<string>;
|
|
684
912
|
}) => {
|
|
685
913
|
changes: CdcChange[];
|
|
686
914
|
cursor: number;
|
|
687
915
|
};
|
|
688
|
-
declare const
|
|
916
|
+
declare const cdcTouchesTables: (sql: SqlExec, sinceSeq: number, tables: ReadonlySet<string>) => boolean;
|
|
917
|
+
declare const cdcCanVouchFor: (sql: SqlExec, deps: ReadonlySet<string>) => boolean;
|
|
918
|
+
interface CdcChangeKey {
|
|
919
|
+
id: string;
|
|
920
|
+
op: CdcChange["op"];
|
|
921
|
+
seq: number;
|
|
922
|
+
}
|
|
923
|
+
declare const readCdcChangeKeys: (sql: SqlExec, table: string, sinceSeq: number, upTo: number) => CdcChangeKey[];
|
|
924
|
+
declare const trimCdcChanges: (sql: SqlExec, throughSeq: number, maxRows: number) => void;
|
|
925
|
+
declare const compactCdcDocs: (sql: SqlExec, throughSeq: number, maxRows: number) => void;
|
|
926
|
+
declare const cdcSeqLeavingRows: (sql: SqlExec, keep: number) => number | undefined;
|
|
689
927
|
declare const readCdcCursor: (sql: SqlExec) => number;
|
|
928
|
+
declare const cursorBelowRetainedFloor: (floor: number | undefined, sinceSeq: number) => boolean;
|
|
929
|
+
declare const cdcTrimmedError: (floor: number, sinceSeq: number, scope: "global" | "shard") => LunoraError;
|
|
930
|
+
declare const cdcForkedError: (cursor: number, sinceSeq: number, scope: "global" | "shard", epoch?: string) => LunoraError;
|
|
690
931
|
declare const minCdcSeq: (sql: SqlExec) => number | undefined;
|
|
932
|
+
declare const minCdcReplayableSeq: (sql: SqlExec) => number | undefined;
|
|
691
933
|
declare const CDC_META_TABLE = "__cdc_meta";
|
|
692
934
|
declare const migrateCdcMeta: (sql: SqlExec) => void;
|
|
693
935
|
declare const readCdcEpoch: (sql: SqlExec) => string;
|
|
@@ -697,12 +939,6 @@ declare const CLIENT_WATERMARK_TABLE = "__client_watermark";
|
|
|
697
939
|
declare const migrateClientWatermark: (sql: SqlExec) => void;
|
|
698
940
|
declare const readClientWatermark: (sql: SqlExec, identity: string, clientId: string) => number;
|
|
699
941
|
declare const advanceClientWatermark: (sql: SqlExec, identity: string, clientId: string, mutationId: number) => void;
|
|
700
|
-
declare const GLOBAL_SHAPE_SNAPSHOT_TABLE = "__global_shape_snapshot";
|
|
701
|
-
declare const migrateGlobalShapeSnapshot: (sql: SqlExec) => void;
|
|
702
|
-
declare const readGlobalShapeSnapshot: (sql: SqlExec, connectionId: string, subId: string) => Map<string, string>;
|
|
703
|
-
declare const writeGlobalShapeSnapshot: (sql: SqlExec, connectionId: string, subId: string, snapshot: Map<string, string>) => void;
|
|
704
|
-
declare const deleteGlobalShapeSnapshot: (sql: SqlExec, connectionId: string, subId: string) => void;
|
|
705
|
-
declare const deleteGlobalShapeSnapshotsForConnection: (sql: SqlExec, connectionId: string) => void;
|
|
706
942
|
declare const IDEMPOTENCY_TABLE = "__idempotency";
|
|
707
943
|
interface IdempotentRecord {
|
|
708
944
|
resultJson: string;
|
|
@@ -714,61 +950,32 @@ declare const writeIdempotent: (sql: SqlExec, identity: string, mutationId: stri
|
|
|
714
950
|
declare const trimIdempotent: (sql: SqlExec, olderThanTs: number) => void;
|
|
715
951
|
declare const runShardMigrations: (sql: SqlExec, schema: SchemaLike, options?: {
|
|
716
952
|
cdc?: boolean;
|
|
953
|
+
deferBlockedUniqueIndexes?: boolean;
|
|
717
954
|
schemaSnapshot?: {
|
|
718
955
|
hash: string;
|
|
719
956
|
json: string;
|
|
720
957
|
};
|
|
721
|
-
}) =>
|
|
722
|
-
/**
|
|
723
|
-
* How far a search companion's backfill has progressed, and what the next pass
|
|
724
|
-
* should do about it.
|
|
725
|
-
*
|
|
726
|
-
* Neither stored analysis nor query policy, which is why it is its own module
|
|
727
|
-
* rather than a third responsibility bolted onto one of them: it is *progress*,
|
|
728
|
-
* the one piece of search state that is written as the index is built rather
|
|
729
|
-
* than decided when it is read.
|
|
730
|
-
*
|
|
731
|
-
* The policy below is shared because when each engine owned a copy they
|
|
732
|
-
* immediately disagreed about exactly the two cases that matter — whether a row
|
|
733
|
-
* with no recorded profile may be resumed (it may not; nothing says what
|
|
734
|
-
* analyzed it) and whether a never-started index is worth wiping (it is not;
|
|
735
|
-
* there is nothing in it).
|
|
736
|
-
*/
|
|
737
|
-
/**
|
|
738
|
-
* How far a companion's backfill has progressed, and under which analysis.
|
|
739
|
-
* Declared here rather than beside either engine's state table: both record the
|
|
740
|
-
* same three facts, and the decisions made from them are the shared policy
|
|
741
|
-
* below.
|
|
742
|
-
*/
|
|
743
|
-
interface SearchBackfillState {
|
|
744
|
-
/** Last `id` indexed, or `undefined` when no page has run yet. */
|
|
745
|
-
cursor: string | undefined;
|
|
746
|
-
/** True once a page came back short — the table is fully indexed. */
|
|
747
|
-
done: boolean;
|
|
748
|
-
/** Analyzer profile the stored rows were built with; `undefined` predates profile tracking. */
|
|
749
|
-
profile: string | undefined;
|
|
750
|
-
}
|
|
751
|
-
declare const SEARCH_STATE_TABLE = "__lunora_search_state";
|
|
752
|
-
declare const migrateSearchState: (sql: SqlExec) => void;
|
|
753
|
-
declare const readSearchBackfillState: (sql: SqlExec, companion: string) => SearchBackfillState;
|
|
754
|
-
declare const writeSearchBackfillState: (sql: SqlExec, companion: string, cursor: string | undefined, done: boolean, profile: string) => void;
|
|
958
|
+
}) => ReadonlyArray<string>;
|
|
755
959
|
interface ShapeRow {
|
|
756
960
|
doc: Record<string, unknown>;
|
|
757
961
|
id: string;
|
|
758
962
|
}
|
|
759
963
|
declare const selectShapeRows: (sql: SqlExec, table: string, effectiveWhere: WhereInput | undefined) => ShapeRow[];
|
|
760
|
-
declare const
|
|
964
|
+
declare const selectShapeMembers: (sql: SqlExec, table: string, effectiveWhere: WhereInput | undefined, ids: ReadonlyArray<string>) => Map<string, Record<string, unknown>>;
|
|
761
965
|
interface SqlExec {
|
|
762
966
|
exec: <Row = Record<string, unknown>>(sql: string, ...params: unknown[]) => SqlCursor<Row>;
|
|
763
967
|
}
|
|
764
968
|
interface SqlCursor<Row> extends Iterable<Row> {
|
|
969
|
+
readonly columnNames?: string[];
|
|
765
970
|
one: () => Row;
|
|
971
|
+
raw?: () => IterableIterator<unknown[]>;
|
|
766
972
|
toArray: () => Row[];
|
|
767
973
|
}
|
|
768
974
|
type IndexUseHook = (table: string, indexName: string, kind: "geo" | "index" | "rank" | "search") => void;
|
|
769
975
|
type Clock = () => number;
|
|
770
976
|
type IdGenerator = () => string;
|
|
771
977
|
declare const assertValidClientId: (clientId: string) => void;
|
|
978
|
+
declare const assertStorableRowId: (id: string) => void;
|
|
772
979
|
interface WriteEvent {
|
|
773
980
|
doc?: Record<string, unknown>;
|
|
774
981
|
id: string;
|
|
@@ -778,18 +985,26 @@ interface WriteEvent {
|
|
|
778
985
|
type WriteHook = (event: WriteEvent) => Promise<void> | void;
|
|
779
986
|
interface CtxDbOptions {
|
|
780
987
|
auth?: ServerDefaultContextLike["auth"];
|
|
988
|
+
baselineSeq?: () => number | undefined;
|
|
781
989
|
broadcast?: BroadcastDelta;
|
|
782
990
|
cache?: ReactiveCache;
|
|
783
991
|
cdc?: boolean;
|
|
784
992
|
clock?: Clock;
|
|
993
|
+
companionMemo?: CompanionMemo;
|
|
785
994
|
enforceRls?: boolean;
|
|
786
995
|
globalDb?: DatabaseWriterLike;
|
|
787
996
|
headroom?: TransactionHeadroomTracker;
|
|
788
997
|
idGenerator?: IdGenerator;
|
|
998
|
+
inTransaction?: () => boolean;
|
|
789
999
|
maxRelationKeys?: number;
|
|
790
1000
|
onIndexUse?: IndexUseHook;
|
|
791
1001
|
onRead?: ReadHook;
|
|
792
1002
|
onReadRange?: (range: KeyRange) => void;
|
|
1003
|
+
onStalePatchDropped?: (event: {
|
|
1004
|
+
fields: string[];
|
|
1005
|
+
id: string;
|
|
1006
|
+
table: string;
|
|
1007
|
+
}) => void;
|
|
793
1008
|
onWrite?: WriteHook;
|
|
794
1009
|
relationExistsPushDown?: "always" | "auto" | "never";
|
|
795
1010
|
scheduler?: SchedulerLike;
|
|
@@ -802,7 +1017,66 @@ declare class NotUniqueError extends LunoraError {
|
|
|
802
1017
|
constructor(message?: string);
|
|
803
1018
|
}
|
|
804
1019
|
declare const normalizeIdStructurally: (schema: SchemaLike, tableName: string, id: string) => null | string;
|
|
1020
|
+
declare const assertNoExplicitUndefined: (op: "patch" | "patchIf" | "replace", document: Record<string, unknown>) => void;
|
|
1021
|
+
declare const stripReservedPatchFields: (patch: Record<string, unknown>) => Record<string, unknown>;
|
|
805
1022
|
declare const createShardCtxDb: (options: CtxDbOptions) => DatabaseWriterLike;
|
|
1023
|
+
declare const ADMIN_TOKEN_TABLE = "__lunora_admin_tokens__";
|
|
1024
|
+
interface AdminTokenSummary {
|
|
1025
|
+
createdAt: number;
|
|
1026
|
+
expiresAt?: number;
|
|
1027
|
+
lastUsedAt?: number;
|
|
1028
|
+
name: string;
|
|
1029
|
+
scopes: AdminTokenScope[];
|
|
1030
|
+
}
|
|
1031
|
+
declare const createAdminTokenRecord: (sql: SqlExec, record: {
|
|
1032
|
+
createdAt: number;
|
|
1033
|
+
digest: string;
|
|
1034
|
+
expiresAt?: number;
|
|
1035
|
+
name: string;
|
|
1036
|
+
scopes?: ReadonlyArray<AdminTokenScope>;
|
|
1037
|
+
}) => boolean;
|
|
1038
|
+
declare const listAdminTokens: (sql: SqlExec) => AdminTokenSummary[];
|
|
1039
|
+
declare const revokeAdminTokenRecord: (sql: SqlExec, name: string, createdAt: number) => boolean;
|
|
1040
|
+
declare const verifyAdminTokenDigest: (sql: SqlExec, name: string, digest: string, now: number) => undefined | {
|
|
1041
|
+
createdAt: number;
|
|
1042
|
+
expiresAt?: number;
|
|
1043
|
+
scopes: AdminTokenScope[];
|
|
1044
|
+
};
|
|
1045
|
+
declare const adminTokenExists: (sql: SqlExec, name: string) => boolean;
|
|
1046
|
+
declare const matchesStaticWhere: (document: Record<string, unknown>, predicate: Record<string, unknown>) => boolean;
|
|
1047
|
+
declare const normalizeCountArgument: (argument: RestrictableQueryOptions | undefined | WhereInput) => RestrictableQueryOptions;
|
|
1048
|
+
declare const AGGREGATE_SQL_FUNCTION: Record<string, string>;
|
|
1049
|
+
declare const aggregateSqlFunction: (op: string) => string;
|
|
1050
|
+
declare const throwingScheduler: SchedulerLike;
|
|
1051
|
+
declare const aggregateTableName: (table: string, indexName: string) => string;
|
|
1052
|
+
declare const coerceAggregateNumber: (value: unknown) => number | undefined;
|
|
1053
|
+
interface AggregateTally {
|
|
1054
|
+
count: number;
|
|
1055
|
+
value: null | number;
|
|
1056
|
+
}
|
|
1057
|
+
declare const foldAggregateTally: (tallies: Map<string, AggregateTally>, encoded: string, index: AggregateIndexDefinitionLike, record: Record<string, unknown>) => void;
|
|
1058
|
+
declare const readAggregateValue: (op: string, row: {
|
|
1059
|
+
count: number;
|
|
1060
|
+
value: null | number;
|
|
1061
|
+
} | undefined) => null | number;
|
|
1062
|
+
declare const encodeAggregateKey: (by: ReadonlyArray<string>, source: Record<string, unknown>) => string;
|
|
1063
|
+
declare class CountRlsUnsupportedError extends LunoraError {
|
|
1064
|
+
constructor(table?: string);
|
|
1065
|
+
}
|
|
1066
|
+
declare const mergeWhere: (left: undefined | WhereInput, right: undefined | WhereInput) => undefined | WhereInput;
|
|
1067
|
+
declare const planAggregateLookup: (index: AggregateIndexDefinitionLike, requestedWhere: Record<string, unknown> | undefined) => Record<string, unknown> | undefined;
|
|
1068
|
+
declare const selectIndexForCount: (indexes: ReadonlyArray<AggregateIndexDefinitionLike>, requestedWhere: Record<string, unknown> | undefined) => undefined | {
|
|
1069
|
+
index: AggregateIndexDefinitionLike;
|
|
1070
|
+
key: Record<string, unknown>;
|
|
1071
|
+
};
|
|
1072
|
+
declare const selectIndexForAggregate: (indexes: ReadonlyArray<AggregateIndexDefinitionLike>, op: AggregateOp, field: string, requestedWhere: Record<string, unknown> | undefined) => undefined | {
|
|
1073
|
+
index: AggregateIndexDefinitionLike;
|
|
1074
|
+
key: Record<string, unknown>;
|
|
1075
|
+
};
|
|
1076
|
+
declare const selectIndexForGroupBy: (indexes: ReadonlyArray<AggregateIndexDefinitionLike>, op: AggregateOp, field: string | undefined, by: ReadonlyArray<string>, requestedWhere: Record<string, unknown> | undefined) => undefined | {
|
|
1077
|
+
index: AggregateIndexDefinitionLike;
|
|
1078
|
+
partial: Record<string, unknown>;
|
|
1079
|
+
};
|
|
806
1080
|
declare const AUDIT_LOG_TABLE = "__lunora_audit__";
|
|
807
1081
|
interface AuditEntry {
|
|
808
1082
|
detail?: Record<string, unknown>;
|
|
@@ -825,68 +1099,23 @@ declare const readAuditLog: (sql: SqlExec, options?: {
|
|
|
825
1099
|
limit?: number;
|
|
826
1100
|
sinceSeq?: number;
|
|
827
1101
|
}) => AuditEntry[];
|
|
828
|
-
interface
|
|
829
|
-
|
|
830
|
-
|
|
831
|
-
|
|
832
|
-
|
|
833
|
-
|
|
834
|
-
|
|
835
|
-
|
|
836
|
-
|
|
837
|
-
|
|
838
|
-
|
|
839
|
-
|
|
840
|
-
|
|
841
|
-
|
|
842
|
-
|
|
843
|
-
|
|
844
|
-
|
|
845
|
-
id: string;
|
|
846
|
-
query?: SubscriptionQuery;
|
|
847
|
-
shape?: {
|
|
848
|
-
args?: Record<string, unknown>;
|
|
849
|
-
name: string;
|
|
850
|
-
};
|
|
851
|
-
sinceCheckpoint?: number;
|
|
852
|
-
sinceEpoch?: string;
|
|
853
|
-
topic?: string;
|
|
854
|
-
type: "ack" | "connect" | "shape_subscribe" | "shape_unsubscribe" | "stream" | "subscribe" | "unsubscribe" | "whisper" | "whisper_subscribe" | "whisper_unsubscribe";
|
|
855
|
-
}
|
|
856
|
-
interface RpcRequest {
|
|
857
|
-
args?: Record<string, unknown>;
|
|
858
|
-
functionPath: string;
|
|
859
|
-
}
|
|
860
|
-
interface SocketAttachment {
|
|
861
|
-
admin?: boolean;
|
|
862
|
-
clientId?: string;
|
|
863
|
-
connected?: boolean;
|
|
864
|
-
connectionId?: string;
|
|
865
|
-
context?: Record<string, unknown>;
|
|
866
|
-
expiresAt?: number;
|
|
867
|
-
identity?: Record<string, unknown>;
|
|
868
|
-
shapes?: Record<string, ShapeSubscriptionQuery>;
|
|
869
|
-
subs: Record<string, SubscriptionQuery>;
|
|
870
|
-
userId?: string;
|
|
871
|
-
whispers?: string[];
|
|
872
|
-
}
|
|
873
|
-
interface ResolvedShape {
|
|
874
|
-
columns?: ReadonlyArray<string>;
|
|
875
|
-
effectiveWhere?: WhereInput;
|
|
876
|
-
global?: boolean;
|
|
877
|
-
table: string;
|
|
878
|
-
}
|
|
879
|
-
interface SubscriptionIdentity {
|
|
880
|
-
identity?: Record<string, unknown>;
|
|
881
|
-
userId?: string;
|
|
882
|
-
}
|
|
883
|
-
interface ShardSocketLike {
|
|
884
|
-
readonly bufferedAmount?: number;
|
|
885
|
-
close?: (code?: number, reason?: string) => void;
|
|
886
|
-
deserializeAttachment?: () => unknown;
|
|
887
|
-
send: (data: string) => void;
|
|
888
|
-
serializeAttachment?: (value: unknown) => void;
|
|
889
|
-
}
|
|
1102
|
+
interface CdcArchiveScope {
|
|
1103
|
+
epoch: string;
|
|
1104
|
+
shard: string;
|
|
1105
|
+
}
|
|
1106
|
+
declare const readCdcArchivedThrough: (sql: SqlExec) => number;
|
|
1107
|
+
declare const writeCdcArchivedThrough: (sql: SqlExec, seq: number) => void;
|
|
1108
|
+
declare const archiveCdcSegment: (bucket: R2BucketLike, scope: CdcArchiveScope, changes: CdcChange[]) => Promise<void>;
|
|
1109
|
+
declare const cdcArchiveRewound: (bucket: R2BucketLike, scope: CdcArchiveScope, archivedThrough: number) => Promise<boolean>;
|
|
1110
|
+
declare const readArchivedCdcChanges: (bucket: R2BucketLike, scope: CdcArchiveScope, sinceSeq: number, limit: number | undefined) => Promise<{
|
|
1111
|
+
changes: CdcChange[];
|
|
1112
|
+
cursor: number;
|
|
1113
|
+
} | undefined>;
|
|
1114
|
+
declare const COMMIT_SEQ_TABLE = "__commit_seq";
|
|
1115
|
+
declare const COMMIT_SEQ_FIELD = "_commitSeq";
|
|
1116
|
+
declare const migrateCommitSeq: (sql: SqlExec) => void;
|
|
1117
|
+
declare const readCommitSeq: (sql: SqlExec) => number;
|
|
1118
|
+
declare const allocateCommitSeq: (sql: SqlExec) => number;
|
|
890
1119
|
interface CompanionSyncDeps {
|
|
891
1120
|
broadcast: (delta: MutationDelta) => void;
|
|
892
1121
|
indexKeysFor: (table: string, document?: Record<string, unknown>) => ReadonlyArray<{
|
|
@@ -897,6 +1126,7 @@ interface CompanionSyncDeps {
|
|
|
897
1126
|
recordCdc: (table: string, id: string, op: "delete" | "insert" | "update", doc?: Record<string, unknown>) => void;
|
|
898
1127
|
schema: SchemaLike;
|
|
899
1128
|
sql: SqlExec;
|
|
1129
|
+
verified?: Set<string>;
|
|
900
1130
|
}
|
|
901
1131
|
interface CompanionSync {
|
|
902
1132
|
ensureBackfilledForTable: (tableName: string) => void;
|
|
@@ -910,6 +1140,19 @@ interface CompanionSync {
|
|
|
910
1140
|
syncSearch: (tableName: string, id: string, document: Record<string, unknown> | undefined, previous?: Record<string, unknown>) => void;
|
|
911
1141
|
}
|
|
912
1142
|
declare const createCompanionSync: (deps: CompanionSyncDeps) => CompanionSync;
|
|
1143
|
+
declare const GLOBAL_SHAPE_SNAPSHOT_TABLE = "__global_shape_snapshot";
|
|
1144
|
+
declare const migrateGlobalShapeSnapshot: (sql: SqlExec) => void;
|
|
1145
|
+
declare const readGlobalShapeSnapshot: (sql: SqlExec, connectionId: string, subId: string) => Map<string, string> | undefined;
|
|
1146
|
+
declare const writeGlobalShapeSnapshot: (sql: SqlExec, connectionId: string, subId: string, snapshot: Map<string, string>) => void;
|
|
1147
|
+
declare const deleteGlobalShapeSnapshot: (sql: SqlExec, connectionId: string, subId: string) => void;
|
|
1148
|
+
declare const deleteGlobalShapeSnapshotsForConnection: (sql: SqlExec, connectionId: string) => void;
|
|
1149
|
+
declare const isMemoryTable: (definition: TableDefinitionLike | undefined) => boolean;
|
|
1150
|
+
declare const memoryTableNames: (schema: SchemaLike) => string[];
|
|
1151
|
+
declare const clearMemoryTables: (sql: SqlExec, schema: SchemaLike) => number;
|
|
1152
|
+
declare const resolveRankSeekTuple: (options: {
|
|
1153
|
+
after?: RankPageRowKey;
|
|
1154
|
+
cursor?: null | string;
|
|
1155
|
+
}) => unknown[] | undefined;
|
|
913
1156
|
interface RankPageDeps {
|
|
914
1157
|
assertRankPartitionLocal: (tableName: string, definition: TableDefinitionLike, index: RankIndexDefinitionLike) => void;
|
|
915
1158
|
ensureRankBackfilled: (tableName: string, index: RankIndexDefinitionLike) => void;
|
|
@@ -927,8 +1170,92 @@ interface RankPageComputation {
|
|
|
927
1170
|
key: RankPageRowKey;
|
|
928
1171
|
}[];
|
|
929
1172
|
}
|
|
930
|
-
declare const hydrateDocsById: (deps: RankPageDeps, tableName: string, ids: ReadonlyArray<string>) => Map<string, Record<string, unknown>>;
|
|
931
1173
|
declare const computeRankPage: (deps: RankPageDeps, tableName: string, indexName: string, rankPageOptions: RankPageOptions) => RankPageComputation;
|
|
1174
|
+
declare const SCHEDULE_OUTBOX_TABLE = "__schedule_outbox";
|
|
1175
|
+
interface ScheduleOutboxRow {
|
|
1176
|
+
attempts: number;
|
|
1177
|
+
envelopeJson: string;
|
|
1178
|
+
id: string;
|
|
1179
|
+
nextAttemptAt: number;
|
|
1180
|
+
}
|
|
1181
|
+
interface ScheduleOutboxEntry {
|
|
1182
|
+
attempts: number;
|
|
1183
|
+
createdAt: number;
|
|
1184
|
+
forever: boolean;
|
|
1185
|
+
id: string;
|
|
1186
|
+
nextAttemptAt: number;
|
|
1187
|
+
parked: boolean;
|
|
1188
|
+
target: string | undefined;
|
|
1189
|
+
when: number | undefined;
|
|
1190
|
+
}
|
|
1191
|
+
interface ScheduleOutboxEnvelope {
|
|
1192
|
+
args: unknown;
|
|
1193
|
+
options: Record<string, unknown> | undefined;
|
|
1194
|
+
target: unknown;
|
|
1195
|
+
when: number;
|
|
1196
|
+
}
|
|
1197
|
+
interface ScheduleOutbox {
|
|
1198
|
+
admit: (target: string) => number | undefined;
|
|
1199
|
+
forget: (id: string) => void;
|
|
1200
|
+
handOff?: (id: string, run: () => Promise<unknown>, token?: string) => Promise<void>;
|
|
1201
|
+
record: (id: string, envelope: ScheduleOutboxEnvelope) => string | undefined;
|
|
1202
|
+
wake: () => void;
|
|
1203
|
+
}
|
|
1204
|
+
declare const migrateScheduleOutbox: (sql: SqlExec) => void;
|
|
1205
|
+
declare const recordScheduleOutbox: (sql: SqlExec, id: string, envelopeJson: string, now: number) => void;
|
|
1206
|
+
declare const forgetScheduleOutbox: (sql: SqlExec, id: string) => void;
|
|
1207
|
+
declare const readDueScheduleOutbox: (sql: SqlExec, nowMs: number, limit: number) => ScheduleOutboxRow[];
|
|
1208
|
+
declare const readDueScheduleOutboxEntry: (sql: SqlExec, id: string, nowMs: number) => ScheduleOutboxRow | undefined;
|
|
1209
|
+
declare const deferScheduleOutbox: (sql: SqlExec, id: string, attempts: number, nextAttemptAt: number) => void;
|
|
1210
|
+
declare const parkScheduleOutbox: (sql: SqlExec, id: string, attempts: number, now: number) => void;
|
|
1211
|
+
declare const probeScheduleOutbox: (sql: SqlExec) => {
|
|
1212
|
+
dueAt: number | undefined;
|
|
1213
|
+
populated: boolean;
|
|
1214
|
+
};
|
|
1215
|
+
declare const trimScheduleOutbox: (sql: SqlExec, olderThanTs: number) => void;
|
|
1216
|
+
declare const readScheduleOutbox: (sql: SqlExec, limit: number, cursor?: string) => {
|
|
1217
|
+
entries: ScheduleOutboxEntry[];
|
|
1218
|
+
nextCursor: string | undefined;
|
|
1219
|
+
};
|
|
1220
|
+
declare const readScheduleOutboxState: (sql: SqlExec, id: string) => {
|
|
1221
|
+
createdAt: number;
|
|
1222
|
+
parked: boolean;
|
|
1223
|
+
version: string;
|
|
1224
|
+
} | undefined;
|
|
1225
|
+
declare const hasScheduleOutboxEntry: (sql: SqlExec, id: string) => boolean;
|
|
1226
|
+
declare const requeueScheduleOutbox: (sql: SqlExec, id: string, now: number) => boolean;
|
|
1227
|
+
declare const dropScheduleOutbox: (sql: SqlExec, id: string) => boolean;
|
|
1228
|
+
/**
|
|
1229
|
+
* How far a companion's backfill has progressed, and under which analysis.
|
|
1230
|
+
* Declared here rather than beside either engine's state table: both record the
|
|
1231
|
+
* same three facts, and the decisions made from them are the shared policy
|
|
1232
|
+
* below.
|
|
1233
|
+
*/
|
|
1234
|
+
interface BackfillState {
|
|
1235
|
+
/** Last `id` indexed, or `undefined` when no page has run yet. */
|
|
1236
|
+
cursor: string | undefined;
|
|
1237
|
+
/** True once a page came back short — the table is fully indexed. */
|
|
1238
|
+
done: boolean;
|
|
1239
|
+
/** Analyzer profile the stored rows were built with; `undefined` predates profile tracking. */
|
|
1240
|
+
profile: string | undefined;
|
|
1241
|
+
}
|
|
1242
|
+
declare const SEARCH_STATE_TABLE = "__lunora_search_state";
|
|
1243
|
+
declare const migrateSearchState: (sql: SqlExec) => void;
|
|
1244
|
+
declare const readSearchBackfillState: (sql: SqlExec, companion: string) => BackfillState;
|
|
1245
|
+
declare const writeSearchBackfillState: (sql: SqlExec, companion: string, cursor: string | undefined, done: boolean, profile: string) => void;
|
|
1246
|
+
declare const SHAPE_POKE_CURSOR_TABLE = "__shape_poke_cursor";
|
|
1247
|
+
declare const migrateShapePokeCursor: (sql: SqlExec) => void;
|
|
1248
|
+
declare const readShapePokeCursor: (sql: SqlExec, connectionId: string, subId: string) => number | undefined;
|
|
1249
|
+
declare const writeShapePokeCursor: (sql: SqlExec, connectionId: string, subId: string, cursor: number) => void;
|
|
1250
|
+
interface ShapePokeCursorRow {
|
|
1251
|
+
connectionId: string;
|
|
1252
|
+
cursor: number;
|
|
1253
|
+
subId: string;
|
|
1254
|
+
}
|
|
1255
|
+
declare const writeShapePokeCursors: (sql: SqlExec, rows: ReadonlyArray<ShapePokeCursorRow>) => void;
|
|
1256
|
+
declare const minShapePokeCursor: (sql: SqlExec) => number | undefined;
|
|
1257
|
+
declare const deleteShapePokeCursor: (sql: SqlExec, connectionId: string, subId: string) => void;
|
|
1258
|
+
declare const deleteShapePokeCursorsForConnection: (sql: SqlExec, connectionId: string) => void;
|
|
932
1259
|
declare const DATA_MIGRATION_STATE_TABLE = "__lunora_migrations";
|
|
933
1260
|
type MigrationDirection = "down" | "up";
|
|
934
1261
|
type MigrationStatus = "completed" | "failed" | "in_progress";
|
|
@@ -992,6 +1319,29 @@ interface DependencyTracker {
|
|
|
992
1319
|
declare const createDependencyTracker: () => DependencyTracker;
|
|
993
1320
|
declare const runSql: <Row = Record<string, unknown>>(sql: SqlExec, query: string, ...params: unknown[]) => SqlCursor<Row>;
|
|
994
1321
|
declare const runDrizzle: <Row = Record<string, unknown>>(exec: SqlExec, query: SQL) => SqlCursor<Row>;
|
|
1322
|
+
type RangeOperandType = "boolean" | "number" | "string";
|
|
1323
|
+
interface WhereFragments<T> {
|
|
1324
|
+
binary: (reference: T, comparator: string, value: unknown) => T;
|
|
1325
|
+
connect: (left: T, right: T, connector: "AND" | "OR") => T;
|
|
1326
|
+
constant: (value: boolean) => T;
|
|
1327
|
+
contains: (reference: T, term: T) => T;
|
|
1328
|
+
inList: (reference: T, items: ReadonlyArray<unknown>, negated: boolean, budget: number) => T;
|
|
1329
|
+
negate: (inner: T) => T;
|
|
1330
|
+
nullCheck: (reference: T, negated: boolean) => T;
|
|
1331
|
+
value: (value: unknown) => T;
|
|
1332
|
+
}
|
|
1333
|
+
type FieldRefSql<T> = (field: string) => T;
|
|
1334
|
+
type SerializeValue = (value: unknown, field: string) => unknown;
|
|
1335
|
+
interface WhereSqlStrategy<T = SQL> {
|
|
1336
|
+
containsExpr?: (reference: T, term: T) => T;
|
|
1337
|
+
fieldRef: FieldRefSql<T>;
|
|
1338
|
+
inList?: (reference: T, items: ReadonlyArray<unknown>, negated: boolean, budget?: number) => T;
|
|
1339
|
+
rangeTypeGuard: (field: string, type: RangeOperandType) => T;
|
|
1340
|
+
relationExists?: (request: unknown) => T;
|
|
1341
|
+
serialize: SerializeValue;
|
|
1342
|
+
}
|
|
1343
|
+
declare const serverInList: (engine: "mysql" | "postgres") => (reference: SQL, items: ReadonlyArray<unknown>, negated: boolean, budget?: number) => SQL;
|
|
1344
|
+
declare const compileWhereSql: <T = SQL>(where: WhereInput | undefined, strategy: WhereSqlStrategy<T>, fragments?: WhereFragments<T>, reservedParams?: number) => T | undefined;
|
|
995
1345
|
declare const quoteIdentifier: (name: string) => string;
|
|
996
1346
|
declare const serializeSqlValue: (value: unknown) => unknown;
|
|
997
1347
|
declare const DOC_COLUMN = "__doc__";
|
|
@@ -1005,10 +1355,16 @@ declare const AGG_KEY: Name;
|
|
|
1005
1355
|
declare const AGG_VALUE: Name;
|
|
1006
1356
|
declare const AGG_COUNT: Name;
|
|
1007
1357
|
declare const aggUpsertSql: (aggTable: string, key: unknown, value: unknown, count: unknown, set: SQL) => SQL;
|
|
1008
|
-
declare const tableColumns: (definition: TableDefinitionLike) => [string, ColumnMetaLike]
|
|
1358
|
+
declare const tableColumns: (definition: TableDefinitionLike) => ReadonlyArray<readonly [string, ColumnMetaLike]>;
|
|
1009
1359
|
declare const rowToDocument: (row: Record<string, unknown> | undefined) => Record<string, unknown> | undefined;
|
|
1010
1360
|
declare const tryRowToDocument: (row: Record<string, unknown> | undefined) => Record<string, unknown> | undefined;
|
|
1011
|
-
declare const isFtsAvailable: (
|
|
1361
|
+
declare const isFtsAvailable: (wrapper: SqlExec, existingFtsTable?: string) => boolean;
|
|
1362
|
+
declare const WORKERD_SQLITE_LIMITS: {
|
|
1363
|
+
readonly boundParams: 100;
|
|
1364
|
+
readonly compoundSelect: 5;
|
|
1365
|
+
readonly likePattern: 50;
|
|
1366
|
+
readonly sqlTextLength: 100000;
|
|
1367
|
+
};
|
|
1012
1368
|
type SqlEngine = "mysql" | "postgres" | "sqlite";
|
|
1013
1369
|
interface RenderedSql {
|
|
1014
1370
|
params: unknown[];
|
|
@@ -1016,6 +1372,79 @@ interface RenderedSql {
|
|
|
1016
1372
|
}
|
|
1017
1373
|
declare const renderSql: (engine: SqlEngine, query: SQL) => RenderedSql;
|
|
1018
1374
|
declare const param: (value: unknown) => SQL;
|
|
1375
|
+
declare const unionAll: (branches: ReadonlyArray<SQL>) => SQL;
|
|
1376
|
+
declare const sqliteInList: (reference: SQL, items: ReadonlyArray<unknown>, negated: boolean, budget?: number) => SQL;
|
|
1377
|
+
type DurableStreamStatus = "complete" | "error" | "running";
|
|
1378
|
+
interface DurableStreamRun {
|
|
1379
|
+
error?: string;
|
|
1380
|
+
errorCode?: string;
|
|
1381
|
+
lastSeq: number;
|
|
1382
|
+
startedAt: number;
|
|
1383
|
+
status: DurableStreamStatus;
|
|
1384
|
+
}
|
|
1385
|
+
interface DurableStreamChunk {
|
|
1386
|
+
dataJson: string;
|
|
1387
|
+
seq: number;
|
|
1388
|
+
}
|
|
1389
|
+
declare const migrateDurableStreams: (sql: SqlExec) => void;
|
|
1390
|
+
declare const readStreamRun: (sql: SqlExec, runKey: string) => DurableStreamRun | undefined;
|
|
1391
|
+
declare const claimStreamRun: (sql: SqlExec, runKey: string, startedAt: number, ttlMs: number) => boolean;
|
|
1392
|
+
declare const deleteStreamRun: (sql: SqlExec, runKey: string) => void;
|
|
1393
|
+
declare const appendStreamChunk: (sql: SqlExec, runKey: string, seq: number, dataJson: string) => void;
|
|
1394
|
+
declare const readStreamChunks: (sql: SqlExec, runKey: string, sinceSeq: number) => DurableStreamChunk[];
|
|
1395
|
+
declare const finishStreamRun: (sql: SqlExec, runKey: string, status: "complete" | "error", lastSeq: number, failure?: {
|
|
1396
|
+
code: string;
|
|
1397
|
+
message: string;
|
|
1398
|
+
}) => void;
|
|
1399
|
+
declare const trimStreamRuns: (sql: SqlExec, now: number, live: ReadonlySet<string>) => void;
|
|
1400
|
+
declare const MAX_DURABLE_STREAM_CHUNKS = 50000;
|
|
1401
|
+
declare const MAX_DURABLE_STREAM_BYTES: number;
|
|
1402
|
+
interface DurableStreamSink {
|
|
1403
|
+
readonly chunk: (chunk: {
|
|
1404
|
+
data: unknown;
|
|
1405
|
+
generation?: number;
|
|
1406
|
+
seq: number;
|
|
1407
|
+
}) => boolean;
|
|
1408
|
+
readonly complete: () => void;
|
|
1409
|
+
readonly fail: (failure: {
|
|
1410
|
+
code: string;
|
|
1411
|
+
message: string;
|
|
1412
|
+
}) => void;
|
|
1413
|
+
}
|
|
1414
|
+
type DurableAttachDecision = "attach" | "interrupted" | "reclaim" | "replay-terminal";
|
|
1415
|
+
declare const decideDurableAttach: (run: DurableStreamRun | undefined, context: {
|
|
1416
|
+
generation?: number;
|
|
1417
|
+
live?: {
|
|
1418
|
+
generation: number;
|
|
1419
|
+
};
|
|
1420
|
+
resuming: boolean;
|
|
1421
|
+
}) => DurableAttachDecision;
|
|
1422
|
+
interface DurableStreamAttach {
|
|
1423
|
+
readonly generation?: number;
|
|
1424
|
+
readonly iterator: (signal: AbortSignal) => AsyncIterable<unknown>;
|
|
1425
|
+
readonly runKey: string;
|
|
1426
|
+
readonly sinceChunk: number;
|
|
1427
|
+
readonly sink: DurableStreamSink;
|
|
1428
|
+
readonly ttlMs?: number;
|
|
1429
|
+
}
|
|
1430
|
+
declare class DurableStreamRunner {
|
|
1431
|
+
private lastTrimAt;
|
|
1432
|
+
private readonly runs;
|
|
1433
|
+
private readonly sql;
|
|
1434
|
+
private readonly waitUntil;
|
|
1435
|
+
constructor(dependencies: {
|
|
1436
|
+
sql: () => SqlExec;
|
|
1437
|
+
waitUntil?: (promise: Promise<unknown>) => void;
|
|
1438
|
+
});
|
|
1439
|
+
attach(request: DurableStreamAttach): Promise<void>;
|
|
1440
|
+
detach(runKey: string, sink: DurableStreamSink): void;
|
|
1441
|
+
isLive(runKey: string): boolean;
|
|
1442
|
+
private attachOrThrow;
|
|
1443
|
+
private produce;
|
|
1444
|
+
private trim;
|
|
1445
|
+
}
|
|
1446
|
+
declare const envPositiveInt: (env: unknown, key: string, fallback: number) => number;
|
|
1447
|
+
declare const envOptionalPositiveInt: (env: unknown, key: string) => number | undefined;
|
|
1019
1448
|
interface ExternalSourceDiffResult {
|
|
1020
1449
|
changes: CdcChange[];
|
|
1021
1450
|
nextBaseline: Map<string, string>;
|
|
@@ -1080,6 +1509,16 @@ declare const isSoftDeleted: (row: Record<string, unknown>, column: string) => b
|
|
|
1080
1509
|
declare const pullExternalSourceIncrementalTick: (sql: SqlExec, writer: DatabaseWriterLike, client: SourceClientLike, table: string, source: ExternalSourceLike, shardKey: string, nowMs: number) => Promise<{
|
|
1081
1510
|
applied: number;
|
|
1082
1511
|
}>;
|
|
1512
|
+
declare const ftsRowidMapName: (companion: string) => string;
|
|
1513
|
+
interface FtsWriteOptions {
|
|
1514
|
+
guard?: SQL;
|
|
1515
|
+
unmappedRowids?: ReadonlyArray<number>;
|
|
1516
|
+
}
|
|
1517
|
+
declare const ftsCompanionDdl: (companion: string) => SQL[];
|
|
1518
|
+
declare const ftsWriteDocument: (companion: string, id: string, text: string, options?: FtsWriteOptions) => SQL[];
|
|
1519
|
+
declare const ftsPurgeDocument: (companion: string, id: string, options?: FtsWriteOptions) => SQL[];
|
|
1520
|
+
declare const ftsUnmappedPage: (companion: string, limit: number, after?: number) => SQL;
|
|
1521
|
+
declare const groupUnmappedRows: (rows: ReadonlyArray<Record<string, unknown>>) => Map<string, number[]>;
|
|
1083
1522
|
declare const GEO_DEFAULT_PRECISION = 9;
|
|
1084
1523
|
interface GeoPoint {
|
|
1085
1524
|
lat: number;
|
|
@@ -1095,6 +1534,108 @@ declare const coveringGeohashes: (center: GeoPoint, radiusMeters: number) => str
|
|
|
1095
1534
|
declare const pointInBoundingBox: (point: GeoPoint, box: GeoBoundingBox) => boolean;
|
|
1096
1535
|
declare const boundingBoxCenter: (box: GeoBoundingBox) => GeoPoint;
|
|
1097
1536
|
declare const boundingBoxGeohashes: (box: GeoBoundingBox) => string[];
|
|
1537
|
+
declare class GlobalPollTick {
|
|
1538
|
+
private readonly changedTables;
|
|
1539
|
+
private readonly reads;
|
|
1540
|
+
private resync;
|
|
1541
|
+
private skippedCount;
|
|
1542
|
+
constructor(changedTables?: Set<string>);
|
|
1543
|
+
get readCount(): number;
|
|
1544
|
+
get resyncRequested(): boolean;
|
|
1545
|
+
get skipped(): number;
|
|
1546
|
+
requestResync(): void;
|
|
1547
|
+
rows(key: string | undefined, load: () => Promise<ShapeRow[]>): Promise<ShapeRow[]>;
|
|
1548
|
+
shouldRead(table: string): boolean;
|
|
1549
|
+
}
|
|
1550
|
+
declare const IMPORT_STAGE_TTL_MS: number;
|
|
1551
|
+
declare const IMPORT_MANIFEST_TTL_MS: number;
|
|
1552
|
+
interface StagedImportRow {
|
|
1553
|
+
doc: Record<string, unknown>;
|
|
1554
|
+
line: number;
|
|
1555
|
+
table: string;
|
|
1556
|
+
}
|
|
1557
|
+
interface ImportStepResult {
|
|
1558
|
+
deleted: Record<string, number>;
|
|
1559
|
+
inserted: Record<string, number>;
|
|
1560
|
+
warnings?: string[];
|
|
1561
|
+
}
|
|
1562
|
+
type ManifestState = "aborting" | "committed" | "committing" | "open";
|
|
1563
|
+
interface ImportManifest {
|
|
1564
|
+
batches: number;
|
|
1565
|
+
claims?: Record<string, {
|
|
1566
|
+
by: string;
|
|
1567
|
+
until: number;
|
|
1568
|
+
}>;
|
|
1569
|
+
expiresAt: number;
|
|
1570
|
+
generation: string;
|
|
1571
|
+
globals: boolean;
|
|
1572
|
+
pending: number;
|
|
1573
|
+
received: number;
|
|
1574
|
+
rejected: number;
|
|
1575
|
+
sections: string[];
|
|
1576
|
+
session: string;
|
|
1577
|
+
shards: string[];
|
|
1578
|
+
state: ManifestState;
|
|
1579
|
+
steps: Record<string, ImportStepResult>;
|
|
1580
|
+
storage: boolean;
|
|
1581
|
+
tables: string[];
|
|
1582
|
+
}
|
|
1583
|
+
declare const assertImportSessionId: (session: unknown) => string;
|
|
1584
|
+
declare const readShardImportSession: (sql: SqlExec, session: string) => undefined | {
|
|
1585
|
+
generation: string;
|
|
1586
|
+
result?: Record<string, unknown>;
|
|
1587
|
+
state: "committed" | "staging";
|
|
1588
|
+
};
|
|
1589
|
+
declare const sweepImportStaging: (sql: SqlExec, now: number) => ImportManifest[];
|
|
1590
|
+
declare const stageImportRows: (sql: SqlExec, session: string, generation: string, rows: ReadonlyArray<StagedImportRow>, now: number) => Record<string, number>;
|
|
1591
|
+
declare const touchShardImportSession: (sql: SqlExec, session: string, now: number) => void;
|
|
1592
|
+
declare const stagedImportPage: (sql: SqlExec, session: string, options: {
|
|
1593
|
+
afterSeq: number;
|
|
1594
|
+
limit: number;
|
|
1595
|
+
sections?: ReadonlyArray<string>;
|
|
1596
|
+
}) => {
|
|
1597
|
+
rows: StagedImportRow[];
|
|
1598
|
+
seq: number;
|
|
1599
|
+
};
|
|
1600
|
+
declare const stagedImportIds: (sql: SqlExec, session: string) => Set<string>;
|
|
1601
|
+
declare const markShardImportCommitted: (sql: SqlExec, session: string, generation: string, result: Record<string, unknown>, now: number) => void;
|
|
1602
|
+
declare const dropImportSession: (sql: SqlExec, session: string, generation: string) => boolean;
|
|
1603
|
+
declare const readImportManifest: (sql: SqlExec, session: string, now: number) => ImportManifest | undefined;
|
|
1604
|
+
interface ManifestTouch {
|
|
1605
|
+
begin: boolean;
|
|
1606
|
+
globals?: boolean;
|
|
1607
|
+
received?: number;
|
|
1608
|
+
rejected?: number;
|
|
1609
|
+
sections?: ReadonlyArray<string>;
|
|
1610
|
+
shards?: ReadonlyArray<string>;
|
|
1611
|
+
storage?: boolean;
|
|
1612
|
+
tables: ReadonlyArray<string>;
|
|
1613
|
+
}
|
|
1614
|
+
declare const touchImportManifest: (sql: SqlExec, session: string, touch: ManifestTouch, now: number) => {
|
|
1615
|
+
created: boolean;
|
|
1616
|
+
manifest: ImportManifest;
|
|
1617
|
+
};
|
|
1618
|
+
type ManifestChange = {
|
|
1619
|
+
batches: number;
|
|
1620
|
+
state: "committing";
|
|
1621
|
+
} | {
|
|
1622
|
+
claim: string;
|
|
1623
|
+
step: string;
|
|
1624
|
+
} | {
|
|
1625
|
+
claimant: string;
|
|
1626
|
+
step: string;
|
|
1627
|
+
stepResult: ImportStepResult;
|
|
1628
|
+
} | {
|
|
1629
|
+
release: string;
|
|
1630
|
+
step: string;
|
|
1631
|
+
} | {
|
|
1632
|
+
state: "aborting";
|
|
1633
|
+
} | {
|
|
1634
|
+
state: "committed";
|
|
1635
|
+
};
|
|
1636
|
+
declare const advanceImportManifest: (sql: SqlExec, session: string, change: ManifestChange, now: number) => ImportManifest;
|
|
1637
|
+
declare const dropImportManifest: (sql: SqlExec, session: string, now: number) => void;
|
|
1638
|
+
declare const isInternalTableName: (name: string) => boolean;
|
|
1098
1639
|
declare const ADMIN_FUNCTION_PREFIX = "__lunora_admin__:";
|
|
1099
1640
|
declare const RELATION_FUNCTION_PREFIX = "__lunora_relation__:";
|
|
1100
1641
|
declare const FLAGS_FUNCTION_PREFIX = "__lunora_flags__:";
|
|
@@ -1102,23 +1643,29 @@ declare const ADMIN_FUNCTIONS: {
|
|
|
1102
1643
|
readonly applyCdc: "__lunora_admin__:applyCdc";
|
|
1103
1644
|
readonly aiAvailable: "__lunora_admin__:aiAvailable";
|
|
1104
1645
|
readonly aiChartConfig: "__lunora_admin__:aiChartConfig";
|
|
1646
|
+
readonly aiCronExpression: "__lunora_admin__:aiCronExpression";
|
|
1105
1647
|
readonly aiGenerateSql: "__lunora_admin__:aiGenerateSql";
|
|
1648
|
+
readonly aiNameQuery: "__lunora_admin__:aiNameQuery";
|
|
1106
1649
|
readonly aiTableFilter: "__lunora_admin__:aiTableFilter";
|
|
1107
1650
|
readonly assignIssue: "__lunora_admin__:assignIssue";
|
|
1651
|
+
readonly backfillSearch: "__lunora_admin__:backfillSearch";
|
|
1652
|
+
readonly backfillVectors: "__lunora_admin__:backfillVectors";
|
|
1108
1653
|
readonly backRelationCounts: "__lunora_admin__:backRelationCounts";
|
|
1109
1654
|
readonly cdcSync: "__lunora_admin__:cdcSync";
|
|
1110
1655
|
readonly clearCapturedMail: "__lunora_admin__:clearCapturedMail";
|
|
1111
1656
|
readonly clearQueueMessages: "__lunora_admin__:clearQueueMessages";
|
|
1112
1657
|
readonly clearTable: "__lunora_admin__:clearTable";
|
|
1658
|
+
readonly createAdminToken: "__lunora_admin__:createAdminToken";
|
|
1113
1659
|
readonly createWorkflowInstance: "__lunora_admin__:createWorkflowInstance";
|
|
1114
1660
|
readonly deleteRows: "__lunora_admin__:deleteRows";
|
|
1115
1661
|
readonly describeTable: "__lunora_admin__:describeTable";
|
|
1116
1662
|
readonly describeTables: "__lunora_admin__:describeTables";
|
|
1663
|
+
readonly dropOutboxEntry: "__lunora_admin__:dropOutboxEntry";
|
|
1117
1664
|
readonly explainIssue: "__lunora_admin__:explainIssue";
|
|
1118
1665
|
readonly exportShard: "__lunora_admin__:exportShard";
|
|
1119
1666
|
readonly facetColumn: "__lunora_admin__:facetColumn";
|
|
1667
|
+
readonly findRelated: "__lunora_admin__:findRelated";
|
|
1120
1668
|
readonly getAdvisories: "__lunora_admin__:getAdvisories";
|
|
1121
|
-
readonly getAdvisorProcedures: "__lunora_admin__:getAdvisorProcedures";
|
|
1122
1669
|
readonly getAuditLog: "__lunora_admin__:getAuditLog";
|
|
1123
1670
|
readonly getAuthMetrics: "__lunora_admin__:getAuthMetrics";
|
|
1124
1671
|
readonly getCapturedMail: "__lunora_admin__:getCapturedMail";
|
|
@@ -1127,6 +1674,7 @@ declare const ADMIN_FUNCTIONS: {
|
|
|
1127
1674
|
readonly getIssues: "__lunora_admin__:getIssues";
|
|
1128
1675
|
readonly getMetricHistory: "__lunora_admin__:getMetricHistory";
|
|
1129
1676
|
readonly getMetricSeries: "__lunora_admin__:getMetricSeries";
|
|
1677
|
+
readonly getScheduleOutbox: "__lunora_admin__:getScheduleOutbox";
|
|
1130
1678
|
readonly listSubscriptions: "__lunora_admin__:listSubscriptions";
|
|
1131
1679
|
readonly listTableIndexes: "__lunora_admin__:listTableIndexes";
|
|
1132
1680
|
readonly listTablesIndexes: "__lunora_admin__:listTablesIndexes";
|
|
@@ -1141,24 +1689,37 @@ declare const ADMIN_FUNCTIONS: {
|
|
|
1141
1689
|
readonly getTraces: "__lunora_admin__:getTraces";
|
|
1142
1690
|
readonly getWorkflowInstanceStatus: "__lunora_admin__:getWorkflowInstanceStatus";
|
|
1143
1691
|
readonly ignoreIssue: "__lunora_admin__:ignoreIssue";
|
|
1692
|
+
readonly importAbort: "__lunora_admin__:importAbort";
|
|
1693
|
+
readonly importCommit: "__lunora_admin__:importCommit";
|
|
1694
|
+
readonly importManifest: "__lunora_admin__:importManifest";
|
|
1144
1695
|
readonly importShard: "__lunora_admin__:importShard";
|
|
1696
|
+
readonly importStage: "__lunora_admin__:importStage";
|
|
1697
|
+
readonly importStagedRows: "__lunora_admin__:importStagedRows";
|
|
1698
|
+
readonly listAdminTokens: "__lunora_admin__:listAdminTokens";
|
|
1145
1699
|
readonly listFlags: "__lunora_admin__:listFlags";
|
|
1700
|
+
readonly listReactors: "__lunora_admin__:listReactors";
|
|
1146
1701
|
readonly listQueues: "__lunora_admin__:listQueues";
|
|
1147
1702
|
readonly lintSql: "__lunora_admin__:lintSql";
|
|
1148
1703
|
readonly listTables: "__lunora_admin__:listTables";
|
|
1149
1704
|
readonly listWorkflows: "__lunora_admin__:listWorkflows";
|
|
1150
1705
|
readonly maskPolicies: "__lunora_admin__:maskPolicies";
|
|
1151
1706
|
readonly migrationStatus: "__lunora_admin__:migrationStatus";
|
|
1707
|
+
readonly patchRows: "__lunora_admin__:patchRows";
|
|
1152
1708
|
readonly pitrRestore: "__lunora_admin__:pitrRestore";
|
|
1153
1709
|
readonly rankBefore: "__lunora_admin__:rankBefore";
|
|
1154
1710
|
readonly rankPage: "__lunora_admin__:rankPage";
|
|
1155
1711
|
readonly readTablePage: "__lunora_admin__:readTablePage";
|
|
1712
|
+
readonly rebuildCompanions: "__lunora_admin__:rebuildCompanions";
|
|
1156
1713
|
readonly recordAuthEvent: "__lunora_admin__:recordAuthEvent";
|
|
1157
1714
|
readonly recordContainerEvent: "__lunora_admin__:recordContainerEvent";
|
|
1715
|
+
readonly recordImportAudit: "__lunora_admin__:recordImportAudit";
|
|
1158
1716
|
readonly recordMail: "__lunora_admin__:recordMail";
|
|
1159
1717
|
readonly recordQueueMessage: "__lunora_admin__:recordQueueMessage";
|
|
1718
|
+
readonly releaseShardRegistration: "__lunora_admin__:releaseShardRegistration";
|
|
1160
1719
|
readonly replayQueueMessage: "__lunora_admin__:replayQueueMessage";
|
|
1720
|
+
readonly retryOutboxEntry: "__lunora_admin__:retryOutboxEntry";
|
|
1161
1721
|
readonly resolveIssue: "__lunora_admin__:resolveIssue";
|
|
1722
|
+
readonly revokeAdminToken: "__lunora_admin__:revokeAdminToken";
|
|
1162
1723
|
readonly rlsPolicies: "__lunora_admin__:rlsPolicies";
|
|
1163
1724
|
readonly schemaHistory: "__lunora_admin__:schemaHistory";
|
|
1164
1725
|
readonly schemaVersion: "__lunora_admin__:schemaVersion";
|
|
@@ -1167,11 +1728,13 @@ declare const ADMIN_FUNCTIONS: {
|
|
|
1167
1728
|
readonly runSql: "__lunora_admin__:runSql";
|
|
1168
1729
|
readonly sendQueueMessage: "__lunora_admin__:sendQueueMessage";
|
|
1169
1730
|
readonly sendTestMail: "__lunora_admin__:sendTestMail";
|
|
1731
|
+
readonly sendWorkflowEvent: "__lunora_admin__:sendWorkflowEvent";
|
|
1170
1732
|
readonly setIssueSeverity: "__lunora_admin__:setIssueSeverity";
|
|
1171
1733
|
readonly storageOrphans: "__lunora_admin__:storageOrphans";
|
|
1172
1734
|
readonly storageReferences: "__lunora_admin__:storageReferences";
|
|
1173
1735
|
readonly storageRules: "__lunora_admin__:storageRules";
|
|
1174
1736
|
readonly studioFeatures: "__lunora_admin__:studioFeatures";
|
|
1737
|
+
readonly verifyAdminToken: "__lunora_admin__:verifyAdminToken";
|
|
1175
1738
|
readonly writeRow: "__lunora_admin__:writeRow";
|
|
1176
1739
|
};
|
|
1177
1740
|
interface TableInfo {
|
|
@@ -1226,8 +1789,12 @@ interface TablesIndexesResult {
|
|
|
1226
1789
|
indexesByTable: Record<string, TableIndexInfo[]>;
|
|
1227
1790
|
}
|
|
1228
1791
|
interface ColumnMeta {
|
|
1792
|
+
bucket?: string;
|
|
1793
|
+
enumValues?: string[];
|
|
1229
1794
|
isStorage?: boolean;
|
|
1230
1795
|
name: string;
|
|
1796
|
+
nullable?: boolean;
|
|
1797
|
+
onDelete?: "cascade" | "restrict" | "set null";
|
|
1231
1798
|
optional: boolean;
|
|
1232
1799
|
pk?: boolean;
|
|
1233
1800
|
ref?: string;
|
|
@@ -1249,6 +1816,11 @@ interface AdvisoryFinding {
|
|
|
1249
1816
|
metadata: Record<string, unknown>;
|
|
1250
1817
|
name: string;
|
|
1251
1818
|
remediation: string;
|
|
1819
|
+
suppressed?: {
|
|
1820
|
+
file: string;
|
|
1821
|
+
line: number;
|
|
1822
|
+
reason: string;
|
|
1823
|
+
};
|
|
1252
1824
|
title: string;
|
|
1253
1825
|
}
|
|
1254
1826
|
interface AdvisoriesResult {
|
|
@@ -1270,6 +1842,7 @@ interface AdvisorProcedure {
|
|
|
1270
1842
|
runsAiGeneration?: boolean;
|
|
1271
1843
|
throwsBareError?: boolean;
|
|
1272
1844
|
unboundedAiGeneration?: boolean;
|
|
1845
|
+
usesAuthorize?: boolean;
|
|
1273
1846
|
usesCaptcha: boolean;
|
|
1274
1847
|
usesEmailGate: boolean;
|
|
1275
1848
|
usesInsertManyUnsafe?: boolean;
|
|
@@ -1279,9 +1852,6 @@ interface AdvisorProcedure {
|
|
|
1279
1852
|
visibility: "internal" | "public";
|
|
1280
1853
|
writesUserTable?: boolean;
|
|
1281
1854
|
}
|
|
1282
|
-
interface AdvisorProceduresResult {
|
|
1283
|
-
procedures: AdvisorProcedure[];
|
|
1284
|
-
}
|
|
1285
1855
|
interface RlsPolicyMetadata {
|
|
1286
1856
|
file: string;
|
|
1287
1857
|
on: "delete" | "insert" | "read" | "update";
|
|
@@ -1324,6 +1894,12 @@ interface StudioFeaturesResult {
|
|
|
1324
1894
|
mail: boolean;
|
|
1325
1895
|
notifications: boolean;
|
|
1326
1896
|
payments: boolean;
|
|
1897
|
+
platform?: {
|
|
1898
|
+
id: string;
|
|
1899
|
+
name: string;
|
|
1900
|
+
unsupported: string[];
|
|
1901
|
+
};
|
|
1902
|
+
privacy: boolean;
|
|
1327
1903
|
queues: boolean;
|
|
1328
1904
|
scheduler: boolean;
|
|
1329
1905
|
storage: boolean;
|
|
@@ -1342,13 +1918,26 @@ interface FlagsResult {
|
|
|
1342
1918
|
configured: boolean;
|
|
1343
1919
|
flags: FlagEvaluation[];
|
|
1344
1920
|
}
|
|
1921
|
+
interface ReactorMetadata {
|
|
1922
|
+
errors: number;
|
|
1923
|
+
lastError?: string;
|
|
1924
|
+
lastRanAt?: number;
|
|
1925
|
+
path: string;
|
|
1926
|
+
runs: number;
|
|
1927
|
+
state: "active" | "failing" | "idle";
|
|
1928
|
+
suppressed: number;
|
|
1929
|
+
tables?: ReadonlyArray<string>;
|
|
1930
|
+
}
|
|
1931
|
+
interface ReactorsResult {
|
|
1932
|
+
reactors: ReactorMetadata[];
|
|
1933
|
+
}
|
|
1345
1934
|
interface WorkflowMetadata {
|
|
1346
|
-
binding: string;
|
|
1347
1935
|
className: string;
|
|
1348
1936
|
exportName: string;
|
|
1349
1937
|
name: string;
|
|
1350
1938
|
}
|
|
1351
1939
|
interface WorkflowsResult {
|
|
1940
|
+
eventTypes?: string[];
|
|
1352
1941
|
workflows: WorkflowMetadata[];
|
|
1353
1942
|
}
|
|
1354
1943
|
interface QueueMetadata {
|
|
@@ -1357,11 +1946,12 @@ interface QueueMetadata {
|
|
|
1357
1946
|
exportName: string;
|
|
1358
1947
|
mode: "pull" | "push";
|
|
1359
1948
|
name: string;
|
|
1949
|
+
topic?: string;
|
|
1360
1950
|
}
|
|
1361
1951
|
interface QueuesResult {
|
|
1362
1952
|
queues: QueueMetadata[];
|
|
1363
1953
|
}
|
|
1364
|
-
type WorkflowInstanceState = "complete" | "errored" | "paused" | "queued" | "running" | "terminated" | "unknown" | "waiting" | "waitingForPause";
|
|
1954
|
+
type WorkflowInstanceState = "complete" | "errored" | "paused" | "queued" | "rollingBack" | "running" | "terminated" | "unknown" | "waiting" | "waitingForPause";
|
|
1365
1955
|
interface CreateWorkflowInstanceResult {
|
|
1366
1956
|
id: string;
|
|
1367
1957
|
status: WorkflowInstanceState;
|
|
@@ -1400,12 +1990,15 @@ interface TablePage {
|
|
|
1400
1990
|
columns: string[];
|
|
1401
1991
|
refs?: Record<string, string>;
|
|
1402
1992
|
rows: Record<string, unknown>[];
|
|
1993
|
+
sqlColumns: string[];
|
|
1403
1994
|
total?: number;
|
|
1404
1995
|
}
|
|
1405
|
-
type
|
|
1996
|
+
type ColumnKinds = Readonly<Record<string, string>>;
|
|
1997
|
+
type FilterOperator = "contains" | "eq" | "gt" | "gte" | "has" | "lt" | "lte" | "ne";
|
|
1406
1998
|
interface FilterClause {
|
|
1407
1999
|
column: string;
|
|
1408
2000
|
operator: FilterOperator;
|
|
2001
|
+
path?: string[];
|
|
1409
2002
|
value?: unknown;
|
|
1410
2003
|
}
|
|
1411
2004
|
interface OrderByClause {
|
|
@@ -1413,6 +2006,7 @@ interface OrderByClause {
|
|
|
1413
2006
|
direction: SortDirection;
|
|
1414
2007
|
}
|
|
1415
2008
|
interface ReadTablePageOptions {
|
|
2009
|
+
columnKinds?: ColumnKinds;
|
|
1416
2010
|
filters?: FilterClause[];
|
|
1417
2011
|
limit?: number;
|
|
1418
2012
|
offset?: number;
|
|
@@ -1423,6 +2017,8 @@ interface ReadTablePageOptions {
|
|
|
1423
2017
|
table: string;
|
|
1424
2018
|
}
|
|
1425
2019
|
interface SelectMatchingIdsOptions {
|
|
2020
|
+
after?: string;
|
|
2021
|
+
columnKinds?: ColumnKinds;
|
|
1426
2022
|
filters?: FilterClause[];
|
|
1427
2023
|
limit?: number;
|
|
1428
2024
|
search?: string;
|
|
@@ -1430,6 +2026,7 @@ interface SelectMatchingIdsOptions {
|
|
|
1430
2026
|
}
|
|
1431
2027
|
interface FacetColumnOptions {
|
|
1432
2028
|
column: string;
|
|
2029
|
+
columnKinds?: ColumnKinds;
|
|
1433
2030
|
filters?: FilterClause[];
|
|
1434
2031
|
limit?: number;
|
|
1435
2032
|
search?: string;
|
|
@@ -1445,6 +2042,7 @@ interface FacetColumnResult {
|
|
|
1445
2042
|
}
|
|
1446
2043
|
declare const MAX_PAGE_SIZE = 500;
|
|
1447
2044
|
declare const listTables: (sql: SqlExec) => TableInfo[];
|
|
2045
|
+
declare const isVacuousFilterClause: (clause: FilterClause) => boolean;
|
|
1448
2046
|
declare const readTablePage: (sql: SqlExec, options: ReadTablePageOptions) => TablePage;
|
|
1449
2047
|
declare const selectMatchingIds: (sql: SqlExec, options: SelectMatchingIdsOptions) => {
|
|
1450
2048
|
hasMore: boolean;
|
|
@@ -1463,6 +2061,7 @@ interface StorageReferenceResult {
|
|
|
1463
2061
|
declare const findStorageReferences: (sql: SqlExec, storageColumns: Record<string, string[]>, keys: string[]) => StorageReferenceResult;
|
|
1464
2062
|
interface SocketAttachmentLike {
|
|
1465
2063
|
admin?: boolean;
|
|
2064
|
+
authenticated?: boolean;
|
|
1466
2065
|
subs?: Record<string, SubscriptionInfo>;
|
|
1467
2066
|
}
|
|
1468
2067
|
declare const summarizeSubscriptions: (attachments: SocketAttachmentLike[]) => SubscriptionsResult;
|
|
@@ -1479,18 +2078,29 @@ interface FanoutPathCounters {
|
|
|
1479
2078
|
socketsIterated: number;
|
|
1480
2079
|
totalMs: number;
|
|
1481
2080
|
}
|
|
2081
|
+
interface ShapeProbeCounters {
|
|
2082
|
+
run: number;
|
|
2083
|
+
served: number;
|
|
2084
|
+
}
|
|
2085
|
+
interface GlobalPollCounters {
|
|
2086
|
+
drains: number;
|
|
2087
|
+
pairsSkipped: number;
|
|
2088
|
+
}
|
|
1482
2089
|
interface FanoutMetricsResult {
|
|
2090
|
+
globalPoll: GlobalPollCounters;
|
|
1483
2091
|
maxRelays: number;
|
|
1484
2092
|
peakSubscribers: number;
|
|
1485
2093
|
promoted: boolean;
|
|
1486
2094
|
relayCount: number;
|
|
1487
2095
|
shapePoke: FanoutPathCounters;
|
|
2096
|
+
shapeProbe: ShapeProbeCounters;
|
|
1488
2097
|
sinceMs: number;
|
|
1489
2098
|
topics: FanoutTopicStat[];
|
|
1490
2099
|
totalConnections: number;
|
|
1491
2100
|
whisper: FanoutPathCounters;
|
|
1492
2101
|
}
|
|
1493
2102
|
interface FanoutAttachmentLike {
|
|
2103
|
+
authenticated?: boolean;
|
|
1494
2104
|
shapes?: Record<string, {
|
|
1495
2105
|
name?: string;
|
|
1496
2106
|
}>;
|
|
@@ -1498,6 +2108,10 @@ interface FanoutAttachmentLike {
|
|
|
1498
2108
|
}
|
|
1499
2109
|
declare const DEFAULT_FANOUT_TOPIC_LIMIT = 20;
|
|
1500
2110
|
declare const createFanoutCounters: () => FanoutPathCounters;
|
|
2111
|
+
declare const createShapeProbeCounters: () => ShapeProbeCounters;
|
|
2112
|
+
declare const createGlobalPollCounters: () => GlobalPollCounters;
|
|
2113
|
+
declare const recordGlobalPollPass: (counters: GlobalPollCounters, drains: number, pairsSkipped: number) => GlobalPollCounters;
|
|
2114
|
+
declare const recordShapeProbePass: (counters: ShapeProbeCounters, run: number, served: number) => ShapeProbeCounters;
|
|
1501
2115
|
declare const recordFanoutPass: (counters: FanoutPathCounters, iterated: number, delivered: number, ms: number) => FanoutPathCounters;
|
|
1502
2116
|
declare const summarizeFanoutTopics: (attachments: FanoutAttachmentLike[], limit?: number) => {
|
|
1503
2117
|
peakSubscribers: number;
|
|
@@ -1545,6 +2159,11 @@ declare const clearCapturedMail: (sql: SqlExec) => {
|
|
|
1545
2159
|
declare class NotFoundError extends LunoraError {
|
|
1546
2160
|
constructor(message?: string);
|
|
1547
2161
|
}
|
|
2162
|
+
declare const operatorFields: (definition: TableDefinitionLike, patch: Record<string, unknown>) => ReadonlySet<string>;
|
|
2163
|
+
declare const resolvePatch: (definition: TableDefinitionLike, patch: Record<string, unknown>, current: Record<string, unknown>) => Record<string, unknown>;
|
|
2164
|
+
declare const patchDependsOnRow: (definition: TableDefinitionLike, patch: Record<string, unknown>) => boolean;
|
|
2165
|
+
declare const assertPatchAllowed: (options: PatchWriteOptions | undefined, previous: Record<string, unknown>, next: Record<string, unknown>) => void;
|
|
2166
|
+
declare const readPatchField: (document: Record<string, unknown>, field: string) => unknown;
|
|
1548
2167
|
interface PitrStorage {
|
|
1549
2168
|
getBookmarkForTime?: (time: Date | number) => Promise<string>;
|
|
1550
2169
|
getCurrentBookmark?: () => Promise<string>;
|
|
@@ -1566,7 +2185,22 @@ interface PitrRestoreArgs {
|
|
|
1566
2185
|
}
|
|
1567
2186
|
declare const readBookmark: (storage: PitrStorage, time?: number | string) => Promise<PitrBookmarkResult>;
|
|
1568
2187
|
declare const armRestore: (storage: PitrStorage, args: PitrRestoreArgs) => Promise<Omit<PitrRestoreResult, "restarted">>;
|
|
1569
|
-
declare const
|
|
2188
|
+
declare const tiebreakDirectionFor: (keys: ReadonlyArray<{
|
|
2189
|
+
direction?: string;
|
|
2190
|
+
}>) => SortDirection;
|
|
2191
|
+
declare const equalityPinnedFields: (where: undefined | WhereInput) => ReadonlySet<string>;
|
|
2192
|
+
declare const uniqueIndexFields: (indexes: ReadonlyArray<{
|
|
2193
|
+
fields: ReadonlyArray<string>;
|
|
2194
|
+
unique?: boolean;
|
|
2195
|
+
}> | undefined, shape: Record<string, ValidatorLike> | undefined) => ReadonlyArray<ReadonlyArray<string>>;
|
|
2196
|
+
interface OrderKeyConstraints {
|
|
2197
|
+
pinned?: ReadonlySet<string>;
|
|
2198
|
+
uniqueBy?: ReadonlyArray<ReadonlyArray<string>>;
|
|
2199
|
+
}
|
|
2200
|
+
declare const nullsFirstOf: (key: Pick<OrderKey, "direction" | "nulls">) => boolean;
|
|
2201
|
+
declare const nullsOrderSuffix: (nullsFirst: boolean) => string;
|
|
2202
|
+
declare const normalizeOrderKeys: (orderBy: OrderByInput[] | undefined, shape?: Record<string, ValidatorLike>, constraints?: OrderKeyConstraints) => OrderKey[];
|
|
2203
|
+
declare const CURSOR_PREFIX = "~4";
|
|
1570
2204
|
declare const encodeCursor: (record: Record<string, unknown>, keys: OrderKey[]) => string;
|
|
1571
2205
|
declare const decodeCursor: (cursor: string) => unknown[];
|
|
1572
2206
|
declare const buildSeekWhere: (keys: OrderKey[], cursorValues: unknown[]) => WhereInput;
|
|
@@ -1626,24 +2260,71 @@ declare const rankKeyFromDocument: (index: RankIndexDefinitionLike, document_: R
|
|
|
1626
2260
|
rowId: string;
|
|
1627
2261
|
sortValues: unknown[];
|
|
1628
2262
|
};
|
|
2263
|
+
declare const rankPivotConditionSql: (column: string, value: unknown, direction: "asc" | "desc", wantLater: boolean) => SQL | undefined;
|
|
1629
2264
|
declare const matchesRankStaticWhere: (document: Record<string, unknown>, predicate: Record<string, unknown>) => boolean;
|
|
2265
|
+
declare const REACTOR_STATE_TABLE = "__reactor_state";
|
|
2266
|
+
interface ReactorState {
|
|
2267
|
+
digest: string;
|
|
2268
|
+
lastError?: string;
|
|
2269
|
+
lastRanAt: number;
|
|
2270
|
+
stats: ReactorStats;
|
|
2271
|
+
tables?: ReadonlyArray<string>;
|
|
2272
|
+
}
|
|
2273
|
+
interface ReactorStats {
|
|
2274
|
+
errors: number;
|
|
2275
|
+
runs: number;
|
|
2276
|
+
suppressed: number;
|
|
2277
|
+
}
|
|
2278
|
+
declare const migrateReactorState: (sql: SqlExec) => void;
|
|
2279
|
+
declare const readReactorState: (sql: SqlExec, path: string) => ReactorState | undefined;
|
|
2280
|
+
declare const listReactorStates: (sql: SqlExec) => {
|
|
2281
|
+
path: string;
|
|
2282
|
+
state: ReactorState;
|
|
2283
|
+
}[];
|
|
2284
|
+
type ReactorDispatchResult = "error" | "ran" | "suppressed";
|
|
2285
|
+
declare const writeReactorState: (sql: SqlExec, path: string, outcome: {
|
|
2286
|
+
digest?: string;
|
|
2287
|
+
error?: string;
|
|
2288
|
+
now: number;
|
|
2289
|
+
result: ReactorDispatchResult;
|
|
2290
|
+
tables?: ReadonlyArray<string>;
|
|
2291
|
+
}) => void;
|
|
2292
|
+
declare const reactorNeedsRun: (state: Pick<ReactorState, "tables"> | undefined, changed: ReadonlySet<string>) => boolean;
|
|
1630
2293
|
interface ReadFootprint {
|
|
1631
|
-
onRead: (table: string, idOrScan?: string) => void;
|
|
2294
|
+
onRead: (table: string, idOrScan?: string, exact?: boolean) => void;
|
|
1632
2295
|
onReadRange: (range: KeyRange) => void;
|
|
1633
2296
|
ranges: () => Map<string, KeyRange[]> | undefined;
|
|
1634
2297
|
tables: Set<string>;
|
|
1635
2298
|
}
|
|
1636
2299
|
declare const createReadFootprint: () => ReadFootprint;
|
|
2300
|
+
declare const ADMIN_WILDCARD = "*";
|
|
2301
|
+
declare const UNVOUCHABLE_DEP = "!unvouchable";
|
|
2302
|
+
declare const markUnvouchableReads: <T extends object>(facade: T, onRead: ReadFootprint["onRead"] | undefined, methods: ReadonlyArray<string>) => T;
|
|
2303
|
+
declare const WHERE_FILTER: unique symbol;
|
|
2304
|
+
type RowPredicate = (document: Record<string, unknown>) => boolean;
|
|
2305
|
+
type WhereFilter = RowPredicate & {
|
|
2306
|
+
readonly [WHERE_FILTER]: WhereInput;
|
|
2307
|
+
};
|
|
2308
|
+
declare const whereFilter: (where: WhereInput, predicate: RowPredicate) => WhereFilter;
|
|
2309
|
+
declare const whereOfFilter: (predicate: RowPredicate) => undefined | WhereInput;
|
|
2310
|
+
declare const isPushableWhere: (where: WhereInput, shape: Readonly<Record<string, ValidatorLike>>, exactText?: boolean) => boolean;
|
|
2311
|
+
declare const RELATED_MAX_DEPTH = 4;
|
|
2312
|
+
declare const RELATED_DEFAULT_LIMIT = 50;
|
|
2313
|
+
declare const RELATED_MAX_LIMIT = 200;
|
|
2314
|
+
declare const RELATED_DEPTH_DECAY = 0.5;
|
|
2315
|
+
declare const deriveRelationEdges: (schema: SchemaLike) => RelationEdge[];
|
|
2316
|
+
type RelationGraphReader = Pick<DatabaseWriterLike, "findMany"> & Pick<Partial<DatabaseWriterLike>, "lookupById">;
|
|
2317
|
+
declare const findRelated: (reader: RelationGraphReader, edges: ReadonlyArray<RelationEdge>, start: RelatedStart, options?: RelatedOptions) => Promise<RelatedPage>;
|
|
1637
2318
|
declare const DEFAULT_MAX_RELATION_KEYS = 5000;
|
|
1638
2319
|
interface RelationExistsMarker {
|
|
1639
2320
|
childWhere: WhereInput;
|
|
1640
2321
|
negated: boolean;
|
|
1641
2322
|
parentTable: string;
|
|
1642
|
-
relation:
|
|
2323
|
+
relation: KeyedRelationDefinitionLike;
|
|
1643
2324
|
}
|
|
1644
2325
|
type ExistsPushMode = "always" | "auto";
|
|
1645
2326
|
interface ResolveRelationPredicatesOptions {
|
|
1646
|
-
canPushExists?: (relation:
|
|
2327
|
+
canPushExists?: (relation: KeyedRelationDefinitionLike) => boolean;
|
|
1647
2328
|
existsPushMode?: ExistsPushMode;
|
|
1648
2329
|
fetcher: (tableName: string, args: QueryArgs) => Promise<QueryPage>;
|
|
1649
2330
|
maxRelationKeys?: number;
|
|
@@ -1654,7 +2335,7 @@ interface ResolveRelationPredicatesOptions {
|
|
|
1654
2335
|
tableName: string;
|
|
1655
2336
|
}
|
|
1656
2337
|
interface ResolveContext {
|
|
1657
|
-
canPushExists?: (relation:
|
|
2338
|
+
canPushExists?: (relation: KeyedRelationDefinitionLike) => boolean;
|
|
1658
2339
|
existsPushMode: ExistsPushMode;
|
|
1659
2340
|
fetcher: (tableName: string, args: QueryArgs) => Promise<QueryPage>;
|
|
1660
2341
|
maxRelationKeys: number;
|
|
@@ -1667,15 +2348,30 @@ declare const isRelationPredicate: (value: unknown) => value is Record<string, W
|
|
|
1667
2348
|
declare const containsRelationPredicate: (where: WhereInput, schema: ResolveContext["schema"], tableName: string) => boolean;
|
|
1668
2349
|
declare const assertFlatPredicate: (where: WhereInput | undefined, schema: ResolveContext["schema"], tableName: string, op: string) => void;
|
|
1669
2350
|
declare const resolveRelationPredicates: (where: WhereInput | undefined, options: ResolveRelationPredicatesOptions) => Promise<WhereInput | undefined>;
|
|
2351
|
+
declare const composeReadPredicate: (definition: TableDefinitionLike, args: QueryArgs, relation: Omit<ResolveRelationPredicatesOptions, "relationBaseWhere">) => Promise<{
|
|
2352
|
+
fetchLimit: number | undefined;
|
|
2353
|
+
limit: number | undefined;
|
|
2354
|
+
orderKeys: OrderKey[];
|
|
2355
|
+
predicate: WhereInput | undefined;
|
|
2356
|
+
}>;
|
|
2357
|
+
declare const findManyPage: (documents: Record<string, unknown>[], read: {
|
|
2358
|
+
endCursor?: null | string;
|
|
2359
|
+
limit: number | undefined;
|
|
2360
|
+
omitContinueCursor?: boolean;
|
|
2361
|
+
orderKeys: OrderKey[];
|
|
2362
|
+
}) => QueryPage;
|
|
1670
2363
|
declare const assertShapeShardable: (effectiveWhere: WhereInput | undefined, schema: ResolveContext["schema"], table: string) => void;
|
|
1671
|
-
declare const relationHooks: (args: Pick<QueryArgs, "relationBaseWhere" | "relationMask">) => Pick<QueryArgs, "relationBaseWhere" | "relationMask">;
|
|
2364
|
+
declare const relationHooks: (args: Pick<QueryArgs, "relationBaseWhere" | "relationMask">) => Pick<QueryArgs, "relationBaseWhere" | "relationMask"> & Pick<ResolveWithOptions, "fanOutBudget">;
|
|
1672
2365
|
declare const fanOutScalarCounts: (counter: (tableName: string, where?: WhereInput) => Promise<number>, tableName: string, whereField: string, values: unknown[], policyWhere: WhereInput | undefined) => Promise<Map<unknown, number>>;
|
|
1673
2366
|
declare const distinctValues: (rows: Record<string, unknown>[], field: string) => unknown[];
|
|
1674
2367
|
declare const resolveWith: (options: ResolveWithOptions) => Promise<void>;
|
|
1675
2368
|
interface ApplyOnDeleteOptions {
|
|
1676
2369
|
deletedId: string;
|
|
1677
2370
|
deletedReference: (references: string) => unknown;
|
|
1678
|
-
findHolders: (holderTable: string, field: string, value: unknown
|
|
2371
|
+
findHolders: (holderTable: string, field: string, value: unknown, page: {
|
|
2372
|
+
limit: number;
|
|
2373
|
+
select?: ReadonlyArray<string>;
|
|
2374
|
+
}) => Promise<Record<string, unknown>[]>;
|
|
1679
2375
|
onCascade: (holderTable: string, id: string) => Promise<void>;
|
|
1680
2376
|
onRestrict: (message: string) => never;
|
|
1681
2377
|
onSetNull: (holderTable: string, id: string, field: string) => Promise<void>;
|
|
@@ -1685,7 +2381,15 @@ interface ApplyOnDeleteOptions {
|
|
|
1685
2381
|
tableName: string;
|
|
1686
2382
|
}
|
|
1687
2383
|
declare const applyOnDelete: (options: ApplyOnDeleteOptions) => Promise<void>;
|
|
1688
|
-
|
|
2384
|
+
interface RowValidatorOptions {
|
|
2385
|
+
only?: ReadonlySet<string>;
|
|
2386
|
+
previous?: () => Readonly<Record<string, unknown>> | undefined;
|
|
2387
|
+
supplied?: Readonly<Record<string, unknown>>;
|
|
2388
|
+
tolerateStoredNull?: boolean;
|
|
2389
|
+
trusted?: boolean;
|
|
2390
|
+
}
|
|
2391
|
+
declare const applyInsertDefaults: (definition: TableDefinitionLike, document: Record<string, unknown>, auth: ServerDefaultContextLike["auth"]) => Record<string, unknown>;
|
|
2392
|
+
declare const runRowValidators: (definition: TableDefinitionLike, document: Record<string, unknown>, options?: RowValidatorOptions) => Record<string, unknown>;
|
|
1689
2393
|
interface ShapeRowOp {
|
|
1690
2394
|
key: string;
|
|
1691
2395
|
op: "delete" | "insert" | "update";
|
|
@@ -1693,6 +2397,8 @@ interface ShapeRowOp {
|
|
|
1693
2397
|
value?: Record<string, unknown>;
|
|
1694
2398
|
}
|
|
1695
2399
|
interface ShapePokePart {
|
|
2400
|
+
baseCheckpoint?: number;
|
|
2401
|
+
reset?: boolean;
|
|
1696
2402
|
rowsPatch: ShapeRowOp[];
|
|
1697
2403
|
shapeId: string;
|
|
1698
2404
|
}
|
|
@@ -1727,15 +2433,18 @@ declare const clampPromotionThresholds: (tUp: number, tDownRaw: number) => Promo
|
|
|
1727
2433
|
declare const relayCountFor: (subscribers: number, perRelayCapacity: number, maxRelays: number) => number;
|
|
1728
2434
|
interface RelayAttach {
|
|
1729
2435
|
relayIndex: number;
|
|
2436
|
+
seq?: number;
|
|
1730
2437
|
type: "relay_attach";
|
|
1731
2438
|
}
|
|
1732
2439
|
interface RelayDetach {
|
|
1733
2440
|
relayIndex: number;
|
|
2441
|
+
seq?: number;
|
|
1734
2442
|
type: "relay_detach";
|
|
1735
2443
|
}
|
|
1736
2444
|
interface RelayFrame {
|
|
1737
2445
|
cursor?: number;
|
|
1738
2446
|
epoch?: string;
|
|
2447
|
+
exceptConnectionId?: string;
|
|
1739
2448
|
frame: string;
|
|
1740
2449
|
originRelay?: number;
|
|
1741
2450
|
topic: string;
|
|
@@ -1753,6 +2462,12 @@ interface RelayShapeSubscribe {
|
|
|
1753
2462
|
type: "relay_shape_subscribe";
|
|
1754
2463
|
userId?: string;
|
|
1755
2464
|
}
|
|
2465
|
+
interface RelayShapeUnsubscribe {
|
|
2466
|
+
connectionId: string;
|
|
2467
|
+
relayIndex: number;
|
|
2468
|
+
subId?: string;
|
|
2469
|
+
type: "relay_shape_unsubscribe";
|
|
2470
|
+
}
|
|
1756
2471
|
interface RelayShapeSeed {
|
|
1757
2472
|
cursor?: number;
|
|
1758
2473
|
epoch?: string;
|
|
@@ -1772,10 +2487,48 @@ interface RelayShapePoke {
|
|
|
1772
2487
|
targetConnectionId?: string;
|
|
1773
2488
|
type: "relay_shape_poke";
|
|
1774
2489
|
}
|
|
1775
|
-
|
|
2490
|
+
interface RelayRoomEvent {
|
|
2491
|
+
attachment: Pick<SocketAttachment, "connectionId" | "context" | "expiresAt" | "identity" | "ip" | "revalidateAt" | "userId">;
|
|
2492
|
+
connectionId: string;
|
|
2493
|
+
data?: unknown;
|
|
2494
|
+
kind: "join" | "leave" | "message";
|
|
2495
|
+
relayIndex: number;
|
|
2496
|
+
topic: string;
|
|
2497
|
+
type: "relay_room_event";
|
|
2498
|
+
}
|
|
2499
|
+
interface RelayRoomVerdict {
|
|
2500
|
+
admitted: boolean;
|
|
2501
|
+
}
|
|
2502
|
+
interface LiveSocketControlCall {
|
|
2503
|
+
action: unknown;
|
|
2504
|
+
adminReauth?: true;
|
|
2505
|
+
callerId: string;
|
|
2506
|
+
connectionId: string;
|
|
2507
|
+
identity?: Record<string, unknown>;
|
|
2508
|
+
identityExpiry?: number;
|
|
2509
|
+
key: string;
|
|
2510
|
+
seq?: number;
|
|
2511
|
+
subscriptionId: string;
|
|
2512
|
+
}
|
|
2513
|
+
interface RelayLiveControl {
|
|
2514
|
+
control: LiveSocketControlCall;
|
|
2515
|
+
type: "relay_live_control";
|
|
2516
|
+
}
|
|
2517
|
+
interface RelayLiveFrame {
|
|
2518
|
+
frame: string;
|
|
2519
|
+
key: string;
|
|
2520
|
+
topic: string;
|
|
2521
|
+
type: "relay_live_frame";
|
|
2522
|
+
}
|
|
2523
|
+
type OwnerRelayFrame = RelayAttach | RelayDetach | RelayFrame | RelayLiveControl | RelayLiveFrame | RelayRoomEvent | RelayShapePoke | RelayShapeSubscribe | RelayShapeUnsubscribe;
|
|
2524
|
+
declare const RELAY_SIGNATURE_HEADER = "x-lunora-relay-sig";
|
|
2525
|
+
declare const siblingSecretOf: (env: unknown) => string | undefined;
|
|
2526
|
+
declare const signSiblingBody: (secret: string, body: string) => Promise<string>;
|
|
2527
|
+
declare const verifySiblingBody: (env: unknown, supplied: null | string, raw: string) => Promise<boolean>;
|
|
1776
2528
|
interface SiblingStub {
|
|
1777
2529
|
fetch: (url: string, init?: RequestInit) => Promise<Response>;
|
|
1778
2530
|
}
|
|
2531
|
+
declare const stubByName: (value: unknown, name: string, jurisdiction?: string) => SiblingStub | undefined;
|
|
1779
2532
|
declare const DEFAULT_MAX_RELAYS = 8;
|
|
1780
2533
|
interface RelayHost {
|
|
1781
2534
|
buildShapeDiff: (resolved: ResolvedShape, fromCursor: number, toCursor: number) => ShapeRowOp[];
|
|
@@ -1783,28 +2536,39 @@ interface RelayHost {
|
|
|
1783
2536
|
baseCheckpoint: number | undefined;
|
|
1784
2537
|
cursor: number;
|
|
1785
2538
|
epoch: string | undefined;
|
|
2539
|
+
reset: boolean;
|
|
1786
2540
|
rowsPatch: ShapeRowOp[];
|
|
1787
2541
|
};
|
|
1788
2542
|
currentCdcEpoch: () => string | undefined;
|
|
2543
|
+
deliverLiveLocal: (topic: string, key: string, frame: string) => number;
|
|
1789
2544
|
deliverWhisperLocal: (topic: string, frame: string, exclude: undefined | ShardSocketLike) => number;
|
|
1790
2545
|
doName: () => string | undefined;
|
|
2546
|
+
dropIfLapsed: (ws: ShardSocketLike) => boolean;
|
|
1791
2547
|
env: () => unknown;
|
|
1792
2548
|
getWebSockets: () => ShardSocketLike[];
|
|
2549
|
+
liveControl: (control: LiveSocketControlCall) => Promise<Response>;
|
|
1793
2550
|
maskMetadata: () => MaskPoliciesResult;
|
|
1794
2551
|
nextPokeId: () => string;
|
|
1795
2552
|
readAttachment: (ws: ShardSocketLike) => SocketAttachment;
|
|
1796
2553
|
recordShapePokeFanout: (iterated: number, delivered: number, elapsedMs: number) => void;
|
|
2554
|
+
relayRoomEvent: (event: RelayRoomEvent) => Promise<RelayRoomVerdict>;
|
|
1797
2555
|
resolveShape: (name: string, args: Record<string, unknown>, identity?: SubscriptionIdentity) => ResolvedShape | undefined;
|
|
1798
2556
|
rlsMetadata: () => RlsPoliciesResult;
|
|
1799
2557
|
shardBinding: () => string | undefined;
|
|
2558
|
+
shardJurisdiction: () => string | undefined;
|
|
1800
2559
|
sql: () => SqlExec;
|
|
1801
2560
|
}
|
|
2561
|
+
interface RelayPokeDelivery {
|
|
2562
|
+
delivered: number;
|
|
2563
|
+
matched: number;
|
|
2564
|
+
}
|
|
1802
2565
|
declare abstract class RelayLink {
|
|
1803
2566
|
protected readonly host: RelayHost;
|
|
1804
2567
|
protected readonly roleId: {
|
|
1805
2568
|
ownerKey: string;
|
|
1806
2569
|
relayIndex?: number;
|
|
1807
2570
|
};
|
|
2571
|
+
private lastSequence;
|
|
1808
2572
|
protected constructor(host: RelayHost, roleId: {
|
|
1809
2573
|
ownerKey: string;
|
|
1810
2574
|
relayIndex?: number;
|
|
@@ -1812,79 +2576,127 @@ declare abstract class RelayLink {
|
|
|
1812
2576
|
handleControl(request: Request): Promise<Response>;
|
|
1813
2577
|
maxRelays(): number;
|
|
1814
2578
|
protected canAddressSiblings(): boolean;
|
|
2579
|
+
protected isAdmitted(ws: ShardSocketLike): boolean;
|
|
1815
2580
|
protected siblingStub(targetName: string): SiblingStub | undefined;
|
|
2581
|
+
protected bindingName(): string | undefined;
|
|
2582
|
+
protected nextRelaySeq(): number;
|
|
1816
2583
|
protected postRelayMessage(targetName: string, message: OwnerRelayFrame): Promise<void>;
|
|
1817
2584
|
protected requestRelayMessage(targetName: string, message: OwnerRelayFrame): Promise<Response | undefined>;
|
|
1818
|
-
abstract forwardWhisper(topic: string, frame: string): Promise<void>;
|
|
2585
|
+
abstract forwardWhisper(topic: string, frame: string, exceptConnectionId?: string): Promise<void>;
|
|
1819
2586
|
abstract onFlush(changed: Set<string>, frameCursor: number): Promise<void>;
|
|
1820
2587
|
abstract seedRelayShape(ws: ShardSocketLike, subId: string, shape: ShapeSubscriptionQuery, identity: SubscriptionIdentity): Promise<"ok" | undefined | {
|
|
1821
2588
|
code: string;
|
|
1822
2589
|
message: string;
|
|
1823
2590
|
}>;
|
|
1824
|
-
abstract announce(): Promise<
|
|
2591
|
+
abstract announce(): Promise<boolean>;
|
|
1825
2592
|
abstract announceDrain(closing: ShardSocketLike): Promise<void>;
|
|
2593
|
+
abstract releaseRelayShapes(ws: ShardSocketLike, subId?: string): Promise<void>;
|
|
1826
2594
|
abstract relayCount(): number;
|
|
1827
2595
|
abstract isShapeRelayUniform(name: string, args: Record<string, unknown>): boolean;
|
|
1828
|
-
|
|
1829
|
-
protected abstract
|
|
2596
|
+
abstract minShapeCursor(): number | undefined;
|
|
2597
|
+
protected abstract onAttach(index: number, seq: number | undefined): boolean;
|
|
2598
|
+
protected abstract onDetach(index: number, seq: number | undefined): boolean;
|
|
2599
|
+
protected abstract onLiveControl(control: LiveSocketControlCall): Promise<Response>;
|
|
1830
2600
|
protected abstract onWhisperFrame(message: RelayFrame): Promise<void>;
|
|
2601
|
+
protected abstract refusesAsIdle(): boolean;
|
|
1831
2602
|
protected abstract onShapeSubscribe(message: RelayShapeSubscribe): RelayShapeSeed;
|
|
1832
|
-
protected abstract
|
|
2603
|
+
protected abstract onShapeUnsubscribe(message: RelayShapeUnsubscribe): void;
|
|
2604
|
+
protected abstract onShapePoke(poke: RelayShapePoke): RelayPokeDelivery;
|
|
1833
2605
|
}
|
|
1834
2606
|
declare class OwnerRelay extends RelayLink {
|
|
1835
2607
|
private readonly shapeUniformCache;
|
|
1836
2608
|
private relaySetCache;
|
|
1837
|
-
private
|
|
1838
|
-
private
|
|
2609
|
+
private liveGrantRelayCache;
|
|
2610
|
+
private relayTablesReady;
|
|
2611
|
+
private readonly relaySeqMarks;
|
|
2612
|
+
private readonly pendingSubscribeRelays;
|
|
2613
|
+
private registryCache;
|
|
2614
|
+
private recorded;
|
|
1839
2615
|
private promotionState;
|
|
1840
2616
|
constructor(host: RelayHost, ownerKey: string);
|
|
1841
|
-
forwardWhisper(topic: string, frame: string): Promise<void>;
|
|
2617
|
+
forwardWhisper(topic: string, frame: string, exceptConnectionId?: string): Promise<void>;
|
|
2618
|
+
forwardLiveControl(call: LiveSocketControlCall): Promise<Response | undefined>;
|
|
2619
|
+
forwardLiveFrame(topic: string, key: string, frame: string): Promise<void>;
|
|
1842
2620
|
onFlush(changed: Set<string>, frameCursor: number): Promise<void>;
|
|
1843
2621
|
seedRelayShape(): Promise<"ok" | undefined | {
|
|
1844
2622
|
code: string;
|
|
1845
2623
|
message: string;
|
|
1846
2624
|
}>;
|
|
1847
|
-
announce(): Promise<
|
|
2625
|
+
announce(): Promise<boolean>;
|
|
1848
2626
|
announceDrain(): Promise<void>;
|
|
2627
|
+
releaseRelayShapes(): Promise<void>;
|
|
1849
2628
|
relayCount(): number;
|
|
2629
|
+
minShapeCursor(): number | undefined;
|
|
1850
2630
|
isShapeRelayUniform(name: string, args: Record<string, unknown>): boolean;
|
|
1851
|
-
protected
|
|
1852
|
-
protected
|
|
2631
|
+
protected onShapeUnsubscribe(message: RelayShapeUnsubscribe): void;
|
|
2632
|
+
protected onAttach(index: number, seq: number | undefined): boolean;
|
|
2633
|
+
protected onDetach(index: number, seq: number | undefined): boolean;
|
|
2634
|
+
protected refusesAsIdle(): boolean;
|
|
2635
|
+
protected onLiveControl(control: LiveSocketControlCall): Promise<Response>;
|
|
1853
2636
|
protected onWhisperFrame(message: RelayFrame): Promise<void>;
|
|
1854
2637
|
protected onShapeSubscribe(message: RelayShapeSubscribe): RelayShapeSeed;
|
|
1855
|
-
protected onShapePoke():
|
|
2638
|
+
protected onShapePoke(): RelayPokeDelivery;
|
|
2639
|
+
private relaySeqMark;
|
|
2640
|
+
private recordRelaySeq;
|
|
2641
|
+
private acceptRelaySeq;
|
|
1856
2642
|
private buildShapePoke;
|
|
1857
2643
|
private multicastShapePokes;
|
|
2644
|
+
private multicastToRelays;
|
|
1858
2645
|
private proxyShapePokes;
|
|
2646
|
+
private proxyToRelay;
|
|
1859
2647
|
private buildShapeSeedFrames;
|
|
1860
|
-
private
|
|
2648
|
+
private ensureRelayTables;
|
|
2649
|
+
protected bindingName(): string | undefined;
|
|
2650
|
+
private relayShapes;
|
|
2651
|
+
private rewindShapeCursor;
|
|
1861
2652
|
private ownerRelaySet;
|
|
2653
|
+
private liveGrantRelaySet;
|
|
2654
|
+
private recordLiveGrantRelay;
|
|
1862
2655
|
private addRelayToSet;
|
|
2656
|
+
private forwardToRelay;
|
|
2657
|
+
private requestDroppingIdle;
|
|
1863
2658
|
private removeRelayFromSet;
|
|
1864
2659
|
private probeShapeRelayUniform;
|
|
1865
2660
|
private tableHasAnyMask;
|
|
2661
|
+
private liveControlAnswer;
|
|
1866
2662
|
}
|
|
1867
2663
|
declare class RelayMember extends RelayLink {
|
|
1868
2664
|
private relayAnnounced;
|
|
1869
|
-
private readonly
|
|
2665
|
+
private readonly liveControlSeqs;
|
|
2666
|
+
private pendingAnnounce;
|
|
2667
|
+
private announceGeneration;
|
|
2668
|
+
private pendingDetach;
|
|
2669
|
+
private relayMemoCache;
|
|
2670
|
+
private readonly shapeControl;
|
|
1870
2671
|
constructor(host: RelayHost, ownerKey: string, relayIndex: number);
|
|
1871
2672
|
forwardWhisper(topic: string, frame: string): Promise<void>;
|
|
2673
|
+
forwardRoomEvent(event: Omit<RelayRoomEvent, "relayIndex" | "type">): Promise<boolean>;
|
|
1872
2674
|
onFlush(): Promise<void>;
|
|
1873
2675
|
seedRelayShape(ws: ShardSocketLike, subId: string, shape: ShapeSubscriptionQuery, identity: SubscriptionIdentity): Promise<"ok" | {
|
|
1874
2676
|
code: string;
|
|
1875
2677
|
message: string;
|
|
1876
2678
|
}>;
|
|
1877
|
-
announce(): Promise<
|
|
2679
|
+
announce(): Promise<boolean>;
|
|
1878
2680
|
announceDrain(closing: ShardSocketLike): Promise<void>;
|
|
2681
|
+
releaseRelayShapes(ws: ShardSocketLike, subId?: string): Promise<void>;
|
|
1879
2682
|
relayCount(): number;
|
|
1880
2683
|
isShapeRelayUniform(): boolean;
|
|
1881
|
-
|
|
1882
|
-
protected
|
|
2684
|
+
minShapeCursor(): number | undefined;
|
|
2685
|
+
protected onAttach(): boolean;
|
|
2686
|
+
protected refusesAsIdle(): boolean;
|
|
2687
|
+
protected onDetach(): boolean;
|
|
2688
|
+
protected onLiveControl(control: LiveSocketControlCall): Promise<Response>;
|
|
1883
2689
|
protected onWhisperFrame(): Promise<void>;
|
|
1884
2690
|
protected onShapeSubscribe(): RelayShapeSeed;
|
|
1885
|
-
protected
|
|
2691
|
+
protected onShapeUnsubscribe(): void;
|
|
2692
|
+
protected onShapePoke(poke: RelayShapePoke): RelayPokeDelivery;
|
|
2693
|
+
private queueShapeControl;
|
|
2694
|
+
private relayMemos;
|
|
2695
|
+
private connectionMemos;
|
|
1886
2696
|
private recordRelayShapeMemo;
|
|
2697
|
+
private forgetRelayShapeMemos;
|
|
1887
2698
|
private deliverShapePoke;
|
|
2699
|
+
private pokeSocketShapes;
|
|
1888
2700
|
}
|
|
1889
2701
|
declare const createRelayLink: (host: RelayHost) => OwnerRelay | RelayMember | undefined;
|
|
1890
2702
|
declare const REGION_HINTS: readonly ["wnam", "enam", "sam", "weur", "eeur", "apac", "apac-ne", "apac-se", "oc", "afr", "me"];
|
|
@@ -1894,6 +2706,7 @@ interface ShardSiblingHost {
|
|
|
1894
2706
|
doName: () => string | undefined;
|
|
1895
2707
|
env: () => unknown;
|
|
1896
2708
|
shardBinding: () => string | undefined;
|
|
2709
|
+
shardJurisdiction: () => string | undefined;
|
|
1897
2710
|
sql: () => SqlExec;
|
|
1898
2711
|
}
|
|
1899
2712
|
interface ReplicaOwnerHost extends ShardSiblingHost {
|
|
@@ -1909,9 +2722,12 @@ interface ReplicaOwnerHost extends ShardSiblingHost {
|
|
|
1909
2722
|
}
|
|
1910
2723
|
interface ReplicaFollowerHost extends ShardSiblingHost {
|
|
1911
2724
|
applyChanges: (changes: ReadonlyArray<CdcChange>) => Promise<number>;
|
|
2725
|
+
exportRows: () => Promise<ExportRow[]>;
|
|
1912
2726
|
importRows: (rows: ReadonlyArray<ExportRow>) => Promise<{
|
|
1913
2727
|
errors: ReadonlyArray<unknown>;
|
|
1914
2728
|
}>;
|
|
2729
|
+
reportError?: (scope: string, error: unknown) => void;
|
|
2730
|
+
transactionLimits: () => Partial<TransactionLimits>;
|
|
1915
2731
|
}
|
|
1916
2732
|
declare const handleReplicaControl: (host: ReplicaOwnerHost, request: Request) => Promise<Response>;
|
|
1917
2733
|
declare class ShardReplica {
|
|
@@ -1927,8 +2743,14 @@ declare class ShardReplica {
|
|
|
1927
2743
|
private advance;
|
|
1928
2744
|
private isCaughtUp;
|
|
1929
2745
|
private catchUp;
|
|
2746
|
+
private verdict;
|
|
2747
|
+
private recover;
|
|
2748
|
+
private whenOwnerUnreachable;
|
|
1930
2749
|
private applyPage;
|
|
1931
|
-
private
|
|
2750
|
+
private applyAtomically;
|
|
2751
|
+
private fetchSnapshot;
|
|
2752
|
+
private resnapshot;
|
|
2753
|
+
private overWriteBudget;
|
|
1932
2754
|
private bootstrap;
|
|
1933
2755
|
private isFreshEnough;
|
|
1934
2756
|
private pull;
|
|
@@ -1951,14 +2773,19 @@ interface GuardableSchema {
|
|
|
1951
2773
|
readonly rlsMode?: "required";
|
|
1952
2774
|
readonly tables: Record<string, {
|
|
1953
2775
|
readonly isPublic?: boolean;
|
|
2776
|
+
readonly relationMap?: Record<string, {
|
|
2777
|
+
readonly table: string;
|
|
2778
|
+
readonly through?: {
|
|
2779
|
+
readonly table: string;
|
|
2780
|
+
};
|
|
2781
|
+
}>;
|
|
1954
2782
|
readonly shardMode?: {
|
|
1955
2783
|
readonly kind?: string;
|
|
1956
2784
|
};
|
|
1957
2785
|
}>;
|
|
1958
2786
|
}
|
|
1959
2787
|
type TableOfId = (id: string, expectedTable?: string) => Promise<string | undefined> | string | undefined;
|
|
1960
|
-
|
|
1961
|
-
declare const guardWriter: <W>(raw: W, schema: GuardableSchema, tableOfId: TableOfId, tablesOfIds?: TablesOfIds) => W;
|
|
2788
|
+
declare const guardWriter: <W>(raw: W, schema: GuardableSchema, tableOfId: TableOfId, relationEdges?: ReadonlyArray<RelationEdge>) => W;
|
|
1962
2789
|
declare const SCHEMA_HISTORY_MAX_VERSIONS = 50;
|
|
1963
2790
|
interface SchemaVersionRow {
|
|
1964
2791
|
appliedAt: number;
|
|
@@ -1969,8 +2796,24 @@ interface SchemaVersionRow {
|
|
|
1969
2796
|
declare const recordSchemaVersion: (sql: SqlExec, hash: string, snapshotJson: string, now?: number) => boolean;
|
|
1970
2797
|
declare const readSchemaHistory: (sql: SqlExec) => SchemaVersionRow[];
|
|
1971
2798
|
declare const readSchemaVersion: (sql: SqlExec, hash: string) => SchemaVersionRow | undefined;
|
|
2799
|
+
declare const readDeployInfo: (rawEnv: unknown) => DeployInfo;
|
|
1972
2800
|
declare const isDevEnvironment: (rawEnv: unknown) => boolean;
|
|
1973
2801
|
declare const buildSettings: (rawEnv: unknown) => SettingsResult;
|
|
2802
|
+
declare class ShapeDiffCache {
|
|
2803
|
+
private readonly keyScans;
|
|
2804
|
+
private readonly memberProbes;
|
|
2805
|
+
private run;
|
|
2806
|
+
private served;
|
|
2807
|
+
get probesRun(): number;
|
|
2808
|
+
get probesServed(): number;
|
|
2809
|
+
changedKeys(rangeKey: string, load: () => CdcChangeKey[]): ReadonlyArray<CdcChangeKey>;
|
|
2810
|
+
members(resolved: ResolvedShape, rangeKey: string, load: () => Map<string, Record<string, unknown>>): ReadonlyMap<string, Record<string, unknown>>;
|
|
2811
|
+
private getOrLoad;
|
|
2812
|
+
}
|
|
2813
|
+
declare const createShapeDiffCache: () => ShapeDiffCache;
|
|
2814
|
+
declare const globalShapeReadKey: (resolved: ResolvedShape, identity: SubscriptionIdentity) => string | undefined;
|
|
2815
|
+
type ReadShapeCdcKeys = (sql: SqlExec, table: string, sinceSeq: number, upTo: number) => CdcChangeKey[];
|
|
2816
|
+
declare const buildShapeDiff: (sql: SqlExec, resolved: ResolvedShape, sinceSeq: number, upTo: number, cache: ShapeDiffCache, readKeys?: ReadShapeCdcKeys) => ShapeRowOp[];
|
|
1974
2817
|
interface ShardRunnerOptions {
|
|
1975
2818
|
handlers?: {
|
|
1976
2819
|
handleAlarm?: () => Promise<void>;
|
|
@@ -1986,7 +2829,7 @@ declare class ShardRunner {
|
|
|
1986
2829
|
socketFor(raw: unknown): ShardSocketLike;
|
|
1987
2830
|
sockets(tag?: string): SocketHandle[];
|
|
1988
2831
|
background(work: Promise<unknown>): boolean;
|
|
1989
|
-
runInTransaction<T>(work: () => Promise<T
|
|
2832
|
+
runInTransaction<T>(work: () => Promise<T>, onCommitted?: () => void): Promise<T>;
|
|
1990
2833
|
handleFetch(request: Request): Promise<Response>;
|
|
1991
2834
|
handleAlarm(): Promise<void>;
|
|
1992
2835
|
}
|
|
@@ -2012,6 +2855,13 @@ interface SqlDiagnostic {
|
|
|
2012
2855
|
source: "gate" | "plan" | "syntax";
|
|
2013
2856
|
}
|
|
2014
2857
|
declare const lintReadonlySql: (sql: SqlExec, query: string) => SqlLintResult;
|
|
2858
|
+
declare const BIGINT_KEY_DIGITS = 39;
|
|
2859
|
+
declare const bigintSqlKey: (value: bigint) => string;
|
|
2860
|
+
declare const decodeBigintSqlKey: (raw: string) => bigint | undefined;
|
|
2861
|
+
declare const float64SqlKey: (value: number) => string;
|
|
2862
|
+
declare const decodeFloat64SqlKey: (raw: string) => number | undefined;
|
|
2863
|
+
declare const DELTA_PLACEHOLDER_TABLE = "__lunora__";
|
|
2864
|
+
declare const deltaTableFor: (tables: Iterable<string>) => string;
|
|
2015
2865
|
declare const subscriptionListDeltas: (previousJson: string, nextResult: unknown, table: string, frames?: string[]) => MutationDelta[] | undefined;
|
|
2016
2866
|
interface FrameSink {
|
|
2017
2867
|
send: (data: string) => void;
|
|
@@ -2020,7 +2870,18 @@ interface DrainableSink {
|
|
|
2020
2870
|
readonly bufferedAmount?: unknown;
|
|
2021
2871
|
}
|
|
2022
2872
|
declare const trySendFrame: (ws: FrameSink, frame: string) => boolean;
|
|
2023
|
-
|
|
2873
|
+
interface SubscriptionFrameInput {
|
|
2874
|
+
cursorSuffix: string;
|
|
2875
|
+
diffKey?: object;
|
|
2876
|
+
lastMutationId?: number;
|
|
2877
|
+
nextResult: unknown;
|
|
2878
|
+
pageDeltas?: boolean;
|
|
2879
|
+
previousJson?: string;
|
|
2880
|
+
snapshotJson: string;
|
|
2881
|
+
subId: string;
|
|
2882
|
+
table: string;
|
|
2883
|
+
}
|
|
2884
|
+
declare const subscriptionFrames: (input: SubscriptionFrameInput) => string[];
|
|
2024
2885
|
declare const awaitWsDrain: (ws: DrainableSink) => Promise<void>;
|
|
2025
2886
|
interface SubscriptionReadFootprint {
|
|
2026
2887
|
ranges?: Map<string, KeyRange[]>;
|
|
@@ -2048,13 +2909,32 @@ declare const selectExpiredIds: (sql: SqlExec, spec: TtlSweepSpec, now: number,
|
|
|
2048
2909
|
hasMore: boolean;
|
|
2049
2910
|
ids: string[];
|
|
2050
2911
|
};
|
|
2051
|
-
|
|
2052
|
-
|
|
2053
|
-
|
|
2054
|
-
|
|
2055
|
-
|
|
2056
|
-
|
|
2057
|
-
|
|
2912
|
+
declare const isTtlExpired: (sql: SqlExec, spec: TtlSweepSpec, id: string, now: number) => boolean;
|
|
2913
|
+
declare const nextTtlExpiry: (sql: SqlExec, spec: TtlSweepSpec) => number | undefined;
|
|
2914
|
+
declare const VECTOR_BACKFILL_MAX_PAGES = 20;
|
|
2915
|
+
interface VectorBackfillTarget {
|
|
2916
|
+
profile: string;
|
|
2917
|
+
table: string;
|
|
2918
|
+
}
|
|
2919
|
+
interface VectorBackfillProgress {
|
|
2920
|
+
done: boolean;
|
|
2921
|
+
error?: string;
|
|
2922
|
+
failed: number;
|
|
2923
|
+
failedIds: string[];
|
|
2924
|
+
pages: number;
|
|
2925
|
+
rows: number;
|
|
2058
2926
|
}
|
|
2059
|
-
|
|
2060
|
-
|
|
2927
|
+
type VectorPageSync = (table: string, rows: ReadonlyArray<{
|
|
2928
|
+
doc: Record<string, unknown>;
|
|
2929
|
+
id: string;
|
|
2930
|
+
}>) => Promise<ReadonlyArray<{
|
|
2931
|
+
error: unknown;
|
|
2932
|
+
id: string;
|
|
2933
|
+
}>>;
|
|
2934
|
+
type OrderedAfterWrites = <T, U>(read: () => T, work: (value: T) => Promise<U>) => Promise<U>;
|
|
2935
|
+
declare const backfillVectorIndexes: (sql: SqlExec, targets: ReadonlyArray<VectorBackfillTarget>, sync: VectorPageSync, options: {
|
|
2936
|
+
maxPages?: number;
|
|
2937
|
+
ordered: OrderedAfterWrites;
|
|
2938
|
+
restart?: boolean;
|
|
2939
|
+
}) => Promise<VectorBackfillProgress>;
|
|
2940
|
+
export { ADMIN_FUNCTIONS, ADMIN_FUNCTION_PREFIX, ADMIN_TOKEN_TABLE, ADMIN_WILDCARD, AGGREGATE_SQL_FUNCTION, AGG_COUNT, AGG_KEY, AGG_VALUE, AUDIT_LOG_TABLE, type AdminTokenSummary, type AdvisorProcedure, type AdvisoriesResult, type AdvisoryFinding, type AggregateIndexDefinitionLike, type AggregateOp, type AggregateOptions, type AggregateResult, type AggregateTally, type AppendAuditEntry, type ApplyOnDeleteOptions, type AuditEntry, type AuditLogResult, BIGINT_KEY_DIGITS, type BroadcastDelta, CDC_LOG_TABLE, CDC_LOG_TABLE_SEQ_INDEX, CDC_META_TABLE, CLIENT_WATERMARK_TABLE, COMMIT_SEQ_FIELD, COMMIT_SEQ_TABLE, CURSOR_PREFIX, type CacheEntry, type CapturedMailRow, type CdcArchiveScope, type CdcChange, type CdcChangeKey, type ChangedKeys, type Clock, type ColumnMeta, type ColumnMetaLike, CompanionMemo, type CompanionSync, type CompanionSyncDeps, ConflictError, type ConflictKind, type CountArgs, CountRlsUnsupportedError, type CreateWorkflowInstanceResult, type CrossShardCountArgs, type CrossShardReadArgs, type CtxDbOptions, DATA_MIGRATION_STATE_TABLE, DEFAULT_FANOUT_TOPIC_LIMIT, DEFAULT_MAX_RELATION_KEYS, DEFAULT_MAX_RELAYS, DEFAULT_PROMOTION_THRESHOLDS, DEFAULT_TRANSACTION_LIMITS, DELTA_PLACEHOLDER_TABLE, DOC_COLUMN, type DataMigrationDocument, type DataMigrationLike, type DataMigrationTransform, type DatabaseWriterLike, type DependencyTracker, type DeployInfo, type DurableAttachDecision, type DurableStreamAttach, type DurableStreamRun, DurableStreamRunner, type DurableStreamSink, type ExportRow, type ExportShardAdminArgs, type ExportShardArgs, type ExternalSourceDiffResult, type ExternalSourceLike, FLAGS_FUNCTION_PREFIX, type FacetColumnOptions, type FacetColumnResult, type FacetValue, type FanOutBudget, type FanoutMetricsResult, type FanoutPathCounters, type FanoutTopicStat, type FieldOperators, type FilterClause, type FilterOperator, type FlagEvaluation, type FlagsResult, type FtsWriteOptions, type FunctionCallStat, type FunctionScanAttribution, type FunctionStatsResult, GEO_DEFAULT_PRECISION, GLOBAL_SHAPE_SNAPSHOT_TABLE, type GeoBoundingBox, type GeoFilterBuilderLike, type GeoIndexDefinitionLike, type GeoPoint, type GeoScoredDocument, type GlobalPollCounters, GlobalPollTick, type GroupByEntry, type GroupByOptions, type GuardableSchema$1 as GuardableSchema, IDEMPOTENCY_TABLE, IMPORT_MANIFEST_TTL_MS, IMPORT_STAGE_TTL_MS, type IdGenerator, type IdempotentRecord, type ImportConflictMode, type ImportError, type ImportManifest, type ImportRow, type ImportShardAdminArgs, type ImportShardArgs, type ImportShardResult, type ImportStepResult, type IncrementalMaterializeResult, type IndexDefinitionLike, type IndexKeyEntry, type IndexRangeBuilderLike, type KeyRange, type KeyedRelationWriteInfo, type LifecycleDispatchInfo, type LifecycleEvent, type LiveSocketControlCall, MAIL_RETENTION, MAIL_TABLE, MAX_DURABLE_STREAM_BYTES, MAX_DURABLE_STREAM_CHUNKS, MAX_PAGE_SIZE, MAX_SQL_ROWS, type ManifestChange, type ManifestTouch, type MaskColumnMetadata, type MaskPoliciesResult, type MaterializeResult, type MigrationDirection, type MigrationRunResult, type MigrationStatus, type MigrationStatusRow, type MutationDelta, type NestedWith, NotFoundError, NotUniqueError, type NullPlacement, type OnDeleteActionLike, type OrderByClause, type OrderByInput, type OrderKey, type OrderKeyConstraints, OwnerRelay, type OwnerRelayFrame, type PaginationOptions, type PatchVerifier, type PatchWriteOptions, type PitrBookmarkResult, type PitrRestoreArgs, type PitrRestoreResult, type PitrStorage, type PokeFrameMeta, type PromotionState, type PromotionThresholds, QUEUE_TABLE, type QueryArgs, type QueryPage, type QueryPlan, type QueueMessageOutcome, type QueueMessageRow, type QueueMetadata, type QueuesResult, RANK_TIEBREAK, REACTOR_STATE_TABLE, RELATED_DEFAULT_LIMIT, RELATED_DEPTH_DECAY, RELATED_MAX_DEPTH, RELATED_MAX_LIMIT, RELATION_EXISTS_KEY, RELATION_FUNCTION_PREFIX, RELAY_SIGNATURE_HEADER, REPROJECTION_MIGRATION_PREFIX, RLS_UNWRAP_SYMBOL, type RangeOperandType, type RankBeforeOptions, type RankBeforeResult, type RankDirection, type RankIndexDefinitionLike, type RankOptions, type RankPage, type RankPageComputation, type RankPageDeps, type RankPageOptions, type RankPageRow, type RankPageRowKey, type RankResult, type RankSortKeyLike, ReactiveCache, type ReactiveCacheOptions, type ReactorDispatchResult, type ReactorMetadata, type ReactorState, type ReactorStats, type ReactorsResult, type ReadFootprint, type ReadHook, type ReadTablePageOptions, type RecordMailInput, type RecordQueueMessageInput, type RelatedDirection, type RelatedNode, type RelatedOptions, type RelatedPage, type RelatedStart, type RelatedStartReference, type RelationDefinitionLike, type RelationEdge, type RelationExistsMarker, type RelationGraphReader, type RelationWriteInfo, type RelationWriteMap, type RelayAttach, type RelayDetach, type RelayFrame, type RelayHost, RelayMember, type RelayPokeDelivery, type RelayRoomEvent, type RelayRoomVerdict, type RelayShapePoke, type RelayShapeSeed, type RelayShapeSubscribe, type RelayShapeUnsubscribe, type RenderedSql, type ReplicaFollowerHost, type ReplicaOwnerHost, type ReplicaReadiness, type ResolveRelationPredicatesOptions, type ResolveWithOptions, type ResolveWithResult, type ResolvedShape, type RestrictableQueryOptions, type RlsPoliciesResult, type RlsPolicyMetadata, RlsRequiredError, type RlsRoleMetadata, type RpcRequest, type RunDataMigrationOptions, type RunTriggersOptions, SCAN_DEP, SCHEDULE_OUTBOX_TABLE, SCHEMA_HISTORY_MAX_VERSIONS, SEARCH_STATE_TABLE, SHAPE_POKE_CURSOR_TABLE, type SchedulableWorkflowReferenceLike, type ScheduleOutbox, type ScheduleOutboxEntry, type ScheduleOutboxEnvelope, type ScheduleOutboxRow, type ScheduledFunctionDoc, type SchedulerLike, type SchemaLike, type ScoredDocument, type SearchBackfillProgress, type SearchFilterBuilderLike, type SearchIndexDefinitionLike, type SearchScoredDocument, type SelectMatchingIdsOptions, type ServerDefaultContextLike, type SettingEntry, type SettingKind, type SettingsResult, ShapeDiffCache, type ShapePokeCursorRow, type ShapePokePart, type ShapeProbeCounters, type ShapeRow, type ShapeRowOp, type ShapeSubscriptionQuery, type ShardRankPageResult, ShardRunner, type ShardRunnerOptions, type ShardSiblingHost, type ShardSocketLike, type SocketAttachment, type SortDirection, type SourceClientLike, type SourceCursorLike, type SourceRefresh, type SqlConsoleResult, type SqlCursor, type SqlEngine, type SqlExec, type SqlLintResult, type StagedImportRow, type StorageMetadata, type StorageReference, type StorageReferenceResult, type StorageRuleMetadata, type StorageRulesResult, type StudioFeaturesResult, type SubscriptionConnection, type SubscriptionEnvelope, type SubscriptionIdentity, type SubscriptionInfo, type SubscriptionQuery, type SubscriptionReadFootprint, type SubscriptionsResult, type SystemDatabaseReader, type SystemDoc, type SystemQuery, type SystemReaderOptions, type SystemReaderSchedulerLike, type SystemReaderStorageLike, type SystemTableName, type TableColumnsResult, type TableDefinitionLike, type TableIndexInfo, type TableIndexesResult, type TableInfo, type TablePage, type TableReaderLike, type TablesColumnsResult, type TablesIndexesResult, type ThroughRelationWriteInfo, type TransactionHeadroom, TransactionHeadroomTracker, type TransactionLimitKind, type TransactionLimitWarning, type TransactionLimits, type TransactionSqlLike, type TriggerContextLike, type TriggerDefinitionLike, type TriggerEventLike, type TriggerOpLike, type TriggerTimingLike, type TtlSweepSpec, UNVOUCHABLE_DEP, VECTOR_BACKFILL_MAX_PAGES, type ValidatorLike, type VectorBackfillProgress, WORKERD_SQLITE_LIMITS, type WhereFilter, type WhereInput, type WhereSqlStrategy, type WithInput, type WorkflowInstanceState, type WorkflowInstanceStatusResult, type WorkflowMetadata, type WorkflowsResult, type WriteEvent, type WriteHook, adminTokenExists, advanceClientWatermark, advanceImportManifest, aggUpsertSql, aggregateSqlFunction, aggregateTableName, allocateCommitSeq, appendAuditEntry, appendCdcChange, appendStreamChunk, applyCdcChanges, applyInsertDefaults, applyOnDelete, applySelect, archiveCdcSegment, armRestore, assertFlatPredicate, assertImportSessionId, assertNoExplicitUndefined, assertPatchAllowed, assertReadonly, assertShapeShardable, assertStorableRowId, assertValidClientId, awaitWsDrain, backfillAggregateIndexes, backfillRankIndexes, backfillSearchIndexes, backfillSearchIndexesForTable, backfillVectorIndexes, bigintSqlKey, boundingBoxCenter, boundingBoxGeohashes, buildIndexRange, buildPokeFrames, buildReprojectionMigration, buildSeekBeforeWhere, buildSeekWhere, buildSettings, buildShapeDiff, bumpCdcEpoch, cdcArchiveRewound, cdcCanVouchFor, cdcForkedError, cdcSeqLeavingRows, cdcTouchesTables, cdcTrimmedError, claimStreamRun, clampPromotionThresholds, clearCapturedMail, clearCompanionSignatures, clearMemoryTables, clearQueueMessages, coerceAggregateNumber, compactCdcDocs, compileWhereSql, composeReadPredicate, computeRankPage, containsRelationPredicate, countLegacyRows, coveringGeohashes, createAdminTokenRecord, createCompanionSync, createDependencyTracker, createFanoutCounters, createGlobalPollCounters, createIndexSql, createReadFootprint, createRelayLink, createReplicaLink, createShapeDiffCache, createShapeProbeCounters, createShardCtxDb, createSystemReader, cursorBelowRetainedFloor, decideDurableAttach, decodeBigintSqlKey, decodeCursor, decodeFloat64SqlKey, deferScheduleOutbox, deleteGlobalShapeSnapshot, deleteGlobalShapeSnapshotsForConnection, deleteShapePokeCursor, deleteShapePokeCursorsForConnection, deleteStreamRun, deltaTableFor, depKey, deriveRelationEdges, describeRelationWrites, diffExternalSource, diffGlobalMembership, distinctValues, dropImportManifest, dropImportSession, dropScheduleOutbox, encodeAggregateKey, encodeCursor, encodeGeohash, encodePartitionKey, encodeRowsPatch, ensureAuditTable, ensureMailTable, envOptionalPositiveInt, envPositiveInt, equalityPinnedFields, exportShardRows, facetColumn, fanOutScalarCounts, findManyPage, findRelated, findStorageReferences, finishStreamRun, float64SqlKey, foldAggregateTally, forgetScheduleOutbox, ftsCompanionDdl, ftsPurgeDocument, ftsRowidMapName, ftsUnmappedPage, ftsWriteDocument, gateReplicaDispatch, geoTableName, globalShapeReadKey, groupUnmappedRows, guardWriter, handleReplicaControl, hasScheduleOutboxEntry, hasTrigger, haversineMeters, importShardRows, indexKeysForRow, isDevEnvironment, isFtsAvailable, isInternalTableName, isLossyBody, isMemoryTable, isPushableWhere, isRelationPredicate, isSoftDeleted, isSourceDue, isTtlExpired, isVacuousFilterClause, jsonPath, jsonPathSql, keysTouchRanges, liftSourceId, lintReadonlySql, listAdminTokens, listReactorStates, listTables, markShardImportCommitted, markUnvouchableReads, matchesRankStaticWhere, matchesStaticWhere, materializeExternalRows, materializeExternalRowsIncremental, memoryTableNames, mergeChangedKeys, mergeWhere, migrateCdcLog, migrateCdcMeta, migrateClientWatermark, migrateCommitSeq, migrateDurableStreams, migrateGlobalShapeSnapshot, migrateIdempotency, migrateReactorState, migrateScheduleOutbox, migrateSearchState, migrateShapePokeCursor, minCdcReplayableSeq, minCdcSeq, minShapePokeCursor, nextPromotionState, nextTtlExpiry, normalizeCountArgument, normalizeIdStructurally, normalizeOrderKeys, normalizeSourceDocument, normalizeSourceValue, nullsFirstOf, nullsOrderSuffix, operatorFields, param, parkScheduleOutbox, parseExportShardArgs, parseImportShardArgs, patchDependsOnRow, planAggregateLookup, pointInBoundingBox, probeScheduleOutbox, projectColumns, pullExternalSourceIncrementalTick, pullExternalSourceTick, qualifiedJsonPath, qualifiedJsonPathSql, quoteIdentifier, rankKeyFromDocument as rankKeyFromDoc, rankPivotConditionSql, rankTableName, reactiveCacheKey, reactorNeedsRun, readAggregateValue, readArchivedCdcChanges, readAuditLog, readBookmark, readCapturedMail, readCdcArchivedThrough, readCdcChangeKeys, readCdcChanges, readCdcCursor, readCdcEpoch, readClientWatermark, readCommitSeq, readDeployInfo, readDueScheduleOutbox, readDueScheduleOutboxEntry, readExternalSourceBaseline, readGlobalShapeSnapshot, readIdempotent, readImportManifest, readMigrationStatus, readPatchField, readQueueMessageById, readQueueMessages, readReactorState, readScheduleOutbox, readScheduleOutboxState, readSchemaHistory, readSchemaVersion, readSearchBackfillState, readShapePokeCursor, readShardImportSession, readStreamChunks, readStreamRun, readTablePage, recordCapturedMail, recordChangedKeys, recordFanoutPass, recordGlobalPollPass, recordQueueMessages, recordScheduleOutbox, recordSchemaVersion, recordShapeProbePass, relationHooks, relayCountFor, renderSql, replaceRefusal, reprojectableFields, reprojectionMigrationId, reprojectionTables, requeueScheduleOutbox, resolvePatch, resolveRankPartition, resolveRankSeekTuple, resolveRelationPredicates, resolveWith, revokeAdminTokenRecord, rowToDocument, runDataMigration, runDrizzle, runExternalSourceTick, runReadonlySql, runRowValidators, runShardMigrations, runSocketPool, runSql, runTriggers, selectExpiredIds, selectExportTables, selectIndexForAggregate, selectIndexForCount, selectIndexForGroupBy, selectMatchingIds, selectShapeMembers, selectShapeRows, serializeSqlValue, serverInList, shapeRoutingKey, siblingSecretOf, signSiblingBody, softDeleteScope, sortColumnName, sqliteInList, stageImportRows, stagedImportIds, stagedImportPage, stripReservedPatchFields, stubByName, subscriptionFrames, subscriptionListDeltas, summarizeFanoutTopics, summarizeSubscriptions, sweepImportStaging, tableColumns, tableFromDepKey, throwingScheduler, tiebreakDirectionFor, touchImportManifest, touchShardImportSession, trimCdcChanges, trimIdempotent, trimScheduleOutbox, trimStreamRuns, tryRowToDocument, trySendFrame, unionAll, uniqueIndexFields, validateImportRow, verifyAdminTokenDigest, verifySiblingBody, whereFilter, whereOfFilter, writeCdcArchivedThrough, writeGlobalShapeSnapshot, writeIdempotent, writeReactorState, writeSearchBackfillState, writeShapePokeCursor, writeShapePokeCursors, writeTouchesMemo };
|