@lunora/shard-engine 1.0.0-alpha.1 → 1.0.0-alpha.10

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (43) hide show
  1. package/dist/conformance/index.mjs +1 -1
  2. package/dist/index.d.mts +105 -12
  3. package/dist/index.d.ts +105 -12
  4. package/dist/index.mjs +1 -1
  5. package/dist/packem_shared/ADMIN_FUNCTIONS-vj2G8OR6.mjs +1 -0
  6. package/dist/packem_shared/AGG_COUNT-Bzd34FRk.mjs +1 -0
  7. package/dist/packem_shared/CDC_LOG_TABLE-BYLRV7-q.mjs +8 -0
  8. package/dist/packem_shared/DATA_MIGRATION_STATE_TABLE-BZMVrLcy.mjs +31 -0
  9. package/dist/packem_shared/{DEFAULT_MAX_RELAYS-CnCyh6oX.mjs → DEFAULT_MAX_RELAYS-Bql_LKaq.mjs} +1 -1
  10. package/dist/packem_shared/{DEFAULT_PROMOTION_THRESHOLDS-Dteg0sZF.mjs → DEFAULT_PROMOTION_THRESHOLDS-AgPry7WL.mjs} +1 -1
  11. package/dist/packem_shared/DEFAULT_TRANSACTION_LIMITS-BH5q0Ror.mjs +1 -0
  12. package/dist/packem_shared/NotUniqueError-DCzs_EKE.mjs +1 -0
  13. package/dist/packem_shared/RLS_UNWRAP_SYMBOL-CBYPlYBb.mjs +1 -0
  14. package/dist/packem_shared/ReactiveCache-D7tpXME6.mjs +1 -0
  15. package/dist/packem_shared/awaitWsDrain-BO5x5HYv.mjs +1 -0
  16. package/dist/packem_shared/backfillAggregateIndexes-DSA1Pf3L.mjs +1 -0
  17. package/dist/packem_shared/buildIndexRange-DFsdtPjD.mjs +1 -0
  18. package/dist/packem_shared/{buildPokeFrames-DaPpm5Ss.mjs → buildPokeFrames-FXWhJFyr.mjs} +1 -1
  19. package/dist/packem_shared/createCompanionSync-BU85IZPJ.mjs +1 -0
  20. package/dist/packem_shared/createReadFootprint-DIrrxRTE.mjs +1 -0
  21. package/dist/packem_shared/{defineEngineContractSuite-CVwNQvzx.mjs → defineEngineContractSuite-DA9Xajwm.mjs} +1 -1
  22. package/dist/packem_shared/estimate-bytes-DwQON1Ky.mjs +1 -0
  23. package/dist/packem_shared/{isSoftDeleted-B-SXkGUo.mjs → isSoftDeleted-CbykrrSZ.mjs} +1 -1
  24. package/dist/packem_shared/{materializeExternalRows-DOQJV9p2.mjs → materializeExternalRows-DgG38W3I.mjs} +1 -1
  25. package/dist/packem_shared/mergeChangedKeys-BXtUgIPW.mjs +1 -0
  26. package/dist/packem_shared/{runShardMigrations-CPxqCh3O.mjs → runShardMigrations-CJ9Fkslb.mjs} +3 -3
  27. package/dist/packem_shared/{selectExpiredIds-FzhIEeG1.mjs → selectExpiredIds-CFLRQUFO.mjs} +1 -1
  28. package/dist/packem_shared/{selectShapeMemberIds-DvE7K6zG.mjs → selectShapeMemberIds-DK74eAPs.mjs} +1 -1
  29. package/dist/packem_shared/stableWireKey-C2NzK-K_.mjs +1 -0
  30. package/dist/packem_shared/wire-codec-ivyqGF-j.mjs +1 -0
  31. package/package.json +3 -3
  32. package/dist/packem_shared/ADMIN_FUNCTIONS-B0xlQJ4w.mjs +0 -1
  33. package/dist/packem_shared/AGG_COUNT-BWXe3gtQ.mjs +0 -1
  34. package/dist/packem_shared/CDC_LOG_TABLE-BnqlH2eZ.mjs +0 -8
  35. package/dist/packem_shared/DATA_MIGRATION_STATE_TABLE-CaO6L0Ee.mjs +0 -31
  36. package/dist/packem_shared/NotUniqueError-B4piAtjk.mjs +0 -1
  37. package/dist/packem_shared/RLS_UNWRAP_SYMBOL-C6_WX3dG.mjs +0 -1
  38. package/dist/packem_shared/ReactiveCache-1_9Rs7J_.mjs +0 -1
  39. package/dist/packem_shared/awaitWsDrain-Dk50ISgE.mjs +0 -1
  40. package/dist/packem_shared/backfillAggregateIndexes-BHiewuB-.mjs +0 -1
  41. package/dist/packem_shared/createCompanionSync-BCBUOnMk.mjs +0 -1
  42. package/dist/packem_shared/stableWireKey-YEHLaX6X.mjs +0 -1
  43. package/dist/packem_shared/wire-codec-Ctnni0h6.mjs +0 -1
@@ -1 +1 @@
1
- import{defineEngineContractSuite as t}from"../packem_shared/defineEngineContractSuite-CVwNQvzx.mjs";export{t as defineEngineContractSuite};
1
+ import{defineEngineContractSuite as t}from"../packem_shared/defineEngineContractSuite-DA9Xajwm.mjs";export{t as defineEngineContractSuite};
package/dist/index.d.mts CHANGED
@@ -1,6 +1,27 @@
1
1
  import { LunoraError } from '@lunora/errors';
2
2
  import { SQL, Name } from 'drizzle-orm';
3
3
  import { ShardHost, SocketHost, SocketHandle } from '@lunora/platform';
4
+ interface KeyRange {
5
+ hi: string;
6
+ index: string;
7
+ lo: string;
8
+ table: string;
9
+ }
10
+ interface IndexKeyEntry {
11
+ index: string;
12
+ key: string;
13
+ }
14
+ interface StagedCondition {
15
+ comparator: string;
16
+ field: string;
17
+ value: unknown;
18
+ }
19
+ declare const buildIndexRange: (table: string, index: string, fields: ReadonlyArray<string>, conditions: ReadonlyArray<StagedCondition>, serialize: (value: unknown) => unknown) => KeyRange | undefined;
20
+ declare const indexKeysForRow: (indexes: ReadonlyArray<{
21
+ fields: ReadonlyArray<string>;
22
+ name: string;
23
+ }>, row: Record<string, unknown>, serialize: (value: unknown) => unknown) => IndexKeyEntry[];
24
+ declare const keysTouchRanges: (ranges: ReadonlyArray<KeyRange> | undefined, keys: ReadonlyArray<IndexKeyEntry> | undefined) => boolean;
4
25
  type SystemTableName = "_scheduled_functions" | "_storage";
5
26
  interface ScheduledFunctionDoc {
6
27
  args: Record<string, unknown>;
@@ -338,8 +359,21 @@ interface GeoFilterBuilderLike {
338
359
  };
339
360
  }) => GeoFilterBuilderLike;
340
361
  }
362
+ type ScoredDocument = GeoScoredDocument | SearchScoredDocument;
363
+ interface GeoScoredDocument {
364
+ distanceMeters: null | number;
365
+ document: Record<string, unknown>;
366
+ score?: never;
367
+ }
368
+ interface SearchScoredDocument {
369
+ distanceMeters?: never;
370
+ document: Record<string, unknown>;
371
+ score: number;
372
+ }
341
373
  interface TableReaderLike {
374
+ [Symbol.asyncIterator]: () => AsyncIterator<Record<string, unknown>>;
342
375
  collect: () => Promise<Record<string, unknown>[]>;
376
+ collectWithScores: () => Promise<ScoredDocument[]>;
343
377
  filter: (predicate: (document: Record<string, unknown>) => boolean) => TableReaderLike;
344
378
  first: () => Promise<Record<string, unknown> | null>;
345
379
  order: (direction: "asc" | "desc") => TableReaderLike;
@@ -371,6 +405,7 @@ interface LifecycleDispatchInfo {
371
405
  userId: string | undefined;
372
406
  }
373
407
  interface MutationDelta {
408
+ indexKeys?: ReadonlyArray<IndexKeyEntry>;
374
409
  key: string;
375
410
  op: "insert" | "update" | "delete";
376
411
  row?: Record<string, unknown>;
@@ -535,6 +570,7 @@ interface CacheEntry {
535
570
  bytes: number;
536
571
  deps: Set<string>;
537
572
  lastUsed: number;
573
+ ranges: ReadonlyArray<KeyRange>;
538
574
  result: unknown;
539
575
  subscribers: Set<string>;
540
576
  }
@@ -546,6 +582,7 @@ interface ReactiveCacheOptions {
546
582
  declare class ReactiveCache {
547
583
  private readonly entries;
548
584
  private readonly tableIndex;
585
+ private readonly rangeIndex;
549
586
  private totalBytes;
550
587
  private hits;
551
588
  private misses;
@@ -555,8 +592,8 @@ declare class ReactiveCache {
555
592
  private readonly now;
556
593
  private monotonic;
557
594
  constructor(options?: ReactiveCacheOptions);
558
- run<R>(key: string, deps: Set<string>, run: () => Promise<R>): Promise<R>;
559
- invalidate(table: string, id: string): string[];
595
+ run<R>(key: string, deps: Set<string>, run: () => Promise<R>, ranges?: () => ReadonlyArray<KeyRange>): Promise<R>;
596
+ invalidate(table: string, id: string, indexKeys?: ReadonlyArray<IndexKeyEntry>): string[];
560
597
  invalidateTable(table: string): string[];
561
598
  subscribe(key: string, subscriberId: string): void;
562
599
  unsubscribe(key: string, subscriberId: string): void;
@@ -573,11 +610,36 @@ declare class ReactiveCache {
573
610
  hits: number;
574
611
  misses: number;
575
612
  };
613
+ private dropRangeDeps;
576
614
  private collectAndDrop;
577
615
  private dropEntry;
578
616
  private evict;
579
617
  }
580
618
  declare const reactiveCacheKey: (functionPath: string, args: Record<string, unknown>, identity: null | string) => string;
619
+ interface TransactionLimits {
620
+ maxReadRows: number;
621
+ maxWrittenBytes: number;
622
+ maxWrittenRows: number;
623
+ }
624
+ interface TransactionHeadroom {
625
+ readRows: number;
626
+ remainingReadRows: number;
627
+ remainingWrittenBytes: number;
628
+ remainingWrittenRows: number;
629
+ writtenBytes: number;
630
+ writtenRows: number;
631
+ }
632
+ declare const DEFAULT_TRANSACTION_LIMITS: TransactionLimits;
633
+ declare class TransactionHeadroomTracker {
634
+ private readRows;
635
+ private writtenRows;
636
+ private writtenBytes;
637
+ private readonly limits;
638
+ constructor(limits?: Partial<TransactionLimits>);
639
+ recordRead(count: number): void;
640
+ recordWrite(row: unknown): void;
641
+ headroom(): TransactionHeadroom;
642
+ }
581
643
  interface RunTriggersOptions {
582
644
  ctx: TriggerContextLike;
583
645
  event: TriggerEventLike;
@@ -712,10 +774,12 @@ interface CtxDbOptions {
712
774
  clock?: Clock;
713
775
  enforceRls?: boolean;
714
776
  globalDb?: DatabaseWriterLike;
777
+ headroom?: TransactionHeadroomTracker;
715
778
  idGenerator?: IdGenerator;
716
779
  maxRelationKeys?: number;
717
780
  onIndexUse?: IndexUseHook;
718
781
  onRead?: ReadHook;
782
+ onReadRange?: (range: KeyRange) => void;
719
783
  onWrite?: WriteHook;
720
784
  relationExistsPushDown?: "always" | "auto" | "never";
721
785
  scheduler?: SchedulerLike;
@@ -815,7 +879,11 @@ interface ShardSocketLike {
815
879
  }
816
880
  interface CompanionSyncDeps {
817
881
  broadcast: (delta: MutationDelta) => void;
818
- invalidateCache: (table: string, id: string) => void;
882
+ indexKeysFor: (table: string, document?: Record<string, unknown>) => ReadonlyArray<{
883
+ index: string;
884
+ key: string;
885
+ }> | undefined;
886
+ invalidateCache: (table: string, id: string, document?: Record<string, unknown>) => void;
819
887
  recordCdc: (table: string, id: string, op: "delete" | "insert" | "update", doc?: Record<string, unknown>) => void;
820
888
  schema: SchemaLike;
821
889
  sql: SqlExec;
@@ -855,7 +923,11 @@ declare const DATA_MIGRATION_STATE_TABLE = "__lunora_migrations";
855
923
  type MigrationDirection = "down" | "up";
856
924
  type MigrationStatus = "completed" | "failed" | "in_progress";
857
925
  type DataMigrationDocument = Record<string, unknown>;
858
- type DataMigrationTransform = (document: DataMigrationDocument) => DataMigrationDocument | undefined;
926
+ type DataMigrationReader = Pick<DatabaseWriterLike, "count" | "findFirst" | "findMany" | "get">;
927
+ interface DataMigrationContext {
928
+ db: DataMigrationReader;
929
+ }
930
+ type DataMigrationTransform = (document: DataMigrationDocument, context: DataMigrationContext) => DataMigrationDocument | Promise<DataMigrationDocument | undefined> | undefined;
859
931
  interface DataMigrationLike {
860
932
  readonly batchSize?: number;
861
933
  readonly down?: DataMigrationTransform;
@@ -1047,6 +1119,7 @@ declare const ADMIN_FUNCTIONS: {
1047
1119
  readonly getMetricSeries: "__lunora_admin__:getMetricSeries";
1048
1120
  readonly listSubscriptions: "__lunora_admin__:listSubscriptions";
1049
1121
  readonly listTableIndexes: "__lunora_admin__:listTableIndexes";
1122
+ readonly listTablesIndexes: "__lunora_admin__:listTablesIndexes";
1050
1123
  readonly getLogs: "__lunora_admin__:getLogs";
1051
1124
  readonly getMetrics: "__lunora_admin__:getMetrics";
1052
1125
  readonly getPitrBookmark: "__lunora_admin__:getPitrBookmark";
@@ -1139,6 +1212,9 @@ interface TableIndexInfo {
1139
1212
  interface TableIndexesResult {
1140
1213
  indexes: TableIndexInfo[];
1141
1214
  }
1215
+ interface TablesIndexesResult {
1216
+ indexesByTable: Record<string, TableIndexInfo[]>;
1217
+ }
1142
1218
  interface ColumnMeta {
1143
1219
  isStorage?: boolean;
1144
1220
  name: string;
@@ -1169,12 +1245,13 @@ interface AdvisoriesResult {
1169
1245
  advisories: AdvisoryFinding[];
1170
1246
  }
1171
1247
  interface AdvisorProcedure {
1172
- callsMail: boolean;
1248
+ analyzableBody?: boolean;
1249
+ callsMail?: boolean;
1173
1250
  emitsEvent?: boolean;
1174
1251
  exempt?: boolean;
1175
1252
  exemptReason?: string;
1176
1253
  exportName: string;
1177
- fanOut: boolean;
1254
+ fanOut?: boolean;
1178
1255
  file: string;
1179
1256
  handlesErrors?: boolean;
1180
1257
  hasEmailArg?: boolean;
@@ -1182,15 +1259,15 @@ interface AdvisorProcedure {
1182
1259
  reachesOutbound?: boolean;
1183
1260
  runsAiGeneration?: boolean;
1184
1261
  throwsBareError?: boolean;
1185
- unboundedAiGeneration: boolean;
1262
+ unboundedAiGeneration?: boolean;
1186
1263
  usesCaptcha: boolean;
1187
1264
  usesEmailGate: boolean;
1188
- usesInsertManyUnsafe: boolean;
1265
+ usesInsertManyUnsafe?: boolean;
1189
1266
  usesMask: boolean;
1190
1267
  usesRateLimit: boolean;
1191
1268
  usesRls: boolean;
1192
1269
  visibility: "internal" | "public";
1193
- writesUserTable: boolean;
1270
+ writesUserTable?: boolean;
1194
1271
  }
1195
1272
  interface AdvisorProceduresResult {
1196
1273
  procedures: AdvisorProcedure[];
@@ -1540,6 +1617,13 @@ declare const rankKeyFromDocument: (index: RankIndexDefinitionLike, document_: R
1540
1617
  rowId: string;
1541
1618
  sortValues: unknown[];
1542
1619
  };
1620
+ interface ReadFootprint {
1621
+ onRead: (table: string, idOrScan?: string) => void;
1622
+ onReadRange: (range: KeyRange) => void;
1623
+ ranges: () => Map<string, KeyRange[]> | undefined;
1624
+ tables: Set<string>;
1625
+ }
1626
+ declare const createReadFootprint: () => ReadFootprint;
1543
1627
  declare const DEFAULT_MAX_RELATION_KEYS = 5000;
1544
1628
  interface RelationExistsMarker {
1545
1629
  childWhere: WhereInput;
@@ -1811,7 +1895,8 @@ interface GuardableSchema {
1811
1895
  }>;
1812
1896
  }
1813
1897
  type TableOfId = (id: string, expectedTable?: string) => Promise<string | undefined> | string | undefined;
1814
- declare const guardWriter: <W>(raw: W, schema: GuardableSchema, tableOfId: TableOfId) => W;
1898
+ type TablesOfIds = (ids: ReadonlyArray<string>, expectedTable?: string) => Promise<ReadonlyMap<string, string>> | ReadonlyMap<string, string>;
1899
+ declare const guardWriter: <W>(raw: W, schema: GuardableSchema, tableOfId: TableOfId, tablesOfIds?: TablesOfIds) => W;
1815
1900
  declare const SCHEMA_HISTORY_MAX_VERSIONS = 50;
1816
1901
  interface SchemaVersionRow {
1817
1902
  appliedAt: number;
@@ -1873,8 +1958,16 @@ interface DrainableSink {
1873
1958
  readonly bufferedAmount?: unknown;
1874
1959
  }
1875
1960
  declare const trySendFrame: (ws: FrameSink, frame: string) => boolean;
1876
- declare const sendDeltaFrames: (ws: FrameSink, subId: string, deltaFrames: ReadonlyArray<string>, cursorSuffix: string) => boolean;
1961
+ declare const sendDeltaFrames: (ws: FrameSink, subId: string, deltaFrames: ReadonlyArray<string>, cursorSuffix: string, lastMutationId?: number) => boolean;
1877
1962
  declare const awaitWsDrain: (ws: DrainableSink) => Promise<void>;
1963
+ interface SubscriptionReadFootprint {
1964
+ ranges?: Map<string, KeyRange[]>;
1965
+ tables: Set<string>;
1966
+ }
1967
+ type ChangedKeys = Map<string, IndexKeyEntry[] | undefined>;
1968
+ declare const mergeChangedKeys: (pending: ChangedKeys | undefined, incoming: ChangedKeys | undefined, changed: Set<string>) => ChangedKeys;
1969
+ declare const recordChangedKeys: (pending: ChangedKeys | undefined, table: string, indexKeys: ReadonlyArray<IndexKeyEntry> | undefined) => ChangedKeys;
1970
+ declare const writeTouchesMemo: (memo: SubscriptionReadFootprint, changed: Set<string>, changedKeys: ChangedKeys | undefined) => boolean;
1878
1971
  type ConflictKind = "conflict" | "occ" | "restrict" | "trigger" | "unique";
1879
1972
  declare class ConflictError extends LunoraError {
1880
1973
  readonly kind: ConflictKind;
@@ -1902,4 +1995,4 @@ interface WhereSqlStrategy {
1902
1995
  serialize: SerializeValue;
1903
1996
  }
1904
1997
  declare const compileWhereSql: (where: WhereInput | undefined, strategy: WhereSqlStrategy) => SQL | undefined;
1905
- 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$1 as ApplyOnDeleteOptions, type AuditEntry, type AuditLogResult, type BroadcastDelta, CDC_LOG_TABLE, CDC_META_TABLE, CLIENT_WATERMARK_TABLE, type CacheEntry, type CapturedMailRow, type CdcChange, type Clock, type ColumnMeta, type ColumnMetaLike, type CompanionSync, type CompanionSyncDeps, ConflictError, type ConflictKind, type CountArgs, CountRlsUnsupportedError, type CreateWorkflowInstanceResult, type CtxDbOptions, DATA_MIGRATION_STATE_TABLE, DEFAULT_FANOUT_TOPIC_LIMIT, DEFAULT_MAX_RELATION_KEYS, DEFAULT_MAX_RELAYS, DEFAULT_PROMOTION_THRESHOLDS, DOC_COLUMN, type DataMigrationDocument, type DataMigrationLike, type DataMigrationTransform, type DatabaseWriterLike, type DependencyTracker, type DeployInfo, type ExportRow, type ExportShardAdminArgs, type ExportShardArgs, type ExternalSourceDiffResult, type ExternalSourceLike, FLAGS_FUNCTION_PREFIX, type FacetColumnOptions, type FacetColumnResult, type FacetValue, type FanoutMetricsResult, type FanoutPathCounters, type FanoutTopicStat, type FieldOperators, type FilterClause, type FilterOperator, type FlagEvaluation, type FlagsResult, type FunctionCallStat, type FunctionScanAttribution, type FunctionStatsResult, GEO_DEFAULT_PRECISION, GLOBAL_SHAPE_SNAPSHOT_TABLE, type GeoBoundingBox, type GeoFilterBuilderLike, type GeoIndexDefinitionLike, type GeoPoint, type GroupByEntry, type GroupByOptions, type GuardableSchema$1 as GuardableSchema, IDEMPOTENCY_TABLE, type IdGenerator, type IdempotentRecord, type ImportError, type ImportShardAdminArgs, type ImportShardArgs, type ImportShardResult, type IncrementalMaterializeResult, type IndexDefinitionLike, type IndexRangeBuilderLike, type LifecycleDispatchInfo, type LifecycleEvent, MAIL_RETENTION, MAIL_TABLE, 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 OnDeleteActionLike, type OrderByClause, type OrderByInput, type OrderKey, OwnerRelay, type OwnerRelayFrame, type PaginationOptions, type PitrBookmarkResult, type PitrRestoreArgs, type PitrRestoreResult, type PitrStorage, type PokeFrameMeta, type PromotionState, type PromotionThresholds, QUEUE_TABLE, type QueryArgs, type QueryPage, type QueueMessageOutcome, type QueueMessageRow, type QueueMetadata, type QueuesResult, RANK_TIEBREAK, RELATION_EXISTS_KEY, RELATION_FUNCTION_PREFIX, RLS_UNWRAP_SYMBOL, 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 ReadHook, type ReadTablePageOptions, type RecordMailInput, type RecordQueueMessageInput, type RelationDefinitionLike, type RelationExistsMarker, type RelayAttach, type RelayDetach, type RelayFrame, type RelayHost, RelayMember, type RelayShapePoke, type RelayShapeSeed, type RelayShapeSubscribe, type RenderedSql, 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, SCHEMA_HISTORY_MAX_VERSIONS, SEARCH_STATE_TABLE, type SchedulableWorkflowReferenceLike, type ScheduledFunctionDoc, type SchedulerLike, type SchemaLike, type SearchFilterBuilderLike, type SearchIndexDefinitionLike, type SelectMatchingIdsOptions, type ServerDefaultContextLike, type SettingEntry, type SettingKind, type SettingsResult, type ShapePokePart, type ShapeRow, type ShapeRowOp, type ShapeSubscriptionQuery, type ShardRankPageResult, ShardRunner, type ShardRunnerOptions, 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 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 TransactionSqlLike, type TriggerContextLike, type TriggerDefinitionLike, type TriggerEventLike, type TriggerOpLike, type TriggerTimingLike, type TtlSweepSpec, type ValidatorLike, type WhereInput, type WhereSqlStrategy, type WithInput, type WorkflowInstanceState, type WorkflowInstanceStatusResult, type WorkflowMetadata, type WorkflowsResult, type WriteEvent, type WriteHook, advanceClientWatermark, aggUpsertSql, aggregateSqlFunction, aggregateTableName, appendAuditEntry, appendCdcChange, applyCdcChanges, applyOnDelete, applySelect, armRestore, assertFlatPredicate, assertReadonly, assertShapeShardable, assertValidClientId, awaitWsDrain, backfillAggregateIndexes, backfillRankIndexes, backfillSearchIndexes, backfillSearchIndexesForTable, boundingBoxCenter, boundingBoxGeohashes, buildPokeFrames, buildSeekBeforeWhere, buildSeekWhere, buildSettings, bumpCdcEpoch, clampPromotionThresholds, clearCapturedMail, clearQueueMessages, coerceAggregateNumber, compileWhereSql, computeRankPage, containsRelationPredicate, coveringGeohashes, createCompanionSync, createDependencyTracker, createFanoutCounters, createIndexSql, createRelayLink, createShardCtxDb, createSystemReader, decodeCursor, deleteGlobalShapeSnapshot, deleteGlobalShapeSnapshotsForConnection, depKey, diffExternalSource, diffGlobalMembership, distinctValues, encodeAggregateKey, encodeCursor, encodeGeohash, encodePartitionKey, encodeRowsPatch, ensureAuditTable, ensureMailTable, exportShardRows, exportShardTable, facetColumn, fanOutScalarCounts, findStorageReferences, foldAggregateTally, geoTableName, guardWriter, hasTrigger, haversineMeters, hydrateDocsById, importShardRows, isDevEnvironment, isFtsAvailable, isLossyBody, isRelationPredicate, isSoftDeleted, isSourceDue, jsonPath, jsonPathSql, liftSourceId, lintReadonlySql, listTables, matchesRankStaticWhere, matchesStaticWhere, materializeExternalRows, materializeExternalRowsIncremental, mergeWhere, migrateCdcLog, migrateCdcMeta, migrateClientWatermark, migrateGlobalShapeSnapshot, migrateIdempotency, migrateSearchState, minCdcSeq, nextPromotionState, normalizeCountArgument, normalizeIdStructurally, normalizeOrderKeys, normalizeSourceDocument, normalizeSourceValue, param, parseExportShardArgs, parseImportShardArgs, planAggregateLookup, pointInBoundingBox, projectColumns, pullExternalSourceIncrementalTick, pullExternalSourceTick, qualifiedJsonPath, qualifiedJsonPathSql, quoteIdentifier, rankKeyFromDocument as rankKeyFromDoc, rankTableName, reactiveCacheKey, readAggregateValue, readAuditLog, readBookmark, readCapturedMail, readCdcChanges, readCdcCursor, readCdcEpoch, readClientWatermark, readExternalSourceBaseline, readGlobalShapeSnapshot, readIdempotent, readMigrationStatus, readQueueMessageById, readQueueMessages, readSchemaHistory, readSchemaVersion, readSearchBackfillState, readTablePage, recordCapturedMail, recordFanoutPass, recordQueueMessages, recordSchemaVersion, relayCountFor, renderSql, resolveRankPartition, resolveRelationPredicates, resolveWith, rowToDocument, runDataMigration, runDrizzle, runExternalSourceTick, runReadonlySql, runRowValidators, runShardMigrations, runSocketPool, runSql, runTriggers, selectExpiredIds, selectExportTables, selectIndexForAggregate, selectIndexForCount, selectIndexForGroupBy, selectMatchingIds, selectShapeMemberIds, selectShapeRows, sendDeltaFrames, serializeSqlValue, shapeRoutingKey, softDeleteScope, sortColumnName, stableStringify, stableWireKey, subscriptionListDeltas, summarizeFanoutTopics, summarizeSubscriptions, tableColumns, tableFromDepKey, throwingScheduler, trimCdcChanges, trimIdempotent, tryRowToDocument, trySendFrame, validateImportRow, writeGlobalShapeSnapshot, writeIdempotent, writeSearchBackfillState };
1998
+ 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$1 as ApplyOnDeleteOptions, type AuditEntry, type AuditLogResult, type BroadcastDelta, CDC_LOG_TABLE, CDC_META_TABLE, CLIENT_WATERMARK_TABLE, type CacheEntry, type CapturedMailRow, type CdcChange, type ChangedKeys, type Clock, type ColumnMeta, type ColumnMetaLike, type CompanionSync, type CompanionSyncDeps, ConflictError, type ConflictKind, type CountArgs, CountRlsUnsupportedError, type CreateWorkflowInstanceResult, 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 ExportRow, type ExportShardAdminArgs, type ExportShardArgs, type ExternalSourceDiffResult, type ExternalSourceLike, FLAGS_FUNCTION_PREFIX, type FacetColumnOptions, type FacetColumnResult, type FacetValue, type FanoutMetricsResult, type FanoutPathCounters, type FanoutTopicStat, type FieldOperators, type FilterClause, type FilterOperator, type FlagEvaluation, type FlagsResult, type FunctionCallStat, type FunctionScanAttribution, type FunctionStatsResult, GEO_DEFAULT_PRECISION, GLOBAL_SHAPE_SNAPSHOT_TABLE, type GeoBoundingBox, type GeoFilterBuilderLike, type GeoIndexDefinitionLike, type GeoPoint, type GeoScoredDocument, type GroupByEntry, type GroupByOptions, type GuardableSchema$1 as GuardableSchema, IDEMPOTENCY_TABLE, type IdGenerator, type IdempotentRecord, type ImportError, type ImportShardAdminArgs, type ImportShardArgs, type ImportShardResult, type IncrementalMaterializeResult, type IndexDefinitionLike, type IndexKeyEntry, type IndexRangeBuilderLike, type KeyRange, type LifecycleDispatchInfo, type LifecycleEvent, MAIL_RETENTION, MAIL_TABLE, 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 OnDeleteActionLike, type OrderByClause, type OrderByInput, type OrderKey, OwnerRelay, type OwnerRelayFrame, type PaginationOptions, type PitrBookmarkResult, type PitrRestoreArgs, type PitrRestoreResult, type PitrStorage, type PokeFrameMeta, type PromotionState, type PromotionThresholds, QUEUE_TABLE, type QueryArgs, type QueryPage, type QueueMessageOutcome, type QueueMessageRow, type QueueMetadata, type QueuesResult, RANK_TIEBREAK, RELATION_EXISTS_KEY, RELATION_FUNCTION_PREFIX, RLS_UNWRAP_SYMBOL, 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 ReadFootprint, type ReadHook, type ReadTablePageOptions, type RecordMailInput, type RecordQueueMessageInput, type RelationDefinitionLike, type RelationExistsMarker, type RelayAttach, type RelayDetach, type RelayFrame, type RelayHost, RelayMember, type RelayShapePoke, type RelayShapeSeed, type RelayShapeSubscribe, type RenderedSql, 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, SCHEMA_HISTORY_MAX_VERSIONS, SEARCH_STATE_TABLE, type SchedulableWorkflowReferenceLike, type ScheduledFunctionDoc, type SchedulerLike, type SchemaLike, type ScoredDocument, type SearchFilterBuilderLike, type SearchIndexDefinitionLike, type SearchScoredDocument, type SelectMatchingIdsOptions, type ServerDefaultContextLike, type SettingEntry, type SettingKind, type SettingsResult, type ShapePokePart, type ShapeRow, type ShapeRowOp, type ShapeSubscriptionQuery, type ShardRankPageResult, ShardRunner, type ShardRunnerOptions, 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 TransactionHeadroom, TransactionHeadroomTracker, type TransactionLimits, type TransactionSqlLike, type TriggerContextLike, type TriggerDefinitionLike, type TriggerEventLike, type TriggerOpLike, type TriggerTimingLike, type TtlSweepSpec, type ValidatorLike, type WhereInput, type WhereSqlStrategy, type WithInput, type WorkflowInstanceState, type WorkflowInstanceStatusResult, type WorkflowMetadata, type WorkflowsResult, type WriteEvent, type WriteHook, advanceClientWatermark, aggUpsertSql, aggregateSqlFunction, aggregateTableName, appendAuditEntry, appendCdcChange, applyCdcChanges, applyOnDelete, applySelect, armRestore, assertFlatPredicate, assertReadonly, assertShapeShardable, assertValidClientId, awaitWsDrain, backfillAggregateIndexes, backfillRankIndexes, backfillSearchIndexes, backfillSearchIndexesForTable, boundingBoxCenter, boundingBoxGeohashes, buildIndexRange, buildPokeFrames, buildSeekBeforeWhere, buildSeekWhere, buildSettings, bumpCdcEpoch, clampPromotionThresholds, clearCapturedMail, clearQueueMessages, coerceAggregateNumber, compileWhereSql, computeRankPage, containsRelationPredicate, coveringGeohashes, createCompanionSync, createDependencyTracker, createFanoutCounters, createIndexSql, createReadFootprint, createRelayLink, createShardCtxDb, createSystemReader, decodeCursor, deleteGlobalShapeSnapshot, deleteGlobalShapeSnapshotsForConnection, depKey, diffExternalSource, diffGlobalMembership, distinctValues, encodeAggregateKey, encodeCursor, encodeGeohash, encodePartitionKey, encodeRowsPatch, ensureAuditTable, ensureMailTable, exportShardRows, exportShardTable, facetColumn, fanOutScalarCounts, findStorageReferences, foldAggregateTally, geoTableName, guardWriter, hasTrigger, haversineMeters, hydrateDocsById, importShardRows, indexKeysForRow, isDevEnvironment, isFtsAvailable, isLossyBody, isRelationPredicate, isSoftDeleted, isSourceDue, jsonPath, jsonPathSql, keysTouchRanges, liftSourceId, lintReadonlySql, listTables, matchesRankStaticWhere, matchesStaticWhere, materializeExternalRows, materializeExternalRowsIncremental, mergeChangedKeys, mergeWhere, migrateCdcLog, migrateCdcMeta, migrateClientWatermark, migrateGlobalShapeSnapshot, migrateIdempotency, migrateSearchState, minCdcSeq, nextPromotionState, normalizeCountArgument, normalizeIdStructurally, normalizeOrderKeys, normalizeSourceDocument, normalizeSourceValue, param, parseExportShardArgs, parseImportShardArgs, planAggregateLookup, pointInBoundingBox, projectColumns, pullExternalSourceIncrementalTick, pullExternalSourceTick, qualifiedJsonPath, qualifiedJsonPathSql, quoteIdentifier, rankKeyFromDocument as rankKeyFromDoc, rankTableName, reactiveCacheKey, readAggregateValue, readAuditLog, readBookmark, readCapturedMail, readCdcChanges, readCdcCursor, readCdcEpoch, readClientWatermark, readExternalSourceBaseline, readGlobalShapeSnapshot, readIdempotent, readMigrationStatus, readQueueMessageById, readQueueMessages, readSchemaHistory, readSchemaVersion, readSearchBackfillState, readTablePage, recordCapturedMail, recordChangedKeys, recordFanoutPass, recordQueueMessages, recordSchemaVersion, relayCountFor, renderSql, resolveRankPartition, resolveRelationPredicates, resolveWith, rowToDocument, runDataMigration, runDrizzle, runExternalSourceTick, runReadonlySql, runRowValidators, runShardMigrations, runSocketPool, runSql, runTriggers, selectExpiredIds, selectExportTables, selectIndexForAggregate, selectIndexForCount, selectIndexForGroupBy, selectMatchingIds, selectShapeMemberIds, selectShapeRows, sendDeltaFrames, serializeSqlValue, shapeRoutingKey, softDeleteScope, sortColumnName, stableStringify, stableWireKey, subscriptionListDeltas, summarizeFanoutTopics, summarizeSubscriptions, tableColumns, tableFromDepKey, throwingScheduler, trimCdcChanges, trimIdempotent, tryRowToDocument, trySendFrame, validateImportRow, writeGlobalShapeSnapshot, writeIdempotent, writeSearchBackfillState, writeTouchesMemo };
package/dist/index.d.ts CHANGED
@@ -1,6 +1,27 @@
1
1
  import { LunoraError } from '@lunora/errors';
2
2
  import { SQL, Name } from 'drizzle-orm';
3
3
  import { ShardHost, SocketHost, SocketHandle } from '@lunora/platform';
4
+ interface KeyRange {
5
+ hi: string;
6
+ index: string;
7
+ lo: string;
8
+ table: string;
9
+ }
10
+ interface IndexKeyEntry {
11
+ index: string;
12
+ key: string;
13
+ }
14
+ interface StagedCondition {
15
+ comparator: string;
16
+ field: string;
17
+ value: unknown;
18
+ }
19
+ declare const buildIndexRange: (table: string, index: string, fields: ReadonlyArray<string>, conditions: ReadonlyArray<StagedCondition>, serialize: (value: unknown) => unknown) => KeyRange | undefined;
20
+ declare const indexKeysForRow: (indexes: ReadonlyArray<{
21
+ fields: ReadonlyArray<string>;
22
+ name: string;
23
+ }>, row: Record<string, unknown>, serialize: (value: unknown) => unknown) => IndexKeyEntry[];
24
+ declare const keysTouchRanges: (ranges: ReadonlyArray<KeyRange> | undefined, keys: ReadonlyArray<IndexKeyEntry> | undefined) => boolean;
4
25
  type SystemTableName = "_scheduled_functions" | "_storage";
5
26
  interface ScheduledFunctionDoc {
6
27
  args: Record<string, unknown>;
@@ -338,8 +359,21 @@ interface GeoFilterBuilderLike {
338
359
  };
339
360
  }) => GeoFilterBuilderLike;
340
361
  }
362
+ type ScoredDocument = GeoScoredDocument | SearchScoredDocument;
363
+ interface GeoScoredDocument {
364
+ distanceMeters: null | number;
365
+ document: Record<string, unknown>;
366
+ score?: never;
367
+ }
368
+ interface SearchScoredDocument {
369
+ distanceMeters?: never;
370
+ document: Record<string, unknown>;
371
+ score: number;
372
+ }
341
373
  interface TableReaderLike {
374
+ [Symbol.asyncIterator]: () => AsyncIterator<Record<string, unknown>>;
342
375
  collect: () => Promise<Record<string, unknown>[]>;
376
+ collectWithScores: () => Promise<ScoredDocument[]>;
343
377
  filter: (predicate: (document: Record<string, unknown>) => boolean) => TableReaderLike;
344
378
  first: () => Promise<Record<string, unknown> | null>;
345
379
  order: (direction: "asc" | "desc") => TableReaderLike;
@@ -371,6 +405,7 @@ interface LifecycleDispatchInfo {
371
405
  userId: string | undefined;
372
406
  }
373
407
  interface MutationDelta {
408
+ indexKeys?: ReadonlyArray<IndexKeyEntry>;
374
409
  key: string;
375
410
  op: "insert" | "update" | "delete";
376
411
  row?: Record<string, unknown>;
@@ -535,6 +570,7 @@ interface CacheEntry {
535
570
  bytes: number;
536
571
  deps: Set<string>;
537
572
  lastUsed: number;
573
+ ranges: ReadonlyArray<KeyRange>;
538
574
  result: unknown;
539
575
  subscribers: Set<string>;
540
576
  }
@@ -546,6 +582,7 @@ interface ReactiveCacheOptions {
546
582
  declare class ReactiveCache {
547
583
  private readonly entries;
548
584
  private readonly tableIndex;
585
+ private readonly rangeIndex;
549
586
  private totalBytes;
550
587
  private hits;
551
588
  private misses;
@@ -555,8 +592,8 @@ declare class ReactiveCache {
555
592
  private readonly now;
556
593
  private monotonic;
557
594
  constructor(options?: ReactiveCacheOptions);
558
- run<R>(key: string, deps: Set<string>, run: () => Promise<R>): Promise<R>;
559
- invalidate(table: string, id: string): string[];
595
+ run<R>(key: string, deps: Set<string>, run: () => Promise<R>, ranges?: () => ReadonlyArray<KeyRange>): Promise<R>;
596
+ invalidate(table: string, id: string, indexKeys?: ReadonlyArray<IndexKeyEntry>): string[];
560
597
  invalidateTable(table: string): string[];
561
598
  subscribe(key: string, subscriberId: string): void;
562
599
  unsubscribe(key: string, subscriberId: string): void;
@@ -573,11 +610,36 @@ declare class ReactiveCache {
573
610
  hits: number;
574
611
  misses: number;
575
612
  };
613
+ private dropRangeDeps;
576
614
  private collectAndDrop;
577
615
  private dropEntry;
578
616
  private evict;
579
617
  }
580
618
  declare const reactiveCacheKey: (functionPath: string, args: Record<string, unknown>, identity: null | string) => string;
619
+ interface TransactionLimits {
620
+ maxReadRows: number;
621
+ maxWrittenBytes: number;
622
+ maxWrittenRows: number;
623
+ }
624
+ interface TransactionHeadroom {
625
+ readRows: number;
626
+ remainingReadRows: number;
627
+ remainingWrittenBytes: number;
628
+ remainingWrittenRows: number;
629
+ writtenBytes: number;
630
+ writtenRows: number;
631
+ }
632
+ declare const DEFAULT_TRANSACTION_LIMITS: TransactionLimits;
633
+ declare class TransactionHeadroomTracker {
634
+ private readRows;
635
+ private writtenRows;
636
+ private writtenBytes;
637
+ private readonly limits;
638
+ constructor(limits?: Partial<TransactionLimits>);
639
+ recordRead(count: number): void;
640
+ recordWrite(row: unknown): void;
641
+ headroom(): TransactionHeadroom;
642
+ }
581
643
  interface RunTriggersOptions {
582
644
  ctx: TriggerContextLike;
583
645
  event: TriggerEventLike;
@@ -712,10 +774,12 @@ interface CtxDbOptions {
712
774
  clock?: Clock;
713
775
  enforceRls?: boolean;
714
776
  globalDb?: DatabaseWriterLike;
777
+ headroom?: TransactionHeadroomTracker;
715
778
  idGenerator?: IdGenerator;
716
779
  maxRelationKeys?: number;
717
780
  onIndexUse?: IndexUseHook;
718
781
  onRead?: ReadHook;
782
+ onReadRange?: (range: KeyRange) => void;
719
783
  onWrite?: WriteHook;
720
784
  relationExistsPushDown?: "always" | "auto" | "never";
721
785
  scheduler?: SchedulerLike;
@@ -815,7 +879,11 @@ interface ShardSocketLike {
815
879
  }
816
880
  interface CompanionSyncDeps {
817
881
  broadcast: (delta: MutationDelta) => void;
818
- invalidateCache: (table: string, id: string) => void;
882
+ indexKeysFor: (table: string, document?: Record<string, unknown>) => ReadonlyArray<{
883
+ index: string;
884
+ key: string;
885
+ }> | undefined;
886
+ invalidateCache: (table: string, id: string, document?: Record<string, unknown>) => void;
819
887
  recordCdc: (table: string, id: string, op: "delete" | "insert" | "update", doc?: Record<string, unknown>) => void;
820
888
  schema: SchemaLike;
821
889
  sql: SqlExec;
@@ -855,7 +923,11 @@ declare const DATA_MIGRATION_STATE_TABLE = "__lunora_migrations";
855
923
  type MigrationDirection = "down" | "up";
856
924
  type MigrationStatus = "completed" | "failed" | "in_progress";
857
925
  type DataMigrationDocument = Record<string, unknown>;
858
- type DataMigrationTransform = (document: DataMigrationDocument) => DataMigrationDocument | undefined;
926
+ type DataMigrationReader = Pick<DatabaseWriterLike, "count" | "findFirst" | "findMany" | "get">;
927
+ interface DataMigrationContext {
928
+ db: DataMigrationReader;
929
+ }
930
+ type DataMigrationTransform = (document: DataMigrationDocument, context: DataMigrationContext) => DataMigrationDocument | Promise<DataMigrationDocument | undefined> | undefined;
859
931
  interface DataMigrationLike {
860
932
  readonly batchSize?: number;
861
933
  readonly down?: DataMigrationTransform;
@@ -1047,6 +1119,7 @@ declare const ADMIN_FUNCTIONS: {
1047
1119
  readonly getMetricSeries: "__lunora_admin__:getMetricSeries";
1048
1120
  readonly listSubscriptions: "__lunora_admin__:listSubscriptions";
1049
1121
  readonly listTableIndexes: "__lunora_admin__:listTableIndexes";
1122
+ readonly listTablesIndexes: "__lunora_admin__:listTablesIndexes";
1050
1123
  readonly getLogs: "__lunora_admin__:getLogs";
1051
1124
  readonly getMetrics: "__lunora_admin__:getMetrics";
1052
1125
  readonly getPitrBookmark: "__lunora_admin__:getPitrBookmark";
@@ -1139,6 +1212,9 @@ interface TableIndexInfo {
1139
1212
  interface TableIndexesResult {
1140
1213
  indexes: TableIndexInfo[];
1141
1214
  }
1215
+ interface TablesIndexesResult {
1216
+ indexesByTable: Record<string, TableIndexInfo[]>;
1217
+ }
1142
1218
  interface ColumnMeta {
1143
1219
  isStorage?: boolean;
1144
1220
  name: string;
@@ -1169,12 +1245,13 @@ interface AdvisoriesResult {
1169
1245
  advisories: AdvisoryFinding[];
1170
1246
  }
1171
1247
  interface AdvisorProcedure {
1172
- callsMail: boolean;
1248
+ analyzableBody?: boolean;
1249
+ callsMail?: boolean;
1173
1250
  emitsEvent?: boolean;
1174
1251
  exempt?: boolean;
1175
1252
  exemptReason?: string;
1176
1253
  exportName: string;
1177
- fanOut: boolean;
1254
+ fanOut?: boolean;
1178
1255
  file: string;
1179
1256
  handlesErrors?: boolean;
1180
1257
  hasEmailArg?: boolean;
@@ -1182,15 +1259,15 @@ interface AdvisorProcedure {
1182
1259
  reachesOutbound?: boolean;
1183
1260
  runsAiGeneration?: boolean;
1184
1261
  throwsBareError?: boolean;
1185
- unboundedAiGeneration: boolean;
1262
+ unboundedAiGeneration?: boolean;
1186
1263
  usesCaptcha: boolean;
1187
1264
  usesEmailGate: boolean;
1188
- usesInsertManyUnsafe: boolean;
1265
+ usesInsertManyUnsafe?: boolean;
1189
1266
  usesMask: boolean;
1190
1267
  usesRateLimit: boolean;
1191
1268
  usesRls: boolean;
1192
1269
  visibility: "internal" | "public";
1193
- writesUserTable: boolean;
1270
+ writesUserTable?: boolean;
1194
1271
  }
1195
1272
  interface AdvisorProceduresResult {
1196
1273
  procedures: AdvisorProcedure[];
@@ -1540,6 +1617,13 @@ declare const rankKeyFromDocument: (index: RankIndexDefinitionLike, document_: R
1540
1617
  rowId: string;
1541
1618
  sortValues: unknown[];
1542
1619
  };
1620
+ interface ReadFootprint {
1621
+ onRead: (table: string, idOrScan?: string) => void;
1622
+ onReadRange: (range: KeyRange) => void;
1623
+ ranges: () => Map<string, KeyRange[]> | undefined;
1624
+ tables: Set<string>;
1625
+ }
1626
+ declare const createReadFootprint: () => ReadFootprint;
1543
1627
  declare const DEFAULT_MAX_RELATION_KEYS = 5000;
1544
1628
  interface RelationExistsMarker {
1545
1629
  childWhere: WhereInput;
@@ -1811,7 +1895,8 @@ interface GuardableSchema {
1811
1895
  }>;
1812
1896
  }
1813
1897
  type TableOfId = (id: string, expectedTable?: string) => Promise<string | undefined> | string | undefined;
1814
- declare const guardWriter: <W>(raw: W, schema: GuardableSchema, tableOfId: TableOfId) => W;
1898
+ type TablesOfIds = (ids: ReadonlyArray<string>, expectedTable?: string) => Promise<ReadonlyMap<string, string>> | ReadonlyMap<string, string>;
1899
+ declare const guardWriter: <W>(raw: W, schema: GuardableSchema, tableOfId: TableOfId, tablesOfIds?: TablesOfIds) => W;
1815
1900
  declare const SCHEMA_HISTORY_MAX_VERSIONS = 50;
1816
1901
  interface SchemaVersionRow {
1817
1902
  appliedAt: number;
@@ -1873,8 +1958,16 @@ interface DrainableSink {
1873
1958
  readonly bufferedAmount?: unknown;
1874
1959
  }
1875
1960
  declare const trySendFrame: (ws: FrameSink, frame: string) => boolean;
1876
- declare const sendDeltaFrames: (ws: FrameSink, subId: string, deltaFrames: ReadonlyArray<string>, cursorSuffix: string) => boolean;
1961
+ declare const sendDeltaFrames: (ws: FrameSink, subId: string, deltaFrames: ReadonlyArray<string>, cursorSuffix: string, lastMutationId?: number) => boolean;
1877
1962
  declare const awaitWsDrain: (ws: DrainableSink) => Promise<void>;
1963
+ interface SubscriptionReadFootprint {
1964
+ ranges?: Map<string, KeyRange[]>;
1965
+ tables: Set<string>;
1966
+ }
1967
+ type ChangedKeys = Map<string, IndexKeyEntry[] | undefined>;
1968
+ declare const mergeChangedKeys: (pending: ChangedKeys | undefined, incoming: ChangedKeys | undefined, changed: Set<string>) => ChangedKeys;
1969
+ declare const recordChangedKeys: (pending: ChangedKeys | undefined, table: string, indexKeys: ReadonlyArray<IndexKeyEntry> | undefined) => ChangedKeys;
1970
+ declare const writeTouchesMemo: (memo: SubscriptionReadFootprint, changed: Set<string>, changedKeys: ChangedKeys | undefined) => boolean;
1878
1971
  type ConflictKind = "conflict" | "occ" | "restrict" | "trigger" | "unique";
1879
1972
  declare class ConflictError extends LunoraError {
1880
1973
  readonly kind: ConflictKind;
@@ -1902,4 +1995,4 @@ interface WhereSqlStrategy {
1902
1995
  serialize: SerializeValue;
1903
1996
  }
1904
1997
  declare const compileWhereSql: (where: WhereInput | undefined, strategy: WhereSqlStrategy) => SQL | undefined;
1905
- 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$1 as ApplyOnDeleteOptions, type AuditEntry, type AuditLogResult, type BroadcastDelta, CDC_LOG_TABLE, CDC_META_TABLE, CLIENT_WATERMARK_TABLE, type CacheEntry, type CapturedMailRow, type CdcChange, type Clock, type ColumnMeta, type ColumnMetaLike, type CompanionSync, type CompanionSyncDeps, ConflictError, type ConflictKind, type CountArgs, CountRlsUnsupportedError, type CreateWorkflowInstanceResult, type CtxDbOptions, DATA_MIGRATION_STATE_TABLE, DEFAULT_FANOUT_TOPIC_LIMIT, DEFAULT_MAX_RELATION_KEYS, DEFAULT_MAX_RELAYS, DEFAULT_PROMOTION_THRESHOLDS, DOC_COLUMN, type DataMigrationDocument, type DataMigrationLike, type DataMigrationTransform, type DatabaseWriterLike, type DependencyTracker, type DeployInfo, type ExportRow, type ExportShardAdminArgs, type ExportShardArgs, type ExternalSourceDiffResult, type ExternalSourceLike, FLAGS_FUNCTION_PREFIX, type FacetColumnOptions, type FacetColumnResult, type FacetValue, type FanoutMetricsResult, type FanoutPathCounters, type FanoutTopicStat, type FieldOperators, type FilterClause, type FilterOperator, type FlagEvaluation, type FlagsResult, type FunctionCallStat, type FunctionScanAttribution, type FunctionStatsResult, GEO_DEFAULT_PRECISION, GLOBAL_SHAPE_SNAPSHOT_TABLE, type GeoBoundingBox, type GeoFilterBuilderLike, type GeoIndexDefinitionLike, type GeoPoint, type GroupByEntry, type GroupByOptions, type GuardableSchema$1 as GuardableSchema, IDEMPOTENCY_TABLE, type IdGenerator, type IdempotentRecord, type ImportError, type ImportShardAdminArgs, type ImportShardArgs, type ImportShardResult, type IncrementalMaterializeResult, type IndexDefinitionLike, type IndexRangeBuilderLike, type LifecycleDispatchInfo, type LifecycleEvent, MAIL_RETENTION, MAIL_TABLE, 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 OnDeleteActionLike, type OrderByClause, type OrderByInput, type OrderKey, OwnerRelay, type OwnerRelayFrame, type PaginationOptions, type PitrBookmarkResult, type PitrRestoreArgs, type PitrRestoreResult, type PitrStorage, type PokeFrameMeta, type PromotionState, type PromotionThresholds, QUEUE_TABLE, type QueryArgs, type QueryPage, type QueueMessageOutcome, type QueueMessageRow, type QueueMetadata, type QueuesResult, RANK_TIEBREAK, RELATION_EXISTS_KEY, RELATION_FUNCTION_PREFIX, RLS_UNWRAP_SYMBOL, 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 ReadHook, type ReadTablePageOptions, type RecordMailInput, type RecordQueueMessageInput, type RelationDefinitionLike, type RelationExistsMarker, type RelayAttach, type RelayDetach, type RelayFrame, type RelayHost, RelayMember, type RelayShapePoke, type RelayShapeSeed, type RelayShapeSubscribe, type RenderedSql, 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, SCHEMA_HISTORY_MAX_VERSIONS, SEARCH_STATE_TABLE, type SchedulableWorkflowReferenceLike, type ScheduledFunctionDoc, type SchedulerLike, type SchemaLike, type SearchFilterBuilderLike, type SearchIndexDefinitionLike, type SelectMatchingIdsOptions, type ServerDefaultContextLike, type SettingEntry, type SettingKind, type SettingsResult, type ShapePokePart, type ShapeRow, type ShapeRowOp, type ShapeSubscriptionQuery, type ShardRankPageResult, ShardRunner, type ShardRunnerOptions, 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 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 TransactionSqlLike, type TriggerContextLike, type TriggerDefinitionLike, type TriggerEventLike, type TriggerOpLike, type TriggerTimingLike, type TtlSweepSpec, type ValidatorLike, type WhereInput, type WhereSqlStrategy, type WithInput, type WorkflowInstanceState, type WorkflowInstanceStatusResult, type WorkflowMetadata, type WorkflowsResult, type WriteEvent, type WriteHook, advanceClientWatermark, aggUpsertSql, aggregateSqlFunction, aggregateTableName, appendAuditEntry, appendCdcChange, applyCdcChanges, applyOnDelete, applySelect, armRestore, assertFlatPredicate, assertReadonly, assertShapeShardable, assertValidClientId, awaitWsDrain, backfillAggregateIndexes, backfillRankIndexes, backfillSearchIndexes, backfillSearchIndexesForTable, boundingBoxCenter, boundingBoxGeohashes, buildPokeFrames, buildSeekBeforeWhere, buildSeekWhere, buildSettings, bumpCdcEpoch, clampPromotionThresholds, clearCapturedMail, clearQueueMessages, coerceAggregateNumber, compileWhereSql, computeRankPage, containsRelationPredicate, coveringGeohashes, createCompanionSync, createDependencyTracker, createFanoutCounters, createIndexSql, createRelayLink, createShardCtxDb, createSystemReader, decodeCursor, deleteGlobalShapeSnapshot, deleteGlobalShapeSnapshotsForConnection, depKey, diffExternalSource, diffGlobalMembership, distinctValues, encodeAggregateKey, encodeCursor, encodeGeohash, encodePartitionKey, encodeRowsPatch, ensureAuditTable, ensureMailTable, exportShardRows, exportShardTable, facetColumn, fanOutScalarCounts, findStorageReferences, foldAggregateTally, geoTableName, guardWriter, hasTrigger, haversineMeters, hydrateDocsById, importShardRows, isDevEnvironment, isFtsAvailable, isLossyBody, isRelationPredicate, isSoftDeleted, isSourceDue, jsonPath, jsonPathSql, liftSourceId, lintReadonlySql, listTables, matchesRankStaticWhere, matchesStaticWhere, materializeExternalRows, materializeExternalRowsIncremental, mergeWhere, migrateCdcLog, migrateCdcMeta, migrateClientWatermark, migrateGlobalShapeSnapshot, migrateIdempotency, migrateSearchState, minCdcSeq, nextPromotionState, normalizeCountArgument, normalizeIdStructurally, normalizeOrderKeys, normalizeSourceDocument, normalizeSourceValue, param, parseExportShardArgs, parseImportShardArgs, planAggregateLookup, pointInBoundingBox, projectColumns, pullExternalSourceIncrementalTick, pullExternalSourceTick, qualifiedJsonPath, qualifiedJsonPathSql, quoteIdentifier, rankKeyFromDocument as rankKeyFromDoc, rankTableName, reactiveCacheKey, readAggregateValue, readAuditLog, readBookmark, readCapturedMail, readCdcChanges, readCdcCursor, readCdcEpoch, readClientWatermark, readExternalSourceBaseline, readGlobalShapeSnapshot, readIdempotent, readMigrationStatus, readQueueMessageById, readQueueMessages, readSchemaHistory, readSchemaVersion, readSearchBackfillState, readTablePage, recordCapturedMail, recordFanoutPass, recordQueueMessages, recordSchemaVersion, relayCountFor, renderSql, resolveRankPartition, resolveRelationPredicates, resolveWith, rowToDocument, runDataMigration, runDrizzle, runExternalSourceTick, runReadonlySql, runRowValidators, runShardMigrations, runSocketPool, runSql, runTriggers, selectExpiredIds, selectExportTables, selectIndexForAggregate, selectIndexForCount, selectIndexForGroupBy, selectMatchingIds, selectShapeMemberIds, selectShapeRows, sendDeltaFrames, serializeSqlValue, shapeRoutingKey, softDeleteScope, sortColumnName, stableStringify, stableWireKey, subscriptionListDeltas, summarizeFanoutTopics, summarizeSubscriptions, tableColumns, tableFromDepKey, throwingScheduler, trimCdcChanges, trimIdempotent, tryRowToDocument, trySendFrame, validateImportRow, writeGlobalShapeSnapshot, writeIdempotent, writeSearchBackfillState };
1998
+ 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$1 as ApplyOnDeleteOptions, type AuditEntry, type AuditLogResult, type BroadcastDelta, CDC_LOG_TABLE, CDC_META_TABLE, CLIENT_WATERMARK_TABLE, type CacheEntry, type CapturedMailRow, type CdcChange, type ChangedKeys, type Clock, type ColumnMeta, type ColumnMetaLike, type CompanionSync, type CompanionSyncDeps, ConflictError, type ConflictKind, type CountArgs, CountRlsUnsupportedError, type CreateWorkflowInstanceResult, 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 ExportRow, type ExportShardAdminArgs, type ExportShardArgs, type ExternalSourceDiffResult, type ExternalSourceLike, FLAGS_FUNCTION_PREFIX, type FacetColumnOptions, type FacetColumnResult, type FacetValue, type FanoutMetricsResult, type FanoutPathCounters, type FanoutTopicStat, type FieldOperators, type FilterClause, type FilterOperator, type FlagEvaluation, type FlagsResult, type FunctionCallStat, type FunctionScanAttribution, type FunctionStatsResult, GEO_DEFAULT_PRECISION, GLOBAL_SHAPE_SNAPSHOT_TABLE, type GeoBoundingBox, type GeoFilterBuilderLike, type GeoIndexDefinitionLike, type GeoPoint, type GeoScoredDocument, type GroupByEntry, type GroupByOptions, type GuardableSchema$1 as GuardableSchema, IDEMPOTENCY_TABLE, type IdGenerator, type IdempotentRecord, type ImportError, type ImportShardAdminArgs, type ImportShardArgs, type ImportShardResult, type IncrementalMaterializeResult, type IndexDefinitionLike, type IndexKeyEntry, type IndexRangeBuilderLike, type KeyRange, type LifecycleDispatchInfo, type LifecycleEvent, MAIL_RETENTION, MAIL_TABLE, 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 OnDeleteActionLike, type OrderByClause, type OrderByInput, type OrderKey, OwnerRelay, type OwnerRelayFrame, type PaginationOptions, type PitrBookmarkResult, type PitrRestoreArgs, type PitrRestoreResult, type PitrStorage, type PokeFrameMeta, type PromotionState, type PromotionThresholds, QUEUE_TABLE, type QueryArgs, type QueryPage, type QueueMessageOutcome, type QueueMessageRow, type QueueMetadata, type QueuesResult, RANK_TIEBREAK, RELATION_EXISTS_KEY, RELATION_FUNCTION_PREFIX, RLS_UNWRAP_SYMBOL, 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 ReadFootprint, type ReadHook, type ReadTablePageOptions, type RecordMailInput, type RecordQueueMessageInput, type RelationDefinitionLike, type RelationExistsMarker, type RelayAttach, type RelayDetach, type RelayFrame, type RelayHost, RelayMember, type RelayShapePoke, type RelayShapeSeed, type RelayShapeSubscribe, type RenderedSql, 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, SCHEMA_HISTORY_MAX_VERSIONS, SEARCH_STATE_TABLE, type SchedulableWorkflowReferenceLike, type ScheduledFunctionDoc, type SchedulerLike, type SchemaLike, type ScoredDocument, type SearchFilterBuilderLike, type SearchIndexDefinitionLike, type SearchScoredDocument, type SelectMatchingIdsOptions, type ServerDefaultContextLike, type SettingEntry, type SettingKind, type SettingsResult, type ShapePokePart, type ShapeRow, type ShapeRowOp, type ShapeSubscriptionQuery, type ShardRankPageResult, ShardRunner, type ShardRunnerOptions, 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 TransactionHeadroom, TransactionHeadroomTracker, type TransactionLimits, type TransactionSqlLike, type TriggerContextLike, type TriggerDefinitionLike, type TriggerEventLike, type TriggerOpLike, type TriggerTimingLike, type TtlSweepSpec, type ValidatorLike, type WhereInput, type WhereSqlStrategy, type WithInput, type WorkflowInstanceState, type WorkflowInstanceStatusResult, type WorkflowMetadata, type WorkflowsResult, type WriteEvent, type WriteHook, advanceClientWatermark, aggUpsertSql, aggregateSqlFunction, aggregateTableName, appendAuditEntry, appendCdcChange, applyCdcChanges, applyOnDelete, applySelect, armRestore, assertFlatPredicate, assertReadonly, assertShapeShardable, assertValidClientId, awaitWsDrain, backfillAggregateIndexes, backfillRankIndexes, backfillSearchIndexes, backfillSearchIndexesForTable, boundingBoxCenter, boundingBoxGeohashes, buildIndexRange, buildPokeFrames, buildSeekBeforeWhere, buildSeekWhere, buildSettings, bumpCdcEpoch, clampPromotionThresholds, clearCapturedMail, clearQueueMessages, coerceAggregateNumber, compileWhereSql, computeRankPage, containsRelationPredicate, coveringGeohashes, createCompanionSync, createDependencyTracker, createFanoutCounters, createIndexSql, createReadFootprint, createRelayLink, createShardCtxDb, createSystemReader, decodeCursor, deleteGlobalShapeSnapshot, deleteGlobalShapeSnapshotsForConnection, depKey, diffExternalSource, diffGlobalMembership, distinctValues, encodeAggregateKey, encodeCursor, encodeGeohash, encodePartitionKey, encodeRowsPatch, ensureAuditTable, ensureMailTable, exportShardRows, exportShardTable, facetColumn, fanOutScalarCounts, findStorageReferences, foldAggregateTally, geoTableName, guardWriter, hasTrigger, haversineMeters, hydrateDocsById, importShardRows, indexKeysForRow, isDevEnvironment, isFtsAvailable, isLossyBody, isRelationPredicate, isSoftDeleted, isSourceDue, jsonPath, jsonPathSql, keysTouchRanges, liftSourceId, lintReadonlySql, listTables, matchesRankStaticWhere, matchesStaticWhere, materializeExternalRows, materializeExternalRowsIncremental, mergeChangedKeys, mergeWhere, migrateCdcLog, migrateCdcMeta, migrateClientWatermark, migrateGlobalShapeSnapshot, migrateIdempotency, migrateSearchState, minCdcSeq, nextPromotionState, normalizeCountArgument, normalizeIdStructurally, normalizeOrderKeys, normalizeSourceDocument, normalizeSourceValue, param, parseExportShardArgs, parseImportShardArgs, planAggregateLookup, pointInBoundingBox, projectColumns, pullExternalSourceIncrementalTick, pullExternalSourceTick, qualifiedJsonPath, qualifiedJsonPathSql, quoteIdentifier, rankKeyFromDocument as rankKeyFromDoc, rankTableName, reactiveCacheKey, readAggregateValue, readAuditLog, readBookmark, readCapturedMail, readCdcChanges, readCdcCursor, readCdcEpoch, readClientWatermark, readExternalSourceBaseline, readGlobalShapeSnapshot, readIdempotent, readMigrationStatus, readQueueMessageById, readQueueMessages, readSchemaHistory, readSchemaVersion, readSearchBackfillState, readTablePage, recordCapturedMail, recordChangedKeys, recordFanoutPass, recordQueueMessages, recordSchemaVersion, relayCountFor, renderSql, resolveRankPartition, resolveRelationPredicates, resolveWith, rowToDocument, runDataMigration, runDrizzle, runExternalSourceTick, runReadonlySql, runRowValidators, runShardMigrations, runSocketPool, runSql, runTriggers, selectExpiredIds, selectExportTables, selectIndexForAggregate, selectIndexForCount, selectIndexForGroupBy, selectMatchingIds, selectShapeMemberIds, selectShapeRows, sendDeltaFrames, serializeSqlValue, shapeRoutingKey, softDeleteScope, sortColumnName, stableStringify, stableWireKey, subscriptionListDeltas, summarizeFanoutTopics, summarizeSubscriptions, tableColumns, tableFromDepKey, throwingScheduler, trimCdcChanges, trimIdempotent, tryRowToDocument, trySendFrame, validateImportRow, writeGlobalShapeSnapshot, writeIdempotent, writeSearchBackfillState, writeTouchesMemo };