@lunora/shard-engine 1.0.0-alpha.188 → 1.0.0-alpha.189

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.mts CHANGED
@@ -1562,7 +1562,6 @@ declare const ADMIN_FUNCTIONS: {
1562
1562
  readonly facetColumn: "__lunora_admin__:facetColumn";
1563
1563
  readonly findRelated: "__lunora_admin__:findRelated";
1564
1564
  readonly getAdvisories: "__lunora_admin__:getAdvisories";
1565
- readonly getAdvisorProcedures: "__lunora_admin__:getAdvisorProcedures";
1566
1565
  readonly getAuditLog: "__lunora_admin__:getAuditLog";
1567
1566
  readonly getAuthMetrics: "__lunora_admin__:getAuthMetrics";
1568
1567
  readonly getCapturedMail: "__lunora_admin__:getCapturedMail";
@@ -1737,9 +1736,6 @@ interface AdvisorProcedure {
1737
1736
  visibility: "internal" | "public";
1738
1737
  writesUserTable?: boolean;
1739
1738
  }
1740
- interface AdvisorProceduresResult {
1741
- procedures: AdvisorProcedure[];
1742
- }
1743
1739
  interface RlsPolicyMetadata {
1744
1740
  file: string;
1745
1741
  on: "delete" | "insert" | "read" | "update";
@@ -2810,4 +2806,4 @@ declare const backfillVectorIndexes: (sql: SqlExec, targets: ReadonlyArray<Vecto
2810
2806
  ordered: OrderedAfterWrites;
2811
2807
  restart?: boolean;
2812
2808
  }) => Promise<VectorBackfillProgress>;
2813
- export { ADMIN_FUNCTIONS, ADMIN_FUNCTION_PREFIX, ADMIN_TOKEN_TABLE, AGGREGATE_SQL_FUNCTION, AGG_COUNT, AGG_KEY, AGG_VALUE, AUDIT_LOG_TABLE, type AdminTokenSummary, 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, adminTokenExists, 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, createAdminTokenRecord, 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, listAdminTokens, 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, revokeAdminTokenRecord, rowToDocument, runDataMigration, runDrizzle, runExternalSourceTick, runReadonlySql, runRowValidators, runShardMigrations, runSocketPool, runSql, runTriggers, selectExpiredIds, selectExportTables, selectIndexForAggregate, selectIndexForCount, selectIndexForGroupBy, selectMatchingIds, selectShapeMembers, selectShapeRows, serializeSqlValue, serverInList, shapeRoutingKey, siblingSecretOf, signSiblingBody, softDeleteScope, sortColumnName, sqliteInList, stripReservedPatchFields, stubByName, subscriptionFrames, subscriptionListDeltas, summarizeFanoutTopics, summarizeSubscriptions, tableColumns, tableFromDepKey, throwingScheduler, tiebreakDirectionFor, trimCdcChanges, trimIdempotent, trimScheduleOutbox, trimStreamRuns, tryRowToDocument, trySendFrame, unionAll, uniqueIndexFields, validateImportRow, verifyAdminTokenDigest, verifySiblingBody, whereFilter, whereOfFilter, writeCdcArchivedThrough, writeGlobalShapeSnapshot, writeIdempotent, writeReactorState, writeSearchBackfillState, writeShapePokeCursor, writeShapePokeCursors, writeTouchesMemo };
2809
+ export { ADMIN_FUNCTIONS, ADMIN_FUNCTION_PREFIX, ADMIN_TOKEN_TABLE, AGGREGATE_SQL_FUNCTION, AGG_COUNT, AGG_KEY, AGG_VALUE, AUDIT_LOG_TABLE, type AdminTokenSummary, type AdvisorProcedure, type AdvisoriesResult, type AdvisoryFinding, type AggregateIndexDefinitionLike, type AggregateOp, type AggregateOptions, type AggregateResult, type AggregateTally, type AppendAuditEntry, type ApplyOnDeleteOptions, type AuditEntry, type AuditLogResult, BIGINT_KEY_DIGITS, type BroadcastDelta, CDC_LOG_TABLE, CDC_LOG_TABLE_SEQ_INDEX, CDC_META_TABLE, CLIENT_WATERMARK_TABLE, COMMIT_SEQ_FIELD, COMMIT_SEQ_TABLE, CURSOR_PREFIX, type CacheEntry, type CapturedMailRow, type CdcArchiveScope, type CdcChange, type CdcChangeKey, type ChangedKeys, type Clock, type ColumnMeta, type ColumnMetaLike, CompanionMemo, type CompanionSync, type CompanionSyncDeps, ConflictError, type ConflictKind, type CountArgs, CountRlsUnsupportedError, type CreateWorkflowInstanceResult, type 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, adminTokenExists, 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, createAdminTokenRecord, 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, listAdminTokens, 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, revokeAdminTokenRecord, rowToDocument, runDataMigration, runDrizzle, runExternalSourceTick, runReadonlySql, runRowValidators, runShardMigrations, runSocketPool, runSql, runTriggers, selectExpiredIds, selectExportTables, selectIndexForAggregate, selectIndexForCount, selectIndexForGroupBy, selectMatchingIds, selectShapeMembers, selectShapeRows, serializeSqlValue, serverInList, shapeRoutingKey, siblingSecretOf, signSiblingBody, softDeleteScope, sortColumnName, sqliteInList, stripReservedPatchFields, stubByName, subscriptionFrames, subscriptionListDeltas, summarizeFanoutTopics, summarizeSubscriptions, tableColumns, tableFromDepKey, throwingScheduler, tiebreakDirectionFor, trimCdcChanges, trimIdempotent, trimScheduleOutbox, trimStreamRuns, tryRowToDocument, trySendFrame, unionAll, uniqueIndexFields, validateImportRow, verifyAdminTokenDigest, verifySiblingBody, whereFilter, whereOfFilter, writeCdcArchivedThrough, writeGlobalShapeSnapshot, writeIdempotent, writeReactorState, writeSearchBackfillState, writeShapePokeCursor, writeShapePokeCursors, writeTouchesMemo };
package/dist/index.d.ts CHANGED
@@ -1562,7 +1562,6 @@ declare const ADMIN_FUNCTIONS: {
1562
1562
  readonly facetColumn: "__lunora_admin__:facetColumn";
1563
1563
  readonly findRelated: "__lunora_admin__:findRelated";
1564
1564
  readonly getAdvisories: "__lunora_admin__:getAdvisories";
1565
- readonly getAdvisorProcedures: "__lunora_admin__:getAdvisorProcedures";
1566
1565
  readonly getAuditLog: "__lunora_admin__:getAuditLog";
1567
1566
  readonly getAuthMetrics: "__lunora_admin__:getAuthMetrics";
1568
1567
  readonly getCapturedMail: "__lunora_admin__:getCapturedMail";
@@ -1737,9 +1736,6 @@ interface AdvisorProcedure {
1737
1736
  visibility: "internal" | "public";
1738
1737
  writesUserTable?: boolean;
1739
1738
  }
1740
- interface AdvisorProceduresResult {
1741
- procedures: AdvisorProcedure[];
1742
- }
1743
1739
  interface RlsPolicyMetadata {
1744
1740
  file: string;
1745
1741
  on: "delete" | "insert" | "read" | "update";
@@ -2810,4 +2806,4 @@ declare const backfillVectorIndexes: (sql: SqlExec, targets: ReadonlyArray<Vecto
2810
2806
  ordered: OrderedAfterWrites;
2811
2807
  restart?: boolean;
2812
2808
  }) => Promise<VectorBackfillProgress>;
2813
- export { ADMIN_FUNCTIONS, ADMIN_FUNCTION_PREFIX, ADMIN_TOKEN_TABLE, AGGREGATE_SQL_FUNCTION, AGG_COUNT, AGG_KEY, AGG_VALUE, AUDIT_LOG_TABLE, type AdminTokenSummary, 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, adminTokenExists, 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, createAdminTokenRecord, 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, listAdminTokens, 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, revokeAdminTokenRecord, rowToDocument, runDataMigration, runDrizzle, runExternalSourceTick, runReadonlySql, runRowValidators, runShardMigrations, runSocketPool, runSql, runTriggers, selectExpiredIds, selectExportTables, selectIndexForAggregate, selectIndexForCount, selectIndexForGroupBy, selectMatchingIds, selectShapeMembers, selectShapeRows, serializeSqlValue, serverInList, shapeRoutingKey, siblingSecretOf, signSiblingBody, softDeleteScope, sortColumnName, sqliteInList, stripReservedPatchFields, stubByName, subscriptionFrames, subscriptionListDeltas, summarizeFanoutTopics, summarizeSubscriptions, tableColumns, tableFromDepKey, throwingScheduler, tiebreakDirectionFor, trimCdcChanges, trimIdempotent, trimScheduleOutbox, trimStreamRuns, tryRowToDocument, trySendFrame, unionAll, uniqueIndexFields, validateImportRow, verifyAdminTokenDigest, verifySiblingBody, whereFilter, whereOfFilter, writeCdcArchivedThrough, writeGlobalShapeSnapshot, writeIdempotent, writeReactorState, writeSearchBackfillState, writeShapePokeCursor, writeShapePokeCursors, writeTouchesMemo };
2809
+ export { ADMIN_FUNCTIONS, ADMIN_FUNCTION_PREFIX, ADMIN_TOKEN_TABLE, AGGREGATE_SQL_FUNCTION, AGG_COUNT, AGG_KEY, AGG_VALUE, AUDIT_LOG_TABLE, type AdminTokenSummary, type AdvisorProcedure, type AdvisoriesResult, type AdvisoryFinding, type AggregateIndexDefinitionLike, type AggregateOp, type AggregateOptions, type AggregateResult, type AggregateTally, type AppendAuditEntry, type ApplyOnDeleteOptions, type AuditEntry, type AuditLogResult, BIGINT_KEY_DIGITS, type BroadcastDelta, CDC_LOG_TABLE, CDC_LOG_TABLE_SEQ_INDEX, CDC_META_TABLE, CLIENT_WATERMARK_TABLE, COMMIT_SEQ_FIELD, COMMIT_SEQ_TABLE, CURSOR_PREFIX, type CacheEntry, type CapturedMailRow, type CdcArchiveScope, type CdcChange, type CdcChangeKey, type ChangedKeys, type Clock, type ColumnMeta, type ColumnMetaLike, CompanionMemo, type CompanionSync, type CompanionSyncDeps, ConflictError, type ConflictKind, type CountArgs, CountRlsUnsupportedError, type CreateWorkflowInstanceResult, type 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, adminTokenExists, 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, createAdminTokenRecord, 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, listAdminTokens, 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, revokeAdminTokenRecord, rowToDocument, runDataMigration, runDrizzle, runExternalSourceTick, runReadonlySql, runRowValidators, runShardMigrations, runSocketPool, runSql, runTriggers, selectExpiredIds, selectExportTables, selectIndexForAggregate, selectIndexForCount, selectIndexForGroupBy, selectMatchingIds, selectShapeMembers, selectShapeRows, serializeSqlValue, serverInList, shapeRoutingKey, siblingSecretOf, signSiblingBody, softDeleteScope, sortColumnName, sqliteInList, stripReservedPatchFields, stubByName, subscriptionFrames, subscriptionListDeltas, summarizeFanoutTopics, summarizeSubscriptions, tableColumns, tableFromDepKey, throwingScheduler, tiebreakDirectionFor, trimCdcChanges, trimIdempotent, trimScheduleOutbox, trimStreamRuns, tryRowToDocument, trySendFrame, unionAll, uniqueIndexFields, validateImportRow, verifyAdminTokenDigest, 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 i,selectExportTables as s,validateImportRow as n}from"./packem_shared/exportShardRows-CZh4wrvI.mjs";import{adminTokenExists as d,createAdminTokenRecord as c,listAdminTokens as m,revokeAdminTokenRecord as p,verifyAdminTokenDigest as u}from"./packem_shared/adminTokenExists-CjKKZzfY.mjs";import{AGGREGATE_SQL_FUNCTION as f,aggregateSqlFunction as x,matchesStaticWhere as E,normalizeCountArgument as h,throwingScheduler as T}from"./packem_shared/AGGREGATE_SQL_FUNCTION-C_ZipS9R.mjs";import{aggregateTableName as A,coerceAggregateNumber as C,encodeAggregateKey as g,foldAggregateTally as _,readAggregateValue as I}from"./packem_shared/aggregateTableName-B_CtIQCS.mjs";import{CountRlsUnsupportedError as L,mergeWhere as D,planAggregateLookup as O,selectIndexForAggregate as P,selectIndexForCount as y,selectIndexForGroupBy as M}from"./packem_shared/CountRlsUnsupportedError-BvsDqfO2.mjs";import{AUDIT_LOG_TABLE as k,appendAuditEntry as N,ensureAuditTable as B,readAuditLog as U}from"./packem_shared/AUDIT_LOG_TABLE-BFJ65SRS.mjs";import{NotUniqueError as w,assertNoExplicitUndefined as q,assertStorableRowId as v,assertValidClientId as K,createShardCtxDb as W,normalizeIdStructurally as X,stripReservedPatchFields as H}from"./packem_shared/NotUniqueError-DGCd3Cph.mjs";import{backfillAggregateIndexes as z,backfillRankIndexes as Q,backfillSearchIndexes as Y,backfillSearchIndexesForTable as j}from"./packem_shared/backfillAggregateIndexes-Pk0KLrfk.mjs";import{CDC_LOG_TABLE as Z,CDC_LOG_TABLE_SEQ_INDEX as $,CDC_META_TABLE as ee,appendCdcChange as re,applyCdcChanges as oe,bumpCdcEpoch as ae,cdcCanVouchFor as te,cdcForkedError as ie,cdcSeqLeavingRows as se,cdcTouchesTables as ne,cdcTrimmedError as le,compactCdcDocs as de,cursorBelowRetainedFloor as ce,migrateCdcLog as me,migrateCdcMeta as pe,minCdcReplayableSeq as ue,minCdcSeq as Se,readCdcChangeKeys as fe,readCdcChanges as xe,readCdcCursor as Ee,readCdcEpoch as he,trimCdcChanges as Te}from"./packem_shared/CDC_LOG_TABLE-BFGgqai8.mjs";import{archiveCdcSegment as Ae,cdcArchiveRewound as Ce,readArchivedCdcChanges as ge,readCdcArchivedThrough as _e,writeCdcArchivedThrough as Ie}from"./packem_shared/archiveCdcSegment-Cr8oGLfB.mjs";import{CLIENT_WATERMARK_TABLE as Le,advanceClientWatermark as De,migrateClientWatermark as Oe,readClientWatermark as Pe}from"./packem_shared/CLIENT_WATERMARK_TABLE-De7z_OHV.mjs";import{COMMIT_SEQ_FIELD as Me,COMMIT_SEQ_TABLE as Fe,allocateCommitSeq as ke,migrateCommitSeq as Ne,readCommitSeq as Be}from"./packem_shared/COMMIT_SEQ_FIELD-Da1DjGqo.mjs";import{CompanionMemo as Ge,clearCompanionSignatures as we}from"./packem_shared/CompanionMemo-BXU5vfak.mjs";import{createCompanionSync as ve}from"./packem_shared/createCompanionSync-CEht4hXX.mjs";import{GLOBAL_SHAPE_SNAPSHOT_TABLE as We,deleteGlobalShapeSnapshot as Xe,deleteGlobalShapeSnapshotsForConnection as He,migrateGlobalShapeSnapshot as Ve,readGlobalShapeSnapshot as ze,writeGlobalShapeSnapshot as Qe}from"./packem_shared/GLOBAL_SHAPE_SNAPSHOT_TABLE-Bb6-aZuH.mjs";import{IDEMPOTENCY_TABLE as je,migrateIdempotency as Je,readIdempotent as Ze,trimIdempotent as $e,writeIdempotent as er}from"./packem_shared/IDEMPOTENCY_TABLE-COrgeP3O.mjs";import{clearMemoryTables as or,isMemoryTable as ar,memoryTableNames as tr}from"./packem_shared/clearMemoryTables-aMRERF0w.mjs";import{computeRankPage as sr,resolveRankSeekTuple as nr}from"./packem_shared/computeRankPage-xm-70mLy.mjs";import{SCHEDULE_OUTBOX_TABLE as dr,deferScheduleOutbox as cr,dropScheduleOutbox as mr,forgetScheduleOutbox as pr,hasScheduleOutboxEntry as ur,migrateScheduleOutbox as Sr,parkScheduleOutbox as fr,probeScheduleOutbox as xr,readDueScheduleOutbox as Er,readDueScheduleOutboxEntry as hr,readScheduleOutbox as Tr,readScheduleOutboxState as Rr,recordScheduleOutbox as Ar,requeueScheduleOutbox as Cr,trimScheduleOutbox as gr}from"./packem_shared/SCHEDULE_OUTBOX_TABLE-iyyiSjsO.mjs";import{S as Ir,m as br,r as Lr,w as Dr}from"./packem_shared/ctx-db-search-state-CPKPy8N6.mjs";import{SHAPE_POKE_CURSOR_TABLE as Pr,deleteShapePokeCursor as yr,deleteShapePokeCursorsForConnection as Mr,migrateShapePokeCursor as Fr,minShapePokeCursor as kr,readShapePokeCursor as Nr,writeShapePokeCursor as Br,writeShapePokeCursors as Ur}from"./packem_shared/SHAPE_POKE_CURSOR_TABLE-BGvY3sFI.mjs";import{selectShapeMembers as wr,selectShapeRows as qr}from"./packem_shared/selectShapeMembers-Dqx_m7BF.mjs";import{DATA_MIGRATION_STATE_TABLE as Kr,readMigrationStatus as Wr,runDataMigration as Xr}from"./packem_shared/DATA_MIGRATION_STATE_TABLE-CFvBS9-M.mjs";import{SCAN_DEP as Vr,createDependencyTracker as zr,depKey as Qr,tableFromDepKey as Yr}from"./packem_shared/SCAN_DEP-B4Uu4g7l.mjs";import{runDrizzle as Jr,runSql as Zr}from"./packem_shared/runDrizzle-RC09zZrh.mjs";import{A as eo,a as ro,b as oo,D as ao,c as to,d as io,g as so,i as no,j as lo,e as co,q as mo,f as po,r as uo,t as So,h as fo}from"./packem_shared/do-sql-105TONaE.mjs";import{WORKERD_SQLITE_LIMITS as Eo,param as ho,renderSql as To,sqliteInList as Ro,unionAll as Ao}from"./packem_shared/WORKERD_SQLITE_LIMITS-B_4w7tzY.mjs";import{appendStreamChunk as go,claimStreamRun as _o,deleteStreamRun as Io,finishStreamRun as bo,migrateDurableStreams as Lo,readStreamChunks as Do,readStreamRun as Oo,trimStreamRuns as Po}from"./packem_shared/appendStreamChunk-BZYgGE9Y.mjs";import{DurableStreamRunner as Mo,MAX_DURABLE_STREAM_BYTES as Fo,MAX_DURABLE_STREAM_CHUNKS as ko,decideDurableAttach as No}from"./packem_shared/DurableStreamRunner-MMlV5qKQ.mjs";import{envOptionalPositiveInt as Uo,envPositiveInt as Go}from"./packem_shared/envOptionalPositiveInt-D2pY-c64.mjs";import{diffExternalSource as qo}from"./packem_shared/diffExternalSource-B0FZlDoL.mjs";import{liftSourceId as Ko,normalizeSourceDocument as Wo,normalizeSourceValue as Xo}from"./packem_shared/liftSourceId-CA3ENhXj.mjs";import{materializeExternalRows as Vo,materializeExternalRowsIncremental as zo,readExternalSourceBaseline as Qo,runExternalSourceTick as Yo}from"./packem_shared/materializeExternalRows-CHPRx8fu.mjs";import{isSoftDeleted as Jo,isSourceDue as Zo,pullExternalSourceIncrementalTick as $o,pullExternalSourceTick as ea}from"./packem_shared/isSoftDeleted-BBWKE0Sm.mjs";import{f as oa,a as aa,b as ta,c as ia,d as sa,g as na}from"./packem_shared/fts-companion-CE3EmIjk.mjs";import{GEO_DEFAULT_PRECISION as da,boundingBoxCenter as ca,boundingBoxGeohashes as ma,coveringGeohashes as pa,encodeGeohash as ua,haversineMeters as Sa,pointInBoundingBox as fa}from"./packem_shared/GEO_DEFAULT_PRECISION-CqpQZ-J_.mjs";import{default as Ea}from"./packem_shared/GlobalPollTick-BNK4o-XT.mjs";import{ADMIN_FUNCTIONS as Ta,ADMIN_FUNCTION_PREFIX as Ra,DEFAULT_FANOUT_TOPIC_LIMIT as Aa,FLAGS_FUNCTION_PREFIX as Ca,MAX_PAGE_SIZE as ga,RELATION_FUNCTION_PREFIX as _a,createFanoutCounters as Ia,createGlobalPollCounters as ba,createShapeProbeCounters as La,facetColumn as Da,findStorageReferences as Oa,isVacuousFilterClause as Pa,listTables as ya,readTablePage as Ma,recordFanoutPass as Fa,recordGlobalPollPass as ka,recordShapeProbePass as Na,selectMatchingIds as Ba,summarizeFanoutTopics as Ua,summarizeSubscriptions as Ga}from"./packem_shared/ADMIN_FUNCTIONS-CKbIcXAC.mjs";import{MAIL_RETENTION as qa,MAIL_TABLE as va,clearCapturedMail as Ka,ensureMailTable as Wa,readCapturedMail as Xa,recordCapturedMail as Ha}from"./packem_shared/MAIL_RETENTION-DMolrLYt.mjs";import{NotFoundError as za}from"./packem_shared/NotFoundError-BhF7FeFr.mjs";import{assertPatchAllowed as Ya,operatorFields as ja,patchDependsOnRow as Ja,readPatchField as Za,resolvePatch as $a}from"./packem_shared/assertPatchAllowed-CA_H466g.mjs";import{armRestore as rt,readBookmark as ot}from"./packem_shared/armRestore-Bu1_8SUa.mjs";import{CURSOR_PREFIX as tt,applySelect as it,buildSeekBeforeWhere as st,buildSeekWhere as nt,decodeCursor as lt,encodeCursor as dt,equalityPinnedFields as ct,normalizeOrderKeys as mt,nullsFirstOf as pt,nullsOrderSuffix as ut,softDeleteScope as St,tiebreakDirectionFor as ft,uniqueIndexFields as xt}from"./packem_shared/CURSOR_PREFIX-6offuG6M.mjs";import{QUEUE_TABLE as ht,clearQueueMessages as Tt,isLossyBody as Rt,readQueueMessageById as At,readQueueMessages as Ct,recordQueueMessages as gt}from"./packem_shared/QUEUE_TABLE-C-goXtGd.mjs";import{RANK_TIEBREAK as It,encodePartitionKey as bt,matchesRankStaticWhere as Lt,rankKeyFromDoc as Dt,rankPivotConditionSql as Ot,rankTableName as Pt,resolveRankPartition as yt,sortColumnName as Mt}from"./packem_shared/RANK_TIEBREAK-D3ye2GsL.mjs";import{ReactiveCache as kt,reactiveCacheKey as Nt}from"./packem_shared/ReactiveCache-BG9z3FE9.mjs";import{REACTOR_STATE_TABLE as Ut,listReactorStates as Gt,migrateReactorState as wt,reactorNeedsRun as qt,readReactorState as vt,writeReactorState as Kt}from"./packem_shared/REACTOR_STATE_TABLE-D2Mn204f.mjs";import{UNVOUCHABLE_DEP as Xt,createReadFootprint as Ht,markUnvouchableReads as Vt}from"./packem_shared/UNVOUCHABLE_DEP-Ds9gxVqs.mjs";import{buildIndexRange as Qt,indexKeysForRow as Yt,keysTouchRanges as jt}from"./packem_shared/buildIndexRange-BTChxh3k.mjs";import{isPushableWhere as Zt,whereFilter as $t,whereOfFilter as ei}from"./packem_shared/isPushableWhere-BeYAOjUb.mjs";import{RELATED_DEFAULT_LIMIT as oi,RELATED_DEPTH_DECAY as ai,RELATED_MAX_DEPTH as ti,RELATED_MAX_LIMIT as ii,deriveRelationEdges as si,findRelated as ni}from"./packem_shared/RELATED_DEFAULT_LIMIT-CVqN4JEu.mjs";import{DEFAULT_MAX_RELATION_KEYS as di,assertFlatPredicate as ci,assertShapeShardable as mi,composeReadPredicate as pi,containsRelationPredicate as ui,isRelationPredicate as Si,resolveRelationPredicates as fi}from"./packem_shared/DEFAULT_MAX_RELATION_KEYS-DfrMi_eE.mjs";import{describeRelationWrites as Ei}from"./packem_shared/describeRelationWrites-omar6-u9.mjs";import{applyInsertDefaults as Ti,applyOnDelete as Ri,distinctValues as Ai,fanOutScalarCounts as Ci,relationHooks as gi,resolveWith as _i,runRowValidators as Ii}from"./packem_shared/applyInsertDefaults-CVukTkQ5.mjs";import{D as Li,c as Di,n as Oi,r as Pi,s as yi}from"./packem_shared/relay-CKEdfUjH.mjs";import{DEFAULT_MAX_RELAYS as Fi,OwnerRelay as ki,RelayMember as Ni,createRelayLink as Bi}from"./packem_shared/DEFAULT_MAX_RELAYS-Bc6PI-xy.mjs";import{createReplicaLink as Gi,gateReplicaDispatch as wi,handleReplicaControl as qi}from"./packem_shared/createReplicaLink-DtqXBi-0.mjs";import{buildReprojectionMigration as Ki,countLegacyRows as Wi,reprojectableFields as Xi,reprojectionTables as Hi}from"./packem_shared/buildReprojectionMigration-B8aEpETD.mjs";import{RLS_UNWRAP_SYMBOL as zi,RlsRequiredError as Qi,guardWriter as Yi}from"./packem_shared/RLS_UNWRAP_SYMBOL-H6J96vgK.mjs";import{SCHEMA_HISTORY_MAX_VERSIONS as Ji,readSchemaHistory as Zi,readSchemaVersion as $i,recordSchemaVersion as es}from"./packem_shared/SCHEMA_HISTORY_MAX_VERSIONS-CEwFjj-O.mjs";import{serializeSqlValue as os}from"./packem_shared/serializeSqlValue-DeoBMpZ2.mjs";import{buildSettings as ts,isDevEnvironment as is,readDeployInfo as ss}from"./packem_shared/buildSettings-BRkZd6_E.mjs";import{buildShapeDiff as ls}from"./packem_shared/buildShapeDiff-CdLJTijm.mjs";import{ShapeDiffCache as cs,createShapeDiffCache as ms,globalShapeReadKey as ps}from"./packem_shared/ShapeDiffCache-iNO-hUiy.mjs";import{buildPokeFrames as Ss,diffGlobalMembership as fs,encodeRowsPatch as xs,projectColumns as Es}from"./packem_shared/buildPokeFrames-WR-hp0mX.mjs";import{ShardRunner as Ts}from"./packem_shared/ShardRunner-CrveaPId.mjs";import{stubByName as As}from"./packem_shared/stubByName-DQSivmvb.mjs";import{runSocketPool as gs}from"./packem_shared/runSocketPool-CZJ2X9cF.mjs";import{MAX_SQL_ROWS as Is,assertReadonly as bs,lintReadonlySql as Ls,runReadonlySql as Ds}from"./packem_shared/MAX_SQL_ROWS-B4WlVI-e.mjs";import{BIGINT_KEY_DIGITS as Ps,bigintSqlKey as ys,decodeBigintSqlKey as Ms,decodeFloat64SqlKey as Fs,float64SqlKey as ks}from"./packem_shared/BIGINT_KEY_DIGITS-DE6yshOt.mjs";import{awaitWsDrain as Bs,subscriptionFrames as Us,subscriptionListDeltas as Gs,trySendFrame as ws}from"./packem_shared/awaitWsDrain-DMcWBQ7I.mjs";import{mergeChangedKeys as vs,recordChangedKeys as Ks,writeTouchesMemo as Ws}from"./packem_shared/mergeChangedKeys-DPKhen6e.mjs";import{createSystemReader as Hs}from"./packem_shared/createSystemReader-BSCxr8Qs.mjs";import{ConflictError as zs}from"./packem_shared/ConflictError-C8GtJmjS.mjs";import{DEFAULT_TRANSACTION_LIMITS as Ys,TransactionHeadroomTracker as js}from"./packem_shared/DEFAULT_TRANSACTION_LIMITS-D7p7Ys0M.mjs";import{hasTrigger as Zs,runTriggers as $s}from"./packem_shared/hasTrigger-CjlwI4le.mjs";import{isTtlExpired as rn,nextTtlExpiry as on,selectExpiredIds as an}from"./packem_shared/isTtlExpired-DNxmZA6e.mjs";import{VECTOR_BACKFILL_MAX_PAGES as sn,backfillVectorIndexes as nn}from"./packem_shared/VECTOR_BACKFILL_MAX_PAGES-DcQpf83n.mjs";import{c as dn,s as cn}from"./packem_shared/where-sql-BjY4rnqb.mjs";import{RELATION_EXISTS_KEY as pn}from"./packem_shared/RELATION_EXISTS_KEY-wxgj6rSL.mjs";import{ADMIN_TOKEN_TABLE as Sn}from"./packem_shared/ADMIN_TOKEN_TABLE-DfQ5osdI.mjs";import{RELAY_SIGNATURE_HEADER as xn,siblingSecretOf as En,signSiblingBody as hn,verifySiblingBody as Tn}from"./packem_shared/RELAY_SIGNATURE_HEADER-CAfC4tqg.mjs";import{REPROJECTION_MIGRATION_PREFIX as An,reprojectionMigrationId as Cn}from"./packem_shared/REPROJECTION_MIGRATION_PREFIX-Czcb6_mO.mjs";import{isInternalTableName as _n}from"./packem_shared/isInternalTableName-BoljO2tP.mjs";import{quoteIdentifier as bn}from"./packem_shared/quoteIdentifier-CObIFRhb.mjs";import{runShardMigrations as Dn}from"./packem_shared/runShardMigrations-BPFg3Ht6.mjs";import{stableStringify as Pn,stableWireKey as yn}from"@lunora/wire";export{Ta as ADMIN_FUNCTIONS,Ra as ADMIN_FUNCTION_PREFIX,Sn as ADMIN_TOKEN_TABLE,f as AGGREGATE_SQL_FUNCTION,eo as AGG_COUNT,ro as AGG_KEY,oo as AGG_VALUE,k as AUDIT_LOG_TABLE,Ps as BIGINT_KEY_DIGITS,Z as CDC_LOG_TABLE,$ as CDC_LOG_TABLE_SEQ_INDEX,ee as CDC_META_TABLE,Le as CLIENT_WATERMARK_TABLE,Me as COMMIT_SEQ_FIELD,Fe as COMMIT_SEQ_TABLE,tt as CURSOR_PREFIX,Ge as CompanionMemo,zs as ConflictError,L as CountRlsUnsupportedError,Kr as DATA_MIGRATION_STATE_TABLE,Aa as DEFAULT_FANOUT_TOPIC_LIMIT,di as DEFAULT_MAX_RELATION_KEYS,Fi as DEFAULT_MAX_RELAYS,Li as DEFAULT_PROMOTION_THRESHOLDS,Ys as DEFAULT_TRANSACTION_LIMITS,ao as DOC_COLUMN,Mo as DurableStreamRunner,Ca as FLAGS_FUNCTION_PREFIX,da as GEO_DEFAULT_PRECISION,We as GLOBAL_SHAPE_SNAPSHOT_TABLE,Ea as GlobalPollTick,je as IDEMPOTENCY_TABLE,qa as MAIL_RETENTION,va as MAIL_TABLE,Fo as MAX_DURABLE_STREAM_BYTES,ko as MAX_DURABLE_STREAM_CHUNKS,ga as MAX_PAGE_SIZE,Is as MAX_SQL_ROWS,za as NotFoundError,w as NotUniqueError,ki as OwnerRelay,ht as QUEUE_TABLE,It as RANK_TIEBREAK,Ut as REACTOR_STATE_TABLE,oi as RELATED_DEFAULT_LIMIT,ai as RELATED_DEPTH_DECAY,ti as RELATED_MAX_DEPTH,ii as RELATED_MAX_LIMIT,pn as RELATION_EXISTS_KEY,_a as RELATION_FUNCTION_PREFIX,xn as RELAY_SIGNATURE_HEADER,An as REPROJECTION_MIGRATION_PREFIX,zi as RLS_UNWRAP_SYMBOL,kt as ReactiveCache,Ni as RelayMember,Qi as RlsRequiredError,Vr as SCAN_DEP,dr as SCHEDULE_OUTBOX_TABLE,Ji as SCHEMA_HISTORY_MAX_VERSIONS,Ir as SEARCH_STATE_TABLE,Pr as SHAPE_POKE_CURSOR_TABLE,cs as ShapeDiffCache,Ts as ShardRunner,js as TransactionHeadroomTracker,Xt as UNVOUCHABLE_DEP,sn as VECTOR_BACKFILL_MAX_PAGES,Eo as WORKERD_SQLITE_LIMITS,d as adminTokenExists,De as advanceClientWatermark,to as aggUpsertSql,x as aggregateSqlFunction,A as aggregateTableName,ke as allocateCommitSeq,N as appendAuditEntry,re as appendCdcChange,go as appendStreamChunk,oe as applyCdcChanges,Ti as applyInsertDefaults,Ri as applyOnDelete,it as applySelect,Ae as archiveCdcSegment,rt as armRestore,ci as assertFlatPredicate,q as assertNoExplicitUndefined,Ya as assertPatchAllowed,bs as assertReadonly,mi as assertShapeShardable,v as assertStorableRowId,K as assertValidClientId,Bs as awaitWsDrain,z as backfillAggregateIndexes,Q as backfillRankIndexes,Y as backfillSearchIndexes,j as backfillSearchIndexesForTable,nn as backfillVectorIndexes,ys as bigintSqlKey,ca as boundingBoxCenter,ma as boundingBoxGeohashes,Qt as buildIndexRange,Ss as buildPokeFrames,Ki as buildReprojectionMigration,st as buildSeekBeforeWhere,nt as buildSeekWhere,ts as buildSettings,ls as buildShapeDiff,ae as bumpCdcEpoch,Ce as cdcArchiveRewound,te as cdcCanVouchFor,ie as cdcForkedError,se as cdcSeqLeavingRows,ne as cdcTouchesTables,le as cdcTrimmedError,_o as claimStreamRun,Di as clampPromotionThresholds,Ka as clearCapturedMail,we as clearCompanionSignatures,or as clearMemoryTables,Tt as clearQueueMessages,C as coerceAggregateNumber,de as compactCdcDocs,dn as compileWhereSql,pi as composeReadPredicate,sr as computeRankPage,ui as containsRelationPredicate,Wi as countLegacyRows,pa as coveringGeohashes,c as createAdminTokenRecord,ve as createCompanionSync,zr as createDependencyTracker,Ia as createFanoutCounters,ba as createGlobalPollCounters,io as createIndexSql,Ht as createReadFootprint,Bi as createRelayLink,Gi as createReplicaLink,ms as createShapeDiffCache,La as createShapeProbeCounters,W as createShardCtxDb,Hs as createSystemReader,ce as cursorBelowRetainedFloor,No as decideDurableAttach,Ms as decodeBigintSqlKey,lt as decodeCursor,Fs as decodeFloat64SqlKey,cr as deferScheduleOutbox,Xe as deleteGlobalShapeSnapshot,He as deleteGlobalShapeSnapshotsForConnection,yr as deleteShapePokeCursor,Mr as deleteShapePokeCursorsForConnection,Io as deleteStreamRun,Qr as depKey,si as deriveRelationEdges,Ei as describeRelationWrites,qo as diffExternalSource,fs as diffGlobalMembership,Ai as distinctValues,mr as dropScheduleOutbox,g as encodeAggregateKey,dt as encodeCursor,ua as encodeGeohash,bt as encodePartitionKey,xs as encodeRowsPatch,B as ensureAuditTable,Wa as ensureMailTable,Uo as envOptionalPositiveInt,Go as envPositiveInt,ct as equalityPinnedFields,o as exportShardRows,Da as facetColumn,Ci as fanOutScalarCounts,ni as findRelated,Oa as findStorageReferences,bo as finishStreamRun,ks as float64SqlKey,_ as foldAggregateTally,pr as forgetScheduleOutbox,oa as ftsCompanionDdl,aa as ftsPurgeDocument,ta as ftsRowidMapName,ia as ftsUnmappedPage,sa as ftsWriteDocument,wi as gateReplicaDispatch,so as geoTableName,ps as globalShapeReadKey,na as groupUnmappedRows,Yi as guardWriter,qi as handleReplicaControl,ur as hasScheduleOutboxEntry,Zs as hasTrigger,Sa as haversineMeters,a as importShardRows,Yt as indexKeysForRow,is as isDevEnvironment,no as isFtsAvailable,_n as isInternalTableName,Rt as isLossyBody,ar as isMemoryTable,Zt as isPushableWhere,Si as isRelationPredicate,Jo as isSoftDeleted,Zo as isSourceDue,rn as isTtlExpired,Pa as isVacuousFilterClause,lo as jsonPath,co as jsonPathSql,jt as keysTouchRanges,Ko as liftSourceId,Ls as lintReadonlySql,m as listAdminTokens,Gt as listReactorStates,ya as listTables,Vt as markUnvouchableReads,Lt as matchesRankStaticWhere,E as matchesStaticWhere,Vo as materializeExternalRows,zo as materializeExternalRowsIncremental,tr as memoryTableNames,vs as mergeChangedKeys,D as mergeWhere,me as migrateCdcLog,pe as migrateCdcMeta,Oe as migrateClientWatermark,Ne as migrateCommitSeq,Lo as migrateDurableStreams,Ve as migrateGlobalShapeSnapshot,Je as migrateIdempotency,wt as migrateReactorState,Sr as migrateScheduleOutbox,br as migrateSearchState,Fr as migrateShapePokeCursor,ue as minCdcReplayableSeq,Se as minCdcSeq,kr as minShapePokeCursor,Oi as nextPromotionState,on as nextTtlExpiry,h as normalizeCountArgument,X as normalizeIdStructurally,mt as normalizeOrderKeys,Wo as normalizeSourceDocument,Xo as normalizeSourceValue,pt as nullsFirstOf,ut as nullsOrderSuffix,ja as operatorFields,ho as param,fr as parkScheduleOutbox,t as parseExportShardArgs,i as parseImportShardArgs,Ja as patchDependsOnRow,O as planAggregateLookup,fa as pointInBoundingBox,xr as probeScheduleOutbox,Es as projectColumns,$o as pullExternalSourceIncrementalTick,ea as pullExternalSourceTick,mo as qualifiedJsonPath,po as qualifiedJsonPathSql,bn as quoteIdentifier,Dt as rankKeyFromDoc,Ot as rankPivotConditionSql,Pt as rankTableName,Nt as reactiveCacheKey,qt as reactorNeedsRun,I as readAggregateValue,ge as readArchivedCdcChanges,U as readAuditLog,ot as readBookmark,Xa as readCapturedMail,_e as readCdcArchivedThrough,fe as readCdcChangeKeys,xe as readCdcChanges,Ee as readCdcCursor,he as readCdcEpoch,Pe as readClientWatermark,Be as readCommitSeq,ss as readDeployInfo,Er as readDueScheduleOutbox,hr as readDueScheduleOutboxEntry,Qo as readExternalSourceBaseline,ze as readGlobalShapeSnapshot,Ze as readIdempotent,Wr as readMigrationStatus,Za as readPatchField,At as readQueueMessageById,Ct as readQueueMessages,vt as readReactorState,Tr as readScheduleOutbox,Rr as readScheduleOutboxState,Zi as readSchemaHistory,$i as readSchemaVersion,Lr as readSearchBackfillState,Nr as readShapePokeCursor,Do as readStreamChunks,Oo as readStreamRun,Ma as readTablePage,Ha as recordCapturedMail,Ks as recordChangedKeys,Fa as recordFanoutPass,ka as recordGlobalPollPass,gt as recordQueueMessages,Ar as recordScheduleOutbox,es as recordSchemaVersion,Na as recordShapeProbePass,gi as relationHooks,Pi as relayCountFor,To as renderSql,Xi as reprojectableFields,Cn as reprojectionMigrationId,Hi as reprojectionTables,Cr as requeueScheduleOutbox,$a as resolvePatch,yt as resolveRankPartition,nr as resolveRankSeekTuple,fi as resolveRelationPredicates,_i as resolveWith,p as revokeAdminTokenRecord,uo as rowToDocument,Xr as runDataMigration,Jr as runDrizzle,Yo as runExternalSourceTick,Ds as runReadonlySql,Ii as runRowValidators,Dn as runShardMigrations,gs as runSocketPool,Zr as runSql,$s as runTriggers,an as selectExpiredIds,s as selectExportTables,P as selectIndexForAggregate,y as selectIndexForCount,M as selectIndexForGroupBy,Ba as selectMatchingIds,wr as selectShapeMembers,qr as selectShapeRows,os as serializeSqlValue,cn as serverInList,yi as shapeRoutingKey,En as siblingSecretOf,hn as signSiblingBody,St as softDeleteScope,Mt as sortColumnName,Ro as sqliteInList,Pn as stableStringify,yn as stableWireKey,H as stripReservedPatchFields,As as stubByName,Us as subscriptionFrames,Gs as subscriptionListDeltas,Ua as summarizeFanoutTopics,Ga as summarizeSubscriptions,So as tableColumns,Yr as tableFromDepKey,T as throwingScheduler,ft as tiebreakDirectionFor,Te as trimCdcChanges,$e as trimIdempotent,gr as trimScheduleOutbox,Po as trimStreamRuns,fo as tryRowToDocument,ws as trySendFrame,Ao as unionAll,xt as uniqueIndexFields,n as validateImportRow,u as verifyAdminTokenDigest,Tn as verifySiblingBody,$t as whereFilter,ei as whereOfFilter,Ie as writeCdcArchivedThrough,Qe as writeGlobalShapeSnapshot,er as writeIdempotent,Kt as writeReactorState,Dr as writeSearchBackfillState,Br as writeShapePokeCursor,Ur as writeShapePokeCursors,Ws as writeTouchesMemo};
1
+ import{exportShardRows as o,importShardRows as a,parseExportShardArgs as t,parseImportShardArgs as i,selectExportTables as s,validateImportRow as n}from"./packem_shared/exportShardRows-CZh4wrvI.mjs";import{adminTokenExists as d,createAdminTokenRecord as c,listAdminTokens as m,revokeAdminTokenRecord as p,verifyAdminTokenDigest as u}from"./packem_shared/adminTokenExists-CjKKZzfY.mjs";import{AGGREGATE_SQL_FUNCTION as f,aggregateSqlFunction as x,matchesStaticWhere as E,normalizeCountArgument as h,throwingScheduler as T}from"./packem_shared/AGGREGATE_SQL_FUNCTION-C_ZipS9R.mjs";import{aggregateTableName as A,coerceAggregateNumber as C,encodeAggregateKey as g,foldAggregateTally as _,readAggregateValue as I}from"./packem_shared/aggregateTableName-B_CtIQCS.mjs";import{CountRlsUnsupportedError as L,mergeWhere as D,planAggregateLookup as O,selectIndexForAggregate as P,selectIndexForCount as y,selectIndexForGroupBy as M}from"./packem_shared/CountRlsUnsupportedError-BvsDqfO2.mjs";import{AUDIT_LOG_TABLE as k,appendAuditEntry as N,ensureAuditTable as B,readAuditLog as U}from"./packem_shared/AUDIT_LOG_TABLE-BFJ65SRS.mjs";import{NotUniqueError as w,assertNoExplicitUndefined as q,assertStorableRowId as v,assertValidClientId as K,createShardCtxDb as W,normalizeIdStructurally as X,stripReservedPatchFields as H}from"./packem_shared/NotUniqueError-DGCd3Cph.mjs";import{backfillAggregateIndexes as z,backfillRankIndexes as Q,backfillSearchIndexes as Y,backfillSearchIndexesForTable as j}from"./packem_shared/backfillAggregateIndexes-Pk0KLrfk.mjs";import{CDC_LOG_TABLE as Z,CDC_LOG_TABLE_SEQ_INDEX as $,CDC_META_TABLE as ee,appendCdcChange as re,applyCdcChanges as oe,bumpCdcEpoch as ae,cdcCanVouchFor as te,cdcForkedError as ie,cdcSeqLeavingRows as se,cdcTouchesTables as ne,cdcTrimmedError as le,compactCdcDocs as de,cursorBelowRetainedFloor as ce,migrateCdcLog as me,migrateCdcMeta as pe,minCdcReplayableSeq as ue,minCdcSeq as Se,readCdcChangeKeys as fe,readCdcChanges as xe,readCdcCursor as Ee,readCdcEpoch as he,trimCdcChanges as Te}from"./packem_shared/CDC_LOG_TABLE-BFGgqai8.mjs";import{archiveCdcSegment as Ae,cdcArchiveRewound as Ce,readArchivedCdcChanges as ge,readCdcArchivedThrough as _e,writeCdcArchivedThrough as Ie}from"./packem_shared/archiveCdcSegment-Cr8oGLfB.mjs";import{CLIENT_WATERMARK_TABLE as Le,advanceClientWatermark as De,migrateClientWatermark as Oe,readClientWatermark as Pe}from"./packem_shared/CLIENT_WATERMARK_TABLE-De7z_OHV.mjs";import{COMMIT_SEQ_FIELD as Me,COMMIT_SEQ_TABLE as Fe,allocateCommitSeq as ke,migrateCommitSeq as Ne,readCommitSeq as Be}from"./packem_shared/COMMIT_SEQ_FIELD-Da1DjGqo.mjs";import{CompanionMemo as Ge,clearCompanionSignatures as we}from"./packem_shared/CompanionMemo-BXU5vfak.mjs";import{createCompanionSync as ve}from"./packem_shared/createCompanionSync-CEht4hXX.mjs";import{GLOBAL_SHAPE_SNAPSHOT_TABLE as We,deleteGlobalShapeSnapshot as Xe,deleteGlobalShapeSnapshotsForConnection as He,migrateGlobalShapeSnapshot as Ve,readGlobalShapeSnapshot as ze,writeGlobalShapeSnapshot as Qe}from"./packem_shared/GLOBAL_SHAPE_SNAPSHOT_TABLE-Bb6-aZuH.mjs";import{IDEMPOTENCY_TABLE as je,migrateIdempotency as Je,readIdempotent as Ze,trimIdempotent as $e,writeIdempotent as er}from"./packem_shared/IDEMPOTENCY_TABLE-COrgeP3O.mjs";import{clearMemoryTables as or,isMemoryTable as ar,memoryTableNames as tr}from"./packem_shared/clearMemoryTables-aMRERF0w.mjs";import{computeRankPage as sr,resolveRankSeekTuple as nr}from"./packem_shared/computeRankPage-xm-70mLy.mjs";import{SCHEDULE_OUTBOX_TABLE as dr,deferScheduleOutbox as cr,dropScheduleOutbox as mr,forgetScheduleOutbox as pr,hasScheduleOutboxEntry as ur,migrateScheduleOutbox as Sr,parkScheduleOutbox as fr,probeScheduleOutbox as xr,readDueScheduleOutbox as Er,readDueScheduleOutboxEntry as hr,readScheduleOutbox as Tr,readScheduleOutboxState as Rr,recordScheduleOutbox as Ar,requeueScheduleOutbox as Cr,trimScheduleOutbox as gr}from"./packem_shared/SCHEDULE_OUTBOX_TABLE-iyyiSjsO.mjs";import{S as Ir,m as br,r as Lr,w as Dr}from"./packem_shared/ctx-db-search-state-CPKPy8N6.mjs";import{SHAPE_POKE_CURSOR_TABLE as Pr,deleteShapePokeCursor as yr,deleteShapePokeCursorsForConnection as Mr,migrateShapePokeCursor as Fr,minShapePokeCursor as kr,readShapePokeCursor as Nr,writeShapePokeCursor as Br,writeShapePokeCursors as Ur}from"./packem_shared/SHAPE_POKE_CURSOR_TABLE-BGvY3sFI.mjs";import{selectShapeMembers as wr,selectShapeRows as qr}from"./packem_shared/selectShapeMembers-Dqx_m7BF.mjs";import{DATA_MIGRATION_STATE_TABLE as Kr,readMigrationStatus as Wr,runDataMigration as Xr}from"./packem_shared/DATA_MIGRATION_STATE_TABLE-CFvBS9-M.mjs";import{SCAN_DEP as Vr,createDependencyTracker as zr,depKey as Qr,tableFromDepKey as Yr}from"./packem_shared/SCAN_DEP-B4Uu4g7l.mjs";import{runDrizzle as Jr,runSql as Zr}from"./packem_shared/runDrizzle-RC09zZrh.mjs";import{A as eo,a as ro,b as oo,D as ao,c as to,d as io,g as so,i as no,j as lo,e as co,q as mo,f as po,r as uo,t as So,h as fo}from"./packem_shared/do-sql-105TONaE.mjs";import{WORKERD_SQLITE_LIMITS as Eo,param as ho,renderSql as To,sqliteInList as Ro,unionAll as Ao}from"./packem_shared/WORKERD_SQLITE_LIMITS-B_4w7tzY.mjs";import{appendStreamChunk as go,claimStreamRun as _o,deleteStreamRun as Io,finishStreamRun as bo,migrateDurableStreams as Lo,readStreamChunks as Do,readStreamRun as Oo,trimStreamRuns as Po}from"./packem_shared/appendStreamChunk-BZYgGE9Y.mjs";import{DurableStreamRunner as Mo,MAX_DURABLE_STREAM_BYTES as Fo,MAX_DURABLE_STREAM_CHUNKS as ko,decideDurableAttach as No}from"./packem_shared/DurableStreamRunner-MMlV5qKQ.mjs";import{envOptionalPositiveInt as Uo,envPositiveInt as Go}from"./packem_shared/envOptionalPositiveInt-D2pY-c64.mjs";import{diffExternalSource as qo}from"./packem_shared/diffExternalSource-B0FZlDoL.mjs";import{liftSourceId as Ko,normalizeSourceDocument as Wo,normalizeSourceValue as Xo}from"./packem_shared/liftSourceId-CA3ENhXj.mjs";import{materializeExternalRows as Vo,materializeExternalRowsIncremental as zo,readExternalSourceBaseline as Qo,runExternalSourceTick as Yo}from"./packem_shared/materializeExternalRows-CHPRx8fu.mjs";import{isSoftDeleted as Jo,isSourceDue as Zo,pullExternalSourceIncrementalTick as $o,pullExternalSourceTick as ea}from"./packem_shared/isSoftDeleted-BBWKE0Sm.mjs";import{f as oa,a as aa,b as ta,c as ia,d as sa,g as na}from"./packem_shared/fts-companion-CE3EmIjk.mjs";import{GEO_DEFAULT_PRECISION as da,boundingBoxCenter as ca,boundingBoxGeohashes as ma,coveringGeohashes as pa,encodeGeohash as ua,haversineMeters as Sa,pointInBoundingBox as fa}from"./packem_shared/GEO_DEFAULT_PRECISION-CqpQZ-J_.mjs";import{default as Ea}from"./packem_shared/GlobalPollTick-BNK4o-XT.mjs";import{ADMIN_FUNCTIONS as Ta,ADMIN_FUNCTION_PREFIX as Ra,DEFAULT_FANOUT_TOPIC_LIMIT as Aa,FLAGS_FUNCTION_PREFIX as Ca,MAX_PAGE_SIZE as ga,RELATION_FUNCTION_PREFIX as _a,createFanoutCounters as Ia,createGlobalPollCounters as ba,createShapeProbeCounters as La,facetColumn as Da,findStorageReferences as Oa,isVacuousFilterClause as Pa,listTables as ya,readTablePage as Ma,recordFanoutPass as Fa,recordGlobalPollPass as ka,recordShapeProbePass as Na,selectMatchingIds as Ba,summarizeFanoutTopics as Ua,summarizeSubscriptions as Ga}from"./packem_shared/ADMIN_FUNCTIONS-CSz3ZK2d.mjs";import{MAIL_RETENTION as qa,MAIL_TABLE as va,clearCapturedMail as Ka,ensureMailTable as Wa,readCapturedMail as Xa,recordCapturedMail as Ha}from"./packem_shared/MAIL_RETENTION-DMolrLYt.mjs";import{NotFoundError as za}from"./packem_shared/NotFoundError-BhF7FeFr.mjs";import{assertPatchAllowed as Ya,operatorFields as ja,patchDependsOnRow as Ja,readPatchField as Za,resolvePatch as $a}from"./packem_shared/assertPatchAllowed-CA_H466g.mjs";import{armRestore as rt,readBookmark as ot}from"./packem_shared/armRestore-Bu1_8SUa.mjs";import{CURSOR_PREFIX as tt,applySelect as it,buildSeekBeforeWhere as st,buildSeekWhere as nt,decodeCursor as lt,encodeCursor as dt,equalityPinnedFields as ct,normalizeOrderKeys as mt,nullsFirstOf as pt,nullsOrderSuffix as ut,softDeleteScope as St,tiebreakDirectionFor as ft,uniqueIndexFields as xt}from"./packem_shared/CURSOR_PREFIX-6offuG6M.mjs";import{QUEUE_TABLE as ht,clearQueueMessages as Tt,isLossyBody as Rt,readQueueMessageById as At,readQueueMessages as Ct,recordQueueMessages as gt}from"./packem_shared/QUEUE_TABLE-C-goXtGd.mjs";import{RANK_TIEBREAK as It,encodePartitionKey as bt,matchesRankStaticWhere as Lt,rankKeyFromDoc as Dt,rankPivotConditionSql as Ot,rankTableName as Pt,resolveRankPartition as yt,sortColumnName as Mt}from"./packem_shared/RANK_TIEBREAK-D3ye2GsL.mjs";import{ReactiveCache as kt,reactiveCacheKey as Nt}from"./packem_shared/ReactiveCache-BG9z3FE9.mjs";import{REACTOR_STATE_TABLE as Ut,listReactorStates as Gt,migrateReactorState as wt,reactorNeedsRun as qt,readReactorState as vt,writeReactorState as Kt}from"./packem_shared/REACTOR_STATE_TABLE-D2Mn204f.mjs";import{UNVOUCHABLE_DEP as Xt,createReadFootprint as Ht,markUnvouchableReads as Vt}from"./packem_shared/UNVOUCHABLE_DEP-Ds9gxVqs.mjs";import{buildIndexRange as Qt,indexKeysForRow as Yt,keysTouchRanges as jt}from"./packem_shared/buildIndexRange-BTChxh3k.mjs";import{isPushableWhere as Zt,whereFilter as $t,whereOfFilter as ei}from"./packem_shared/isPushableWhere-BeYAOjUb.mjs";import{RELATED_DEFAULT_LIMIT as oi,RELATED_DEPTH_DECAY as ai,RELATED_MAX_DEPTH as ti,RELATED_MAX_LIMIT as ii,deriveRelationEdges as si,findRelated as ni}from"./packem_shared/RELATED_DEFAULT_LIMIT-CVqN4JEu.mjs";import{DEFAULT_MAX_RELATION_KEYS as di,assertFlatPredicate as ci,assertShapeShardable as mi,composeReadPredicate as pi,containsRelationPredicate as ui,isRelationPredicate as Si,resolveRelationPredicates as fi}from"./packem_shared/DEFAULT_MAX_RELATION_KEYS-DfrMi_eE.mjs";import{describeRelationWrites as Ei}from"./packem_shared/describeRelationWrites-omar6-u9.mjs";import{applyInsertDefaults as Ti,applyOnDelete as Ri,distinctValues as Ai,fanOutScalarCounts as Ci,relationHooks as gi,resolveWith as _i,runRowValidators as Ii}from"./packem_shared/applyInsertDefaults-CVukTkQ5.mjs";import{D as Li,c as Di,n as Oi,r as Pi,s as yi}from"./packem_shared/relay-CKEdfUjH.mjs";import{DEFAULT_MAX_RELAYS as Fi,OwnerRelay as ki,RelayMember as Ni,createRelayLink as Bi}from"./packem_shared/DEFAULT_MAX_RELAYS-Bc6PI-xy.mjs";import{createReplicaLink as Gi,gateReplicaDispatch as wi,handleReplicaControl as qi}from"./packem_shared/createReplicaLink-DtqXBi-0.mjs";import{buildReprojectionMigration as Ki,countLegacyRows as Wi,reprojectableFields as Xi,reprojectionTables as Hi}from"./packem_shared/buildReprojectionMigration-B8aEpETD.mjs";import{RLS_UNWRAP_SYMBOL as zi,RlsRequiredError as Qi,guardWriter as Yi}from"./packem_shared/RLS_UNWRAP_SYMBOL-H6J96vgK.mjs";import{SCHEMA_HISTORY_MAX_VERSIONS as Ji,readSchemaHistory as Zi,readSchemaVersion as $i,recordSchemaVersion as es}from"./packem_shared/SCHEMA_HISTORY_MAX_VERSIONS-CEwFjj-O.mjs";import{serializeSqlValue as os}from"./packem_shared/serializeSqlValue-DeoBMpZ2.mjs";import{buildSettings as ts,isDevEnvironment as is,readDeployInfo as ss}from"./packem_shared/buildSettings-BRkZd6_E.mjs";import{buildShapeDiff as ls}from"./packem_shared/buildShapeDiff-CdLJTijm.mjs";import{ShapeDiffCache as cs,createShapeDiffCache as ms,globalShapeReadKey as ps}from"./packem_shared/ShapeDiffCache-iNO-hUiy.mjs";import{buildPokeFrames as Ss,diffGlobalMembership as fs,encodeRowsPatch as xs,projectColumns as Es}from"./packem_shared/buildPokeFrames-WR-hp0mX.mjs";import{ShardRunner as Ts}from"./packem_shared/ShardRunner-CrveaPId.mjs";import{stubByName as As}from"./packem_shared/stubByName-DQSivmvb.mjs";import{runSocketPool as gs}from"./packem_shared/runSocketPool-CZJ2X9cF.mjs";import{MAX_SQL_ROWS as Is,assertReadonly as bs,lintReadonlySql as Ls,runReadonlySql as Ds}from"./packem_shared/MAX_SQL_ROWS-B4WlVI-e.mjs";import{BIGINT_KEY_DIGITS as Ps,bigintSqlKey as ys,decodeBigintSqlKey as Ms,decodeFloat64SqlKey as Fs,float64SqlKey as ks}from"./packem_shared/BIGINT_KEY_DIGITS-DE6yshOt.mjs";import{awaitWsDrain as Bs,subscriptionFrames as Us,subscriptionListDeltas as Gs,trySendFrame as ws}from"./packem_shared/awaitWsDrain-DMcWBQ7I.mjs";import{mergeChangedKeys as vs,recordChangedKeys as Ks,writeTouchesMemo as Ws}from"./packem_shared/mergeChangedKeys-DPKhen6e.mjs";import{createSystemReader as Hs}from"./packem_shared/createSystemReader-BSCxr8Qs.mjs";import{ConflictError as zs}from"./packem_shared/ConflictError-C8GtJmjS.mjs";import{DEFAULT_TRANSACTION_LIMITS as Ys,TransactionHeadroomTracker as js}from"./packem_shared/DEFAULT_TRANSACTION_LIMITS-D7p7Ys0M.mjs";import{hasTrigger as Zs,runTriggers as $s}from"./packem_shared/hasTrigger-CjlwI4le.mjs";import{isTtlExpired as rn,nextTtlExpiry as on,selectExpiredIds as an}from"./packem_shared/isTtlExpired-DNxmZA6e.mjs";import{VECTOR_BACKFILL_MAX_PAGES as sn,backfillVectorIndexes as nn}from"./packem_shared/VECTOR_BACKFILL_MAX_PAGES-DcQpf83n.mjs";import{c as dn,s as cn}from"./packem_shared/where-sql-BjY4rnqb.mjs";import{RELATION_EXISTS_KEY as pn}from"./packem_shared/RELATION_EXISTS_KEY-wxgj6rSL.mjs";import{ADMIN_TOKEN_TABLE as Sn}from"./packem_shared/ADMIN_TOKEN_TABLE-DfQ5osdI.mjs";import{RELAY_SIGNATURE_HEADER as xn,siblingSecretOf as En,signSiblingBody as hn,verifySiblingBody as Tn}from"./packem_shared/RELAY_SIGNATURE_HEADER-CAfC4tqg.mjs";import{REPROJECTION_MIGRATION_PREFIX as An,reprojectionMigrationId as Cn}from"./packem_shared/REPROJECTION_MIGRATION_PREFIX-Czcb6_mO.mjs";import{isInternalTableName as _n}from"./packem_shared/isInternalTableName-BoljO2tP.mjs";import{quoteIdentifier as bn}from"./packem_shared/quoteIdentifier-CObIFRhb.mjs";import{runShardMigrations as Dn}from"./packem_shared/runShardMigrations-BPFg3Ht6.mjs";import{stableStringify as Pn,stableWireKey as yn}from"@lunora/wire";export{Ta as ADMIN_FUNCTIONS,Ra as ADMIN_FUNCTION_PREFIX,Sn as ADMIN_TOKEN_TABLE,f as AGGREGATE_SQL_FUNCTION,eo as AGG_COUNT,ro as AGG_KEY,oo as AGG_VALUE,k as AUDIT_LOG_TABLE,Ps as BIGINT_KEY_DIGITS,Z as CDC_LOG_TABLE,$ as CDC_LOG_TABLE_SEQ_INDEX,ee as CDC_META_TABLE,Le as CLIENT_WATERMARK_TABLE,Me as COMMIT_SEQ_FIELD,Fe as COMMIT_SEQ_TABLE,tt as CURSOR_PREFIX,Ge as CompanionMemo,zs as ConflictError,L as CountRlsUnsupportedError,Kr as DATA_MIGRATION_STATE_TABLE,Aa as DEFAULT_FANOUT_TOPIC_LIMIT,di as DEFAULT_MAX_RELATION_KEYS,Fi as DEFAULT_MAX_RELAYS,Li as DEFAULT_PROMOTION_THRESHOLDS,Ys as DEFAULT_TRANSACTION_LIMITS,ao as DOC_COLUMN,Mo as DurableStreamRunner,Ca as FLAGS_FUNCTION_PREFIX,da as GEO_DEFAULT_PRECISION,We as GLOBAL_SHAPE_SNAPSHOT_TABLE,Ea as GlobalPollTick,je as IDEMPOTENCY_TABLE,qa as MAIL_RETENTION,va as MAIL_TABLE,Fo as MAX_DURABLE_STREAM_BYTES,ko as MAX_DURABLE_STREAM_CHUNKS,ga as MAX_PAGE_SIZE,Is as MAX_SQL_ROWS,za as NotFoundError,w as NotUniqueError,ki as OwnerRelay,ht as QUEUE_TABLE,It as RANK_TIEBREAK,Ut as REACTOR_STATE_TABLE,oi as RELATED_DEFAULT_LIMIT,ai as RELATED_DEPTH_DECAY,ti as RELATED_MAX_DEPTH,ii as RELATED_MAX_LIMIT,pn as RELATION_EXISTS_KEY,_a as RELATION_FUNCTION_PREFIX,xn as RELAY_SIGNATURE_HEADER,An as REPROJECTION_MIGRATION_PREFIX,zi as RLS_UNWRAP_SYMBOL,kt as ReactiveCache,Ni as RelayMember,Qi as RlsRequiredError,Vr as SCAN_DEP,dr as SCHEDULE_OUTBOX_TABLE,Ji as SCHEMA_HISTORY_MAX_VERSIONS,Ir as SEARCH_STATE_TABLE,Pr as SHAPE_POKE_CURSOR_TABLE,cs as ShapeDiffCache,Ts as ShardRunner,js as TransactionHeadroomTracker,Xt as UNVOUCHABLE_DEP,sn as VECTOR_BACKFILL_MAX_PAGES,Eo as WORKERD_SQLITE_LIMITS,d as adminTokenExists,De as advanceClientWatermark,to as aggUpsertSql,x as aggregateSqlFunction,A as aggregateTableName,ke as allocateCommitSeq,N as appendAuditEntry,re as appendCdcChange,go as appendStreamChunk,oe as applyCdcChanges,Ti as applyInsertDefaults,Ri as applyOnDelete,it as applySelect,Ae as archiveCdcSegment,rt as armRestore,ci as assertFlatPredicate,q as assertNoExplicitUndefined,Ya as assertPatchAllowed,bs as assertReadonly,mi as assertShapeShardable,v as assertStorableRowId,K as assertValidClientId,Bs as awaitWsDrain,z as backfillAggregateIndexes,Q as backfillRankIndexes,Y as backfillSearchIndexes,j as backfillSearchIndexesForTable,nn as backfillVectorIndexes,ys as bigintSqlKey,ca as boundingBoxCenter,ma as boundingBoxGeohashes,Qt as buildIndexRange,Ss as buildPokeFrames,Ki as buildReprojectionMigration,st as buildSeekBeforeWhere,nt as buildSeekWhere,ts as buildSettings,ls as buildShapeDiff,ae as bumpCdcEpoch,Ce as cdcArchiveRewound,te as cdcCanVouchFor,ie as cdcForkedError,se as cdcSeqLeavingRows,ne as cdcTouchesTables,le as cdcTrimmedError,_o as claimStreamRun,Di as clampPromotionThresholds,Ka as clearCapturedMail,we as clearCompanionSignatures,or as clearMemoryTables,Tt as clearQueueMessages,C as coerceAggregateNumber,de as compactCdcDocs,dn as compileWhereSql,pi as composeReadPredicate,sr as computeRankPage,ui as containsRelationPredicate,Wi as countLegacyRows,pa as coveringGeohashes,c as createAdminTokenRecord,ve as createCompanionSync,zr as createDependencyTracker,Ia as createFanoutCounters,ba as createGlobalPollCounters,io as createIndexSql,Ht as createReadFootprint,Bi as createRelayLink,Gi as createReplicaLink,ms as createShapeDiffCache,La as createShapeProbeCounters,W as createShardCtxDb,Hs as createSystemReader,ce as cursorBelowRetainedFloor,No as decideDurableAttach,Ms as decodeBigintSqlKey,lt as decodeCursor,Fs as decodeFloat64SqlKey,cr as deferScheduleOutbox,Xe as deleteGlobalShapeSnapshot,He as deleteGlobalShapeSnapshotsForConnection,yr as deleteShapePokeCursor,Mr as deleteShapePokeCursorsForConnection,Io as deleteStreamRun,Qr as depKey,si as deriveRelationEdges,Ei as describeRelationWrites,qo as diffExternalSource,fs as diffGlobalMembership,Ai as distinctValues,mr as dropScheduleOutbox,g as encodeAggregateKey,dt as encodeCursor,ua as encodeGeohash,bt as encodePartitionKey,xs as encodeRowsPatch,B as ensureAuditTable,Wa as ensureMailTable,Uo as envOptionalPositiveInt,Go as envPositiveInt,ct as equalityPinnedFields,o as exportShardRows,Da as facetColumn,Ci as fanOutScalarCounts,ni as findRelated,Oa as findStorageReferences,bo as finishStreamRun,ks as float64SqlKey,_ as foldAggregateTally,pr as forgetScheduleOutbox,oa as ftsCompanionDdl,aa as ftsPurgeDocument,ta as ftsRowidMapName,ia as ftsUnmappedPage,sa as ftsWriteDocument,wi as gateReplicaDispatch,so as geoTableName,ps as globalShapeReadKey,na as groupUnmappedRows,Yi as guardWriter,qi as handleReplicaControl,ur as hasScheduleOutboxEntry,Zs as hasTrigger,Sa as haversineMeters,a as importShardRows,Yt as indexKeysForRow,is as isDevEnvironment,no as isFtsAvailable,_n as isInternalTableName,Rt as isLossyBody,ar as isMemoryTable,Zt as isPushableWhere,Si as isRelationPredicate,Jo as isSoftDeleted,Zo as isSourceDue,rn as isTtlExpired,Pa as isVacuousFilterClause,lo as jsonPath,co as jsonPathSql,jt as keysTouchRanges,Ko as liftSourceId,Ls as lintReadonlySql,m as listAdminTokens,Gt as listReactorStates,ya as listTables,Vt as markUnvouchableReads,Lt as matchesRankStaticWhere,E as matchesStaticWhere,Vo as materializeExternalRows,zo as materializeExternalRowsIncremental,tr as memoryTableNames,vs as mergeChangedKeys,D as mergeWhere,me as migrateCdcLog,pe as migrateCdcMeta,Oe as migrateClientWatermark,Ne as migrateCommitSeq,Lo as migrateDurableStreams,Ve as migrateGlobalShapeSnapshot,Je as migrateIdempotency,wt as migrateReactorState,Sr as migrateScheduleOutbox,br as migrateSearchState,Fr as migrateShapePokeCursor,ue as minCdcReplayableSeq,Se as minCdcSeq,kr as minShapePokeCursor,Oi as nextPromotionState,on as nextTtlExpiry,h as normalizeCountArgument,X as normalizeIdStructurally,mt as normalizeOrderKeys,Wo as normalizeSourceDocument,Xo as normalizeSourceValue,pt as nullsFirstOf,ut as nullsOrderSuffix,ja as operatorFields,ho as param,fr as parkScheduleOutbox,t as parseExportShardArgs,i as parseImportShardArgs,Ja as patchDependsOnRow,O as planAggregateLookup,fa as pointInBoundingBox,xr as probeScheduleOutbox,Es as projectColumns,$o as pullExternalSourceIncrementalTick,ea as pullExternalSourceTick,mo as qualifiedJsonPath,po as qualifiedJsonPathSql,bn as quoteIdentifier,Dt as rankKeyFromDoc,Ot as rankPivotConditionSql,Pt as rankTableName,Nt as reactiveCacheKey,qt as reactorNeedsRun,I as readAggregateValue,ge as readArchivedCdcChanges,U as readAuditLog,ot as readBookmark,Xa as readCapturedMail,_e as readCdcArchivedThrough,fe as readCdcChangeKeys,xe as readCdcChanges,Ee as readCdcCursor,he as readCdcEpoch,Pe as readClientWatermark,Be as readCommitSeq,ss as readDeployInfo,Er as readDueScheduleOutbox,hr as readDueScheduleOutboxEntry,Qo as readExternalSourceBaseline,ze as readGlobalShapeSnapshot,Ze as readIdempotent,Wr as readMigrationStatus,Za as readPatchField,At as readQueueMessageById,Ct as readQueueMessages,vt as readReactorState,Tr as readScheduleOutbox,Rr as readScheduleOutboxState,Zi as readSchemaHistory,$i as readSchemaVersion,Lr as readSearchBackfillState,Nr as readShapePokeCursor,Do as readStreamChunks,Oo as readStreamRun,Ma as readTablePage,Ha as recordCapturedMail,Ks as recordChangedKeys,Fa as recordFanoutPass,ka as recordGlobalPollPass,gt as recordQueueMessages,Ar as recordScheduleOutbox,es as recordSchemaVersion,Na as recordShapeProbePass,gi as relationHooks,Pi as relayCountFor,To as renderSql,Xi as reprojectableFields,Cn as reprojectionMigrationId,Hi as reprojectionTables,Cr as requeueScheduleOutbox,$a as resolvePatch,yt as resolveRankPartition,nr as resolveRankSeekTuple,fi as resolveRelationPredicates,_i as resolveWith,p as revokeAdminTokenRecord,uo as rowToDocument,Xr as runDataMigration,Jr as runDrizzle,Yo as runExternalSourceTick,Ds as runReadonlySql,Ii as runRowValidators,Dn as runShardMigrations,gs as runSocketPool,Zr as runSql,$s as runTriggers,an as selectExpiredIds,s as selectExportTables,P as selectIndexForAggregate,y as selectIndexForCount,M as selectIndexForGroupBy,Ba as selectMatchingIds,wr as selectShapeMembers,qr as selectShapeRows,os as serializeSqlValue,cn as serverInList,yi as shapeRoutingKey,En as siblingSecretOf,hn as signSiblingBody,St as softDeleteScope,Mt as sortColumnName,Ro as sqliteInList,Pn as stableStringify,yn as stableWireKey,H as stripReservedPatchFields,As as stubByName,Us as subscriptionFrames,Gs as subscriptionListDeltas,Ua as summarizeFanoutTopics,Ga as summarizeSubscriptions,So as tableColumns,Yr as tableFromDepKey,T as throwingScheduler,ft as tiebreakDirectionFor,Te as trimCdcChanges,$e as trimIdempotent,gr as trimScheduleOutbox,Po as trimStreamRuns,fo as tryRowToDocument,ws as trySendFrame,Ao as unionAll,xt as uniqueIndexFields,n as validateImportRow,u as verifyAdminTokenDigest,Tn as verifySiblingBody,$t as whereFilter,ei as whereOfFilter,Ie as writeCdcArchivedThrough,Qe as writeGlobalShapeSnapshot,er as writeIdempotent,Kt as writeReactorState,Dr as writeSearchBackfillState,Br as writeShapePokeCursor,Ur as writeShapePokeCursors,Ws as writeTouchesMemo};
@@ -1,4 +1,4 @@
1
- import{LunoraError as m}from"@lunora/errors";import{decodeWire as G,WIRE_TAG as F,needsWireEncoding as J,encodeWire as X}from"@lunora/wire";import{sql as K}from"drizzle-orm";import{isInternalTableName as $}from"./isInternalTableName-BoljO2tP.mjs";import{n as y,o as V}from"./do-sql-105TONaE.mjs";import{quoteIdentifier as d}from"./quoteIdentifier-CObIFRhb.mjs";import{renderSql as Y,sqliteInList as Z}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 Fe="__lunora_admin__:",xe="__lunora_relation__:",qe="__lunora_flags__:",Ue={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",createAdminToken:"__lunora_admin__:createAdminToken",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",listAdminTokens:"__lunora_admin__:listAdminTokens",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",revokeAdminToken:"__lunora_admin__:revokeAdminToken",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",verifyAdminToken:"__lunora_admin__:verifyAdminToken",writeRow:"__lunora_admin__:writeRow"},ee=50,N=500,te=30,ne=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}},re=e=>{const{[y]:t,...n}=e;return t===void 0?n:t===null||typeof t!="object"||Array.isArray(t)?{[y]:t,...n}:{...n,...G(t)}},oe=(e,t)=>{if(!e.includes(c))return{columns:e,rows:t};const n=[];for(const i of t){const a=i[c],_=typeof a=="string"?x(a):void 0;if(_===void 0)return{columns:e,rows:t};const l=Object.fromEntries(Object.entries(i).filter(([u])=>u!==c));n.push({...l,...re(_)})}const r=e.filter(i=>i!==c),o=[],s=new Set(r);for(const i of n)for(const a of Object.keys(i))s.has(a)||(s.add(a),o.push(a));return{columns:[...r,...o],rows:n}},g=e=>`instr(lower(CAST(${e} AS TEXT)), lower(?)) > 0`,O=(e,t,n)=>Math.min(Math.max(e,t),n),q=(e,t)=>{const n=e.exec(`SELECT COUNT(*) AS c FROM ${t}`).one();return Number(n.c)},Pe=e=>{const t=e.exec("SELECT name FROM sqlite_master WHERE type = 'table' ORDER BY name").toArray(),n=[];for(const{name:r}of t)$(r)||n.push({name:r,rowCount:q(e,d(r))});return n},U=(e,t)=>e.exec("SELECT name FROM sqlite_master WHERE type = 'table' AND name = ? LIMIT 1",t).toArray().length>0,v=(e,t)=>{if($(t)||!U(e,t))throw new m("UNKNOWN_TABLE",`unknown table: ${t}`,{status:404})},b=(e,t)=>e.exec(`PRAGMA table_info(${t})`).toArray().map(n=>n.name),I={eq:"=",gt:">",gte:">=",lt:"<",lte:"<=",ne:"<>"},j=100,C=(e,t)=>{if(t>j)throw new m("BAD_REQUEST",`the query over ${e} binds ${String(t)} parameters, and a statement takes at most ${String(j)} — remove some filters or narrow the search`)},P=e=>typeof e=="string"?e:typeof e=="number"||typeof e=="boolean"?String(e):"",se=new Set(["gt","gte","lt","lte"]),ae=e=>e.operator==="contains"?P(e.value)==="":se.has(e.operator)&&e.value==="",H=(e,t)=>{if(!t.every(n=>typeof n=="string"&&n!==""))throw new m("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(".")}`},T=(e,t,n=[])=>{const r=t.includes(e),o=t.includes(c);if(!(!r&&!o)){if(r){if(n.length>0)throw new m("BAD_REQUEST",`${e} is a physical column, so it has no nested path`);return{expression:d(e),params:[]}}return{expression:`json_extract(${d(c)}, ?)`,params:[H(e,n)]}}},ie=/^-?\d+$/u,R=(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(!ie.test(r))throw new m("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 m("BAD_REQUEST",`bigint column ${e.column} can only be filtered by an integer, got ${JSON.stringify(n)}`);return L(n)},_e=(e,t)=>t==="bigint"&&typeof e=="string"?z(e)??e:e,le=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 m("BAD_REQUEST",'"has" needs a string, number or boolean value to look for in the array')},ce=(e,t,n)=>{if(t.includes(e.column))throw new m("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 m("BAD_REQUEST",`"has" is not supported on bigint column ${e.column} — it stores a sort key, not an array`);const o=le(e.value),s=H(e.column,r),i=d(c),a=`SELECT 1 FROM json_each(${i}, ?) 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(${i}, ?) IS NOT '${F}' THEN EXISTS (${a}) WHEN json_extract(${i}, ?) IS 'arr' THEN EXISTS (${a}) ELSE 0 END`}},de=e=>{if(!(e==null||typeof e=="string"||typeof e=="boolean"))try{return J(e)?JSON.stringify(X(e)):void 0}catch(t){throw new m("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'",me=(e,t,n)=>{const r=de(e.value);if(r!==void 0){if(e.operator!=="eq"&&e.operator!=="ne")throw new m("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,R(e,void 0)],sql:`(json_type(${d(c)}, ?) IN (${s}) AND ${t} ${I[o]} ?)`}}if((o==="eq"||o==="ne")&&(typeof e.value=="boolean"||typeof e.value=="number")){const s=`json_type(${d(c)}, ?) IN (${ue(e.value)}) AND ${t} = ?`,i=R(e,void 0);return o==="eq"?{params:[...n,...n,i],sql:`(${s})`}:{params:[...n,...n,...n,i],sql:`(${t} IS NOT NULL AND NOT (${s}))`}}},fe=/["\\\u0000-\u001F]/u,W=e=>fe.test(e)?"":e,B=(e,t,n,r)=>{const o=`'${F}'`,s=f=>`(instr(${f}, ${o}) > 0 OR instr(${f}, ${String.raw`'\u'`}) > 0)`,i=s(e),a=r.prefilter===void 0?[]:[r.prefilter],_=r.root===void 0?"":", ?",l=r.root===void 0?[]:[r.root],u=[...r.prefilter===void 0?[]:[g(e)],`EXISTS (SELECT 1 FROM json_tree(${e}${_}) AS j WHERE ${n.sql})`],E=[s(`t.${e}`),...r.prefilter===void 0?[]:[g(`t.${e}`)]],p=`(${u.join(" AND ")})`;return{params:[...a,...l,...n.params,...a,...l,...n.params],sql:`CASE WHEN ${i} THEN ${e} COLLATE BINARY IN (WITH RECURSIVE
1
+ import{LunoraError as m}from"@lunora/errors";import{decodeWire as G,WIRE_TAG as F,needsWireEncoding as J,encodeWire as X}from"@lunora/wire";import{sql as K}from"drizzle-orm";import{isInternalTableName as $}from"./isInternalTableName-BoljO2tP.mjs";import{n as y,o as V}from"./do-sql-105TONaE.mjs";import{quoteIdentifier as d}from"./quoteIdentifier-CObIFRhb.mjs";import{renderSql as Y,sqliteInList as Z}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 Fe="__lunora_admin__:",xe="__lunora_relation__:",qe="__lunora_flags__:",Ue={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",createAdminToken:"__lunora_admin__:createAdminToken",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",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",listAdminTokens:"__lunora_admin__:listAdminTokens",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",revokeAdminToken:"__lunora_admin__:revokeAdminToken",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",verifyAdminToken:"__lunora_admin__:verifyAdminToken",writeRow:"__lunora_admin__:writeRow"},ee=50,N=500,te=30,ne=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}},re=e=>{const{[y]:t,...n}=e;return t===void 0?n:t===null||typeof t!="object"||Array.isArray(t)?{[y]:t,...n}:{...n,...G(t)}},oe=(e,t)=>{if(!e.includes(c))return{columns:e,rows:t};const n=[];for(const i of t){const a=i[c],_=typeof a=="string"?x(a):void 0;if(_===void 0)return{columns:e,rows:t};const l=Object.fromEntries(Object.entries(i).filter(([u])=>u!==c));n.push({...l,...re(_)})}const r=e.filter(i=>i!==c),o=[],s=new Set(r);for(const i of n)for(const a of Object.keys(i))s.has(a)||(s.add(a),o.push(a));return{columns:[...r,...o],rows:n}},g=e=>`instr(lower(CAST(${e} AS TEXT)), lower(?)) > 0`,O=(e,t,n)=>Math.min(Math.max(e,t),n),q=(e,t)=>{const n=e.exec(`SELECT COUNT(*) AS c FROM ${t}`).one();return Number(n.c)},He=e=>{const t=e.exec("SELECT name FROM sqlite_master WHERE type = 'table' ORDER BY name").toArray(),n=[];for(const{name:r}of t)$(r)||n.push({name:r,rowCount:q(e,d(r))});return n},U=(e,t)=>e.exec("SELECT name FROM sqlite_master WHERE type = 'table' AND name = ? LIMIT 1",t).toArray().length>0,C=(e,t)=>{if($(t)||!U(e,t))throw new m("UNKNOWN_TABLE",`unknown table: ${t}`,{status:404})},b=(e,t)=>e.exec(`PRAGMA table_info(${t})`).toArray().map(n=>n.name),I={eq:"=",gt:">",gte:">=",lt:"<",lte:"<=",ne:"<>"},j=100,v=(e,t)=>{if(t>j)throw new m("BAD_REQUEST",`the query over ${e} binds ${String(t)} parameters, and a statement takes at most ${String(j)} — remove some filters or narrow the search`)},H=e=>typeof e=="string"?e:typeof e=="number"||typeof e=="boolean"?String(e):"",se=new Set(["gt","gte","lt","lte"]),ae=e=>e.operator==="contains"?H(e.value)==="":se.has(e.operator)&&e.value==="",P=(e,t)=>{if(!t.every(n=>typeof n=="string"&&n!==""))throw new m("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(".")}`},T=(e,t,n=[])=>{const r=t.includes(e),o=t.includes(c);if(!(!r&&!o)){if(r){if(n.length>0)throw new m("BAD_REQUEST",`${e} is a physical column, so it has no nested path`);return{expression:d(e),params:[]}}return{expression:`json_extract(${d(c)}, ?)`,params:[P(e,n)]}}},ie=/^-?\d+$/u,R=(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(!ie.test(r))throw new m("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 m("BAD_REQUEST",`bigint column ${e.column} can only be filtered by an integer, got ${JSON.stringify(n)}`);return L(n)},_e=(e,t)=>t==="bigint"&&typeof e=="string"?z(e)??e:e,le=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 m("BAD_REQUEST",'"has" needs a string, number or boolean value to look for in the array')},ce=(e,t,n)=>{if(t.includes(e.column))throw new m("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 m("BAD_REQUEST",`"has" is not supported on bigint column ${e.column} — it stores a sort key, not an array`);const o=le(e.value),s=P(e.column,r),i=d(c),a=`SELECT 1 FROM json_each(${i}, ?) 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(${i}, ?) IS NOT '${F}' THEN EXISTS (${a}) WHEN json_extract(${i}, ?) IS 'arr' THEN EXISTS (${a}) ELSE 0 END`}},de=e=>{if(!(e==null||typeof e=="string"||typeof e=="boolean"))try{return J(e)?JSON.stringify(X(e)):void 0}catch(t){throw new m("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'",me=(e,t,n)=>{const r=de(e.value);if(r!==void 0){if(e.operator!=="eq"&&e.operator!=="ne")throw new m("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,R(e,void 0)],sql:`(json_type(${d(c)}, ?) IN (${s}) AND ${t} ${I[o]} ?)`}}if((o==="eq"||o==="ne")&&(typeof e.value=="boolean"||typeof e.value=="number")){const s=`json_type(${d(c)}, ?) IN (${ue(e.value)}) AND ${t} = ?`,i=R(e,void 0);return o==="eq"?{params:[...n,...n,i],sql:`(${s})`}:{params:[...n,...n,...n,i],sql:`(${t} IS NOT NULL AND NOT (${s}))`}}},fe=/["\\\u0000-\u001F]/u,W=e=>fe.test(e)?"":e,B=(e,t,n,r)=>{const o=`'${F}'`,s=f=>`(instr(${f}, ${o}) > 0 OR instr(${f}, ${String.raw`'\u'`}) > 0)`,i=s(e),a=r.prefilter===void 0?[]:[r.prefilter],_=r.root===void 0?"":", ?",l=r.root===void 0?[]:[r.root],u=[...r.prefilter===void 0?[]:[g(e)],`EXISTS (SELECT 1 FROM json_tree(${e}${_}) AS j WHERE ${n.sql})`],E=[s(`t.${e}`),...r.prefilter===void 0?[]:[g(`t.${e}`)]],p=`(${u.join(" AND ")})`;return{params:[...a,...l,...n.params,...a,...l,...n.params],sql:`CASE WHEN ${i} THEN ${e} COLLATE BINARY IN (WITH RECURSIVE
2
2
  __wf_framed AS MATERIALIZED (SELECT DISTINCT t.${e} COLLATE BINARY AS doc FROM ${t} AS t WHERE ${E.join(" AND ")}),
3
3
  __wf_docs AS MATERIALIZED (SELECT doc, row_number() OVER () AS n FROM __wf_framed),
4
4
  __wf_raw AS (SELECT d.n, j.id, j.parent, j.key, j.type, j.atom, j.value, j.fullkey FROM __wf_docs AS d, json_tree(d.doc${_}) AS j),
@@ -11,4 +11,4 @@ import{LunoraError as m}from"@lunora/errors";import{decodeWire as G,WIRE_TAG as
11
11
  __wf_runs(n, id, k) AS MATERIALIZED (SELECT s.n, s.id, 1 FROM __wf_steps AS s LEFT JOIN __wf_steps AS p ON p.n = s.n AND p.id = s.parent WHERE p.id IS NULL UNION ALL SELECT c.n, c.id, r.k + 1 FROM __wf_runs AS r JOIN __wf_steps AS c ON c.n = r.n AND c.parent = r.id),
12
12
  __wf_excluded AS MATERIALIZED (SELECT j.n, j.id FROM __wf_tree AS j LEFT JOIN __wf_runs AS p ON p.n = j.n AND p.id = j.parent WHERE typeof(j.key) = 'integer' AND j.key IN (0, 1) AND j.tagged_parent AND coalesce(p.k, 0) % 2 = 0),
13
13
  __wf_framedMatches AS (SELECT d.doc FROM __wf_docs AS d JOIN (SELECT DISTINCT j.n FROM __wf_tree AS j LEFT JOIN __wf_excluded AS e ON e.n = j.n AND e.id = j.id WHERE ${n.sql} AND e.id IS NULL) AS m ON m.n = d.n)
14
- SELECT doc FROM __wf_framedMatches) ELSE ${p} END`}},Ee=(e,t,n,r)=>{const o={params:[r],sql:`j.type IN ('text', 'integer', 'real', 'true', 'false') AND ${g("CASE WHEN j.type IN ('true', 'false') THEN j.type ELSE j.value END")}`},s=B(t,e,o,{prefilter:W(r),root:n});return{params:[n,n,r,n,n,r,n,...s.params],sql:`CASE WHEN json_type(${t}, ?) IN ('text', 'integer', 'real') THEN ${g(`json_extract(${t}, ?)`)} WHEN json_type(${t}, ?) IN ('true', 'false') THEN ${g(`json_type(${t}, ?)`)} WHEN json_type(${t}, ?) IN ('array', 'object') THEN ${s.sql} ELSE 0 END`}},pe=(e,{expression:t,kind:n,pathParameters:r,physical:o,table:s})=>{const i=e.path??[];if(n==="bigint")throw new m("BAD_REQUEST",`"contains" is not supported on bigint column ${e.column} — use =, <, > instead`);const a=P(e.value);return i.length===0&&o?{params:[a],sql:g(t)}:i.length===0?Ee(s,d(c),r[0],a):{params:[...r,...r,a],sql:`(json_type(${d(c)}, ?) IN ('text', 'integer', 'real') AND ${g(t)})`}},Se=(e,t,n,r)=>{if(e.operator==="has")return ce(e,t,n);const o=e.path??[],s=T(e.column,t,o);if(s===void 0||ae(e))return;const{expression:i,params:a}=s,_=t.includes(e.column)||o.length>0?void 0:n?.[e.column];if(e.operator==="contains")return pe(e,{expression:i,kind:_,pathParameters:a,physical:t.includes(e.column),table:r});if(e.value===null&&(e.operator==="eq"||e.operator==="ne"))return{params:a,sql:`${i} IS ${e.operator==="ne"?"NOT ":""}NULL`};if(o.length>0){const l=me(e,i,a);if(l!==void 0)return l}return{params:[...a,R(e,_)],sql:`${i} ${I[e.operator]} ?`}},ge=new Set(["date","timestamp"]),Ae=[`$.${y}`,`$."${y}"`].map(e=>`substr(j.fullkey, 1, ${String(e.length+1)}) NOT IN ('${e}.', '${e}[')`).join(" AND "),Ne=(e,t)=>{const n={params:[t],sql:`j.type IN ('text', 'integer', 'real', 'true', 'false') AND ${g("CASE WHEN j.type IN ('true', 'false') THEN j.type ELSE j.value END")} AND ${Ae}`};return B(d(c),e,n,{prefilter:W(t)})},Te=/^(\d{4})(?:-(\d{2}))?(?:-(\d{2}))?$/u,he=e=>{const t=Te.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 i;return o!==void 0?i=Date.UTC(n,(r??1)-1,o+1):r===void 0?i=Date.UTC(n+1,0,1):i=Date.UTC(n,r,1),{from:s,to:i}},ye=(e,t,n)=>t.map(r=>r===c?Ne(e,n):{params:[n],sql:g(d(r))}),be=(e,t,n)=>{const r=e.map(s=>({params:[n.from,n.to],sql:`(${d(s)} >= ? AND ${d(s)} < ?)`})),o=Object.keys(t??{}).filter(s=>!e.includes(s)&&ge.has(t?.[s]??""));return o.length>0&&e.includes(c)&&r.push({params:[JSON.stringify(o),n.from,n.to],sql:`EXISTS (SELECT 1 FROM json_each(${d(c)}) AS j WHERE j.key IN (SELECT value FROM json_each(?)) AND j.type IN ('integer', 'real') AND j.value >= ? AND j.value < ?)`}),r},M=(e,t,n,r,o)=>{const s=[],i=[];if(n!==""&&t.length>0){const a=ye(e,t,n),_=he(n);_!==void 0&&a.push(...be(t,o,_)),s.push(`(${a.map(l=>l.sql).join(" OR ")})`),i.push(...a.flatMap(l=>l.params))}for(const a of r??[]){const _=Se(a,t,o,e);_!==void 0&&(s.push(`(${_.sql})`),i.push(..._.params))}return s.length===0?void 0:{parameters:i,where:s.join(" AND ")}},we=(e,t)=>{if(e===void 0)return;const n=T(e.column,t);if(n===void 0)return;const r=e.direction==="desc"?"DESC":"ASC";return{params:n.params,sql:`${n.expression} ${r}`}},He=(e,t)=>{const{table:n}=t;v(e,n);const r=O(Math.trunc(t.limit??ee),1,N),o=Math.max(0,Math.trunc(t.offset??0)),s=d(n),i=b(e,s),a=t.search?.trim()??"",_=h=>{if(t.refs===void 0)return h;const w={};for(const D of h.columns){const k=t.refs[D];k!==void 0&&(w[D]=k)}return Object.keys(w).length>0?{...h,refs:w}:h},l=M(s,i,a,t.filters,t.columnKinds),u=we(t.orderBy,i),E=l===void 0?"":` WHERE ${l.where}`,p=u===void 0?"":` ORDER BY ${u.sql}`,f=l?.parameters??[],A=u?.params??[];C(n,f.length+A.length+2);let S;t.skipCount||(S=l===void 0?q(e,s):Number(e.exec(`SELECT COUNT(*) AS c FROM ${s}${E}`,...f).one().c));const Q=e.exec(`SELECT * FROM ${s}${E}${p} LIMIT ? OFFSET ?`,...f,...A,r,o).toArray();return _({...oe(i,Q),sqlColumns:i,total:S})},We=(e,t)=>{const{table:n}=t;v(e,n);const r=O(Math.trunc(t.limit??N),1,N),o=d(n),s=b(e,o),i=t.search?.trim()??"";for(const S of t.filters??[])if(T(S.column,s,S.path??[])===void 0)throw new m("BAD_REQUEST",`unknown column: ${S.column}`);const a=M(o,s,i,t.filters,t.columnKinds);if(a===void 0&&(t.filters?.length??0)>0)throw new m("BAD_REQUEST",`the filters on ${n} are all empty, so the predicate constrains no rows — refusing to select the whole table`);const _=[],l=[];a!==void 0&&(_.push(a.where),l.push(...a.parameters)),t.after!==void 0&&(_.push("id > ?"),l.push(t.after));const u=_.length===0?"":` WHERE ${_.join(" AND ")}`,E=t.after===void 0?"":" ORDER BY id";C(n,l.length+1);const p=e.exec(`SELECT id FROM ${o}${u}${E} LIMIT ?`,...l,r+1).toArray(),f=p.length>r,A=p.slice(0,r).map(S=>S.id);return{hasMore:f,ids:A}},Ie=(e,t,n,r)=>{const o=new Set(n.filter(i=>i!==c));if(!n.includes(c))return o;for(const i of Object.keys(r??{}))o.add(i);const s=e.exec(`SELECT ${d(c)} AS doc FROM ${t} LIMIT ?`,N).toArray();for(const{doc:i}of s){const a=typeof i=="string"?x(i):void 0;if(a!==void 0)for(const _ of Object.keys(a))o.add(_)}return o},Be=(e,t)=>{const{column:n,table:r}=t;v(e,r);const o=d(r),s=b(e,o);if(!Ie(e,o,s,t.columnKinds).has(n))throw new m("UNKNOWN_COLUMN",`unknown column: ${n}`,{status:404});const i=T(n,s);if(i===void 0)throw new m("UNKNOWN_COLUMN",`unknown column: ${n}`,{status:404});const a=O(Math.trunc(t.limit??te),1,ne),_=t.search?.trim()??"",l=M(o,s,_,t.filters,t.columnKinds),u=l===void 0?"":` WHERE ${l.where}`,E=l?.parameters??[];C(r,i.params.length*2+E.length+1);const p=e.exec(`SELECT ${i.expression} AS value, COUNT(*) AS count FROM ${o}${u} GROUP BY ${i.expression} ORDER BY count DESC LIMIT ?`,...i.params,...E,...i.params,a+1).toArray(),f=p.length>a,A=s.includes(n)?void 0:t.columnKinds?.[n];return{truncated:f,values:p.slice(0,a).map(S=>({count:Number(S.count),value:_e(S.value,A)}))}},Qe=(e,t,n)=>{const r={},o=n.slice(0,N);for(const s of o)r[s]=[];if(o.length===0)return{references:r,storageColumns:t};for(const[s,i]of Object.entries(t)){if($(s)||!U(e,s))continue;const a=d(s),_=b(e,a);for(const l of i){const u=T(l,_);if(u===void 0)continue;const E=Y("sqlite",Z(K.raw(u.expression),o,!1)),p=e.exec(`SELECT id, ${u.expression} AS ref FROM ${a} WHERE ${E.sql}`,...u.params,...u.params,...E.params).toArray();for(const f of p)r[f.ref]?.push({column:l,id:f.id,table:s})}}return{references:r,storageColumns:t}},Ge=e=>{const n=e.filter(o=>o.authenticated!==!1).map((o,s)=>{const i=Object.values(o.subs??{}).map(a=>({args:a.args,functionPath:a.functionPath,table:a.table}));return{admin:o.admin===!0,id:s,subscriptions:i}}),r=n.reduce((o,s)=>o+s.subscriptions.length,0);return{connections:n,totalConnections:n.length,totalSubscriptions:r}},Re=20,Je=()=>({maxMs:0,passes:0,peakSocketsIterated:0,socketsDelivered:0,socketsIterated:0,totalMs:0}),Xe=()=>({run:0,served:0}),Ke=()=>({drains:0,pairsSkipped:0}),Ve=(e,t,n)=>({drains:e.drains+t,pairsSkipped:e.pairsSkipped+n}),Ye=(e,t,n)=>({run:e.run+t,served:e.served+n}),Ze=(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}),ze=(e,t=Re)=>{const n=new Map,r=new Map,o=e.filter(a=>a.authenticated!==!1);for(const a of o){for(const _ of Object.values(a.shapes??{})){const l=_.name??"(unknown shape)";n.set(l,(n.get(l)??0)+1)}for(const _ of a.whispers??[])r.set(_,(r.get(_)??0)+1)}const s=[...[...n].map(([a,_])=>({kind:"shape",subscribers:_,topic:a})),...[...r].map(([a,_])=>({kind:"whisper",subscribers:_,topic:a}))];return s.sort((a,_)=>_.subscribers-a.subscribers||a.topic.localeCompare(_.topic)),{peakSubscribers:s[0]?.subscribers??0,topics:s.slice(0,t),totalConnections:o.length}};export{Ue as ADMIN_FUNCTIONS,Fe as ADMIN_FUNCTION_PREFIX,Re as DEFAULT_FANOUT_TOPIC_LIMIT,qe as FLAGS_FUNCTION_PREFIX,N as MAX_PAGE_SIZE,xe as RELATION_FUNCTION_PREFIX,Je as createFanoutCounters,Ke as createGlobalPollCounters,Xe as createShapeProbeCounters,he as datePrefixRange,Be as facetColumn,Qe as findStorageReferences,$ as isInternalTableName,ae as isVacuousFilterClause,Pe as listTables,He as readTablePage,Ze as recordFanoutPass,Ve as recordGlobalPollPass,Ye as recordShapeProbePass,We as selectMatchingIds,ze as summarizeFanoutTopics,Ge as summarizeSubscriptions};
14
+ SELECT doc FROM __wf_framedMatches) ELSE ${p} END`}},Ee=(e,t,n,r)=>{const o={params:[r],sql:`j.type IN ('text', 'integer', 'real', 'true', 'false') AND ${g("CASE WHEN j.type IN ('true', 'false') THEN j.type ELSE j.value END")}`},s=B(t,e,o,{prefilter:W(r),root:n});return{params:[n,n,r,n,n,r,n,...s.params],sql:`CASE WHEN json_type(${t}, ?) IN ('text', 'integer', 'real') THEN ${g(`json_extract(${t}, ?)`)} WHEN json_type(${t}, ?) IN ('true', 'false') THEN ${g(`json_type(${t}, ?)`)} WHEN json_type(${t}, ?) IN ('array', 'object') THEN ${s.sql} ELSE 0 END`}},pe=(e,{expression:t,kind:n,pathParameters:r,physical:o,table:s})=>{const i=e.path??[];if(n==="bigint")throw new m("BAD_REQUEST",`"contains" is not supported on bigint column ${e.column} — use =, <, > instead`);const a=H(e.value);return i.length===0&&o?{params:[a],sql:g(t)}:i.length===0?Ee(s,d(c),r[0],a):{params:[...r,...r,a],sql:`(json_type(${d(c)}, ?) IN ('text', 'integer', 'real') AND ${g(t)})`}},Se=(e,t,n,r)=>{if(e.operator==="has")return ce(e,t,n);const o=e.path??[],s=T(e.column,t,o);if(s===void 0||ae(e))return;const{expression:i,params:a}=s,_=t.includes(e.column)||o.length>0?void 0:n?.[e.column];if(e.operator==="contains")return pe(e,{expression:i,kind:_,pathParameters:a,physical:t.includes(e.column),table:r});if(e.value===null&&(e.operator==="eq"||e.operator==="ne"))return{params:a,sql:`${i} IS ${e.operator==="ne"?"NOT ":""}NULL`};if(o.length>0){const l=me(e,i,a);if(l!==void 0)return l}return{params:[...a,R(e,_)],sql:`${i} ${I[e.operator]} ?`}},ge=new Set(["date","timestamp"]),Ae=[`$.${y}`,`$."${y}"`].map(e=>`substr(j.fullkey, 1, ${String(e.length+1)}) NOT IN ('${e}.', '${e}[')`).join(" AND "),Ne=(e,t)=>{const n={params:[t],sql:`j.type IN ('text', 'integer', 'real', 'true', 'false') AND ${g("CASE WHEN j.type IN ('true', 'false') THEN j.type ELSE j.value END")} AND ${Ae}`};return B(d(c),e,n,{prefilter:W(t)})},Te=/^(\d{4})(?:-(\d{2}))?(?:-(\d{2}))?$/u,he=e=>{const t=Te.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 i;return o!==void 0?i=Date.UTC(n,(r??1)-1,o+1):r===void 0?i=Date.UTC(n+1,0,1):i=Date.UTC(n,r,1),{from:s,to:i}},ye=(e,t,n)=>t.map(r=>r===c?Ne(e,n):{params:[n],sql:g(d(r))}),be=(e,t,n)=>{const r=e.map(s=>({params:[n.from,n.to],sql:`(${d(s)} >= ? AND ${d(s)} < ?)`})),o=Object.keys(t??{}).filter(s=>!e.includes(s)&&ge.has(t?.[s]??""));return o.length>0&&e.includes(c)&&r.push({params:[JSON.stringify(o),n.from,n.to],sql:`EXISTS (SELECT 1 FROM json_each(${d(c)}) AS j WHERE j.key IN (SELECT value FROM json_each(?)) AND j.type IN ('integer', 'real') AND j.value >= ? AND j.value < ?)`}),r},M=(e,t,n,r,o)=>{const s=[],i=[];if(n!==""&&t.length>0){const a=ye(e,t,n),_=he(n);_!==void 0&&a.push(...be(t,o,_)),s.push(`(${a.map(l=>l.sql).join(" OR ")})`),i.push(...a.flatMap(l=>l.params))}for(const a of r??[]){const _=Se(a,t,o,e);_!==void 0&&(s.push(`(${_.sql})`),i.push(..._.params))}return s.length===0?void 0:{parameters:i,where:s.join(" AND ")}},we=(e,t)=>{if(e===void 0)return;const n=T(e.column,t);if(n===void 0)return;const r=e.direction==="desc"?"DESC":"ASC";return{params:n.params,sql:`${n.expression} ${r}`}},Pe=(e,t)=>{const{table:n}=t;C(e,n);const r=O(Math.trunc(t.limit??ee),1,N),o=Math.max(0,Math.trunc(t.offset??0)),s=d(n),i=b(e,s),a=t.search?.trim()??"",_=h=>{if(t.refs===void 0)return h;const w={};for(const D of h.columns){const k=t.refs[D];k!==void 0&&(w[D]=k)}return Object.keys(w).length>0?{...h,refs:w}:h},l=M(s,i,a,t.filters,t.columnKinds),u=we(t.orderBy,i),E=l===void 0?"":` WHERE ${l.where}`,p=u===void 0?"":` ORDER BY ${u.sql}`,f=l?.parameters??[],A=u?.params??[];v(n,f.length+A.length+2);let S;t.skipCount||(S=l===void 0?q(e,s):Number(e.exec(`SELECT COUNT(*) AS c FROM ${s}${E}`,...f).one().c));const Q=e.exec(`SELECT * FROM ${s}${E}${p} LIMIT ? OFFSET ?`,...f,...A,r,o).toArray();return _({...oe(i,Q),sqlColumns:i,total:S})},We=(e,t)=>{const{table:n}=t;C(e,n);const r=O(Math.trunc(t.limit??N),1,N),o=d(n),s=b(e,o),i=t.search?.trim()??"";for(const S of t.filters??[])if(T(S.column,s,S.path??[])===void 0)throw new m("BAD_REQUEST",`unknown column: ${S.column}`);const a=M(o,s,i,t.filters,t.columnKinds);if(a===void 0&&(t.filters?.length??0)>0)throw new m("BAD_REQUEST",`the filters on ${n} are all empty, so the predicate constrains no rows — refusing to select the whole table`);const _=[],l=[];a!==void 0&&(_.push(a.where),l.push(...a.parameters)),t.after!==void 0&&(_.push("id > ?"),l.push(t.after));const u=_.length===0?"":` WHERE ${_.join(" AND ")}`,E=t.after===void 0?"":" ORDER BY id";v(n,l.length+1);const p=e.exec(`SELECT id FROM ${o}${u}${E} LIMIT ?`,...l,r+1).toArray(),f=p.length>r,A=p.slice(0,r).map(S=>S.id);return{hasMore:f,ids:A}},Ie=(e,t,n,r)=>{const o=new Set(n.filter(i=>i!==c));if(!n.includes(c))return o;for(const i of Object.keys(r??{}))o.add(i);const s=e.exec(`SELECT ${d(c)} AS doc FROM ${t} LIMIT ?`,N).toArray();for(const{doc:i}of s){const a=typeof i=="string"?x(i):void 0;if(a!==void 0)for(const _ of Object.keys(a))o.add(_)}return o},Be=(e,t)=>{const{column:n,table:r}=t;C(e,r);const o=d(r),s=b(e,o);if(!Ie(e,o,s,t.columnKinds).has(n))throw new m("UNKNOWN_COLUMN",`unknown column: ${n}`,{status:404});const i=T(n,s);if(i===void 0)throw new m("UNKNOWN_COLUMN",`unknown column: ${n}`,{status:404});const a=O(Math.trunc(t.limit??te),1,ne),_=t.search?.trim()??"",l=M(o,s,_,t.filters,t.columnKinds),u=l===void 0?"":` WHERE ${l.where}`,E=l?.parameters??[];v(r,i.params.length*2+E.length+1);const p=e.exec(`SELECT ${i.expression} AS value, COUNT(*) AS count FROM ${o}${u} GROUP BY ${i.expression} ORDER BY count DESC LIMIT ?`,...i.params,...E,...i.params,a+1).toArray(),f=p.length>a,A=s.includes(n)?void 0:t.columnKinds?.[n];return{truncated:f,values:p.slice(0,a).map(S=>({count:Number(S.count),value:_e(S.value,A)}))}},Qe=(e,t,n)=>{const r={},o=n.slice(0,N);for(const s of o)r[s]=[];if(o.length===0)return{references:r,storageColumns:t};for(const[s,i]of Object.entries(t)){if($(s)||!U(e,s))continue;const a=d(s),_=b(e,a);for(const l of i){const u=T(l,_);if(u===void 0)continue;const E=Y("sqlite",Z(K.raw(u.expression),o,!1)),p=e.exec(`SELECT id, ${u.expression} AS ref FROM ${a} WHERE ${E.sql}`,...u.params,...u.params,...E.params).toArray();for(const f of p)r[f.ref]?.push({column:l,id:f.id,table:s})}}return{references:r,storageColumns:t}},Ge=e=>{const n=e.filter(o=>o.authenticated!==!1).map((o,s)=>{const i=Object.values(o.subs??{}).map(a=>({args:a.args,functionPath:a.functionPath,table:a.table}));return{admin:o.admin===!0,id:s,subscriptions:i}}),r=n.reduce((o,s)=>o+s.subscriptions.length,0);return{connections:n,totalConnections:n.length,totalSubscriptions:r}},Re=20,Je=()=>({maxMs:0,passes:0,peakSocketsIterated:0,socketsDelivered:0,socketsIterated:0,totalMs:0}),Xe=()=>({run:0,served:0}),Ke=()=>({drains:0,pairsSkipped:0}),Ve=(e,t,n)=>({drains:e.drains+t,pairsSkipped:e.pairsSkipped+n}),Ye=(e,t,n)=>({run:e.run+t,served:e.served+n}),Ze=(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}),ze=(e,t=Re)=>{const n=new Map,r=new Map,o=e.filter(a=>a.authenticated!==!1);for(const a of o){for(const _ of Object.values(a.shapes??{})){const l=_.name??"(unknown shape)";n.set(l,(n.get(l)??0)+1)}for(const _ of a.whispers??[])r.set(_,(r.get(_)??0)+1)}const s=[...[...n].map(([a,_])=>({kind:"shape",subscribers:_,topic:a})),...[...r].map(([a,_])=>({kind:"whisper",subscribers:_,topic:a}))];return s.sort((a,_)=>_.subscribers-a.subscribers||a.topic.localeCompare(_.topic)),{peakSubscribers:s[0]?.subscribers??0,topics:s.slice(0,t),totalConnections:o.length}};export{Ue as ADMIN_FUNCTIONS,Fe as ADMIN_FUNCTION_PREFIX,Re as DEFAULT_FANOUT_TOPIC_LIMIT,qe as FLAGS_FUNCTION_PREFIX,N as MAX_PAGE_SIZE,xe as RELATION_FUNCTION_PREFIX,Je as createFanoutCounters,Ke as createGlobalPollCounters,Xe as createShapeProbeCounters,he as datePrefixRange,Be as facetColumn,Qe as findStorageReferences,$ as isInternalTableName,ae as isVacuousFilterClause,He as listTables,Pe as readTablePage,Ze as recordFanoutPass,Ve as recordGlobalPollPass,Ye as recordShapeProbePass,We as selectMatchingIds,ze as summarizeFanoutTopics,Ge as summarizeSubscriptions};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lunora/shard-engine",
3
- "version": "1.0.0-alpha.188",
3
+ "version": "1.0.0-alpha.189",
4
4
  "description": "Host-neutral reactive engine for Lunora: per-shard state, OCC, CDC, reactive subscriptions, and the poke protocol. Consumes @lunora/platform host contracts and can be mounted on any platform host.",
5
5
  "keywords": [
6
6
  "cloudflare",