@lunora/shard-engine 1.0.0-alpha.80 → 1.0.0-alpha.82

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 (57) hide show
  1. package/dist/conformance/index.mjs +1 -1
  2. package/dist/index.d.mts +40 -3
  3. package/dist/index.d.ts +40 -3
  4. package/dist/index.mjs +1 -1
  5. package/dist/packem_shared/ADMIN_FUNCTIONS-BdZ3gTHm.mjs +1 -0
  6. package/dist/packem_shared/{AGG_COUNT-TzzFAsyw.mjs → AGG_COUNT-B7izQELK.mjs} +1 -1
  7. package/dist/packem_shared/{AUDIT_LOG_TABLE-ONxmEAIz.mjs → AUDIT_LOG_TABLE-CEdsC6vT.mjs} +1 -1
  8. package/dist/packem_shared/{CDC_LOG_TABLE-DXEAcmsr.mjs → CDC_LOG_TABLE-BFbP2eiJ.mjs} +1 -1
  9. package/dist/packem_shared/{CLIENT_WATERMARK_TABLE-CRnrAnJ2.mjs → CLIENT_WATERMARK_TABLE-BdKYbah0.mjs} +1 -1
  10. package/dist/packem_shared/{COMMIT_SEQ_FIELD-BUdOMG5y.mjs → COMMIT_SEQ_FIELD-D6uMUaiR.mjs} +1 -1
  11. package/dist/packem_shared/{DATA_MIGRATION_STATE_TABLE-BwFz6NTT.mjs → DATA_MIGRATION_STATE_TABLE-BbDr6pc7.mjs} +1 -1
  12. package/dist/packem_shared/{DEFAULT_MAX_RELATION_KEYS-XESc7TiB.mjs → DEFAULT_MAX_RELATION_KEYS-BfAQvZT8.mjs} +1 -1
  13. package/dist/packem_shared/{DEFAULT_MAX_RELAYS-Ng4SyJ7k.mjs → DEFAULT_MAX_RELAYS-DG9iXjzF.mjs} +1 -1
  14. package/dist/packem_shared/{DurableStreamRunner-rTYp4v03.mjs → DurableStreamRunner-Cliu09-j.mjs} +1 -1
  15. package/dist/packem_shared/{GLOBAL_SHAPE_SNAPSHOT_TABLE-DSA6mzyx.mjs → GLOBAL_SHAPE_SNAPSHOT_TABLE-wWaEWj5f.mjs} +1 -1
  16. package/dist/packem_shared/{IDEMPOTENCY_TABLE-DOpm_oMF.mjs → IDEMPOTENCY_TABLE-DKrXVEUe.mjs} +1 -1
  17. package/dist/packem_shared/{MAIL_RETENTION-DGAQTHHs.mjs → MAIL_RETENTION-DXpGFjOt.mjs} +1 -1
  18. package/dist/packem_shared/NotUniqueError-D0LwVtXI.mjs +1 -0
  19. package/dist/packem_shared/{QUEUE_TABLE-s7QJZvBz.mjs → QUEUE_TABLE-D-cL1NPj.mjs} +1 -1
  20. package/dist/packem_shared/{REACTOR_STATE_TABLE-QPRFyxMS.mjs → REACTOR_STATE_TABLE-CBHASjH9.mjs} +1 -1
  21. package/dist/packem_shared/{SCHEDULE_OUTBOX_TABLE-CD_UjYVx.mjs → SCHEDULE_OUTBOX_TABLE-BHpxtEy4.mjs} +1 -1
  22. package/dist/packem_shared/{SCHEMA_HISTORY_MAX_VERSIONS-BluIj2s-.mjs → SCHEMA_HISTORY_MAX_VERSIONS-CXznJRUG.mjs} +1 -1
  23. package/dist/packem_shared/SEARCH_STATE_TABLE-D_KJ04Bn.mjs +1 -0
  24. package/dist/packem_shared/{SHAPE_POKE_CURSOR_TABLE-ByJVDHds.mjs → SHAPE_POKE_CURSOR_TABLE-Bbpou9XZ.mjs} +1 -1
  25. package/dist/packem_shared/VECTOR_BACKFILL_MAX_PAGES-C-KZJbgA.mjs +1 -0
  26. package/dist/packem_shared/{appendStreamChunk-C1Ok4b6J.mjs → appendStreamChunk-pPeR5nbF.mjs} +1 -1
  27. package/dist/packem_shared/{archiveCdcSegment-E_R_b5Qz.mjs → archiveCdcSegment-C7taIEpg.mjs} +1 -1
  28. package/dist/packem_shared/backfillAggregateIndexes-D-S4qiCu.mjs +1 -0
  29. package/dist/packem_shared/{buildReprojectionMigration-DNjOe6AP.mjs → buildReprojectionMigration-DDZhSO95.mjs} +1 -1
  30. package/dist/packem_shared/{buildShapeDiff-CnCHKdCw.mjs → buildShapeDiff-Bd5nLaY8.mjs} +1 -1
  31. package/dist/packem_shared/{clearMemoryTables-BGbmag2i.mjs → clearMemoryTables-C5Wivufe.mjs} +1 -1
  32. package/dist/packem_shared/{computeRankPage-pTaG_r9F.mjs → computeRankPage-CQewnemg.mjs} +1 -1
  33. package/dist/packem_shared/createCompanionSync-BwWcSwvy.mjs +1 -0
  34. package/dist/packem_shared/{createReplicaLink-CUnl1y_Q.mjs → createReplicaLink-CTyOjpjh.mjs} +1 -1
  35. package/dist/packem_shared/{ctx-db-relay-shapes-Bg5YYnmN.mjs → ctx-db-relay-shapes-BcgjOtG1.mjs} +1 -1
  36. package/dist/packem_shared/ctx-db-search-state-fIiMVPXO.mjs +1 -0
  37. package/dist/packem_shared/{defineEngineContractSuite-BS0T_g0Z.mjs → defineEngineContractSuite-BD9v9a97.mjs} +1 -1
  38. package/dist/packem_shared/{do-sql-kpl5Kt1j.mjs → do-sql-BSoH-O04.mjs} +1 -1
  39. package/dist/packem_shared/{exportShardRows-1TkeNJI6.mjs → exportShardRows-DmFKSzLZ.mjs} +1 -1
  40. package/dist/packem_shared/fts-companion-B7jllLhZ.mjs +1 -0
  41. package/dist/packem_shared/ftsCompanionDdl-BKeIk9KQ.mjs +1 -0
  42. package/dist/packem_shared/{isSoftDeleted-DIMlSsdB.mjs → isSoftDeleted-CCDHCtX3.mjs} +1 -1
  43. package/dist/packem_shared/{materializeExternalRows-B1623YXA.mjs → materializeExternalRows-j_8glxcE.mjs} +1 -1
  44. package/dist/packem_shared/runDrizzle-CfKnGpV2.mjs +1 -0
  45. package/dist/packem_shared/runShardMigrations-o-qjyKt5.mjs +5 -0
  46. package/dist/packem_shared/{selectExpiredIds-D5DEpBbi.mjs → selectExpiredIds-Do1q2HQr.mjs} +1 -1
  47. package/dist/packem_shared/{selectShapeMembers-B8gTOeOB.mjs → selectShapeMembers-Cp98I-ot.mjs} +1 -1
  48. package/package.json +2 -2
  49. package/dist/packem_shared/ADMIN_FUNCTIONS-BjpFlIz5.mjs +0 -1
  50. package/dist/packem_shared/NotUniqueError-1OMgp1sA.mjs +0 -1
  51. package/dist/packem_shared/SEARCH_STATE_TABLE-D5mnK5kX.mjs +0 -1
  52. package/dist/packem_shared/backfillAggregateIndexes-DTemznr7.mjs +0 -1
  53. package/dist/packem_shared/createCompanionSync-Cb567rkq.mjs +0 -1
  54. package/dist/packem_shared/ctx-db-companions-DsNfXSbb.mjs +0 -1
  55. package/dist/packem_shared/ctx-db-search-state-ruTuCsxa.mjs +0 -1
  56. package/dist/packem_shared/runDrizzle-2ULFQR_k.mjs +0 -1
  57. package/dist/packem_shared/runShardMigrations-DGlaC68E.mjs +0 -5
@@ -1 +1 @@
1
- import{defineEngineContractSuite as t}from"../packem_shared/defineEngineContractSuite-BS0T_g0Z.mjs";export{t as defineEngineContractSuite};
1
+ import{defineEngineContractSuite as t}from"../packem_shared/defineEngineContractSuite-BD9v9a97.mjs";export{t as defineEngineContractSuite};
package/dist/index.d.mts CHANGED
@@ -875,7 +875,7 @@ declare const runShardMigrations: (sql: SqlExec, schema: SchemaLike, options?: {
875
875
  * same three facts, and the decisions made from them are the shared policy
876
876
  * below.
877
877
  */
878
- interface SearchBackfillState {
878
+ interface BackfillState {
879
879
  /** Last `id` indexed, or `undefined` when no page has run yet. */
880
880
  cursor: string | undefined;
881
881
  /** True once a page came back short — the table is fully indexed. */
@@ -885,7 +885,7 @@ interface SearchBackfillState {
885
885
  }
886
886
  declare const SEARCH_STATE_TABLE = "__lunora_search_state";
887
887
  declare const migrateSearchState: (sql: SqlExec) => void;
888
- declare const readSearchBackfillState: (sql: SqlExec, companion: string) => SearchBackfillState;
888
+ declare const readSearchBackfillState: (sql: SqlExec, companion: string) => BackfillState;
889
889
  declare const writeSearchBackfillState: (sql: SqlExec, companion: string, cursor: string | undefined, done: boolean, profile: string) => void;
890
890
  interface ShapeRow {
891
891
  doc: Record<string, unknown>;
@@ -1302,6 +1302,16 @@ declare const isSoftDeleted: (row: Record<string, unknown>, column: string) => b
1302
1302
  declare const pullExternalSourceIncrementalTick: (sql: SqlExec, writer: DatabaseWriterLike, client: SourceClientLike, table: string, source: ExternalSourceLike, shardKey: string, nowMs: number) => Promise<{
1303
1303
  applied: number;
1304
1304
  }>;
1305
+ declare const ftsRowidMapName: (companion: string) => string;
1306
+ interface FtsWriteOptions {
1307
+ guard?: SQL;
1308
+ unmappedRowids?: ReadonlyArray<number>;
1309
+ }
1310
+ declare const ftsCompanionDdl: (companion: string) => SQL[];
1311
+ declare const ftsWriteDocument: (companion: string, id: string, text: string, options?: FtsWriteOptions) => SQL[];
1312
+ declare const ftsPurgeDocument: (companion: string, id: string, options?: FtsWriteOptions) => SQL[];
1313
+ declare const ftsUnmappedPage: (companion: string, limit: number, after?: number) => SQL;
1314
+ declare const groupUnmappedRows: (rows: ReadonlyArray<Record<string, unknown>>) => Map<string, number[]>;
1305
1315
  declare const GEO_DEFAULT_PRECISION = 9;
1306
1316
  interface GeoPoint {
1307
1317
  lat: number;
@@ -1341,6 +1351,7 @@ declare const ADMIN_FUNCTIONS: {
1341
1351
  readonly aiTableFilter: "__lunora_admin__:aiTableFilter";
1342
1352
  readonly assignIssue: "__lunora_admin__:assignIssue";
1343
1353
  readonly backfillSearch: "__lunora_admin__:backfillSearch";
1354
+ readonly backfillVectors: "__lunora_admin__:backfillVectors";
1344
1355
  readonly backRelationCounts: "__lunora_admin__:backRelationCounts";
1345
1356
  readonly cdcSync: "__lunora_admin__:cdcSync";
1346
1357
  readonly clearCapturedMail: "__lunora_admin__:clearCapturedMail";
@@ -2438,6 +2449,32 @@ declare const selectExpiredIds: (sql: SqlExec, spec: TtlSweepSpec, now: number,
2438
2449
  hasMore: boolean;
2439
2450
  ids: string[];
2440
2451
  };
2452
+ declare const VECTOR_BACKFILL_MAX_PAGES = 20;
2453
+ interface VectorBackfillTarget {
2454
+ profile: string;
2455
+ table: string;
2456
+ }
2457
+ interface VectorBackfillProgress {
2458
+ done: boolean;
2459
+ error?: string;
2460
+ failed: number;
2461
+ failedIds: string[];
2462
+ pages: number;
2463
+ rows: number;
2464
+ }
2465
+ type VectorPageSync = (table: string, rows: ReadonlyArray<{
2466
+ doc: Record<string, unknown>;
2467
+ id: string;
2468
+ }>) => Promise<ReadonlyArray<{
2469
+ error: unknown;
2470
+ id: string;
2471
+ }>>;
2472
+ type OrderedAfterWrites = <T, U>(read: () => T, work: (value: T) => Promise<U>) => Promise<U>;
2473
+ declare const backfillVectorIndexes: (sql: SqlExec, targets: ReadonlyArray<VectorBackfillTarget>, sync: VectorPageSync, options: {
2474
+ maxPages?: number;
2475
+ ordered: OrderedAfterWrites;
2476
+ restart?: boolean;
2477
+ }) => Promise<VectorBackfillProgress>;
2441
2478
  interface WhereFragments<T> {
2442
2479
  binary: (reference: T, comparator: string, value: unknown) => T;
2443
2480
  connect: (left: T, right: T, connector: "AND" | "OR") => T;
@@ -2459,4 +2496,4 @@ interface WhereSqlStrategy<T = SQL> {
2459
2496
  }
2460
2497
  declare const literalInList: (reference: SQL, items: ReadonlyArray<unknown>, negated: boolean) => SQL;
2461
2498
  declare const compileWhereSql: <T = SQL>(where: WhereInput | undefined, strategy: WhereSqlStrategy<T>, fragments?: WhereFragments<T>) => T | undefined;
2462
- 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, BIGINT_KEY_DIGITS, type BroadcastDelta, CDC_LOG_TABLE, CDC_LOG_TABLE_SEQ_INDEX, CDC_META_TABLE, CLIENT_WATERMARK_TABLE, COMMIT_SEQ_FIELD, COMMIT_SEQ_TABLE, CURSOR_PREFIX, type CacheEntry, type CapturedMailRow, type CdcArchiveScope, type CdcChange, type CdcChangeKey, type ChangedKeys, type Clock, type ColumnMeta, type ColumnMetaLike, type CompanionSync, type CompanionSyncDeps, ConflictError, type ConflictKind, type CountArgs, CountRlsUnsupportedError, type CreateWorkflowInstanceResult, type CrossShardReadArgs, type CtxDbOptions, DATA_MIGRATION_STATE_TABLE, DEFAULT_FANOUT_TOPIC_LIMIT, DEFAULT_MAX_RELATION_KEYS, DEFAULT_MAX_RELAYS, DEFAULT_PROMOTION_THRESHOLDS, DEFAULT_TRANSACTION_LIMITS, DOC_COLUMN, type DataMigrationDocument, type DataMigrationLike, type DataMigrationTransform, type DatabaseWriterLike, type DependencyTracker, type DeployInfo, type DurableAttachDecision, type DurableStreamAttach, type DurableStreamRun, DurableStreamRunner, type DurableStreamSink, type ExportRow, type ExportShardAdminArgs, type ExportShardArgs, type ExternalSourceDiffResult, type ExternalSourceLike, FLAGS_FUNCTION_PREFIX, type FacetColumnOptions, type FacetColumnResult, type FacetValue, type FanOutBudget, type FanoutMetricsResult, type FanoutPathCounters, type FanoutTopicStat, type FieldOperators, type FilterClause, type FilterOperator, type FlagEvaluation, type FlagsResult, type FunctionCallStat, type FunctionScanAttribution, type FunctionStatsResult, GEO_DEFAULT_PRECISION, GLOBAL_SHAPE_SNAPSHOT_TABLE, type GeoBoundingBox, type GeoFilterBuilderLike, type GeoIndexDefinitionLike, type GeoPoint, type GeoScoredDocument, type GlobalPollCounters, GlobalPollTick, type GroupByEntry, type GroupByOptions, type GuardableSchema$1 as GuardableSchema, IDEMPOTENCY_TABLE, type IdGenerator, type IdempotentRecord, type ImportError, type ImportShardAdminArgs, type ImportShardArgs, type ImportShardResult, type IncrementalMaterializeResult, type IndexDefinitionLike, type IndexKeyEntry, type IndexRangeBuilderLike, type KeyRange, type LifecycleDispatchInfo, type LifecycleEvent, MAIL_RETENTION, MAIL_TABLE, MAX_DURABLE_STREAM_BYTES, MAX_DURABLE_STREAM_CHUNKS, MAX_PAGE_SIZE, MAX_SQL_ROWS, type MaskColumnMetadata, type MaskPoliciesResult, type MaterializeResult, type MigrationDirection, type MigrationRunResult, type MigrationStatus, type MigrationStatusRow, type MutationDelta, type NestedWith, NotFoundError, NotUniqueError, type OnDeleteActionLike, type OrderByClause, type OrderByInput, type OrderKey, type OrderKeyConstraints, 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, REACTOR_STATE_TABLE, RELATED_DEFAULT_LIMIT, RELATED_DEPTH_DECAY, RELATED_MAX_DEPTH, RELATED_MAX_LIMIT, RELATION_EXISTS_KEY, RELATION_FUNCTION_PREFIX, REPROJECTION_MIGRATION_PREFIX, RLS_UNWRAP_SYMBOL, type 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 RelayAttach, type RelayDetach, type RelayFrame, type RelayHost, RelayMember, type RelayPokeDelivery, type RelayShapePoke, type RelayShapeSeed, type RelayShapeSubscribe, type RelayShapeUnsubscribe, type RenderedSql, type ReplicaFollowerHost, type ReplicaOwnerHost, type ReplicaReadiness, type ResolveRelationPredicatesOptions, type ResolveWithOptions, type ResolveWithResult, type ResolvedShape, type RestrictableQueryOptions, type RlsPoliciesResult, type RlsPolicyMetadata, RlsRequiredError, type RlsRoleMetadata, type RpcRequest, type RunDataMigrationOptions, type RunTriggersOptions, SCAN_DEP, SCHEDULE_OUTBOX_TABLE, SCHEMA_HISTORY_MAX_VERSIONS, SEARCH_STATE_TABLE, SHAPE_POKE_CURSOR_TABLE, type SchedulableWorkflowReferenceLike, type ScheduleOutbox, type ScheduleOutboxEnvelope, type ScheduleOutboxRow, type ScheduledFunctionDoc, type SchedulerLike, type SchemaLike, type ScoredDocument, type SearchBackfillProgress, type SearchFilterBuilderLike, type SearchIndexDefinitionLike, type SearchScoredDocument, type SelectMatchingIdsOptions, type ServerDefaultContextLike, type SettingEntry, type SettingKind, type SettingsResult, ShapeDiffCache, type ShapePokeCursorRow, type ShapePokePart, type ShapeProbeCounters, type ShapeRow, type ShapeRowOp, type ShapeSubscriptionQuery, type ShardRankPageResult, ShardRunner, type ShardRunnerOptions, type ShardSiblingHost, type ShardSocketLike, type SocketAttachment, type SortDirection, type SourceClientLike, type SourceCursorLike, type SourceRefresh, type SqlConsoleResult, type SqlCursor, type SqlEngine, type SqlExec, type SqlLintResult, type StorageMetadata, type StorageReference, type StorageReferenceResult, type StorageRuleMetadata, type StorageRulesResult, type StudioFeaturesResult, type SubscriptionConnection, type SubscriptionEnvelope, type SubscriptionIdentity, type SubscriptionInfo, type SubscriptionQuery, type SubscriptionReadFootprint, type SubscriptionsResult, type SystemDatabaseReader, type SystemDoc, type SystemQuery, type SystemReaderOptions, type SystemReaderSchedulerLike, type SystemReaderStorageLike, type SystemTableName, type TableColumnsResult, type TableDefinitionLike, type TableIndexInfo, type TableIndexesResult, type TableInfo, type TablePage, type TableReaderLike, type TablesColumnsResult, type TablesIndexesResult, type TransactionHeadroom, TransactionHeadroomTracker, type TransactionLimits, type TransactionSqlLike, type TriggerContextLike, type TriggerDefinitionLike, type TriggerEventLike, type TriggerOpLike, type TriggerTimingLike, type TtlSweepSpec, UNVOUCHABLE_DEP, type ValidatorLike, type WhereInput, type WhereSqlStrategy, type WithInput, type WorkflowInstanceState, type WorkflowInstanceStatusResult, type WorkflowMetadata, type WorkflowsResult, type WriteEvent, type WriteHook, advanceClientWatermark, aggUpsertSql, aggregateSqlFunction, aggregateTableName, allocateCommitSeq, appendAuditEntry, appendCdcChange, appendStreamChunk, applyCdcChanges, applyOnDelete, applySelect, archiveCdcSegment, armRestore, assertFlatPredicate, assertNoExplicitUndefined, assertReadonly, assertShapeShardable, assertValidClientId, awaitWsDrain, backfillAggregateIndexes, backfillRankIndexes, backfillSearchIndexes, backfillSearchIndexesForTable, bigintSqlKey, boundingBoxCenter, boundingBoxGeohashes, buildIndexRange, buildPokeFrames, buildReprojectionMigration, buildSeekBeforeWhere, buildSeekWhere, buildSettings, buildShapeDiff, bumpCdcEpoch, cdcArchiveRewound, cdcCanVouchFor, cdcForkedError, cdcSeqLeavingRows, cdcTouchesTables, cdcTrimmedError, claimStreamRun, clampPromotionThresholds, clearCapturedMail, clearMemoryTables, clearQueueMessages, coerceAggregateNumber, compactCdcDocs, compileWhereSql, 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, diffExternalSource, diffGlobalMembership, distinctValues, encodeAggregateKey, encodeCursor, encodeGeohash, encodePartitionKey, encodeRowsPatch, ensureAuditTable, ensureMailTable, envOptionalPositiveInt, envPositiveInt, equalityPinnedFields, exportShardRows, facetColumn, fanOutScalarCounts, findRelated, findStorageReferences, finishStreamRun, float64SqlKey, foldAggregateTally, forgetScheduleOutbox, gateReplicaDispatch, geoTableName, globalShapeReadKey, guardWriter, handleReplicaControl, hasTrigger, haversineMeters, importShardRows, indexKeysForRow, isDevEnvironment, isFtsAvailable, isLossyBody, isMemoryTable, isRelationPredicate, isSoftDeleted, isSourceDue, jsonPath, jsonPathSql, keysTouchRanges, liftSourceId, lintReadonlySql, listReactorStates, listTables, literalInList, markUnvouchableReads, matchesRankStaticWhere, matchesStaticWhere, materializeExternalRows, materializeExternalRowsIncremental, memoryTableNames, mergeChangedKeys, mergeWhere, migrateCdcLog, migrateCdcMeta, migrateClientWatermark, migrateCommitSeq, migrateDurableStreams, migrateGlobalShapeSnapshot, migrateIdempotency, migrateReactorState, migrateScheduleOutbox, migrateSearchState, migrateShapePokeCursor, minCdcReplayableSeq, minCdcSeq, minShapePokeCursor, nextPromotionState, normalizeCountArgument, normalizeIdStructurally, normalizeOrderKeys, normalizeSourceDocument, normalizeSourceValue, param, parkScheduleOutbox, parseExportShardArgs, parseImportShardArgs, 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, readQueueMessageById, readQueueMessages, readReactorState, readSchemaHistory, readSchemaVersion, readSearchBackfillState, readShapePokeCursor, readStreamChunks, readStreamRun, readTablePage, recordCapturedMail, recordChangedKeys, recordFanoutPass, recordGlobalPollPass, recordQueueMessages, recordScheduleOutbox, recordSchemaVersion, recordShapeProbePass, relationHooks, relayCountFor, renderSql, reprojectableFields, reprojectionMigrationId, reprojectionTables, resolveRankPartition, resolveRankSeekTuple, resolveRelationPredicates, resolveWith, rowToDocument, runDataMigration, runDrizzle, runExternalSourceTick, runReadonlySql, runRowValidators, runShardMigrations, runSocketPool, runSql, runTriggers, selectExpiredIds, selectExportTables, selectIndexForAggregate, selectIndexForCount, selectIndexForGroupBy, selectMatchingIds, selectShapeMembers, selectShapeRows, serializeSqlValue, shapeRoutingKey, softDeleteScope, sortColumnName, sqliteInList, stableStringify, stableWireKey, stripReservedPatchFields, subscriptionFrames, subscriptionListDeltas, summarizeFanoutTopics, summarizeSubscriptions, tableColumns, tableFromDepKey, throwingScheduler, tiebreakDirectionFor, trimCdcChanges, trimIdempotent, trimScheduleOutbox, trimStreamRuns, tryRowToDocument, trySendFrame, unionAll, uniqueIndexFields, validateImportRow, writeCdcArchivedThrough, writeGlobalShapeSnapshot, writeIdempotent, writeReactorState, writeSearchBackfillState, writeShapePokeCursor, writeShapePokeCursors, writeTouchesMemo };
2499
+ 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, BIGINT_KEY_DIGITS, type BroadcastDelta, CDC_LOG_TABLE, CDC_LOG_TABLE_SEQ_INDEX, CDC_META_TABLE, CLIENT_WATERMARK_TABLE, COMMIT_SEQ_FIELD, COMMIT_SEQ_TABLE, CURSOR_PREFIX, type CacheEntry, type CapturedMailRow, type CdcArchiveScope, type CdcChange, type CdcChangeKey, type ChangedKeys, type Clock, type ColumnMeta, type ColumnMetaLike, type CompanionSync, type CompanionSyncDeps, ConflictError, type ConflictKind, type CountArgs, CountRlsUnsupportedError, type CreateWorkflowInstanceResult, type CrossShardReadArgs, type CtxDbOptions, DATA_MIGRATION_STATE_TABLE, DEFAULT_FANOUT_TOPIC_LIMIT, DEFAULT_MAX_RELATION_KEYS, DEFAULT_MAX_RELAYS, DEFAULT_PROMOTION_THRESHOLDS, DEFAULT_TRANSACTION_LIMITS, DOC_COLUMN, type DataMigrationDocument, type DataMigrationLike, type DataMigrationTransform, type DatabaseWriterLike, type DependencyTracker, type DeployInfo, type DurableAttachDecision, type DurableStreamAttach, type DurableStreamRun, DurableStreamRunner, type DurableStreamSink, type ExportRow, type ExportShardAdminArgs, type ExportShardArgs, type ExternalSourceDiffResult, type ExternalSourceLike, FLAGS_FUNCTION_PREFIX, type FacetColumnOptions, type FacetColumnResult, type FacetValue, type FanOutBudget, type FanoutMetricsResult, type FanoutPathCounters, type FanoutTopicStat, type FieldOperators, type FilterClause, type FilterOperator, type FlagEvaluation, type FlagsResult, type FtsWriteOptions, type FunctionCallStat, type FunctionScanAttribution, type FunctionStatsResult, GEO_DEFAULT_PRECISION, GLOBAL_SHAPE_SNAPSHOT_TABLE, type GeoBoundingBox, type GeoFilterBuilderLike, type GeoIndexDefinitionLike, type GeoPoint, type GeoScoredDocument, type GlobalPollCounters, GlobalPollTick, type GroupByEntry, type GroupByOptions, type GuardableSchema$1 as GuardableSchema, IDEMPOTENCY_TABLE, type IdGenerator, type IdempotentRecord, type ImportError, type ImportShardAdminArgs, type ImportShardArgs, type ImportShardResult, type IncrementalMaterializeResult, type IndexDefinitionLike, type IndexKeyEntry, type IndexRangeBuilderLike, type KeyRange, type LifecycleDispatchInfo, type LifecycleEvent, MAIL_RETENTION, MAIL_TABLE, MAX_DURABLE_STREAM_BYTES, MAX_DURABLE_STREAM_CHUNKS, MAX_PAGE_SIZE, MAX_SQL_ROWS, type MaskColumnMetadata, type MaskPoliciesResult, type MaterializeResult, type MigrationDirection, type MigrationRunResult, type MigrationStatus, type MigrationStatusRow, type MutationDelta, type NestedWith, NotFoundError, NotUniqueError, type OnDeleteActionLike, type OrderByClause, type OrderByInput, type OrderKey, type OrderKeyConstraints, 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, REACTOR_STATE_TABLE, RELATED_DEFAULT_LIMIT, RELATED_DEPTH_DECAY, RELATED_MAX_DEPTH, RELATED_MAX_LIMIT, RELATION_EXISTS_KEY, RELATION_FUNCTION_PREFIX, REPROJECTION_MIGRATION_PREFIX, RLS_UNWRAP_SYMBOL, type 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 RelayAttach, type RelayDetach, type RelayFrame, type RelayHost, RelayMember, type RelayPokeDelivery, type RelayShapePoke, type RelayShapeSeed, type RelayShapeSubscribe, type RelayShapeUnsubscribe, type RenderedSql, type ReplicaFollowerHost, type ReplicaOwnerHost, type ReplicaReadiness, type ResolveRelationPredicatesOptions, type ResolveWithOptions, type ResolveWithResult, type ResolvedShape, type RestrictableQueryOptions, type RlsPoliciesResult, type RlsPolicyMetadata, RlsRequiredError, type RlsRoleMetadata, type RpcRequest, type RunDataMigrationOptions, type RunTriggersOptions, SCAN_DEP, SCHEDULE_OUTBOX_TABLE, SCHEMA_HISTORY_MAX_VERSIONS, SEARCH_STATE_TABLE, SHAPE_POKE_CURSOR_TABLE, type SchedulableWorkflowReferenceLike, type ScheduleOutbox, type ScheduleOutboxEnvelope, type ScheduleOutboxRow, type ScheduledFunctionDoc, type SchedulerLike, type SchemaLike, type ScoredDocument, type SearchBackfillProgress, type SearchFilterBuilderLike, type SearchIndexDefinitionLike, type SearchScoredDocument, type SelectMatchingIdsOptions, type ServerDefaultContextLike, type SettingEntry, type SettingKind, type SettingsResult, ShapeDiffCache, type ShapePokeCursorRow, type ShapePokePart, type ShapeProbeCounters, type ShapeRow, type ShapeRowOp, type ShapeSubscriptionQuery, type ShardRankPageResult, ShardRunner, type ShardRunnerOptions, type ShardSiblingHost, type ShardSocketLike, type SocketAttachment, type SortDirection, type SourceClientLike, type SourceCursorLike, type SourceRefresh, type SqlConsoleResult, type SqlCursor, type SqlEngine, type SqlExec, type SqlLintResult, type StorageMetadata, type StorageReference, type StorageReferenceResult, type StorageRuleMetadata, type StorageRulesResult, type StudioFeaturesResult, type SubscriptionConnection, type SubscriptionEnvelope, type SubscriptionIdentity, type SubscriptionInfo, type SubscriptionQuery, type SubscriptionReadFootprint, type SubscriptionsResult, type SystemDatabaseReader, type SystemDoc, type SystemQuery, type SystemReaderOptions, type SystemReaderSchedulerLike, type SystemReaderStorageLike, type SystemTableName, type TableColumnsResult, type TableDefinitionLike, type TableIndexInfo, type TableIndexesResult, type TableInfo, type TablePage, type TableReaderLike, type TablesColumnsResult, type TablesIndexesResult, type 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, type WhereInput, type WhereSqlStrategy, type WithInput, type WorkflowInstanceState, type WorkflowInstanceStatusResult, type WorkflowMetadata, type WorkflowsResult, type WriteEvent, type WriteHook, advanceClientWatermark, aggUpsertSql, aggregateSqlFunction, aggregateTableName, allocateCommitSeq, appendAuditEntry, appendCdcChange, appendStreamChunk, applyCdcChanges, applyOnDelete, applySelect, archiveCdcSegment, armRestore, assertFlatPredicate, assertNoExplicitUndefined, assertReadonly, assertShapeShardable, assertValidClientId, awaitWsDrain, backfillAggregateIndexes, backfillRankIndexes, backfillSearchIndexes, backfillSearchIndexesForTable, backfillVectorIndexes, bigintSqlKey, boundingBoxCenter, boundingBoxGeohashes, buildIndexRange, buildPokeFrames, buildReprojectionMigration, buildSeekBeforeWhere, buildSeekWhere, buildSettings, buildShapeDiff, bumpCdcEpoch, cdcArchiveRewound, cdcCanVouchFor, cdcForkedError, cdcSeqLeavingRows, cdcTouchesTables, cdcTrimmedError, claimStreamRun, clampPromotionThresholds, clearCapturedMail, clearMemoryTables, clearQueueMessages, coerceAggregateNumber, compactCdcDocs, compileWhereSql, 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, 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, isLossyBody, isMemoryTable, isRelationPredicate, isSoftDeleted, isSourceDue, jsonPath, jsonPathSql, keysTouchRanges, liftSourceId, lintReadonlySql, listReactorStates, listTables, literalInList, markUnvouchableReads, matchesRankStaticWhere, matchesStaticWhere, materializeExternalRows, materializeExternalRowsIncremental, memoryTableNames, mergeChangedKeys, mergeWhere, migrateCdcLog, migrateCdcMeta, migrateClientWatermark, migrateCommitSeq, migrateDurableStreams, migrateGlobalShapeSnapshot, migrateIdempotency, migrateReactorState, migrateScheduleOutbox, migrateSearchState, migrateShapePokeCursor, minCdcReplayableSeq, minCdcSeq, minShapePokeCursor, nextPromotionState, normalizeCountArgument, normalizeIdStructurally, normalizeOrderKeys, normalizeSourceDocument, normalizeSourceValue, param, parkScheduleOutbox, parseExportShardArgs, parseImportShardArgs, 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, readQueueMessageById, readQueueMessages, readReactorState, readSchemaHistory, readSchemaVersion, readSearchBackfillState, readShapePokeCursor, readStreamChunks, readStreamRun, readTablePage, recordCapturedMail, recordChangedKeys, recordFanoutPass, recordGlobalPollPass, recordQueueMessages, recordScheduleOutbox, recordSchemaVersion, recordShapeProbePass, relationHooks, relayCountFor, renderSql, reprojectableFields, reprojectionMigrationId, reprojectionTables, resolveRankPartition, resolveRankSeekTuple, resolveRelationPredicates, resolveWith, rowToDocument, runDataMigration, runDrizzle, runExternalSourceTick, runReadonlySql, runRowValidators, runShardMigrations, runSocketPool, runSql, runTriggers, selectExpiredIds, selectExportTables, selectIndexForAggregate, selectIndexForCount, selectIndexForGroupBy, selectMatchingIds, selectShapeMembers, selectShapeRows, serializeSqlValue, shapeRoutingKey, softDeleteScope, sortColumnName, sqliteInList, stableStringify, stableWireKey, stripReservedPatchFields, subscriptionFrames, subscriptionListDeltas, summarizeFanoutTopics, summarizeSubscriptions, tableColumns, tableFromDepKey, throwingScheduler, tiebreakDirectionFor, trimCdcChanges, trimIdempotent, trimScheduleOutbox, trimStreamRuns, tryRowToDocument, trySendFrame, unionAll, uniqueIndexFields, validateImportRow, writeCdcArchivedThrough, writeGlobalShapeSnapshot, writeIdempotent, writeReactorState, writeSearchBackfillState, writeShapePokeCursor, writeShapePokeCursors, writeTouchesMemo };
package/dist/index.d.ts CHANGED
@@ -875,7 +875,7 @@ declare const runShardMigrations: (sql: SqlExec, schema: SchemaLike, options?: {
875
875
  * same three facts, and the decisions made from them are the shared policy
876
876
  * below.
877
877
  */
878
- interface SearchBackfillState {
878
+ interface BackfillState {
879
879
  /** Last `id` indexed, or `undefined` when no page has run yet. */
880
880
  cursor: string | undefined;
881
881
  /** True once a page came back short — the table is fully indexed. */
@@ -885,7 +885,7 @@ interface SearchBackfillState {
885
885
  }
886
886
  declare const SEARCH_STATE_TABLE = "__lunora_search_state";
887
887
  declare const migrateSearchState: (sql: SqlExec) => void;
888
- declare const readSearchBackfillState: (sql: SqlExec, companion: string) => SearchBackfillState;
888
+ declare const readSearchBackfillState: (sql: SqlExec, companion: string) => BackfillState;
889
889
  declare const writeSearchBackfillState: (sql: SqlExec, companion: string, cursor: string | undefined, done: boolean, profile: string) => void;
890
890
  interface ShapeRow {
891
891
  doc: Record<string, unknown>;
@@ -1302,6 +1302,16 @@ declare const isSoftDeleted: (row: Record<string, unknown>, column: string) => b
1302
1302
  declare const pullExternalSourceIncrementalTick: (sql: SqlExec, writer: DatabaseWriterLike, client: SourceClientLike, table: string, source: ExternalSourceLike, shardKey: string, nowMs: number) => Promise<{
1303
1303
  applied: number;
1304
1304
  }>;
1305
+ declare const ftsRowidMapName: (companion: string) => string;
1306
+ interface FtsWriteOptions {
1307
+ guard?: SQL;
1308
+ unmappedRowids?: ReadonlyArray<number>;
1309
+ }
1310
+ declare const ftsCompanionDdl: (companion: string) => SQL[];
1311
+ declare const ftsWriteDocument: (companion: string, id: string, text: string, options?: FtsWriteOptions) => SQL[];
1312
+ declare const ftsPurgeDocument: (companion: string, id: string, options?: FtsWriteOptions) => SQL[];
1313
+ declare const ftsUnmappedPage: (companion: string, limit: number, after?: number) => SQL;
1314
+ declare const groupUnmappedRows: (rows: ReadonlyArray<Record<string, unknown>>) => Map<string, number[]>;
1305
1315
  declare const GEO_DEFAULT_PRECISION = 9;
1306
1316
  interface GeoPoint {
1307
1317
  lat: number;
@@ -1341,6 +1351,7 @@ declare const ADMIN_FUNCTIONS: {
1341
1351
  readonly aiTableFilter: "__lunora_admin__:aiTableFilter";
1342
1352
  readonly assignIssue: "__lunora_admin__:assignIssue";
1343
1353
  readonly backfillSearch: "__lunora_admin__:backfillSearch";
1354
+ readonly backfillVectors: "__lunora_admin__:backfillVectors";
1344
1355
  readonly backRelationCounts: "__lunora_admin__:backRelationCounts";
1345
1356
  readonly cdcSync: "__lunora_admin__:cdcSync";
1346
1357
  readonly clearCapturedMail: "__lunora_admin__:clearCapturedMail";
@@ -2438,6 +2449,32 @@ declare const selectExpiredIds: (sql: SqlExec, spec: TtlSweepSpec, now: number,
2438
2449
  hasMore: boolean;
2439
2450
  ids: string[];
2440
2451
  };
2452
+ declare const VECTOR_BACKFILL_MAX_PAGES = 20;
2453
+ interface VectorBackfillTarget {
2454
+ profile: string;
2455
+ table: string;
2456
+ }
2457
+ interface VectorBackfillProgress {
2458
+ done: boolean;
2459
+ error?: string;
2460
+ failed: number;
2461
+ failedIds: string[];
2462
+ pages: number;
2463
+ rows: number;
2464
+ }
2465
+ type VectorPageSync = (table: string, rows: ReadonlyArray<{
2466
+ doc: Record<string, unknown>;
2467
+ id: string;
2468
+ }>) => Promise<ReadonlyArray<{
2469
+ error: unknown;
2470
+ id: string;
2471
+ }>>;
2472
+ type OrderedAfterWrites = <T, U>(read: () => T, work: (value: T) => Promise<U>) => Promise<U>;
2473
+ declare const backfillVectorIndexes: (sql: SqlExec, targets: ReadonlyArray<VectorBackfillTarget>, sync: VectorPageSync, options: {
2474
+ maxPages?: number;
2475
+ ordered: OrderedAfterWrites;
2476
+ restart?: boolean;
2477
+ }) => Promise<VectorBackfillProgress>;
2441
2478
  interface WhereFragments<T> {
2442
2479
  binary: (reference: T, comparator: string, value: unknown) => T;
2443
2480
  connect: (left: T, right: T, connector: "AND" | "OR") => T;
@@ -2459,4 +2496,4 @@ interface WhereSqlStrategy<T = SQL> {
2459
2496
  }
2460
2497
  declare const literalInList: (reference: SQL, items: ReadonlyArray<unknown>, negated: boolean) => SQL;
2461
2498
  declare const compileWhereSql: <T = SQL>(where: WhereInput | undefined, strategy: WhereSqlStrategy<T>, fragments?: WhereFragments<T>) => T | undefined;
2462
- 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, BIGINT_KEY_DIGITS, type BroadcastDelta, CDC_LOG_TABLE, CDC_LOG_TABLE_SEQ_INDEX, CDC_META_TABLE, CLIENT_WATERMARK_TABLE, COMMIT_SEQ_FIELD, COMMIT_SEQ_TABLE, CURSOR_PREFIX, type CacheEntry, type CapturedMailRow, type CdcArchiveScope, type CdcChange, type CdcChangeKey, type ChangedKeys, type Clock, type ColumnMeta, type ColumnMetaLike, type CompanionSync, type CompanionSyncDeps, ConflictError, type ConflictKind, type CountArgs, CountRlsUnsupportedError, type CreateWorkflowInstanceResult, type CrossShardReadArgs, type CtxDbOptions, DATA_MIGRATION_STATE_TABLE, DEFAULT_FANOUT_TOPIC_LIMIT, DEFAULT_MAX_RELATION_KEYS, DEFAULT_MAX_RELAYS, DEFAULT_PROMOTION_THRESHOLDS, DEFAULT_TRANSACTION_LIMITS, DOC_COLUMN, type DataMigrationDocument, type DataMigrationLike, type DataMigrationTransform, type DatabaseWriterLike, type DependencyTracker, type DeployInfo, type DurableAttachDecision, type DurableStreamAttach, type DurableStreamRun, DurableStreamRunner, type DurableStreamSink, type ExportRow, type ExportShardAdminArgs, type ExportShardArgs, type ExternalSourceDiffResult, type ExternalSourceLike, FLAGS_FUNCTION_PREFIX, type FacetColumnOptions, type FacetColumnResult, type FacetValue, type FanOutBudget, type FanoutMetricsResult, type FanoutPathCounters, type FanoutTopicStat, type FieldOperators, type FilterClause, type FilterOperator, type FlagEvaluation, type FlagsResult, type FunctionCallStat, type FunctionScanAttribution, type FunctionStatsResult, GEO_DEFAULT_PRECISION, GLOBAL_SHAPE_SNAPSHOT_TABLE, type GeoBoundingBox, type GeoFilterBuilderLike, type GeoIndexDefinitionLike, type GeoPoint, type GeoScoredDocument, type GlobalPollCounters, GlobalPollTick, type GroupByEntry, type GroupByOptions, type GuardableSchema$1 as GuardableSchema, IDEMPOTENCY_TABLE, type IdGenerator, type IdempotentRecord, type ImportError, type ImportShardAdminArgs, type ImportShardArgs, type ImportShardResult, type IncrementalMaterializeResult, type IndexDefinitionLike, type IndexKeyEntry, type IndexRangeBuilderLike, type KeyRange, type LifecycleDispatchInfo, type LifecycleEvent, MAIL_RETENTION, MAIL_TABLE, MAX_DURABLE_STREAM_BYTES, MAX_DURABLE_STREAM_CHUNKS, MAX_PAGE_SIZE, MAX_SQL_ROWS, type MaskColumnMetadata, type MaskPoliciesResult, type MaterializeResult, type MigrationDirection, type MigrationRunResult, type MigrationStatus, type MigrationStatusRow, type MutationDelta, type NestedWith, NotFoundError, NotUniqueError, type OnDeleteActionLike, type OrderByClause, type OrderByInput, type OrderKey, type OrderKeyConstraints, 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, REACTOR_STATE_TABLE, RELATED_DEFAULT_LIMIT, RELATED_DEPTH_DECAY, RELATED_MAX_DEPTH, RELATED_MAX_LIMIT, RELATION_EXISTS_KEY, RELATION_FUNCTION_PREFIX, REPROJECTION_MIGRATION_PREFIX, RLS_UNWRAP_SYMBOL, type 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 RelayAttach, type RelayDetach, type RelayFrame, type RelayHost, RelayMember, type RelayPokeDelivery, type RelayShapePoke, type RelayShapeSeed, type RelayShapeSubscribe, type RelayShapeUnsubscribe, type RenderedSql, type ReplicaFollowerHost, type ReplicaOwnerHost, type ReplicaReadiness, type ResolveRelationPredicatesOptions, type ResolveWithOptions, type ResolveWithResult, type ResolvedShape, type RestrictableQueryOptions, type RlsPoliciesResult, type RlsPolicyMetadata, RlsRequiredError, type RlsRoleMetadata, type RpcRequest, type RunDataMigrationOptions, type RunTriggersOptions, SCAN_DEP, SCHEDULE_OUTBOX_TABLE, SCHEMA_HISTORY_MAX_VERSIONS, SEARCH_STATE_TABLE, SHAPE_POKE_CURSOR_TABLE, type SchedulableWorkflowReferenceLike, type ScheduleOutbox, type ScheduleOutboxEnvelope, type ScheduleOutboxRow, type ScheduledFunctionDoc, type SchedulerLike, type SchemaLike, type ScoredDocument, type SearchBackfillProgress, type SearchFilterBuilderLike, type SearchIndexDefinitionLike, type SearchScoredDocument, type SelectMatchingIdsOptions, type ServerDefaultContextLike, type SettingEntry, type SettingKind, type SettingsResult, ShapeDiffCache, type ShapePokeCursorRow, type ShapePokePart, type ShapeProbeCounters, type ShapeRow, type ShapeRowOp, type ShapeSubscriptionQuery, type ShardRankPageResult, ShardRunner, type ShardRunnerOptions, type ShardSiblingHost, type ShardSocketLike, type SocketAttachment, type SortDirection, type SourceClientLike, type SourceCursorLike, type SourceRefresh, type SqlConsoleResult, type SqlCursor, type SqlEngine, type SqlExec, type SqlLintResult, type StorageMetadata, type StorageReference, type StorageReferenceResult, type StorageRuleMetadata, type StorageRulesResult, type StudioFeaturesResult, type SubscriptionConnection, type SubscriptionEnvelope, type SubscriptionIdentity, type SubscriptionInfo, type SubscriptionQuery, type SubscriptionReadFootprint, type SubscriptionsResult, type SystemDatabaseReader, type SystemDoc, type SystemQuery, type SystemReaderOptions, type SystemReaderSchedulerLike, type SystemReaderStorageLike, type SystemTableName, type TableColumnsResult, type TableDefinitionLike, type TableIndexInfo, type TableIndexesResult, type TableInfo, type TablePage, type TableReaderLike, type TablesColumnsResult, type TablesIndexesResult, type TransactionHeadroom, TransactionHeadroomTracker, type TransactionLimits, type TransactionSqlLike, type TriggerContextLike, type TriggerDefinitionLike, type TriggerEventLike, type TriggerOpLike, type TriggerTimingLike, type TtlSweepSpec, UNVOUCHABLE_DEP, type ValidatorLike, type WhereInput, type WhereSqlStrategy, type WithInput, type WorkflowInstanceState, type WorkflowInstanceStatusResult, type WorkflowMetadata, type WorkflowsResult, type WriteEvent, type WriteHook, advanceClientWatermark, aggUpsertSql, aggregateSqlFunction, aggregateTableName, allocateCommitSeq, appendAuditEntry, appendCdcChange, appendStreamChunk, applyCdcChanges, applyOnDelete, applySelect, archiveCdcSegment, armRestore, assertFlatPredicate, assertNoExplicitUndefined, assertReadonly, assertShapeShardable, assertValidClientId, awaitWsDrain, backfillAggregateIndexes, backfillRankIndexes, backfillSearchIndexes, backfillSearchIndexesForTable, bigintSqlKey, boundingBoxCenter, boundingBoxGeohashes, buildIndexRange, buildPokeFrames, buildReprojectionMigration, buildSeekBeforeWhere, buildSeekWhere, buildSettings, buildShapeDiff, bumpCdcEpoch, cdcArchiveRewound, cdcCanVouchFor, cdcForkedError, cdcSeqLeavingRows, cdcTouchesTables, cdcTrimmedError, claimStreamRun, clampPromotionThresholds, clearCapturedMail, clearMemoryTables, clearQueueMessages, coerceAggregateNumber, compactCdcDocs, compileWhereSql, 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, diffExternalSource, diffGlobalMembership, distinctValues, encodeAggregateKey, encodeCursor, encodeGeohash, encodePartitionKey, encodeRowsPatch, ensureAuditTable, ensureMailTable, envOptionalPositiveInt, envPositiveInt, equalityPinnedFields, exportShardRows, facetColumn, fanOutScalarCounts, findRelated, findStorageReferences, finishStreamRun, float64SqlKey, foldAggregateTally, forgetScheduleOutbox, gateReplicaDispatch, geoTableName, globalShapeReadKey, guardWriter, handleReplicaControl, hasTrigger, haversineMeters, importShardRows, indexKeysForRow, isDevEnvironment, isFtsAvailable, isLossyBody, isMemoryTable, isRelationPredicate, isSoftDeleted, isSourceDue, jsonPath, jsonPathSql, keysTouchRanges, liftSourceId, lintReadonlySql, listReactorStates, listTables, literalInList, markUnvouchableReads, matchesRankStaticWhere, matchesStaticWhere, materializeExternalRows, materializeExternalRowsIncremental, memoryTableNames, mergeChangedKeys, mergeWhere, migrateCdcLog, migrateCdcMeta, migrateClientWatermark, migrateCommitSeq, migrateDurableStreams, migrateGlobalShapeSnapshot, migrateIdempotency, migrateReactorState, migrateScheduleOutbox, migrateSearchState, migrateShapePokeCursor, minCdcReplayableSeq, minCdcSeq, minShapePokeCursor, nextPromotionState, normalizeCountArgument, normalizeIdStructurally, normalizeOrderKeys, normalizeSourceDocument, normalizeSourceValue, param, parkScheduleOutbox, parseExportShardArgs, parseImportShardArgs, 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, readQueueMessageById, readQueueMessages, readReactorState, readSchemaHistory, readSchemaVersion, readSearchBackfillState, readShapePokeCursor, readStreamChunks, readStreamRun, readTablePage, recordCapturedMail, recordChangedKeys, recordFanoutPass, recordGlobalPollPass, recordQueueMessages, recordScheduleOutbox, recordSchemaVersion, recordShapeProbePass, relationHooks, relayCountFor, renderSql, reprojectableFields, reprojectionMigrationId, reprojectionTables, resolveRankPartition, resolveRankSeekTuple, resolveRelationPredicates, resolveWith, rowToDocument, runDataMigration, runDrizzle, runExternalSourceTick, runReadonlySql, runRowValidators, runShardMigrations, runSocketPool, runSql, runTriggers, selectExpiredIds, selectExportTables, selectIndexForAggregate, selectIndexForCount, selectIndexForGroupBy, selectMatchingIds, selectShapeMembers, selectShapeRows, serializeSqlValue, shapeRoutingKey, softDeleteScope, sortColumnName, sqliteInList, stableStringify, stableWireKey, stripReservedPatchFields, subscriptionFrames, subscriptionListDeltas, summarizeFanoutTopics, summarizeSubscriptions, tableColumns, tableFromDepKey, throwingScheduler, tiebreakDirectionFor, trimCdcChanges, trimIdempotent, trimScheduleOutbox, trimStreamRuns, tryRowToDocument, trySendFrame, unionAll, uniqueIndexFields, validateImportRow, writeCdcArchivedThrough, writeGlobalShapeSnapshot, writeIdempotent, writeReactorState, writeSearchBackfillState, writeShapePokeCursor, writeShapePokeCursors, writeTouchesMemo };
2499
+ 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, BIGINT_KEY_DIGITS, type BroadcastDelta, CDC_LOG_TABLE, CDC_LOG_TABLE_SEQ_INDEX, CDC_META_TABLE, CLIENT_WATERMARK_TABLE, COMMIT_SEQ_FIELD, COMMIT_SEQ_TABLE, CURSOR_PREFIX, type CacheEntry, type CapturedMailRow, type CdcArchiveScope, type CdcChange, type CdcChangeKey, type ChangedKeys, type Clock, type ColumnMeta, type ColumnMetaLike, type CompanionSync, type CompanionSyncDeps, ConflictError, type ConflictKind, type CountArgs, CountRlsUnsupportedError, type CreateWorkflowInstanceResult, type CrossShardReadArgs, type CtxDbOptions, DATA_MIGRATION_STATE_TABLE, DEFAULT_FANOUT_TOPIC_LIMIT, DEFAULT_MAX_RELATION_KEYS, DEFAULT_MAX_RELAYS, DEFAULT_PROMOTION_THRESHOLDS, DEFAULT_TRANSACTION_LIMITS, DOC_COLUMN, type DataMigrationDocument, type DataMigrationLike, type DataMigrationTransform, type DatabaseWriterLike, type DependencyTracker, type DeployInfo, type DurableAttachDecision, type DurableStreamAttach, type DurableStreamRun, DurableStreamRunner, type DurableStreamSink, type ExportRow, type ExportShardAdminArgs, type ExportShardArgs, type ExternalSourceDiffResult, type ExternalSourceLike, FLAGS_FUNCTION_PREFIX, type FacetColumnOptions, type FacetColumnResult, type FacetValue, type FanOutBudget, type FanoutMetricsResult, type FanoutPathCounters, type FanoutTopicStat, type FieldOperators, type FilterClause, type FilterOperator, type FlagEvaluation, type FlagsResult, type FtsWriteOptions, type FunctionCallStat, type FunctionScanAttribution, type FunctionStatsResult, GEO_DEFAULT_PRECISION, GLOBAL_SHAPE_SNAPSHOT_TABLE, type GeoBoundingBox, type GeoFilterBuilderLike, type GeoIndexDefinitionLike, type GeoPoint, type GeoScoredDocument, type GlobalPollCounters, GlobalPollTick, type GroupByEntry, type GroupByOptions, type GuardableSchema$1 as GuardableSchema, IDEMPOTENCY_TABLE, type IdGenerator, type IdempotentRecord, type ImportError, type ImportShardAdminArgs, type ImportShardArgs, type ImportShardResult, type IncrementalMaterializeResult, type IndexDefinitionLike, type IndexKeyEntry, type IndexRangeBuilderLike, type KeyRange, type LifecycleDispatchInfo, type LifecycleEvent, MAIL_RETENTION, MAIL_TABLE, MAX_DURABLE_STREAM_BYTES, MAX_DURABLE_STREAM_CHUNKS, MAX_PAGE_SIZE, MAX_SQL_ROWS, type MaskColumnMetadata, type MaskPoliciesResult, type MaterializeResult, type MigrationDirection, type MigrationRunResult, type MigrationStatus, type MigrationStatusRow, type MutationDelta, type NestedWith, NotFoundError, NotUniqueError, type OnDeleteActionLike, type OrderByClause, type OrderByInput, type OrderKey, type OrderKeyConstraints, 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, REACTOR_STATE_TABLE, RELATED_DEFAULT_LIMIT, RELATED_DEPTH_DECAY, RELATED_MAX_DEPTH, RELATED_MAX_LIMIT, RELATION_EXISTS_KEY, RELATION_FUNCTION_PREFIX, REPROJECTION_MIGRATION_PREFIX, RLS_UNWRAP_SYMBOL, type 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 RelayAttach, type RelayDetach, type RelayFrame, type RelayHost, RelayMember, type RelayPokeDelivery, type RelayShapePoke, type RelayShapeSeed, type RelayShapeSubscribe, type RelayShapeUnsubscribe, type RenderedSql, type ReplicaFollowerHost, type ReplicaOwnerHost, type ReplicaReadiness, type ResolveRelationPredicatesOptions, type ResolveWithOptions, type ResolveWithResult, type ResolvedShape, type RestrictableQueryOptions, type RlsPoliciesResult, type RlsPolicyMetadata, RlsRequiredError, type RlsRoleMetadata, type RpcRequest, type RunDataMigrationOptions, type RunTriggersOptions, SCAN_DEP, SCHEDULE_OUTBOX_TABLE, SCHEMA_HISTORY_MAX_VERSIONS, SEARCH_STATE_TABLE, SHAPE_POKE_CURSOR_TABLE, type SchedulableWorkflowReferenceLike, type ScheduleOutbox, type ScheduleOutboxEnvelope, type ScheduleOutboxRow, type ScheduledFunctionDoc, type SchedulerLike, type SchemaLike, type ScoredDocument, type SearchBackfillProgress, type SearchFilterBuilderLike, type SearchIndexDefinitionLike, type SearchScoredDocument, type SelectMatchingIdsOptions, type ServerDefaultContextLike, type SettingEntry, type SettingKind, type SettingsResult, ShapeDiffCache, type ShapePokeCursorRow, type ShapePokePart, type ShapeProbeCounters, type ShapeRow, type ShapeRowOp, type ShapeSubscriptionQuery, type ShardRankPageResult, ShardRunner, type ShardRunnerOptions, type ShardSiblingHost, type ShardSocketLike, type SocketAttachment, type SortDirection, type SourceClientLike, type SourceCursorLike, type SourceRefresh, type SqlConsoleResult, type SqlCursor, type SqlEngine, type SqlExec, type SqlLintResult, type StorageMetadata, type StorageReference, type StorageReferenceResult, type StorageRuleMetadata, type StorageRulesResult, type StudioFeaturesResult, type SubscriptionConnection, type SubscriptionEnvelope, type SubscriptionIdentity, type SubscriptionInfo, type SubscriptionQuery, type SubscriptionReadFootprint, type SubscriptionsResult, type SystemDatabaseReader, type SystemDoc, type SystemQuery, type SystemReaderOptions, type SystemReaderSchedulerLike, type SystemReaderStorageLike, type SystemTableName, type TableColumnsResult, type TableDefinitionLike, type TableIndexInfo, type TableIndexesResult, type TableInfo, type TablePage, type TableReaderLike, type TablesColumnsResult, type TablesIndexesResult, type 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, type WhereInput, type WhereSqlStrategy, type WithInput, type WorkflowInstanceState, type WorkflowInstanceStatusResult, type WorkflowMetadata, type WorkflowsResult, type WriteEvent, type WriteHook, advanceClientWatermark, aggUpsertSql, aggregateSqlFunction, aggregateTableName, allocateCommitSeq, appendAuditEntry, appendCdcChange, appendStreamChunk, applyCdcChanges, applyOnDelete, applySelect, archiveCdcSegment, armRestore, assertFlatPredicate, assertNoExplicitUndefined, assertReadonly, assertShapeShardable, assertValidClientId, awaitWsDrain, backfillAggregateIndexes, backfillRankIndexes, backfillSearchIndexes, backfillSearchIndexesForTable, backfillVectorIndexes, bigintSqlKey, boundingBoxCenter, boundingBoxGeohashes, buildIndexRange, buildPokeFrames, buildReprojectionMigration, buildSeekBeforeWhere, buildSeekWhere, buildSettings, buildShapeDiff, bumpCdcEpoch, cdcArchiveRewound, cdcCanVouchFor, cdcForkedError, cdcSeqLeavingRows, cdcTouchesTables, cdcTrimmedError, claimStreamRun, clampPromotionThresholds, clearCapturedMail, clearMemoryTables, clearQueueMessages, coerceAggregateNumber, compactCdcDocs, compileWhereSql, 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, 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, isLossyBody, isMemoryTable, isRelationPredicate, isSoftDeleted, isSourceDue, jsonPath, jsonPathSql, keysTouchRanges, liftSourceId, lintReadonlySql, listReactorStates, listTables, literalInList, markUnvouchableReads, matchesRankStaticWhere, matchesStaticWhere, materializeExternalRows, materializeExternalRowsIncremental, memoryTableNames, mergeChangedKeys, mergeWhere, migrateCdcLog, migrateCdcMeta, migrateClientWatermark, migrateCommitSeq, migrateDurableStreams, migrateGlobalShapeSnapshot, migrateIdempotency, migrateReactorState, migrateScheduleOutbox, migrateSearchState, migrateShapePokeCursor, minCdcReplayableSeq, minCdcSeq, minShapePokeCursor, nextPromotionState, normalizeCountArgument, normalizeIdStructurally, normalizeOrderKeys, normalizeSourceDocument, normalizeSourceValue, param, parkScheduleOutbox, parseExportShardArgs, parseImportShardArgs, 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, readQueueMessageById, readQueueMessages, readReactorState, readSchemaHistory, readSchemaVersion, readSearchBackfillState, readShapePokeCursor, readStreamChunks, readStreamRun, readTablePage, recordCapturedMail, recordChangedKeys, recordFanoutPass, recordGlobalPollPass, recordQueueMessages, recordScheduleOutbox, recordSchemaVersion, recordShapeProbePass, relationHooks, relayCountFor, renderSql, reprojectableFields, reprojectionMigrationId, reprojectionTables, resolveRankPartition, resolveRankSeekTuple, resolveRelationPredicates, resolveWith, rowToDocument, runDataMigration, runDrizzle, runExternalSourceTick, runReadonlySql, runRowValidators, runShardMigrations, runSocketPool, runSql, runTriggers, selectExpiredIds, selectExportTables, selectIndexForAggregate, selectIndexForCount, selectIndexForGroupBy, selectMatchingIds, selectShapeMembers, selectShapeRows, serializeSqlValue, shapeRoutingKey, softDeleteScope, sortColumnName, sqliteInList, stableStringify, stableWireKey, stripReservedPatchFields, subscriptionFrames, subscriptionListDeltas, summarizeFanoutTopics, summarizeSubscriptions, tableColumns, tableFromDepKey, throwingScheduler, tiebreakDirectionFor, trimCdcChanges, trimIdempotent, trimScheduleOutbox, trimStreamRuns, tryRowToDocument, trySendFrame, unionAll, uniqueIndexFields, validateImportRow, writeCdcArchivedThrough, writeGlobalShapeSnapshot, writeIdempotent, writeReactorState, writeSearchBackfillState, writeShapePokeCursor, writeShapePokeCursors, writeTouchesMemo };
package/dist/index.mjs CHANGED
@@ -1 +1 @@
1
- import{exportShardRows as o,importShardRows as a,parseExportShardArgs as t,parseImportShardArgs as i,selectExportTables as l,validateImportRow as n}from"./packem_shared/exportShardRows-1TkeNJI6.mjs";import{AGGREGATE_SQL_FUNCTION as d,aggregateSqlFunction as c,matchesStaticWhere as m,normalizeCountArgument as p,throwingScheduler as S}from"./packem_shared/AGGREGATE_SQL_FUNCTION-DDEoMnJR.mjs";import{aggregateTableName as f,coerceAggregateNumber as E,encodeAggregateKey as h,foldAggregateTally as x,readAggregateValue as T}from"./packem_shared/aggregateTableName-C7o-gpms.mjs";import{CountRlsUnsupportedError as R,mergeWhere as A,planAggregateLookup as g,selectIndexForAggregate as _,selectIndexForCount as I,selectIndexForGroupBy as b}from"./packem_shared/CountRlsUnsupportedError-BvsDqfO2.mjs";import{AUDIT_LOG_TABLE as D,appendAuditEntry as O,ensureAuditTable as P,readAuditLog as M}from"./packem_shared/AUDIT_LOG_TABLE-ONxmEAIz.mjs";import{NotUniqueError as F,assertNoExplicitUndefined as k,assertValidClientId as N,createShardCtxDb as B,normalizeIdStructurally as U,stripReservedPatchFields as G}from"./packem_shared/NotUniqueError-1OMgp1sA.mjs";import{backfillAggregateIndexes as v,backfillRankIndexes as w,backfillSearchIndexes as K,backfillSearchIndexesForTable as X}from"./packem_shared/backfillAggregateIndexes-DTemznr7.mjs";import{CDC_LOG_TABLE as W,CDC_LOG_TABLE_SEQ_INDEX as z,CDC_META_TABLE as V,appendCdcChange as Q,applyCdcChanges as Y,bumpCdcEpoch as j,cdcCanVouchFor as J,cdcForkedError as Z,cdcSeqLeavingRows as $,cdcTouchesTables as ee,cdcTrimmedError as re,compactCdcDocs as oe,cursorBelowRetainedFloor as ae,migrateCdcLog as te,migrateCdcMeta as ie,minCdcReplayableSeq as le,minCdcSeq as ne,readCdcChangeKeys as se,readCdcChanges as de,readCdcCursor as ce,readCdcEpoch as me,trimCdcChanges as pe}from"./packem_shared/CDC_LOG_TABLE-DXEAcmsr.mjs";import{archiveCdcSegment as ue,cdcArchiveRewound as fe,readArchivedCdcChanges as Ee,readCdcArchivedThrough as he,writeCdcArchivedThrough as xe}from"./packem_shared/archiveCdcSegment-E_R_b5Qz.mjs";import{CLIENT_WATERMARK_TABLE as Ce,advanceClientWatermark as Re,migrateClientWatermark as Ae,readClientWatermark as ge}from"./packem_shared/CLIENT_WATERMARK_TABLE-CRnrAnJ2.mjs";import{COMMIT_SEQ_FIELD as Ie,COMMIT_SEQ_TABLE as be,allocateCommitSeq as Le,migrateCommitSeq as De,readCommitSeq as Oe}from"./packem_shared/COMMIT_SEQ_FIELD-BUdOMG5y.mjs";import{c as Me}from"./packem_shared/ctx-db-companions-DsNfXSbb.mjs";import{GLOBAL_SHAPE_SNAPSHOT_TABLE as Fe,deleteGlobalShapeSnapshot as ke,deleteGlobalShapeSnapshotsForConnection as Ne,migrateGlobalShapeSnapshot as Be,readGlobalShapeSnapshot as Ue,writeGlobalShapeSnapshot as Ge}from"./packem_shared/GLOBAL_SHAPE_SNAPSHOT_TABLE-DSA6mzyx.mjs";import{IDEMPOTENCY_TABLE as ve,migrateIdempotency as we,readIdempotent as Ke,trimIdempotent as Xe,writeIdempotent as He}from"./packem_shared/IDEMPOTENCY_TABLE-DOpm_oMF.mjs";import{clearMemoryTables as ze,isMemoryTable as Ve,memoryTableNames as Qe}from"./packem_shared/clearMemoryTables-BGbmag2i.mjs";import{computeRankPage as je,resolveRankSeekTuple as Je}from"./packem_shared/computeRankPage-pTaG_r9F.mjs";import{SCHEDULE_OUTBOX_TABLE as $e,deferScheduleOutbox as er,forgetScheduleOutbox as rr,migrateScheduleOutbox as or,parkScheduleOutbox as ar,probeScheduleOutbox as tr,readDueScheduleOutbox as ir,recordScheduleOutbox as lr,trimScheduleOutbox as nr}from"./packem_shared/SCHEDULE_OUTBOX_TABLE-CD_UjYVx.mjs";import{S as dr,m as cr,r as mr,w as pr}from"./packem_shared/ctx-db-search-state-ruTuCsxa.mjs";import{SHAPE_POKE_CURSOR_TABLE as ur,deleteShapePokeCursor as fr,deleteShapePokeCursorsForConnection as Er,migrateShapePokeCursor as hr,minShapePokeCursor as xr,readShapePokeCursor as Tr,writeShapePokeCursor as Cr,writeShapePokeCursors as Rr}from"./packem_shared/SHAPE_POKE_CURSOR_TABLE-ByJVDHds.mjs";import{selectShapeMembers as gr,selectShapeRows as _r}from"./packem_shared/selectShapeMembers-B8gTOeOB.mjs";import{DATA_MIGRATION_STATE_TABLE as br,readMigrationStatus as Lr,runDataMigration as Dr}from"./packem_shared/DATA_MIGRATION_STATE_TABLE-BwFz6NTT.mjs";import{SCAN_DEP as Pr,createDependencyTracker as Mr,depKey as yr,tableFromDepKey as Fr}from"./packem_shared/SCAN_DEP-D7qE3iUe.mjs";import{runDrizzle as Nr,runSql as Br}from"./packem_shared/runDrizzle-2ULFQR_k.mjs";import{A as Gr,a as qr,b as vr,D as wr,c as Kr,d as Xr,g as Hr,i as Wr,j as zr,e as Vr,q as Qr,f as Yr,r as jr,t as Jr,h as Zr}from"./packem_shared/do-sql-kpl5Kt1j.mjs";import{param as eo,renderSql as ro,sqliteInList as oo,unionAll as ao}from"./packem_shared/param-DlozcSQu.mjs";import{appendStreamChunk as io,claimStreamRun as lo,deleteStreamRun as no,finishStreamRun as so,migrateDurableStreams as co,readStreamChunks as mo,readStreamRun as po,trimStreamRuns as So}from"./packem_shared/appendStreamChunk-C1Ok4b6J.mjs";import{DurableStreamRunner as fo,MAX_DURABLE_STREAM_BYTES as Eo,MAX_DURABLE_STREAM_CHUNKS as ho,decideDurableAttach as xo}from"./packem_shared/DurableStreamRunner-rTYp4v03.mjs";import{envOptionalPositiveInt as Co,envPositiveInt as Ro}from"./packem_shared/envOptionalPositiveInt-D2pY-c64.mjs";import{diffExternalSource as go}from"./packem_shared/diffExternalSource-DgDJhslq.mjs";import{liftSourceId as Io,normalizeSourceDocument as bo,normalizeSourceValue as Lo}from"./packem_shared/liftSourceId-CA3ENhXj.mjs";import{materializeExternalRows as Oo,materializeExternalRowsIncremental as Po,readExternalSourceBaseline as Mo,runExternalSourceTick as yo}from"./packem_shared/materializeExternalRows-B1623YXA.mjs";import{isSoftDeleted as ko,isSourceDue as No,pullExternalSourceIncrementalTick as Bo,pullExternalSourceTick as Uo}from"./packem_shared/isSoftDeleted-DIMlSsdB.mjs";import{GEO_DEFAULT_PRECISION as qo,boundingBoxCenter as vo,boundingBoxGeohashes as wo,coveringGeohashes as Ko,encodeGeohash as Xo,haversineMeters as Ho,pointInBoundingBox as Wo}from"./packem_shared/GEO_DEFAULT_PRECISION-CqpQZ-J_.mjs";import{default as Vo}from"./packem_shared/GlobalPollTick-BNK4o-XT.mjs";import{ADMIN_FUNCTIONS as Yo,ADMIN_FUNCTION_PREFIX as jo,DEFAULT_FANOUT_TOPIC_LIMIT as Jo,FLAGS_FUNCTION_PREFIX as Zo,MAX_PAGE_SIZE as $o,RELATION_FUNCTION_PREFIX as ea,createFanoutCounters as ra,createGlobalPollCounters as oa,createShapeProbeCounters as aa,facetColumn as ta,findStorageReferences as ia,listTables as la,readTablePage as na,recordFanoutPass as sa,recordGlobalPollPass as da,recordShapeProbePass as ca,selectMatchingIds as ma,summarizeFanoutTopics as pa,summarizeSubscriptions as Sa}from"./packem_shared/ADMIN_FUNCTIONS-BjpFlIz5.mjs";import{MAIL_RETENTION as fa,MAIL_TABLE as Ea,clearCapturedMail as ha,ensureMailTable as xa,readCapturedMail as Ta,recordCapturedMail as Ca}from"./packem_shared/MAIL_RETENTION-DGAQTHHs.mjs";import{NotFoundError as Aa}from"./packem_shared/NotFoundError-BhF7FeFr.mjs";import{armRestore as _a,readBookmark as Ia}from"./packem_shared/armRestore-Bu1_8SUa.mjs";import{CURSOR_PREFIX as La,applySelect as Da,buildSeekBeforeWhere as Oa,buildSeekWhere as Pa,decodeCursor as Ma,encodeCursor as ya,equalityPinnedFields as Fa,normalizeOrderKeys as ka,softDeleteScope as Na,tiebreakDirectionFor as Ba,uniqueIndexFields as Ua}from"./packem_shared/CURSOR_PREFIX-Bn8SFoGd.mjs";import{QUEUE_TABLE as qa,clearQueueMessages as va,isLossyBody as wa,readQueueMessageById as Ka,readQueueMessages as Xa,recordQueueMessages as Ha}from"./packem_shared/QUEUE_TABLE-s7QJZvBz.mjs";import{RANK_TIEBREAK as za,encodePartitionKey as Va,matchesRankStaticWhere as Qa,rankKeyFromDoc as Ya,rankPivotConditionSql as ja,rankTableName as Ja,resolveRankPartition as Za,sortColumnName as $a}from"./packem_shared/RANK_TIEBREAK-D5xNdzB3.mjs";import{ReactiveCache as rt,reactiveCacheKey as ot}from"./packem_shared/ReactiveCache-CU_NoCMR.mjs";import{REACTOR_STATE_TABLE as tt,listReactorStates as it,migrateReactorState as lt,reactorNeedsRun as nt,readReactorState as st,writeReactorState as dt}from"./packem_shared/REACTOR_STATE_TABLE-QPRFyxMS.mjs";import{UNVOUCHABLE_DEP as mt,createReadFootprint as pt,markUnvouchableReads as St}from"./packem_shared/UNVOUCHABLE_DEP-C68htACn.mjs";import{buildIndexRange as ft,indexKeysForRow as Et,keysTouchRanges as ht}from"./packem_shared/buildIndexRange-DvN8Qj8e.mjs";import{RELATED_DEFAULT_LIMIT as Tt,RELATED_DEPTH_DECAY as Ct,RELATED_MAX_DEPTH as Rt,RELATED_MAX_LIMIT as At,deriveRelationEdges as gt,findRelated as _t}from"./packem_shared/RELATED_DEFAULT_LIMIT-B9PH28Pn.mjs";import{DEFAULT_MAX_RELATION_KEYS as bt,assertFlatPredicate as Lt,assertShapeShardable as Dt,containsRelationPredicate as Ot,isRelationPredicate as Pt,resolveRelationPredicates as Mt}from"./packem_shared/DEFAULT_MAX_RELATION_KEYS-XESc7TiB.mjs";import{applyOnDelete as Ft,distinctValues as kt,fanOutScalarCounts as Nt,relationHooks as Bt,resolveWith as Ut,runRowValidators as Gt}from"./packem_shared/applyOnDelete-7JZ4vR9r.mjs";import{DEFAULT_PROMOTION_THRESHOLDS as vt,clampPromotionThresholds as wt,nextPromotionState as Kt,relayCountFor as Xt,shapeRoutingKey as Ht}from"./packem_shared/DEFAULT_PROMOTION_THRESHOLDS-Bfx7KakS.mjs";import{DEFAULT_MAX_RELAYS as zt,OwnerRelay as Vt,RelayMember as Qt,createRelayLink as Yt}from"./packem_shared/DEFAULT_MAX_RELAYS-Ng4SyJ7k.mjs";import{createReplicaLink as Jt,gateReplicaDispatch as Zt,handleReplicaControl as $t}from"./packem_shared/createReplicaLink-CUnl1y_Q.mjs";import{buildReprojectionMigration as ri,countLegacyRows as oi,reprojectableFields as ai,reprojectionTables as ti}from"./packem_shared/buildReprojectionMigration-DNjOe6AP.mjs";import{RLS_UNWRAP_SYMBOL as li,RlsRequiredError as ni,guardWriter as si}from"./packem_shared/RLS_UNWRAP_SYMBOL-BwwTbz3Q.mjs";import{SCHEMA_HISTORY_MAX_VERSIONS as ci,readSchemaHistory as mi,readSchemaVersion as pi,recordSchemaVersion as Si}from"./packem_shared/SCHEMA_HISTORY_MAX_VERSIONS-BluIj2s-.mjs";import{serializeSqlValue as fi}from"./packem_shared/serializeSqlValue-BEMMYX1n.mjs";import{buildSettings as hi,isDevEnvironment as xi,readDeployInfo as Ti}from"./packem_shared/buildSettings-DC3VeQ0H.mjs";import{buildShapeDiff as Ri}from"./packem_shared/buildShapeDiff-CnCHKdCw.mjs";import{ShapeDiffCache as gi,createShapeDiffCache as _i,globalShapeReadKey as Ii}from"./packem_shared/ShapeDiffCache-gdaILV5E.mjs";import{buildPokeFrames as Li,diffGlobalMembership as Di,encodeRowsPatch as Oi,projectColumns as Pi}from"./packem_shared/buildPokeFrames-BBE6J91z.mjs";import{ShardRunner as yi}from"./packem_shared/ShardRunner-CrveaPId.mjs";import{runSocketPool as ki}from"./packem_shared/runSocketPool-CZJ2X9cF.mjs";import{MAX_SQL_ROWS as Bi,assertReadonly as Ui,lintReadonlySql as Gi,runReadonlySql as qi}from"./packem_shared/MAX_SQL_ROWS-Dh_Ty0Zo.mjs";import{B as wi,b as Ki,d as Xi,a as Hi,f as Wi}from"./packem_shared/sql-projection-D3qdaItY.mjs";import{awaitWsDrain as Vi,subscriptionFrames as Qi,subscriptionListDeltas as Yi,trySendFrame as ji}from"./packem_shared/awaitWsDrain-apizgmKY.mjs";import{mergeChangedKeys as Zi,recordChangedKeys as $i,writeTouchesMemo as el}from"./packem_shared/mergeChangedKeys-BA3YxaLE.mjs";import{createSystemReader as ol}from"./packem_shared/createSystemReader-DcDLFfC-.mjs";import{ConflictError as tl}from"./packem_shared/ConflictError-C8GtJmjS.mjs";import{DEFAULT_TRANSACTION_LIMITS as ll,TransactionHeadroomTracker as nl}from"./packem_shared/DEFAULT_TRANSACTION_LIMITS-CTHQQgDC.mjs";import{hasTrigger as dl,runTriggers as cl}from"./packem_shared/hasTrigger-CjlwI4le.mjs";import{selectExpiredIds as pl}from"./packem_shared/selectExpiredIds-D5DEpBbi.mjs";import{c as ul,l as fl}from"./packem_shared/where-sql-x1YKldcq.mjs";import{RELATION_EXISTS_KEY as hl}from"./packem_shared/RELATION_EXISTS_KEY-CFUhnZSZ.mjs";import{REPROJECTION_MIGRATION_PREFIX as Tl,reprojectionMigrationId as Cl}from"./packem_shared/REPROJECTION_MIGRATION_PREFIX-Czcb6_mO.mjs";import{quoteIdentifier as Al}from"./packem_shared/quoteIdentifier-CObIFRhb.mjs";import{runShardMigrations as _l}from"./packem_shared/runShardMigrations-DGlaC68E.mjs";import{stableStringify as bl}from"./packem_shared/stableStringify-DibjylKD.mjs";import{stableWireKey as Dl}from"./packem_shared/stableWireKey-D2US4k_J.mjs";export{Yo as ADMIN_FUNCTIONS,jo as ADMIN_FUNCTION_PREFIX,d as AGGREGATE_SQL_FUNCTION,Gr as AGG_COUNT,qr as AGG_KEY,vr as AGG_VALUE,D as AUDIT_LOG_TABLE,wi as BIGINT_KEY_DIGITS,W as CDC_LOG_TABLE,z as CDC_LOG_TABLE_SEQ_INDEX,V as CDC_META_TABLE,Ce as CLIENT_WATERMARK_TABLE,Ie as COMMIT_SEQ_FIELD,be as COMMIT_SEQ_TABLE,La as CURSOR_PREFIX,tl as ConflictError,R as CountRlsUnsupportedError,br as DATA_MIGRATION_STATE_TABLE,Jo as DEFAULT_FANOUT_TOPIC_LIMIT,bt as DEFAULT_MAX_RELATION_KEYS,zt as DEFAULT_MAX_RELAYS,vt as DEFAULT_PROMOTION_THRESHOLDS,ll as DEFAULT_TRANSACTION_LIMITS,wr as DOC_COLUMN,fo as DurableStreamRunner,Zo as FLAGS_FUNCTION_PREFIX,qo as GEO_DEFAULT_PRECISION,Fe as GLOBAL_SHAPE_SNAPSHOT_TABLE,Vo as GlobalPollTick,ve as IDEMPOTENCY_TABLE,fa as MAIL_RETENTION,Ea as MAIL_TABLE,Eo as MAX_DURABLE_STREAM_BYTES,ho as MAX_DURABLE_STREAM_CHUNKS,$o as MAX_PAGE_SIZE,Bi as MAX_SQL_ROWS,Aa as NotFoundError,F as NotUniqueError,Vt as OwnerRelay,qa as QUEUE_TABLE,za as RANK_TIEBREAK,tt as REACTOR_STATE_TABLE,Tt as RELATED_DEFAULT_LIMIT,Ct as RELATED_DEPTH_DECAY,Rt as RELATED_MAX_DEPTH,At as RELATED_MAX_LIMIT,hl as RELATION_EXISTS_KEY,ea as RELATION_FUNCTION_PREFIX,Tl as REPROJECTION_MIGRATION_PREFIX,li as RLS_UNWRAP_SYMBOL,rt as ReactiveCache,Qt as RelayMember,ni as RlsRequiredError,Pr as SCAN_DEP,$e as SCHEDULE_OUTBOX_TABLE,ci as SCHEMA_HISTORY_MAX_VERSIONS,dr as SEARCH_STATE_TABLE,ur as SHAPE_POKE_CURSOR_TABLE,gi as ShapeDiffCache,yi as ShardRunner,nl as TransactionHeadroomTracker,mt as UNVOUCHABLE_DEP,Re as advanceClientWatermark,Kr as aggUpsertSql,c as aggregateSqlFunction,f as aggregateTableName,Le as allocateCommitSeq,O as appendAuditEntry,Q as appendCdcChange,io as appendStreamChunk,Y as applyCdcChanges,Ft as applyOnDelete,Da as applySelect,ue as archiveCdcSegment,_a as armRestore,Lt as assertFlatPredicate,k as assertNoExplicitUndefined,Ui as assertReadonly,Dt as assertShapeShardable,N as assertValidClientId,Vi as awaitWsDrain,v as backfillAggregateIndexes,w as backfillRankIndexes,K as backfillSearchIndexes,X as backfillSearchIndexesForTable,Ki as bigintSqlKey,vo as boundingBoxCenter,wo as boundingBoxGeohashes,ft as buildIndexRange,Li as buildPokeFrames,ri as buildReprojectionMigration,Oa as buildSeekBeforeWhere,Pa as buildSeekWhere,hi as buildSettings,Ri as buildShapeDiff,j as bumpCdcEpoch,fe as cdcArchiveRewound,J as cdcCanVouchFor,Z as cdcForkedError,$ as cdcSeqLeavingRows,ee as cdcTouchesTables,re as cdcTrimmedError,lo as claimStreamRun,wt as clampPromotionThresholds,ha as clearCapturedMail,ze as clearMemoryTables,va as clearQueueMessages,E as coerceAggregateNumber,oe as compactCdcDocs,ul as compileWhereSql,je as computeRankPage,Ot as containsRelationPredicate,oi as countLegacyRows,Ko as coveringGeohashes,Me as createCompanionSync,Mr as createDependencyTracker,ra as createFanoutCounters,oa as createGlobalPollCounters,Xr as createIndexSql,pt as createReadFootprint,Yt as createRelayLink,Jt as createReplicaLink,_i as createShapeDiffCache,aa as createShapeProbeCounters,B as createShardCtxDb,ol as createSystemReader,ae as cursorBelowRetainedFloor,xo as decideDurableAttach,Xi as decodeBigintSqlKey,Ma as decodeCursor,Hi as decodeFloat64SqlKey,er as deferScheduleOutbox,ke as deleteGlobalShapeSnapshot,Ne as deleteGlobalShapeSnapshotsForConnection,fr as deleteShapePokeCursor,Er as deleteShapePokeCursorsForConnection,no as deleteStreamRun,yr as depKey,gt as deriveRelationEdges,go as diffExternalSource,Di as diffGlobalMembership,kt as distinctValues,h as encodeAggregateKey,ya as encodeCursor,Xo as encodeGeohash,Va as encodePartitionKey,Oi as encodeRowsPatch,P as ensureAuditTable,xa as ensureMailTable,Co as envOptionalPositiveInt,Ro as envPositiveInt,Fa as equalityPinnedFields,o as exportShardRows,ta as facetColumn,Nt as fanOutScalarCounts,_t as findRelated,ia as findStorageReferences,so as finishStreamRun,Wi as float64SqlKey,x as foldAggregateTally,rr as forgetScheduleOutbox,Zt as gateReplicaDispatch,Hr as geoTableName,Ii as globalShapeReadKey,si as guardWriter,$t as handleReplicaControl,dl as hasTrigger,Ho as haversineMeters,a as importShardRows,Et as indexKeysForRow,xi as isDevEnvironment,Wr as isFtsAvailable,wa as isLossyBody,Ve as isMemoryTable,Pt as isRelationPredicate,ko as isSoftDeleted,No as isSourceDue,zr as jsonPath,Vr as jsonPathSql,ht as keysTouchRanges,Io as liftSourceId,Gi as lintReadonlySql,it as listReactorStates,la as listTables,fl as literalInList,St as markUnvouchableReads,Qa as matchesRankStaticWhere,m as matchesStaticWhere,Oo as materializeExternalRows,Po as materializeExternalRowsIncremental,Qe as memoryTableNames,Zi as mergeChangedKeys,A as mergeWhere,te as migrateCdcLog,ie as migrateCdcMeta,Ae as migrateClientWatermark,De as migrateCommitSeq,co as migrateDurableStreams,Be as migrateGlobalShapeSnapshot,we as migrateIdempotency,lt as migrateReactorState,or as migrateScheduleOutbox,cr as migrateSearchState,hr as migrateShapePokeCursor,le as minCdcReplayableSeq,ne as minCdcSeq,xr as minShapePokeCursor,Kt as nextPromotionState,p as normalizeCountArgument,U as normalizeIdStructurally,ka as normalizeOrderKeys,bo as normalizeSourceDocument,Lo as normalizeSourceValue,eo as param,ar as parkScheduleOutbox,t as parseExportShardArgs,i as parseImportShardArgs,g as planAggregateLookup,Wo as pointInBoundingBox,tr as probeScheduleOutbox,Pi as projectColumns,Bo as pullExternalSourceIncrementalTick,Uo as pullExternalSourceTick,Qr as qualifiedJsonPath,Yr as qualifiedJsonPathSql,Al as quoteIdentifier,Ya as rankKeyFromDoc,ja as rankPivotConditionSql,Ja as rankTableName,ot as reactiveCacheKey,nt as reactorNeedsRun,T as readAggregateValue,Ee as readArchivedCdcChanges,M as readAuditLog,Ia as readBookmark,Ta as readCapturedMail,he as readCdcArchivedThrough,se as readCdcChangeKeys,de as readCdcChanges,ce as readCdcCursor,me as readCdcEpoch,ge as readClientWatermark,Oe as readCommitSeq,Ti as readDeployInfo,ir as readDueScheduleOutbox,Mo as readExternalSourceBaseline,Ue as readGlobalShapeSnapshot,Ke as readIdempotent,Lr as readMigrationStatus,Ka as readQueueMessageById,Xa as readQueueMessages,st as readReactorState,mi as readSchemaHistory,pi as readSchemaVersion,mr as readSearchBackfillState,Tr as readShapePokeCursor,mo as readStreamChunks,po as readStreamRun,na as readTablePage,Ca as recordCapturedMail,$i as recordChangedKeys,sa as recordFanoutPass,da as recordGlobalPollPass,Ha as recordQueueMessages,lr as recordScheduleOutbox,Si as recordSchemaVersion,ca as recordShapeProbePass,Bt as relationHooks,Xt as relayCountFor,ro as renderSql,ai as reprojectableFields,Cl as reprojectionMigrationId,ti as reprojectionTables,Za as resolveRankPartition,Je as resolveRankSeekTuple,Mt as resolveRelationPredicates,Ut as resolveWith,jr as rowToDocument,Dr as runDataMigration,Nr as runDrizzle,yo as runExternalSourceTick,qi as runReadonlySql,Gt as runRowValidators,_l as runShardMigrations,ki as runSocketPool,Br as runSql,cl as runTriggers,pl as selectExpiredIds,l as selectExportTables,_ as selectIndexForAggregate,I as selectIndexForCount,b as selectIndexForGroupBy,ma as selectMatchingIds,gr as selectShapeMembers,_r as selectShapeRows,fi as serializeSqlValue,Ht as shapeRoutingKey,Na as softDeleteScope,$a as sortColumnName,oo as sqliteInList,bl as stableStringify,Dl as stableWireKey,G as stripReservedPatchFields,Qi as subscriptionFrames,Yi as subscriptionListDeltas,pa as summarizeFanoutTopics,Sa as summarizeSubscriptions,Jr as tableColumns,Fr as tableFromDepKey,S as throwingScheduler,Ba as tiebreakDirectionFor,pe as trimCdcChanges,Xe as trimIdempotent,nr as trimScheduleOutbox,So as trimStreamRuns,Zr as tryRowToDocument,ji as trySendFrame,ao as unionAll,Ua as uniqueIndexFields,n as validateImportRow,xe as writeCdcArchivedThrough,Ge as writeGlobalShapeSnapshot,He as writeIdempotent,dt as writeReactorState,pr as writeSearchBackfillState,Cr as writeShapePokeCursor,Rr as writeShapePokeCursors,el as writeTouchesMemo};
1
+ import{exportShardRows as o,importShardRows as a,parseExportShardArgs as t,parseImportShardArgs as n,selectExportTables as s,validateImportRow as i}from"./packem_shared/exportShardRows-DmFKSzLZ.mjs";import{AGGREGATE_SQL_FUNCTION as d,aggregateSqlFunction as c,matchesStaticWhere as m,normalizeCountArgument as p,throwingScheduler as S}from"./packem_shared/AGGREGATE_SQL_FUNCTION-DDEoMnJR.mjs";import{aggregateTableName as f,coerceAggregateNumber as E,encodeAggregateKey as x,foldAggregateTally as h,readAggregateValue as T}from"./packem_shared/aggregateTableName-C7o-gpms.mjs";import{CountRlsUnsupportedError as R,mergeWhere as A,planAggregateLookup as g,selectIndexForAggregate as _,selectIndexForCount as I,selectIndexForGroupBy as b}from"./packem_shared/CountRlsUnsupportedError-BvsDqfO2.mjs";import{AUDIT_LOG_TABLE as D,appendAuditEntry as P,ensureAuditTable as O,readAuditLog as M}from"./packem_shared/AUDIT_LOG_TABLE-CEdsC6vT.mjs";import{NotUniqueError as F,assertNoExplicitUndefined as k,assertValidClientId as N,createShardCtxDb as B,normalizeIdStructurally as U,stripReservedPatchFields as G}from"./packem_shared/NotUniqueError-D0LwVtXI.mjs";import{backfillAggregateIndexes as w,backfillRankIndexes as K,backfillSearchIndexes as v,backfillSearchIndexesForTable as X}from"./packem_shared/backfillAggregateIndexes-D-S4qiCu.mjs";import{CDC_LOG_TABLE as H,CDC_LOG_TABLE_SEQ_INDEX as V,CDC_META_TABLE as z,appendCdcChange as Q,applyCdcChanges as Y,bumpCdcEpoch as j,cdcCanVouchFor as J,cdcForkedError as Z,cdcSeqLeavingRows as $,cdcTouchesTables as ee,cdcTrimmedError as re,compactCdcDocs as oe,cursorBelowRetainedFloor as ae,migrateCdcLog as te,migrateCdcMeta as ne,minCdcReplayableSeq as se,minCdcSeq as ie,readCdcChangeKeys as le,readCdcChanges as de,readCdcCursor as ce,readCdcEpoch as me,trimCdcChanges as pe}from"./packem_shared/CDC_LOG_TABLE-BFbP2eiJ.mjs";import{archiveCdcSegment as ue,cdcArchiveRewound as fe,readArchivedCdcChanges as Ee,readCdcArchivedThrough as xe,writeCdcArchivedThrough as he}from"./packem_shared/archiveCdcSegment-C7taIEpg.mjs";import{CLIENT_WATERMARK_TABLE as Ce,advanceClientWatermark as Re,migrateClientWatermark as Ae,readClientWatermark as ge}from"./packem_shared/CLIENT_WATERMARK_TABLE-BdKYbah0.mjs";import{COMMIT_SEQ_FIELD as Ie,COMMIT_SEQ_TABLE as be,allocateCommitSeq as Le,migrateCommitSeq as De,readCommitSeq as Pe}from"./packem_shared/COMMIT_SEQ_FIELD-D6uMUaiR.mjs";import{createCompanionSync as Me}from"./packem_shared/createCompanionSync-BwWcSwvy.mjs";import{GLOBAL_SHAPE_SNAPSHOT_TABLE as Fe,deleteGlobalShapeSnapshot as ke,deleteGlobalShapeSnapshotsForConnection as Ne,migrateGlobalShapeSnapshot as Be,readGlobalShapeSnapshot as Ue,writeGlobalShapeSnapshot as Ge}from"./packem_shared/GLOBAL_SHAPE_SNAPSHOT_TABLE-wWaEWj5f.mjs";import{IDEMPOTENCY_TABLE as we,migrateIdempotency as Ke,readIdempotent as ve,trimIdempotent as Xe,writeIdempotent as We}from"./packem_shared/IDEMPOTENCY_TABLE-DKrXVEUe.mjs";import{clearMemoryTables as Ve,isMemoryTable as ze,memoryTableNames as Qe}from"./packem_shared/clearMemoryTables-C5Wivufe.mjs";import{computeRankPage as je,resolveRankSeekTuple as Je}from"./packem_shared/computeRankPage-CQewnemg.mjs";import{SCHEDULE_OUTBOX_TABLE as $e,deferScheduleOutbox as er,forgetScheduleOutbox as rr,migrateScheduleOutbox as or,parkScheduleOutbox as ar,probeScheduleOutbox as tr,readDueScheduleOutbox as nr,recordScheduleOutbox as sr,trimScheduleOutbox as ir}from"./packem_shared/SCHEDULE_OUTBOX_TABLE-BHpxtEy4.mjs";import{S as dr,m as cr,r as mr,w as pr}from"./packem_shared/ctx-db-search-state-fIiMVPXO.mjs";import{SHAPE_POKE_CURSOR_TABLE as ur,deleteShapePokeCursor as fr,deleteShapePokeCursorsForConnection as Er,migrateShapePokeCursor as xr,minShapePokeCursor as hr,readShapePokeCursor as Tr,writeShapePokeCursor as Cr,writeShapePokeCursors as Rr}from"./packem_shared/SHAPE_POKE_CURSOR_TABLE-Bbpou9XZ.mjs";import{selectShapeMembers as gr,selectShapeRows as _r}from"./packem_shared/selectShapeMembers-Cp98I-ot.mjs";import{DATA_MIGRATION_STATE_TABLE as br,readMigrationStatus as Lr,runDataMigration as Dr}from"./packem_shared/DATA_MIGRATION_STATE_TABLE-BbDr6pc7.mjs";import{SCAN_DEP as Or,createDependencyTracker as Mr,depKey as yr,tableFromDepKey as Fr}from"./packem_shared/SCAN_DEP-D7qE3iUe.mjs";import{runDrizzle as Nr,runSql as Br}from"./packem_shared/runDrizzle-CfKnGpV2.mjs";import{A as Gr,a as qr,b as wr,D as Kr,c as vr,d as Xr,g as Wr,i as Hr,j as Vr,e as zr,q as Qr,f as Yr,r as jr,t as Jr,h as Zr}from"./packem_shared/do-sql-BSoH-O04.mjs";import{param as eo,renderSql as ro,sqliteInList as oo,unionAll as ao}from"./packem_shared/param-DlozcSQu.mjs";import{appendStreamChunk as no,claimStreamRun as so,deleteStreamRun as io,finishStreamRun as lo,migrateDurableStreams as co,readStreamChunks as mo,readStreamRun as po,trimStreamRuns as So}from"./packem_shared/appendStreamChunk-pPeR5nbF.mjs";import{DurableStreamRunner as fo,MAX_DURABLE_STREAM_BYTES as Eo,MAX_DURABLE_STREAM_CHUNKS as xo,decideDurableAttach as ho}from"./packem_shared/DurableStreamRunner-Cliu09-j.mjs";import{envOptionalPositiveInt as Co,envPositiveInt as Ro}from"./packem_shared/envOptionalPositiveInt-D2pY-c64.mjs";import{diffExternalSource as go}from"./packem_shared/diffExternalSource-DgDJhslq.mjs";import{liftSourceId as Io,normalizeSourceDocument as bo,normalizeSourceValue as Lo}from"./packem_shared/liftSourceId-CA3ENhXj.mjs";import{materializeExternalRows as Po,materializeExternalRowsIncremental as Oo,readExternalSourceBaseline as Mo,runExternalSourceTick as yo}from"./packem_shared/materializeExternalRows-j_8glxcE.mjs";import{isSoftDeleted as ko,isSourceDue as No,pullExternalSourceIncrementalTick as Bo,pullExternalSourceTick as Uo}from"./packem_shared/isSoftDeleted-CCDHCtX3.mjs";import{f as qo,a as wo,b as Ko,c as vo,d as Xo,g as Wo}from"./packem_shared/fts-companion-B7jllLhZ.mjs";import{GEO_DEFAULT_PRECISION as Vo,boundingBoxCenter as zo,boundingBoxGeohashes as Qo,coveringGeohashes as Yo,encodeGeohash as jo,haversineMeters as Jo,pointInBoundingBox as Zo}from"./packem_shared/GEO_DEFAULT_PRECISION-CqpQZ-J_.mjs";import{default as ea}from"./packem_shared/GlobalPollTick-BNK4o-XT.mjs";import{ADMIN_FUNCTIONS as oa,ADMIN_FUNCTION_PREFIX as aa,DEFAULT_FANOUT_TOPIC_LIMIT as ta,FLAGS_FUNCTION_PREFIX as na,MAX_PAGE_SIZE as sa,RELATION_FUNCTION_PREFIX as ia,createFanoutCounters as la,createGlobalPollCounters as da,createShapeProbeCounters as ca,facetColumn as ma,findStorageReferences as pa,listTables as Sa,readTablePage as ua,recordFanoutPass as fa,recordGlobalPollPass as Ea,recordShapeProbePass as xa,selectMatchingIds as ha,summarizeFanoutTopics as Ta,summarizeSubscriptions as Ca}from"./packem_shared/ADMIN_FUNCTIONS-BdZ3gTHm.mjs";import{MAIL_RETENTION as Aa,MAIL_TABLE as ga,clearCapturedMail as _a,ensureMailTable as Ia,readCapturedMail as ba,recordCapturedMail as La}from"./packem_shared/MAIL_RETENTION-DXpGFjOt.mjs";import{NotFoundError as Pa}from"./packem_shared/NotFoundError-BhF7FeFr.mjs";import{armRestore as Ma,readBookmark as ya}from"./packem_shared/armRestore-Bu1_8SUa.mjs";import{CURSOR_PREFIX as ka,applySelect as Na,buildSeekBeforeWhere as Ba,buildSeekWhere as Ua,decodeCursor as Ga,encodeCursor as qa,equalityPinnedFields as wa,normalizeOrderKeys as Ka,softDeleteScope as va,tiebreakDirectionFor as Xa,uniqueIndexFields as Wa}from"./packem_shared/CURSOR_PREFIX-Bn8SFoGd.mjs";import{QUEUE_TABLE as Va,clearQueueMessages as za,isLossyBody as Qa,readQueueMessageById as Ya,readQueueMessages as ja,recordQueueMessages as Ja}from"./packem_shared/QUEUE_TABLE-D-cL1NPj.mjs";import{RANK_TIEBREAK as $a,encodePartitionKey as et,matchesRankStaticWhere as rt,rankKeyFromDoc as ot,rankPivotConditionSql as at,rankTableName as tt,resolveRankPartition as nt,sortColumnName as st}from"./packem_shared/RANK_TIEBREAK-D5xNdzB3.mjs";import{ReactiveCache as lt,reactiveCacheKey as dt}from"./packem_shared/ReactiveCache-CU_NoCMR.mjs";import{REACTOR_STATE_TABLE as mt,listReactorStates as pt,migrateReactorState as St,reactorNeedsRun as ut,readReactorState as ft,writeReactorState as Et}from"./packem_shared/REACTOR_STATE_TABLE-CBHASjH9.mjs";import{UNVOUCHABLE_DEP as ht,createReadFootprint as Tt,markUnvouchableReads as Ct}from"./packem_shared/UNVOUCHABLE_DEP-C68htACn.mjs";import{buildIndexRange as At,indexKeysForRow as gt,keysTouchRanges as _t}from"./packem_shared/buildIndexRange-DvN8Qj8e.mjs";import{RELATED_DEFAULT_LIMIT as bt,RELATED_DEPTH_DECAY as Lt,RELATED_MAX_DEPTH as Dt,RELATED_MAX_LIMIT as Pt,deriveRelationEdges as Ot,findRelated as Mt}from"./packem_shared/RELATED_DEFAULT_LIMIT-B9PH28Pn.mjs";import{DEFAULT_MAX_RELATION_KEYS as Ft,assertFlatPredicate as kt,assertShapeShardable as Nt,containsRelationPredicate as Bt,isRelationPredicate as Ut,resolveRelationPredicates as Gt}from"./packem_shared/DEFAULT_MAX_RELATION_KEYS-BfAQvZT8.mjs";import{applyOnDelete as wt,distinctValues as Kt,fanOutScalarCounts as vt,relationHooks as Xt,resolveWith as Wt,runRowValidators as Ht}from"./packem_shared/applyOnDelete-7JZ4vR9r.mjs";import{DEFAULT_PROMOTION_THRESHOLDS as zt,clampPromotionThresholds as Qt,nextPromotionState as Yt,relayCountFor as jt,shapeRoutingKey as Jt}from"./packem_shared/DEFAULT_PROMOTION_THRESHOLDS-Bfx7KakS.mjs";import{DEFAULT_MAX_RELAYS as $t,OwnerRelay as en,RelayMember as rn,createRelayLink as on}from"./packem_shared/DEFAULT_MAX_RELAYS-DG9iXjzF.mjs";import{createReplicaLink as tn,gateReplicaDispatch as nn,handleReplicaControl as sn}from"./packem_shared/createReplicaLink-CTyOjpjh.mjs";import{buildReprojectionMigration as dn,countLegacyRows as cn,reprojectableFields as mn,reprojectionTables as pn}from"./packem_shared/buildReprojectionMigration-DDZhSO95.mjs";import{RLS_UNWRAP_SYMBOL as un,RlsRequiredError as fn,guardWriter as En}from"./packem_shared/RLS_UNWRAP_SYMBOL-BwwTbz3Q.mjs";import{SCHEMA_HISTORY_MAX_VERSIONS as hn,readSchemaHistory as Tn,readSchemaVersion as Cn,recordSchemaVersion as Rn}from"./packem_shared/SCHEMA_HISTORY_MAX_VERSIONS-CXznJRUG.mjs";import{serializeSqlValue as gn}from"./packem_shared/serializeSqlValue-BEMMYX1n.mjs";import{buildSettings as In,isDevEnvironment as bn,readDeployInfo as Ln}from"./packem_shared/buildSettings-DC3VeQ0H.mjs";import{buildShapeDiff as Pn}from"./packem_shared/buildShapeDiff-Bd5nLaY8.mjs";import{ShapeDiffCache as Mn,createShapeDiffCache as yn,globalShapeReadKey as Fn}from"./packem_shared/ShapeDiffCache-gdaILV5E.mjs";import{buildPokeFrames as Nn,diffGlobalMembership as Bn,encodeRowsPatch as Un,projectColumns as Gn}from"./packem_shared/buildPokeFrames-BBE6J91z.mjs";import{ShardRunner as wn}from"./packem_shared/ShardRunner-CrveaPId.mjs";import{runSocketPool as vn}from"./packem_shared/runSocketPool-CZJ2X9cF.mjs";import{MAX_SQL_ROWS as Wn,assertReadonly as Hn,lintReadonlySql as Vn,runReadonlySql as zn}from"./packem_shared/MAX_SQL_ROWS-Dh_Ty0Zo.mjs";import{B as Yn,b as jn,d as Jn,a as Zn,f as $n}from"./packem_shared/sql-projection-D3qdaItY.mjs";import{awaitWsDrain as rs,subscriptionFrames as os,subscriptionListDeltas as as,trySendFrame as ts}from"./packem_shared/awaitWsDrain-apizgmKY.mjs";import{mergeChangedKeys as ss,recordChangedKeys as is,writeTouchesMemo as ls}from"./packem_shared/mergeChangedKeys-BA3YxaLE.mjs";import{createSystemReader as cs}from"./packem_shared/createSystemReader-DcDLFfC-.mjs";import{ConflictError as ps}from"./packem_shared/ConflictError-C8GtJmjS.mjs";import{DEFAULT_TRANSACTION_LIMITS as us,TransactionHeadroomTracker as fs}from"./packem_shared/DEFAULT_TRANSACTION_LIMITS-CTHQQgDC.mjs";import{hasTrigger as xs,runTriggers as hs}from"./packem_shared/hasTrigger-CjlwI4le.mjs";import{selectExpiredIds as Cs}from"./packem_shared/selectExpiredIds-Do1q2HQr.mjs";import{VECTOR_BACKFILL_MAX_PAGES as As,backfillVectorIndexes as gs}from"./packem_shared/VECTOR_BACKFILL_MAX_PAGES-C-KZJbgA.mjs";import{c as Is,l as bs}from"./packem_shared/where-sql-x1YKldcq.mjs";import{RELATION_EXISTS_KEY as Ds}from"./packem_shared/RELATION_EXISTS_KEY-CFUhnZSZ.mjs";import{REPROJECTION_MIGRATION_PREFIX as Os,reprojectionMigrationId as Ms}from"./packem_shared/REPROJECTION_MIGRATION_PREFIX-Czcb6_mO.mjs";import{quoteIdentifier as Fs}from"./packem_shared/quoteIdentifier-CObIFRhb.mjs";import{runShardMigrations as Ns}from"./packem_shared/runShardMigrations-o-qjyKt5.mjs";import{stableStringify as Us}from"./packem_shared/stableStringify-DibjylKD.mjs";import{stableWireKey as qs}from"./packem_shared/stableWireKey-D2US4k_J.mjs";export{oa as ADMIN_FUNCTIONS,aa as ADMIN_FUNCTION_PREFIX,d as AGGREGATE_SQL_FUNCTION,Gr as AGG_COUNT,qr as AGG_KEY,wr as AGG_VALUE,D as AUDIT_LOG_TABLE,Yn as BIGINT_KEY_DIGITS,H as CDC_LOG_TABLE,V as CDC_LOG_TABLE_SEQ_INDEX,z as CDC_META_TABLE,Ce as CLIENT_WATERMARK_TABLE,Ie as COMMIT_SEQ_FIELD,be as COMMIT_SEQ_TABLE,ka as CURSOR_PREFIX,ps as ConflictError,R as CountRlsUnsupportedError,br as DATA_MIGRATION_STATE_TABLE,ta as DEFAULT_FANOUT_TOPIC_LIMIT,Ft as DEFAULT_MAX_RELATION_KEYS,$t as DEFAULT_MAX_RELAYS,zt as DEFAULT_PROMOTION_THRESHOLDS,us as DEFAULT_TRANSACTION_LIMITS,Kr as DOC_COLUMN,fo as DurableStreamRunner,na as FLAGS_FUNCTION_PREFIX,Vo as GEO_DEFAULT_PRECISION,Fe as GLOBAL_SHAPE_SNAPSHOT_TABLE,ea as GlobalPollTick,we as IDEMPOTENCY_TABLE,Aa as MAIL_RETENTION,ga as MAIL_TABLE,Eo as MAX_DURABLE_STREAM_BYTES,xo as MAX_DURABLE_STREAM_CHUNKS,sa as MAX_PAGE_SIZE,Wn as MAX_SQL_ROWS,Pa as NotFoundError,F as NotUniqueError,en as OwnerRelay,Va as QUEUE_TABLE,$a as RANK_TIEBREAK,mt as REACTOR_STATE_TABLE,bt as RELATED_DEFAULT_LIMIT,Lt as RELATED_DEPTH_DECAY,Dt as RELATED_MAX_DEPTH,Pt as RELATED_MAX_LIMIT,Ds as RELATION_EXISTS_KEY,ia as RELATION_FUNCTION_PREFIX,Os as REPROJECTION_MIGRATION_PREFIX,un as RLS_UNWRAP_SYMBOL,lt as ReactiveCache,rn as RelayMember,fn as RlsRequiredError,Or as SCAN_DEP,$e as SCHEDULE_OUTBOX_TABLE,hn as SCHEMA_HISTORY_MAX_VERSIONS,dr as SEARCH_STATE_TABLE,ur as SHAPE_POKE_CURSOR_TABLE,Mn as ShapeDiffCache,wn as ShardRunner,fs as TransactionHeadroomTracker,ht as UNVOUCHABLE_DEP,As as VECTOR_BACKFILL_MAX_PAGES,Re as advanceClientWatermark,vr as aggUpsertSql,c as aggregateSqlFunction,f as aggregateTableName,Le as allocateCommitSeq,P as appendAuditEntry,Q as appendCdcChange,no as appendStreamChunk,Y as applyCdcChanges,wt as applyOnDelete,Na as applySelect,ue as archiveCdcSegment,Ma as armRestore,kt as assertFlatPredicate,k as assertNoExplicitUndefined,Hn as assertReadonly,Nt as assertShapeShardable,N as assertValidClientId,rs as awaitWsDrain,w as backfillAggregateIndexes,K as backfillRankIndexes,v as backfillSearchIndexes,X as backfillSearchIndexesForTable,gs as backfillVectorIndexes,jn as bigintSqlKey,zo as boundingBoxCenter,Qo as boundingBoxGeohashes,At as buildIndexRange,Nn as buildPokeFrames,dn as buildReprojectionMigration,Ba as buildSeekBeforeWhere,Ua as buildSeekWhere,In as buildSettings,Pn as buildShapeDiff,j as bumpCdcEpoch,fe as cdcArchiveRewound,J as cdcCanVouchFor,Z as cdcForkedError,$ as cdcSeqLeavingRows,ee as cdcTouchesTables,re as cdcTrimmedError,so as claimStreamRun,Qt as clampPromotionThresholds,_a as clearCapturedMail,Ve as clearMemoryTables,za as clearQueueMessages,E as coerceAggregateNumber,oe as compactCdcDocs,Is as compileWhereSql,je as computeRankPage,Bt as containsRelationPredicate,cn as countLegacyRows,Yo as coveringGeohashes,Me as createCompanionSync,Mr as createDependencyTracker,la as createFanoutCounters,da as createGlobalPollCounters,Xr as createIndexSql,Tt as createReadFootprint,on as createRelayLink,tn as createReplicaLink,yn as createShapeDiffCache,ca as createShapeProbeCounters,B as createShardCtxDb,cs as createSystemReader,ae as cursorBelowRetainedFloor,ho as decideDurableAttach,Jn as decodeBigintSqlKey,Ga as decodeCursor,Zn as decodeFloat64SqlKey,er as deferScheduleOutbox,ke as deleteGlobalShapeSnapshot,Ne as deleteGlobalShapeSnapshotsForConnection,fr as deleteShapePokeCursor,Er as deleteShapePokeCursorsForConnection,io as deleteStreamRun,yr as depKey,Ot as deriveRelationEdges,go as diffExternalSource,Bn as diffGlobalMembership,Kt as distinctValues,x as encodeAggregateKey,qa as encodeCursor,jo as encodeGeohash,et as encodePartitionKey,Un as encodeRowsPatch,O as ensureAuditTable,Ia as ensureMailTable,Co as envOptionalPositiveInt,Ro as envPositiveInt,wa as equalityPinnedFields,o as exportShardRows,ma as facetColumn,vt as fanOutScalarCounts,Mt as findRelated,pa as findStorageReferences,lo as finishStreamRun,$n as float64SqlKey,h as foldAggregateTally,rr as forgetScheduleOutbox,qo as ftsCompanionDdl,wo as ftsPurgeDocument,Ko as ftsRowidMapName,vo as ftsUnmappedPage,Xo as ftsWriteDocument,nn as gateReplicaDispatch,Wr as geoTableName,Fn as globalShapeReadKey,Wo as groupUnmappedRows,En as guardWriter,sn as handleReplicaControl,xs as hasTrigger,Jo as haversineMeters,a as importShardRows,gt as indexKeysForRow,bn as isDevEnvironment,Hr as isFtsAvailable,Qa as isLossyBody,ze as isMemoryTable,Ut as isRelationPredicate,ko as isSoftDeleted,No as isSourceDue,Vr as jsonPath,zr as jsonPathSql,_t as keysTouchRanges,Io as liftSourceId,Vn as lintReadonlySql,pt as listReactorStates,Sa as listTables,bs as literalInList,Ct as markUnvouchableReads,rt as matchesRankStaticWhere,m as matchesStaticWhere,Po as materializeExternalRows,Oo as materializeExternalRowsIncremental,Qe as memoryTableNames,ss as mergeChangedKeys,A as mergeWhere,te as migrateCdcLog,ne as migrateCdcMeta,Ae as migrateClientWatermark,De as migrateCommitSeq,co as migrateDurableStreams,Be as migrateGlobalShapeSnapshot,Ke as migrateIdempotency,St as migrateReactorState,or as migrateScheduleOutbox,cr as migrateSearchState,xr as migrateShapePokeCursor,se as minCdcReplayableSeq,ie as minCdcSeq,hr as minShapePokeCursor,Yt as nextPromotionState,p as normalizeCountArgument,U as normalizeIdStructurally,Ka as normalizeOrderKeys,bo as normalizeSourceDocument,Lo as normalizeSourceValue,eo as param,ar as parkScheduleOutbox,t as parseExportShardArgs,n as parseImportShardArgs,g as planAggregateLookup,Zo as pointInBoundingBox,tr as probeScheduleOutbox,Gn as projectColumns,Bo as pullExternalSourceIncrementalTick,Uo as pullExternalSourceTick,Qr as qualifiedJsonPath,Yr as qualifiedJsonPathSql,Fs as quoteIdentifier,ot as rankKeyFromDoc,at as rankPivotConditionSql,tt as rankTableName,dt as reactiveCacheKey,ut as reactorNeedsRun,T as readAggregateValue,Ee as readArchivedCdcChanges,M as readAuditLog,ya as readBookmark,ba as readCapturedMail,xe as readCdcArchivedThrough,le as readCdcChangeKeys,de as readCdcChanges,ce as readCdcCursor,me as readCdcEpoch,ge as readClientWatermark,Pe as readCommitSeq,Ln as readDeployInfo,nr as readDueScheduleOutbox,Mo as readExternalSourceBaseline,Ue as readGlobalShapeSnapshot,ve as readIdempotent,Lr as readMigrationStatus,Ya as readQueueMessageById,ja as readQueueMessages,ft as readReactorState,Tn as readSchemaHistory,Cn as readSchemaVersion,mr as readSearchBackfillState,Tr as readShapePokeCursor,mo as readStreamChunks,po as readStreamRun,ua as readTablePage,La as recordCapturedMail,is as recordChangedKeys,fa as recordFanoutPass,Ea as recordGlobalPollPass,Ja as recordQueueMessages,sr as recordScheduleOutbox,Rn as recordSchemaVersion,xa as recordShapeProbePass,Xt as relationHooks,jt as relayCountFor,ro as renderSql,mn as reprojectableFields,Ms as reprojectionMigrationId,pn as reprojectionTables,nt as resolveRankPartition,Je as resolveRankSeekTuple,Gt as resolveRelationPredicates,Wt as resolveWith,jr as rowToDocument,Dr as runDataMigration,Nr as runDrizzle,yo as runExternalSourceTick,zn as runReadonlySql,Ht as runRowValidators,Ns as runShardMigrations,vn as runSocketPool,Br as runSql,hs as runTriggers,Cs as selectExpiredIds,s as selectExportTables,_ as selectIndexForAggregate,I as selectIndexForCount,b as selectIndexForGroupBy,ha as selectMatchingIds,gr as selectShapeMembers,_r as selectShapeRows,gn as serializeSqlValue,Jt as shapeRoutingKey,va as softDeleteScope,st as sortColumnName,oo as sqliteInList,Us as stableStringify,qs as stableWireKey,G as stripReservedPatchFields,os as subscriptionFrames,as as subscriptionListDeltas,Ta as summarizeFanoutTopics,Ca as summarizeSubscriptions,Jr as tableColumns,Fr as tableFromDepKey,S as throwingScheduler,Xa as tiebreakDirectionFor,pe as trimCdcChanges,Xe as trimIdempotent,ir as trimScheduleOutbox,So as trimStreamRuns,Zr as tryRowToDocument,ts as trySendFrame,ao as unionAll,Wa as uniqueIndexFields,i as validateImportRow,he as writeCdcArchivedThrough,Ge as writeGlobalShapeSnapshot,We as writeIdempotent,Et as writeReactorState,pr as writeSearchBackfillState,Cr as writeShapePokeCursor,Rr as writeShapePokeCursors,ls as writeTouchesMemo};
@@ -0,0 +1 @@
1
+ import{LunoraError as I}from"@lunora/errors";import{m as x,n as y}from"./do-sql-BSoH-O04.mjs";import{quoteIdentifier as d}from"./quoteIdentifier-CObIFRhb.mjs";import{d as L}from"./wire-codec-C-FpWm52.mjs";const te="__lunora_admin__:",re="__lunora_relation__:",ne="__lunora_flags__:",se={applyCdc:"__lunora_admin__:applyCdc",aiAvailable:"__lunora_admin__:aiAvailable",aiChartConfig:"__lunora_admin__:aiChartConfig",aiGenerateSql:"__lunora_admin__:aiGenerateSql",aiTableFilter:"__lunora_admin__:aiTableFilter",assignIssue:"__lunora_admin__:assignIssue",backfillSearch:"__lunora_admin__:backfillSearch",backfillVectors:"__lunora_admin__:backfillVectors",backRelationCounts:"__lunora_admin__:backRelationCounts",cdcSync:"__lunora_admin__:cdcSync",clearCapturedMail:"__lunora_admin__:clearCapturedMail",clearQueueMessages:"__lunora_admin__:clearQueueMessages",clearTable:"__lunora_admin__:clearTable",createWorkflowInstance:"__lunora_admin__:createWorkflowInstance",deleteRows:"__lunora_admin__:deleteRows",describeTable:"__lunora_admin__:describeTable",describeTables:"__lunora_admin__:describeTables",explainIssue:"__lunora_admin__:explainIssue",exportShard:"__lunora_admin__:exportShard",facetColumn:"__lunora_admin__:facetColumn",findRelated:"__lunora_admin__:findRelated",getAdvisories:"__lunora_admin__:getAdvisories",getAdvisorProcedures:"__lunora_admin__:getAdvisorProcedures",getAuditLog:"__lunora_admin__:getAuditLog",getAuthMetrics:"__lunora_admin__:getAuthMetrics",getCapturedMail:"__lunora_admin__:getCapturedMail",getFanoutMetrics:"__lunora_admin__:getFanoutMetrics",getFunctionStats:"__lunora_admin__:getFunctionStats",getIssues:"__lunora_admin__:getIssues",getMetricHistory:"__lunora_admin__:getMetricHistory",getMetricSeries:"__lunora_admin__:getMetricSeries",listSubscriptions:"__lunora_admin__:listSubscriptions",listTableIndexes:"__lunora_admin__:listTableIndexes",listTablesIndexes:"__lunora_admin__:listTablesIndexes",getLogs:"__lunora_admin__:getLogs",getMetrics:"__lunora_admin__:getMetrics",getPitrBookmark:"__lunora_admin__:getPitrBookmark",getQueryInsights:"__lunora_admin__:getQueryInsights",getQueueMessages:"__lunora_admin__:getQueueMessages",getRequestLog:"__lunora_admin__:getRequestLog",getSecurityAudit:"__lunora_admin__:getSecurityAudit",getSettings:"__lunora_admin__:getSettings",getTraces:"__lunora_admin__:getTraces",getWorkflowInstanceStatus:"__lunora_admin__:getWorkflowInstanceStatus",ignoreIssue:"__lunora_admin__:ignoreIssue",importShard:"__lunora_admin__:importShard",listFlags:"__lunora_admin__:listFlags",listReactors:"__lunora_admin__:listReactors",listQueues:"__lunora_admin__:listQueues",lintSql:"__lunora_admin__:lintSql",listTables:"__lunora_admin__:listTables",listWorkflows:"__lunora_admin__:listWorkflows",maskPolicies:"__lunora_admin__:maskPolicies",migrationStatus:"__lunora_admin__:migrationStatus",patchRows:"__lunora_admin__:patchRows",pitrRestore:"__lunora_admin__:pitrRestore",rankBefore:"__lunora_admin__:rankBefore",rankPage:"__lunora_admin__:rankPage",readTablePage:"__lunora_admin__:readTablePage",recordAuthEvent:"__lunora_admin__:recordAuthEvent",recordContainerEvent:"__lunora_admin__:recordContainerEvent",recordMail:"__lunora_admin__:recordMail",recordQueueMessage:"__lunora_admin__:recordQueueMessage",replayQueueMessage:"__lunora_admin__:replayQueueMessage",resolveIssue:"__lunora_admin__:resolveIssue",rlsPolicies:"__lunora_admin__:rlsPolicies",schemaHistory:"__lunora_admin__:schemaHistory",schemaVersion:"__lunora_admin__:schemaVersion",runAs:"__lunora_admin__:runAs",runMigration:"__lunora_admin__:runMigration",runSql:"__lunora_admin__:runSql",sendQueueMessage:"__lunora_admin__:sendQueueMessage",sendTestMail:"__lunora_admin__:sendTestMail",setIssueSeverity:"__lunora_admin__:setIssueSeverity",storageOrphans:"__lunora_admin__:storageOrphans",storageReferences:"__lunora_admin__:storageReferences",storageRules:"__lunora_admin__:storageRules",studioFeatures:"__lunora_admin__:studioFeatures",writeRow:"__lunora_admin__:writeRow"},D=50,h=500,U=30,j=200,f="__doc__",O=e=>{try{const t=JSON.parse(e);return t!==null&&typeof t=="object"&&!Array.isArray(t)?t:void 0}catch{return}},W=e=>{const{[y]:t,...r}=e;return t===void 0?r:t===null||typeof t!="object"||Array.isArray(t)?{[y]:t,...r}:{...r,...L(t)}},q=(e,t)=>{if(!e.includes(f))return{columns:e,rows:t};const r=[];for(const s of t){const o=s[f],i=typeof o=="string"?O(o):void 0;if(i===void 0)return{columns:e,rows:t};const c=Object.fromEntries(Object.entries(s).filter(([u])=>u!==f));r.push({...c,...W(i)})}const n=e.filter(s=>s!==f),a=[],_=new Set(n);for(const s of r)for(const o of Object.keys(s))_.has(o)||(_.add(o),a.push(o));return{columns:[...n,...a],rows:r}},N=e=>`instr(lower(CAST(${e} AS TEXT)), lower(?)) > 0`,E=e=>e.startsWith("sqlite_")||e.startsWith("_cf_")||e.startsWith("__miniflare")||e.startsWith("__lunora")||e.includes("__fts_"),C=(e,t,r)=>Math.min(Math.max(e,t),r),F=(e,t)=>{const r=e.exec(`SELECT COUNT(*) AS c FROM ${t}`).one();return Number(r.c)},ae=e=>{const t=e.exec("SELECT name FROM sqlite_master WHERE type = 'table' ORDER BY name").toArray(),r=[];for(const{name:n}of t)E(n)||r.push({name:n,rowCount:F(e,d(n))});return r},P=(e,t)=>e.exec("SELECT name FROM sqlite_master WHERE type = 'table' AND name = ? LIMIT 1",t).toArray().length>0,A=(e,t)=>{if(E(t)||!P(e,t))throw new I("UNKNOWN_TABLE",`unknown table: ${t}`,{status:404})},M=(e,t)=>e.exec(`PRAGMA table_info(${t})`).toArray().map(r=>r.name),Q={eq:"=",gt:">",gte:">=",lt:"<",lte:"<=",ne:"<>"},B=e=>typeof e=="string"?e:typeof e=="number"||typeof e=="boolean"?String(e):"",v=(e,t)=>{const r=t.includes(e),n=t.includes(f);if(!(!r&&!n))return r?{expression:d(e),params:[]}:{expression:`json_extract(${d(f)}, ?)`,params:[`$.${x(e)}`]}},G=(e,t)=>{const r=v(e.column,t);if(r===void 0)return;const{expression:n,params:a}=r;return e.operator==="contains"?{params:[...a,B(e.value)],sql:N(n)}:e.value===null&&(e.operator==="eq"||e.operator==="ne")?{params:a,sql:`${n} IS ${e.operator==="ne"?"NOT ":""}NULL`}:{params:[...a,e.value],sql:`${n} ${Q[e.operator]} ?`}},H=/^(\d{4})(?:-(\d{2}))?(?:-(\d{2}))?$/u,X=e=>{const t=H.exec(e.trim());if(t===null)return;const r=Number(t[1]),n=t[2]===void 0?void 0:Number(t[2]),a=t[3]===void 0?void 0:Number(t[3]);if(n!==void 0&&(n<1||n>12)||a!==void 0&&(a<1||a>31)||r<100)return;const _=Date.UTC(r,(n??1)-1,a??1);if(a!==void 0&&new Date(_).getUTCDate()!==a)return;let s;return a!==void 0?s=Date.UTC(r,(n??1)-1,a+1):n===void 0?s=Date.UTC(r+1,0,1):s=Date.UTC(r,n,1),{from:_,to:s}},R=(e,t,r)=>{const n=[],a=[];if(t!==""&&e.length>0){const _=e.map(o=>N(d(o)));a.push(...e.map(()=>t));const s=X(t);if(s!==void 0)for(const o of e)_.push(`(${d(o)} >= ? AND ${d(o)} < ?)`),a.push(s.from,s.to);n.push(`(${_.join(" OR ")})`)}for(const _ of r??[]){const s=G(_,e);s!==void 0&&(n.push(`(${s.sql})`),a.push(...s.params))}return n.length===0?void 0:{parameters:a,where:n.join(" AND ")}},Y=(e,t)=>{if(e===void 0)return;const r=v(e.column,t);if(r===void 0)return;const n=e.direction==="desc"?"DESC":"ASC";return{params:r.params,sql:`${r.expression} ${n}`}},oe=(e,t)=>{const{table:r}=t;A(e,r);const n=C(Math.trunc(t.limit??D),1,h),a=Math.max(0,Math.trunc(t.offset??0)),_=d(r),s=M(e,_),o=t.search?.trim()??"",i=S=>{if(t.refs===void 0)return S;const T={};for(const k of S.columns){const w=t.refs[k];w!==void 0&&(T[k]=w)}return Object.keys(T).length>0?{...S,refs:T}:S},c=R(s,o,t.filters),u=Y(t.orderBy,s),l=c===void 0?"":` WHERE ${c.where}`,m=u===void 0?"":` ORDER BY ${u.sql}`,p=c?.parameters??[],g=u?.params??[];let b;t.skipCount||(b=c===void 0?F(e,_):Number(e.exec(`SELECT COUNT(*) AS c FROM ${_}${l}`,...p).one().c));const $=e.exec(`SELECT * FROM ${_}${l}${m} LIMIT ? OFFSET ?`,...p,...g,n,a).toArray();return i({...q(s,$),sqlColumns:s,total:b})},_e=(e,t)=>{const{table:r}=t;A(e,r);const n=C(Math.trunc(t.limit??h),1,h),a=d(r),_=M(e,a),s=t.search?.trim()??"",o=R(_,s,t.filters),i=[],c=[];o!==void 0&&(i.push(o.where),c.push(...o.parameters)),t.after!==void 0&&(i.push("id > ?"),c.push(t.after));const u=i.length===0?"":` WHERE ${i.join(" AND ")}`,l=t.after===void 0?"":" ORDER BY id",m=e.exec(`SELECT id FROM ${a}${u}${l} LIMIT ?`,...c,n+1).toArray(),p=m.length>n,g=m.slice(0,n).map(b=>b.id);return{hasMore:p,ids:g}},K=(e,t,r)=>{const n=new Set(r.filter(_=>_!==f));if(!r.includes(f))return n;const a=e.exec(`SELECT ${d(f)} AS doc FROM ${t} LIMIT ?`,h).toArray();for(const{doc:_}of a){const s=typeof _=="string"?O(_):void 0;if(s!==void 0)for(const o of Object.keys(s))n.add(o)}return n},ie=(e,t)=>{const{column:r,table:n}=t;A(e,n);const a=d(n),_=M(e,a);if(!K(e,a,_).has(r))throw new I("UNKNOWN_COLUMN",`unknown column: ${r}`,{status:404});const s=v(r,_);if(s===void 0)throw new I("UNKNOWN_COLUMN",`unknown column: ${r}`,{status:404});const o=C(Math.trunc(t.limit??U),1,j),i=t.search?.trim()??"",c=R(_,i,t.filters),u=c===void 0?"":` WHERE ${c.where}`,l=c?.parameters??[],m=e.exec(`SELECT ${s.expression} AS value, COUNT(*) AS count FROM ${a}${u} GROUP BY ${s.expression} ORDER BY count DESC LIMIT ?`,...s.params,...l,...s.params,o+1).toArray();return{truncated:m.length>o,values:m.slice(0,o).map(g=>({count:Number(g.count),value:g.value}))}},ce=(e,t,r)=>{const n={},a=r.slice(0,h);for(const s of a)n[s]=[];if(a.length===0)return{references:n,storageColumns:t};const _=a.map(()=>"?").join(", ");for(const[s,o]of Object.entries(t)){if(E(s)||!P(e,s))continue;const i=d(s),c=M(e,i);for(const u of o){const l=v(u,c);if(l===void 0)continue;const m=e.exec(`SELECT id, ${l.expression} AS ref FROM ${i} WHERE ${l.expression} IN (${_})`,...l.params,...l.params,...a).toArray();for(const p of m)n[p.ref]?.push({column:u,id:p.id,table:s})}}return{references:n,storageColumns:t}},ue=e=>{const t=e.map((n,a)=>{const _=Object.values(n.subs??{}).map(s=>({args:s.args,functionPath:s.functionPath,table:s.table}));return{admin:n.admin===!0,id:a,subscriptions:_}}),r=t.reduce((n,a)=>n+a.subscriptions.length,0);return{connections:t,totalConnections:t.length,totalSubscriptions:r}},V=20,le=()=>({maxMs:0,passes:0,peakSocketsIterated:0,socketsDelivered:0,socketsIterated:0,totalMs:0}),de=()=>({run:0,served:0}),me=()=>({drains:0,pairsSkipped:0}),fe=(e,t,r)=>({drains:e.drains+t,pairsSkipped:e.pairsSkipped+r}),pe=(e,t,r)=>({run:e.run+t,served:e.served+r}),ge=(e,t,r,n)=>({maxMs:Math.max(e.maxMs,n),passes:e.passes+1,peakSocketsIterated:Math.max(e.peakSocketsIterated,t),socketsDelivered:e.socketsDelivered+r,socketsIterated:e.socketsIterated+t,totalMs:e.totalMs+n}),he=(e,t=V)=>{const r=new Map,n=new Map;for(const s of e){for(const o of Object.values(s.shapes??{})){const i=o.name??"(unknown shape)";r.set(i,(r.get(i)??0)+1)}for(const o of s.whispers??[])n.set(o,(n.get(o)??0)+1)}const a=[...[...r].map(([s,o])=>({kind:"shape",subscribers:o,topic:s})),...[...n].map(([s,o])=>({kind:"whisper",subscribers:o,topic:s}))];return a.sort((s,o)=>o.subscribers-s.subscribers||s.topic.localeCompare(o.topic)),{peakSubscribers:a[0]?.subscribers??0,topics:a.slice(0,t),totalConnections:e.length}};export{se as ADMIN_FUNCTIONS,te as ADMIN_FUNCTION_PREFIX,V as DEFAULT_FANOUT_TOPIC_LIMIT,ne as FLAGS_FUNCTION_PREFIX,h as MAX_PAGE_SIZE,re as RELATION_FUNCTION_PREFIX,le as createFanoutCounters,me as createGlobalPollCounters,de as createShapeProbeCounters,X as datePrefixRange,ie as facetColumn,ce as findStorageReferences,ae as listTables,oe as readTablePage,ge as recordFanoutPass,fe as recordGlobalPollPass,pe as recordShapeProbePass,_e as selectMatchingIds,he as summarizeFanoutTopics,ue as summarizeSubscriptions};
@@ -1 +1 @@
1
- import"./sql-projection-D3qdaItY.mjs";import{A as r,a as l,b as i,D as n,n as d,c as m,d as c,l as q,o as u,k as p,g as G,i as f,j as A,e as D,q as S,f as _,r as h,t as C,h as O}from"./do-sql-kpl5Kt1j.mjs";import{quoteIdentifier as g}from"./quoteIdentifier-CObIFRhb.mjs";import"./wire-codec-C-FpWm52.mjs";import"./runDrizzle-2ULFQR_k.mjs";import{serializeSqlValue as I}from"./serializeSqlValue-BEMMYX1n.mjs";export{r as AGG_COUNT,l as AGG_KEY,i as AGG_VALUE,n as DOC_COLUMN,d as DOC_ORIGINALS_KEY,m as aggUpsertSql,c as createIndexSql,q as decodeDocJson,u as decodeGroupKeyValue,p as encodeDocJson,G as geoTableName,f as isFtsAvailable,A as jsonPath,D as jsonPathSql,S as qualifiedJsonPath,_ as qualifiedJsonPathSql,g as quoteIdentifier,h as rowToDocument,I as serializeSqlValue,C as tableColumns,O as tryRowToDocument};
1
+ import"./sql-projection-D3qdaItY.mjs";import{A as r,a as l,b as i,D as n,n as d,c as m,d as c,l as q,o as u,k as p,g as G,i as f,j as A,e as D,q as S,f as _,r as h,t as C,h as O}from"./do-sql-BSoH-O04.mjs";import{quoteIdentifier as g}from"./quoteIdentifier-CObIFRhb.mjs";import"./wire-codec-C-FpWm52.mjs";import"./runDrizzle-CfKnGpV2.mjs";import{serializeSqlValue as I}from"./serializeSqlValue-BEMMYX1n.mjs";export{r as AGG_COUNT,l as AGG_KEY,i as AGG_VALUE,n as DOC_COLUMN,d as DOC_ORIGINALS_KEY,m as aggUpsertSql,c as createIndexSql,q as decodeDocJson,u as decodeGroupKeyValue,p as encodeDocJson,G as geoTableName,f as isFtsAvailable,A as jsonPath,D as jsonPathSql,S as qualifiedJsonPath,_ as qualifiedJsonPathSql,g as quoteIdentifier,h as rowToDocument,I as serializeSqlValue,C as tableColumns,O as tryRowToDocument};
@@ -1,4 +1,4 @@
1
- import{runSql as T}from"./runDrizzle-2ULFQR_k.mjs";const i="__lunora_audit__",a=1e3,s=E=>{T(E,`CREATE TABLE IF NOT EXISTS "${i}" (
1
+ import{runSql as T}from"./runDrizzle-CfKnGpV2.mjs";const i="__lunora_audit__",a=1e3,s=E=>{T(E,`CREATE TABLE IF NOT EXISTS "${i}" (
2
2
  seq INTEGER PRIMARY KEY AUTOINCREMENT,
3
3
  ts REAL NOT NULL,
4
4
  op TEXT NOT NULL,
@@ -1,4 +1,4 @@
1
- import{LunoraError as R}from"@lunora/errors";import{sql as t}from"drizzle-orm";import{quoteIdentifier as C}from"./quoteIdentifier-CObIFRhb.mjs";import{runSql as A,runDrizzle as n}from"./runDrizzle-2ULFQR_k.mjs";import{k as m,l as u}from"./do-sql-kpl5Kt1j.mjs";import{ConflictError as I}from"./ConflictError-C8GtJmjS.mjs";const s="__cdc_log",p=`INSERT INTO ${C(s)} (ts, ${C("table")}, id, op, doc) VALUES (?, ?, ?, ?, ?)`,$="__cdc_log_table_seq",N="__cdc_log_table_id_seq",y=(e,o={})=>{n(e,t`CREATE TABLE IF NOT EXISTS ${t.identifier(s)} (
1
+ import{LunoraError as R}from"@lunora/errors";import{sql as t}from"drizzle-orm";import{quoteIdentifier as C}from"./quoteIdentifier-CObIFRhb.mjs";import{runSql as A,runDrizzle as n}from"./runDrizzle-CfKnGpV2.mjs";import{k as m,l as u}from"./do-sql-BSoH-O04.mjs";import{ConflictError as I}from"./ConflictError-C8GtJmjS.mjs";const s="__cdc_log",p=`INSERT INTO ${C(s)} (ts, ${C("table")}, id, op, doc) VALUES (?, ?, ?, ?, ?)`,$="__cdc_log_table_seq",N="__cdc_log_table_id_seq",y=(e,o={})=>{n(e,t`CREATE TABLE IF NOT EXISTS ${t.identifier(s)} (
2
2
  seq INTEGER PRIMARY KEY AUTOINCREMENT,
3
3
  ts REAL NOT NULL,
4
4
  ${t.identifier("table")} TEXT NOT NULL,
@@ -1,4 +1,4 @@
1
- import{sql as t}from"drizzle-orm";import{runDrizzle as a}from"./runDrizzle-2ULFQR_k.mjs";const r="__client_watermark",o=i=>{a(i,t`CREATE TABLE IF NOT EXISTS ${t.identifier(r)} (
1
+ import{sql as t}from"drizzle-orm";import{runDrizzle as a}from"./runDrizzle-CfKnGpV2.mjs";const r="__client_watermark",o=i=>{a(i,t`CREATE TABLE IF NOT EXISTS ${t.identifier(r)} (
2
2
  identity TEXT NOT NULL,
3
3
  client_id TEXT NOT NULL,
4
4
  last_mutation_id INTEGER NOT NULL,
@@ -1,4 +1,4 @@
1
- import{sql as e}from"drizzle-orm";import{runDrizzle as E}from"./runDrizzle-2ULFQR_k.mjs";const t="__commit_seq",n="_commitSeq",S=i=>{E(i,e`CREATE TABLE IF NOT EXISTS ${e.identifier(t)} (
1
+ import{sql as e}from"drizzle-orm";import{runDrizzle as E}from"./runDrizzle-CfKnGpV2.mjs";const t="__commit_seq",n="_commitSeq",S=i=>{E(i,e`CREATE TABLE IF NOT EXISTS ${e.identifier(t)} (
2
2
  id INTEGER PRIMARY KEY CHECK (id = 0),
3
3
  value INTEGER NOT NULL
4
4
  )`),E(i,e`INSERT OR IGNORE INTO ${e.identifier(t)} (id, value) VALUES (0, 0)`)},r=i=>{const[o]=E(i,e`SELECT value FROM ${e.identifier(t)} WHERE id = 0`);return typeof o?.value=="number"?o.value:0},a=i=>(E(i,e`UPDATE ${e.identifier(t)} SET value = value + 1 WHERE id = 0`),r(i));export{n as COMMIT_SEQ_FIELD,t as COMMIT_SEQ_TABLE,a as allocateCommitSeq,S as migrateCommitSeq,r as readCommitSeq};
@@ -1,4 +1,4 @@
1
- import{LunoraError as D}from"@lunora/errors";import{stableWireKey as S}from"./stableWireKey-D2US4k_J.mjs";import{runSql as E}from"./runDrizzle-2ULFQR_k.mjs";import{encodeCursor as w,CURSOR_PREFIX as C}from"./CURSOR_PREFIX-Bn8SFoGd.mjs";import{ConflictError as x}from"./ConflictError-C8GtJmjS.mjs";const i="__lunora_migrations",M=100,y=3e4,U=1e4,$=e=>{E(e,`CREATE TABLE IF NOT EXISTS "${i}" (
1
+ import{LunoraError as D}from"@lunora/errors";import{stableWireKey as S}from"./stableWireKey-D2US4k_J.mjs";import{runSql as E}from"./runDrizzle-CfKnGpV2.mjs";import{encodeCursor as w,CURSOR_PREFIX as C}from"./CURSOR_PREFIX-Bn8SFoGd.mjs";import{ConflictError as x}from"./ConflictError-C8GtJmjS.mjs";const i="__lunora_migrations",M=100,y=3e4,U=1e4,$=e=>{E(e,`CREATE TABLE IF NOT EXISTS "${i}" (
2
2
  id TEXT PRIMARY KEY,
3
3
  direction TEXT NOT NULL,
4
4
  status TEXT NOT NULL,
@@ -1 +1 @@
1
- import{LunoraError as u}from"@lunora/errors";import{isMemoryTable as p}from"./clearMemoryTables-BGbmag2i.mjs";import{distinctValues as v}from"./applyOnDelete-7JZ4vR9r.mjs";import{RELATION_EXISTS_KEY as j}from"./RELATION_EXISTS_KEY-CFUhnZSZ.mjs";const S=["every","is","isNot","none","some"],O=new Set(S),$=e=>{if(e===null||typeof e!="object"||Array.isArray(e))return!1;const t=Object.keys(e);return t.length>0&&t.every(r=>O.has(r))},E={every:{kind:"many",negateChild:!0,negated:!0},is:{kind:"one",negated:!1},isNot:{kind:"one",negated:!0,nullDisjunct:!0},none:{kind:"many",negated:!0},some:{kind:"many",negated:!1}},R=e=>O.has(e)?e:void 0,w=e=>{const t=R(e),r=t===void 0?void 0:E[t];if(!r)throw new u("INTERNAL",`unknown relation operator "${e}"`);return r},_=e=>e.kind==="one"?{clause:e.field,project:e.references}:{clause:e.references,project:e.field},L=5e3,h=Symbol("relation-key-overflow"),m=e=>Array.isArray(e)?e.map(t=>t??{}):[],A=e=>{if(e.length===1){const[t]=e;return t??{}}return e.length===0?{}:{AND:e}},y=e=>$(e),l=(e,t,r)=>{const n=t.tables[r]?.relationMap??{};return Object.keys(e).some(s=>{const o=e[s];return s==="AND"||s==="OR"?m(o).some(a=>l(a,t,r)):s==="NOT"?l(o??{},t,r):!!n[s]&&y(o)})},Y=(e,t,r,n)=>{if(e&&l(e,t,r))throw new u("INTERNAL",`relation-crossing predicates are not supported in ${n}() — use them in findMany/findFirst or an RLS read policy`)},M=async(e,t,r,n,s)=>{const o=await d(t,e.table,n),{page:a}=await n.fetcher(e.table,{baseWhere:n.relationBaseWhere?.(e.table),relationBaseWhere:n.relationBaseWhere,where:o}),i=v(a,r);if(i.length>n.maxRelationKeys){if(s)return h;throw new u("INTERNAL",`relation predicate on "${e.table}" matched ${String(i.length)} rows, exceeding the ${String(n.maxRelationKeys)}-key limit; narrow the predicate (a same-shard EXISTS push-down lifts this cap)`)}return i},P=async(e,t,r,n,s)=>{const o=w(e),{clause:a,project:i}=_(t),c=await M(t,o.negateChild?{NOT:r}:r,i,n,s);return c===h?h:o.negated?o.nullDisjunct?{OR:[{[a]:{notIn:c}},{[a]:{isNull:!0}}]}:{[a]:{notIn:c}}:{[a]:{in:c}}},b=async(e,t,r,n,s)=>{const o=w(e),a=s.relationBaseWhere?.(t.table),i=o.negateChild?{NOT:r}:r,N={childWhere:await d(a?{AND:[a,i]}:i,t.table,s),negated:o.negated,parentTable:n,relation:t};return{[j]:N}},k=(e,t,r)=>{const n=R(e),s=n===void 0?void 0:E[n];if(s&&s.kind!==r.kind)throw new u("INTERNAL",`relation operator "${e}" requires a to-${s.kind} relation, but "${t}" is to-${r.kind}`)},I=async(e,t,r,n,s)=>{const o=[];for(const a of Object.keys(r)){k(a,e,t);const i=r[a]??{},c=s.canPushExists?.(t)??!1;if(c&&s.existsPushMode==="always"){o.push(await b(a,t,i,n,s));continue}const f=await P(a,t,i,s,c);f===h?o.push(await b(a,t,i,n,s)):o.push(f)}return A(o)},D=async(e,t,r,n)=>{if(e==="AND"||e==="OR"){const o=[];for(const a of m(t))o.push(await d(a,r,n));return{[e]:o}}if(e==="NOT")return{NOT:await d(t??{},r,n)};const s=n.schema.tables[r]?.relationMap?.[e];return s&&y(t)?I(e,s,t,r,n):{[e]:t}},d=async(e,t,r)=>{const n=[];for(const s of Object.keys(e))n.push(await D(s,e[s],t,r));return A(n)},H=async(e,t)=>!e||!l(e,t.schema,t.tableName)?e:d(e,t.tableName,{canPushExists:t.canPushExists,existsPushMode:t.existsPushMode??"auto",fetcher:t.fetcher,maxRelationKeys:t.maxRelationKeys??L,relationBaseWhere:t.relationBaseWhere,schema:t.schema}),g=(e,t,r)=>{for(const n of e){const s=T(n,t,r);if(s)return s}},K=(e,t,r,n)=>{if(e==="AND"||e==="OR")return g(m(t),r,n);if(e==="NOT")return g([t??{}],r,n);const s=r.tables[n]?.relationMap?.[e];if(!(!s||!y(t)))return r.tables[s.table]?.shardMode?.kind==="shardBy"?{kind:"shard",relation:e,target:s.table}:p(r.tables[s.table])?{kind:"memory",relation:e,target:s.table}:g(Object.values(t),r,s.table)},T=(e,t,r)=>{for(const n of Object.keys(e)){const s=K(n,e[n],t,r);if(s)return s}},q=(e,t,r)=>{if(p(t.tables[r]))throw Object.assign(new Error(`shape on "${r}" replicates from the changelog, which never records a .memory() table — the shape would seed once and never update again. Fix it by (a) dropping .memory() from "${r}" so its writes reach the changelog, or (b) reading it through a live query (\`useQuery\`), which refreshes off the changed-table set rather than the log.`),{code:"SHAPE_MEMORY_TABLE",name:"LunoraError",status:400});if(!e)return;const n=T(e,t,r);if(n)throw n.kind==="memory"?Object.assign(new Error(`shape on "${r}" joins the .memory() table "${n.target}" via relation "${n.relation}" — writes to a .memory() table never reach the changelog, so the shape is never told its membership changed and would serve stale rows indefinitely. Fix it by (a) dropping .memory() from "${n.target}", or (b) reading it through a live query (\`useQuery\`), which refreshes off the changed-table set rather than the log.`),{code:"SHAPE_MEMORY_TABLE",name:"LunoraError",status:400}):Object.assign(new Error(`shape on "${r}" joins the sharded table "${n.target}" via relation "${n.relation}" — a live shape cannot replicate rows that live in another shard's Durable Object. Fix it by (a) denormalizing the joined columns into "${r}", or (b) moving "${n.target}" to .global() so it is served through the latency-tiered D1 shape tier.`),{code:"SHAPE_CROSS_SHARD_JOIN",name:"LunoraError",status:400})};export{L as DEFAULT_MAX_RELATION_KEYS,Y as assertFlatPredicate,q as assertShapeShardable,l as containsRelationPredicate,y as isRelationPredicate,H as resolveRelationPredicates};
1
+ import{LunoraError as u}from"@lunora/errors";import{isMemoryTable as p}from"./clearMemoryTables-C5Wivufe.mjs";import{distinctValues as v}from"./applyOnDelete-7JZ4vR9r.mjs";import{RELATION_EXISTS_KEY as j}from"./RELATION_EXISTS_KEY-CFUhnZSZ.mjs";const S=["every","is","isNot","none","some"],O=new Set(S),$=e=>{if(e===null||typeof e!="object"||Array.isArray(e))return!1;const t=Object.keys(e);return t.length>0&&t.every(r=>O.has(r))},E={every:{kind:"many",negateChild:!0,negated:!0},is:{kind:"one",negated:!1},isNot:{kind:"one",negated:!0,nullDisjunct:!0},none:{kind:"many",negated:!0},some:{kind:"many",negated:!1}},R=e=>O.has(e)?e:void 0,w=e=>{const t=R(e),r=t===void 0?void 0:E[t];if(!r)throw new u("INTERNAL",`unknown relation operator "${e}"`);return r},_=e=>e.kind==="one"?{clause:e.field,project:e.references}:{clause:e.references,project:e.field},L=5e3,h=Symbol("relation-key-overflow"),m=e=>Array.isArray(e)?e.map(t=>t??{}):[],A=e=>{if(e.length===1){const[t]=e;return t??{}}return e.length===0?{}:{AND:e}},y=e=>$(e),l=(e,t,r)=>{const n=t.tables[r]?.relationMap??{};return Object.keys(e).some(s=>{const o=e[s];return s==="AND"||s==="OR"?m(o).some(a=>l(a,t,r)):s==="NOT"?l(o??{},t,r):!!n[s]&&y(o)})},Y=(e,t,r,n)=>{if(e&&l(e,t,r))throw new u("INTERNAL",`relation-crossing predicates are not supported in ${n}() — use them in findMany/findFirst or an RLS read policy`)},M=async(e,t,r,n,s)=>{const o=await d(t,e.table,n),{page:a}=await n.fetcher(e.table,{baseWhere:n.relationBaseWhere?.(e.table),relationBaseWhere:n.relationBaseWhere,where:o}),i=v(a,r);if(i.length>n.maxRelationKeys){if(s)return h;throw new u("INTERNAL",`relation predicate on "${e.table}" matched ${String(i.length)} rows, exceeding the ${String(n.maxRelationKeys)}-key limit; narrow the predicate (a same-shard EXISTS push-down lifts this cap)`)}return i},P=async(e,t,r,n,s)=>{const o=w(e),{clause:a,project:i}=_(t),c=await M(t,o.negateChild?{NOT:r}:r,i,n,s);return c===h?h:o.negated?o.nullDisjunct?{OR:[{[a]:{notIn:c}},{[a]:{isNull:!0}}]}:{[a]:{notIn:c}}:{[a]:{in:c}}},b=async(e,t,r,n,s)=>{const o=w(e),a=s.relationBaseWhere?.(t.table),i=o.negateChild?{NOT:r}:r,N={childWhere:await d(a?{AND:[a,i]}:i,t.table,s),negated:o.negated,parentTable:n,relation:t};return{[j]:N}},k=(e,t,r)=>{const n=R(e),s=n===void 0?void 0:E[n];if(s&&s.kind!==r.kind)throw new u("INTERNAL",`relation operator "${e}" requires a to-${s.kind} relation, but "${t}" is to-${r.kind}`)},I=async(e,t,r,n,s)=>{const o=[];for(const a of Object.keys(r)){k(a,e,t);const i=r[a]??{},c=s.canPushExists?.(t)??!1;if(c&&s.existsPushMode==="always"){o.push(await b(a,t,i,n,s));continue}const f=await P(a,t,i,s,c);f===h?o.push(await b(a,t,i,n,s)):o.push(f)}return A(o)},D=async(e,t,r,n)=>{if(e==="AND"||e==="OR"){const o=[];for(const a of m(t))o.push(await d(a,r,n));return{[e]:o}}if(e==="NOT")return{NOT:await d(t??{},r,n)};const s=n.schema.tables[r]?.relationMap?.[e];return s&&y(t)?I(e,s,t,r,n):{[e]:t}},d=async(e,t,r)=>{const n=[];for(const s of Object.keys(e))n.push(await D(s,e[s],t,r));return A(n)},H=async(e,t)=>!e||!l(e,t.schema,t.tableName)?e:d(e,t.tableName,{canPushExists:t.canPushExists,existsPushMode:t.existsPushMode??"auto",fetcher:t.fetcher,maxRelationKeys:t.maxRelationKeys??L,relationBaseWhere:t.relationBaseWhere,schema:t.schema}),g=(e,t,r)=>{for(const n of e){const s=T(n,t,r);if(s)return s}},K=(e,t,r,n)=>{if(e==="AND"||e==="OR")return g(m(t),r,n);if(e==="NOT")return g([t??{}],r,n);const s=r.tables[n]?.relationMap?.[e];if(!(!s||!y(t)))return r.tables[s.table]?.shardMode?.kind==="shardBy"?{kind:"shard",relation:e,target:s.table}:p(r.tables[s.table])?{kind:"memory",relation:e,target:s.table}:g(Object.values(t),r,s.table)},T=(e,t,r)=>{for(const n of Object.keys(e)){const s=K(n,e[n],t,r);if(s)return s}},q=(e,t,r)=>{if(p(t.tables[r]))throw Object.assign(new Error(`shape on "${r}" replicates from the changelog, which never records a .memory() table — the shape would seed once and never update again. Fix it by (a) dropping .memory() from "${r}" so its writes reach the changelog, or (b) reading it through a live query (\`useQuery\`), which refreshes off the changed-table set rather than the log.`),{code:"SHAPE_MEMORY_TABLE",name:"LunoraError",status:400});if(!e)return;const n=T(e,t,r);if(n)throw n.kind==="memory"?Object.assign(new Error(`shape on "${r}" joins the .memory() table "${n.target}" via relation "${n.relation}" — writes to a .memory() table never reach the changelog, so the shape is never told its membership changed and would serve stale rows indefinitely. Fix it by (a) dropping .memory() from "${n.target}", or (b) reading it through a live query (\`useQuery\`), which refreshes off the changed-table set rather than the log.`),{code:"SHAPE_MEMORY_TABLE",name:"LunoraError",status:400}):Object.assign(new Error(`shape on "${r}" joins the sharded table "${n.target}" via relation "${n.relation}" — a live shape cannot replicate rows that live in another shard's Durable Object. Fix it by (a) denormalizing the joined columns into "${r}", or (b) moving "${n.target}" to .global() so it is served through the latency-tiered D1 shape tier.`),{code:"SHAPE_CROSS_SHARD_JOIN",name:"LunoraError",status:400})};export{L as DEFAULT_MAX_RELATION_KEYS,Y as assertFlatPredicate,q as assertShapeShardable,l as containsRelationPredicate,y as isRelationPredicate,H as resolveRelationPredicates};
@@ -1,4 +1,4 @@
1
- import{toErrorBody as k,LunoraError as D}from"@lunora/errors";import{e as N,d as v}from"./wire-codec-C-FpWm52.mjs";import{sql as y}from"drizzle-orm";import{runDrizzle as m}from"./runDrizzle-2ULFQR_k.mjs";import{WORKERD_SQLITE_LIMITS as F}from"./param-DlozcSQu.mjs";import{d as U,w,a as A,m as $,r as K,b as Y,c as W}from"./ctx-db-relay-shapes-Bg5YYnmN.mjs";import{envPositiveInt as g}from"./envOptionalPositiveInt-D2pY-c64.mjs";import{relayName as R,DEFAULT_PROMOTION_THRESHOLDS as T,nextPromotionState as B,shapeRoutingKey as _,relayProxyKey as M,parseRelayName as H,clampPromotionThresholds as q}from"./DEFAULT_PROMOTION_THRESHOLDS-Bfx7KakS.mjs";import{encodeRowsPatch as X,buildPokeFrames as O}from"./buildPokeFrames-BBE6J91z.mjs";import{v as j,R as L,s as z,a as G,b as J}from"./sibling-channel-BkL5cTCc.mjs";import{awaitWsDrain as V,trySendFrame as x}from"./awaitWsDrain-apizgmKY.mjs";import{stableWireKey as b}from"./stableWireKey-D2US4k_J.mjs";const f="__lunora_relay_memos",Q=i=>{m(i,y`CREATE TABLE IF NOT EXISTS ${y.identifier(f)} (
1
+ import{toErrorBody as k,LunoraError as D}from"@lunora/errors";import{e as N,d as v}from"./wire-codec-C-FpWm52.mjs";import{sql as y}from"drizzle-orm";import{runDrizzle as m}from"./runDrizzle-CfKnGpV2.mjs";import{WORKERD_SQLITE_LIMITS as F}from"./param-DlozcSQu.mjs";import{d as U,w,a as A,m as $,r as K,b as Y,c as W}from"./ctx-db-relay-shapes-BcgjOtG1.mjs";import{envPositiveInt as g}from"./envOptionalPositiveInt-D2pY-c64.mjs";import{relayName as R,DEFAULT_PROMOTION_THRESHOLDS as T,nextPromotionState as B,shapeRoutingKey as _,relayProxyKey as M,parseRelayName as H,clampPromotionThresholds as q}from"./DEFAULT_PROMOTION_THRESHOLDS-Bfx7KakS.mjs";import{encodeRowsPatch as X,buildPokeFrames as O}from"./buildPokeFrames-BBE6J91z.mjs";import{v as j,R as L,s as z,a as G,b as J}from"./sibling-channel-BkL5cTCc.mjs";import{awaitWsDrain as V,trySendFrame as x}from"./awaitWsDrain-apizgmKY.mjs";import{stableWireKey as b}from"./stableWireKey-D2US4k_J.mjs";const f="__lunora_relay_memos",Q=i=>{m(i,y`CREATE TABLE IF NOT EXISTS ${y.identifier(f)} (
2
2
  connection_id TEXT NOT NULL,
3
3
  sub_id TEXT NOT NULL,
4
4
  cursor INTEGER NOT NULL,
@@ -1 +1 @@
1
- import{toErrorBody as R,LunoraError as k}from"@lunora/errors";import{e as A}from"./wire-codec-C-FpWm52.mjs";import{readStreamRun as T,deleteStreamRun as w,claimStreamRun as _,appendStreamChunk as y,finishStreamRun as E,trimStreamRuns as b,readStreamChunks as v}from"./appendStreamChunk-C1Ok4b6J.mjs";const p=5e4,S=64*1024*1024,M=864e5,N=36e5,L=(i,e)=>{const r=i?.startedAt??e.live?.generation;return e.resuming&&e.generation!==void 0&&r!==void 0&&e.generation!==r?"interrupted":e.live!==void 0?"attach":i===void 0?e.resuming?"interrupted":"attach":i.status==="complete"||i.status==="error"?e.resuming?"replay-terminal":"reclaim":e.resuming?"interrupted":"reclaim"},O=(i,e,r)=>{(i||r())&&e.fail({code:"STREAM_INTERRUPTED",message:i?"the run this durable stream resumed from no longer exists; start a new run":"the producer for this durable stream did not survive; start a new run"})};class I{lastTrimAt=0;runs=new Map;sql;waitUntil;constructor(e){this.sql=e.sql,this.waitUntil=e.waitUntil}async attach(e){try{await this.attachOrThrow(e)}catch(r){const{body:t,redacted:o}=R(r,{fallbackCode:"INTERNAL_SERVER_ERROR",redactedMessage:"internal error"});o&&console.error("[@lunora/shard-engine] durable stream attach failed:",r),e.sink.fail({code:t.code,message:t.message})}finally{this.trim(this.sql())}}detach(e,r){this.runs.get(e)?.sinks.delete(r)}isLive(e){return this.runs.has(e)}async attachOrThrow(e){const r=this.sql(),{runKey:t,sinceChunk:o,sink:c}=e,s=T(r,t),u=o>0,n=this.runs.get(t),a=s?.startedAt??n?.generation,l=L(s,{generation:e.generation,live:n,resuming:u}),d=()=>{for(const g of v(r,t,o))if(!c.chunk({data:JSON.parse(g.dataJson),generation:a,seq:g.seq}))return!1;return!0};if(l==="replay-terminal"){d()&&(s?.status==="error"?c.fail({code:s.errorCode??"INTERNAL_SERVER_ERROR",message:s.error??"stream failed"}):c.complete());return}if(l==="interrupted"){O(e.generation!==void 0&&a!==void 0&&e.generation!==a,c,d);return}if(n){d()&&n.sinks.add(c);return}l==="reclaim"&&w(r,t);const m=Math.max(Date.now(),s===void 0?0:s.startedAt+1);_(r,t,m,e.ttlMs??M);const h={generation:m,sinks:new Set([c])};this.runs.set(t,h);const f=this.produce(t,e.iterator,h);this.waitUntil?.(f),await f}async produce(e,r,t){const o=this.sql(),c=new AbortController;let s=0,u=0;try{for await(const n of r(c.signal)){const a=A(n),l=JSON.stringify(a);if(s+=1,u+=l.length,s>p||u>S)throw new k("STREAM_TOO_LONG",`durable stream exceeded its ceiling (${String(p)} chunks / ${String(S)} bytes); yield less, or drop \`durable\``,{status:507});y(o,e,s,l);for(const d of t.sinks)d.chunk({data:a,generation:t.generation,seq:s})||t.sinks.delete(d)}E(o,e,"complete",s);for(const n of t.sinks)n.complete()}catch(n){const{body:a,redacted:l}=R(n,{fallbackCode:"INTERNAL_SERVER_ERROR",redactedMessage:"internal error"});l&&console.error("[@lunora/shard-engine] unhandled durable stream error:",n),E(o,e,"error",s,{code:a.code,message:a.message});for(const d of t.sinks)d.fail({code:a.code,message:a.message})}finally{this.runs.delete(e)}}trim(e){const r=Date.now();if(!(r-this.lastTrimAt<=N)){this.lastTrimAt=r;try{b(e,r)}catch{}}}}export{I as DurableStreamRunner,S as MAX_DURABLE_STREAM_BYTES,p as MAX_DURABLE_STREAM_CHUNKS,L as decideDurableAttach};
1
+ import{toErrorBody as R,LunoraError as k}from"@lunora/errors";import{e as A}from"./wire-codec-C-FpWm52.mjs";import{readStreamRun as T,deleteStreamRun as w,claimStreamRun as _,appendStreamChunk as y,finishStreamRun as E,trimStreamRuns as b,readStreamChunks as v}from"./appendStreamChunk-pPeR5nbF.mjs";const p=5e4,S=64*1024*1024,M=864e5,N=36e5,L=(i,e)=>{const r=i?.startedAt??e.live?.generation;return e.resuming&&e.generation!==void 0&&r!==void 0&&e.generation!==r?"interrupted":e.live!==void 0?"attach":i===void 0?e.resuming?"interrupted":"attach":i.status==="complete"||i.status==="error"?e.resuming?"replay-terminal":"reclaim":e.resuming?"interrupted":"reclaim"},O=(i,e,r)=>{(i||r())&&e.fail({code:"STREAM_INTERRUPTED",message:i?"the run this durable stream resumed from no longer exists; start a new run":"the producer for this durable stream did not survive; start a new run"})};class I{lastTrimAt=0;runs=new Map;sql;waitUntil;constructor(e){this.sql=e.sql,this.waitUntil=e.waitUntil}async attach(e){try{await this.attachOrThrow(e)}catch(r){const{body:t,redacted:o}=R(r,{fallbackCode:"INTERNAL_SERVER_ERROR",redactedMessage:"internal error"});o&&console.error("[@lunora/shard-engine] durable stream attach failed:",r),e.sink.fail({code:t.code,message:t.message})}finally{this.trim(this.sql())}}detach(e,r){this.runs.get(e)?.sinks.delete(r)}isLive(e){return this.runs.has(e)}async attachOrThrow(e){const r=this.sql(),{runKey:t,sinceChunk:o,sink:c}=e,s=T(r,t),u=o>0,n=this.runs.get(t),a=s?.startedAt??n?.generation,l=L(s,{generation:e.generation,live:n,resuming:u}),d=()=>{for(const g of v(r,t,o))if(!c.chunk({data:JSON.parse(g.dataJson),generation:a,seq:g.seq}))return!1;return!0};if(l==="replay-terminal"){d()&&(s?.status==="error"?c.fail({code:s.errorCode??"INTERNAL_SERVER_ERROR",message:s.error??"stream failed"}):c.complete());return}if(l==="interrupted"){O(e.generation!==void 0&&a!==void 0&&e.generation!==a,c,d);return}if(n){d()&&n.sinks.add(c);return}l==="reclaim"&&w(r,t);const m=Math.max(Date.now(),s===void 0?0:s.startedAt+1);_(r,t,m,e.ttlMs??M);const h={generation:m,sinks:new Set([c])};this.runs.set(t,h);const f=this.produce(t,e.iterator,h);this.waitUntil?.(f),await f}async produce(e,r,t){const o=this.sql(),c=new AbortController;let s=0,u=0;try{for await(const n of r(c.signal)){const a=A(n),l=JSON.stringify(a);if(s+=1,u+=l.length,s>p||u>S)throw new k("STREAM_TOO_LONG",`durable stream exceeded its ceiling (${String(p)} chunks / ${String(S)} bytes); yield less, or drop \`durable\``,{status:507});y(o,e,s,l);for(const d of t.sinks)d.chunk({data:a,generation:t.generation,seq:s})||t.sinks.delete(d)}E(o,e,"complete",s);for(const n of t.sinks)n.complete()}catch(n){const{body:a,redacted:l}=R(n,{fallbackCode:"INTERNAL_SERVER_ERROR",redactedMessage:"internal error"});l&&console.error("[@lunora/shard-engine] unhandled durable stream error:",n),E(o,e,"error",s,{code:a.code,message:a.message});for(const d of t.sinks)d.fail({code:a.code,message:a.message})}finally{this.runs.delete(e)}}trim(e){const r=Date.now();if(!(r-this.lastTrimAt<=N)){this.lastTrimAt=r;try{b(e,r)}catch{}}}}export{I as DurableStreamRunner,S as MAX_DURABLE_STREAM_BYTES,p as MAX_DURABLE_STREAM_CHUNKS,L as decideDurableAttach};
@@ -1,4 +1,4 @@
1
- import{LunoraError as p}from"@lunora/errors";import{sql as e}from"drizzle-orm";import{runDrizzle as i}from"./runDrizzle-2ULFQR_k.mjs";const s="__global_shape_snapshot",E=1e6,T=n=>{i(n,e`CREATE TABLE IF NOT EXISTS ${e.identifier(s)} (
1
+ import{LunoraError as p}from"@lunora/errors";import{sql as e}from"drizzle-orm";import{runDrizzle as i}from"./runDrizzle-CfKnGpV2.mjs";const s="__global_shape_snapshot",E=1e6,T=n=>{i(n,e`CREATE TABLE IF NOT EXISTS ${e.identifier(s)} (
2
2
  connection_id TEXT NOT NULL,
3
3
  sub_id TEXT NOT NULL,
4
4
  members TEXT NOT NULL,
@@ -1,4 +1,4 @@
1
- import{sql as t}from"drizzle-orm";import{runDrizzle as n}from"./runDrizzle-2ULFQR_k.mjs";const r="__idempotency",m=i=>{n(i,t`CREATE TABLE IF NOT EXISTS ${t.identifier(r)} (
1
+ import{sql as t}from"drizzle-orm";import{runDrizzle as n}from"./runDrizzle-CfKnGpV2.mjs";const r="__idempotency",m=i=>{n(i,t`CREATE TABLE IF NOT EXISTS ${t.identifier(r)} (
2
2
  identity TEXT NOT NULL,
3
3
  mutation_id TEXT NOT NULL,
4
4
  result_json TEXT NOT NULL,
@@ -1,4 +1,4 @@
1
- import{runSql as c,decodeJsonColumn as a,orNull as o}from"./runDrizzle-2ULFQR_k.mjs";const e="__lunora_mail",l=500,i=256*1024,n=t=>t!==void 0&&t.length>i?`${t.slice(0,i)}
1
+ import{runSql as c,decodeJsonColumn as a,orNull as o}from"./runDrizzle-CfKnGpV2.mjs";const e="__lunora_mail",l=500,i=256*1024,n=t=>t!==void 0&&t.length>i?`${t.slice(0,i)}
2
2
  … [truncated by the dev mail catcher]`:t,s=t=>t===void 0?null:JSON.stringify(t),_=t=>{c(t,`CREATE TABLE IF NOT EXISTS "${e}" (
3
3
  id TEXT PRIMARY KEY,
4
4
  captured_at INTEGER NOT NULL,