@lunora/shard-engine 1.0.0-alpha.18 → 1.0.0-alpha.181
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/dist/conformance/index.mjs +1 -1
- package/dist/index.d.mts +916 -188
- package/dist/index.d.ts +916 -188
- package/dist/index.mjs +1 -1
- package/dist/packem_shared/ADMIN_FUNCTIONS-CgMPqUvK.mjs +1 -0
- package/dist/packem_shared/AGGREGATE_SQL_FUNCTION-C_ZipS9R.mjs +1 -0
- package/dist/packem_shared/AGG_COUNT-BkqKHbcG.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-CTkXVeJx.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-6offuG6M.mjs +1 -0
- package/dist/packem_shared/CompanionMemo-BXU5vfak.mjs +1 -0
- package/dist/packem_shared/CountRlsUnsupportedError-BvsDqfO2.mjs +1 -0
- package/dist/packem_shared/DATA_MIGRATION_STATE_TABLE-CFvBS9-M.mjs +31 -0
- package/dist/packem_shared/DEFAULT_MAX_RELATION_KEYS-DQkJExDV.mjs +1 -0
- package/dist/packem_shared/DEFAULT_MAX_RELAYS-B66neS_B.mjs +8 -0
- package/dist/packem_shared/DEFAULT_PROMOTION_THRESHOLDS-VU44O5kq.mjs +1 -0
- package/dist/packem_shared/DEFAULT_TRANSACTION_LIMITS-Dmj5VBrV.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-COrgeP3O.mjs +7 -0
- package/dist/packem_shared/MAIL_RETENTION-DMolrLYt.mjs +18 -0
- package/dist/packem_shared/MAX_SQL_ROWS-eRignWyO.mjs +4 -0
- package/dist/packem_shared/MAX_TOKEN_LENGTH-iFEGEcDL-DBPC6ZWl.mjs +1 -0
- package/dist/packem_shared/NotUniqueError-Dn6Cj7W1.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-CVqN4JEu.mjs +1 -0
- package/dist/packem_shared/RELATION_EXISTS_KEY-wxgj6rSL.mjs +1 -0
- package/dist/packem_shared/RELAY_SIGNATURE_HEADER-DP0glzE_.mjs +1 -0
- package/dist/packem_shared/REPROJECTION_MIGRATION_PREFIX-Czcb6_mO.mjs +1 -0
- package/dist/packem_shared/RLS_UNWRAP_SYMBOL-H6J96vgK.mjs +1 -0
- package/dist/packem_shared/ReactiveCache-Cy7oH_7w.mjs +1 -0
- package/dist/packem_shared/SCAN_DEP-D7qE3iUe.mjs +1 -0
- package/dist/packem_shared/SCHEDULE_OUTBOX_TABLE-DcZI7Yhl.mjs +11 -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/UNVOUCHABLE_DEP-Ds9gxVqs.mjs +1 -0
- package/dist/packem_shared/VECTOR_BACKFILL_MAX_PAGES-UY0toTIR.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/aggregateTableName-B_CtIQCS.mjs +1 -0
- package/dist/packem_shared/appendStreamChunk-BZYgGE9Y.mjs +17 -0
- package/dist/packem_shared/applyInsertDefaults-BJo578fn.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/awaitWsDrain-DMcWBQ7I.mjs +1 -0
- package/dist/packem_shared/backfillAggregateIndexes-CRNxxM19.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-DAh1inpL.mjs +1 -0
- package/dist/packem_shared/buildSettings-BRkZd6_E.mjs +1 -0
- package/dist/packem_shared/buildShapeDiff-CCpH5fNc.mjs +1 -0
- package/dist/packem_shared/clearMemoryTables-aMRERF0w.mjs +1 -0
- package/dist/packem_shared/compileWhereSql-TgKZIvWM.mjs +1 -0
- package/dist/packem_shared/computeRankPage-BZIpATcs.mjs +1 -0
- package/dist/packem_shared/createCompanionSync-qhvw6wyL.mjs +1 -0
- package/dist/packem_shared/createReplicaLink-D0YNQDzD.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-DKON0Z5G.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-RROYQPCM.mjs +1 -0
- package/dist/packem_shared/effective-kind-BmG_zCAy.mjs +1 -0
- package/dist/packem_shared/envOptionalPositiveInt-D2pY-c64.mjs +1 -0
- package/dist/packem_shared/estimate-bytes-_k74s6LZ.mjs +1 -0
- package/dist/packem_shared/exportShardRows-CZh4wrvI.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-QCy5JKnY.mjs +9 -0
- package/dist/packem_shared/isTtlExpired-BmiUp7MF.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-BakYlgvb.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-DOiPunti.mjs +5 -0
- package/dist/packem_shared/runSocketPool-CZJ2X9cF.mjs +1 -0
- package/dist/packem_shared/selectShapeMembers-BhK79123.mjs +1 -0
- package/dist/packem_shared/serializeSqlValue-DeoBMpZ2.mjs +1 -0
- package/dist/packem_shared/stubByName-B8cFYipA.mjs +1 -0
- package/dist/packem_shared/where-sql-BjY4rnqb.mjs +1 -0
- package/package.json +5 -4
- 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-sPcXaWFW.mjs +0 -1
- package/dist/packem_shared/DEFAULT_MAX_RELAYS-CPBmX1FO.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-BItFDsAw.mjs +0 -1
- package/dist/packem_shared/QUEUE_TABLE-DgBqWrXX.mjs +0 -17
- package/dist/packem_shared/RANK_TIEBREAK-DYDRmLKH.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-DV-K7ft2.mjs +0 -1
- package/dist/packem_shared/applyOnDelete-BB6tr2G0.mjs +0 -1
- package/dist/packem_shared/applySelect-i17LYhIU.mjs +0 -1
- package/dist/packem_shared/awaitWsDrain-Bp2jKzIb.mjs +0 -1
- package/dist/packem_shared/backfillAggregateIndexes-tK0jrl43.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-CRFgJbuz.mjs +0 -1
- package/dist/packem_shared/createCompanionSync-Gp-AesYj.mjs +0 -1
- package/dist/packem_shared/createReadFootprint-DIrrxRTE.mjs +0 -1
- package/dist/packem_shared/createSystemReader-DcDcrtM3.mjs +0 -1
- package/dist/packem_shared/ctx-db-companions-CAJOSdN-.mjs +0 -1
- package/dist/packem_shared/defineEngineContractSuite-CZccUN4c.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-n2dKcH5E.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/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,89 @@ 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
|
+
clientId?: string;
|
|
164
|
+
connected?: boolean;
|
|
165
|
+
connectionId?: string;
|
|
166
|
+
context?: Record<string, unknown>;
|
|
167
|
+
deliveryPermits?: Record<string, {
|
|
168
|
+
epoch: number;
|
|
169
|
+
scope: string;
|
|
170
|
+
}>;
|
|
171
|
+
expiresAt?: number;
|
|
172
|
+
identity?: Record<string, unknown>;
|
|
173
|
+
ip?: string;
|
|
174
|
+
liveGrants?: Record<string, string>;
|
|
175
|
+
pageDeltas?: boolean;
|
|
176
|
+
pendingSince?: number;
|
|
177
|
+
refreshBatch?: boolean;
|
|
178
|
+
revalidateAt?: number;
|
|
179
|
+
shapes?: Record<string, ShapeSubscriptionQuery>;
|
|
180
|
+
socketFunction?: string;
|
|
181
|
+
socketPath?: string;
|
|
182
|
+
subs: Record<string, SubscriptionQuery>;
|
|
183
|
+
userId?: string;
|
|
184
|
+
whispers?: string[];
|
|
185
|
+
}
|
|
186
|
+
interface ResolvedShape {
|
|
187
|
+
columns?: ReadonlyArray<string>;
|
|
188
|
+
effectiveWhere?: WhereInput;
|
|
189
|
+
global?: boolean;
|
|
190
|
+
table: string;
|
|
191
|
+
}
|
|
192
|
+
interface SubscriptionIdentity {
|
|
193
|
+
identity?: Record<string, unknown>;
|
|
194
|
+
ip?: string;
|
|
195
|
+
userId?: string;
|
|
196
|
+
}
|
|
197
|
+
interface ShardSocketLike {
|
|
198
|
+
readonly bufferedAmount?: number;
|
|
199
|
+
close?: (code?: number, reason?: string) => void;
|
|
200
|
+
deserializeAttachment?: () => unknown;
|
|
201
|
+
send: (data: string) => void;
|
|
202
|
+
serializeAttachment?: (value: unknown) => void;
|
|
203
|
+
}
|
|
89
204
|
type AggregateOp = "avg" | "count" | "max" | "min" | "sum";
|
|
90
205
|
interface AggregateIndexDefinitionLike {
|
|
91
206
|
readonly by?: ReadonlyArray<string>;
|
|
@@ -137,6 +252,11 @@ interface ColumnMetaLike {
|
|
|
137
252
|
interface ValidatorLike {
|
|
138
253
|
readonly _meta?: {
|
|
139
254
|
readonly column?: ColumnMetaLike;
|
|
255
|
+
readonly inner?: ValidatorLike;
|
|
256
|
+
readonly members?: ReadonlyArray<ValidatorLike>;
|
|
257
|
+
readonly shape?: Readonly<Record<string, ValidatorLike>>;
|
|
258
|
+
readonly tableName?: string;
|
|
259
|
+
readonly value?: unknown;
|
|
140
260
|
};
|
|
141
261
|
readonly kind?: string;
|
|
142
262
|
readonly parse?: (value: unknown) => unknown;
|
|
@@ -144,7 +264,7 @@ interface ValidatorLike {
|
|
|
144
264
|
type TriggerTimingLike = "after" | "before";
|
|
145
265
|
type TriggerOpLike = "delete" | "insert" | "update";
|
|
146
266
|
interface SchedulableWorkflowReferenceLike {
|
|
147
|
-
readonly
|
|
267
|
+
readonly className?: string;
|
|
148
268
|
readonly isLunoraWorkflow: true;
|
|
149
269
|
readonly name?: string;
|
|
150
270
|
}
|
|
@@ -178,11 +298,18 @@ interface SchemaLike {
|
|
|
178
298
|
readonly rlsMode?: "required";
|
|
179
299
|
readonly tables: Record<string, TableDefinitionLike>;
|
|
180
300
|
}
|
|
301
|
+
type PatchVerifier = (previous: Record<string, unknown>, next: Record<string, unknown>) => boolean;
|
|
302
|
+
interface PatchWriteOptions {
|
|
303
|
+
verify?: PatchVerifier;
|
|
304
|
+
}
|
|
181
305
|
interface TableDefinitionLike {
|
|
182
306
|
readonly aggregateIndexes?: ReadonlyArray<AggregateIndexDefinitionLike>;
|
|
307
|
+
readonly commitOrderedMode?: boolean;
|
|
308
|
+
readonly dropStalePatchesMode?: boolean;
|
|
183
309
|
readonly geoIndexes?: ReadonlyArray<GeoIndexDefinitionLike>;
|
|
184
310
|
readonly indexes: ReadonlyArray<IndexDefinitionLike>;
|
|
185
311
|
readonly isPublic?: boolean;
|
|
312
|
+
readonly memoryMode?: boolean;
|
|
186
313
|
readonly rankIndexes?: ReadonlyArray<RankIndexDefinitionLike>;
|
|
187
314
|
readonly relationMap?: Record<string, RelationDefinitionLike>;
|
|
188
315
|
readonly searchIndexes?: ReadonlyArray<SearchIndexDefinitionLike>;
|
|
@@ -200,13 +327,25 @@ interface TableDefinitionLike {
|
|
|
200
327
|
field: string;
|
|
201
328
|
};
|
|
202
329
|
}
|
|
203
|
-
interface
|
|
330
|
+
interface KeyedRelationDefinitionLike {
|
|
204
331
|
readonly field: string;
|
|
205
332
|
readonly kind: "many" | "one";
|
|
206
333
|
readonly onDelete?: OnDeleteActionLike;
|
|
207
334
|
readonly references: string;
|
|
208
335
|
readonly table: string;
|
|
336
|
+
readonly through?: never;
|
|
337
|
+
}
|
|
338
|
+
interface RelationThroughLike {
|
|
339
|
+
readonly from: string;
|
|
340
|
+
readonly table: string;
|
|
341
|
+
readonly to: string;
|
|
209
342
|
}
|
|
343
|
+
interface ThroughRelationDefinitionLike {
|
|
344
|
+
readonly kind: "many";
|
|
345
|
+
readonly table: string;
|
|
346
|
+
readonly through: RelationThroughLike;
|
|
347
|
+
}
|
|
348
|
+
type RelationDefinitionLike = KeyedRelationDefinitionLike | ThroughRelationDefinitionLike;
|
|
210
349
|
type OnDeleteActionLike = "cascade" | "restrict" | "set null";
|
|
211
350
|
interface NestedWith {
|
|
212
351
|
limit?: number;
|
|
@@ -219,13 +358,11 @@ interface WithInput {
|
|
|
219
358
|
[relationName: string]: NestedWith | Record<string, true> | boolean | undefined;
|
|
220
359
|
_count?: Record<string, true>;
|
|
221
360
|
}
|
|
222
|
-
interface
|
|
223
|
-
|
|
224
|
-
relation: RelationDefinitionLike;
|
|
225
|
-
row: Record<string, unknown>;
|
|
226
|
-
tableName: string;
|
|
361
|
+
interface FanOutBudget {
|
|
362
|
+
remaining: number;
|
|
227
363
|
}
|
|
228
364
|
interface ResolveWithOptions {
|
|
365
|
+
fanOutBudget?: FanOutBudget;
|
|
229
366
|
fetcher: (tableName: string, args: QueryArgs) => Promise<QueryPage>;
|
|
230
367
|
groupedCounter: (tableName: string, whereField: string, values: unknown[], policyWhere?: WhereInput) => Promise<Map<unknown, number>>;
|
|
231
368
|
parents: Record<string, unknown>[];
|
|
@@ -243,12 +380,17 @@ interface ResolveWithResult {
|
|
|
243
380
|
rows: Record<string, unknown>[];
|
|
244
381
|
}
|
|
245
382
|
type SortDirection = "asc" | "desc";
|
|
246
|
-
type
|
|
383
|
+
type NullPlacement = "first" | "last";
|
|
384
|
+
type OrderByInput = Record<string, SortDirection | {
|
|
385
|
+
nulls: NullPlacement;
|
|
386
|
+
sort: SortDirection;
|
|
387
|
+
}>;
|
|
247
388
|
interface QueryArgs {
|
|
248
389
|
baseWhere?: WhereInput;
|
|
249
390
|
cursor?: null | string;
|
|
250
391
|
includeDeleted?: boolean;
|
|
251
392
|
limit?: number;
|
|
393
|
+
omitContinueCursor?: boolean;
|
|
252
394
|
orderBy?: OrderByInput[];
|
|
253
395
|
relationBaseWhere?: (table: string) => undefined | WhereInput;
|
|
254
396
|
relationMask?: RelationMask;
|
|
@@ -264,15 +406,59 @@ interface CrossShardReadArgs {
|
|
|
264
406
|
with?: WithInput;
|
|
265
407
|
}
|
|
266
408
|
type RelationMask = (table: string, rows: Record<string, unknown>[]) => Record<string, unknown>[];
|
|
409
|
+
interface QueryPlan {
|
|
410
|
+
params: unknown[];
|
|
411
|
+
plan: string[];
|
|
412
|
+
sql: string;
|
|
413
|
+
}
|
|
267
414
|
interface QueryPage {
|
|
268
415
|
continueCursor: null | string;
|
|
269
416
|
isDone: boolean;
|
|
270
417
|
page: Record<string, unknown>[];
|
|
271
418
|
splitCursor?: null | string;
|
|
272
419
|
}
|
|
420
|
+
interface RelationEdge {
|
|
421
|
+
readonly array: boolean;
|
|
422
|
+
readonly column: string;
|
|
423
|
+
readonly name: string;
|
|
424
|
+
readonly sourceTable: string;
|
|
425
|
+
readonly targetTable: string;
|
|
426
|
+
}
|
|
427
|
+
interface RelatedStartReference {
|
|
428
|
+
id: string;
|
|
429
|
+
table: string;
|
|
430
|
+
}
|
|
431
|
+
type RelatedStart = (Record<string, unknown> & {
|
|
432
|
+
_id: string;
|
|
433
|
+
}) | RelatedStartReference;
|
|
434
|
+
type RelatedDirection = "both" | "in" | "out";
|
|
435
|
+
interface RelatedOptions {
|
|
436
|
+
cursor?: null | string;
|
|
437
|
+
depth?: number;
|
|
438
|
+
direction?: RelatedDirection;
|
|
439
|
+
edges?: ReadonlyArray<string>;
|
|
440
|
+
limit?: number;
|
|
441
|
+
relationBaseWhere?: (table: string) => undefined | WhereInput;
|
|
442
|
+
relationMask?: RelationMask;
|
|
443
|
+
}
|
|
444
|
+
interface RelatedNode {
|
|
445
|
+
depth: number;
|
|
446
|
+
document: Record<string, unknown>;
|
|
447
|
+
path: ReadonlyArray<string>;
|
|
448
|
+
pathIds: ReadonlyArray<string>;
|
|
449
|
+
score: number;
|
|
450
|
+
table: string;
|
|
451
|
+
}
|
|
452
|
+
interface RelatedPage {
|
|
453
|
+
continueCursor: null | string;
|
|
454
|
+
isDone: boolean;
|
|
455
|
+
nodes: RelatedNode[];
|
|
456
|
+
}
|
|
273
457
|
interface OrderKey {
|
|
274
458
|
direction: SortDirection;
|
|
275
459
|
field: string;
|
|
460
|
+
nullable: boolean;
|
|
461
|
+
nulls?: NullPlacement;
|
|
276
462
|
}
|
|
277
463
|
interface RestrictableQueryOptions {
|
|
278
464
|
baseWhere?: WhereInput;
|
|
@@ -401,17 +587,15 @@ interface IndexRangeBuilderLike {
|
|
|
401
587
|
lte: (field: string, value: unknown) => IndexRangeBuilderLike;
|
|
402
588
|
}
|
|
403
589
|
type BroadcastDelta = (delta: MutationDelta) => void;
|
|
404
|
-
type ReadHook = (table: string, idOrScan?: string) => void;
|
|
590
|
+
type ReadHook = (table: string, idOrScan?: string, exact?: boolean) => void;
|
|
405
591
|
interface LifecycleEvent {
|
|
406
592
|
connectionId: string;
|
|
407
593
|
context?: Record<string, unknown>;
|
|
408
594
|
shardKey: string;
|
|
409
595
|
userId: string | null;
|
|
410
596
|
}
|
|
411
|
-
interface LifecycleDispatchInfo {
|
|
597
|
+
interface LifecycleDispatchInfo extends SubscriptionIdentity {
|
|
412
598
|
event: LifecycleEvent;
|
|
413
|
-
identity: Record<string, unknown> | undefined;
|
|
414
|
-
userId: string | undefined;
|
|
415
599
|
}
|
|
416
600
|
interface MutationDelta {
|
|
417
601
|
indexKeys?: ReadonlyArray<IndexKeyEntry>;
|
|
@@ -423,9 +607,18 @@ interface MutationDelta {
|
|
|
423
607
|
interface DatabaseWriterLike {
|
|
424
608
|
aggregate: (tableName: string, options: AggregateOptions) => Promise<AggregateResult>;
|
|
425
609
|
asId?: (tableName: string, id: string) => string;
|
|
610
|
+
assertPatchAllowed?: (table: string, id: string) => Promise<void>;
|
|
611
|
+
cdcChangedTables?: (sinceSeq: number, options?: {
|
|
612
|
+
cursorOnly?: boolean;
|
|
613
|
+
}) => Promise<{
|
|
614
|
+
cursor: number;
|
|
615
|
+
floor?: number;
|
|
616
|
+
tables: string[];
|
|
617
|
+
} | undefined>;
|
|
426
618
|
count: (tableName: string, where?: RestrictableQueryOptions | WhereInput) => Promise<number>;
|
|
427
|
-
delete: (
|
|
619
|
+
delete: (table: string, id: string, options?: {
|
|
428
620
|
hard?: boolean;
|
|
621
|
+
skipOnDelete?: boolean;
|
|
429
622
|
}) => Promise<void>;
|
|
430
623
|
deleteAll?: (tableName: string, options?: {
|
|
431
624
|
chunkSize?: number;
|
|
@@ -433,20 +626,22 @@ interface DatabaseWriterLike {
|
|
|
433
626
|
}) => Promise<{
|
|
434
627
|
deleted: number;
|
|
435
628
|
}>;
|
|
436
|
-
deleteMany?: (ids: ReadonlyArray<string>, options?: {
|
|
629
|
+
deleteMany?: (table: string, ids: ReadonlyArray<string>, options?: {
|
|
437
630
|
limit?: number;
|
|
438
|
-
}
|
|
631
|
+
}) => Promise<{
|
|
439
632
|
deleted: number;
|
|
440
633
|
}>;
|
|
634
|
+
deleteRereadTables?: ReadonlySet<string>;
|
|
441
635
|
deleteWhere?: (tableName: string, where: WhereInput, options?: {
|
|
442
636
|
limit?: number;
|
|
443
637
|
}) => Promise<{
|
|
444
638
|
deleted: number;
|
|
445
639
|
}>;
|
|
640
|
+
explain: (tableName: string, args?: QueryArgs) => Promise<QueryPlan>;
|
|
446
641
|
findFirst: (tableName: string, args?: QueryArgs) => Promise<Record<string, unknown> | null>;
|
|
447
642
|
findFirstOrThrow: (tableName: string, args?: QueryArgs) => Promise<Record<string, unknown>>;
|
|
448
643
|
findMany: (tableName: string, args?: QueryArgs) => Promise<QueryPage>;
|
|
449
|
-
get: (
|
|
644
|
+
get: (table: string, id: string) => Promise<Record<string, unknown> | null>;
|
|
450
645
|
groupBy: (tableName: string, options: GroupByOptions) => Promise<ReadonlyArray<GroupByEntry>>;
|
|
451
646
|
insert: (tableName: string, document: Record<string, unknown>, options?: {
|
|
452
647
|
allowExplicitId?: boolean;
|
|
@@ -460,18 +655,27 @@ interface DatabaseWriterLike {
|
|
|
460
655
|
allowExplicitId?: boolean;
|
|
461
656
|
limit?: number;
|
|
462
657
|
}) => Promise<string[]>;
|
|
658
|
+
inTransaction?: () => boolean;
|
|
463
659
|
lookupById?: (id: string, expectedTable?: string) => Promise<null | {
|
|
464
660
|
row: Record<string, unknown>;
|
|
465
661
|
tableName: string;
|
|
466
662
|
}>;
|
|
467
663
|
normalizeId: (tableName: string, id: string) => null | string;
|
|
468
|
-
patch: (id: string, patch: Record<string, unknown>,
|
|
469
|
-
|
|
664
|
+
patch: (table: string, id: string, patch: Record<string, unknown>, options?: PatchWriteOptions) => Promise<void>;
|
|
665
|
+
patchIf?: (tableName: string, id: string, args: {
|
|
666
|
+
patch: Record<string, unknown>;
|
|
667
|
+
verify?: PatchVerifier;
|
|
668
|
+
where: WhereInput;
|
|
669
|
+
}) => Promise<{
|
|
670
|
+
applied: boolean;
|
|
671
|
+
doc: Record<string, unknown> | null;
|
|
672
|
+
}>;
|
|
673
|
+
patchMany?: (table: string, patches: ReadonlyArray<{
|
|
470
674
|
id: string;
|
|
471
675
|
patch: Record<string, unknown>;
|
|
472
676
|
}>, options?: {
|
|
473
677
|
limit?: number;
|
|
474
|
-
}
|
|
678
|
+
}) => Promise<{
|
|
475
679
|
patched: number;
|
|
476
680
|
}>;
|
|
477
681
|
patchWhere?: (tableName: string, args: {
|
|
@@ -487,10 +691,14 @@ interface DatabaseWriterLike {
|
|
|
487
691
|
rankBefore?: (tableName: string, indexName: string, options: RankBeforeOptions) => Promise<RankBeforeResult>;
|
|
488
692
|
rankPage: (tableName: string, indexName: string, options?: RankPageOptions) => Promise<RankPage>;
|
|
489
693
|
rankPageRows?: (tableName: string, indexName: string, options?: RankPageOptions) => Promise<ShardRankPageResult>;
|
|
490
|
-
|
|
694
|
+
related?: (start: RelatedStart, options?: RelatedOptions) => Promise<RelatedPage>;
|
|
695
|
+
relationEdges?: ReadonlyArray<RelationEdge>;
|
|
696
|
+
relationWrites?: RelationWriteMap;
|
|
697
|
+
replace: (table: string, id: string, document: Record<string, unknown>, options?: {
|
|
491
698
|
allowExplicitId?: boolean;
|
|
492
699
|
}) => Promise<void>;
|
|
493
|
-
restore?: (
|
|
700
|
+
restore?: (table: string, id: string) => Promise<void>;
|
|
701
|
+
softDeleteFields?: ReadonlyMap<string, string>;
|
|
494
702
|
system?: SystemDatabaseReader;
|
|
495
703
|
wipeShard?: (options?: {
|
|
496
704
|
chunkSize?: number;
|
|
@@ -515,17 +723,25 @@ interface ExportShardArgs {
|
|
|
515
723
|
batchSize?: number;
|
|
516
724
|
tables?: ReadonlyArray<string>;
|
|
517
725
|
}
|
|
726
|
+
type ImportConflictMode = "replace" | "skip";
|
|
727
|
+
interface ImportRow extends ExportRow {
|
|
728
|
+
op?: string;
|
|
729
|
+
}
|
|
518
730
|
interface ImportShardArgs {
|
|
519
|
-
|
|
731
|
+
deletes?: boolean;
|
|
732
|
+
dryRun?: boolean;
|
|
733
|
+
onConflict?: ImportConflictMode;
|
|
734
|
+
rows: ReadonlyArray<ImportRow>;
|
|
520
735
|
startLine?: number;
|
|
521
736
|
}
|
|
522
737
|
interface ImportShardResult {
|
|
523
738
|
conflicts: number;
|
|
739
|
+
deleted: number;
|
|
524
740
|
errors: ImportError[];
|
|
525
741
|
inserted: Record<string, number>;
|
|
742
|
+
replaced: number;
|
|
526
743
|
}
|
|
527
744
|
declare const selectExportTables: (schema: SchemaLike, requested?: ReadonlyArray<string>) => string[];
|
|
528
|
-
declare const exportShardTable: (writer: DatabaseWriterLike, table: string, batchSize?: number) => AsyncGenerator<ExportRow, void, undefined>;
|
|
529
745
|
declare const exportShardRows: (writer: DatabaseWriterLike, schema: SchemaLike, args: ExportShardArgs) => AsyncGenerator<ExportRow, void, undefined>;
|
|
530
746
|
declare const validateImportRow: (schema: SchemaLike, table: string, record: Record<string, unknown>) => string | undefined;
|
|
531
747
|
declare const importShardRows: (writer: DatabaseWriterLike, schema: SchemaLike, args: ImportShardArgs) => Promise<ImportShardResult>;
|
|
@@ -534,7 +750,10 @@ interface ExportShardAdminArgs {
|
|
|
534
750
|
tables?: ReadonlyArray<string>;
|
|
535
751
|
}
|
|
536
752
|
interface ImportShardAdminArgs {
|
|
537
|
-
|
|
753
|
+
deletes: boolean;
|
|
754
|
+
dryRun: boolean;
|
|
755
|
+
onConflict: ImportConflictMode;
|
|
756
|
+
rows: ReadonlyArray<ImportRow>;
|
|
538
757
|
startLine?: number;
|
|
539
758
|
}
|
|
540
759
|
declare const parseExportShardArgs: (args: Record<string, unknown>) => ExportShardAdminArgs;
|
|
@@ -573,8 +792,11 @@ declare const selectIndexForGroupBy: (indexes: ReadonlyArray<AggregateIndexDefin
|
|
|
573
792
|
index: AggregateIndexDefinitionLike;
|
|
574
793
|
partial: Record<string, unknown>;
|
|
575
794
|
};
|
|
576
|
-
declare const
|
|
577
|
-
declare
|
|
795
|
+
declare const clearCompanionSignatures: (sql: SqlExec) => void;
|
|
796
|
+
declare class CompanionMemo {
|
|
797
|
+
readonly verified: Set<string>;
|
|
798
|
+
invalidate(): void;
|
|
799
|
+
}
|
|
578
800
|
interface CacheEntry {
|
|
579
801
|
bytes: number;
|
|
580
802
|
deps: Set<string>;
|
|
@@ -600,6 +822,7 @@ declare class ReactiveCache {
|
|
|
600
822
|
private readonly maxBytes;
|
|
601
823
|
private readonly now;
|
|
602
824
|
private monotonic;
|
|
825
|
+
private generation;
|
|
603
826
|
constructor(options?: ReactiveCacheOptions);
|
|
604
827
|
run<R>(key: string, deps: Set<string>, run: () => Promise<R>, ranges?: () => ReadonlyArray<KeyRange>): Promise<R>;
|
|
605
828
|
invalidate(table: string, id: string, indexKeys?: ReadonlyArray<IndexKeyEntry>): string[];
|
|
@@ -660,12 +883,18 @@ interface RunTriggersOptions {
|
|
|
660
883
|
}
|
|
661
884
|
declare const runTriggers: (options: RunTriggersOptions) => Promise<void>;
|
|
662
885
|
declare const hasTrigger: (schema: SchemaLike, tableName: string, op: TriggerOpLike) => boolean;
|
|
886
|
+
interface SearchBackfillProgress {
|
|
887
|
+
done: boolean;
|
|
888
|
+
pages: number;
|
|
889
|
+
}
|
|
663
890
|
declare const backfillAggregateIndexes: (sql: SqlExec, schema: SchemaLike) => void;
|
|
664
891
|
declare const backfillRankIndexes: (sql: SqlExec, schema: SchemaLike) => void;
|
|
665
892
|
declare const backfillSearchIndexesForTable: (sql: SqlExec, tableName: string, definition: {
|
|
666
893
|
searchIndexes?: ReadonlyArray<SearchIndexDefinitionLike>;
|
|
667
894
|
}) => void;
|
|
668
|
-
declare const backfillSearchIndexes: (sql: SqlExec, schema: SchemaLike
|
|
895
|
+
declare const backfillSearchIndexes: (sql: SqlExec, schema: SchemaLike, options?: {
|
|
896
|
+
maxPages?: number;
|
|
897
|
+
}) => SearchBackfillProgress;
|
|
669
898
|
declare const CDC_LOG_TABLE = "__cdc_log";
|
|
670
899
|
interface CdcChange {
|
|
671
900
|
doc?: Record<string, unknown>;
|
|
@@ -675,19 +904,35 @@ interface CdcChange {
|
|
|
675
904
|
table: string;
|
|
676
905
|
ts: number;
|
|
677
906
|
}
|
|
678
|
-
declare const
|
|
907
|
+
declare const CDC_LOG_TABLE_SEQ_INDEX = "__cdc_log_table_seq";
|
|
908
|
+
declare const migrateCdcLog: (sql: SqlExec, options?: {
|
|
909
|
+
rowHistoryIndex?: boolean;
|
|
910
|
+
}) => void;
|
|
679
911
|
declare const appendCdcChange: (sql: SqlExec, ts: number, table: string, id: string, op: CdcChange["op"], doc: Record<string, unknown> | undefined) => void;
|
|
680
912
|
declare const readCdcChanges: (sql: SqlExec, options?: {
|
|
681
913
|
limit?: number;
|
|
682
914
|
sinceSeq?: number;
|
|
683
|
-
tables?: ReadonlySet<string>;
|
|
684
915
|
}) => {
|
|
685
916
|
changes: CdcChange[];
|
|
686
917
|
cursor: number;
|
|
687
918
|
};
|
|
688
|
-
declare const
|
|
919
|
+
declare const cdcTouchesTables: (sql: SqlExec, sinceSeq: number, tables: ReadonlySet<string>) => boolean;
|
|
920
|
+
declare const cdcCanVouchFor: (sql: SqlExec, deps: ReadonlySet<string>) => boolean;
|
|
921
|
+
interface CdcChangeKey {
|
|
922
|
+
id: string;
|
|
923
|
+
op: CdcChange["op"];
|
|
924
|
+
seq: number;
|
|
925
|
+
}
|
|
926
|
+
declare const readCdcChangeKeys: (sql: SqlExec, table: string, sinceSeq: number, upTo: number) => CdcChangeKey[];
|
|
927
|
+
declare const trimCdcChanges: (sql: SqlExec, throughSeq: number, maxRows: number) => void;
|
|
928
|
+
declare const compactCdcDocs: (sql: SqlExec, throughSeq: number, maxRows: number) => void;
|
|
929
|
+
declare const cdcSeqLeavingRows: (sql: SqlExec, keep: number) => number | undefined;
|
|
689
930
|
declare const readCdcCursor: (sql: SqlExec) => number;
|
|
931
|
+
declare const cursorBelowRetainedFloor: (floor: number | undefined, sinceSeq: number) => boolean;
|
|
932
|
+
declare const cdcTrimmedError: (floor: number, sinceSeq: number, scope: "global" | "shard") => LunoraError;
|
|
933
|
+
declare const cdcForkedError: (cursor: number, sinceSeq: number, scope: "global" | "shard", epoch?: string) => LunoraError;
|
|
690
934
|
declare const minCdcSeq: (sql: SqlExec) => number | undefined;
|
|
935
|
+
declare const minCdcReplayableSeq: (sql: SqlExec) => number | undefined;
|
|
691
936
|
declare const CDC_META_TABLE = "__cdc_meta";
|
|
692
937
|
declare const migrateCdcMeta: (sql: SqlExec) => void;
|
|
693
938
|
declare const readCdcEpoch: (sql: SqlExec) => string;
|
|
@@ -697,12 +942,6 @@ declare const CLIENT_WATERMARK_TABLE = "__client_watermark";
|
|
|
697
942
|
declare const migrateClientWatermark: (sql: SqlExec) => void;
|
|
698
943
|
declare const readClientWatermark: (sql: SqlExec, identity: string, clientId: string) => number;
|
|
699
944
|
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
945
|
declare const IDEMPOTENCY_TABLE = "__idempotency";
|
|
707
946
|
interface IdempotentRecord {
|
|
708
947
|
resultJson: string;
|
|
@@ -714,61 +953,32 @@ declare const writeIdempotent: (sql: SqlExec, identity: string, mutationId: stri
|
|
|
714
953
|
declare const trimIdempotent: (sql: SqlExec, olderThanTs: number) => void;
|
|
715
954
|
declare const runShardMigrations: (sql: SqlExec, schema: SchemaLike, options?: {
|
|
716
955
|
cdc?: boolean;
|
|
956
|
+
deferBlockedUniqueIndexes?: boolean;
|
|
717
957
|
schemaSnapshot?: {
|
|
718
958
|
hash: string;
|
|
719
959
|
json: string;
|
|
720
960
|
};
|
|
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;
|
|
961
|
+
}) => ReadonlyArray<string>;
|
|
755
962
|
interface ShapeRow {
|
|
756
963
|
doc: Record<string, unknown>;
|
|
757
964
|
id: string;
|
|
758
965
|
}
|
|
759
966
|
declare const selectShapeRows: (sql: SqlExec, table: string, effectiveWhere: WhereInput | undefined) => ShapeRow[];
|
|
760
|
-
declare const
|
|
967
|
+
declare const selectShapeMembers: (sql: SqlExec, table: string, effectiveWhere: WhereInput | undefined, ids: ReadonlyArray<string>) => Map<string, Record<string, unknown>>;
|
|
761
968
|
interface SqlExec {
|
|
762
969
|
exec: <Row = Record<string, unknown>>(sql: string, ...params: unknown[]) => SqlCursor<Row>;
|
|
763
970
|
}
|
|
764
971
|
interface SqlCursor<Row> extends Iterable<Row> {
|
|
972
|
+
readonly columnNames?: string[];
|
|
765
973
|
one: () => Row;
|
|
974
|
+
raw?: () => IterableIterator<unknown[]>;
|
|
766
975
|
toArray: () => Row[];
|
|
767
976
|
}
|
|
768
977
|
type IndexUseHook = (table: string, indexName: string, kind: "geo" | "index" | "rank" | "search") => void;
|
|
769
978
|
type Clock = () => number;
|
|
770
979
|
type IdGenerator = () => string;
|
|
771
980
|
declare const assertValidClientId: (clientId: string) => void;
|
|
981
|
+
declare const assertStorableRowId: (id: string) => void;
|
|
772
982
|
interface WriteEvent {
|
|
773
983
|
doc?: Record<string, unknown>;
|
|
774
984
|
id: string;
|
|
@@ -778,18 +988,26 @@ interface WriteEvent {
|
|
|
778
988
|
type WriteHook = (event: WriteEvent) => Promise<void> | void;
|
|
779
989
|
interface CtxDbOptions {
|
|
780
990
|
auth?: ServerDefaultContextLike["auth"];
|
|
991
|
+
baselineSeq?: () => number | undefined;
|
|
781
992
|
broadcast?: BroadcastDelta;
|
|
782
993
|
cache?: ReactiveCache;
|
|
783
994
|
cdc?: boolean;
|
|
784
995
|
clock?: Clock;
|
|
996
|
+
companionMemo?: CompanionMemo;
|
|
785
997
|
enforceRls?: boolean;
|
|
786
998
|
globalDb?: DatabaseWriterLike;
|
|
787
999
|
headroom?: TransactionHeadroomTracker;
|
|
788
1000
|
idGenerator?: IdGenerator;
|
|
1001
|
+
inTransaction?: () => boolean;
|
|
789
1002
|
maxRelationKeys?: number;
|
|
790
1003
|
onIndexUse?: IndexUseHook;
|
|
791
1004
|
onRead?: ReadHook;
|
|
792
1005
|
onReadRange?: (range: KeyRange) => void;
|
|
1006
|
+
onStalePatchDropped?: (event: {
|
|
1007
|
+
fields: string[];
|
|
1008
|
+
id: string;
|
|
1009
|
+
table: string;
|
|
1010
|
+
}) => void;
|
|
793
1011
|
onWrite?: WriteHook;
|
|
794
1012
|
relationExistsPushDown?: "always" | "auto" | "never";
|
|
795
1013
|
scheduler?: SchedulerLike;
|
|
@@ -802,6 +1020,8 @@ declare class NotUniqueError extends LunoraError {
|
|
|
802
1020
|
constructor(message?: string);
|
|
803
1021
|
}
|
|
804
1022
|
declare const normalizeIdStructurally: (schema: SchemaLike, tableName: string, id: string) => null | string;
|
|
1023
|
+
declare const assertNoExplicitUndefined: (op: "patch" | "patchIf" | "replace", document: Record<string, unknown>) => void;
|
|
1024
|
+
declare const stripReservedPatchFields: (patch: Record<string, unknown>) => Record<string, unknown>;
|
|
805
1025
|
declare const createShardCtxDb: (options: CtxDbOptions) => DatabaseWriterLike;
|
|
806
1026
|
declare const AUDIT_LOG_TABLE = "__lunora_audit__";
|
|
807
1027
|
interface AuditEntry {
|
|
@@ -825,68 +1045,23 @@ declare const readAuditLog: (sql: SqlExec, options?: {
|
|
|
825
1045
|
limit?: number;
|
|
826
1046
|
sinceSeq?: number;
|
|
827
1047
|
}) => 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
|
-
}
|
|
1048
|
+
interface CdcArchiveScope {
|
|
1049
|
+
epoch: string;
|
|
1050
|
+
shard: string;
|
|
1051
|
+
}
|
|
1052
|
+
declare const readCdcArchivedThrough: (sql: SqlExec) => number;
|
|
1053
|
+
declare const writeCdcArchivedThrough: (sql: SqlExec, seq: number) => void;
|
|
1054
|
+
declare const archiveCdcSegment: (bucket: R2BucketLike, scope: CdcArchiveScope, changes: CdcChange[]) => Promise<void>;
|
|
1055
|
+
declare const cdcArchiveRewound: (bucket: R2BucketLike, scope: CdcArchiveScope, archivedThrough: number) => Promise<boolean>;
|
|
1056
|
+
declare const readArchivedCdcChanges: (bucket: R2BucketLike, scope: CdcArchiveScope, sinceSeq: number, limit: number | undefined) => Promise<{
|
|
1057
|
+
changes: CdcChange[];
|
|
1058
|
+
cursor: number;
|
|
1059
|
+
} | undefined>;
|
|
1060
|
+
declare const COMMIT_SEQ_TABLE = "__commit_seq";
|
|
1061
|
+
declare const COMMIT_SEQ_FIELD = "_commitSeq";
|
|
1062
|
+
declare const migrateCommitSeq: (sql: SqlExec) => void;
|
|
1063
|
+
declare const readCommitSeq: (sql: SqlExec) => number;
|
|
1064
|
+
declare const allocateCommitSeq: (sql: SqlExec) => number;
|
|
890
1065
|
interface CompanionSyncDeps {
|
|
891
1066
|
broadcast: (delta: MutationDelta) => void;
|
|
892
1067
|
indexKeysFor: (table: string, document?: Record<string, unknown>) => ReadonlyArray<{
|
|
@@ -897,6 +1072,7 @@ interface CompanionSyncDeps {
|
|
|
897
1072
|
recordCdc: (table: string, id: string, op: "delete" | "insert" | "update", doc?: Record<string, unknown>) => void;
|
|
898
1073
|
schema: SchemaLike;
|
|
899
1074
|
sql: SqlExec;
|
|
1075
|
+
verified?: Set<string>;
|
|
900
1076
|
}
|
|
901
1077
|
interface CompanionSync {
|
|
902
1078
|
ensureBackfilledForTable: (tableName: string) => void;
|
|
@@ -910,6 +1086,19 @@ interface CompanionSync {
|
|
|
910
1086
|
syncSearch: (tableName: string, id: string, document: Record<string, unknown> | undefined, previous?: Record<string, unknown>) => void;
|
|
911
1087
|
}
|
|
912
1088
|
declare const createCompanionSync: (deps: CompanionSyncDeps) => CompanionSync;
|
|
1089
|
+
declare const GLOBAL_SHAPE_SNAPSHOT_TABLE = "__global_shape_snapshot";
|
|
1090
|
+
declare const migrateGlobalShapeSnapshot: (sql: SqlExec) => void;
|
|
1091
|
+
declare const readGlobalShapeSnapshot: (sql: SqlExec, connectionId: string, subId: string) => Map<string, string> | undefined;
|
|
1092
|
+
declare const writeGlobalShapeSnapshot: (sql: SqlExec, connectionId: string, subId: string, snapshot: Map<string, string>) => void;
|
|
1093
|
+
declare const deleteGlobalShapeSnapshot: (sql: SqlExec, connectionId: string, subId: string) => void;
|
|
1094
|
+
declare const deleteGlobalShapeSnapshotsForConnection: (sql: SqlExec, connectionId: string) => void;
|
|
1095
|
+
declare const isMemoryTable: (definition: TableDefinitionLike | undefined) => boolean;
|
|
1096
|
+
declare const memoryTableNames: (schema: SchemaLike) => string[];
|
|
1097
|
+
declare const clearMemoryTables: (sql: SqlExec, schema: SchemaLike) => number;
|
|
1098
|
+
declare const resolveRankSeekTuple: (options: {
|
|
1099
|
+
after?: RankPageRowKey;
|
|
1100
|
+
cursor?: null | string;
|
|
1101
|
+
}) => unknown[] | undefined;
|
|
913
1102
|
interface RankPageDeps {
|
|
914
1103
|
assertRankPartitionLocal: (tableName: string, definition: TableDefinitionLike, index: RankIndexDefinitionLike) => void;
|
|
915
1104
|
ensureRankBackfilled: (tableName: string, index: RankIndexDefinitionLike) => void;
|
|
@@ -927,8 +1116,68 @@ interface RankPageComputation {
|
|
|
927
1116
|
key: RankPageRowKey;
|
|
928
1117
|
}[];
|
|
929
1118
|
}
|
|
930
|
-
declare const hydrateDocsById: (deps: RankPageDeps, tableName: string, ids: ReadonlyArray<string>) => Map<string, Record<string, unknown>>;
|
|
931
1119
|
declare const computeRankPage: (deps: RankPageDeps, tableName: string, indexName: string, rankPageOptions: RankPageOptions) => RankPageComputation;
|
|
1120
|
+
declare const SCHEDULE_OUTBOX_TABLE = "__schedule_outbox";
|
|
1121
|
+
interface ScheduleOutboxRow {
|
|
1122
|
+
attempts: number;
|
|
1123
|
+
envelopeJson: string;
|
|
1124
|
+
id: string;
|
|
1125
|
+
nextAttemptAt: number;
|
|
1126
|
+
}
|
|
1127
|
+
interface ScheduleOutboxEnvelope {
|
|
1128
|
+
args: unknown;
|
|
1129
|
+
options: Record<string, unknown> | undefined;
|
|
1130
|
+
target: unknown;
|
|
1131
|
+
when: number;
|
|
1132
|
+
}
|
|
1133
|
+
interface ScheduleOutbox {
|
|
1134
|
+
admit: (target: string) => number | undefined;
|
|
1135
|
+
forget: (id: string) => void;
|
|
1136
|
+
record: (id: string, envelope: ScheduleOutboxEnvelope) => void;
|
|
1137
|
+
wake: () => void;
|
|
1138
|
+
}
|
|
1139
|
+
declare const migrateScheduleOutbox: (sql: SqlExec) => void;
|
|
1140
|
+
declare const recordScheduleOutbox: (sql: SqlExec, id: string, envelopeJson: string, now: number) => void;
|
|
1141
|
+
declare const forgetScheduleOutbox: (sql: SqlExec, id: string) => void;
|
|
1142
|
+
declare const readDueScheduleOutbox: (sql: SqlExec, nowMs: number, limit: number) => ScheduleOutboxRow[];
|
|
1143
|
+
declare const deferScheduleOutbox: (sql: SqlExec, id: string, attempts: number, nextAttemptAt: number) => void;
|
|
1144
|
+
declare const parkScheduleOutbox: (sql: SqlExec, id: string, attempts: number) => void;
|
|
1145
|
+
declare const probeScheduleOutbox: (sql: SqlExec) => {
|
|
1146
|
+
dueAt: number | undefined;
|
|
1147
|
+
populated: boolean;
|
|
1148
|
+
};
|
|
1149
|
+
declare const trimScheduleOutbox: (sql: SqlExec, olderThanTs: number) => void;
|
|
1150
|
+
/**
|
|
1151
|
+
* How far a companion's backfill has progressed, and under which analysis.
|
|
1152
|
+
* Declared here rather than beside either engine's state table: both record the
|
|
1153
|
+
* same three facts, and the decisions made from them are the shared policy
|
|
1154
|
+
* below.
|
|
1155
|
+
*/
|
|
1156
|
+
interface BackfillState {
|
|
1157
|
+
/** Last `id` indexed, or `undefined` when no page has run yet. */
|
|
1158
|
+
cursor: string | undefined;
|
|
1159
|
+
/** True once a page came back short — the table is fully indexed. */
|
|
1160
|
+
done: boolean;
|
|
1161
|
+
/** Analyzer profile the stored rows were built with; `undefined` predates profile tracking. */
|
|
1162
|
+
profile: string | undefined;
|
|
1163
|
+
}
|
|
1164
|
+
declare const SEARCH_STATE_TABLE = "__lunora_search_state";
|
|
1165
|
+
declare const migrateSearchState: (sql: SqlExec) => void;
|
|
1166
|
+
declare const readSearchBackfillState: (sql: SqlExec, companion: string) => BackfillState;
|
|
1167
|
+
declare const writeSearchBackfillState: (sql: SqlExec, companion: string, cursor: string | undefined, done: boolean, profile: string) => void;
|
|
1168
|
+
declare const SHAPE_POKE_CURSOR_TABLE = "__shape_poke_cursor";
|
|
1169
|
+
declare const migrateShapePokeCursor: (sql: SqlExec) => void;
|
|
1170
|
+
declare const readShapePokeCursor: (sql: SqlExec, connectionId: string, subId: string) => number | undefined;
|
|
1171
|
+
declare const writeShapePokeCursor: (sql: SqlExec, connectionId: string, subId: string, cursor: number) => void;
|
|
1172
|
+
interface ShapePokeCursorRow {
|
|
1173
|
+
connectionId: string;
|
|
1174
|
+
cursor: number;
|
|
1175
|
+
subId: string;
|
|
1176
|
+
}
|
|
1177
|
+
declare const writeShapePokeCursors: (sql: SqlExec, rows: ReadonlyArray<ShapePokeCursorRow>) => void;
|
|
1178
|
+
declare const minShapePokeCursor: (sql: SqlExec) => number | undefined;
|
|
1179
|
+
declare const deleteShapePokeCursor: (sql: SqlExec, connectionId: string, subId: string) => void;
|
|
1180
|
+
declare const deleteShapePokeCursorsForConnection: (sql: SqlExec, connectionId: string) => void;
|
|
932
1181
|
declare const DATA_MIGRATION_STATE_TABLE = "__lunora_migrations";
|
|
933
1182
|
type MigrationDirection = "down" | "up";
|
|
934
1183
|
type MigrationStatus = "completed" | "failed" | "in_progress";
|
|
@@ -992,6 +1241,29 @@ interface DependencyTracker {
|
|
|
992
1241
|
declare const createDependencyTracker: () => DependencyTracker;
|
|
993
1242
|
declare const runSql: <Row = Record<string, unknown>>(sql: SqlExec, query: string, ...params: unknown[]) => SqlCursor<Row>;
|
|
994
1243
|
declare const runDrizzle: <Row = Record<string, unknown>>(exec: SqlExec, query: SQL) => SqlCursor<Row>;
|
|
1244
|
+
type RangeOperandType = "boolean" | "number" | "string";
|
|
1245
|
+
interface WhereFragments<T> {
|
|
1246
|
+
binary: (reference: T, comparator: string, value: unknown) => T;
|
|
1247
|
+
connect: (left: T, right: T, connector: "AND" | "OR") => T;
|
|
1248
|
+
constant: (value: boolean) => T;
|
|
1249
|
+
contains: (reference: T, term: T) => T;
|
|
1250
|
+
inList: (reference: T, items: ReadonlyArray<unknown>, negated: boolean, budget: number) => T;
|
|
1251
|
+
negate: (inner: T) => T;
|
|
1252
|
+
nullCheck: (reference: T, negated: boolean) => T;
|
|
1253
|
+
value: (value: unknown) => T;
|
|
1254
|
+
}
|
|
1255
|
+
type FieldRefSql<T> = (field: string) => T;
|
|
1256
|
+
type SerializeValue = (value: unknown, field: string) => unknown;
|
|
1257
|
+
interface WhereSqlStrategy<T = SQL> {
|
|
1258
|
+
containsExpr?: (reference: T, term: T) => T;
|
|
1259
|
+
fieldRef: FieldRefSql<T>;
|
|
1260
|
+
inList?: (reference: T, items: ReadonlyArray<unknown>, negated: boolean, budget?: number) => T;
|
|
1261
|
+
rangeTypeGuard: (field: string, type: RangeOperandType) => T;
|
|
1262
|
+
relationExists?: (request: unknown) => T;
|
|
1263
|
+
serialize: SerializeValue;
|
|
1264
|
+
}
|
|
1265
|
+
declare const serverInList: (engine: "mysql" | "postgres") => (reference: SQL, items: ReadonlyArray<unknown>, negated: boolean, budget?: number) => SQL;
|
|
1266
|
+
declare const compileWhereSql: <T = SQL>(where: WhereInput | undefined, strategy: WhereSqlStrategy<T>, fragments?: WhereFragments<T>, reservedParams?: number) => T | undefined;
|
|
995
1267
|
declare const quoteIdentifier: (name: string) => string;
|
|
996
1268
|
declare const serializeSqlValue: (value: unknown) => unknown;
|
|
997
1269
|
declare const DOC_COLUMN = "__doc__";
|
|
@@ -1005,10 +1277,16 @@ declare const AGG_KEY: Name;
|
|
|
1005
1277
|
declare const AGG_VALUE: Name;
|
|
1006
1278
|
declare const AGG_COUNT: Name;
|
|
1007
1279
|
declare const aggUpsertSql: (aggTable: string, key: unknown, value: unknown, count: unknown, set: SQL) => SQL;
|
|
1008
|
-
declare const tableColumns: (definition: TableDefinitionLike) => [string, ColumnMetaLike]
|
|
1280
|
+
declare const tableColumns: (definition: TableDefinitionLike) => ReadonlyArray<readonly [string, ColumnMetaLike]>;
|
|
1009
1281
|
declare const rowToDocument: (row: Record<string, unknown> | undefined) => Record<string, unknown> | undefined;
|
|
1010
1282
|
declare const tryRowToDocument: (row: Record<string, unknown> | undefined) => Record<string, unknown> | undefined;
|
|
1011
1283
|
declare const isFtsAvailable: (sql: SqlExec) => boolean;
|
|
1284
|
+
declare const WORKERD_SQLITE_LIMITS: {
|
|
1285
|
+
readonly boundParams: 100;
|
|
1286
|
+
readonly compoundSelect: 5;
|
|
1287
|
+
readonly likePattern: 50;
|
|
1288
|
+
readonly sqlTextLength: 100000;
|
|
1289
|
+
};
|
|
1012
1290
|
type SqlEngine = "mysql" | "postgres" | "sqlite";
|
|
1013
1291
|
interface RenderedSql {
|
|
1014
1292
|
params: unknown[];
|
|
@@ -1016,6 +1294,79 @@ interface RenderedSql {
|
|
|
1016
1294
|
}
|
|
1017
1295
|
declare const renderSql: (engine: SqlEngine, query: SQL) => RenderedSql;
|
|
1018
1296
|
declare const param: (value: unknown) => SQL;
|
|
1297
|
+
declare const unionAll: (branches: ReadonlyArray<SQL>) => SQL;
|
|
1298
|
+
declare const sqliteInList: (reference: SQL, items: ReadonlyArray<unknown>, negated: boolean, budget?: number) => SQL;
|
|
1299
|
+
type DurableStreamStatus = "complete" | "error" | "running";
|
|
1300
|
+
interface DurableStreamRun {
|
|
1301
|
+
error?: string;
|
|
1302
|
+
errorCode?: string;
|
|
1303
|
+
lastSeq: number;
|
|
1304
|
+
startedAt: number;
|
|
1305
|
+
status: DurableStreamStatus;
|
|
1306
|
+
}
|
|
1307
|
+
interface DurableStreamChunk {
|
|
1308
|
+
dataJson: string;
|
|
1309
|
+
seq: number;
|
|
1310
|
+
}
|
|
1311
|
+
declare const migrateDurableStreams: (sql: SqlExec) => void;
|
|
1312
|
+
declare const readStreamRun: (sql: SqlExec, runKey: string) => DurableStreamRun | undefined;
|
|
1313
|
+
declare const claimStreamRun: (sql: SqlExec, runKey: string, startedAt: number, ttlMs: number) => boolean;
|
|
1314
|
+
declare const deleteStreamRun: (sql: SqlExec, runKey: string) => void;
|
|
1315
|
+
declare const appendStreamChunk: (sql: SqlExec, runKey: string, seq: number, dataJson: string) => void;
|
|
1316
|
+
declare const readStreamChunks: (sql: SqlExec, runKey: string, sinceSeq: number) => DurableStreamChunk[];
|
|
1317
|
+
declare const finishStreamRun: (sql: SqlExec, runKey: string, status: "complete" | "error", lastSeq: number, failure?: {
|
|
1318
|
+
code: string;
|
|
1319
|
+
message: string;
|
|
1320
|
+
}) => void;
|
|
1321
|
+
declare const trimStreamRuns: (sql: SqlExec, now: number, live: ReadonlySet<string>) => void;
|
|
1322
|
+
declare const MAX_DURABLE_STREAM_CHUNKS = 50000;
|
|
1323
|
+
declare const MAX_DURABLE_STREAM_BYTES: number;
|
|
1324
|
+
interface DurableStreamSink {
|
|
1325
|
+
readonly chunk: (chunk: {
|
|
1326
|
+
data: unknown;
|
|
1327
|
+
generation?: number;
|
|
1328
|
+
seq: number;
|
|
1329
|
+
}) => boolean;
|
|
1330
|
+
readonly complete: () => void;
|
|
1331
|
+
readonly fail: (failure: {
|
|
1332
|
+
code: string;
|
|
1333
|
+
message: string;
|
|
1334
|
+
}) => void;
|
|
1335
|
+
}
|
|
1336
|
+
type DurableAttachDecision = "attach" | "interrupted" | "reclaim" | "replay-terminal";
|
|
1337
|
+
declare const decideDurableAttach: (run: DurableStreamRun | undefined, context: {
|
|
1338
|
+
generation?: number;
|
|
1339
|
+
live?: {
|
|
1340
|
+
generation: number;
|
|
1341
|
+
};
|
|
1342
|
+
resuming: boolean;
|
|
1343
|
+
}) => DurableAttachDecision;
|
|
1344
|
+
interface DurableStreamAttach {
|
|
1345
|
+
readonly generation?: number;
|
|
1346
|
+
readonly iterator: (signal: AbortSignal) => AsyncIterable<unknown>;
|
|
1347
|
+
readonly runKey: string;
|
|
1348
|
+
readonly sinceChunk: number;
|
|
1349
|
+
readonly sink: DurableStreamSink;
|
|
1350
|
+
readonly ttlMs?: number;
|
|
1351
|
+
}
|
|
1352
|
+
declare class DurableStreamRunner {
|
|
1353
|
+
private lastTrimAt;
|
|
1354
|
+
private readonly runs;
|
|
1355
|
+
private readonly sql;
|
|
1356
|
+
private readonly waitUntil;
|
|
1357
|
+
constructor(dependencies: {
|
|
1358
|
+
sql: () => SqlExec;
|
|
1359
|
+
waitUntil?: (promise: Promise<unknown>) => void;
|
|
1360
|
+
});
|
|
1361
|
+
attach(request: DurableStreamAttach): Promise<void>;
|
|
1362
|
+
detach(runKey: string, sink: DurableStreamSink): void;
|
|
1363
|
+
isLive(runKey: string): boolean;
|
|
1364
|
+
private attachOrThrow;
|
|
1365
|
+
private produce;
|
|
1366
|
+
private trim;
|
|
1367
|
+
}
|
|
1368
|
+
declare const envPositiveInt: (env: unknown, key: string, fallback: number) => number;
|
|
1369
|
+
declare const envOptionalPositiveInt: (env: unknown, key: string) => number | undefined;
|
|
1019
1370
|
interface ExternalSourceDiffResult {
|
|
1020
1371
|
changes: CdcChange[];
|
|
1021
1372
|
nextBaseline: Map<string, string>;
|
|
@@ -1080,6 +1431,16 @@ declare const isSoftDeleted: (row: Record<string, unknown>, column: string) => b
|
|
|
1080
1431
|
declare const pullExternalSourceIncrementalTick: (sql: SqlExec, writer: DatabaseWriterLike, client: SourceClientLike, table: string, source: ExternalSourceLike, shardKey: string, nowMs: number) => Promise<{
|
|
1081
1432
|
applied: number;
|
|
1082
1433
|
}>;
|
|
1434
|
+
declare const ftsRowidMapName: (companion: string) => string;
|
|
1435
|
+
interface FtsWriteOptions {
|
|
1436
|
+
guard?: SQL;
|
|
1437
|
+
unmappedRowids?: ReadonlyArray<number>;
|
|
1438
|
+
}
|
|
1439
|
+
declare const ftsCompanionDdl: (companion: string) => SQL[];
|
|
1440
|
+
declare const ftsWriteDocument: (companion: string, id: string, text: string, options?: FtsWriteOptions) => SQL[];
|
|
1441
|
+
declare const ftsPurgeDocument: (companion: string, id: string, options?: FtsWriteOptions) => SQL[];
|
|
1442
|
+
declare const ftsUnmappedPage: (companion: string, limit: number, after?: number) => SQL;
|
|
1443
|
+
declare const groupUnmappedRows: (rows: ReadonlyArray<Record<string, unknown>>) => Map<string, number[]>;
|
|
1083
1444
|
declare const GEO_DEFAULT_PRECISION = 9;
|
|
1084
1445
|
interface GeoPoint {
|
|
1085
1446
|
lat: number;
|
|
@@ -1095,6 +1456,20 @@ declare const coveringGeohashes: (center: GeoPoint, radiusMeters: number) => str
|
|
|
1095
1456
|
declare const pointInBoundingBox: (point: GeoPoint, box: GeoBoundingBox) => boolean;
|
|
1096
1457
|
declare const boundingBoxCenter: (box: GeoBoundingBox) => GeoPoint;
|
|
1097
1458
|
declare const boundingBoxGeohashes: (box: GeoBoundingBox) => string[];
|
|
1459
|
+
declare class GlobalPollTick {
|
|
1460
|
+
private readonly changedTables;
|
|
1461
|
+
private readonly reads;
|
|
1462
|
+
private resync;
|
|
1463
|
+
private skippedCount;
|
|
1464
|
+
constructor(changedTables?: Set<string>);
|
|
1465
|
+
get readCount(): number;
|
|
1466
|
+
get resyncRequested(): boolean;
|
|
1467
|
+
get skipped(): number;
|
|
1468
|
+
requestResync(): void;
|
|
1469
|
+
rows(key: string | undefined, load: () => Promise<ShapeRow[]>): Promise<ShapeRow[]>;
|
|
1470
|
+
shouldRead(table: string): boolean;
|
|
1471
|
+
}
|
|
1472
|
+
declare const isInternalTableName: (name: string) => boolean;
|
|
1098
1473
|
declare const ADMIN_FUNCTION_PREFIX = "__lunora_admin__:";
|
|
1099
1474
|
declare const RELATION_FUNCTION_PREFIX = "__lunora_relation__:";
|
|
1100
1475
|
declare const FLAGS_FUNCTION_PREFIX = "__lunora_flags__:";
|
|
@@ -1102,9 +1477,13 @@ declare const ADMIN_FUNCTIONS: {
|
|
|
1102
1477
|
readonly applyCdc: "__lunora_admin__:applyCdc";
|
|
1103
1478
|
readonly aiAvailable: "__lunora_admin__:aiAvailable";
|
|
1104
1479
|
readonly aiChartConfig: "__lunora_admin__:aiChartConfig";
|
|
1480
|
+
readonly aiCronExpression: "__lunora_admin__:aiCronExpression";
|
|
1105
1481
|
readonly aiGenerateSql: "__lunora_admin__:aiGenerateSql";
|
|
1482
|
+
readonly aiNameQuery: "__lunora_admin__:aiNameQuery";
|
|
1106
1483
|
readonly aiTableFilter: "__lunora_admin__:aiTableFilter";
|
|
1107
1484
|
readonly assignIssue: "__lunora_admin__:assignIssue";
|
|
1485
|
+
readonly backfillSearch: "__lunora_admin__:backfillSearch";
|
|
1486
|
+
readonly backfillVectors: "__lunora_admin__:backfillVectors";
|
|
1108
1487
|
readonly backRelationCounts: "__lunora_admin__:backRelationCounts";
|
|
1109
1488
|
readonly cdcSync: "__lunora_admin__:cdcSync";
|
|
1110
1489
|
readonly clearCapturedMail: "__lunora_admin__:clearCapturedMail";
|
|
@@ -1117,6 +1496,7 @@ declare const ADMIN_FUNCTIONS: {
|
|
|
1117
1496
|
readonly explainIssue: "__lunora_admin__:explainIssue";
|
|
1118
1497
|
readonly exportShard: "__lunora_admin__:exportShard";
|
|
1119
1498
|
readonly facetColumn: "__lunora_admin__:facetColumn";
|
|
1499
|
+
readonly findRelated: "__lunora_admin__:findRelated";
|
|
1120
1500
|
readonly getAdvisories: "__lunora_admin__:getAdvisories";
|
|
1121
1501
|
readonly getAdvisorProcedures: "__lunora_admin__:getAdvisorProcedures";
|
|
1122
1502
|
readonly getAuditLog: "__lunora_admin__:getAuditLog";
|
|
@@ -1143,20 +1523,24 @@ declare const ADMIN_FUNCTIONS: {
|
|
|
1143
1523
|
readonly ignoreIssue: "__lunora_admin__:ignoreIssue";
|
|
1144
1524
|
readonly importShard: "__lunora_admin__:importShard";
|
|
1145
1525
|
readonly listFlags: "__lunora_admin__:listFlags";
|
|
1526
|
+
readonly listReactors: "__lunora_admin__:listReactors";
|
|
1146
1527
|
readonly listQueues: "__lunora_admin__:listQueues";
|
|
1147
1528
|
readonly lintSql: "__lunora_admin__:lintSql";
|
|
1148
1529
|
readonly listTables: "__lunora_admin__:listTables";
|
|
1149
1530
|
readonly listWorkflows: "__lunora_admin__:listWorkflows";
|
|
1150
1531
|
readonly maskPolicies: "__lunora_admin__:maskPolicies";
|
|
1151
1532
|
readonly migrationStatus: "__lunora_admin__:migrationStatus";
|
|
1533
|
+
readonly patchRows: "__lunora_admin__:patchRows";
|
|
1152
1534
|
readonly pitrRestore: "__lunora_admin__:pitrRestore";
|
|
1153
1535
|
readonly rankBefore: "__lunora_admin__:rankBefore";
|
|
1154
1536
|
readonly rankPage: "__lunora_admin__:rankPage";
|
|
1155
1537
|
readonly readTablePage: "__lunora_admin__:readTablePage";
|
|
1538
|
+
readonly rebuildCompanions: "__lunora_admin__:rebuildCompanions";
|
|
1156
1539
|
readonly recordAuthEvent: "__lunora_admin__:recordAuthEvent";
|
|
1157
1540
|
readonly recordContainerEvent: "__lunora_admin__:recordContainerEvent";
|
|
1158
1541
|
readonly recordMail: "__lunora_admin__:recordMail";
|
|
1159
1542
|
readonly recordQueueMessage: "__lunora_admin__:recordQueueMessage";
|
|
1543
|
+
readonly releaseShardRegistration: "__lunora_admin__:releaseShardRegistration";
|
|
1160
1544
|
readonly replayQueueMessage: "__lunora_admin__:replayQueueMessage";
|
|
1161
1545
|
readonly resolveIssue: "__lunora_admin__:resolveIssue";
|
|
1162
1546
|
readonly rlsPolicies: "__lunora_admin__:rlsPolicies";
|
|
@@ -1167,6 +1551,7 @@ declare const ADMIN_FUNCTIONS: {
|
|
|
1167
1551
|
readonly runSql: "__lunora_admin__:runSql";
|
|
1168
1552
|
readonly sendQueueMessage: "__lunora_admin__:sendQueueMessage";
|
|
1169
1553
|
readonly sendTestMail: "__lunora_admin__:sendTestMail";
|
|
1554
|
+
readonly sendWorkflowEvent: "__lunora_admin__:sendWorkflowEvent";
|
|
1170
1555
|
readonly setIssueSeverity: "__lunora_admin__:setIssueSeverity";
|
|
1171
1556
|
readonly storageOrphans: "__lunora_admin__:storageOrphans";
|
|
1172
1557
|
readonly storageReferences: "__lunora_admin__:storageReferences";
|
|
@@ -1226,8 +1611,12 @@ interface TablesIndexesResult {
|
|
|
1226
1611
|
indexesByTable: Record<string, TableIndexInfo[]>;
|
|
1227
1612
|
}
|
|
1228
1613
|
interface ColumnMeta {
|
|
1614
|
+
bucket?: string;
|
|
1615
|
+
enumValues?: string[];
|
|
1229
1616
|
isStorage?: boolean;
|
|
1230
1617
|
name: string;
|
|
1618
|
+
nullable?: boolean;
|
|
1619
|
+
onDelete?: "cascade" | "restrict" | "set null";
|
|
1231
1620
|
optional: boolean;
|
|
1232
1621
|
pk?: boolean;
|
|
1233
1622
|
ref?: string;
|
|
@@ -1324,6 +1713,12 @@ interface StudioFeaturesResult {
|
|
|
1324
1713
|
mail: boolean;
|
|
1325
1714
|
notifications: boolean;
|
|
1326
1715
|
payments: boolean;
|
|
1716
|
+
platform?: {
|
|
1717
|
+
id: string;
|
|
1718
|
+
name: string;
|
|
1719
|
+
unsupported: string[];
|
|
1720
|
+
};
|
|
1721
|
+
privacy: boolean;
|
|
1327
1722
|
queues: boolean;
|
|
1328
1723
|
scheduler: boolean;
|
|
1329
1724
|
storage: boolean;
|
|
@@ -1342,13 +1737,26 @@ interface FlagsResult {
|
|
|
1342
1737
|
configured: boolean;
|
|
1343
1738
|
flags: FlagEvaluation[];
|
|
1344
1739
|
}
|
|
1740
|
+
interface ReactorMetadata {
|
|
1741
|
+
errors: number;
|
|
1742
|
+
lastError?: string;
|
|
1743
|
+
lastRanAt?: number;
|
|
1744
|
+
path: string;
|
|
1745
|
+
runs: number;
|
|
1746
|
+
state: "active" | "failing" | "idle";
|
|
1747
|
+
suppressed: number;
|
|
1748
|
+
tables?: ReadonlyArray<string>;
|
|
1749
|
+
}
|
|
1750
|
+
interface ReactorsResult {
|
|
1751
|
+
reactors: ReactorMetadata[];
|
|
1752
|
+
}
|
|
1345
1753
|
interface WorkflowMetadata {
|
|
1346
|
-
binding: string;
|
|
1347
1754
|
className: string;
|
|
1348
1755
|
exportName: string;
|
|
1349
1756
|
name: string;
|
|
1350
1757
|
}
|
|
1351
1758
|
interface WorkflowsResult {
|
|
1759
|
+
eventTypes?: string[];
|
|
1352
1760
|
workflows: WorkflowMetadata[];
|
|
1353
1761
|
}
|
|
1354
1762
|
interface QueueMetadata {
|
|
@@ -1357,11 +1765,12 @@ interface QueueMetadata {
|
|
|
1357
1765
|
exportName: string;
|
|
1358
1766
|
mode: "pull" | "push";
|
|
1359
1767
|
name: string;
|
|
1768
|
+
topic?: string;
|
|
1360
1769
|
}
|
|
1361
1770
|
interface QueuesResult {
|
|
1362
1771
|
queues: QueueMetadata[];
|
|
1363
1772
|
}
|
|
1364
|
-
type WorkflowInstanceState = "complete" | "errored" | "paused" | "queued" | "running" | "terminated" | "unknown" | "waiting" | "waitingForPause";
|
|
1773
|
+
type WorkflowInstanceState = "complete" | "errored" | "paused" | "queued" | "rollingBack" | "running" | "terminated" | "unknown" | "waiting" | "waitingForPause";
|
|
1365
1774
|
interface CreateWorkflowInstanceResult {
|
|
1366
1775
|
id: string;
|
|
1367
1776
|
status: WorkflowInstanceState;
|
|
@@ -1400,12 +1809,15 @@ interface TablePage {
|
|
|
1400
1809
|
columns: string[];
|
|
1401
1810
|
refs?: Record<string, string>;
|
|
1402
1811
|
rows: Record<string, unknown>[];
|
|
1812
|
+
sqlColumns: string[];
|
|
1403
1813
|
total?: number;
|
|
1404
1814
|
}
|
|
1405
|
-
type
|
|
1815
|
+
type ColumnKinds = Readonly<Record<string, string>>;
|
|
1816
|
+
type FilterOperator = "contains" | "eq" | "gt" | "gte" | "has" | "lt" | "lte" | "ne";
|
|
1406
1817
|
interface FilterClause {
|
|
1407
1818
|
column: string;
|
|
1408
1819
|
operator: FilterOperator;
|
|
1820
|
+
path?: string[];
|
|
1409
1821
|
value?: unknown;
|
|
1410
1822
|
}
|
|
1411
1823
|
interface OrderByClause {
|
|
@@ -1413,6 +1825,7 @@ interface OrderByClause {
|
|
|
1413
1825
|
direction: SortDirection;
|
|
1414
1826
|
}
|
|
1415
1827
|
interface ReadTablePageOptions {
|
|
1828
|
+
columnKinds?: ColumnKinds;
|
|
1416
1829
|
filters?: FilterClause[];
|
|
1417
1830
|
limit?: number;
|
|
1418
1831
|
offset?: number;
|
|
@@ -1423,6 +1836,8 @@ interface ReadTablePageOptions {
|
|
|
1423
1836
|
table: string;
|
|
1424
1837
|
}
|
|
1425
1838
|
interface SelectMatchingIdsOptions {
|
|
1839
|
+
after?: string;
|
|
1840
|
+
columnKinds?: ColumnKinds;
|
|
1426
1841
|
filters?: FilterClause[];
|
|
1427
1842
|
limit?: number;
|
|
1428
1843
|
search?: string;
|
|
@@ -1430,6 +1845,7 @@ interface SelectMatchingIdsOptions {
|
|
|
1430
1845
|
}
|
|
1431
1846
|
interface FacetColumnOptions {
|
|
1432
1847
|
column: string;
|
|
1848
|
+
columnKinds?: ColumnKinds;
|
|
1433
1849
|
filters?: FilterClause[];
|
|
1434
1850
|
limit?: number;
|
|
1435
1851
|
search?: string;
|
|
@@ -1445,6 +1861,7 @@ interface FacetColumnResult {
|
|
|
1445
1861
|
}
|
|
1446
1862
|
declare const MAX_PAGE_SIZE = 500;
|
|
1447
1863
|
declare const listTables: (sql: SqlExec) => TableInfo[];
|
|
1864
|
+
declare const isVacuousFilterClause: (clause: FilterClause) => boolean;
|
|
1448
1865
|
declare const readTablePage: (sql: SqlExec, options: ReadTablePageOptions) => TablePage;
|
|
1449
1866
|
declare const selectMatchingIds: (sql: SqlExec, options: SelectMatchingIdsOptions) => {
|
|
1450
1867
|
hasMore: boolean;
|
|
@@ -1463,6 +1880,7 @@ interface StorageReferenceResult {
|
|
|
1463
1880
|
declare const findStorageReferences: (sql: SqlExec, storageColumns: Record<string, string[]>, keys: string[]) => StorageReferenceResult;
|
|
1464
1881
|
interface SocketAttachmentLike {
|
|
1465
1882
|
admin?: boolean;
|
|
1883
|
+
authenticated?: boolean;
|
|
1466
1884
|
subs?: Record<string, SubscriptionInfo>;
|
|
1467
1885
|
}
|
|
1468
1886
|
declare const summarizeSubscriptions: (attachments: SocketAttachmentLike[]) => SubscriptionsResult;
|
|
@@ -1479,18 +1897,29 @@ interface FanoutPathCounters {
|
|
|
1479
1897
|
socketsIterated: number;
|
|
1480
1898
|
totalMs: number;
|
|
1481
1899
|
}
|
|
1900
|
+
interface ShapeProbeCounters {
|
|
1901
|
+
run: number;
|
|
1902
|
+
served: number;
|
|
1903
|
+
}
|
|
1904
|
+
interface GlobalPollCounters {
|
|
1905
|
+
drains: number;
|
|
1906
|
+
pairsSkipped: number;
|
|
1907
|
+
}
|
|
1482
1908
|
interface FanoutMetricsResult {
|
|
1909
|
+
globalPoll: GlobalPollCounters;
|
|
1483
1910
|
maxRelays: number;
|
|
1484
1911
|
peakSubscribers: number;
|
|
1485
1912
|
promoted: boolean;
|
|
1486
1913
|
relayCount: number;
|
|
1487
1914
|
shapePoke: FanoutPathCounters;
|
|
1915
|
+
shapeProbe: ShapeProbeCounters;
|
|
1488
1916
|
sinceMs: number;
|
|
1489
1917
|
topics: FanoutTopicStat[];
|
|
1490
1918
|
totalConnections: number;
|
|
1491
1919
|
whisper: FanoutPathCounters;
|
|
1492
1920
|
}
|
|
1493
1921
|
interface FanoutAttachmentLike {
|
|
1922
|
+
authenticated?: boolean;
|
|
1494
1923
|
shapes?: Record<string, {
|
|
1495
1924
|
name?: string;
|
|
1496
1925
|
}>;
|
|
@@ -1498,6 +1927,10 @@ interface FanoutAttachmentLike {
|
|
|
1498
1927
|
}
|
|
1499
1928
|
declare const DEFAULT_FANOUT_TOPIC_LIMIT = 20;
|
|
1500
1929
|
declare const createFanoutCounters: () => FanoutPathCounters;
|
|
1930
|
+
declare const createShapeProbeCounters: () => ShapeProbeCounters;
|
|
1931
|
+
declare const createGlobalPollCounters: () => GlobalPollCounters;
|
|
1932
|
+
declare const recordGlobalPollPass: (counters: GlobalPollCounters, drains: number, pairsSkipped: number) => GlobalPollCounters;
|
|
1933
|
+
declare const recordShapeProbePass: (counters: ShapeProbeCounters, run: number, served: number) => ShapeProbeCounters;
|
|
1501
1934
|
declare const recordFanoutPass: (counters: FanoutPathCounters, iterated: number, delivered: number, ms: number) => FanoutPathCounters;
|
|
1502
1935
|
declare const summarizeFanoutTopics: (attachments: FanoutAttachmentLike[], limit?: number) => {
|
|
1503
1936
|
peakSubscribers: number;
|
|
@@ -1545,6 +1978,11 @@ declare const clearCapturedMail: (sql: SqlExec) => {
|
|
|
1545
1978
|
declare class NotFoundError extends LunoraError {
|
|
1546
1979
|
constructor(message?: string);
|
|
1547
1980
|
}
|
|
1981
|
+
declare const operatorFields: (definition: TableDefinitionLike, patch: Record<string, unknown>) => ReadonlySet<string>;
|
|
1982
|
+
declare const resolvePatch: (definition: TableDefinitionLike, patch: Record<string, unknown>, current: Record<string, unknown>) => Record<string, unknown>;
|
|
1983
|
+
declare const patchDependsOnRow: (definition: TableDefinitionLike, patch: Record<string, unknown>) => boolean;
|
|
1984
|
+
declare const assertPatchAllowed: (options: PatchWriteOptions | undefined, previous: Record<string, unknown>, next: Record<string, unknown>) => void;
|
|
1985
|
+
declare const readPatchField: (document: Record<string, unknown>, field: string) => unknown;
|
|
1548
1986
|
interface PitrStorage {
|
|
1549
1987
|
getBookmarkForTime?: (time: Date | number) => Promise<string>;
|
|
1550
1988
|
getCurrentBookmark?: () => Promise<string>;
|
|
@@ -1566,7 +2004,22 @@ interface PitrRestoreArgs {
|
|
|
1566
2004
|
}
|
|
1567
2005
|
declare const readBookmark: (storage: PitrStorage, time?: number | string) => Promise<PitrBookmarkResult>;
|
|
1568
2006
|
declare const armRestore: (storage: PitrStorage, args: PitrRestoreArgs) => Promise<Omit<PitrRestoreResult, "restarted">>;
|
|
1569
|
-
declare const
|
|
2007
|
+
declare const tiebreakDirectionFor: (keys: ReadonlyArray<{
|
|
2008
|
+
direction?: string;
|
|
2009
|
+
}>) => SortDirection;
|
|
2010
|
+
declare const equalityPinnedFields: (where: undefined | WhereInput) => ReadonlySet<string>;
|
|
2011
|
+
declare const uniqueIndexFields: (indexes: ReadonlyArray<{
|
|
2012
|
+
fields: ReadonlyArray<string>;
|
|
2013
|
+
unique?: boolean;
|
|
2014
|
+
}> | undefined, shape: Record<string, ValidatorLike> | undefined) => ReadonlyArray<ReadonlyArray<string>>;
|
|
2015
|
+
interface OrderKeyConstraints {
|
|
2016
|
+
pinned?: ReadonlySet<string>;
|
|
2017
|
+
uniqueBy?: ReadonlyArray<ReadonlyArray<string>>;
|
|
2018
|
+
}
|
|
2019
|
+
declare const nullsFirstOf: (key: Pick<OrderKey, "direction" | "nulls">) => boolean;
|
|
2020
|
+
declare const nullsOrderSuffix: (nullsFirst: boolean) => string;
|
|
2021
|
+
declare const normalizeOrderKeys: (orderBy: OrderByInput[] | undefined, shape?: Record<string, ValidatorLike>, constraints?: OrderKeyConstraints) => OrderKey[];
|
|
2022
|
+
declare const CURSOR_PREFIX = "~4";
|
|
1570
2023
|
declare const encodeCursor: (record: Record<string, unknown>, keys: OrderKey[]) => string;
|
|
1571
2024
|
declare const decodeCursor: (cursor: string) => unknown[];
|
|
1572
2025
|
declare const buildSeekWhere: (keys: OrderKey[], cursorValues: unknown[]) => WhereInput;
|
|
@@ -1626,24 +2079,70 @@ declare const rankKeyFromDocument: (index: RankIndexDefinitionLike, document_: R
|
|
|
1626
2079
|
rowId: string;
|
|
1627
2080
|
sortValues: unknown[];
|
|
1628
2081
|
};
|
|
2082
|
+
declare const rankPivotConditionSql: (column: string, value: unknown, direction: "asc" | "desc", wantLater: boolean) => SQL | undefined;
|
|
1629
2083
|
declare const matchesRankStaticWhere: (document: Record<string, unknown>, predicate: Record<string, unknown>) => boolean;
|
|
2084
|
+
declare const REACTOR_STATE_TABLE = "__reactor_state";
|
|
2085
|
+
interface ReactorState {
|
|
2086
|
+
digest: string;
|
|
2087
|
+
lastError?: string;
|
|
2088
|
+
lastRanAt: number;
|
|
2089
|
+
stats: ReactorStats;
|
|
2090
|
+
tables?: ReadonlyArray<string>;
|
|
2091
|
+
}
|
|
2092
|
+
interface ReactorStats {
|
|
2093
|
+
errors: number;
|
|
2094
|
+
runs: number;
|
|
2095
|
+
suppressed: number;
|
|
2096
|
+
}
|
|
2097
|
+
declare const migrateReactorState: (sql: SqlExec) => void;
|
|
2098
|
+
declare const readReactorState: (sql: SqlExec, path: string) => ReactorState | undefined;
|
|
2099
|
+
declare const listReactorStates: (sql: SqlExec) => {
|
|
2100
|
+
path: string;
|
|
2101
|
+
state: ReactorState;
|
|
2102
|
+
}[];
|
|
2103
|
+
type ReactorDispatchResult = "error" | "ran" | "suppressed";
|
|
2104
|
+
declare const writeReactorState: (sql: SqlExec, path: string, outcome: {
|
|
2105
|
+
digest?: string;
|
|
2106
|
+
error?: string;
|
|
2107
|
+
now: number;
|
|
2108
|
+
result: ReactorDispatchResult;
|
|
2109
|
+
tables?: ReadonlyArray<string>;
|
|
2110
|
+
}) => void;
|
|
2111
|
+
declare const reactorNeedsRun: (state: Pick<ReactorState, "tables"> | undefined, changed: ReadonlySet<string>) => boolean;
|
|
1630
2112
|
interface ReadFootprint {
|
|
1631
|
-
onRead: (table: string, idOrScan?: string) => void;
|
|
2113
|
+
onRead: (table: string, idOrScan?: string, exact?: boolean) => void;
|
|
1632
2114
|
onReadRange: (range: KeyRange) => void;
|
|
1633
2115
|
ranges: () => Map<string, KeyRange[]> | undefined;
|
|
1634
2116
|
tables: Set<string>;
|
|
1635
2117
|
}
|
|
1636
2118
|
declare const createReadFootprint: () => ReadFootprint;
|
|
2119
|
+
declare const UNVOUCHABLE_DEP = "!unvouchable";
|
|
2120
|
+
declare const markUnvouchableReads: <T extends object>(facade: T, onRead: ReadFootprint["onRead"] | undefined, methods: ReadonlyArray<string>) => T;
|
|
2121
|
+
declare const WHERE_FILTER: unique symbol;
|
|
2122
|
+
type RowPredicate = (document: Record<string, unknown>) => boolean;
|
|
2123
|
+
type WhereFilter = RowPredicate & {
|
|
2124
|
+
readonly [WHERE_FILTER]: WhereInput;
|
|
2125
|
+
};
|
|
2126
|
+
declare const whereFilter: (where: WhereInput, predicate: RowPredicate) => WhereFilter;
|
|
2127
|
+
declare const whereOfFilter: (predicate: RowPredicate) => undefined | WhereInput;
|
|
2128
|
+
declare const isPushableWhere: (where: WhereInput, shape: Readonly<Record<string, ValidatorLike>>, exactText?: boolean) => boolean;
|
|
2129
|
+
declare const RELATED_MAX_DEPTH = 4;
|
|
2130
|
+
declare const RELATED_DEFAULT_LIMIT = 50;
|
|
2131
|
+
declare const RELATED_MAX_LIMIT = 200;
|
|
2132
|
+
declare const RELATED_DEPTH_DECAY = 0.5;
|
|
2133
|
+
declare const deriveRelationEdges: (schema: SchemaLike) => RelationEdge[];
|
|
2134
|
+
type RelationGraphReader = Pick<DatabaseWriterLike, "findMany"> & Pick<Partial<DatabaseWriterLike>, "lookupById">;
|
|
2135
|
+
declare const findRelated: (reader: RelationGraphReader, edges: ReadonlyArray<RelationEdge>, start: RelatedStart, options?: RelatedOptions) => Promise<RelatedPage>;
|
|
1637
2136
|
declare const DEFAULT_MAX_RELATION_KEYS = 5000;
|
|
1638
2137
|
interface RelationExistsMarker {
|
|
1639
2138
|
childWhere: WhereInput;
|
|
1640
2139
|
negated: boolean;
|
|
1641
2140
|
parentTable: string;
|
|
1642
|
-
relation:
|
|
2141
|
+
relation: KeyedRelationDefinitionLike;
|
|
1643
2142
|
}
|
|
1644
2143
|
type ExistsPushMode = "always" | "auto";
|
|
1645
2144
|
interface ResolveRelationPredicatesOptions {
|
|
1646
|
-
canPushExists?: (relation:
|
|
2145
|
+
canPushExists?: (relation: KeyedRelationDefinitionLike) => boolean;
|
|
1647
2146
|
existsPushMode?: ExistsPushMode;
|
|
1648
2147
|
fetcher: (tableName: string, args: QueryArgs) => Promise<QueryPage>;
|
|
1649
2148
|
maxRelationKeys?: number;
|
|
@@ -1654,7 +2153,7 @@ interface ResolveRelationPredicatesOptions {
|
|
|
1654
2153
|
tableName: string;
|
|
1655
2154
|
}
|
|
1656
2155
|
interface ResolveContext {
|
|
1657
|
-
canPushExists?: (relation:
|
|
2156
|
+
canPushExists?: (relation: KeyedRelationDefinitionLike) => boolean;
|
|
1658
2157
|
existsPushMode: ExistsPushMode;
|
|
1659
2158
|
fetcher: (tableName: string, args: QueryArgs) => Promise<QueryPage>;
|
|
1660
2159
|
maxRelationKeys: number;
|
|
@@ -1667,15 +2166,24 @@ declare const isRelationPredicate: (value: unknown) => value is Record<string, W
|
|
|
1667
2166
|
declare const containsRelationPredicate: (where: WhereInput, schema: ResolveContext["schema"], tableName: string) => boolean;
|
|
1668
2167
|
declare const assertFlatPredicate: (where: WhereInput | undefined, schema: ResolveContext["schema"], tableName: string, op: string) => void;
|
|
1669
2168
|
declare const resolveRelationPredicates: (where: WhereInput | undefined, options: ResolveRelationPredicatesOptions) => Promise<WhereInput | undefined>;
|
|
2169
|
+
declare const composeReadPredicate: (definition: TableDefinitionLike, args: QueryArgs, relation: Omit<ResolveRelationPredicatesOptions, "relationBaseWhere">) => Promise<{
|
|
2170
|
+
fetchLimit: number | undefined;
|
|
2171
|
+
limit: number | undefined;
|
|
2172
|
+
orderKeys: OrderKey[];
|
|
2173
|
+
predicate: WhereInput | undefined;
|
|
2174
|
+
}>;
|
|
1670
2175
|
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">;
|
|
2176
|
+
declare const relationHooks: (args: Pick<QueryArgs, "relationBaseWhere" | "relationMask">) => Pick<QueryArgs, "relationBaseWhere" | "relationMask"> & Pick<ResolveWithOptions, "fanOutBudget">;
|
|
1672
2177
|
declare const fanOutScalarCounts: (counter: (tableName: string, where?: WhereInput) => Promise<number>, tableName: string, whereField: string, values: unknown[], policyWhere: WhereInput | undefined) => Promise<Map<unknown, number>>;
|
|
1673
2178
|
declare const distinctValues: (rows: Record<string, unknown>[], field: string) => unknown[];
|
|
1674
2179
|
declare const resolveWith: (options: ResolveWithOptions) => Promise<void>;
|
|
1675
2180
|
interface ApplyOnDeleteOptions {
|
|
1676
2181
|
deletedId: string;
|
|
1677
2182
|
deletedReference: (references: string) => unknown;
|
|
1678
|
-
findHolders: (holderTable: string, field: string, value: unknown
|
|
2183
|
+
findHolders: (holderTable: string, field: string, value: unknown, page: {
|
|
2184
|
+
limit: number;
|
|
2185
|
+
select?: ReadonlyArray<string>;
|
|
2186
|
+
}) => Promise<Record<string, unknown>[]>;
|
|
1679
2187
|
onCascade: (holderTable: string, id: string) => Promise<void>;
|
|
1680
2188
|
onRestrict: (message: string) => never;
|
|
1681
2189
|
onSetNull: (holderTable: string, id: string, field: string) => Promise<void>;
|
|
@@ -1685,7 +2193,15 @@ interface ApplyOnDeleteOptions {
|
|
|
1685
2193
|
tableName: string;
|
|
1686
2194
|
}
|
|
1687
2195
|
declare const applyOnDelete: (options: ApplyOnDeleteOptions) => Promise<void>;
|
|
1688
|
-
|
|
2196
|
+
interface RowValidatorOptions {
|
|
2197
|
+
only?: ReadonlySet<string>;
|
|
2198
|
+
previous?: () => Readonly<Record<string, unknown>> | undefined;
|
|
2199
|
+
supplied?: Readonly<Record<string, unknown>>;
|
|
2200
|
+
tolerateStoredNull?: boolean;
|
|
2201
|
+
trusted?: boolean;
|
|
2202
|
+
}
|
|
2203
|
+
declare const applyInsertDefaults: (definition: TableDefinitionLike, document: Record<string, unknown>, auth: ServerDefaultContextLike["auth"]) => Record<string, unknown>;
|
|
2204
|
+
declare const runRowValidators: (definition: TableDefinitionLike, document: Record<string, unknown>, options?: RowValidatorOptions) => Record<string, unknown>;
|
|
1689
2205
|
interface ShapeRowOp {
|
|
1690
2206
|
key: string;
|
|
1691
2207
|
op: "delete" | "insert" | "update";
|
|
@@ -1693,6 +2209,8 @@ interface ShapeRowOp {
|
|
|
1693
2209
|
value?: Record<string, unknown>;
|
|
1694
2210
|
}
|
|
1695
2211
|
interface ShapePokePart {
|
|
2212
|
+
baseCheckpoint?: number;
|
|
2213
|
+
reset?: boolean;
|
|
1696
2214
|
rowsPatch: ShapeRowOp[];
|
|
1697
2215
|
shapeId: string;
|
|
1698
2216
|
}
|
|
@@ -1727,15 +2245,18 @@ declare const clampPromotionThresholds: (tUp: number, tDownRaw: number) => Promo
|
|
|
1727
2245
|
declare const relayCountFor: (subscribers: number, perRelayCapacity: number, maxRelays: number) => number;
|
|
1728
2246
|
interface RelayAttach {
|
|
1729
2247
|
relayIndex: number;
|
|
2248
|
+
seq?: number;
|
|
1730
2249
|
type: "relay_attach";
|
|
1731
2250
|
}
|
|
1732
2251
|
interface RelayDetach {
|
|
1733
2252
|
relayIndex: number;
|
|
2253
|
+
seq?: number;
|
|
1734
2254
|
type: "relay_detach";
|
|
1735
2255
|
}
|
|
1736
2256
|
interface RelayFrame {
|
|
1737
2257
|
cursor?: number;
|
|
1738
2258
|
epoch?: string;
|
|
2259
|
+
exceptConnectionId?: string;
|
|
1739
2260
|
frame: string;
|
|
1740
2261
|
originRelay?: number;
|
|
1741
2262
|
topic: string;
|
|
@@ -1753,6 +2274,12 @@ interface RelayShapeSubscribe {
|
|
|
1753
2274
|
type: "relay_shape_subscribe";
|
|
1754
2275
|
userId?: string;
|
|
1755
2276
|
}
|
|
2277
|
+
interface RelayShapeUnsubscribe {
|
|
2278
|
+
connectionId: string;
|
|
2279
|
+
relayIndex: number;
|
|
2280
|
+
subId?: string;
|
|
2281
|
+
type: "relay_shape_unsubscribe";
|
|
2282
|
+
}
|
|
1756
2283
|
interface RelayShapeSeed {
|
|
1757
2284
|
cursor?: number;
|
|
1758
2285
|
epoch?: string;
|
|
@@ -1772,44 +2299,88 @@ interface RelayShapePoke {
|
|
|
1772
2299
|
targetConnectionId?: string;
|
|
1773
2300
|
type: "relay_shape_poke";
|
|
1774
2301
|
}
|
|
1775
|
-
|
|
1776
|
-
|
|
1777
|
-
|
|
1778
|
-
|
|
2302
|
+
interface RelayRoomEvent {
|
|
2303
|
+
attachment: Pick<SocketAttachment, "connectionId" | "context" | "expiresAt" | "identity" | "ip" | "revalidateAt" | "userId">;
|
|
2304
|
+
connectionId: string;
|
|
2305
|
+
data?: unknown;
|
|
2306
|
+
kind: "join" | "leave" | "message";
|
|
2307
|
+
relayIndex: number;
|
|
2308
|
+
topic: string;
|
|
2309
|
+
type: "relay_room_event";
|
|
2310
|
+
}
|
|
2311
|
+
interface RelayRoomVerdict {
|
|
2312
|
+
admitted: boolean;
|
|
2313
|
+
}
|
|
2314
|
+
interface LiveSocketControlCall {
|
|
2315
|
+
action: unknown;
|
|
2316
|
+
adminReauth?: true;
|
|
2317
|
+
callerId: string;
|
|
2318
|
+
connectionId: string;
|
|
2319
|
+
identity?: Record<string, unknown>;
|
|
2320
|
+
identityExpiry?: number;
|
|
2321
|
+
key: string;
|
|
2322
|
+
seq?: number;
|
|
2323
|
+
subscriptionId: string;
|
|
2324
|
+
}
|
|
2325
|
+
interface RelayLiveControl {
|
|
2326
|
+
control: LiveSocketControlCall;
|
|
2327
|
+
type: "relay_live_control";
|
|
1779
2328
|
}
|
|
1780
|
-
interface
|
|
1781
|
-
|
|
1782
|
-
|
|
1783
|
-
|
|
2329
|
+
interface RelayLiveFrame {
|
|
2330
|
+
frame: string;
|
|
2331
|
+
key: string;
|
|
2332
|
+
topic: string;
|
|
2333
|
+
type: "relay_live_frame";
|
|
2334
|
+
}
|
|
2335
|
+
type OwnerRelayFrame = RelayAttach | RelayDetach | RelayFrame | RelayLiveControl | RelayLiveFrame | RelayRoomEvent | RelayShapePoke | RelayShapeSubscribe | RelayShapeUnsubscribe;
|
|
2336
|
+
declare const RELAY_SIGNATURE_HEADER = "x-lunora-relay-sig";
|
|
2337
|
+
declare const siblingSecretOf: (env: unknown) => string | undefined;
|
|
2338
|
+
declare const signSiblingBody: (secret: string, body: string) => Promise<string>;
|
|
2339
|
+
declare const verifySiblingBody: (env: unknown, supplied: null | string, raw: string) => Promise<boolean>;
|
|
2340
|
+
interface SiblingStub {
|
|
2341
|
+
fetch: (url: string, init?: RequestInit) => Promise<Response>;
|
|
1784
2342
|
}
|
|
2343
|
+
declare const stubByName: (value: unknown, name: string, jurisdiction?: string) => SiblingStub | undefined;
|
|
2344
|
+
declare const DEFAULT_MAX_RELAYS = 8;
|
|
1785
2345
|
interface RelayHost {
|
|
1786
2346
|
buildShapeDiff: (resolved: ResolvedShape, fromCursor: number, toCursor: number) => ShapeRowOp[];
|
|
1787
2347
|
computeOpLogShapeSeed: (shape: ShapeSubscriptionQuery, resolved: ResolvedShape) => {
|
|
1788
2348
|
baseCheckpoint: number | undefined;
|
|
1789
2349
|
cursor: number;
|
|
1790
2350
|
epoch: string | undefined;
|
|
2351
|
+
reset: boolean;
|
|
1791
2352
|
rowsPatch: ShapeRowOp[];
|
|
1792
2353
|
};
|
|
1793
2354
|
currentCdcEpoch: () => string | undefined;
|
|
2355
|
+
deliverLiveLocal: (topic: string, key: string, frame: string) => number;
|
|
1794
2356
|
deliverWhisperLocal: (topic: string, frame: string, exclude: undefined | ShardSocketLike) => number;
|
|
1795
2357
|
doName: () => string | undefined;
|
|
2358
|
+
dropIfLapsed: (ws: ShardSocketLike) => boolean;
|
|
1796
2359
|
env: () => unknown;
|
|
1797
2360
|
getWebSockets: () => ShardSocketLike[];
|
|
2361
|
+
liveControl: (control: LiveSocketControlCall) => Promise<Response>;
|
|
1798
2362
|
maskMetadata: () => MaskPoliciesResult;
|
|
1799
2363
|
nextPokeId: () => string;
|
|
1800
2364
|
readAttachment: (ws: ShardSocketLike) => SocketAttachment;
|
|
1801
2365
|
recordShapePokeFanout: (iterated: number, delivered: number, elapsedMs: number) => void;
|
|
2366
|
+
relayRoomEvent: (event: RelayRoomEvent) => Promise<RelayRoomVerdict>;
|
|
1802
2367
|
resolveShape: (name: string, args: Record<string, unknown>, identity?: SubscriptionIdentity) => ResolvedShape | undefined;
|
|
1803
2368
|
rlsMetadata: () => RlsPoliciesResult;
|
|
1804
2369
|
shardBinding: () => string | undefined;
|
|
2370
|
+
shardJurisdiction: () => string | undefined;
|
|
1805
2371
|
sql: () => SqlExec;
|
|
1806
2372
|
}
|
|
2373
|
+
interface RelayPokeDelivery {
|
|
2374
|
+
delivered: number;
|
|
2375
|
+
matched: number;
|
|
2376
|
+
}
|
|
1807
2377
|
declare abstract class RelayLink {
|
|
1808
2378
|
protected readonly host: RelayHost;
|
|
1809
2379
|
protected readonly roleId: {
|
|
1810
2380
|
ownerKey: string;
|
|
1811
2381
|
relayIndex?: number;
|
|
1812
2382
|
};
|
|
2383
|
+
private lastSequence;
|
|
1813
2384
|
protected constructor(host: RelayHost, roleId: {
|
|
1814
2385
|
ownerKey: string;
|
|
1815
2386
|
relayIndex?: number;
|
|
@@ -1817,81 +2388,188 @@ declare abstract class RelayLink {
|
|
|
1817
2388
|
handleControl(request: Request): Promise<Response>;
|
|
1818
2389
|
maxRelays(): number;
|
|
1819
2390
|
protected canAddressSiblings(): boolean;
|
|
1820
|
-
protected
|
|
2391
|
+
protected isAdmitted(ws: ShardSocketLike): boolean;
|
|
2392
|
+
protected siblingStub(targetName: string): SiblingStub | undefined;
|
|
2393
|
+
protected bindingName(): string | undefined;
|
|
2394
|
+
protected nextRelaySeq(): number;
|
|
1821
2395
|
protected postRelayMessage(targetName: string, message: OwnerRelayFrame): Promise<void>;
|
|
1822
2396
|
protected requestRelayMessage(targetName: string, message: OwnerRelayFrame): Promise<Response | undefined>;
|
|
1823
|
-
abstract forwardWhisper(topic: string, frame: string): Promise<void>;
|
|
2397
|
+
abstract forwardWhisper(topic: string, frame: string, exceptConnectionId?: string): Promise<void>;
|
|
1824
2398
|
abstract onFlush(changed: Set<string>, frameCursor: number): Promise<void>;
|
|
1825
2399
|
abstract seedRelayShape(ws: ShardSocketLike, subId: string, shape: ShapeSubscriptionQuery, identity: SubscriptionIdentity): Promise<"ok" | undefined | {
|
|
1826
2400
|
code: string;
|
|
1827
2401
|
message: string;
|
|
1828
2402
|
}>;
|
|
1829
|
-
abstract announce(): Promise<
|
|
2403
|
+
abstract announce(): Promise<boolean>;
|
|
1830
2404
|
abstract announceDrain(closing: ShardSocketLike): Promise<void>;
|
|
2405
|
+
abstract releaseRelayShapes(ws: ShardSocketLike, subId?: string): Promise<void>;
|
|
1831
2406
|
abstract relayCount(): number;
|
|
1832
2407
|
abstract isShapeRelayUniform(name: string, args: Record<string, unknown>): boolean;
|
|
1833
|
-
|
|
1834
|
-
protected abstract
|
|
2408
|
+
abstract minShapeCursor(): number | undefined;
|
|
2409
|
+
protected abstract onAttach(index: number, seq: number | undefined): boolean;
|
|
2410
|
+
protected abstract onDetach(index: number, seq: number | undefined): boolean;
|
|
2411
|
+
protected abstract onLiveControl(control: LiveSocketControlCall): Promise<Response>;
|
|
1835
2412
|
protected abstract onWhisperFrame(message: RelayFrame): Promise<void>;
|
|
2413
|
+
protected abstract refusesAsIdle(): boolean;
|
|
1836
2414
|
protected abstract onShapeSubscribe(message: RelayShapeSubscribe): RelayShapeSeed;
|
|
1837
|
-
protected abstract
|
|
2415
|
+
protected abstract onShapeUnsubscribe(message: RelayShapeUnsubscribe): void;
|
|
2416
|
+
protected abstract onShapePoke(poke: RelayShapePoke): RelayPokeDelivery;
|
|
1838
2417
|
}
|
|
1839
2418
|
declare class OwnerRelay extends RelayLink {
|
|
1840
2419
|
private readonly shapeUniformCache;
|
|
1841
2420
|
private relaySetCache;
|
|
1842
|
-
private
|
|
1843
|
-
private
|
|
2421
|
+
private liveGrantRelayCache;
|
|
2422
|
+
private relayTablesReady;
|
|
2423
|
+
private readonly relaySeqMarks;
|
|
2424
|
+
private readonly pendingSubscribeRelays;
|
|
2425
|
+
private registryCache;
|
|
2426
|
+
private recorded;
|
|
1844
2427
|
private promotionState;
|
|
1845
2428
|
constructor(host: RelayHost, ownerKey: string);
|
|
1846
|
-
forwardWhisper(topic: string, frame: string): Promise<void>;
|
|
2429
|
+
forwardWhisper(topic: string, frame: string, exceptConnectionId?: string): Promise<void>;
|
|
2430
|
+
forwardLiveControl(call: LiveSocketControlCall): Promise<Response | undefined>;
|
|
2431
|
+
forwardLiveFrame(topic: string, key: string, frame: string): Promise<void>;
|
|
1847
2432
|
onFlush(changed: Set<string>, frameCursor: number): Promise<void>;
|
|
1848
2433
|
seedRelayShape(): Promise<"ok" | undefined | {
|
|
1849
2434
|
code: string;
|
|
1850
2435
|
message: string;
|
|
1851
2436
|
}>;
|
|
1852
|
-
announce(): Promise<
|
|
2437
|
+
announce(): Promise<boolean>;
|
|
1853
2438
|
announceDrain(): Promise<void>;
|
|
2439
|
+
releaseRelayShapes(): Promise<void>;
|
|
1854
2440
|
relayCount(): number;
|
|
2441
|
+
minShapeCursor(): number | undefined;
|
|
1855
2442
|
isShapeRelayUniform(name: string, args: Record<string, unknown>): boolean;
|
|
1856
|
-
protected
|
|
1857
|
-
protected
|
|
2443
|
+
protected onShapeUnsubscribe(message: RelayShapeUnsubscribe): void;
|
|
2444
|
+
protected onAttach(index: number, seq: number | undefined): boolean;
|
|
2445
|
+
protected onDetach(index: number, seq: number | undefined): boolean;
|
|
2446
|
+
protected refusesAsIdle(): boolean;
|
|
2447
|
+
protected onLiveControl(control: LiveSocketControlCall): Promise<Response>;
|
|
1858
2448
|
protected onWhisperFrame(message: RelayFrame): Promise<void>;
|
|
1859
2449
|
protected onShapeSubscribe(message: RelayShapeSubscribe): RelayShapeSeed;
|
|
1860
|
-
protected onShapePoke():
|
|
2450
|
+
protected onShapePoke(): RelayPokeDelivery;
|
|
2451
|
+
private relaySeqMark;
|
|
2452
|
+
private recordRelaySeq;
|
|
2453
|
+
private acceptRelaySeq;
|
|
1861
2454
|
private buildShapePoke;
|
|
1862
2455
|
private multicastShapePokes;
|
|
2456
|
+
private multicastToRelays;
|
|
1863
2457
|
private proxyShapePokes;
|
|
2458
|
+
private proxyToRelay;
|
|
1864
2459
|
private buildShapeSeedFrames;
|
|
1865
|
-
private
|
|
2460
|
+
private ensureRelayTables;
|
|
2461
|
+
protected bindingName(): string | undefined;
|
|
2462
|
+
private relayShapes;
|
|
2463
|
+
private rewindShapeCursor;
|
|
1866
2464
|
private ownerRelaySet;
|
|
2465
|
+
private liveGrantRelaySet;
|
|
2466
|
+
private recordLiveGrantRelay;
|
|
1867
2467
|
private addRelayToSet;
|
|
2468
|
+
private forwardToRelay;
|
|
2469
|
+
private requestDroppingIdle;
|
|
1868
2470
|
private removeRelayFromSet;
|
|
1869
2471
|
private probeShapeRelayUniform;
|
|
1870
2472
|
private tableHasAnyMask;
|
|
2473
|
+
private liveControlAnswer;
|
|
1871
2474
|
}
|
|
1872
2475
|
declare class RelayMember extends RelayLink {
|
|
1873
2476
|
private relayAnnounced;
|
|
1874
|
-
private readonly
|
|
2477
|
+
private readonly liveControlSeqs;
|
|
2478
|
+
private pendingAnnounce;
|
|
2479
|
+
private announceGeneration;
|
|
2480
|
+
private pendingDetach;
|
|
2481
|
+
private relayMemoCache;
|
|
2482
|
+
private readonly shapeControl;
|
|
1875
2483
|
constructor(host: RelayHost, ownerKey: string, relayIndex: number);
|
|
1876
2484
|
forwardWhisper(topic: string, frame: string): Promise<void>;
|
|
2485
|
+
forwardRoomEvent(event: Omit<RelayRoomEvent, "relayIndex" | "type">): Promise<boolean>;
|
|
1877
2486
|
onFlush(): Promise<void>;
|
|
1878
2487
|
seedRelayShape(ws: ShardSocketLike, subId: string, shape: ShapeSubscriptionQuery, identity: SubscriptionIdentity): Promise<"ok" | {
|
|
1879
2488
|
code: string;
|
|
1880
2489
|
message: string;
|
|
1881
2490
|
}>;
|
|
1882
|
-
announce(): Promise<
|
|
2491
|
+
announce(): Promise<boolean>;
|
|
1883
2492
|
announceDrain(closing: ShardSocketLike): Promise<void>;
|
|
2493
|
+
releaseRelayShapes(ws: ShardSocketLike, subId?: string): Promise<void>;
|
|
1884
2494
|
relayCount(): number;
|
|
1885
2495
|
isShapeRelayUniform(): boolean;
|
|
1886
|
-
|
|
1887
|
-
protected
|
|
2496
|
+
minShapeCursor(): number | undefined;
|
|
2497
|
+
protected onAttach(): boolean;
|
|
2498
|
+
protected refusesAsIdle(): boolean;
|
|
2499
|
+
protected onDetach(): boolean;
|
|
2500
|
+
protected onLiveControl(control: LiveSocketControlCall): Promise<Response>;
|
|
1888
2501
|
protected onWhisperFrame(): Promise<void>;
|
|
1889
2502
|
protected onShapeSubscribe(): RelayShapeSeed;
|
|
1890
|
-
protected
|
|
2503
|
+
protected onShapeUnsubscribe(): void;
|
|
2504
|
+
protected onShapePoke(poke: RelayShapePoke): RelayPokeDelivery;
|
|
2505
|
+
private queueShapeControl;
|
|
2506
|
+
private relayMemos;
|
|
2507
|
+
private connectionMemos;
|
|
1891
2508
|
private recordRelayShapeMemo;
|
|
2509
|
+
private forgetRelayShapeMemos;
|
|
1892
2510
|
private deliverShapePoke;
|
|
2511
|
+
private pokeSocketShapes;
|
|
1893
2512
|
}
|
|
1894
2513
|
declare const createRelayLink: (host: RelayHost) => OwnerRelay | RelayMember | undefined;
|
|
2514
|
+
declare const REGION_HINTS: readonly ["wnam", "enam", "sam", "weur", "eeur", "apac", "apac-ne", "apac-se", "oc", "afr", "me"];
|
|
2515
|
+
type RegionHint = (typeof REGION_HINTS)[number];
|
|
2516
|
+
type ReplicaReadiness = "fresh" | "stale" | "unavailable";
|
|
2517
|
+
interface ShardSiblingHost {
|
|
2518
|
+
doName: () => string | undefined;
|
|
2519
|
+
env: () => unknown;
|
|
2520
|
+
shardBinding: () => string | undefined;
|
|
2521
|
+
shardJurisdiction: () => string | undefined;
|
|
2522
|
+
sql: () => SqlExec;
|
|
2523
|
+
}
|
|
2524
|
+
interface ReplicaOwnerHost extends ShardSiblingHost {
|
|
2525
|
+
exportRows: () => Promise<ExportRow[]>;
|
|
2526
|
+
ownerCursor: () => number | undefined;
|
|
2527
|
+
ownerEpoch: () => string | undefined;
|
|
2528
|
+
ownerFloor: () => number | undefined;
|
|
2529
|
+
readChanges: (sinceSeq: number, limit: number) => {
|
|
2530
|
+
changes: CdcChange[];
|
|
2531
|
+
cursor: number;
|
|
2532
|
+
};
|
|
2533
|
+
rowCount: () => number;
|
|
2534
|
+
}
|
|
2535
|
+
interface ReplicaFollowerHost extends ShardSiblingHost {
|
|
2536
|
+
applyChanges: (changes: ReadonlyArray<CdcChange>) => Promise<number>;
|
|
2537
|
+
exportRows: () => Promise<ExportRow[]>;
|
|
2538
|
+
importRows: (rows: ReadonlyArray<ExportRow>) => Promise<{
|
|
2539
|
+
errors: ReadonlyArray<unknown>;
|
|
2540
|
+
}>;
|
|
2541
|
+
reportError?: (scope: string, error: unknown) => void;
|
|
2542
|
+
transactionLimits: () => Partial<TransactionLimits>;
|
|
2543
|
+
}
|
|
2544
|
+
declare const handleReplicaControl: (host: ReplicaOwnerHost, request: Request) => Promise<Response>;
|
|
2545
|
+
declare class ShardReplica {
|
|
2546
|
+
private readonly host;
|
|
2547
|
+
readonly ownerKey: string;
|
|
2548
|
+
readonly region: RegionHint;
|
|
2549
|
+
private divergent;
|
|
2550
|
+
private inFlight;
|
|
2551
|
+
constructor(host: ReplicaFollowerHost, ownerKey: string, region: RegionHint);
|
|
2552
|
+
ensureFresh(minSeq?: number): Promise<ReplicaReadiness>;
|
|
2553
|
+
appliedSeq(): number;
|
|
2554
|
+
isDivergent(): boolean;
|
|
2555
|
+
private advance;
|
|
2556
|
+
private isCaughtUp;
|
|
2557
|
+
private catchUp;
|
|
2558
|
+
private verdict;
|
|
2559
|
+
private recover;
|
|
2560
|
+
private whenOwnerUnreachable;
|
|
2561
|
+
private applyPage;
|
|
2562
|
+
private applyAtomically;
|
|
2563
|
+
private fetchSnapshot;
|
|
2564
|
+
private resnapshot;
|
|
2565
|
+
private overWriteBudget;
|
|
2566
|
+
private bootstrap;
|
|
2567
|
+
private isFreshEnough;
|
|
2568
|
+
private pull;
|
|
2569
|
+
private request;
|
|
2570
|
+
}
|
|
2571
|
+
declare const createReplicaLink: (host: ReplicaFollowerHost) => ShardReplica | undefined;
|
|
2572
|
+
declare const gateReplicaDispatch: (replica: ShardReplica, request: Request, functionPath: string) => Promise<Response | undefined>;
|
|
1895
2573
|
declare const REPROJECTION_MIGRATION_PREFIX = "__lunora_reproject__";
|
|
1896
2574
|
declare const reprojectionMigrationId: (table: string) => string;
|
|
1897
2575
|
declare const reprojectableFields: (definition: TableDefinitionLike) => string[];
|
|
@@ -1913,8 +2591,7 @@ interface GuardableSchema {
|
|
|
1913
2591
|
}>;
|
|
1914
2592
|
}
|
|
1915
2593
|
type TableOfId = (id: string, expectedTable?: string) => Promise<string | undefined> | string | undefined;
|
|
1916
|
-
|
|
1917
|
-
declare const guardWriter: <W>(raw: W, schema: GuardableSchema, tableOfId: TableOfId, tablesOfIds?: TablesOfIds) => W;
|
|
2594
|
+
declare const guardWriter: <W>(raw: W, schema: GuardableSchema, tableOfId: TableOfId, relationEdges?: ReadonlyArray<RelationEdge>) => W;
|
|
1918
2595
|
declare const SCHEMA_HISTORY_MAX_VERSIONS = 50;
|
|
1919
2596
|
interface SchemaVersionRow {
|
|
1920
2597
|
appliedAt: number;
|
|
@@ -1925,8 +2602,24 @@ interface SchemaVersionRow {
|
|
|
1925
2602
|
declare const recordSchemaVersion: (sql: SqlExec, hash: string, snapshotJson: string, now?: number) => boolean;
|
|
1926
2603
|
declare const readSchemaHistory: (sql: SqlExec) => SchemaVersionRow[];
|
|
1927
2604
|
declare const readSchemaVersion: (sql: SqlExec, hash: string) => SchemaVersionRow | undefined;
|
|
2605
|
+
declare const readDeployInfo: (rawEnv: unknown) => DeployInfo;
|
|
1928
2606
|
declare const isDevEnvironment: (rawEnv: unknown) => boolean;
|
|
1929
2607
|
declare const buildSettings: (rawEnv: unknown) => SettingsResult;
|
|
2608
|
+
declare class ShapeDiffCache {
|
|
2609
|
+
private readonly keyScans;
|
|
2610
|
+
private readonly memberProbes;
|
|
2611
|
+
private run;
|
|
2612
|
+
private served;
|
|
2613
|
+
get probesRun(): number;
|
|
2614
|
+
get probesServed(): number;
|
|
2615
|
+
changedKeys(rangeKey: string, load: () => CdcChangeKey[]): ReadonlyArray<CdcChangeKey>;
|
|
2616
|
+
members(resolved: ResolvedShape, rangeKey: string, load: () => Map<string, Record<string, unknown>>): ReadonlyMap<string, Record<string, unknown>>;
|
|
2617
|
+
private getOrLoad;
|
|
2618
|
+
}
|
|
2619
|
+
declare const createShapeDiffCache: () => ShapeDiffCache;
|
|
2620
|
+
declare const globalShapeReadKey: (resolved: ResolvedShape, identity: SubscriptionIdentity) => string | undefined;
|
|
2621
|
+
type ReadShapeCdcKeys = (sql: SqlExec, table: string, sinceSeq: number, upTo: number) => CdcChangeKey[];
|
|
2622
|
+
declare const buildShapeDiff: (sql: SqlExec, resolved: ResolvedShape, sinceSeq: number, upTo: number, cache: ShapeDiffCache, readKeys?: ReadShapeCdcKeys) => ShapeRowOp[];
|
|
1930
2623
|
interface ShardRunnerOptions {
|
|
1931
2624
|
handlers?: {
|
|
1932
2625
|
handleAlarm?: () => Promise<void>;
|
|
@@ -1942,7 +2635,7 @@ declare class ShardRunner {
|
|
|
1942
2635
|
socketFor(raw: unknown): ShardSocketLike;
|
|
1943
2636
|
sockets(tag?: string): SocketHandle[];
|
|
1944
2637
|
background(work: Promise<unknown>): boolean;
|
|
1945
|
-
runInTransaction<T>(work: () => Promise<T
|
|
2638
|
+
runInTransaction<T>(work: () => Promise<T>, onCommitted?: () => void): Promise<T>;
|
|
1946
2639
|
handleFetch(request: Request): Promise<Response>;
|
|
1947
2640
|
handleAlarm(): Promise<void>;
|
|
1948
2641
|
}
|
|
@@ -1968,6 +2661,11 @@ interface SqlDiagnostic {
|
|
|
1968
2661
|
source: "gate" | "plan" | "syntax";
|
|
1969
2662
|
}
|
|
1970
2663
|
declare const lintReadonlySql: (sql: SqlExec, query: string) => SqlLintResult;
|
|
2664
|
+
declare const BIGINT_KEY_DIGITS = 39;
|
|
2665
|
+
declare const bigintSqlKey: (value: bigint) => string;
|
|
2666
|
+
declare const decodeBigintSqlKey: (raw: string) => bigint | undefined;
|
|
2667
|
+
declare const float64SqlKey: (value: number) => string;
|
|
2668
|
+
declare const decodeFloat64SqlKey: (raw: string) => number | undefined;
|
|
1971
2669
|
declare const subscriptionListDeltas: (previousJson: string, nextResult: unknown, table: string, frames?: string[]) => MutationDelta[] | undefined;
|
|
1972
2670
|
interface FrameSink {
|
|
1973
2671
|
send: (data: string) => void;
|
|
@@ -1976,7 +2674,18 @@ interface DrainableSink {
|
|
|
1976
2674
|
readonly bufferedAmount?: unknown;
|
|
1977
2675
|
}
|
|
1978
2676
|
declare const trySendFrame: (ws: FrameSink, frame: string) => boolean;
|
|
1979
|
-
|
|
2677
|
+
interface SubscriptionFrameInput {
|
|
2678
|
+
cursorSuffix: string;
|
|
2679
|
+
diffKey?: object;
|
|
2680
|
+
lastMutationId?: number;
|
|
2681
|
+
nextResult: unknown;
|
|
2682
|
+
pageDeltas?: boolean;
|
|
2683
|
+
previousJson?: string;
|
|
2684
|
+
snapshotJson: string;
|
|
2685
|
+
subId: string;
|
|
2686
|
+
table: string;
|
|
2687
|
+
}
|
|
2688
|
+
declare const subscriptionFrames: (input: SubscriptionFrameInput) => string[];
|
|
1980
2689
|
declare const awaitWsDrain: (ws: DrainableSink) => Promise<void>;
|
|
1981
2690
|
interface SubscriptionReadFootprint {
|
|
1982
2691
|
ranges?: Map<string, KeyRange[]>;
|
|
@@ -2004,13 +2713,32 @@ declare const selectExpiredIds: (sql: SqlExec, spec: TtlSweepSpec, now: number,
|
|
|
2004
2713
|
hasMore: boolean;
|
|
2005
2714
|
ids: string[];
|
|
2006
2715
|
};
|
|
2007
|
-
|
|
2008
|
-
|
|
2009
|
-
|
|
2010
|
-
|
|
2011
|
-
|
|
2012
|
-
|
|
2013
|
-
|
|
2716
|
+
declare const isTtlExpired: (sql: SqlExec, spec: TtlSweepSpec, id: string, now: number) => boolean;
|
|
2717
|
+
declare const nextTtlExpiry: (sql: SqlExec, spec: TtlSweepSpec) => number | undefined;
|
|
2718
|
+
declare const VECTOR_BACKFILL_MAX_PAGES = 20;
|
|
2719
|
+
interface VectorBackfillTarget {
|
|
2720
|
+
profile: string;
|
|
2721
|
+
table: string;
|
|
2722
|
+
}
|
|
2723
|
+
interface VectorBackfillProgress {
|
|
2724
|
+
done: boolean;
|
|
2725
|
+
error?: string;
|
|
2726
|
+
failed: number;
|
|
2727
|
+
failedIds: string[];
|
|
2728
|
+
pages: number;
|
|
2729
|
+
rows: number;
|
|
2014
2730
|
}
|
|
2015
|
-
|
|
2016
|
-
|
|
2731
|
+
type VectorPageSync = (table: string, rows: ReadonlyArray<{
|
|
2732
|
+
doc: Record<string, unknown>;
|
|
2733
|
+
id: string;
|
|
2734
|
+
}>) => Promise<ReadonlyArray<{
|
|
2735
|
+
error: unknown;
|
|
2736
|
+
id: string;
|
|
2737
|
+
}>>;
|
|
2738
|
+
type OrderedAfterWrites = <T, U>(read: () => T, work: (value: T) => Promise<U>) => Promise<U>;
|
|
2739
|
+
declare const backfillVectorIndexes: (sql: SqlExec, targets: ReadonlyArray<VectorBackfillTarget>, sync: VectorPageSync, options: {
|
|
2740
|
+
maxPages?: number;
|
|
2741
|
+
ordered: OrderedAfterWrites;
|
|
2742
|
+
restart?: boolean;
|
|
2743
|
+
}) => Promise<VectorBackfillProgress>;
|
|
2744
|
+
export { ADMIN_FUNCTIONS, ADMIN_FUNCTION_PREFIX, AGGREGATE_SQL_FUNCTION, AGG_COUNT, AGG_KEY, AGG_VALUE, AUDIT_LOG_TABLE, type AdvisorProcedure, type AdvisorProceduresResult, type AdvisoriesResult, type AdvisoryFinding, type AggregateIndexDefinitionLike, type AggregateOp, type AggregateOptions, type AggregateResult, type AggregateTally, type AppendAuditEntry, type ApplyOnDeleteOptions, type AuditEntry, type AuditLogResult, BIGINT_KEY_DIGITS, type BroadcastDelta, CDC_LOG_TABLE, CDC_LOG_TABLE_SEQ_INDEX, CDC_META_TABLE, CLIENT_WATERMARK_TABLE, COMMIT_SEQ_FIELD, COMMIT_SEQ_TABLE, CURSOR_PREFIX, type CacheEntry, type CapturedMailRow, type CdcArchiveScope, type CdcChange, type CdcChangeKey, type ChangedKeys, type Clock, type ColumnMeta, type ColumnMetaLike, CompanionMemo, type CompanionSync, type CompanionSyncDeps, ConflictError, type ConflictKind, type CountArgs, CountRlsUnsupportedError, type CreateWorkflowInstanceResult, type CrossShardReadArgs, type CtxDbOptions, DATA_MIGRATION_STATE_TABLE, DEFAULT_FANOUT_TOPIC_LIMIT, DEFAULT_MAX_RELATION_KEYS, DEFAULT_MAX_RELAYS, DEFAULT_PROMOTION_THRESHOLDS, DEFAULT_TRANSACTION_LIMITS, DOC_COLUMN, type DataMigrationDocument, type DataMigrationLike, type DataMigrationTransform, type DatabaseWriterLike, type DependencyTracker, type DeployInfo, type DurableAttachDecision, type DurableStreamAttach, type DurableStreamRun, DurableStreamRunner, type DurableStreamSink, type ExportRow, type ExportShardAdminArgs, type ExportShardArgs, type ExternalSourceDiffResult, type ExternalSourceLike, FLAGS_FUNCTION_PREFIX, type FacetColumnOptions, type FacetColumnResult, type FacetValue, type FanOutBudget, type FanoutMetricsResult, type FanoutPathCounters, type FanoutTopicStat, type FieldOperators, type FilterClause, type FilterOperator, type FlagEvaluation, type FlagsResult, type FtsWriteOptions, type FunctionCallStat, type FunctionScanAttribution, type FunctionStatsResult, GEO_DEFAULT_PRECISION, GLOBAL_SHAPE_SNAPSHOT_TABLE, type GeoBoundingBox, type GeoFilterBuilderLike, type GeoIndexDefinitionLike, type GeoPoint, type GeoScoredDocument, type GlobalPollCounters, GlobalPollTick, type GroupByEntry, type GroupByOptions, type GuardableSchema$1 as GuardableSchema, IDEMPOTENCY_TABLE, type IdGenerator, type IdempotentRecord, type ImportConflictMode, type ImportError, type ImportRow, type ImportShardAdminArgs, type ImportShardArgs, type ImportShardResult, type IncrementalMaterializeResult, type IndexDefinitionLike, type IndexKeyEntry, type IndexRangeBuilderLike, type KeyRange, type KeyedRelationWriteInfo, type LifecycleDispatchInfo, type LifecycleEvent, type LiveSocketControlCall, MAIL_RETENTION, MAIL_TABLE, MAX_DURABLE_STREAM_BYTES, MAX_DURABLE_STREAM_CHUNKS, MAX_PAGE_SIZE, MAX_SQL_ROWS, type MaskColumnMetadata, type MaskPoliciesResult, type MaterializeResult, type MigrationDirection, type MigrationRunResult, type MigrationStatus, type MigrationStatusRow, type MutationDelta, type NestedWith, NotFoundError, NotUniqueError, type NullPlacement, type OnDeleteActionLike, type OrderByClause, type OrderByInput, type OrderKey, type OrderKeyConstraints, OwnerRelay, type OwnerRelayFrame, type PaginationOptions, type PatchVerifier, type PatchWriteOptions, type PitrBookmarkResult, type PitrRestoreArgs, type PitrRestoreResult, type PitrStorage, type PokeFrameMeta, type PromotionState, type PromotionThresholds, QUEUE_TABLE, type QueryArgs, type QueryPage, type QueryPlan, type QueueMessageOutcome, type QueueMessageRow, type QueueMetadata, type QueuesResult, RANK_TIEBREAK, REACTOR_STATE_TABLE, RELATED_DEFAULT_LIMIT, RELATED_DEPTH_DECAY, RELATED_MAX_DEPTH, RELATED_MAX_LIMIT, RELATION_EXISTS_KEY, RELATION_FUNCTION_PREFIX, RELAY_SIGNATURE_HEADER, REPROJECTION_MIGRATION_PREFIX, RLS_UNWRAP_SYMBOL, type RangeOperandType, type RankBeforeOptions, type RankBeforeResult, type RankDirection, type RankIndexDefinitionLike, type RankOptions, type RankPage, type RankPageComputation, type RankPageDeps, type RankPageOptions, type RankPageRow, type RankPageRowKey, type RankResult, type RankSortKeyLike, ReactiveCache, type ReactiveCacheOptions, type ReactorDispatchResult, type ReactorMetadata, type ReactorState, type ReactorStats, type ReactorsResult, type ReadFootprint, type ReadHook, type ReadTablePageOptions, type RecordMailInput, type RecordQueueMessageInput, type RelatedDirection, type RelatedNode, type RelatedOptions, type RelatedPage, type RelatedStart, type RelatedStartReference, type RelationDefinitionLike, type RelationEdge, type RelationExistsMarker, type RelationGraphReader, type RelationWriteInfo, type RelationWriteMap, type RelayAttach, type RelayDetach, type RelayFrame, type RelayHost, RelayMember, type RelayPokeDelivery, type RelayRoomEvent, type RelayRoomVerdict, type RelayShapePoke, type RelayShapeSeed, type RelayShapeSubscribe, type RelayShapeUnsubscribe, type RenderedSql, type ReplicaFollowerHost, type ReplicaOwnerHost, type ReplicaReadiness, type ResolveRelationPredicatesOptions, type ResolveWithOptions, type ResolveWithResult, type ResolvedShape, type RestrictableQueryOptions, type RlsPoliciesResult, type RlsPolicyMetadata, RlsRequiredError, type RlsRoleMetadata, type RpcRequest, type RunDataMigrationOptions, type RunTriggersOptions, SCAN_DEP, SCHEDULE_OUTBOX_TABLE, SCHEMA_HISTORY_MAX_VERSIONS, SEARCH_STATE_TABLE, SHAPE_POKE_CURSOR_TABLE, type SchedulableWorkflowReferenceLike, type ScheduleOutbox, type ScheduleOutboxEnvelope, type ScheduleOutboxRow, type ScheduledFunctionDoc, type SchedulerLike, type SchemaLike, type ScoredDocument, type SearchBackfillProgress, type SearchFilterBuilderLike, type SearchIndexDefinitionLike, type SearchScoredDocument, type SelectMatchingIdsOptions, type ServerDefaultContextLike, type SettingEntry, type SettingKind, type SettingsResult, ShapeDiffCache, type ShapePokeCursorRow, type ShapePokePart, type ShapeProbeCounters, type ShapeRow, type ShapeRowOp, type ShapeSubscriptionQuery, type ShardRankPageResult, ShardRunner, type ShardRunnerOptions, type ShardSiblingHost, type ShardSocketLike, type SocketAttachment, type SortDirection, type SourceClientLike, type SourceCursorLike, type SourceRefresh, type SqlConsoleResult, type SqlCursor, type SqlEngine, type SqlExec, type SqlLintResult, type StorageMetadata, type StorageReference, type StorageReferenceResult, type StorageRuleMetadata, type StorageRulesResult, type StudioFeaturesResult, type SubscriptionConnection, type SubscriptionEnvelope, type SubscriptionIdentity, type SubscriptionInfo, type SubscriptionQuery, type SubscriptionReadFootprint, type SubscriptionsResult, type SystemDatabaseReader, type SystemDoc, type SystemQuery, type SystemReaderOptions, type SystemReaderSchedulerLike, type SystemReaderStorageLike, type SystemTableName, type TableColumnsResult, type TableDefinitionLike, type TableIndexInfo, type TableIndexesResult, type TableInfo, type TablePage, type TableReaderLike, type TablesColumnsResult, type TablesIndexesResult, type ThroughRelationWriteInfo, type TransactionHeadroom, TransactionHeadroomTracker, type TransactionLimits, type TransactionSqlLike, type TriggerContextLike, type TriggerDefinitionLike, type TriggerEventLike, type TriggerOpLike, type TriggerTimingLike, type TtlSweepSpec, UNVOUCHABLE_DEP, VECTOR_BACKFILL_MAX_PAGES, type ValidatorLike, type VectorBackfillProgress, WORKERD_SQLITE_LIMITS, type WhereFilter, type WhereInput, type WhereSqlStrategy, type WithInput, type WorkflowInstanceState, type WorkflowInstanceStatusResult, type WorkflowMetadata, type WorkflowsResult, type WriteEvent, type WriteHook, advanceClientWatermark, aggUpsertSql, aggregateSqlFunction, aggregateTableName, allocateCommitSeq, appendAuditEntry, appendCdcChange, appendStreamChunk, applyCdcChanges, applyInsertDefaults, applyOnDelete, applySelect, archiveCdcSegment, armRestore, assertFlatPredicate, 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, createCompanionSync, createDependencyTracker, createFanoutCounters, createGlobalPollCounters, createIndexSql, createReadFootprint, createRelayLink, createReplicaLink, createShapeDiffCache, createShapeProbeCounters, createShardCtxDb, createSystemReader, cursorBelowRetainedFloor, decideDurableAttach, decodeBigintSqlKey, decodeCursor, decodeFloat64SqlKey, deferScheduleOutbox, deleteGlobalShapeSnapshot, deleteGlobalShapeSnapshotsForConnection, deleteShapePokeCursor, deleteShapePokeCursorsForConnection, deleteStreamRun, depKey, deriveRelationEdges, describeRelationWrites, diffExternalSource, diffGlobalMembership, distinctValues, encodeAggregateKey, encodeCursor, encodeGeohash, encodePartitionKey, encodeRowsPatch, ensureAuditTable, ensureMailTable, envOptionalPositiveInt, envPositiveInt, equalityPinnedFields, exportShardRows, facetColumn, fanOutScalarCounts, findRelated, findStorageReferences, finishStreamRun, float64SqlKey, foldAggregateTally, forgetScheduleOutbox, ftsCompanionDdl, ftsPurgeDocument, ftsRowidMapName, ftsUnmappedPage, ftsWriteDocument, gateReplicaDispatch, geoTableName, globalShapeReadKey, groupUnmappedRows, guardWriter, handleReplicaControl, hasTrigger, haversineMeters, importShardRows, indexKeysForRow, isDevEnvironment, isFtsAvailable, isInternalTableName, isLossyBody, isMemoryTable, isPushableWhere, isRelationPredicate, isSoftDeleted, isSourceDue, isTtlExpired, isVacuousFilterClause, jsonPath, jsonPathSql, keysTouchRanges, liftSourceId, lintReadonlySql, listReactorStates, listTables, markUnvouchableReads, matchesRankStaticWhere, matchesStaticWhere, materializeExternalRows, materializeExternalRowsIncremental, memoryTableNames, mergeChangedKeys, mergeWhere, migrateCdcLog, migrateCdcMeta, migrateClientWatermark, migrateCommitSeq, migrateDurableStreams, migrateGlobalShapeSnapshot, migrateIdempotency, migrateReactorState, migrateScheduleOutbox, migrateSearchState, migrateShapePokeCursor, minCdcReplayableSeq, minCdcSeq, minShapePokeCursor, nextPromotionState, 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, readExternalSourceBaseline, readGlobalShapeSnapshot, readIdempotent, readMigrationStatus, readPatchField, readQueueMessageById, readQueueMessages, readReactorState, readSchemaHistory, readSchemaVersion, readSearchBackfillState, readShapePokeCursor, readStreamChunks, readStreamRun, readTablePage, recordCapturedMail, recordChangedKeys, recordFanoutPass, recordGlobalPollPass, recordQueueMessages, recordScheduleOutbox, recordSchemaVersion, recordShapeProbePass, relationHooks, relayCountFor, renderSql, reprojectableFields, reprojectionMigrationId, reprojectionTables, resolvePatch, resolveRankPartition, resolveRankSeekTuple, resolveRelationPredicates, resolveWith, rowToDocument, runDataMigration, runDrizzle, runExternalSourceTick, runReadonlySql, runRowValidators, runShardMigrations, runSocketPool, runSql, runTriggers, selectExpiredIds, selectExportTables, selectIndexForAggregate, selectIndexForCount, selectIndexForGroupBy, selectMatchingIds, selectShapeMembers, selectShapeRows, serializeSqlValue, serverInList, shapeRoutingKey, siblingSecretOf, signSiblingBody, softDeleteScope, sortColumnName, sqliteInList, stripReservedPatchFields, stubByName, subscriptionFrames, subscriptionListDeltas, summarizeFanoutTopics, summarizeSubscriptions, tableColumns, tableFromDepKey, throwingScheduler, tiebreakDirectionFor, trimCdcChanges, trimIdempotent, trimScheduleOutbox, trimStreamRuns, tryRowToDocument, trySendFrame, unionAll, uniqueIndexFields, validateImportRow, verifySiblingBody, whereFilter, whereOfFilter, writeCdcArchivedThrough, writeGlobalShapeSnapshot, writeIdempotent, writeReactorState, writeSearchBackfillState, writeShapePokeCursor, writeShapePokeCursors, writeTouchesMemo };
|