@lunora/shard-engine 1.0.0-alpha.181 → 1.0.0-alpha.182

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 (36) hide show
  1. package/dist/conformance/index.mjs +1 -1
  2. package/dist/index.d.mts +49 -5
  3. package/dist/index.d.ts +49 -5
  4. package/dist/index.mjs +1 -1
  5. package/dist/packem_shared/ADMIN_FUNCTIONS-BMBnudzO.mjs +1 -0
  6. package/dist/packem_shared/AGG_COUNT-dVi3FAjZ.mjs +1 -0
  7. package/dist/packem_shared/{CDC_LOG_TABLE-CTkXVeJx.mjs → CDC_LOG_TABLE-BFGgqai8.mjs} +1 -1
  8. package/dist/packem_shared/{DEFAULT_MAX_RELATION_KEYS-DQkJExDV.mjs → DEFAULT_MAX_RELATION_KEYS-DfrMi_eE.mjs} +1 -1
  9. package/dist/packem_shared/DEFAULT_TRANSACTION_LIMITS-D7p7Ys0M.mjs +1 -0
  10. package/dist/packem_shared/NotUniqueError-CO-HgL4c.mjs +1 -0
  11. package/dist/packem_shared/{ReactiveCache-Cy7oH_7w.mjs → ReactiveCache-5XPk8qfW.mjs} +1 -1
  12. package/dist/packem_shared/SCHEDULE_OUTBOX_TABLE-iyyiSjsO.mjs +18 -0
  13. package/dist/packem_shared/{VECTOR_BACKFILL_MAX_PAGES-UY0toTIR.mjs → VECTOR_BACKFILL_MAX_PAGES-DcQpf83n.mjs} +1 -1
  14. package/dist/packem_shared/{applyInsertDefaults-BJo578fn.mjs → applyInsertDefaults-CVukTkQ5.mjs} +1 -1
  15. package/dist/packem_shared/{backfillAggregateIndexes-CRNxxM19.mjs → backfillAggregateIndexes-Pk0KLrfk.mjs} +1 -1
  16. package/dist/packem_shared/{buildReprojectionMigration-DAh1inpL.mjs → buildReprojectionMigration-B8aEpETD.mjs} +1 -1
  17. package/dist/packem_shared/{buildShapeDiff-CCpH5fNc.mjs → buildShapeDiff-CdLJTijm.mjs} +1 -1
  18. package/dist/packem_shared/createCompanionSync-CEht4hXX.mjs +1 -0
  19. package/dist/packem_shared/{createReplicaLink-D0YNQDzD.mjs → createReplicaLink-DVXW9rR6.mjs} +1 -1
  20. package/dist/packem_shared/{defineEngineContractSuite-DKON0Z5G.mjs → defineEngineContractSuite-C4w7jbyk.mjs} +1 -1
  21. package/dist/packem_shared/do-sql-105TONaE.mjs +1 -0
  22. package/dist/packem_shared/estimate-bytes-C-C35VXL.mjs +1 -0
  23. package/dist/packem_shared/{isSoftDeleted-QCy5JKnY.mjs → isSoftDeleted-BBWKE0Sm.mjs} +1 -1
  24. package/dist/packem_shared/{isTtlExpired-BmiUp7MF.mjs → isTtlExpired-DNxmZA6e.mjs} +1 -1
  25. package/dist/packem_shared/{materializeExternalRows-BakYlgvb.mjs → materializeExternalRows-CHPRx8fu.mjs} +1 -1
  26. package/dist/packem_shared/{runShardMigrations-DOiPunti.mjs → runShardMigrations-xu993yo2.mjs} +1 -1
  27. package/dist/packem_shared/{selectShapeMembers-BhK79123.mjs → selectShapeMembers-Dqx_m7BF.mjs} +1 -1
  28. package/package.json +2 -2
  29. package/dist/packem_shared/ADMIN_FUNCTIONS-CgMPqUvK.mjs +0 -1
  30. package/dist/packem_shared/AGG_COUNT-BkqKHbcG.mjs +0 -1
  31. package/dist/packem_shared/DEFAULT_TRANSACTION_LIMITS-Dmj5VBrV.mjs +0 -1
  32. package/dist/packem_shared/NotUniqueError-Dn6Cj7W1.mjs +0 -1
  33. package/dist/packem_shared/SCHEDULE_OUTBOX_TABLE-DcZI7Yhl.mjs +0 -11
  34. package/dist/packem_shared/createCompanionSync-qhvw6wyL.mjs +0 -1
  35. package/dist/packem_shared/do-sql-RROYQPCM.mjs +0 -1
  36. package/dist/packem_shared/estimate-bytes-_k74s6LZ.mjs +0 -1
@@ -1 +1 @@
1
- import{defineEngineContractSuite as t}from"../packem_shared/defineEngineContractSuite-DKON0Z5G.mjs";export{t as defineEngineContractSuite};
1
+ import{defineEngineContractSuite as t}from"../packem_shared/defineEngineContractSuite-C4w7jbyk.mjs";export{t as defineEngineContractSuite};
package/dist/index.d.mts CHANGED
@@ -850,28 +850,45 @@ declare class ReactiveCache {
850
850
  }
851
851
  declare const reactiveCacheKey: (functionPath: string, args: Record<string, unknown>, identity: null | string) => string;
852
852
  interface TransactionLimits {
853
+ maxReadBytes: number;
853
854
  maxReadRows: number;
854
855
  maxWrittenBytes: number;
855
856
  maxWrittenRows: number;
856
857
  }
857
858
  interface TransactionHeadroom {
859
+ readBytes: number;
858
860
  readRows: number;
861
+ remainingReadBytes: number;
859
862
  remainingReadRows: number;
860
863
  remainingWrittenBytes: number;
861
864
  remainingWrittenRows: number;
862
865
  writtenBytes: number;
863
866
  writtenRows: number;
864
867
  }
868
+ type TransactionLimitKind = "readBytes" | "readRows" | "writtenBytes" | "writtenRows";
869
+ interface TransactionLimitWarning {
870
+ kind: TransactionLimitKind;
871
+ limit: number;
872
+ used: number;
873
+ }
865
874
  declare const DEFAULT_TRANSACTION_LIMITS: TransactionLimits;
866
875
  declare class TransactionHeadroomTracker {
876
+ private readBytes;
867
877
  private readRows;
868
878
  private writtenRows;
869
879
  private writtenBytes;
870
880
  private readonly limits;
871
- constructor(limits?: Partial<TransactionLimits>);
881
+ private readonly onNearLimit;
882
+ private readonly warned;
883
+ private readonly chargedDocuments;
884
+ constructor(limits?: Partial<TransactionLimits>, onNearLimit?: (warning: TransactionLimitWarning) => void);
872
885
  recordRead(count: number): void;
886
+ recordReadBytes(bytes: number): void;
887
+ recordDocumentRead(key: string, bytes: number): void;
888
+ beginReadWindow(): void;
873
889
  recordWrite(row: unknown): void;
874
890
  headroom(): TransactionHeadroom;
891
+ private check;
875
892
  }
876
893
  interface RunTriggersOptions {
877
894
  ctx: TriggerContextLike;
@@ -1124,6 +1141,16 @@ interface ScheduleOutboxRow {
1124
1141
  id: string;
1125
1142
  nextAttemptAt: number;
1126
1143
  }
1144
+ interface ScheduleOutboxEntry {
1145
+ attempts: number;
1146
+ createdAt: number;
1147
+ forever: boolean;
1148
+ id: string;
1149
+ nextAttemptAt: number;
1150
+ parked: boolean;
1151
+ target: string | undefined;
1152
+ when: number | undefined;
1153
+ }
1127
1154
  interface ScheduleOutboxEnvelope {
1128
1155
  args: unknown;
1129
1156
  options: Record<string, unknown> | undefined;
@@ -1133,20 +1160,34 @@ interface ScheduleOutboxEnvelope {
1133
1160
  interface ScheduleOutbox {
1134
1161
  admit: (target: string) => number | undefined;
1135
1162
  forget: (id: string) => void;
1136
- record: (id: string, envelope: ScheduleOutboxEnvelope) => void;
1163
+ handOff?: (id: string, run: () => Promise<unknown>, token?: string) => Promise<void>;
1164
+ record: (id: string, envelope: ScheduleOutboxEnvelope) => string | undefined;
1137
1165
  wake: () => void;
1138
1166
  }
1139
1167
  declare const migrateScheduleOutbox: (sql: SqlExec) => void;
1140
1168
  declare const recordScheduleOutbox: (sql: SqlExec, id: string, envelopeJson: string, now: number) => void;
1141
1169
  declare const forgetScheduleOutbox: (sql: SqlExec, id: string) => void;
1142
1170
  declare const readDueScheduleOutbox: (sql: SqlExec, nowMs: number, limit: number) => ScheduleOutboxRow[];
1171
+ declare const readDueScheduleOutboxEntry: (sql: SqlExec, id: string, nowMs: number) => ScheduleOutboxRow | undefined;
1143
1172
  declare const deferScheduleOutbox: (sql: SqlExec, id: string, attempts: number, nextAttemptAt: number) => void;
1144
- declare const parkScheduleOutbox: (sql: SqlExec, id: string, attempts: number) => void;
1173
+ declare const parkScheduleOutbox: (sql: SqlExec, id: string, attempts: number, now: number) => void;
1145
1174
  declare const probeScheduleOutbox: (sql: SqlExec) => {
1146
1175
  dueAt: number | undefined;
1147
1176
  populated: boolean;
1148
1177
  };
1149
1178
  declare const trimScheduleOutbox: (sql: SqlExec, olderThanTs: number) => void;
1179
+ declare const readScheduleOutbox: (sql: SqlExec, limit: number, cursor?: string) => {
1180
+ entries: ScheduleOutboxEntry[];
1181
+ nextCursor: string | undefined;
1182
+ };
1183
+ declare const readScheduleOutboxState: (sql: SqlExec, id: string) => {
1184
+ createdAt: number;
1185
+ parked: boolean;
1186
+ version: string;
1187
+ } | undefined;
1188
+ declare const hasScheduleOutboxEntry: (sql: SqlExec, id: string) => boolean;
1189
+ declare const requeueScheduleOutbox: (sql: SqlExec, id: string, now: number) => boolean;
1190
+ declare const dropScheduleOutbox: (sql: SqlExec, id: string) => boolean;
1150
1191
  /**
1151
1192
  * How far a companion's backfill has progressed, and under which analysis.
1152
1193
  * Declared here rather than beside either engine's state table: both record the
@@ -1280,7 +1321,7 @@ declare const aggUpsertSql: (aggTable: string, key: unknown, value: unknown, cou
1280
1321
  declare const tableColumns: (definition: TableDefinitionLike) => ReadonlyArray<readonly [string, ColumnMetaLike]>;
1281
1322
  declare const rowToDocument: (row: Record<string, unknown> | undefined) => Record<string, unknown> | undefined;
1282
1323
  declare const tryRowToDocument: (row: Record<string, unknown> | undefined) => Record<string, unknown> | undefined;
1283
- declare const isFtsAvailable: (sql: SqlExec) => boolean;
1324
+ declare const isFtsAvailable: (wrapper: SqlExec) => boolean;
1284
1325
  declare const WORKERD_SQLITE_LIMITS: {
1285
1326
  readonly boundParams: 100;
1286
1327
  readonly compoundSelect: 5;
@@ -1493,6 +1534,7 @@ declare const ADMIN_FUNCTIONS: {
1493
1534
  readonly deleteRows: "__lunora_admin__:deleteRows";
1494
1535
  readonly describeTable: "__lunora_admin__:describeTable";
1495
1536
  readonly describeTables: "__lunora_admin__:describeTables";
1537
+ readonly dropOutboxEntry: "__lunora_admin__:dropOutboxEntry";
1496
1538
  readonly explainIssue: "__lunora_admin__:explainIssue";
1497
1539
  readonly exportShard: "__lunora_admin__:exportShard";
1498
1540
  readonly facetColumn: "__lunora_admin__:facetColumn";
@@ -1507,6 +1549,7 @@ declare const ADMIN_FUNCTIONS: {
1507
1549
  readonly getIssues: "__lunora_admin__:getIssues";
1508
1550
  readonly getMetricHistory: "__lunora_admin__:getMetricHistory";
1509
1551
  readonly getMetricSeries: "__lunora_admin__:getMetricSeries";
1552
+ readonly getScheduleOutbox: "__lunora_admin__:getScheduleOutbox";
1510
1553
  readonly listSubscriptions: "__lunora_admin__:listSubscriptions";
1511
1554
  readonly listTableIndexes: "__lunora_admin__:listTableIndexes";
1512
1555
  readonly listTablesIndexes: "__lunora_admin__:listTablesIndexes";
@@ -1542,6 +1585,7 @@ declare const ADMIN_FUNCTIONS: {
1542
1585
  readonly recordQueueMessage: "__lunora_admin__:recordQueueMessage";
1543
1586
  readonly releaseShardRegistration: "__lunora_admin__:releaseShardRegistration";
1544
1587
  readonly replayQueueMessage: "__lunora_admin__:replayQueueMessage";
1588
+ readonly retryOutboxEntry: "__lunora_admin__:retryOutboxEntry";
1545
1589
  readonly resolveIssue: "__lunora_admin__:resolveIssue";
1546
1590
  readonly rlsPolicies: "__lunora_admin__:rlsPolicies";
1547
1591
  readonly schemaHistory: "__lunora_admin__:schemaHistory";
@@ -2741,4 +2785,4 @@ declare const backfillVectorIndexes: (sql: SqlExec, targets: ReadonlyArray<Vecto
2741
2785
  ordered: OrderedAfterWrites;
2742
2786
  restart?: boolean;
2743
2787
  }) => Promise<VectorBackfillProgress>;
2744
- export { ADMIN_FUNCTIONS, ADMIN_FUNCTION_PREFIX, AGGREGATE_SQL_FUNCTION, AGG_COUNT, AGG_KEY, AGG_VALUE, AUDIT_LOG_TABLE, type AdvisorProcedure, type AdvisorProceduresResult, type AdvisoriesResult, type AdvisoryFinding, type AggregateIndexDefinitionLike, type AggregateOp, type AggregateOptions, type AggregateResult, type AggregateTally, type AppendAuditEntry, type ApplyOnDeleteOptions, type AuditEntry, type AuditLogResult, BIGINT_KEY_DIGITS, type BroadcastDelta, CDC_LOG_TABLE, CDC_LOG_TABLE_SEQ_INDEX, CDC_META_TABLE, CLIENT_WATERMARK_TABLE, COMMIT_SEQ_FIELD, COMMIT_SEQ_TABLE, CURSOR_PREFIX, type CacheEntry, type CapturedMailRow, type CdcArchiveScope, type CdcChange, type CdcChangeKey, type ChangedKeys, type Clock, type ColumnMeta, type ColumnMetaLike, CompanionMemo, type CompanionSync, type CompanionSyncDeps, ConflictError, type ConflictKind, type CountArgs, CountRlsUnsupportedError, type CreateWorkflowInstanceResult, type CrossShardReadArgs, type CtxDbOptions, DATA_MIGRATION_STATE_TABLE, DEFAULT_FANOUT_TOPIC_LIMIT, DEFAULT_MAX_RELATION_KEYS, DEFAULT_MAX_RELAYS, DEFAULT_PROMOTION_THRESHOLDS, DEFAULT_TRANSACTION_LIMITS, DOC_COLUMN, type DataMigrationDocument, type DataMigrationLike, type DataMigrationTransform, type DatabaseWriterLike, type DependencyTracker, type DeployInfo, type DurableAttachDecision, type DurableStreamAttach, type DurableStreamRun, DurableStreamRunner, type DurableStreamSink, type ExportRow, type ExportShardAdminArgs, type ExportShardArgs, type ExternalSourceDiffResult, type ExternalSourceLike, FLAGS_FUNCTION_PREFIX, type FacetColumnOptions, type FacetColumnResult, type FacetValue, type FanOutBudget, type FanoutMetricsResult, type FanoutPathCounters, type FanoutTopicStat, type FieldOperators, type FilterClause, type FilterOperator, type FlagEvaluation, type FlagsResult, type FtsWriteOptions, type FunctionCallStat, type FunctionScanAttribution, type FunctionStatsResult, GEO_DEFAULT_PRECISION, GLOBAL_SHAPE_SNAPSHOT_TABLE, type GeoBoundingBox, type GeoFilterBuilderLike, type GeoIndexDefinitionLike, type GeoPoint, type GeoScoredDocument, type GlobalPollCounters, GlobalPollTick, type GroupByEntry, type GroupByOptions, type GuardableSchema$1 as GuardableSchema, IDEMPOTENCY_TABLE, type IdGenerator, type IdempotentRecord, type ImportConflictMode, type ImportError, type ImportRow, type ImportShardAdminArgs, type ImportShardArgs, type ImportShardResult, type IncrementalMaterializeResult, type IndexDefinitionLike, type IndexKeyEntry, type IndexRangeBuilderLike, type KeyRange, type KeyedRelationWriteInfo, type LifecycleDispatchInfo, type LifecycleEvent, type LiveSocketControlCall, MAIL_RETENTION, MAIL_TABLE, MAX_DURABLE_STREAM_BYTES, MAX_DURABLE_STREAM_CHUNKS, MAX_PAGE_SIZE, MAX_SQL_ROWS, type MaskColumnMetadata, type MaskPoliciesResult, type MaterializeResult, type MigrationDirection, type MigrationRunResult, type MigrationStatus, type MigrationStatusRow, type MutationDelta, type NestedWith, NotFoundError, NotUniqueError, type NullPlacement, type OnDeleteActionLike, type OrderByClause, type OrderByInput, type OrderKey, type OrderKeyConstraints, OwnerRelay, type OwnerRelayFrame, type PaginationOptions, type PatchVerifier, type PatchWriteOptions, type PitrBookmarkResult, type PitrRestoreArgs, type PitrRestoreResult, type PitrStorage, type PokeFrameMeta, type PromotionState, type PromotionThresholds, QUEUE_TABLE, type QueryArgs, type QueryPage, type QueryPlan, type QueueMessageOutcome, type QueueMessageRow, type QueueMetadata, type QueuesResult, RANK_TIEBREAK, REACTOR_STATE_TABLE, RELATED_DEFAULT_LIMIT, RELATED_DEPTH_DECAY, RELATED_MAX_DEPTH, RELATED_MAX_LIMIT, RELATION_EXISTS_KEY, RELATION_FUNCTION_PREFIX, RELAY_SIGNATURE_HEADER, REPROJECTION_MIGRATION_PREFIX, RLS_UNWRAP_SYMBOL, type RangeOperandType, type RankBeforeOptions, type RankBeforeResult, type RankDirection, type RankIndexDefinitionLike, type RankOptions, type RankPage, type RankPageComputation, type RankPageDeps, type RankPageOptions, type RankPageRow, type RankPageRowKey, type RankResult, type RankSortKeyLike, ReactiveCache, type ReactiveCacheOptions, type ReactorDispatchResult, type ReactorMetadata, type ReactorState, type ReactorStats, type ReactorsResult, type ReadFootprint, type ReadHook, type ReadTablePageOptions, type RecordMailInput, type RecordQueueMessageInput, type RelatedDirection, type RelatedNode, type RelatedOptions, type RelatedPage, type RelatedStart, type RelatedStartReference, type RelationDefinitionLike, type RelationEdge, type RelationExistsMarker, type RelationGraphReader, type RelationWriteInfo, type RelationWriteMap, type RelayAttach, type RelayDetach, type RelayFrame, type RelayHost, RelayMember, type RelayPokeDelivery, type RelayRoomEvent, type RelayRoomVerdict, type RelayShapePoke, type RelayShapeSeed, type RelayShapeSubscribe, type RelayShapeUnsubscribe, type RenderedSql, type ReplicaFollowerHost, type ReplicaOwnerHost, type ReplicaReadiness, type ResolveRelationPredicatesOptions, type ResolveWithOptions, type ResolveWithResult, type ResolvedShape, type RestrictableQueryOptions, type RlsPoliciesResult, type RlsPolicyMetadata, RlsRequiredError, type RlsRoleMetadata, type RpcRequest, type RunDataMigrationOptions, type RunTriggersOptions, SCAN_DEP, SCHEDULE_OUTBOX_TABLE, SCHEMA_HISTORY_MAX_VERSIONS, SEARCH_STATE_TABLE, SHAPE_POKE_CURSOR_TABLE, type SchedulableWorkflowReferenceLike, type ScheduleOutbox, type ScheduleOutboxEnvelope, type ScheduleOutboxRow, type ScheduledFunctionDoc, type SchedulerLike, type SchemaLike, type ScoredDocument, type SearchBackfillProgress, type SearchFilterBuilderLike, type SearchIndexDefinitionLike, type SearchScoredDocument, type SelectMatchingIdsOptions, type ServerDefaultContextLike, type SettingEntry, type SettingKind, type SettingsResult, ShapeDiffCache, type ShapePokeCursorRow, type ShapePokePart, type ShapeProbeCounters, type ShapeRow, type ShapeRowOp, type ShapeSubscriptionQuery, type ShardRankPageResult, ShardRunner, type ShardRunnerOptions, type ShardSiblingHost, type ShardSocketLike, type SocketAttachment, type SortDirection, type SourceClientLike, type SourceCursorLike, type SourceRefresh, type SqlConsoleResult, type SqlCursor, type SqlEngine, type SqlExec, type SqlLintResult, type StorageMetadata, type StorageReference, type StorageReferenceResult, type StorageRuleMetadata, type StorageRulesResult, type StudioFeaturesResult, type SubscriptionConnection, type SubscriptionEnvelope, type SubscriptionIdentity, type SubscriptionInfo, type SubscriptionQuery, type SubscriptionReadFootprint, type SubscriptionsResult, type SystemDatabaseReader, type SystemDoc, type SystemQuery, type SystemReaderOptions, type SystemReaderSchedulerLike, type SystemReaderStorageLike, type SystemTableName, type TableColumnsResult, type TableDefinitionLike, type TableIndexInfo, type TableIndexesResult, type TableInfo, type TablePage, type TableReaderLike, type TablesColumnsResult, type TablesIndexesResult, type ThroughRelationWriteInfo, type TransactionHeadroom, TransactionHeadroomTracker, type TransactionLimits, type TransactionSqlLike, type TriggerContextLike, type TriggerDefinitionLike, type TriggerEventLike, type TriggerOpLike, type TriggerTimingLike, type TtlSweepSpec, UNVOUCHABLE_DEP, VECTOR_BACKFILL_MAX_PAGES, type ValidatorLike, type VectorBackfillProgress, WORKERD_SQLITE_LIMITS, type WhereFilter, type WhereInput, type WhereSqlStrategy, type WithInput, type WorkflowInstanceState, type WorkflowInstanceStatusResult, type WorkflowMetadata, type WorkflowsResult, type WriteEvent, type WriteHook, advanceClientWatermark, aggUpsertSql, aggregateSqlFunction, aggregateTableName, allocateCommitSeq, appendAuditEntry, appendCdcChange, appendStreamChunk, applyCdcChanges, applyInsertDefaults, applyOnDelete, applySelect, archiveCdcSegment, armRestore, assertFlatPredicate, assertNoExplicitUndefined, assertPatchAllowed, assertReadonly, assertShapeShardable, assertStorableRowId, assertValidClientId, awaitWsDrain, backfillAggregateIndexes, backfillRankIndexes, backfillSearchIndexes, backfillSearchIndexesForTable, backfillVectorIndexes, bigintSqlKey, boundingBoxCenter, boundingBoxGeohashes, buildIndexRange, buildPokeFrames, buildReprojectionMigration, buildSeekBeforeWhere, buildSeekWhere, buildSettings, buildShapeDiff, bumpCdcEpoch, cdcArchiveRewound, cdcCanVouchFor, cdcForkedError, cdcSeqLeavingRows, cdcTouchesTables, cdcTrimmedError, claimStreamRun, clampPromotionThresholds, clearCapturedMail, clearCompanionSignatures, clearMemoryTables, clearQueueMessages, coerceAggregateNumber, compactCdcDocs, compileWhereSql, composeReadPredicate, computeRankPage, containsRelationPredicate, countLegacyRows, coveringGeohashes, createCompanionSync, createDependencyTracker, createFanoutCounters, createGlobalPollCounters, createIndexSql, createReadFootprint, createRelayLink, createReplicaLink, createShapeDiffCache, createShapeProbeCounters, createShardCtxDb, createSystemReader, cursorBelowRetainedFloor, decideDurableAttach, decodeBigintSqlKey, decodeCursor, decodeFloat64SqlKey, deferScheduleOutbox, deleteGlobalShapeSnapshot, deleteGlobalShapeSnapshotsForConnection, deleteShapePokeCursor, deleteShapePokeCursorsForConnection, deleteStreamRun, depKey, deriveRelationEdges, describeRelationWrites, diffExternalSource, diffGlobalMembership, distinctValues, encodeAggregateKey, encodeCursor, encodeGeohash, encodePartitionKey, encodeRowsPatch, ensureAuditTable, ensureMailTable, envOptionalPositiveInt, envPositiveInt, equalityPinnedFields, exportShardRows, facetColumn, fanOutScalarCounts, findRelated, findStorageReferences, finishStreamRun, float64SqlKey, foldAggregateTally, forgetScheduleOutbox, ftsCompanionDdl, ftsPurgeDocument, ftsRowidMapName, ftsUnmappedPage, ftsWriteDocument, gateReplicaDispatch, geoTableName, globalShapeReadKey, groupUnmappedRows, guardWriter, handleReplicaControl, hasTrigger, haversineMeters, importShardRows, indexKeysForRow, isDevEnvironment, isFtsAvailable, isInternalTableName, isLossyBody, isMemoryTable, isPushableWhere, isRelationPredicate, isSoftDeleted, isSourceDue, isTtlExpired, isVacuousFilterClause, jsonPath, jsonPathSql, keysTouchRanges, liftSourceId, lintReadonlySql, listReactorStates, listTables, markUnvouchableReads, matchesRankStaticWhere, matchesStaticWhere, materializeExternalRows, materializeExternalRowsIncremental, memoryTableNames, mergeChangedKeys, mergeWhere, migrateCdcLog, migrateCdcMeta, migrateClientWatermark, migrateCommitSeq, migrateDurableStreams, migrateGlobalShapeSnapshot, migrateIdempotency, migrateReactorState, migrateScheduleOutbox, migrateSearchState, migrateShapePokeCursor, minCdcReplayableSeq, minCdcSeq, minShapePokeCursor, nextPromotionState, nextTtlExpiry, normalizeCountArgument, normalizeIdStructurally, normalizeOrderKeys, normalizeSourceDocument, normalizeSourceValue, nullsFirstOf, nullsOrderSuffix, operatorFields, param, parkScheduleOutbox, parseExportShardArgs, parseImportShardArgs, patchDependsOnRow, planAggregateLookup, pointInBoundingBox, probeScheduleOutbox, projectColumns, pullExternalSourceIncrementalTick, pullExternalSourceTick, qualifiedJsonPath, qualifiedJsonPathSql, quoteIdentifier, rankKeyFromDocument as rankKeyFromDoc, rankPivotConditionSql, rankTableName, reactiveCacheKey, reactorNeedsRun, readAggregateValue, readArchivedCdcChanges, readAuditLog, readBookmark, readCapturedMail, readCdcArchivedThrough, readCdcChangeKeys, readCdcChanges, readCdcCursor, readCdcEpoch, readClientWatermark, readCommitSeq, readDeployInfo, readDueScheduleOutbox, readExternalSourceBaseline, readGlobalShapeSnapshot, readIdempotent, readMigrationStatus, readPatchField, readQueueMessageById, readQueueMessages, readReactorState, readSchemaHistory, readSchemaVersion, readSearchBackfillState, readShapePokeCursor, readStreamChunks, readStreamRun, readTablePage, recordCapturedMail, recordChangedKeys, recordFanoutPass, recordGlobalPollPass, recordQueueMessages, recordScheduleOutbox, recordSchemaVersion, recordShapeProbePass, relationHooks, relayCountFor, renderSql, reprojectableFields, reprojectionMigrationId, reprojectionTables, resolvePatch, resolveRankPartition, resolveRankSeekTuple, resolveRelationPredicates, resolveWith, rowToDocument, runDataMigration, runDrizzle, runExternalSourceTick, runReadonlySql, runRowValidators, runShardMigrations, runSocketPool, runSql, runTriggers, selectExpiredIds, selectExportTables, selectIndexForAggregate, selectIndexForCount, selectIndexForGroupBy, selectMatchingIds, selectShapeMembers, selectShapeRows, serializeSqlValue, serverInList, shapeRoutingKey, siblingSecretOf, signSiblingBody, softDeleteScope, sortColumnName, sqliteInList, stripReservedPatchFields, stubByName, subscriptionFrames, subscriptionListDeltas, summarizeFanoutTopics, summarizeSubscriptions, tableColumns, tableFromDepKey, throwingScheduler, tiebreakDirectionFor, trimCdcChanges, trimIdempotent, trimScheduleOutbox, trimStreamRuns, tryRowToDocument, trySendFrame, unionAll, uniqueIndexFields, validateImportRow, verifySiblingBody, whereFilter, whereOfFilter, writeCdcArchivedThrough, writeGlobalShapeSnapshot, writeIdempotent, writeReactorState, writeSearchBackfillState, writeShapePokeCursor, writeShapePokeCursors, writeTouchesMemo };
2788
+ export { ADMIN_FUNCTIONS, ADMIN_FUNCTION_PREFIX, AGGREGATE_SQL_FUNCTION, AGG_COUNT, AGG_KEY, AGG_VALUE, AUDIT_LOG_TABLE, type AdvisorProcedure, type AdvisorProceduresResult, type AdvisoriesResult, type AdvisoryFinding, type AggregateIndexDefinitionLike, type AggregateOp, type AggregateOptions, type AggregateResult, type AggregateTally, type AppendAuditEntry, type ApplyOnDeleteOptions, type AuditEntry, type AuditLogResult, BIGINT_KEY_DIGITS, type BroadcastDelta, CDC_LOG_TABLE, CDC_LOG_TABLE_SEQ_INDEX, CDC_META_TABLE, CLIENT_WATERMARK_TABLE, COMMIT_SEQ_FIELD, COMMIT_SEQ_TABLE, CURSOR_PREFIX, type CacheEntry, type CapturedMailRow, type CdcArchiveScope, type CdcChange, type CdcChangeKey, type ChangedKeys, type Clock, type ColumnMeta, type ColumnMetaLike, CompanionMemo, type CompanionSync, type CompanionSyncDeps, ConflictError, type ConflictKind, type CountArgs, CountRlsUnsupportedError, type CreateWorkflowInstanceResult, type CrossShardReadArgs, type CtxDbOptions, DATA_MIGRATION_STATE_TABLE, DEFAULT_FANOUT_TOPIC_LIMIT, DEFAULT_MAX_RELATION_KEYS, DEFAULT_MAX_RELAYS, DEFAULT_PROMOTION_THRESHOLDS, DEFAULT_TRANSACTION_LIMITS, DOC_COLUMN, type DataMigrationDocument, type DataMigrationLike, type DataMigrationTransform, type DatabaseWriterLike, type DependencyTracker, type DeployInfo, type DurableAttachDecision, type DurableStreamAttach, type DurableStreamRun, DurableStreamRunner, type DurableStreamSink, type ExportRow, type ExportShardAdminArgs, type ExportShardArgs, type ExternalSourceDiffResult, type ExternalSourceLike, FLAGS_FUNCTION_PREFIX, type FacetColumnOptions, type FacetColumnResult, type FacetValue, type FanOutBudget, type FanoutMetricsResult, type FanoutPathCounters, type FanoutTopicStat, type FieldOperators, type FilterClause, type FilterOperator, type FlagEvaluation, type FlagsResult, type FtsWriteOptions, type FunctionCallStat, type FunctionScanAttribution, type FunctionStatsResult, GEO_DEFAULT_PRECISION, GLOBAL_SHAPE_SNAPSHOT_TABLE, type GeoBoundingBox, type GeoFilterBuilderLike, type GeoIndexDefinitionLike, type GeoPoint, type GeoScoredDocument, type GlobalPollCounters, GlobalPollTick, type GroupByEntry, type GroupByOptions, type GuardableSchema$1 as GuardableSchema, IDEMPOTENCY_TABLE, type IdGenerator, type IdempotentRecord, type ImportConflictMode, type ImportError, type ImportRow, type ImportShardAdminArgs, type ImportShardArgs, type ImportShardResult, type IncrementalMaterializeResult, type IndexDefinitionLike, type IndexKeyEntry, type IndexRangeBuilderLike, type KeyRange, type KeyedRelationWriteInfo, type LifecycleDispatchInfo, type LifecycleEvent, type LiveSocketControlCall, MAIL_RETENTION, MAIL_TABLE, MAX_DURABLE_STREAM_BYTES, MAX_DURABLE_STREAM_CHUNKS, MAX_PAGE_SIZE, MAX_SQL_ROWS, type MaskColumnMetadata, type MaskPoliciesResult, type MaterializeResult, type MigrationDirection, type MigrationRunResult, type MigrationStatus, type MigrationStatusRow, type MutationDelta, type NestedWith, NotFoundError, NotUniqueError, type NullPlacement, type OnDeleteActionLike, type OrderByClause, type OrderByInput, type OrderKey, type OrderKeyConstraints, OwnerRelay, type OwnerRelayFrame, type PaginationOptions, type PatchVerifier, type PatchWriteOptions, type PitrBookmarkResult, type PitrRestoreArgs, type PitrRestoreResult, type PitrStorage, type PokeFrameMeta, type PromotionState, type PromotionThresholds, QUEUE_TABLE, type QueryArgs, type QueryPage, type QueryPlan, type QueueMessageOutcome, type QueueMessageRow, type QueueMetadata, type QueuesResult, RANK_TIEBREAK, REACTOR_STATE_TABLE, RELATED_DEFAULT_LIMIT, RELATED_DEPTH_DECAY, RELATED_MAX_DEPTH, RELATED_MAX_LIMIT, RELATION_EXISTS_KEY, RELATION_FUNCTION_PREFIX, RELAY_SIGNATURE_HEADER, REPROJECTION_MIGRATION_PREFIX, RLS_UNWRAP_SYMBOL, type RangeOperandType, type RankBeforeOptions, type RankBeforeResult, type RankDirection, type RankIndexDefinitionLike, type RankOptions, type RankPage, type RankPageComputation, type RankPageDeps, type RankPageOptions, type RankPageRow, type RankPageRowKey, type RankResult, type RankSortKeyLike, ReactiveCache, type ReactiveCacheOptions, type ReactorDispatchResult, type ReactorMetadata, type ReactorState, type ReactorStats, type ReactorsResult, type ReadFootprint, type ReadHook, type ReadTablePageOptions, type RecordMailInput, type RecordQueueMessageInput, type RelatedDirection, type RelatedNode, type RelatedOptions, type RelatedPage, type RelatedStart, type RelatedStartReference, type RelationDefinitionLike, type RelationEdge, type RelationExistsMarker, type RelationGraphReader, type RelationWriteInfo, type RelationWriteMap, type RelayAttach, type RelayDetach, type RelayFrame, type RelayHost, RelayMember, type RelayPokeDelivery, type RelayRoomEvent, type RelayRoomVerdict, type RelayShapePoke, type RelayShapeSeed, type RelayShapeSubscribe, type RelayShapeUnsubscribe, type RenderedSql, type ReplicaFollowerHost, type ReplicaOwnerHost, type ReplicaReadiness, type ResolveRelationPredicatesOptions, type ResolveWithOptions, type ResolveWithResult, type ResolvedShape, type RestrictableQueryOptions, type RlsPoliciesResult, type RlsPolicyMetadata, RlsRequiredError, type RlsRoleMetadata, type RpcRequest, type RunDataMigrationOptions, type RunTriggersOptions, SCAN_DEP, SCHEDULE_OUTBOX_TABLE, SCHEMA_HISTORY_MAX_VERSIONS, SEARCH_STATE_TABLE, SHAPE_POKE_CURSOR_TABLE, type SchedulableWorkflowReferenceLike, type ScheduleOutbox, type ScheduleOutboxEntry, type ScheduleOutboxEnvelope, type ScheduleOutboxRow, type ScheduledFunctionDoc, type SchedulerLike, type SchemaLike, type ScoredDocument, type SearchBackfillProgress, type SearchFilterBuilderLike, type SearchIndexDefinitionLike, type SearchScoredDocument, type SelectMatchingIdsOptions, type ServerDefaultContextLike, type SettingEntry, type SettingKind, type SettingsResult, ShapeDiffCache, type ShapePokeCursorRow, type ShapePokePart, type ShapeProbeCounters, type ShapeRow, type ShapeRowOp, type ShapeSubscriptionQuery, type ShardRankPageResult, ShardRunner, type ShardRunnerOptions, type ShardSiblingHost, type ShardSocketLike, type SocketAttachment, type SortDirection, type SourceClientLike, type SourceCursorLike, type SourceRefresh, type SqlConsoleResult, type SqlCursor, type SqlEngine, type SqlExec, type SqlLintResult, type StorageMetadata, type StorageReference, type StorageReferenceResult, type StorageRuleMetadata, type StorageRulesResult, type StudioFeaturesResult, type SubscriptionConnection, type SubscriptionEnvelope, type SubscriptionIdentity, type SubscriptionInfo, type SubscriptionQuery, type SubscriptionReadFootprint, type SubscriptionsResult, type SystemDatabaseReader, type SystemDoc, type SystemQuery, type SystemReaderOptions, type SystemReaderSchedulerLike, type SystemReaderStorageLike, type SystemTableName, type TableColumnsResult, type TableDefinitionLike, type TableIndexInfo, type TableIndexesResult, type TableInfo, type TablePage, type TableReaderLike, type TablesColumnsResult, type TablesIndexesResult, type ThroughRelationWriteInfo, type TransactionHeadroom, TransactionHeadroomTracker, type TransactionLimitKind, type TransactionLimitWarning, type TransactionLimits, type TransactionSqlLike, type TriggerContextLike, type TriggerDefinitionLike, type TriggerEventLike, type TriggerOpLike, type TriggerTimingLike, type TtlSweepSpec, UNVOUCHABLE_DEP, VECTOR_BACKFILL_MAX_PAGES, type ValidatorLike, type VectorBackfillProgress, WORKERD_SQLITE_LIMITS, type WhereFilter, type WhereInput, type WhereSqlStrategy, type WithInput, type WorkflowInstanceState, type WorkflowInstanceStatusResult, type WorkflowMetadata, type WorkflowsResult, type WriteEvent, type WriteHook, advanceClientWatermark, aggUpsertSql, aggregateSqlFunction, aggregateTableName, allocateCommitSeq, appendAuditEntry, appendCdcChange, appendStreamChunk, applyCdcChanges, applyInsertDefaults, applyOnDelete, applySelect, archiveCdcSegment, armRestore, assertFlatPredicate, assertNoExplicitUndefined, assertPatchAllowed, assertReadonly, assertShapeShardable, assertStorableRowId, assertValidClientId, awaitWsDrain, backfillAggregateIndexes, backfillRankIndexes, backfillSearchIndexes, backfillSearchIndexesForTable, backfillVectorIndexes, bigintSqlKey, boundingBoxCenter, boundingBoxGeohashes, buildIndexRange, buildPokeFrames, buildReprojectionMigration, buildSeekBeforeWhere, buildSeekWhere, buildSettings, buildShapeDiff, bumpCdcEpoch, cdcArchiveRewound, cdcCanVouchFor, cdcForkedError, cdcSeqLeavingRows, cdcTouchesTables, cdcTrimmedError, claimStreamRun, clampPromotionThresholds, clearCapturedMail, clearCompanionSignatures, clearMemoryTables, clearQueueMessages, coerceAggregateNumber, compactCdcDocs, compileWhereSql, composeReadPredicate, computeRankPage, containsRelationPredicate, countLegacyRows, coveringGeohashes, createCompanionSync, createDependencyTracker, createFanoutCounters, createGlobalPollCounters, createIndexSql, createReadFootprint, createRelayLink, createReplicaLink, createShapeDiffCache, createShapeProbeCounters, createShardCtxDb, createSystemReader, cursorBelowRetainedFloor, decideDurableAttach, decodeBigintSqlKey, decodeCursor, decodeFloat64SqlKey, deferScheduleOutbox, deleteGlobalShapeSnapshot, deleteGlobalShapeSnapshotsForConnection, deleteShapePokeCursor, deleteShapePokeCursorsForConnection, deleteStreamRun, depKey, deriveRelationEdges, describeRelationWrites, diffExternalSource, diffGlobalMembership, distinctValues, dropScheduleOutbox, 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, hasScheduleOutboxEntry, hasTrigger, haversineMeters, importShardRows, indexKeysForRow, isDevEnvironment, isFtsAvailable, isInternalTableName, isLossyBody, isMemoryTable, isPushableWhere, isRelationPredicate, isSoftDeleted, isSourceDue, isTtlExpired, isVacuousFilterClause, jsonPath, jsonPathSql, keysTouchRanges, liftSourceId, lintReadonlySql, listReactorStates, listTables, markUnvouchableReads, matchesRankStaticWhere, matchesStaticWhere, materializeExternalRows, materializeExternalRowsIncremental, memoryTableNames, mergeChangedKeys, mergeWhere, migrateCdcLog, migrateCdcMeta, migrateClientWatermark, migrateCommitSeq, migrateDurableStreams, migrateGlobalShapeSnapshot, migrateIdempotency, migrateReactorState, migrateScheduleOutbox, migrateSearchState, migrateShapePokeCursor, minCdcReplayableSeq, minCdcSeq, minShapePokeCursor, nextPromotionState, nextTtlExpiry, normalizeCountArgument, normalizeIdStructurally, normalizeOrderKeys, normalizeSourceDocument, normalizeSourceValue, nullsFirstOf, nullsOrderSuffix, operatorFields, param, parkScheduleOutbox, parseExportShardArgs, parseImportShardArgs, patchDependsOnRow, planAggregateLookup, pointInBoundingBox, probeScheduleOutbox, projectColumns, pullExternalSourceIncrementalTick, pullExternalSourceTick, qualifiedJsonPath, qualifiedJsonPathSql, quoteIdentifier, rankKeyFromDocument as rankKeyFromDoc, rankPivotConditionSql, rankTableName, reactiveCacheKey, reactorNeedsRun, readAggregateValue, readArchivedCdcChanges, readAuditLog, readBookmark, readCapturedMail, readCdcArchivedThrough, readCdcChangeKeys, readCdcChanges, readCdcCursor, readCdcEpoch, readClientWatermark, readCommitSeq, readDeployInfo, readDueScheduleOutbox, readDueScheduleOutboxEntry, readExternalSourceBaseline, readGlobalShapeSnapshot, readIdempotent, readMigrationStatus, readPatchField, readQueueMessageById, readQueueMessages, readReactorState, readScheduleOutbox, readScheduleOutboxState, readSchemaHistory, readSchemaVersion, readSearchBackfillState, readShapePokeCursor, readStreamChunks, readStreamRun, readTablePage, recordCapturedMail, recordChangedKeys, recordFanoutPass, recordGlobalPollPass, recordQueueMessages, recordScheduleOutbox, recordSchemaVersion, recordShapeProbePass, relationHooks, relayCountFor, renderSql, reprojectableFields, reprojectionMigrationId, reprojectionTables, requeueScheduleOutbox, resolvePatch, resolveRankPartition, resolveRankSeekTuple, resolveRelationPredicates, resolveWith, rowToDocument, runDataMigration, runDrizzle, runExternalSourceTick, runReadonlySql, runRowValidators, runShardMigrations, runSocketPool, runSql, runTriggers, selectExpiredIds, selectExportTables, selectIndexForAggregate, selectIndexForCount, selectIndexForGroupBy, selectMatchingIds, selectShapeMembers, selectShapeRows, serializeSqlValue, serverInList, shapeRoutingKey, siblingSecretOf, signSiblingBody, softDeleteScope, sortColumnName, sqliteInList, stripReservedPatchFields, stubByName, subscriptionFrames, subscriptionListDeltas, summarizeFanoutTopics, summarizeSubscriptions, tableColumns, tableFromDepKey, throwingScheduler, tiebreakDirectionFor, trimCdcChanges, trimIdempotent, trimScheduleOutbox, trimStreamRuns, tryRowToDocument, trySendFrame, unionAll, uniqueIndexFields, validateImportRow, verifySiblingBody, whereFilter, whereOfFilter, writeCdcArchivedThrough, writeGlobalShapeSnapshot, writeIdempotent, writeReactorState, writeSearchBackfillState, writeShapePokeCursor, writeShapePokeCursors, writeTouchesMemo };
package/dist/index.d.ts CHANGED
@@ -850,28 +850,45 @@ declare class ReactiveCache {
850
850
  }
851
851
  declare const reactiveCacheKey: (functionPath: string, args: Record<string, unknown>, identity: null | string) => string;
852
852
  interface TransactionLimits {
853
+ maxReadBytes: number;
853
854
  maxReadRows: number;
854
855
  maxWrittenBytes: number;
855
856
  maxWrittenRows: number;
856
857
  }
857
858
  interface TransactionHeadroom {
859
+ readBytes: number;
858
860
  readRows: number;
861
+ remainingReadBytes: number;
859
862
  remainingReadRows: number;
860
863
  remainingWrittenBytes: number;
861
864
  remainingWrittenRows: number;
862
865
  writtenBytes: number;
863
866
  writtenRows: number;
864
867
  }
868
+ type TransactionLimitKind = "readBytes" | "readRows" | "writtenBytes" | "writtenRows";
869
+ interface TransactionLimitWarning {
870
+ kind: TransactionLimitKind;
871
+ limit: number;
872
+ used: number;
873
+ }
865
874
  declare const DEFAULT_TRANSACTION_LIMITS: TransactionLimits;
866
875
  declare class TransactionHeadroomTracker {
876
+ private readBytes;
867
877
  private readRows;
868
878
  private writtenRows;
869
879
  private writtenBytes;
870
880
  private readonly limits;
871
- constructor(limits?: Partial<TransactionLimits>);
881
+ private readonly onNearLimit;
882
+ private readonly warned;
883
+ private readonly chargedDocuments;
884
+ constructor(limits?: Partial<TransactionLimits>, onNearLimit?: (warning: TransactionLimitWarning) => void);
872
885
  recordRead(count: number): void;
886
+ recordReadBytes(bytes: number): void;
887
+ recordDocumentRead(key: string, bytes: number): void;
888
+ beginReadWindow(): void;
873
889
  recordWrite(row: unknown): void;
874
890
  headroom(): TransactionHeadroom;
891
+ private check;
875
892
  }
876
893
  interface RunTriggersOptions {
877
894
  ctx: TriggerContextLike;
@@ -1124,6 +1141,16 @@ interface ScheduleOutboxRow {
1124
1141
  id: string;
1125
1142
  nextAttemptAt: number;
1126
1143
  }
1144
+ interface ScheduleOutboxEntry {
1145
+ attempts: number;
1146
+ createdAt: number;
1147
+ forever: boolean;
1148
+ id: string;
1149
+ nextAttemptAt: number;
1150
+ parked: boolean;
1151
+ target: string | undefined;
1152
+ when: number | undefined;
1153
+ }
1127
1154
  interface ScheduleOutboxEnvelope {
1128
1155
  args: unknown;
1129
1156
  options: Record<string, unknown> | undefined;
@@ -1133,20 +1160,34 @@ interface ScheduleOutboxEnvelope {
1133
1160
  interface ScheduleOutbox {
1134
1161
  admit: (target: string) => number | undefined;
1135
1162
  forget: (id: string) => void;
1136
- record: (id: string, envelope: ScheduleOutboxEnvelope) => void;
1163
+ handOff?: (id: string, run: () => Promise<unknown>, token?: string) => Promise<void>;
1164
+ record: (id: string, envelope: ScheduleOutboxEnvelope) => string | undefined;
1137
1165
  wake: () => void;
1138
1166
  }
1139
1167
  declare const migrateScheduleOutbox: (sql: SqlExec) => void;
1140
1168
  declare const recordScheduleOutbox: (sql: SqlExec, id: string, envelopeJson: string, now: number) => void;
1141
1169
  declare const forgetScheduleOutbox: (sql: SqlExec, id: string) => void;
1142
1170
  declare const readDueScheduleOutbox: (sql: SqlExec, nowMs: number, limit: number) => ScheduleOutboxRow[];
1171
+ declare const readDueScheduleOutboxEntry: (sql: SqlExec, id: string, nowMs: number) => ScheduleOutboxRow | undefined;
1143
1172
  declare const deferScheduleOutbox: (sql: SqlExec, id: string, attempts: number, nextAttemptAt: number) => void;
1144
- declare const parkScheduleOutbox: (sql: SqlExec, id: string, attempts: number) => void;
1173
+ declare const parkScheduleOutbox: (sql: SqlExec, id: string, attempts: number, now: number) => void;
1145
1174
  declare const probeScheduleOutbox: (sql: SqlExec) => {
1146
1175
  dueAt: number | undefined;
1147
1176
  populated: boolean;
1148
1177
  };
1149
1178
  declare const trimScheduleOutbox: (sql: SqlExec, olderThanTs: number) => void;
1179
+ declare const readScheduleOutbox: (sql: SqlExec, limit: number, cursor?: string) => {
1180
+ entries: ScheduleOutboxEntry[];
1181
+ nextCursor: string | undefined;
1182
+ };
1183
+ declare const readScheduleOutboxState: (sql: SqlExec, id: string) => {
1184
+ createdAt: number;
1185
+ parked: boolean;
1186
+ version: string;
1187
+ } | undefined;
1188
+ declare const hasScheduleOutboxEntry: (sql: SqlExec, id: string) => boolean;
1189
+ declare const requeueScheduleOutbox: (sql: SqlExec, id: string, now: number) => boolean;
1190
+ declare const dropScheduleOutbox: (sql: SqlExec, id: string) => boolean;
1150
1191
  /**
1151
1192
  * How far a companion's backfill has progressed, and under which analysis.
1152
1193
  * Declared here rather than beside either engine's state table: both record the
@@ -1280,7 +1321,7 @@ declare const aggUpsertSql: (aggTable: string, key: unknown, value: unknown, cou
1280
1321
  declare const tableColumns: (definition: TableDefinitionLike) => ReadonlyArray<readonly [string, ColumnMetaLike]>;
1281
1322
  declare const rowToDocument: (row: Record<string, unknown> | undefined) => Record<string, unknown> | undefined;
1282
1323
  declare const tryRowToDocument: (row: Record<string, unknown> | undefined) => Record<string, unknown> | undefined;
1283
- declare const isFtsAvailable: (sql: SqlExec) => boolean;
1324
+ declare const isFtsAvailable: (wrapper: SqlExec) => boolean;
1284
1325
  declare const WORKERD_SQLITE_LIMITS: {
1285
1326
  readonly boundParams: 100;
1286
1327
  readonly compoundSelect: 5;
@@ -1493,6 +1534,7 @@ declare const ADMIN_FUNCTIONS: {
1493
1534
  readonly deleteRows: "__lunora_admin__:deleteRows";
1494
1535
  readonly describeTable: "__lunora_admin__:describeTable";
1495
1536
  readonly describeTables: "__lunora_admin__:describeTables";
1537
+ readonly dropOutboxEntry: "__lunora_admin__:dropOutboxEntry";
1496
1538
  readonly explainIssue: "__lunora_admin__:explainIssue";
1497
1539
  readonly exportShard: "__lunora_admin__:exportShard";
1498
1540
  readonly facetColumn: "__lunora_admin__:facetColumn";
@@ -1507,6 +1549,7 @@ declare const ADMIN_FUNCTIONS: {
1507
1549
  readonly getIssues: "__lunora_admin__:getIssues";
1508
1550
  readonly getMetricHistory: "__lunora_admin__:getMetricHistory";
1509
1551
  readonly getMetricSeries: "__lunora_admin__:getMetricSeries";
1552
+ readonly getScheduleOutbox: "__lunora_admin__:getScheduleOutbox";
1510
1553
  readonly listSubscriptions: "__lunora_admin__:listSubscriptions";
1511
1554
  readonly listTableIndexes: "__lunora_admin__:listTableIndexes";
1512
1555
  readonly listTablesIndexes: "__lunora_admin__:listTablesIndexes";
@@ -1542,6 +1585,7 @@ declare const ADMIN_FUNCTIONS: {
1542
1585
  readonly recordQueueMessage: "__lunora_admin__:recordQueueMessage";
1543
1586
  readonly releaseShardRegistration: "__lunora_admin__:releaseShardRegistration";
1544
1587
  readonly replayQueueMessage: "__lunora_admin__:replayQueueMessage";
1588
+ readonly retryOutboxEntry: "__lunora_admin__:retryOutboxEntry";
1545
1589
  readonly resolveIssue: "__lunora_admin__:resolveIssue";
1546
1590
  readonly rlsPolicies: "__lunora_admin__:rlsPolicies";
1547
1591
  readonly schemaHistory: "__lunora_admin__:schemaHistory";
@@ -2741,4 +2785,4 @@ declare const backfillVectorIndexes: (sql: SqlExec, targets: ReadonlyArray<Vecto
2741
2785
  ordered: OrderedAfterWrites;
2742
2786
  restart?: boolean;
2743
2787
  }) => Promise<VectorBackfillProgress>;
2744
- export { ADMIN_FUNCTIONS, ADMIN_FUNCTION_PREFIX, AGGREGATE_SQL_FUNCTION, AGG_COUNT, AGG_KEY, AGG_VALUE, AUDIT_LOG_TABLE, type AdvisorProcedure, type AdvisorProceduresResult, type AdvisoriesResult, type AdvisoryFinding, type AggregateIndexDefinitionLike, type AggregateOp, type AggregateOptions, type AggregateResult, type AggregateTally, type AppendAuditEntry, type ApplyOnDeleteOptions, type AuditEntry, type AuditLogResult, BIGINT_KEY_DIGITS, type BroadcastDelta, CDC_LOG_TABLE, CDC_LOG_TABLE_SEQ_INDEX, CDC_META_TABLE, CLIENT_WATERMARK_TABLE, COMMIT_SEQ_FIELD, COMMIT_SEQ_TABLE, CURSOR_PREFIX, type CacheEntry, type CapturedMailRow, type CdcArchiveScope, type CdcChange, type CdcChangeKey, type ChangedKeys, type Clock, type ColumnMeta, type ColumnMetaLike, CompanionMemo, type CompanionSync, type CompanionSyncDeps, ConflictError, type ConflictKind, type CountArgs, CountRlsUnsupportedError, type CreateWorkflowInstanceResult, type CrossShardReadArgs, type CtxDbOptions, DATA_MIGRATION_STATE_TABLE, DEFAULT_FANOUT_TOPIC_LIMIT, DEFAULT_MAX_RELATION_KEYS, DEFAULT_MAX_RELAYS, DEFAULT_PROMOTION_THRESHOLDS, DEFAULT_TRANSACTION_LIMITS, DOC_COLUMN, type DataMigrationDocument, type DataMigrationLike, type DataMigrationTransform, type DatabaseWriterLike, type DependencyTracker, type DeployInfo, type DurableAttachDecision, type DurableStreamAttach, type DurableStreamRun, DurableStreamRunner, type DurableStreamSink, type ExportRow, type ExportShardAdminArgs, type ExportShardArgs, type ExternalSourceDiffResult, type ExternalSourceLike, FLAGS_FUNCTION_PREFIX, type FacetColumnOptions, type FacetColumnResult, type FacetValue, type FanOutBudget, type FanoutMetricsResult, type FanoutPathCounters, type FanoutTopicStat, type FieldOperators, type FilterClause, type FilterOperator, type FlagEvaluation, type FlagsResult, type FtsWriteOptions, type FunctionCallStat, type FunctionScanAttribution, type FunctionStatsResult, GEO_DEFAULT_PRECISION, GLOBAL_SHAPE_SNAPSHOT_TABLE, type GeoBoundingBox, type GeoFilterBuilderLike, type GeoIndexDefinitionLike, type GeoPoint, type GeoScoredDocument, type GlobalPollCounters, GlobalPollTick, type GroupByEntry, type GroupByOptions, type GuardableSchema$1 as GuardableSchema, IDEMPOTENCY_TABLE, type IdGenerator, type IdempotentRecord, type ImportConflictMode, type ImportError, type ImportRow, type ImportShardAdminArgs, type ImportShardArgs, type ImportShardResult, type IncrementalMaterializeResult, type IndexDefinitionLike, type IndexKeyEntry, type IndexRangeBuilderLike, type KeyRange, type KeyedRelationWriteInfo, type LifecycleDispatchInfo, type LifecycleEvent, type LiveSocketControlCall, MAIL_RETENTION, MAIL_TABLE, MAX_DURABLE_STREAM_BYTES, MAX_DURABLE_STREAM_CHUNKS, MAX_PAGE_SIZE, MAX_SQL_ROWS, type MaskColumnMetadata, type MaskPoliciesResult, type MaterializeResult, type MigrationDirection, type MigrationRunResult, type MigrationStatus, type MigrationStatusRow, type MutationDelta, type NestedWith, NotFoundError, NotUniqueError, type NullPlacement, type OnDeleteActionLike, type OrderByClause, type OrderByInput, type OrderKey, type OrderKeyConstraints, OwnerRelay, type OwnerRelayFrame, type PaginationOptions, type PatchVerifier, type PatchWriteOptions, type PitrBookmarkResult, type PitrRestoreArgs, type PitrRestoreResult, type PitrStorage, type PokeFrameMeta, type PromotionState, type PromotionThresholds, QUEUE_TABLE, type QueryArgs, type QueryPage, type QueryPlan, type QueueMessageOutcome, type QueueMessageRow, type QueueMetadata, type QueuesResult, RANK_TIEBREAK, REACTOR_STATE_TABLE, RELATED_DEFAULT_LIMIT, RELATED_DEPTH_DECAY, RELATED_MAX_DEPTH, RELATED_MAX_LIMIT, RELATION_EXISTS_KEY, RELATION_FUNCTION_PREFIX, RELAY_SIGNATURE_HEADER, REPROJECTION_MIGRATION_PREFIX, RLS_UNWRAP_SYMBOL, type RangeOperandType, type RankBeforeOptions, type RankBeforeResult, type RankDirection, type RankIndexDefinitionLike, type RankOptions, type RankPage, type RankPageComputation, type RankPageDeps, type RankPageOptions, type RankPageRow, type RankPageRowKey, type RankResult, type RankSortKeyLike, ReactiveCache, type ReactiveCacheOptions, type ReactorDispatchResult, type ReactorMetadata, type ReactorState, type ReactorStats, type ReactorsResult, type ReadFootprint, type ReadHook, type ReadTablePageOptions, type RecordMailInput, type RecordQueueMessageInput, type RelatedDirection, type RelatedNode, type RelatedOptions, type RelatedPage, type RelatedStart, type RelatedStartReference, type RelationDefinitionLike, type RelationEdge, type RelationExistsMarker, type RelationGraphReader, type RelationWriteInfo, type RelationWriteMap, type RelayAttach, type RelayDetach, type RelayFrame, type RelayHost, RelayMember, type RelayPokeDelivery, type RelayRoomEvent, type RelayRoomVerdict, type RelayShapePoke, type RelayShapeSeed, type RelayShapeSubscribe, type RelayShapeUnsubscribe, type RenderedSql, type ReplicaFollowerHost, type ReplicaOwnerHost, type ReplicaReadiness, type ResolveRelationPredicatesOptions, type ResolveWithOptions, type ResolveWithResult, type ResolvedShape, type RestrictableQueryOptions, type RlsPoliciesResult, type RlsPolicyMetadata, RlsRequiredError, type RlsRoleMetadata, type RpcRequest, type RunDataMigrationOptions, type RunTriggersOptions, SCAN_DEP, SCHEDULE_OUTBOX_TABLE, SCHEMA_HISTORY_MAX_VERSIONS, SEARCH_STATE_TABLE, SHAPE_POKE_CURSOR_TABLE, type SchedulableWorkflowReferenceLike, type ScheduleOutbox, type ScheduleOutboxEnvelope, type ScheduleOutboxRow, type ScheduledFunctionDoc, type SchedulerLike, type SchemaLike, type ScoredDocument, type SearchBackfillProgress, type SearchFilterBuilderLike, type SearchIndexDefinitionLike, type SearchScoredDocument, type SelectMatchingIdsOptions, type ServerDefaultContextLike, type SettingEntry, type SettingKind, type SettingsResult, ShapeDiffCache, type ShapePokeCursorRow, type ShapePokePart, type ShapeProbeCounters, type ShapeRow, type ShapeRowOp, type ShapeSubscriptionQuery, type ShardRankPageResult, ShardRunner, type ShardRunnerOptions, type ShardSiblingHost, type ShardSocketLike, type SocketAttachment, type SortDirection, type SourceClientLike, type SourceCursorLike, type SourceRefresh, type SqlConsoleResult, type SqlCursor, type SqlEngine, type SqlExec, type SqlLintResult, type StorageMetadata, type StorageReference, type StorageReferenceResult, type StorageRuleMetadata, type StorageRulesResult, type StudioFeaturesResult, type SubscriptionConnection, type SubscriptionEnvelope, type SubscriptionIdentity, type SubscriptionInfo, type SubscriptionQuery, type SubscriptionReadFootprint, type SubscriptionsResult, type SystemDatabaseReader, type SystemDoc, type SystemQuery, type SystemReaderOptions, type SystemReaderSchedulerLike, type SystemReaderStorageLike, type SystemTableName, type TableColumnsResult, type TableDefinitionLike, type TableIndexInfo, type TableIndexesResult, type TableInfo, type TablePage, type TableReaderLike, type TablesColumnsResult, type TablesIndexesResult, type ThroughRelationWriteInfo, type TransactionHeadroom, TransactionHeadroomTracker, type TransactionLimits, type TransactionSqlLike, type TriggerContextLike, type TriggerDefinitionLike, type TriggerEventLike, type TriggerOpLike, type TriggerTimingLike, type TtlSweepSpec, UNVOUCHABLE_DEP, VECTOR_BACKFILL_MAX_PAGES, type ValidatorLike, type VectorBackfillProgress, WORKERD_SQLITE_LIMITS, type WhereFilter, type WhereInput, type WhereSqlStrategy, type WithInput, type WorkflowInstanceState, type WorkflowInstanceStatusResult, type WorkflowMetadata, type WorkflowsResult, type WriteEvent, type WriteHook, advanceClientWatermark, aggUpsertSql, aggregateSqlFunction, aggregateTableName, allocateCommitSeq, appendAuditEntry, appendCdcChange, appendStreamChunk, applyCdcChanges, applyInsertDefaults, applyOnDelete, applySelect, archiveCdcSegment, armRestore, assertFlatPredicate, assertNoExplicitUndefined, assertPatchAllowed, assertReadonly, assertShapeShardable, assertStorableRowId, assertValidClientId, awaitWsDrain, backfillAggregateIndexes, backfillRankIndexes, backfillSearchIndexes, backfillSearchIndexesForTable, backfillVectorIndexes, bigintSqlKey, boundingBoxCenter, boundingBoxGeohashes, buildIndexRange, buildPokeFrames, buildReprojectionMigration, buildSeekBeforeWhere, buildSeekWhere, buildSettings, buildShapeDiff, bumpCdcEpoch, cdcArchiveRewound, cdcCanVouchFor, cdcForkedError, cdcSeqLeavingRows, cdcTouchesTables, cdcTrimmedError, claimStreamRun, clampPromotionThresholds, clearCapturedMail, clearCompanionSignatures, clearMemoryTables, clearQueueMessages, coerceAggregateNumber, compactCdcDocs, compileWhereSql, composeReadPredicate, computeRankPage, containsRelationPredicate, countLegacyRows, coveringGeohashes, createCompanionSync, createDependencyTracker, createFanoutCounters, createGlobalPollCounters, createIndexSql, createReadFootprint, createRelayLink, createReplicaLink, createShapeDiffCache, createShapeProbeCounters, createShardCtxDb, createSystemReader, cursorBelowRetainedFloor, decideDurableAttach, decodeBigintSqlKey, decodeCursor, decodeFloat64SqlKey, deferScheduleOutbox, deleteGlobalShapeSnapshot, deleteGlobalShapeSnapshotsForConnection, deleteShapePokeCursor, deleteShapePokeCursorsForConnection, deleteStreamRun, depKey, deriveRelationEdges, describeRelationWrites, diffExternalSource, diffGlobalMembership, distinctValues, encodeAggregateKey, encodeCursor, encodeGeohash, encodePartitionKey, encodeRowsPatch, ensureAuditTable, ensureMailTable, envOptionalPositiveInt, envPositiveInt, equalityPinnedFields, exportShardRows, facetColumn, fanOutScalarCounts, findRelated, findStorageReferences, finishStreamRun, float64SqlKey, foldAggregateTally, forgetScheduleOutbox, ftsCompanionDdl, ftsPurgeDocument, ftsRowidMapName, ftsUnmappedPage, ftsWriteDocument, gateReplicaDispatch, geoTableName, globalShapeReadKey, groupUnmappedRows, guardWriter, handleReplicaControl, hasTrigger, haversineMeters, importShardRows, indexKeysForRow, isDevEnvironment, isFtsAvailable, isInternalTableName, isLossyBody, isMemoryTable, isPushableWhere, isRelationPredicate, isSoftDeleted, isSourceDue, isTtlExpired, isVacuousFilterClause, jsonPath, jsonPathSql, keysTouchRanges, liftSourceId, lintReadonlySql, listReactorStates, listTables, markUnvouchableReads, matchesRankStaticWhere, matchesStaticWhere, materializeExternalRows, materializeExternalRowsIncremental, memoryTableNames, mergeChangedKeys, mergeWhere, migrateCdcLog, migrateCdcMeta, migrateClientWatermark, migrateCommitSeq, migrateDurableStreams, migrateGlobalShapeSnapshot, migrateIdempotency, migrateReactorState, migrateScheduleOutbox, migrateSearchState, migrateShapePokeCursor, minCdcReplayableSeq, minCdcSeq, minShapePokeCursor, nextPromotionState, nextTtlExpiry, normalizeCountArgument, normalizeIdStructurally, normalizeOrderKeys, normalizeSourceDocument, normalizeSourceValue, nullsFirstOf, nullsOrderSuffix, operatorFields, param, parkScheduleOutbox, parseExportShardArgs, parseImportShardArgs, patchDependsOnRow, planAggregateLookup, pointInBoundingBox, probeScheduleOutbox, projectColumns, pullExternalSourceIncrementalTick, pullExternalSourceTick, qualifiedJsonPath, qualifiedJsonPathSql, quoteIdentifier, rankKeyFromDocument as rankKeyFromDoc, rankPivotConditionSql, rankTableName, reactiveCacheKey, reactorNeedsRun, readAggregateValue, readArchivedCdcChanges, readAuditLog, readBookmark, readCapturedMail, readCdcArchivedThrough, readCdcChangeKeys, readCdcChanges, readCdcCursor, readCdcEpoch, readClientWatermark, readCommitSeq, readDeployInfo, readDueScheduleOutbox, readExternalSourceBaseline, readGlobalShapeSnapshot, readIdempotent, readMigrationStatus, readPatchField, readQueueMessageById, readQueueMessages, readReactorState, readSchemaHistory, readSchemaVersion, readSearchBackfillState, readShapePokeCursor, readStreamChunks, readStreamRun, readTablePage, recordCapturedMail, recordChangedKeys, recordFanoutPass, recordGlobalPollPass, recordQueueMessages, recordScheduleOutbox, recordSchemaVersion, recordShapeProbePass, relationHooks, relayCountFor, renderSql, reprojectableFields, reprojectionMigrationId, reprojectionTables, resolvePatch, resolveRankPartition, resolveRankSeekTuple, resolveRelationPredicates, resolveWith, rowToDocument, runDataMigration, runDrizzle, runExternalSourceTick, runReadonlySql, runRowValidators, runShardMigrations, runSocketPool, runSql, runTriggers, selectExpiredIds, selectExportTables, selectIndexForAggregate, selectIndexForCount, selectIndexForGroupBy, selectMatchingIds, selectShapeMembers, selectShapeRows, serializeSqlValue, serverInList, shapeRoutingKey, siblingSecretOf, signSiblingBody, softDeleteScope, sortColumnName, sqliteInList, stripReservedPatchFields, stubByName, subscriptionFrames, subscriptionListDeltas, summarizeFanoutTopics, summarizeSubscriptions, tableColumns, tableFromDepKey, throwingScheduler, tiebreakDirectionFor, trimCdcChanges, trimIdempotent, trimScheduleOutbox, trimStreamRuns, tryRowToDocument, trySendFrame, unionAll, uniqueIndexFields, validateImportRow, verifySiblingBody, whereFilter, whereOfFilter, writeCdcArchivedThrough, writeGlobalShapeSnapshot, writeIdempotent, writeReactorState, writeSearchBackfillState, writeShapePokeCursor, writeShapePokeCursors, writeTouchesMemo };
2788
+ export { ADMIN_FUNCTIONS, ADMIN_FUNCTION_PREFIX, AGGREGATE_SQL_FUNCTION, AGG_COUNT, AGG_KEY, AGG_VALUE, AUDIT_LOG_TABLE, type AdvisorProcedure, type AdvisorProceduresResult, type AdvisoriesResult, type AdvisoryFinding, type AggregateIndexDefinitionLike, type AggregateOp, type AggregateOptions, type AggregateResult, type AggregateTally, type AppendAuditEntry, type ApplyOnDeleteOptions, type AuditEntry, type AuditLogResult, BIGINT_KEY_DIGITS, type BroadcastDelta, CDC_LOG_TABLE, CDC_LOG_TABLE_SEQ_INDEX, CDC_META_TABLE, CLIENT_WATERMARK_TABLE, COMMIT_SEQ_FIELD, COMMIT_SEQ_TABLE, CURSOR_PREFIX, type CacheEntry, type CapturedMailRow, type CdcArchiveScope, type CdcChange, type CdcChangeKey, type ChangedKeys, type Clock, type ColumnMeta, type ColumnMetaLike, CompanionMemo, type CompanionSync, type CompanionSyncDeps, ConflictError, type ConflictKind, type CountArgs, CountRlsUnsupportedError, type CreateWorkflowInstanceResult, type CrossShardReadArgs, type CtxDbOptions, DATA_MIGRATION_STATE_TABLE, DEFAULT_FANOUT_TOPIC_LIMIT, DEFAULT_MAX_RELATION_KEYS, DEFAULT_MAX_RELAYS, DEFAULT_PROMOTION_THRESHOLDS, DEFAULT_TRANSACTION_LIMITS, DOC_COLUMN, type DataMigrationDocument, type DataMigrationLike, type DataMigrationTransform, type DatabaseWriterLike, type DependencyTracker, type DeployInfo, type DurableAttachDecision, type DurableStreamAttach, type DurableStreamRun, DurableStreamRunner, type DurableStreamSink, type ExportRow, type ExportShardAdminArgs, type ExportShardArgs, type ExternalSourceDiffResult, type ExternalSourceLike, FLAGS_FUNCTION_PREFIX, type FacetColumnOptions, type FacetColumnResult, type FacetValue, type FanOutBudget, type FanoutMetricsResult, type FanoutPathCounters, type FanoutTopicStat, type FieldOperators, type FilterClause, type FilterOperator, type FlagEvaluation, type FlagsResult, type FtsWriteOptions, type FunctionCallStat, type FunctionScanAttribution, type FunctionStatsResult, GEO_DEFAULT_PRECISION, GLOBAL_SHAPE_SNAPSHOT_TABLE, type GeoBoundingBox, type GeoFilterBuilderLike, type GeoIndexDefinitionLike, type GeoPoint, type GeoScoredDocument, type GlobalPollCounters, GlobalPollTick, type GroupByEntry, type GroupByOptions, type GuardableSchema$1 as GuardableSchema, IDEMPOTENCY_TABLE, type IdGenerator, type IdempotentRecord, type ImportConflictMode, type ImportError, type ImportRow, type ImportShardAdminArgs, type ImportShardArgs, type ImportShardResult, type IncrementalMaterializeResult, type IndexDefinitionLike, type IndexKeyEntry, type IndexRangeBuilderLike, type KeyRange, type KeyedRelationWriteInfo, type LifecycleDispatchInfo, type LifecycleEvent, type LiveSocketControlCall, MAIL_RETENTION, MAIL_TABLE, MAX_DURABLE_STREAM_BYTES, MAX_DURABLE_STREAM_CHUNKS, MAX_PAGE_SIZE, MAX_SQL_ROWS, type MaskColumnMetadata, type MaskPoliciesResult, type MaterializeResult, type MigrationDirection, type MigrationRunResult, type MigrationStatus, type MigrationStatusRow, type MutationDelta, type NestedWith, NotFoundError, NotUniqueError, type NullPlacement, type OnDeleteActionLike, type OrderByClause, type OrderByInput, type OrderKey, type OrderKeyConstraints, OwnerRelay, type OwnerRelayFrame, type PaginationOptions, type PatchVerifier, type PatchWriteOptions, type PitrBookmarkResult, type PitrRestoreArgs, type PitrRestoreResult, type PitrStorage, type PokeFrameMeta, type PromotionState, type PromotionThresholds, QUEUE_TABLE, type QueryArgs, type QueryPage, type QueryPlan, type QueueMessageOutcome, type QueueMessageRow, type QueueMetadata, type QueuesResult, RANK_TIEBREAK, REACTOR_STATE_TABLE, RELATED_DEFAULT_LIMIT, RELATED_DEPTH_DECAY, RELATED_MAX_DEPTH, RELATED_MAX_LIMIT, RELATION_EXISTS_KEY, RELATION_FUNCTION_PREFIX, RELAY_SIGNATURE_HEADER, REPROJECTION_MIGRATION_PREFIX, RLS_UNWRAP_SYMBOL, type RangeOperandType, type RankBeforeOptions, type RankBeforeResult, type RankDirection, type RankIndexDefinitionLike, type RankOptions, type RankPage, type RankPageComputation, type RankPageDeps, type RankPageOptions, type RankPageRow, type RankPageRowKey, type RankResult, type RankSortKeyLike, ReactiveCache, type ReactiveCacheOptions, type ReactorDispatchResult, type ReactorMetadata, type ReactorState, type ReactorStats, type ReactorsResult, type ReadFootprint, type ReadHook, type ReadTablePageOptions, type RecordMailInput, type RecordQueueMessageInput, type RelatedDirection, type RelatedNode, type RelatedOptions, type RelatedPage, type RelatedStart, type RelatedStartReference, type RelationDefinitionLike, type RelationEdge, type RelationExistsMarker, type RelationGraphReader, type RelationWriteInfo, type RelationWriteMap, type RelayAttach, type RelayDetach, type RelayFrame, type RelayHost, RelayMember, type RelayPokeDelivery, type RelayRoomEvent, type RelayRoomVerdict, type RelayShapePoke, type RelayShapeSeed, type RelayShapeSubscribe, type RelayShapeUnsubscribe, type RenderedSql, type ReplicaFollowerHost, type ReplicaOwnerHost, type ReplicaReadiness, type ResolveRelationPredicatesOptions, type ResolveWithOptions, type ResolveWithResult, type ResolvedShape, type RestrictableQueryOptions, type RlsPoliciesResult, type RlsPolicyMetadata, RlsRequiredError, type RlsRoleMetadata, type RpcRequest, type RunDataMigrationOptions, type RunTriggersOptions, SCAN_DEP, SCHEDULE_OUTBOX_TABLE, SCHEMA_HISTORY_MAX_VERSIONS, SEARCH_STATE_TABLE, SHAPE_POKE_CURSOR_TABLE, type SchedulableWorkflowReferenceLike, type ScheduleOutbox, type ScheduleOutboxEntry, type ScheduleOutboxEnvelope, type ScheduleOutboxRow, type ScheduledFunctionDoc, type SchedulerLike, type SchemaLike, type ScoredDocument, type SearchBackfillProgress, type SearchFilterBuilderLike, type SearchIndexDefinitionLike, type SearchScoredDocument, type SelectMatchingIdsOptions, type ServerDefaultContextLike, type SettingEntry, type SettingKind, type SettingsResult, ShapeDiffCache, type ShapePokeCursorRow, type ShapePokePart, type ShapeProbeCounters, type ShapeRow, type ShapeRowOp, type ShapeSubscriptionQuery, type ShardRankPageResult, ShardRunner, type ShardRunnerOptions, type ShardSiblingHost, type ShardSocketLike, type SocketAttachment, type SortDirection, type SourceClientLike, type SourceCursorLike, type SourceRefresh, type SqlConsoleResult, type SqlCursor, type SqlEngine, type SqlExec, type SqlLintResult, type StorageMetadata, type StorageReference, type StorageReferenceResult, type StorageRuleMetadata, type StorageRulesResult, type StudioFeaturesResult, type SubscriptionConnection, type SubscriptionEnvelope, type SubscriptionIdentity, type SubscriptionInfo, type SubscriptionQuery, type SubscriptionReadFootprint, type SubscriptionsResult, type SystemDatabaseReader, type SystemDoc, type SystemQuery, type SystemReaderOptions, type SystemReaderSchedulerLike, type SystemReaderStorageLike, type SystemTableName, type TableColumnsResult, type TableDefinitionLike, type TableIndexInfo, type TableIndexesResult, type TableInfo, type TablePage, type TableReaderLike, type TablesColumnsResult, type TablesIndexesResult, type ThroughRelationWriteInfo, type TransactionHeadroom, TransactionHeadroomTracker, type TransactionLimitKind, type TransactionLimitWarning, type TransactionLimits, type TransactionSqlLike, type TriggerContextLike, type TriggerDefinitionLike, type TriggerEventLike, type TriggerOpLike, type TriggerTimingLike, type TtlSweepSpec, UNVOUCHABLE_DEP, VECTOR_BACKFILL_MAX_PAGES, type ValidatorLike, type VectorBackfillProgress, WORKERD_SQLITE_LIMITS, type WhereFilter, type WhereInput, type WhereSqlStrategy, type WithInput, type WorkflowInstanceState, type WorkflowInstanceStatusResult, type WorkflowMetadata, type WorkflowsResult, type WriteEvent, type WriteHook, advanceClientWatermark, aggUpsertSql, aggregateSqlFunction, aggregateTableName, allocateCommitSeq, appendAuditEntry, appendCdcChange, appendStreamChunk, applyCdcChanges, applyInsertDefaults, applyOnDelete, applySelect, archiveCdcSegment, armRestore, assertFlatPredicate, assertNoExplicitUndefined, assertPatchAllowed, assertReadonly, assertShapeShardable, assertStorableRowId, assertValidClientId, awaitWsDrain, backfillAggregateIndexes, backfillRankIndexes, backfillSearchIndexes, backfillSearchIndexesForTable, backfillVectorIndexes, bigintSqlKey, boundingBoxCenter, boundingBoxGeohashes, buildIndexRange, buildPokeFrames, buildReprojectionMigration, buildSeekBeforeWhere, buildSeekWhere, buildSettings, buildShapeDiff, bumpCdcEpoch, cdcArchiveRewound, cdcCanVouchFor, cdcForkedError, cdcSeqLeavingRows, cdcTouchesTables, cdcTrimmedError, claimStreamRun, clampPromotionThresholds, clearCapturedMail, clearCompanionSignatures, clearMemoryTables, clearQueueMessages, coerceAggregateNumber, compactCdcDocs, compileWhereSql, composeReadPredicate, computeRankPage, containsRelationPredicate, countLegacyRows, coveringGeohashes, createCompanionSync, createDependencyTracker, createFanoutCounters, createGlobalPollCounters, createIndexSql, createReadFootprint, createRelayLink, createReplicaLink, createShapeDiffCache, createShapeProbeCounters, createShardCtxDb, createSystemReader, cursorBelowRetainedFloor, decideDurableAttach, decodeBigintSqlKey, decodeCursor, decodeFloat64SqlKey, deferScheduleOutbox, deleteGlobalShapeSnapshot, deleteGlobalShapeSnapshotsForConnection, deleteShapePokeCursor, deleteShapePokeCursorsForConnection, deleteStreamRun, depKey, deriveRelationEdges, describeRelationWrites, diffExternalSource, diffGlobalMembership, distinctValues, dropScheduleOutbox, 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, hasScheduleOutboxEntry, hasTrigger, haversineMeters, importShardRows, indexKeysForRow, isDevEnvironment, isFtsAvailable, isInternalTableName, isLossyBody, isMemoryTable, isPushableWhere, isRelationPredicate, isSoftDeleted, isSourceDue, isTtlExpired, isVacuousFilterClause, jsonPath, jsonPathSql, keysTouchRanges, liftSourceId, lintReadonlySql, listReactorStates, listTables, markUnvouchableReads, matchesRankStaticWhere, matchesStaticWhere, materializeExternalRows, materializeExternalRowsIncremental, memoryTableNames, mergeChangedKeys, mergeWhere, migrateCdcLog, migrateCdcMeta, migrateClientWatermark, migrateCommitSeq, migrateDurableStreams, migrateGlobalShapeSnapshot, migrateIdempotency, migrateReactorState, migrateScheduleOutbox, migrateSearchState, migrateShapePokeCursor, minCdcReplayableSeq, minCdcSeq, minShapePokeCursor, nextPromotionState, nextTtlExpiry, normalizeCountArgument, normalizeIdStructurally, normalizeOrderKeys, normalizeSourceDocument, normalizeSourceValue, nullsFirstOf, nullsOrderSuffix, operatorFields, param, parkScheduleOutbox, parseExportShardArgs, parseImportShardArgs, patchDependsOnRow, planAggregateLookup, pointInBoundingBox, probeScheduleOutbox, projectColumns, pullExternalSourceIncrementalTick, pullExternalSourceTick, qualifiedJsonPath, qualifiedJsonPathSql, quoteIdentifier, rankKeyFromDocument as rankKeyFromDoc, rankPivotConditionSql, rankTableName, reactiveCacheKey, reactorNeedsRun, readAggregateValue, readArchivedCdcChanges, readAuditLog, readBookmark, readCapturedMail, readCdcArchivedThrough, readCdcChangeKeys, readCdcChanges, readCdcCursor, readCdcEpoch, readClientWatermark, readCommitSeq, readDeployInfo, readDueScheduleOutbox, readDueScheduleOutboxEntry, readExternalSourceBaseline, readGlobalShapeSnapshot, readIdempotent, readMigrationStatus, readPatchField, readQueueMessageById, readQueueMessages, readReactorState, readScheduleOutbox, readScheduleOutboxState, readSchemaHistory, readSchemaVersion, readSearchBackfillState, readShapePokeCursor, readStreamChunks, readStreamRun, readTablePage, recordCapturedMail, recordChangedKeys, recordFanoutPass, recordGlobalPollPass, recordQueueMessages, recordScheduleOutbox, recordSchemaVersion, recordShapeProbePass, relationHooks, relayCountFor, renderSql, reprojectableFields, reprojectionMigrationId, reprojectionTables, requeueScheduleOutbox, resolvePatch, resolveRankPartition, resolveRankSeekTuple, resolveRelationPredicates, resolveWith, rowToDocument, runDataMigration, runDrizzle, runExternalSourceTick, runReadonlySql, runRowValidators, runShardMigrations, runSocketPool, runSql, runTriggers, selectExpiredIds, selectExportTables, selectIndexForAggregate, selectIndexForCount, selectIndexForGroupBy, selectMatchingIds, selectShapeMembers, selectShapeRows, serializeSqlValue, serverInList, shapeRoutingKey, siblingSecretOf, signSiblingBody, softDeleteScope, sortColumnName, sqliteInList, stripReservedPatchFields, stubByName, subscriptionFrames, subscriptionListDeltas, summarizeFanoutTopics, summarizeSubscriptions, tableColumns, tableFromDepKey, throwingScheduler, tiebreakDirectionFor, trimCdcChanges, trimIdempotent, trimScheduleOutbox, trimStreamRuns, tryRowToDocument, trySendFrame, unionAll, uniqueIndexFields, validateImportRow, verifySiblingBody, whereFilter, whereOfFilter, writeCdcArchivedThrough, writeGlobalShapeSnapshot, writeIdempotent, writeReactorState, writeSearchBackfillState, writeShapePokeCursor, writeShapePokeCursors, writeTouchesMemo };
package/dist/index.mjs CHANGED
@@ -1 +1 @@
1
- import{exportShardRows as o,importShardRows as a,parseExportShardArgs as t,parseImportShardArgs as s,selectExportTables as i,validateImportRow as l}from"./packem_shared/exportShardRows-CZh4wrvI.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-C_ZipS9R.mjs";import{aggregateTableName as f,coerceAggregateNumber as x,encodeAggregateKey as E,foldAggregateTally as h,readAggregateValue as T}from"./packem_shared/aggregateTableName-B_CtIQCS.mjs";import{CountRlsUnsupportedError as A,mergeWhere as C,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-BFJ65SRS.mjs";import{NotUniqueError as F,assertNoExplicitUndefined as N,assertStorableRowId as k,assertValidClientId as B,createShardCtxDb as U,normalizeIdStructurally as G,stripReservedPatchFields as w}from"./packem_shared/NotUniqueError-Dn6Cj7W1.mjs";import{backfillAggregateIndexes as v,backfillRankIndexes as K,backfillSearchIndexes as W,backfillSearchIndexesForTable as X}from"./packem_shared/backfillAggregateIndexes-CRNxxM19.mjs";import{CDC_LOG_TABLE as V,CDC_LOG_TABLE_SEQ_INDEX as z,CDC_META_TABLE as Q,appendCdcChange as Y,applyCdcChanges as j,bumpCdcEpoch as J,cdcCanVouchFor as Z,cdcForkedError as $,cdcSeqLeavingRows as ee,cdcTouchesTables as re,cdcTrimmedError as oe,compactCdcDocs as ae,cursorBelowRetainedFloor as te,migrateCdcLog as se,migrateCdcMeta as ie,minCdcReplayableSeq as le,minCdcSeq as ne,readCdcChangeKeys as de,readCdcChanges as ce,readCdcCursor as me,readCdcEpoch as pe,trimCdcChanges as Se}from"./packem_shared/CDC_LOG_TABLE-CTkXVeJx.mjs";import{archiveCdcSegment as fe,cdcArchiveRewound as xe,readArchivedCdcChanges as Ee,readCdcArchivedThrough as he,writeCdcArchivedThrough as Te}from"./packem_shared/archiveCdcSegment-Cr8oGLfB.mjs";import{CLIENT_WATERMARK_TABLE as Ae,advanceClientWatermark as Ce,migrateClientWatermark as ge,readClientWatermark as _e}from"./packem_shared/CLIENT_WATERMARK_TABLE-De7z_OHV.mjs";import{COMMIT_SEQ_FIELD as be,COMMIT_SEQ_TABLE as Le,allocateCommitSeq as De,migrateCommitSeq as Pe,readCommitSeq as Oe}from"./packem_shared/COMMIT_SEQ_FIELD-Da1DjGqo.mjs";import{CompanionMemo as ye,clearCompanionSignatures as Fe}from"./packem_shared/CompanionMemo-BXU5vfak.mjs";import{createCompanionSync as ke}from"./packem_shared/createCompanionSync-qhvw6wyL.mjs";import{GLOBAL_SHAPE_SNAPSHOT_TABLE as Ue,deleteGlobalShapeSnapshot as Ge,deleteGlobalShapeSnapshotsForConnection as we,migrateGlobalShapeSnapshot as qe,readGlobalShapeSnapshot as ve,writeGlobalShapeSnapshot as Ke}from"./packem_shared/GLOBAL_SHAPE_SNAPSHOT_TABLE-Bb6-aZuH.mjs";import{IDEMPOTENCY_TABLE as Xe,migrateIdempotency as He,readIdempotent as Ve,trimIdempotent as ze,writeIdempotent as Qe}from"./packem_shared/IDEMPOTENCY_TABLE-COrgeP3O.mjs";import{clearMemoryTables as je,isMemoryTable as Je,memoryTableNames as Ze}from"./packem_shared/clearMemoryTables-aMRERF0w.mjs";import{computeRankPage as er,resolveRankSeekTuple as rr}from"./packem_shared/computeRankPage-BZIpATcs.mjs";import{SCHEDULE_OUTBOX_TABLE as ar,deferScheduleOutbox as tr,forgetScheduleOutbox as sr,migrateScheduleOutbox as ir,parkScheduleOutbox as lr,probeScheduleOutbox as nr,readDueScheduleOutbox as dr,recordScheduleOutbox as cr,trimScheduleOutbox as mr}from"./packem_shared/SCHEDULE_OUTBOX_TABLE-DcZI7Yhl.mjs";import{S as Sr,m as ur,r as fr,w as xr}from"./packem_shared/ctx-db-search-state-CPKPy8N6.mjs";import{SHAPE_POKE_CURSOR_TABLE as hr,deleteShapePokeCursor as Tr,deleteShapePokeCursorsForConnection as Rr,migrateShapePokeCursor as Ar,minShapePokeCursor as Cr,readShapePokeCursor as gr,writeShapePokeCursor as _r,writeShapePokeCursors as Ir}from"./packem_shared/SHAPE_POKE_CURSOR_TABLE-BGvY3sFI.mjs";import{selectShapeMembers as Lr,selectShapeRows as Dr}from"./packem_shared/selectShapeMembers-BhK79123.mjs";import{DATA_MIGRATION_STATE_TABLE as Or,readMigrationStatus as Mr,runDataMigration as yr}from"./packem_shared/DATA_MIGRATION_STATE_TABLE-CFvBS9-M.mjs";import{SCAN_DEP as Nr,createDependencyTracker as kr,depKey as Br,tableFromDepKey as Ur}from"./packem_shared/SCAN_DEP-D7qE3iUe.mjs";import{runDrizzle as wr,runSql as qr}from"./packem_shared/runDrizzle-RC09zZrh.mjs";import{A as Kr,a as Wr,b as Xr,D as Hr,c as Vr,d as zr,g as Qr,i as Yr,j as jr,e as Jr,q as Zr,f as $r,r as eo,t as ro,h as oo}from"./packem_shared/do-sql-RROYQPCM.mjs";import{WORKERD_SQLITE_LIMITS as to,param as so,renderSql as io,sqliteInList as lo,unionAll as no}from"./packem_shared/WORKERD_SQLITE_LIMITS-B_4w7tzY.mjs";import{appendStreamChunk as mo,claimStreamRun as po,deleteStreamRun as So,finishStreamRun as uo,migrateDurableStreams as fo,readStreamChunks as xo,readStreamRun as Eo,trimStreamRuns as ho}from"./packem_shared/appendStreamChunk-BZYgGE9Y.mjs";import{DurableStreamRunner as Ro,MAX_DURABLE_STREAM_BYTES as Ao,MAX_DURABLE_STREAM_CHUNKS as Co,decideDurableAttach as go}from"./packem_shared/DurableStreamRunner-MMlV5qKQ.mjs";import{envOptionalPositiveInt as Io,envPositiveInt as bo}from"./packem_shared/envOptionalPositiveInt-D2pY-c64.mjs";import{diffExternalSource as Do}from"./packem_shared/diffExternalSource-B0FZlDoL.mjs";import{liftSourceId as Oo,normalizeSourceDocument as Mo,normalizeSourceValue as yo}from"./packem_shared/liftSourceId-CA3ENhXj.mjs";import{materializeExternalRows as No,materializeExternalRowsIncremental as ko,readExternalSourceBaseline as Bo,runExternalSourceTick as Uo}from"./packem_shared/materializeExternalRows-BakYlgvb.mjs";import{isSoftDeleted as wo,isSourceDue as qo,pullExternalSourceIncrementalTick as vo,pullExternalSourceTick as Ko}from"./packem_shared/isSoftDeleted-QCy5JKnY.mjs";import{f as Xo,a as Ho,b as Vo,c as zo,d as Qo,g as Yo}from"./packem_shared/fts-companion-CE3EmIjk.mjs";import{GEO_DEFAULT_PRECISION as Jo,boundingBoxCenter as Zo,boundingBoxGeohashes as $o,coveringGeohashes as ea,encodeGeohash as ra,haversineMeters as oa,pointInBoundingBox as aa}from"./packem_shared/GEO_DEFAULT_PRECISION-CqpQZ-J_.mjs";import{default as sa}from"./packem_shared/GlobalPollTick-BNK4o-XT.mjs";import{ADMIN_FUNCTIONS as la,ADMIN_FUNCTION_PREFIX as na,DEFAULT_FANOUT_TOPIC_LIMIT as da,FLAGS_FUNCTION_PREFIX as ca,MAX_PAGE_SIZE as ma,RELATION_FUNCTION_PREFIX as pa,createFanoutCounters as Sa,createGlobalPollCounters as ua,createShapeProbeCounters as fa,facetColumn as xa,findStorageReferences as Ea,isVacuousFilterClause as ha,listTables as Ta,readTablePage as Ra,recordFanoutPass as Aa,recordGlobalPollPass as Ca,recordShapeProbePass as ga,selectMatchingIds as _a,summarizeFanoutTopics as Ia,summarizeSubscriptions as ba}from"./packem_shared/ADMIN_FUNCTIONS-CgMPqUvK.mjs";import{MAIL_RETENTION as Da,MAIL_TABLE as Pa,clearCapturedMail as Oa,ensureMailTable as Ma,readCapturedMail as ya,recordCapturedMail as Fa}from"./packem_shared/MAIL_RETENTION-DMolrLYt.mjs";import{NotFoundError as ka}from"./packem_shared/NotFoundError-BhF7FeFr.mjs";import{assertPatchAllowed as Ua,operatorFields as Ga,patchDependsOnRow as wa,readPatchField as qa,resolvePatch as va}from"./packem_shared/assertPatchAllowed-CA_H466g.mjs";import{armRestore as Wa,readBookmark as Xa}from"./packem_shared/armRestore-Bu1_8SUa.mjs";import{CURSOR_PREFIX as Va,applySelect as za,buildSeekBeforeWhere as Qa,buildSeekWhere as Ya,decodeCursor as ja,encodeCursor as Ja,equalityPinnedFields as Za,normalizeOrderKeys as $a,nullsFirstOf as et,nullsOrderSuffix as rt,softDeleteScope as ot,tiebreakDirectionFor as at,uniqueIndexFields as tt}from"./packem_shared/CURSOR_PREFIX-6offuG6M.mjs";import{QUEUE_TABLE as it,clearQueueMessages as lt,isLossyBody as nt,readQueueMessageById as dt,readQueueMessages as ct,recordQueueMessages as mt}from"./packem_shared/QUEUE_TABLE-C-goXtGd.mjs";import{RANK_TIEBREAK as St,encodePartitionKey as ut,matchesRankStaticWhere as ft,rankKeyFromDoc as xt,rankPivotConditionSql as Et,rankTableName as ht,resolveRankPartition as Tt,sortColumnName as Rt}from"./packem_shared/RANK_TIEBREAK-D3ye2GsL.mjs";import{ReactiveCache as Ct,reactiveCacheKey as gt}from"./packem_shared/ReactiveCache-Cy7oH_7w.mjs";import{REACTOR_STATE_TABLE as It,listReactorStates as bt,migrateReactorState as Lt,reactorNeedsRun as Dt,readReactorState as Pt,writeReactorState as Ot}from"./packem_shared/REACTOR_STATE_TABLE-D2Mn204f.mjs";import{UNVOUCHABLE_DEP as yt,createReadFootprint as Ft,markUnvouchableReads as Nt}from"./packem_shared/UNVOUCHABLE_DEP-Ds9gxVqs.mjs";import{buildIndexRange as Bt,indexKeysForRow as Ut,keysTouchRanges as Gt}from"./packem_shared/buildIndexRange-BTChxh3k.mjs";import{isPushableWhere as qt,whereFilter as vt,whereOfFilter as Kt}from"./packem_shared/isPushableWhere-BeYAOjUb.mjs";import{RELATED_DEFAULT_LIMIT as Xt,RELATED_DEPTH_DECAY as Ht,RELATED_MAX_DEPTH as Vt,RELATED_MAX_LIMIT as zt,deriveRelationEdges as Qt,findRelated as Yt}from"./packem_shared/RELATED_DEFAULT_LIMIT-CVqN4JEu.mjs";import{DEFAULT_MAX_RELATION_KEYS as Jt,assertFlatPredicate as Zt,assertShapeShardable as $t,composeReadPredicate as es,containsRelationPredicate as rs,isRelationPredicate as os,resolveRelationPredicates as as}from"./packem_shared/DEFAULT_MAX_RELATION_KEYS-DQkJExDV.mjs";import{describeRelationWrites as ss}from"./packem_shared/describeRelationWrites-omar6-u9.mjs";import{applyInsertDefaults as ls,applyOnDelete as ns,distinctValues as ds,fanOutScalarCounts as cs,relationHooks as ms,resolveWith as ps,runRowValidators as Ss}from"./packem_shared/applyInsertDefaults-BJo578fn.mjs";import{D as fs,c as xs,n as Es,r as hs,s as Ts}from"./packem_shared/relay-CKEdfUjH.mjs";import{DEFAULT_MAX_RELAYS as As,OwnerRelay as Cs,RelayMember as gs,createRelayLink as _s}from"./packem_shared/DEFAULT_MAX_RELAYS-B66neS_B.mjs";import{createReplicaLink as bs,gateReplicaDispatch as Ls,handleReplicaControl as Ds}from"./packem_shared/createReplicaLink-D0YNQDzD.mjs";import{buildReprojectionMigration as Os,countLegacyRows as Ms,reprojectableFields as ys,reprojectionTables as Fs}from"./packem_shared/buildReprojectionMigration-DAh1inpL.mjs";import{RLS_UNWRAP_SYMBOL as ks,RlsRequiredError as Bs,guardWriter as Us}from"./packem_shared/RLS_UNWRAP_SYMBOL-H6J96vgK.mjs";import{SCHEMA_HISTORY_MAX_VERSIONS as ws,readSchemaHistory as qs,readSchemaVersion as vs,recordSchemaVersion as Ks}from"./packem_shared/SCHEMA_HISTORY_MAX_VERSIONS-CEwFjj-O.mjs";import{serializeSqlValue as Xs}from"./packem_shared/serializeSqlValue-DeoBMpZ2.mjs";import{buildSettings as Vs,isDevEnvironment as zs,readDeployInfo as Qs}from"./packem_shared/buildSettings-BRkZd6_E.mjs";import{buildShapeDiff as js}from"./packem_shared/buildShapeDiff-CCpH5fNc.mjs";import{ShapeDiffCache as Zs,createShapeDiffCache as $s,globalShapeReadKey as ei}from"./packem_shared/ShapeDiffCache-iNO-hUiy.mjs";import{buildPokeFrames as oi,diffGlobalMembership as ai,encodeRowsPatch as ti,projectColumns as si}from"./packem_shared/buildPokeFrames-WR-hp0mX.mjs";import{ShardRunner as li}from"./packem_shared/ShardRunner-CrveaPId.mjs";import{stubByName as di}from"./packem_shared/stubByName-B8cFYipA.mjs";import{runSocketPool as mi}from"./packem_shared/runSocketPool-CZJ2X9cF.mjs";import{MAX_SQL_ROWS as Si,assertReadonly as ui,lintReadonlySql as fi,runReadonlySql as xi}from"./packem_shared/MAX_SQL_ROWS-eRignWyO.mjs";import{BIGINT_KEY_DIGITS as hi,bigintSqlKey as Ti,decodeBigintSqlKey as Ri,decodeFloat64SqlKey as Ai,float64SqlKey as Ci}from"./packem_shared/BIGINT_KEY_DIGITS-DE6yshOt.mjs";import{awaitWsDrain as _i,subscriptionFrames as Ii,subscriptionListDeltas as bi,trySendFrame as Li}from"./packem_shared/awaitWsDrain-DMcWBQ7I.mjs";import{mergeChangedKeys as Pi,recordChangedKeys as Oi,writeTouchesMemo as Mi}from"./packem_shared/mergeChangedKeys-DPKhen6e.mjs";import{createSystemReader as Fi}from"./packem_shared/createSystemReader-BSCxr8Qs.mjs";import{ConflictError as ki}from"./packem_shared/ConflictError-C8GtJmjS.mjs";import{DEFAULT_TRANSACTION_LIMITS as Ui,TransactionHeadroomTracker as Gi}from"./packem_shared/DEFAULT_TRANSACTION_LIMITS-Dmj5VBrV.mjs";import{hasTrigger as qi,runTriggers as vi}from"./packem_shared/hasTrigger-CjlwI4le.mjs";import{isTtlExpired as Wi,nextTtlExpiry as Xi,selectExpiredIds as Hi}from"./packem_shared/isTtlExpired-BmiUp7MF.mjs";import{VECTOR_BACKFILL_MAX_PAGES as zi,backfillVectorIndexes as Qi}from"./packem_shared/VECTOR_BACKFILL_MAX_PAGES-UY0toTIR.mjs";import{c as ji,s as Ji}from"./packem_shared/where-sql-BjY4rnqb.mjs";import{RELATION_EXISTS_KEY as $i}from"./packem_shared/RELATION_EXISTS_KEY-wxgj6rSL.mjs";import{RELAY_SIGNATURE_HEADER as rl,siblingSecretOf as ol,signSiblingBody as al,verifySiblingBody as tl}from"./packem_shared/RELAY_SIGNATURE_HEADER-DP0glzE_.mjs";import{REPROJECTION_MIGRATION_PREFIX as il,reprojectionMigrationId as ll}from"./packem_shared/REPROJECTION_MIGRATION_PREFIX-Czcb6_mO.mjs";import{isInternalTableName as dl}from"./packem_shared/isInternalTableName-BoljO2tP.mjs";import{quoteIdentifier as ml}from"./packem_shared/quoteIdentifier-CObIFRhb.mjs";import{runShardMigrations as Sl}from"./packem_shared/runShardMigrations-DOiPunti.mjs";import{stableStringify as fl,stableWireKey as xl}from"@lunora/wire";export{la as ADMIN_FUNCTIONS,na as ADMIN_FUNCTION_PREFIX,d as AGGREGATE_SQL_FUNCTION,Kr as AGG_COUNT,Wr as AGG_KEY,Xr as AGG_VALUE,D as AUDIT_LOG_TABLE,hi as BIGINT_KEY_DIGITS,V as CDC_LOG_TABLE,z as CDC_LOG_TABLE_SEQ_INDEX,Q as CDC_META_TABLE,Ae as CLIENT_WATERMARK_TABLE,be as COMMIT_SEQ_FIELD,Le as COMMIT_SEQ_TABLE,Va as CURSOR_PREFIX,ye as CompanionMemo,ki as ConflictError,A as CountRlsUnsupportedError,Or as DATA_MIGRATION_STATE_TABLE,da as DEFAULT_FANOUT_TOPIC_LIMIT,Jt as DEFAULT_MAX_RELATION_KEYS,As as DEFAULT_MAX_RELAYS,fs as DEFAULT_PROMOTION_THRESHOLDS,Ui as DEFAULT_TRANSACTION_LIMITS,Hr as DOC_COLUMN,Ro as DurableStreamRunner,ca as FLAGS_FUNCTION_PREFIX,Jo as GEO_DEFAULT_PRECISION,Ue as GLOBAL_SHAPE_SNAPSHOT_TABLE,sa as GlobalPollTick,Xe as IDEMPOTENCY_TABLE,Da as MAIL_RETENTION,Pa as MAIL_TABLE,Ao as MAX_DURABLE_STREAM_BYTES,Co as MAX_DURABLE_STREAM_CHUNKS,ma as MAX_PAGE_SIZE,Si as MAX_SQL_ROWS,ka as NotFoundError,F as NotUniqueError,Cs as OwnerRelay,it as QUEUE_TABLE,St as RANK_TIEBREAK,It as REACTOR_STATE_TABLE,Xt as RELATED_DEFAULT_LIMIT,Ht as RELATED_DEPTH_DECAY,Vt as RELATED_MAX_DEPTH,zt as RELATED_MAX_LIMIT,$i as RELATION_EXISTS_KEY,pa as RELATION_FUNCTION_PREFIX,rl as RELAY_SIGNATURE_HEADER,il as REPROJECTION_MIGRATION_PREFIX,ks as RLS_UNWRAP_SYMBOL,Ct as ReactiveCache,gs as RelayMember,Bs as RlsRequiredError,Nr as SCAN_DEP,ar as SCHEDULE_OUTBOX_TABLE,ws as SCHEMA_HISTORY_MAX_VERSIONS,Sr as SEARCH_STATE_TABLE,hr as SHAPE_POKE_CURSOR_TABLE,Zs as ShapeDiffCache,li as ShardRunner,Gi as TransactionHeadroomTracker,yt as UNVOUCHABLE_DEP,zi as VECTOR_BACKFILL_MAX_PAGES,to as WORKERD_SQLITE_LIMITS,Ce as advanceClientWatermark,Vr as aggUpsertSql,c as aggregateSqlFunction,f as aggregateTableName,De as allocateCommitSeq,P as appendAuditEntry,Y as appendCdcChange,mo as appendStreamChunk,j as applyCdcChanges,ls as applyInsertDefaults,ns as applyOnDelete,za as applySelect,fe as archiveCdcSegment,Wa as armRestore,Zt as assertFlatPredicate,N as assertNoExplicitUndefined,Ua as assertPatchAllowed,ui as assertReadonly,$t as assertShapeShardable,k as assertStorableRowId,B as assertValidClientId,_i as awaitWsDrain,v as backfillAggregateIndexes,K as backfillRankIndexes,W as backfillSearchIndexes,X as backfillSearchIndexesForTable,Qi as backfillVectorIndexes,Ti as bigintSqlKey,Zo as boundingBoxCenter,$o as boundingBoxGeohashes,Bt as buildIndexRange,oi as buildPokeFrames,Os as buildReprojectionMigration,Qa as buildSeekBeforeWhere,Ya as buildSeekWhere,Vs as buildSettings,js as buildShapeDiff,J as bumpCdcEpoch,xe as cdcArchiveRewound,Z as cdcCanVouchFor,$ as cdcForkedError,ee as cdcSeqLeavingRows,re as cdcTouchesTables,oe as cdcTrimmedError,po as claimStreamRun,xs as clampPromotionThresholds,Oa as clearCapturedMail,Fe as clearCompanionSignatures,je as clearMemoryTables,lt as clearQueueMessages,x as coerceAggregateNumber,ae as compactCdcDocs,ji as compileWhereSql,es as composeReadPredicate,er as computeRankPage,rs as containsRelationPredicate,Ms as countLegacyRows,ea as coveringGeohashes,ke as createCompanionSync,kr as createDependencyTracker,Sa as createFanoutCounters,ua as createGlobalPollCounters,zr as createIndexSql,Ft as createReadFootprint,_s as createRelayLink,bs as createReplicaLink,$s as createShapeDiffCache,fa as createShapeProbeCounters,U as createShardCtxDb,Fi as createSystemReader,te as cursorBelowRetainedFloor,go as decideDurableAttach,Ri as decodeBigintSqlKey,ja as decodeCursor,Ai as decodeFloat64SqlKey,tr as deferScheduleOutbox,Ge as deleteGlobalShapeSnapshot,we as deleteGlobalShapeSnapshotsForConnection,Tr as deleteShapePokeCursor,Rr as deleteShapePokeCursorsForConnection,So as deleteStreamRun,Br as depKey,Qt as deriveRelationEdges,ss as describeRelationWrites,Do as diffExternalSource,ai as diffGlobalMembership,ds as distinctValues,E as encodeAggregateKey,Ja as encodeCursor,ra as encodeGeohash,ut as encodePartitionKey,ti as encodeRowsPatch,O as ensureAuditTable,Ma as ensureMailTable,Io as envOptionalPositiveInt,bo as envPositiveInt,Za as equalityPinnedFields,o as exportShardRows,xa as facetColumn,cs as fanOutScalarCounts,Yt as findRelated,Ea as findStorageReferences,uo as finishStreamRun,Ci as float64SqlKey,h as foldAggregateTally,sr as forgetScheduleOutbox,Xo as ftsCompanionDdl,Ho as ftsPurgeDocument,Vo as ftsRowidMapName,zo as ftsUnmappedPage,Qo as ftsWriteDocument,Ls as gateReplicaDispatch,Qr as geoTableName,ei as globalShapeReadKey,Yo as groupUnmappedRows,Us as guardWriter,Ds as handleReplicaControl,qi as hasTrigger,oa as haversineMeters,a as importShardRows,Ut as indexKeysForRow,zs as isDevEnvironment,Yr as isFtsAvailable,dl as isInternalTableName,nt as isLossyBody,Je as isMemoryTable,qt as isPushableWhere,os as isRelationPredicate,wo as isSoftDeleted,qo as isSourceDue,Wi as isTtlExpired,ha as isVacuousFilterClause,jr as jsonPath,Jr as jsonPathSql,Gt as keysTouchRanges,Oo as liftSourceId,fi as lintReadonlySql,bt as listReactorStates,Ta as listTables,Nt as markUnvouchableReads,ft as matchesRankStaticWhere,m as matchesStaticWhere,No as materializeExternalRows,ko as materializeExternalRowsIncremental,Ze as memoryTableNames,Pi as mergeChangedKeys,C as mergeWhere,se as migrateCdcLog,ie as migrateCdcMeta,ge as migrateClientWatermark,Pe as migrateCommitSeq,fo as migrateDurableStreams,qe as migrateGlobalShapeSnapshot,He as migrateIdempotency,Lt as migrateReactorState,ir as migrateScheduleOutbox,ur as migrateSearchState,Ar as migrateShapePokeCursor,le as minCdcReplayableSeq,ne as minCdcSeq,Cr as minShapePokeCursor,Es as nextPromotionState,Xi as nextTtlExpiry,p as normalizeCountArgument,G as normalizeIdStructurally,$a as normalizeOrderKeys,Mo as normalizeSourceDocument,yo as normalizeSourceValue,et as nullsFirstOf,rt as nullsOrderSuffix,Ga as operatorFields,so as param,lr as parkScheduleOutbox,t as parseExportShardArgs,s as parseImportShardArgs,wa as patchDependsOnRow,g as planAggregateLookup,aa as pointInBoundingBox,nr as probeScheduleOutbox,si as projectColumns,vo as pullExternalSourceIncrementalTick,Ko as pullExternalSourceTick,Zr as qualifiedJsonPath,$r as qualifiedJsonPathSql,ml as quoteIdentifier,xt as rankKeyFromDoc,Et as rankPivotConditionSql,ht as rankTableName,gt as reactiveCacheKey,Dt as reactorNeedsRun,T as readAggregateValue,Ee as readArchivedCdcChanges,M as readAuditLog,Xa as readBookmark,ya as readCapturedMail,he as readCdcArchivedThrough,de as readCdcChangeKeys,ce as readCdcChanges,me as readCdcCursor,pe as readCdcEpoch,_e as readClientWatermark,Oe as readCommitSeq,Qs as readDeployInfo,dr as readDueScheduleOutbox,Bo as readExternalSourceBaseline,ve as readGlobalShapeSnapshot,Ve as readIdempotent,Mr as readMigrationStatus,qa as readPatchField,dt as readQueueMessageById,ct as readQueueMessages,Pt as readReactorState,qs as readSchemaHistory,vs as readSchemaVersion,fr as readSearchBackfillState,gr as readShapePokeCursor,xo as readStreamChunks,Eo as readStreamRun,Ra as readTablePage,Fa as recordCapturedMail,Oi as recordChangedKeys,Aa as recordFanoutPass,Ca as recordGlobalPollPass,mt as recordQueueMessages,cr as recordScheduleOutbox,Ks as recordSchemaVersion,ga as recordShapeProbePass,ms as relationHooks,hs as relayCountFor,io as renderSql,ys as reprojectableFields,ll as reprojectionMigrationId,Fs as reprojectionTables,va as resolvePatch,Tt as resolveRankPartition,rr as resolveRankSeekTuple,as as resolveRelationPredicates,ps as resolveWith,eo as rowToDocument,yr as runDataMigration,wr as runDrizzle,Uo as runExternalSourceTick,xi as runReadonlySql,Ss as runRowValidators,Sl as runShardMigrations,mi as runSocketPool,qr as runSql,vi as runTriggers,Hi as selectExpiredIds,i as selectExportTables,_ as selectIndexForAggregate,I as selectIndexForCount,b as selectIndexForGroupBy,_a as selectMatchingIds,Lr as selectShapeMembers,Dr as selectShapeRows,Xs as serializeSqlValue,Ji as serverInList,Ts as shapeRoutingKey,ol as siblingSecretOf,al as signSiblingBody,ot as softDeleteScope,Rt as sortColumnName,lo as sqliteInList,fl as stableStringify,xl as stableWireKey,w as stripReservedPatchFields,di as stubByName,Ii as subscriptionFrames,bi as subscriptionListDeltas,Ia as summarizeFanoutTopics,ba as summarizeSubscriptions,ro as tableColumns,Ur as tableFromDepKey,S as throwingScheduler,at as tiebreakDirectionFor,Se as trimCdcChanges,ze as trimIdempotent,mr as trimScheduleOutbox,ho as trimStreamRuns,oo as tryRowToDocument,Li as trySendFrame,no as unionAll,tt as uniqueIndexFields,l as validateImportRow,tl as verifySiblingBody,vt as whereFilter,Kt as whereOfFilter,Te as writeCdcArchivedThrough,Ke as writeGlobalShapeSnapshot,Qe as writeIdempotent,Ot as writeReactorState,xr as writeSearchBackfillState,_r as writeShapePokeCursor,Ir as writeShapePokeCursors,Mi as writeTouchesMemo};
1
+ import{exportShardRows as o,importShardRows as a,parseExportShardArgs as t,parseImportShardArgs as s,selectExportTables as i,validateImportRow as l}from"./packem_shared/exportShardRows-CZh4wrvI.mjs";import{AGGREGATE_SQL_FUNCTION as d,aggregateSqlFunction as c,matchesStaticWhere as m,normalizeCountArgument as p,throwingScheduler as u}from"./packem_shared/AGGREGATE_SQL_FUNCTION-C_ZipS9R.mjs";import{aggregateTableName as f,coerceAggregateNumber as x,encodeAggregateKey as h,foldAggregateTally as E,readAggregateValue as T}from"./packem_shared/aggregateTableName-B_CtIQCS.mjs";import{CountRlsUnsupportedError as A,mergeWhere as C,planAggregateLookup as g,selectIndexForAggregate as _,selectIndexForCount as I,selectIndexForGroupBy as b}from"./packem_shared/CountRlsUnsupportedError-BvsDqfO2.mjs";import{AUDIT_LOG_TABLE as O,appendAuditEntry as D,ensureAuditTable as P,readAuditLog as y}from"./packem_shared/AUDIT_LOG_TABLE-BFJ65SRS.mjs";import{NotUniqueError as F,assertNoExplicitUndefined as N,assertStorableRowId as k,assertValidClientId as B,createShardCtxDb as U,normalizeIdStructurally as G,stripReservedPatchFields as w}from"./packem_shared/NotUniqueError-CO-HgL4c.mjs";import{backfillAggregateIndexes as v,backfillRankIndexes as K,backfillSearchIndexes as W,backfillSearchIndexesForTable as X}from"./packem_shared/backfillAggregateIndexes-Pk0KLrfk.mjs";import{CDC_LOG_TABLE as V,CDC_LOG_TABLE_SEQ_INDEX as z,CDC_META_TABLE as Q,appendCdcChange as Y,applyCdcChanges as j,bumpCdcEpoch as J,cdcCanVouchFor as Z,cdcForkedError as $,cdcSeqLeavingRows as ee,cdcTouchesTables as re,cdcTrimmedError as oe,compactCdcDocs as ae,cursorBelowRetainedFloor as te,migrateCdcLog as se,migrateCdcMeta as ie,minCdcReplayableSeq as le,minCdcSeq as ne,readCdcChangeKeys as de,readCdcChanges as ce,readCdcCursor as me,readCdcEpoch as pe,trimCdcChanges as ue}from"./packem_shared/CDC_LOG_TABLE-BFGgqai8.mjs";import{archiveCdcSegment as fe,cdcArchiveRewound as xe,readArchivedCdcChanges as he,readCdcArchivedThrough as Ee,writeCdcArchivedThrough as Te}from"./packem_shared/archiveCdcSegment-Cr8oGLfB.mjs";import{CLIENT_WATERMARK_TABLE as Ae,advanceClientWatermark as Ce,migrateClientWatermark as ge,readClientWatermark as _e}from"./packem_shared/CLIENT_WATERMARK_TABLE-De7z_OHV.mjs";import{COMMIT_SEQ_FIELD as be,COMMIT_SEQ_TABLE as Le,allocateCommitSeq as Oe,migrateCommitSeq as De,readCommitSeq as Pe}from"./packem_shared/COMMIT_SEQ_FIELD-Da1DjGqo.mjs";import{CompanionMemo as Me,clearCompanionSignatures as Fe}from"./packem_shared/CompanionMemo-BXU5vfak.mjs";import{createCompanionSync as ke}from"./packem_shared/createCompanionSync-CEht4hXX.mjs";import{GLOBAL_SHAPE_SNAPSHOT_TABLE as Ue,deleteGlobalShapeSnapshot as Ge,deleteGlobalShapeSnapshotsForConnection as we,migrateGlobalShapeSnapshot as qe,readGlobalShapeSnapshot as ve,writeGlobalShapeSnapshot as Ke}from"./packem_shared/GLOBAL_SHAPE_SNAPSHOT_TABLE-Bb6-aZuH.mjs";import{IDEMPOTENCY_TABLE as Xe,migrateIdempotency as He,readIdempotent as Ve,trimIdempotent as ze,writeIdempotent as Qe}from"./packem_shared/IDEMPOTENCY_TABLE-COrgeP3O.mjs";import{clearMemoryTables as je,isMemoryTable as Je,memoryTableNames as Ze}from"./packem_shared/clearMemoryTables-aMRERF0w.mjs";import{computeRankPage as er,resolveRankSeekTuple as rr}from"./packem_shared/computeRankPage-BZIpATcs.mjs";import{SCHEDULE_OUTBOX_TABLE as ar,deferScheduleOutbox as tr,dropScheduleOutbox as sr,forgetScheduleOutbox as ir,hasScheduleOutboxEntry as lr,migrateScheduleOutbox as nr,parkScheduleOutbox as dr,probeScheduleOutbox as cr,readDueScheduleOutbox as mr,readDueScheduleOutboxEntry as pr,readScheduleOutbox as ur,readScheduleOutboxState as Sr,recordScheduleOutbox as fr,requeueScheduleOutbox as xr,trimScheduleOutbox as hr}from"./packem_shared/SCHEDULE_OUTBOX_TABLE-iyyiSjsO.mjs";import{S as Tr,m as Rr,r as Ar,w as Cr}from"./packem_shared/ctx-db-search-state-CPKPy8N6.mjs";import{SHAPE_POKE_CURSOR_TABLE as _r,deleteShapePokeCursor as Ir,deleteShapePokeCursorsForConnection as br,migrateShapePokeCursor as Lr,minShapePokeCursor as Or,readShapePokeCursor as Dr,writeShapePokeCursor as Pr,writeShapePokeCursors as yr}from"./packem_shared/SHAPE_POKE_CURSOR_TABLE-BGvY3sFI.mjs";import{selectShapeMembers as Fr,selectShapeRows as Nr}from"./packem_shared/selectShapeMembers-Dqx_m7BF.mjs";import{DATA_MIGRATION_STATE_TABLE as Br,readMigrationStatus as Ur,runDataMigration as Gr}from"./packem_shared/DATA_MIGRATION_STATE_TABLE-CFvBS9-M.mjs";import{SCAN_DEP as qr,createDependencyTracker as vr,depKey as Kr,tableFromDepKey as Wr}from"./packem_shared/SCAN_DEP-D7qE3iUe.mjs";import{runDrizzle as Hr,runSql as Vr}from"./packem_shared/runDrizzle-RC09zZrh.mjs";import{A as Qr,a as Yr,b as jr,D as Jr,c as Zr,d as $r,g as eo,i as ro,j as oo,e as ao,q as to,f as so,r as io,t as lo,h as no}from"./packem_shared/do-sql-105TONaE.mjs";import{WORKERD_SQLITE_LIMITS as mo,param as po,renderSql as uo,sqliteInList as So,unionAll as fo}from"./packem_shared/WORKERD_SQLITE_LIMITS-B_4w7tzY.mjs";import{appendStreamChunk as ho,claimStreamRun as Eo,deleteStreamRun as To,finishStreamRun as Ro,migrateDurableStreams as Ao,readStreamChunks as Co,readStreamRun as go,trimStreamRuns as _o}from"./packem_shared/appendStreamChunk-BZYgGE9Y.mjs";import{DurableStreamRunner as bo,MAX_DURABLE_STREAM_BYTES as Lo,MAX_DURABLE_STREAM_CHUNKS as Oo,decideDurableAttach as Do}from"./packem_shared/DurableStreamRunner-MMlV5qKQ.mjs";import{envOptionalPositiveInt as yo,envPositiveInt as Mo}from"./packem_shared/envOptionalPositiveInt-D2pY-c64.mjs";import{diffExternalSource as No}from"./packem_shared/diffExternalSource-B0FZlDoL.mjs";import{liftSourceId as Bo,normalizeSourceDocument as Uo,normalizeSourceValue as Go}from"./packem_shared/liftSourceId-CA3ENhXj.mjs";import{materializeExternalRows as qo,materializeExternalRowsIncremental as vo,readExternalSourceBaseline as Ko,runExternalSourceTick as Wo}from"./packem_shared/materializeExternalRows-CHPRx8fu.mjs";import{isSoftDeleted as Ho,isSourceDue as Vo,pullExternalSourceIncrementalTick as zo,pullExternalSourceTick as Qo}from"./packem_shared/isSoftDeleted-BBWKE0Sm.mjs";import{f as jo,a as Jo,b as Zo,c as $o,d as ea,g as ra}from"./packem_shared/fts-companion-CE3EmIjk.mjs";import{GEO_DEFAULT_PRECISION as aa,boundingBoxCenter as ta,boundingBoxGeohashes as sa,coveringGeohashes as ia,encodeGeohash as la,haversineMeters as na,pointInBoundingBox as da}from"./packem_shared/GEO_DEFAULT_PRECISION-CqpQZ-J_.mjs";import{default as ma}from"./packem_shared/GlobalPollTick-BNK4o-XT.mjs";import{ADMIN_FUNCTIONS as ua,ADMIN_FUNCTION_PREFIX as Sa,DEFAULT_FANOUT_TOPIC_LIMIT as fa,FLAGS_FUNCTION_PREFIX as xa,MAX_PAGE_SIZE as ha,RELATION_FUNCTION_PREFIX as Ea,createFanoutCounters as Ta,createGlobalPollCounters as Ra,createShapeProbeCounters as Aa,facetColumn as Ca,findStorageReferences as ga,isVacuousFilterClause as _a,listTables as Ia,readTablePage as ba,recordFanoutPass as La,recordGlobalPollPass as Oa,recordShapeProbePass as Da,selectMatchingIds as Pa,summarizeFanoutTopics as ya,summarizeSubscriptions as Ma}from"./packem_shared/ADMIN_FUNCTIONS-BMBnudzO.mjs";import{MAIL_RETENTION as Na,MAIL_TABLE as ka,clearCapturedMail as Ba,ensureMailTable as Ua,readCapturedMail as Ga,recordCapturedMail as wa}from"./packem_shared/MAIL_RETENTION-DMolrLYt.mjs";import{NotFoundError as va}from"./packem_shared/NotFoundError-BhF7FeFr.mjs";import{assertPatchAllowed as Wa,operatorFields as Xa,patchDependsOnRow as Ha,readPatchField as Va,resolvePatch as za}from"./packem_shared/assertPatchAllowed-CA_H466g.mjs";import{armRestore as Ya,readBookmark as ja}from"./packem_shared/armRestore-Bu1_8SUa.mjs";import{CURSOR_PREFIX as Za,applySelect as $a,buildSeekBeforeWhere as et,buildSeekWhere as rt,decodeCursor as ot,encodeCursor as at,equalityPinnedFields as tt,normalizeOrderKeys as st,nullsFirstOf as it,nullsOrderSuffix as lt,softDeleteScope as nt,tiebreakDirectionFor as dt,uniqueIndexFields as ct}from"./packem_shared/CURSOR_PREFIX-6offuG6M.mjs";import{QUEUE_TABLE as pt,clearQueueMessages as ut,isLossyBody as St,readQueueMessageById as ft,readQueueMessages as xt,recordQueueMessages as ht}from"./packem_shared/QUEUE_TABLE-C-goXtGd.mjs";import{RANK_TIEBREAK as Tt,encodePartitionKey as Rt,matchesRankStaticWhere as At,rankKeyFromDoc as Ct,rankPivotConditionSql as gt,rankTableName as _t,resolveRankPartition as It,sortColumnName as bt}from"./packem_shared/RANK_TIEBREAK-D3ye2GsL.mjs";import{ReactiveCache as Ot,reactiveCacheKey as Dt}from"./packem_shared/ReactiveCache-5XPk8qfW.mjs";import{REACTOR_STATE_TABLE as yt,listReactorStates as Mt,migrateReactorState as Ft,reactorNeedsRun as Nt,readReactorState as kt,writeReactorState as Bt}from"./packem_shared/REACTOR_STATE_TABLE-D2Mn204f.mjs";import{UNVOUCHABLE_DEP as Gt,createReadFootprint as wt,markUnvouchableReads as qt}from"./packem_shared/UNVOUCHABLE_DEP-Ds9gxVqs.mjs";import{buildIndexRange as Kt,indexKeysForRow as Wt,keysTouchRanges as Xt}from"./packem_shared/buildIndexRange-BTChxh3k.mjs";import{isPushableWhere as Vt,whereFilter as zt,whereOfFilter as Qt}from"./packem_shared/isPushableWhere-BeYAOjUb.mjs";import{RELATED_DEFAULT_LIMIT as jt,RELATED_DEPTH_DECAY as Jt,RELATED_MAX_DEPTH as Zt,RELATED_MAX_LIMIT as $t,deriveRelationEdges as es,findRelated as rs}from"./packem_shared/RELATED_DEFAULT_LIMIT-CVqN4JEu.mjs";import{DEFAULT_MAX_RELATION_KEYS as as,assertFlatPredicate as ts,assertShapeShardable as ss,composeReadPredicate as is,containsRelationPredicate as ls,isRelationPredicate as ns,resolveRelationPredicates as ds}from"./packem_shared/DEFAULT_MAX_RELATION_KEYS-DfrMi_eE.mjs";import{describeRelationWrites as ms}from"./packem_shared/describeRelationWrites-omar6-u9.mjs";import{applyInsertDefaults as us,applyOnDelete as Ss,distinctValues as fs,fanOutScalarCounts as xs,relationHooks as hs,resolveWith as Es,runRowValidators as Ts}from"./packem_shared/applyInsertDefaults-CVukTkQ5.mjs";import{D as As,c as Cs,n as gs,r as _s,s as Is}from"./packem_shared/relay-CKEdfUjH.mjs";import{DEFAULT_MAX_RELAYS as Ls,OwnerRelay as Os,RelayMember as Ds,createRelayLink as Ps}from"./packem_shared/DEFAULT_MAX_RELAYS-B66neS_B.mjs";import{createReplicaLink as Ms,gateReplicaDispatch as Fs,handleReplicaControl as Ns}from"./packem_shared/createReplicaLink-DVXW9rR6.mjs";import{buildReprojectionMigration as Bs,countLegacyRows as Us,reprojectableFields as Gs,reprojectionTables as ws}from"./packem_shared/buildReprojectionMigration-B8aEpETD.mjs";import{RLS_UNWRAP_SYMBOL as vs,RlsRequiredError as Ks,guardWriter as Ws}from"./packem_shared/RLS_UNWRAP_SYMBOL-H6J96vgK.mjs";import{SCHEMA_HISTORY_MAX_VERSIONS as Hs,readSchemaHistory as Vs,readSchemaVersion as zs,recordSchemaVersion as Qs}from"./packem_shared/SCHEMA_HISTORY_MAX_VERSIONS-CEwFjj-O.mjs";import{serializeSqlValue as js}from"./packem_shared/serializeSqlValue-DeoBMpZ2.mjs";import{buildSettings as Zs,isDevEnvironment as $s,readDeployInfo as ei}from"./packem_shared/buildSettings-BRkZd6_E.mjs";import{buildShapeDiff as oi}from"./packem_shared/buildShapeDiff-CdLJTijm.mjs";import{ShapeDiffCache as ti,createShapeDiffCache as si,globalShapeReadKey as ii}from"./packem_shared/ShapeDiffCache-iNO-hUiy.mjs";import{buildPokeFrames as ni,diffGlobalMembership as di,encodeRowsPatch as ci,projectColumns as mi}from"./packem_shared/buildPokeFrames-WR-hp0mX.mjs";import{ShardRunner as ui}from"./packem_shared/ShardRunner-CrveaPId.mjs";import{stubByName as fi}from"./packem_shared/stubByName-B8cFYipA.mjs";import{runSocketPool as hi}from"./packem_shared/runSocketPool-CZJ2X9cF.mjs";import{MAX_SQL_ROWS as Ti,assertReadonly as Ri,lintReadonlySql as Ai,runReadonlySql as Ci}from"./packem_shared/MAX_SQL_ROWS-eRignWyO.mjs";import{BIGINT_KEY_DIGITS as _i,bigintSqlKey as Ii,decodeBigintSqlKey as bi,decodeFloat64SqlKey as Li,float64SqlKey as Oi}from"./packem_shared/BIGINT_KEY_DIGITS-DE6yshOt.mjs";import{awaitWsDrain as Pi,subscriptionFrames as yi,subscriptionListDeltas as Mi,trySendFrame as Fi}from"./packem_shared/awaitWsDrain-DMcWBQ7I.mjs";import{mergeChangedKeys as ki,recordChangedKeys as Bi,writeTouchesMemo as Ui}from"./packem_shared/mergeChangedKeys-DPKhen6e.mjs";import{createSystemReader as wi}from"./packem_shared/createSystemReader-BSCxr8Qs.mjs";import{ConflictError as vi}from"./packem_shared/ConflictError-C8GtJmjS.mjs";import{DEFAULT_TRANSACTION_LIMITS as Wi,TransactionHeadroomTracker as Xi}from"./packem_shared/DEFAULT_TRANSACTION_LIMITS-D7p7Ys0M.mjs";import{hasTrigger as Vi,runTriggers as zi}from"./packem_shared/hasTrigger-CjlwI4le.mjs";import{isTtlExpired as Yi,nextTtlExpiry as ji,selectExpiredIds as Ji}from"./packem_shared/isTtlExpired-DNxmZA6e.mjs";import{VECTOR_BACKFILL_MAX_PAGES as $i,backfillVectorIndexes as el}from"./packem_shared/VECTOR_BACKFILL_MAX_PAGES-DcQpf83n.mjs";import{c as ol,s as al}from"./packem_shared/where-sql-BjY4rnqb.mjs";import{RELATION_EXISTS_KEY as sl}from"./packem_shared/RELATION_EXISTS_KEY-wxgj6rSL.mjs";import{RELAY_SIGNATURE_HEADER as ll,siblingSecretOf as nl,signSiblingBody as dl,verifySiblingBody as cl}from"./packem_shared/RELAY_SIGNATURE_HEADER-DP0glzE_.mjs";import{REPROJECTION_MIGRATION_PREFIX as pl,reprojectionMigrationId as ul}from"./packem_shared/REPROJECTION_MIGRATION_PREFIX-Czcb6_mO.mjs";import{isInternalTableName as fl}from"./packem_shared/isInternalTableName-BoljO2tP.mjs";import{quoteIdentifier as hl}from"./packem_shared/quoteIdentifier-CObIFRhb.mjs";import{runShardMigrations as Tl}from"./packem_shared/runShardMigrations-xu993yo2.mjs";import{stableStringify as Al,stableWireKey as Cl}from"@lunora/wire";export{ua as ADMIN_FUNCTIONS,Sa as ADMIN_FUNCTION_PREFIX,d as AGGREGATE_SQL_FUNCTION,Qr as AGG_COUNT,Yr as AGG_KEY,jr as AGG_VALUE,O as AUDIT_LOG_TABLE,_i as BIGINT_KEY_DIGITS,V as CDC_LOG_TABLE,z as CDC_LOG_TABLE_SEQ_INDEX,Q as CDC_META_TABLE,Ae as CLIENT_WATERMARK_TABLE,be as COMMIT_SEQ_FIELD,Le as COMMIT_SEQ_TABLE,Za as CURSOR_PREFIX,Me as CompanionMemo,vi as ConflictError,A as CountRlsUnsupportedError,Br as DATA_MIGRATION_STATE_TABLE,fa as DEFAULT_FANOUT_TOPIC_LIMIT,as as DEFAULT_MAX_RELATION_KEYS,Ls as DEFAULT_MAX_RELAYS,As as DEFAULT_PROMOTION_THRESHOLDS,Wi as DEFAULT_TRANSACTION_LIMITS,Jr as DOC_COLUMN,bo as DurableStreamRunner,xa as FLAGS_FUNCTION_PREFIX,aa as GEO_DEFAULT_PRECISION,Ue as GLOBAL_SHAPE_SNAPSHOT_TABLE,ma as GlobalPollTick,Xe as IDEMPOTENCY_TABLE,Na as MAIL_RETENTION,ka as MAIL_TABLE,Lo as MAX_DURABLE_STREAM_BYTES,Oo as MAX_DURABLE_STREAM_CHUNKS,ha as MAX_PAGE_SIZE,Ti as MAX_SQL_ROWS,va as NotFoundError,F as NotUniqueError,Os as OwnerRelay,pt as QUEUE_TABLE,Tt as RANK_TIEBREAK,yt as REACTOR_STATE_TABLE,jt as RELATED_DEFAULT_LIMIT,Jt as RELATED_DEPTH_DECAY,Zt as RELATED_MAX_DEPTH,$t as RELATED_MAX_LIMIT,sl as RELATION_EXISTS_KEY,Ea as RELATION_FUNCTION_PREFIX,ll as RELAY_SIGNATURE_HEADER,pl as REPROJECTION_MIGRATION_PREFIX,vs as RLS_UNWRAP_SYMBOL,Ot as ReactiveCache,Ds as RelayMember,Ks as RlsRequiredError,qr as SCAN_DEP,ar as SCHEDULE_OUTBOX_TABLE,Hs as SCHEMA_HISTORY_MAX_VERSIONS,Tr as SEARCH_STATE_TABLE,_r as SHAPE_POKE_CURSOR_TABLE,ti as ShapeDiffCache,ui as ShardRunner,Xi as TransactionHeadroomTracker,Gt as UNVOUCHABLE_DEP,$i as VECTOR_BACKFILL_MAX_PAGES,mo as WORKERD_SQLITE_LIMITS,Ce as advanceClientWatermark,Zr as aggUpsertSql,c as aggregateSqlFunction,f as aggregateTableName,Oe as allocateCommitSeq,D as appendAuditEntry,Y as appendCdcChange,ho as appendStreamChunk,j as applyCdcChanges,us as applyInsertDefaults,Ss as applyOnDelete,$a as applySelect,fe as archiveCdcSegment,Ya as armRestore,ts as assertFlatPredicate,N as assertNoExplicitUndefined,Wa as assertPatchAllowed,Ri as assertReadonly,ss as assertShapeShardable,k as assertStorableRowId,B as assertValidClientId,Pi as awaitWsDrain,v as backfillAggregateIndexes,K as backfillRankIndexes,W as backfillSearchIndexes,X as backfillSearchIndexesForTable,el as backfillVectorIndexes,Ii as bigintSqlKey,ta as boundingBoxCenter,sa as boundingBoxGeohashes,Kt as buildIndexRange,ni as buildPokeFrames,Bs as buildReprojectionMigration,et as buildSeekBeforeWhere,rt as buildSeekWhere,Zs as buildSettings,oi as buildShapeDiff,J as bumpCdcEpoch,xe as cdcArchiveRewound,Z as cdcCanVouchFor,$ as cdcForkedError,ee as cdcSeqLeavingRows,re as cdcTouchesTables,oe as cdcTrimmedError,Eo as claimStreamRun,Cs as clampPromotionThresholds,Ba as clearCapturedMail,Fe as clearCompanionSignatures,je as clearMemoryTables,ut as clearQueueMessages,x as coerceAggregateNumber,ae as compactCdcDocs,ol as compileWhereSql,is as composeReadPredicate,er as computeRankPage,ls as containsRelationPredicate,Us as countLegacyRows,ia as coveringGeohashes,ke as createCompanionSync,vr as createDependencyTracker,Ta as createFanoutCounters,Ra as createGlobalPollCounters,$r as createIndexSql,wt as createReadFootprint,Ps as createRelayLink,Ms as createReplicaLink,si as createShapeDiffCache,Aa as createShapeProbeCounters,U as createShardCtxDb,wi as createSystemReader,te as cursorBelowRetainedFloor,Do as decideDurableAttach,bi as decodeBigintSqlKey,ot as decodeCursor,Li as decodeFloat64SqlKey,tr as deferScheduleOutbox,Ge as deleteGlobalShapeSnapshot,we as deleteGlobalShapeSnapshotsForConnection,Ir as deleteShapePokeCursor,br as deleteShapePokeCursorsForConnection,To as deleteStreamRun,Kr as depKey,es as deriveRelationEdges,ms as describeRelationWrites,No as diffExternalSource,di as diffGlobalMembership,fs as distinctValues,sr as dropScheduleOutbox,h as encodeAggregateKey,at as encodeCursor,la as encodeGeohash,Rt as encodePartitionKey,ci as encodeRowsPatch,P as ensureAuditTable,Ua as ensureMailTable,yo as envOptionalPositiveInt,Mo as envPositiveInt,tt as equalityPinnedFields,o as exportShardRows,Ca as facetColumn,xs as fanOutScalarCounts,rs as findRelated,ga as findStorageReferences,Ro as finishStreamRun,Oi as float64SqlKey,E as foldAggregateTally,ir as forgetScheduleOutbox,jo as ftsCompanionDdl,Jo as ftsPurgeDocument,Zo as ftsRowidMapName,$o as ftsUnmappedPage,ea as ftsWriteDocument,Fs as gateReplicaDispatch,eo as geoTableName,ii as globalShapeReadKey,ra as groupUnmappedRows,Ws as guardWriter,Ns as handleReplicaControl,lr as hasScheduleOutboxEntry,Vi as hasTrigger,na as haversineMeters,a as importShardRows,Wt as indexKeysForRow,$s as isDevEnvironment,ro as isFtsAvailable,fl as isInternalTableName,St as isLossyBody,Je as isMemoryTable,Vt as isPushableWhere,ns as isRelationPredicate,Ho as isSoftDeleted,Vo as isSourceDue,Yi as isTtlExpired,_a as isVacuousFilterClause,oo as jsonPath,ao as jsonPathSql,Xt as keysTouchRanges,Bo as liftSourceId,Ai as lintReadonlySql,Mt as listReactorStates,Ia as listTables,qt as markUnvouchableReads,At as matchesRankStaticWhere,m as matchesStaticWhere,qo as materializeExternalRows,vo as materializeExternalRowsIncremental,Ze as memoryTableNames,ki as mergeChangedKeys,C as mergeWhere,se as migrateCdcLog,ie as migrateCdcMeta,ge as migrateClientWatermark,De as migrateCommitSeq,Ao as migrateDurableStreams,qe as migrateGlobalShapeSnapshot,He as migrateIdempotency,Ft as migrateReactorState,nr as migrateScheduleOutbox,Rr as migrateSearchState,Lr as migrateShapePokeCursor,le as minCdcReplayableSeq,ne as minCdcSeq,Or as minShapePokeCursor,gs as nextPromotionState,ji as nextTtlExpiry,p as normalizeCountArgument,G as normalizeIdStructurally,st as normalizeOrderKeys,Uo as normalizeSourceDocument,Go as normalizeSourceValue,it as nullsFirstOf,lt as nullsOrderSuffix,Xa as operatorFields,po as param,dr as parkScheduleOutbox,t as parseExportShardArgs,s as parseImportShardArgs,Ha as patchDependsOnRow,g as planAggregateLookup,da as pointInBoundingBox,cr as probeScheduleOutbox,mi as projectColumns,zo as pullExternalSourceIncrementalTick,Qo as pullExternalSourceTick,to as qualifiedJsonPath,so as qualifiedJsonPathSql,hl as quoteIdentifier,Ct as rankKeyFromDoc,gt as rankPivotConditionSql,_t as rankTableName,Dt as reactiveCacheKey,Nt as reactorNeedsRun,T as readAggregateValue,he as readArchivedCdcChanges,y as readAuditLog,ja as readBookmark,Ga as readCapturedMail,Ee as readCdcArchivedThrough,de as readCdcChangeKeys,ce as readCdcChanges,me as readCdcCursor,pe as readCdcEpoch,_e as readClientWatermark,Pe as readCommitSeq,ei as readDeployInfo,mr as readDueScheduleOutbox,pr as readDueScheduleOutboxEntry,Ko as readExternalSourceBaseline,ve as readGlobalShapeSnapshot,Ve as readIdempotent,Ur as readMigrationStatus,Va as readPatchField,ft as readQueueMessageById,xt as readQueueMessages,kt as readReactorState,ur as readScheduleOutbox,Sr as readScheduleOutboxState,Vs as readSchemaHistory,zs as readSchemaVersion,Ar as readSearchBackfillState,Dr as readShapePokeCursor,Co as readStreamChunks,go as readStreamRun,ba as readTablePage,wa as recordCapturedMail,Bi as recordChangedKeys,La as recordFanoutPass,Oa as recordGlobalPollPass,ht as recordQueueMessages,fr as recordScheduleOutbox,Qs as recordSchemaVersion,Da as recordShapeProbePass,hs as relationHooks,_s as relayCountFor,uo as renderSql,Gs as reprojectableFields,ul as reprojectionMigrationId,ws as reprojectionTables,xr as requeueScheduleOutbox,za as resolvePatch,It as resolveRankPartition,rr as resolveRankSeekTuple,ds as resolveRelationPredicates,Es as resolveWith,io as rowToDocument,Gr as runDataMigration,Hr as runDrizzle,Wo as runExternalSourceTick,Ci as runReadonlySql,Ts as runRowValidators,Tl as runShardMigrations,hi as runSocketPool,Vr as runSql,zi as runTriggers,Ji as selectExpiredIds,i as selectExportTables,_ as selectIndexForAggregate,I as selectIndexForCount,b as selectIndexForGroupBy,Pa as selectMatchingIds,Fr as selectShapeMembers,Nr as selectShapeRows,js as serializeSqlValue,al as serverInList,Is as shapeRoutingKey,nl as siblingSecretOf,dl as signSiblingBody,nt as softDeleteScope,bt as sortColumnName,So as sqliteInList,Al as stableStringify,Cl as stableWireKey,w as stripReservedPatchFields,fi as stubByName,yi as subscriptionFrames,Mi as subscriptionListDeltas,ya as summarizeFanoutTopics,Ma as summarizeSubscriptions,lo as tableColumns,Wr as tableFromDepKey,u as throwingScheduler,dt as tiebreakDirectionFor,ue as trimCdcChanges,ze as trimIdempotent,hr as trimScheduleOutbox,_o as trimStreamRuns,no as tryRowToDocument,Fi as trySendFrame,fo as unionAll,ct as uniqueIndexFields,l as validateImportRow,cl as verifySiblingBody,zt as whereFilter,Qt as whereOfFilter,Te as writeCdcArchivedThrough,Ke as writeGlobalShapeSnapshot,Qe as writeIdempotent,Bt as writeReactorState,Cr as writeSearchBackfillState,Pr as writeShapePokeCursor,yr as writeShapePokeCursors,Ui as writeTouchesMemo};
@@ -0,0 +1 @@
1
+ import{LunoraError as d}from"@lunora/errors";import{decodeWire as Q,WIRE_TAG as R,needsWireEncoding as X,encodeWire as G}from"@lunora/wire";import{sql as K}from"drizzle-orm";import{isInternalTableName as w}from"./isInternalTableName-BoljO2tP.mjs";import{n as T,o as V}from"./do-sql-105TONaE.mjs";import{quoteIdentifier as u}from"./quoteIdentifier-CObIFRhb.mjs";import{renderSql as J,sqliteInList as Y}from"./WORKERD_SQLITE_LIMITS-B_4w7tzY.mjs";import{serializeSqlValue as L}from"./serializeSqlValue-DeoBMpZ2.mjs";import{decodeBigintSqlKey as z}from"./BIGINT_KEY_DIGITS-DE6yshOt.mjs";const je="__lunora_admin__:",Le="__lunora_relation__:",Fe="__lunora_flags__:",xe={applyCdc:"__lunora_admin__:applyCdc",aiAvailable:"__lunora_admin__:aiAvailable",aiChartConfig:"__lunora_admin__:aiChartConfig",aiCronExpression:"__lunora_admin__:aiCronExpression",aiGenerateSql:"__lunora_admin__:aiGenerateSql",aiNameQuery:"__lunora_admin__:aiNameQuery",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",dropOutboxEntry:"__lunora_admin__:dropOutboxEntry",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",getScheduleOutbox:"__lunora_admin__:getScheduleOutbox",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",rebuildCompanions:"__lunora_admin__:rebuildCompanions",recordAuthEvent:"__lunora_admin__:recordAuthEvent",recordContainerEvent:"__lunora_admin__:recordContainerEvent",recordMail:"__lunora_admin__:recordMail",recordQueueMessage:"__lunora_admin__:recordQueueMessage",releaseShardRegistration:"__lunora_admin__:releaseShardRegistration",replayQueueMessage:"__lunora_admin__:replayQueueMessage",retryOutboxEntry:"__lunora_admin__:retryOutboxEntry",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",sendWorkflowEvent:"__lunora_admin__:sendWorkflowEvent",setIssueSeverity:"__lunora_admin__:setIssueSeverity",storageOrphans:"__lunora_admin__:storageOrphans",storageReferences:"__lunora_admin__:storageReferences",storageRules:"__lunora_admin__:storageRules",studioFeatures:"__lunora_admin__:studioFeatures",writeRow:"__lunora_admin__:writeRow"},Z=50,y=500,ee=30,te=200,c="__doc__",x=e=>{try{const t=JSON.parse(e);return t!==null&&typeof t=="object"&&!Array.isArray(t)?t:void 0}catch{return}},ne=e=>{const{[T]:t,...n}=e;return t===void 0?n:t===null||typeof t!="object"||Array.isArray(t)?{[T]:t,...n}:{...n,...Q(t)}},re=(e,t)=>{if(!e.includes(c))return{columns:e,rows:t};const n=[];for(const a of t){const i=a[c],_=typeof i=="string"?x(i):void 0;if(_===void 0)return{columns:e,rows:t};const l=Object.fromEntries(Object.entries(a).filter(([m])=>m!==c));n.push({...l,...ne(_)})}const r=e.filter(a=>a!==c),o=[],s=new Set(r);for(const a of n)for(const i of Object.keys(a))s.has(i)||(s.add(i),o.push(i));return{columns:[...r,...o],rows:n}},S=e=>`instr(lower(CAST(${e} AS TEXT)), lower(?)) > 0`,C=(e,t,n)=>Math.min(Math.max(e,t),n),U=(e,t)=>{const n=e.exec(`SELECT COUNT(*) AS c FROM ${t}`).one();return Number(n.c)},Ue=e=>{const t=e.exec("SELECT name FROM sqlite_master WHERE type = 'table' ORDER BY name").toArray(),n=[];for(const{name:r}of t)w(r)||n.push({name:r,rowCount:U(e,u(r))});return n},q=(e,t)=>e.exec("SELECT name FROM sqlite_master WHERE type = 'table' AND name = ? LIMIT 1",t).toArray().length>0,O=(e,t)=>{if(w(t)||!q(e,t))throw new d("UNKNOWN_TABLE",`unknown table: ${t}`,{status:404})},A=(e,t)=>e.exec(`PRAGMA table_info(${t})`).toArray().map(n=>n.name),I={eq:"=",gt:">",gte:">=",lt:"<",lte:"<=",ne:"<>"},F=100,M=(e,t)=>{if(t>F)throw new d("BAD_REQUEST",`the query over ${e} binds ${String(t)} parameters, and a statement takes at most ${String(F)} — remove some filters or narrow the search`)},P=e=>typeof e=="string"?e:typeof e=="number"||typeof e=="boolean"?String(e):"",oe=new Set(["gt","gte","lt","lte"]),se=e=>e.operator==="contains"?P(e.value)==="":oe.has(e.operator)&&e.value==="",W=(e,t)=>{if(!t.every(n=>typeof n=="string"&&n!==""))throw new d("BAD_REQUEST",`nested path under ${e} must name each field with a non-empty string, got ${JSON.stringify(t)}`);return`$.${[e,...t].map(n=>V(n)).join(".")}`},b=(e,t,n=[])=>{const r=t.includes(e),o=t.includes(c);if(!(!r&&!o)){if(r){if(n.length>0)throw new d("BAD_REQUEST",`${e} is a physical column, so it has no nested path`);return{expression:u(e),params:[]}}return{expression:`json_extract(${u(c)}, ?)`,params:[W(e,n)]}}},ae=/^-?\d+$/u,v=(e,t)=>{const{value:n}=e;if(t==="bigint"&&(typeof n=="number"||typeof n=="string")){const r=typeof n=="number"&&Number.isInteger(n)?BigInt(n).toString():String(n).trim();if(!ae.test(r))throw new d("BAD_REQUEST",`bigint column ${e.column} can only be filtered by an integer, got ${JSON.stringify(n)}`);return L(BigInt(r))}if(t==="bigint"&&typeof n!="bigint")throw new d("BAD_REQUEST",`bigint column ${e.column} can only be filtered by an integer, got ${JSON.stringify(n)}`);return L(n)},ie=(e,t)=>t==="bigint"&&typeof e=="string"?z(e)??e:e,_e=e=>{if(typeof e=="boolean")return{params:[],sql:`j.type = '${e?"true":"false"}'`};if(typeof e=="string")return{params:[e],sql:"j.type = 'text' AND j.value = ?"};if(typeof e=="number"&&Number.isFinite(e))return{params:[e],sql:"j.type IN ('integer', 'real') AND j.value = ?"};throw new d("BAD_REQUEST",'"has" needs a string, number or boolean value to look for in the array')},le=(e,t,n)=>{if(t.includes(e.column))throw new d("BAD_REQUEST",`"has" needs an array-valued document field, but ${e.column} is a physical column`);if(!t.includes(c))return;const r=e.path??[];if(r.length===0&&n?.[e.column]==="bigint")throw new d("BAD_REQUEST",`"has" is not supported on bigint column ${e.column} — it stores a sort key, not an array`);const o=_e(e.value),s=W(e.column,r),a=u(c),i=`SELECT 1 FROM json_each(${a}, ?) AS j WHERE typeof(j.key) = 'integer' AND ${o.sql}`;return{params:[`${s}[0]`,s,...o.params,`${s}[1]`,`${s}[2]`,...o.params],sql:`CASE WHEN json_extract(${a}, ?) IS NOT '${R}' THEN EXISTS (${i}) WHEN json_extract(${a}, ?) IS 'arr' THEN EXISTS (${i}) ELSE 0 END`}},ce=e=>{if(!(e==null||typeof e=="string"||typeof e=="boolean"))try{return X(e)?JSON.stringify(G(e)):void 0}catch(t){throw new d("BAD_REQUEST",`this filter value cannot be compared: ${t instanceof Error?t.message:String(t)}`)}},ue=e=>typeof e=="number"?"'integer', 'real'":e?"'true'":"'false'",de=(e,t,n)=>{const r=ce(e.value);if(r!==void 0){if(e.operator!=="eq"&&e.operator!=="ne")throw new d("BAD_REQUEST",`a value nested under ${e.column} that holds a bigint, bytes, date, map or set can only be compared with = or <>, got ${e.operator}`);return{params:[...n,r],sql:`${t} ${I[e.operator]} ?`}}const{operator:o}=e;if(o==="gt"||o==="gte"||o==="lt"||o==="lte"){let s="'integer', 'real'";return typeof e.value=="string"?s="'text'":typeof e.value=="boolean"&&(s="'true', 'false'"),{params:[...n,...n,v(e,void 0)],sql:`(json_type(${u(c)}, ?) IN (${s}) AND ${t} ${I[o]} ?)`}}if((o==="eq"||o==="ne")&&(typeof e.value=="boolean"||typeof e.value=="number")){const s=`json_type(${u(c)}, ?) IN (${ue(e.value)}) AND ${t} = ?`,a=v(e,void 0);return o==="eq"?{params:[...n,...n,a],sql:`(${s})`}:{params:[...n,...n,...n,a],sql:`(${t} IS NOT NULL AND NOT (${s}))`}}},H=e=>{const t=`json_tree(${e})`;return`NOT (typeof(j.key) = 'integer' AND j.key IN (0, 1) AND EXISTS (SELECT 1 FROM ${t} AS f WHERE f.parent = j.parent AND f.key = 0 AND f.type = 'text' AND f.atom = '${R}') AND (WITH RECURSIVE links(node, k) AS (SELECT j.parent, 0 UNION ALL SELECT c.parent, links.k + 1 FROM links JOIN ${t} AS c ON c.id = links.node WHERE typeof(c.key) = 'integer' AND c.key = 2 AND ${((r,o)=>`(SELECT count(*) FROM ${t} AS ${r} WHERE ${r}.parent = ${o} AND typeof(${r}.key) = 'integer' AND ((${r}.key = 0 AND ${r}.atom = '${R}') OR (${r}.key = 1 AND ${r}.atom = 'arr'))) = 2`)("h","c.parent")}) SELECT max(k) FROM links) % 2 = 0)`},me=(e,t,n)=>({params:[t,t,n,t,t,n,t,t,n,t,t,t],sql:`CASE WHEN json_type(${e}, ?) IN ('text', 'integer', 'real') THEN ${S(`json_extract(${e}, ?)`)} WHEN json_type(${e}, ?) IN ('true', 'false') THEN ${S(`json_type(${e}, ?)`)} WHEN json_type(${e}, ?) IN ('array', 'object') THEN EXISTS (SELECT 1 FROM json_tree(${e}, ?) AS j WHERE j.type IN ('text', 'integer', 'real', 'true', 'false') AND ${S("CASE WHEN j.type IN ('true', 'false') THEN j.type ELSE j.value END")} AND ${H(`${e}, ?`)}) ELSE 0 END`}),fe=(e,{expression:t,kind:n,pathParameters:r,physical:o})=>{const s=e.path??[];if(n==="bigint")throw new d("BAD_REQUEST",`"contains" is not supported on bigint column ${e.column} — use =, <, > instead`);const a=P(e.value);return s.length===0&&o?{params:[a],sql:S(t)}:s.length===0?me(u(c),r[0],a):{params:[...r,...r,a],sql:`(json_type(${u(c)}, ?) IN ('text', 'integer', 'real') AND ${S(t)})`}},pe=(e,t,n)=>{if(e.operator==="has")return le(e,t,n);const r=e.path??[],o=b(e.column,t,r);if(o===void 0||se(e))return;const{expression:s,params:a}=o,i=t.includes(e.column)||r.length>0?void 0:n?.[e.column];if(e.operator==="contains")return fe(e,{expression:s,kind:i,pathParameters:a,physical:t.includes(e.column)});if(e.value===null&&(e.operator==="eq"||e.operator==="ne"))return{params:a,sql:`${s} IS ${e.operator==="ne"?"NOT ":""}NULL`};if(r.length>0){const _=de(e,s,a);if(_!==void 0)return _}return{params:[...a,v(e,i)],sql:`${s} ${I[e.operator]} ?`}},Ee=new Set(["date","timestamp"]),ge=[`$.${T}`,`$."${T}"`].map(e=>`substr(j.fullkey, 1, ${String(e.length+1)}) NOT IN ('${e}.', '${e}[')`).join(" AND "),Se=e=>`(${S(e)} AND EXISTS (SELECT 1 FROM json_tree(${e}) AS j WHERE j.type IN ('text', 'integer', 'real', 'true', 'false') AND ${S("CASE WHEN j.type IN ('true', 'false') THEN j.type ELSE j.value END")} AND ${ge} AND ${H(e)}))`,he=/["\\\u0000-\u001F]/u,ye=e=>he.test(e)?"":e,be=/^(\d{4})(?:-(\d{2}))?(?:-(\d{2}))?$/u,Ne=e=>{const t=be.exec(e.trim());if(t===null)return;const n=Number(t[1]),r=t[2]===void 0?void 0:Number(t[2]),o=t[3]===void 0?void 0:Number(t[3]);if(r!==void 0&&(r<1||r>12)||o!==void 0&&(o<1||o>31)||n<100)return;const s=Date.UTC(n,(r??1)-1,o??1);if(o!==void 0&&new Date(s).getUTCDate()!==o)return;let a;return o!==void 0?a=Date.UTC(n,(r??1)-1,o+1):r===void 0?a=Date.UTC(n+1,0,1):a=Date.UTC(n,r,1),{from:s,to:a}},D=(e,t,n,r)=>{const o=[],s=[];if(t!==""&&e.length>0){const a=e.map(_=>_===c?Se(u(_)):S(u(_)));s.push(...e.flatMap(_=>_===c?[ye(t),t]:[t]));const i=Ne(t);if(i!==void 0){for(const l of e)a.push(`(${u(l)} >= ? AND ${u(l)} < ?)`),s.push(i.from,i.to);const _=Object.keys(r??{}).filter(l=>!e.includes(l)&&Ee.has(r?.[l]??""));_.length>0&&e.includes(c)&&(a.push(`EXISTS (SELECT 1 FROM json_each(${u(c)}) AS j WHERE j.key IN (SELECT value FROM json_each(?)) AND j.type IN ('integer', 'real') AND j.value >= ? AND j.value < ?)`),s.push(JSON.stringify(_),i.from,i.to))}o.push(`(${a.join(" OR ")})`)}for(const a of n??[]){const i=pe(a,e,r);i!==void 0&&(o.push(`(${i.sql})`),s.push(...i.params))}return o.length===0?void 0:{parameters:s,where:o.join(" AND ")}},Te=(e,t)=>{if(e===void 0)return;const n=b(e.column,t);if(n===void 0)return;const r=e.direction==="desc"?"DESC":"ASC";return{params:n.params,sql:`${n.expression} ${r}`}},qe=(e,t)=>{const{table:n}=t;O(e,n);const r=C(Math.trunc(t.limit??Z),1,y),o=Math.max(0,Math.trunc(t.offset??0)),s=u(n),a=A(e,s),i=t.search?.trim()??"",_=N=>{if(t.refs===void 0)return N;const $={};for(const k of N.columns){const j=t.refs[k];j!==void 0&&($[k]=j)}return Object.keys($).length>0?{...N,refs:$}:N},l=D(a,i,t.filters,t.columnKinds),m=Te(t.orderBy,a),p=l===void 0?"":` WHERE ${l.where}`,g=m===void 0?"":` ORDER BY ${m.sql}`,E=l?.parameters??[],h=m?.params??[];M(n,E.length+h.length+2);let f;t.skipCount||(f=l===void 0?U(e,s):Number(e.exec(`SELECT COUNT(*) AS c FROM ${s}${p}`,...E).one().c));const B=e.exec(`SELECT * FROM ${s}${p}${g} LIMIT ? OFFSET ?`,...E,...h,r,o).toArray();return _({...re(a,B),sqlColumns:a,total:f})},Pe=(e,t)=>{const{table:n}=t;O(e,n);const r=C(Math.trunc(t.limit??y),1,y),o=u(n),s=A(e,o),a=t.search?.trim()??"";for(const f of t.filters??[])if(b(f.column,s,f.path??[])===void 0)throw new d("BAD_REQUEST",`unknown column: ${f.column}`);const i=D(s,a,t.filters,t.columnKinds);if(i===void 0&&(t.filters?.length??0)>0)throw new d("BAD_REQUEST",`the filters on ${n} are all empty, so the predicate constrains no rows — refusing to select the whole table`);const _=[],l=[];i!==void 0&&(_.push(i.where),l.push(...i.parameters)),t.after!==void 0&&(_.push("id > ?"),l.push(t.after));const m=_.length===0?"":` WHERE ${_.join(" AND ")}`,p=t.after===void 0?"":" ORDER BY id";M(n,l.length+1);const g=e.exec(`SELECT id FROM ${o}${m}${p} LIMIT ?`,...l,r+1).toArray(),E=g.length>r,h=g.slice(0,r).map(f=>f.id);return{hasMore:E,ids:h}},Ae=(e,t,n,r)=>{const o=new Set(n.filter(a=>a!==c));if(!n.includes(c))return o;for(const a of Object.keys(r??{}))o.add(a);const s=e.exec(`SELECT ${u(c)} AS doc FROM ${t} LIMIT ?`,y).toArray();for(const{doc:a}of s){const i=typeof a=="string"?x(a):void 0;if(i!==void 0)for(const _ of Object.keys(i))o.add(_)}return o},We=(e,t)=>{const{column:n,table:r}=t;O(e,r);const o=u(r),s=A(e,o);if(!Ae(e,o,s,t.columnKinds).has(n))throw new d("UNKNOWN_COLUMN",`unknown column: ${n}`,{status:404});const a=b(n,s);if(a===void 0)throw new d("UNKNOWN_COLUMN",`unknown column: ${n}`,{status:404});const i=C(Math.trunc(t.limit??ee),1,te),_=t.search?.trim()??"",l=D(s,_,t.filters,t.columnKinds),m=l===void 0?"":` WHERE ${l.where}`,p=l?.parameters??[];M(r,a.params.length*2+p.length+1);const g=e.exec(`SELECT ${a.expression} AS value, COUNT(*) AS count FROM ${o}${m} GROUP BY ${a.expression} ORDER BY count DESC LIMIT ?`,...a.params,...p,...a.params,i+1).toArray(),E=g.length>i,h=s.includes(n)?void 0:t.columnKinds?.[n];return{truncated:E,values:g.slice(0,i).map(f=>({count:Number(f.count),value:ie(f.value,h)}))}},He=(e,t,n)=>{const r={},o=n.slice(0,y);for(const s of o)r[s]=[];if(o.length===0)return{references:r,storageColumns:t};for(const[s,a]of Object.entries(t)){if(w(s)||!q(e,s))continue;const i=u(s),_=A(e,i);for(const l of a){const m=b(l,_);if(m===void 0)continue;const p=J("sqlite",Y(K.raw(m.expression),o,!1)),g=e.exec(`SELECT id, ${m.expression} AS ref FROM ${i} WHERE ${p.sql}`,...m.params,...m.params,...p.params).toArray();for(const E of g)r[E.ref]?.push({column:l,id:E.id,table:s})}}return{references:r,storageColumns:t}},Be=e=>{const n=e.filter(o=>o.authenticated!==!1).map((o,s)=>{const a=Object.values(o.subs??{}).map(i=>({args:i.args,functionPath:i.functionPath,table:i.table}));return{admin:o.admin===!0,id:s,subscriptions:a}}),r=n.reduce((o,s)=>o+s.subscriptions.length,0);return{connections:n,totalConnections:n.length,totalSubscriptions:r}},$e=20,Qe=()=>({maxMs:0,passes:0,peakSocketsIterated:0,socketsDelivered:0,socketsIterated:0,totalMs:0}),Xe=()=>({run:0,served:0}),Ge=()=>({drains:0,pairsSkipped:0}),Ke=(e,t,n)=>({drains:e.drains+t,pairsSkipped:e.pairsSkipped+n}),Ve=(e,t,n)=>({run:e.run+t,served:e.served+n}),Je=(e,t,n,r)=>({maxMs:Math.max(e.maxMs,r),passes:e.passes+1,peakSocketsIterated:Math.max(e.peakSocketsIterated,t),socketsDelivered:e.socketsDelivered+n,socketsIterated:e.socketsIterated+t,totalMs:e.totalMs+r}),Ye=(e,t=$e)=>{const n=new Map,r=new Map,o=e.filter(i=>i.authenticated!==!1);for(const i of o){for(const _ of Object.values(i.shapes??{})){const l=_.name??"(unknown shape)";n.set(l,(n.get(l)??0)+1)}for(const _ of i.whispers??[])r.set(_,(r.get(_)??0)+1)}const s=[...[...n].map(([i,_])=>({kind:"shape",subscribers:_,topic:i})),...[...r].map(([i,_])=>({kind:"whisper",subscribers:_,topic:i}))];return s.sort((i,_)=>_.subscribers-i.subscribers||i.topic.localeCompare(_.topic)),{peakSubscribers:s[0]?.subscribers??0,topics:s.slice(0,t),totalConnections:o.length}};export{xe as ADMIN_FUNCTIONS,je as ADMIN_FUNCTION_PREFIX,$e as DEFAULT_FANOUT_TOPIC_LIMIT,Fe as FLAGS_FUNCTION_PREFIX,y as MAX_PAGE_SIZE,Le as RELATION_FUNCTION_PREFIX,Qe as createFanoutCounters,Ge as createGlobalPollCounters,Xe as createShapeProbeCounters,Ne as datePrefixRange,We as facetColumn,He as findStorageReferences,w as isInternalTableName,se as isVacuousFilterClause,Ue as listTables,qe as readTablePage,Je as recordFanoutPass,Ke as recordGlobalPollPass,Ve as recordShapeProbePass,Pe as selectMatchingIds,Ye as summarizeFanoutTopics,Be as summarizeSubscriptions};
@@ -0,0 +1 @@
1
+ import"./effective-kind-BmG_zCAy.mjs";import"./json-field-path-DeJW4U9z.mjs";import{A as l,a as n,b as i,D as d,n as p,W as u,c as m,d as q,l as S,s as G,m as c,k as A,g as D,i as f,j as _,e as h,p as P,v as T,q as g,f as j,r as y,t as C,h as O,u as b}from"./do-sql-105TONaE.mjs";import{quoteIdentifier as E}from"./quoteIdentifier-CObIFRhb.mjs";import"./runDrizzle-RC09zZrh.mjs";import{serializeSqlValue as J}from"./serializeSqlValue-DeoBMpZ2.mjs";import"./BIGINT_KEY_DIGITS-DE6yshOt.mjs";export{l as AGG_COUNT,n as AGG_KEY,i as AGG_VALUE,d as DOC_COLUMN,p as DOC_ORIGINALS_KEY,u as WRAPPED_SQL,m as aggUpsertSql,q as createIndexSql,S as decodeDocJson,G as decodeGroupKeyValue,c as doWhereSqlStrategy,A as encodeDocJson,D as geoTableName,f as isFtsAvailable,_ as jsonPath,h as jsonPathSql,P as jsonTypeGuard,T as jsonTypeGuardSql,g as qualifiedJsonPath,j as qualifiedJsonPathSql,E as quoteIdentifier,y as rowToDocument,J as serializeSqlValue,C as tableColumns,O as tryRowToDocument,b as unwrapSql};
@@ -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 I,runDrizzle as n}from"./runDrizzle-RC09zZrh.mjs";import{k as m,l as A}from"./do-sql-RROYQPCM.mjs";import{ConflictError as p}from"./ConflictError-C8GtJmjS.mjs";const c="__cdc_log",N=`INSERT INTO ${C(c)} (ts, ${C("table")}, id, op, doc) VALUES (?, ?, ?, ?, ?)`,$="__cdc_log_table_seq",O="__cdc_log_table_id_seq",u=t.raw("op <> 'delete' AND doc IS NULL"),_="__cdc_log_payload_gap",U=(e,o={})=>{n(e,t`CREATE TABLE IF NOT EXISTS ${t.identifier(c)} (
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 I,runDrizzle as n}from"./runDrizzle-RC09zZrh.mjs";import{k as m,l as A}from"./do-sql-105TONaE.mjs";import{ConflictError as p}from"./ConflictError-C8GtJmjS.mjs";const c="__cdc_log",N=`INSERT INTO ${C(c)} (ts, ${C("table")}, id, op, doc) VALUES (?, ?, ?, ?, ?)`,$="__cdc_log_table_seq",O="__cdc_log_table_id_seq",u=t.raw("op <> 'delete' AND doc IS NULL"),_="__cdc_log_payload_gap",U=(e,o={})=>{n(e,t`CREATE TABLE IF NOT EXISTS ${t.identifier(c)} (
2
2
  seq INTEGER PRIMARY KEY AUTOINCREMENT,
3
3
  ts REAL NOT NULL,
4
4
  ${t.identifier("table")} TEXT NOT NULL,