@lunora/shard-engine 1.0.0-alpha.46 → 1.0.0-alpha.48
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/dist/index.d.mts +1 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.mjs +1 -1
- package/dist/packem_shared/DATA_MIGRATION_STATE_TABLE-Cp6pbyAp.mjs +31 -0
- package/dist/packem_shared/ReactiveCache-BpnU4D2r.mjs +1 -0
- package/package.json +3 -3
- package/dist/packem_shared/DATA_MIGRATION_STATE_TABLE-CKRGRMxV.mjs +0 -31
- package/dist/packem_shared/ReactiveCache-BNPEzDot.mjs +0 -1
package/README.md
CHANGED
|
@@ -14,4 +14,4 @@ It consumes the provider-neutral host contracts from `@lunora/platform` (`ShardH
|
|
|
14
14
|
|
|
15
15
|
## Status
|
|
16
16
|
|
|
17
|
-
|
|
17
|
+
The extraction from `@lunora/do` is complete. This package owns the engine; `@lunora/do` is the Cloudflare host binding that wires `ShardHost`/`SocketHost` to Durable Objects and re-exports only the names codegen emits against.
|
package/dist/index.d.mts
CHANGED
|
@@ -610,6 +610,7 @@ declare class ReactiveCache {
|
|
|
610
610
|
private readonly maxBytes;
|
|
611
611
|
private readonly now;
|
|
612
612
|
private monotonic;
|
|
613
|
+
private generation;
|
|
613
614
|
constructor(options?: ReactiveCacheOptions);
|
|
614
615
|
run<R>(key: string, deps: Set<string>, run: () => Promise<R>, ranges?: () => ReadonlyArray<KeyRange>): Promise<R>;
|
|
615
616
|
invalidate(table: string, id: string, indexKeys?: ReadonlyArray<IndexKeyEntry>): string[];
|
package/dist/index.d.ts
CHANGED
|
@@ -610,6 +610,7 @@ declare class ReactiveCache {
|
|
|
610
610
|
private readonly maxBytes;
|
|
611
611
|
private readonly now;
|
|
612
612
|
private monotonic;
|
|
613
|
+
private generation;
|
|
613
614
|
constructor(options?: ReactiveCacheOptions);
|
|
614
615
|
run<R>(key: string, deps: Set<string>, run: () => Promise<R>, ranges?: () => ReadonlyArray<KeyRange>): Promise<R>;
|
|
615
616
|
invalidate(table: string, id: string, indexKeys?: ReadonlyArray<IndexKeyEntry>): string[];
|
package/dist/index.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{exportShardRows as o,exportShardTable as a,importShardRows as t,parseExportShardArgs as n,parseImportShardArgs as i,selectExportTables as s,validateImportRow as l}from"./packem_shared/exportShardRows-Cgt3ITwH.mjs";import{AGGREGATE_SQL_FUNCTION as m,aggregateSqlFunction as d,matchesStaticWhere as p,normalizeCountArgument as S,throwingScheduler as u}from"./packem_shared/AGGREGATE_SQL_FUNCTION-m1iUU1rv.mjs";import{aggregateTableName as h,coerceAggregateNumber as x,encodeAggregateKey as C,foldAggregateTally as T,readAggregateValue as E}from"./packem_shared/aggregateTableName-XtEbp1DE.mjs";import{CountRlsUnsupportedError as A,mergeWhere as g,planAggregateLookup as _,selectIndexForAggregate as I,selectIndexForCount as b,selectIndexForGroupBy as L}from"./packem_shared/CountRlsUnsupportedError-Bdfupt3g.mjs";import{AUDIT_LOG_TABLE as M,appendAuditEntry as D,ensureAuditTable as y,readAuditLog as N}from"./packem_shared/AUDIT_LOG_TABLE-ONxmEAIz.mjs";import{NotUniqueError as k,assertNoExplicitUndefined as F,assertValidClientId as B,createShardCtxDb as G,normalizeIdStructurally as U}from"./packem_shared/NotUniqueError-DJFaCeQK.mjs";import{backfillAggregateIndexes as q,backfillRankIndexes as v,backfillSearchIndexes as K,backfillSearchIndexesForTable as W}from"./packem_shared/backfillAggregateIndexes-92hEoqfj.mjs";import{CDC_LOG_TABLE as H,CDC_LOG_TABLE_SEQ_INDEX as z,CDC_META_TABLE as V,appendCdcChange as Q,applyCdcChanges as j,bumpCdcEpoch as Y,cdcCanVouchFor as J,cdcSeqLeavingRows as Z,cdcTouchesTables as $,cdcTrimmedError as ee,compactCdcDocs as re,cursorBelowRetainedFloor as oe,migrateCdcLog as ae,migrateCdcMeta as te,minCdcReplayableSeq as ne,minCdcSeq as ie,readCdcChangeKeys as se,readCdcChanges as le,readCdcCursor as ce,readCdcEpoch as me,trimCdcChanges as de}from"./packem_shared/CDC_LOG_TABLE-BknLCi4r.mjs";import{archiveCdcSegment as Se,readArchivedCdcChanges as ue,readCdcArchivedThrough as fe,writeCdcArchivedThrough as he}from"./packem_shared/archiveCdcSegment-DU4uzDFQ.mjs";import{CLIENT_WATERMARK_TABLE as Ce,advanceClientWatermark as Te,migrateClientWatermark as Ee,readClientWatermark as Re}from"./packem_shared/CLIENT_WATERMARK_TABLE-CRnrAnJ2.mjs";import{COMMIT_SEQ_FIELD as ge,COMMIT_SEQ_TABLE as _e,allocateCommitSeq as Ie,migrateCommitSeq as be,readCommitSeq as Le}from"./packem_shared/COMMIT_SEQ_FIELD-BUdOMG5y.mjs";import{c as Me}from"./packem_shared/ctx-db-companions-BeVsHnEe.mjs";import{GLOBAL_SHAPE_SNAPSHOT_TABLE as ye,deleteGlobalShapeSnapshot as Ne,deleteGlobalShapeSnapshotsForConnection as Oe,migrateGlobalShapeSnapshot as ke,readGlobalShapeSnapshot as Fe,writeGlobalShapeSnapshot as Be}from"./packem_shared/GLOBAL_SHAPE_SNAPSHOT_TABLE-BicDuO0a.mjs";import{IDEMPOTENCY_TABLE as Ue,migrateIdempotency as we,readIdempotent as qe,trimIdempotent as ve,writeIdempotent as Ke}from"./packem_shared/IDEMPOTENCY_TABLE-DOpm_oMF.mjs";import{clearMemoryTables as Xe,isMemoryTable as He,memoryTableNames as ze}from"./packem_shared/clearMemoryTables-BGbmag2i.mjs";import{computeRankPage as Qe,hydrateDocsById as je,resolveRankSeekTuple as Ye}from"./packem_shared/computeRankPage-EhvBDg7F.mjs";import{SEARCH_STATE_TABLE as Ze,migrateSearchState as $e,readSearchBackfillState as er,writeSearchBackfillState as rr}from"./packem_shared/SEARCH_STATE_TABLE-BCqn5ksa.mjs";import{SHAPE_POKE_CURSOR_TABLE as ar,deleteShapePokeCursor as tr,deleteShapePokeCursorsForConnection as nr,migrateShapePokeCursor as ir,minShapePokeCursor as sr,readShapePokeCursor as lr,writeShapePokeCursor as cr,writeShapePokeCursors as mr}from"./packem_shared/SHAPE_POKE_CURSOR_TABLE-ByJVDHds.mjs";import{selectShapeMembers as pr,selectShapeRows as Sr}from"./packem_shared/selectShapeMembers-Ce5Jr6UH.mjs";import{DATA_MIGRATION_STATE_TABLE as fr,readMigrationStatus as hr,runDataMigration as xr}from"./packem_shared/DATA_MIGRATION_STATE_TABLE-CKRGRMxV.mjs";import{SCAN_DEP as Tr,createDependencyTracker as Er,depKey as Rr,tableFromDepKey as Ar}from"./packem_shared/SCAN_DEP-D7qE3iUe.mjs";import{runDrizzle as _r,runSql as Ir}from"./packem_shared/runDrizzle-2ULFQR_k.mjs";import{A as Lr,a as Pr,b as Mr,D as Dr,c as yr,d as Nr,g as Or,i as kr,j as Fr,e as Br,q as Gr,f as Ur,r as wr,t as qr,h as vr}from"./packem_shared/do-sql-DqQTxsj_.mjs";import{param as Wr,renderSql as Xr,sqliteInList as Hr,unionAll as zr}from"./packem_shared/param-DlozcSQu.mjs";import{appendStreamChunk as Qr,claimStreamRun as jr,deleteStreamRun as Yr,finishStreamRun as Jr,migrateDurableStreams as Zr,readStreamChunks as $r,readStreamRun as eo,trimStreamRuns as ro}from"./packem_shared/appendStreamChunk-8eH4HB1Q.mjs";import{DurableStreamRunner as ao,MAX_DURABLE_STREAM_BYTES as to,MAX_DURABLE_STREAM_CHUNKS as no,decideDurableAttach as io}from"./packem_shared/DurableStreamRunner-cq7kMv9M.mjs";import{envOptionalPositiveInt as lo,envPositiveInt as co}from"./packem_shared/envOptionalPositiveInt-D2pY-c64.mjs";import{diffExternalSource as po}from"./packem_shared/diffExternalSource-DgDJhslq.mjs";import{liftSourceId as uo,normalizeSourceDocument as fo,normalizeSourceValue as ho}from"./packem_shared/liftSourceId-CA3ENhXj.mjs";import{materializeExternalRows as Co,materializeExternalRowsIncremental as To,readExternalSourceBaseline as Eo,runExternalSourceTick as Ro}from"./packem_shared/materializeExternalRows-C4G4u8QD.mjs";import{isSoftDeleted as go,isSourceDue as _o,pullExternalSourceIncrementalTick as Io,pullExternalSourceTick as bo}from"./packem_shared/isSoftDeleted-h1UH0yYz.mjs";import{GEO_DEFAULT_PRECISION as Po,boundingBoxCenter as Mo,boundingBoxGeohashes as Do,coveringGeohashes as yo,encodeGeohash as No,haversineMeters as Oo,pointInBoundingBox as ko}from"./packem_shared/GEO_DEFAULT_PRECISION-CqpQZ-J_.mjs";import{default as Bo}from"./packem_shared/GlobalPollTick-BNK4o-XT.mjs";import{ADMIN_FUNCTIONS as Uo,ADMIN_FUNCTION_PREFIX as wo,DEFAULT_FANOUT_TOPIC_LIMIT as qo,FLAGS_FUNCTION_PREFIX as vo,MAX_PAGE_SIZE as Ko,RELATION_FUNCTION_PREFIX as Wo,createFanoutCounters as Xo,createGlobalPollCounters as Ho,createShapeProbeCounters as zo,facetColumn as Vo,findStorageReferences as Qo,listTables as jo,readTablePage as Yo,recordFanoutPass as Jo,recordGlobalPollPass as Zo,recordShapeProbePass as $o,selectMatchingIds as ea,summarizeFanoutTopics as ra,summarizeSubscriptions as oa}from"./packem_shared/ADMIN_FUNCTIONS-DKos6M_I.mjs";import{MAIL_RETENTION as ta,MAIL_TABLE as na,clearCapturedMail as ia,ensureMailTable as sa,readCapturedMail as la,recordCapturedMail as ca}from"./packem_shared/MAIL_RETENTION-DGAQTHHs.mjs";import{NotFoundError as da}from"./packem_shared/NotFoundError-BhF7FeFr.mjs";import{armRestore as Sa,readBookmark as ua}from"./packem_shared/armRestore-Bu1_8SUa.mjs";import{CURSOR_PREFIX as ha,applySelect as xa,buildSeekBeforeWhere as Ca,buildSeekWhere as Ta,decodeCursor as Ea,encodeCursor as Ra,normalizeOrderKeys as Aa,softDeleteScope as ga,tiebreakDirectionFor as _a}from"./packem_shared/CURSOR_PREFIX-CheBVHA7.mjs";import{QUEUE_TABLE as ba,clearQueueMessages as La,isLossyBody as Pa,readQueueMessageById as Ma,readQueueMessages as Da,recordQueueMessages as ya}from"./packem_shared/QUEUE_TABLE-s7QJZvBz.mjs";import{RANK_TIEBREAK as Oa,encodePartitionKey as ka,matchesRankStaticWhere as Fa,rankKeyFromDoc as Ba,rankTableName as Ga,resolveRankPartition as Ua,sortColumnName as wa}from"./packem_shared/RANK_TIEBREAK-DBzb8aDX.mjs";import{ReactiveCache as va,reactiveCacheKey as Ka}from"./packem_shared/ReactiveCache-BNPEzDot.mjs";import{REACTOR_STATE_TABLE as Xa,listReactorStates as Ha,migrateReactorState as za,reactorNeedsRun as Va,readReactorState as Qa,writeReactorState as ja}from"./packem_shared/REACTOR_STATE_TABLE-QPRFyxMS.mjs";import{UNVOUCHABLE_DEP as Ja,createReadFootprint as Za,markUnvouchableReads as $a}from"./packem_shared/UNVOUCHABLE_DEP-C68htACn.mjs";import{buildIndexRange as rt,indexKeysForRow as ot,keysTouchRanges as at}from"./packem_shared/buildIndexRange-CBKQmHSS.mjs";import{DEFAULT_MAX_RELATION_KEYS as nt,assertFlatPredicate as it,assertShapeShardable as st,containsRelationPredicate as lt,isRelationPredicate as ct,resolveRelationPredicates as mt}from"./packem_shared/DEFAULT_MAX_RELATION_KEYS-DrUSQbcU.mjs";import{applyOnDelete as pt,distinctValues as St,fanOutScalarCounts as ut,relationHooks as ft,resolveWith as ht,runRowValidators as xt}from"./packem_shared/applyOnDelete-DxgoRrx9.mjs";import{DEFAULT_PROMOTION_THRESHOLDS as Tt,clampPromotionThresholds as Et,nextPromotionState as Rt,relayCountFor as At,shapeRoutingKey as gt}from"./packem_shared/DEFAULT_PROMOTION_THRESHOLDS-DFAcRYsv.mjs";import{DEFAULT_MAX_RELAYS as It,OwnerRelay as bt,RelayMember as Lt,createRelayLink as Pt}from"./packem_shared/DEFAULT_MAX_RELAYS-JVr88opJ.mjs";import{createReplicaLink as Dt,gateReplicaDispatch as yt,handleReplicaControl as Nt}from"./packem_shared/createReplicaLink-GrknD9FY.mjs";import{buildReprojectionMigration as kt,countLegacyRows as Ft,reprojectableFields as Bt,reprojectionTables as Gt}from"./packem_shared/buildReprojectionMigration-DcEoW2QQ.mjs";import{RLS_UNWRAP_SYMBOL as wt,RlsRequiredError as qt,guardWriter as vt}from"./packem_shared/RLS_UNWRAP_SYMBOL-BWloGsd3.mjs";import{SCHEMA_HISTORY_MAX_VERSIONS as Wt,readSchemaHistory as Xt,readSchemaVersion as Ht,recordSchemaVersion as zt}from"./packem_shared/SCHEMA_HISTORY_MAX_VERSIONS-BluIj2s-.mjs";import{serializeSqlValue as Qt}from"./packem_shared/serializeSqlValue-DbI1VQYM.mjs";import{buildSettings as Yt,isDevEnvironment as Jt}from"./packem_shared/buildSettings-B4igo4rJ.mjs";import{buildShapeDiff as $t}from"./packem_shared/buildShapeDiff-CphrFTHd.mjs";import{ShapeDiffCache as rn,createShapeDiffCache as on,globalShapeReadKey as an}from"./packem_shared/ShapeDiffCache-DIqpvunX.mjs";import{buildPokeFrames as nn,diffGlobalMembership as sn,encodeRowsPatch as ln,projectColumns as cn}from"./packem_shared/buildPokeFrames-BvgtmTHk.mjs";import{ShardRunner as dn}from"./packem_shared/ShardRunner-C9p5DVOx.mjs";import{runSocketPool as Sn}from"./packem_shared/runSocketPool-CZJ2X9cF.mjs";import{MAX_SQL_ROWS as fn,assertReadonly as hn,lintReadonlySql as xn,runReadonlySql as Cn}from"./packem_shared/MAX_SQL_ROWS-gsiUV0Eo.mjs";import{awaitWsDrain as En,subscriptionFrames as Rn,subscriptionListDeltas as An,trySendFrame as gn}from"./packem_shared/awaitWsDrain-KLafbnds.mjs";import{mergeChangedKeys as In,recordChangedKeys as bn,writeTouchesMemo as Ln}from"./packem_shared/mergeChangedKeys-D1T-TPUb.mjs";import{createSystemReader as Mn}from"./packem_shared/createSystemReader-BtYeSMDb.mjs";import{ConflictError as yn}from"./packem_shared/ConflictError-C8GtJmjS.mjs";import{DEFAULT_TRANSACTION_LIMITS as On,TransactionHeadroomTracker as kn}from"./packem_shared/DEFAULT_TRANSACTION_LIMITS-Bcoi7Bvf.mjs";import{hasTrigger as Bn,runTriggers as Gn}from"./packem_shared/hasTrigger-CjlwI4le.mjs";import{selectExpiredIds as wn}from"./packem_shared/selectExpiredIds-rvmKjueQ.mjs";import{c as vn,l as Kn}from"./packem_shared/where-sql-DxCbgqDJ.mjs";import{RELATION_EXISTS_KEY as Xn}from"./packem_shared/RELATION_EXISTS_KEY-CFUhnZSZ.mjs";import{REPROJECTION_MIGRATION_PREFIX as zn,reprojectionMigrationId as Vn}from"./packem_shared/REPROJECTION_MIGRATION_PREFIX-Czcb6_mO.mjs";import{quoteIdentifier as jn}from"./packem_shared/quoteIdentifier-CObIFRhb.mjs";import{runShardMigrations as Jn}from"./packem_shared/runShardMigrations-DS2tQC3s.mjs";import{stableStringify as $n}from"./packem_shared/stableStringify-DibjylKD.mjs";import{stableWireKey as ri}from"./packem_shared/stableWireKey-DQUcEqhM.mjs";export{Uo as ADMIN_FUNCTIONS,wo as ADMIN_FUNCTION_PREFIX,m as AGGREGATE_SQL_FUNCTION,Lr as AGG_COUNT,Pr as AGG_KEY,Mr as AGG_VALUE,M as AUDIT_LOG_TABLE,H as CDC_LOG_TABLE,z as CDC_LOG_TABLE_SEQ_INDEX,V as CDC_META_TABLE,Ce as CLIENT_WATERMARK_TABLE,ge as COMMIT_SEQ_FIELD,_e as COMMIT_SEQ_TABLE,ha as CURSOR_PREFIX,yn as ConflictError,A as CountRlsUnsupportedError,fr as DATA_MIGRATION_STATE_TABLE,qo as DEFAULT_FANOUT_TOPIC_LIMIT,nt as DEFAULT_MAX_RELATION_KEYS,It as DEFAULT_MAX_RELAYS,Tt as DEFAULT_PROMOTION_THRESHOLDS,On as DEFAULT_TRANSACTION_LIMITS,Dr as DOC_COLUMN,ao as DurableStreamRunner,vo as FLAGS_FUNCTION_PREFIX,Po as GEO_DEFAULT_PRECISION,ye as GLOBAL_SHAPE_SNAPSHOT_TABLE,Bo as GlobalPollTick,Ue as IDEMPOTENCY_TABLE,ta as MAIL_RETENTION,na as MAIL_TABLE,to as MAX_DURABLE_STREAM_BYTES,no as MAX_DURABLE_STREAM_CHUNKS,Ko as MAX_PAGE_SIZE,fn as MAX_SQL_ROWS,da as NotFoundError,k as NotUniqueError,bt as OwnerRelay,ba as QUEUE_TABLE,Oa as RANK_TIEBREAK,Xa as REACTOR_STATE_TABLE,Xn as RELATION_EXISTS_KEY,Wo as RELATION_FUNCTION_PREFIX,zn as REPROJECTION_MIGRATION_PREFIX,wt as RLS_UNWRAP_SYMBOL,va as ReactiveCache,Lt as RelayMember,qt as RlsRequiredError,Tr as SCAN_DEP,Wt as SCHEMA_HISTORY_MAX_VERSIONS,Ze as SEARCH_STATE_TABLE,ar as SHAPE_POKE_CURSOR_TABLE,rn as ShapeDiffCache,dn as ShardRunner,kn as TransactionHeadroomTracker,Ja as UNVOUCHABLE_DEP,Te as advanceClientWatermark,yr as aggUpsertSql,d as aggregateSqlFunction,h as aggregateTableName,Ie as allocateCommitSeq,D as appendAuditEntry,Q as appendCdcChange,Qr as appendStreamChunk,j as applyCdcChanges,pt as applyOnDelete,xa as applySelect,Se as archiveCdcSegment,Sa as armRestore,it as assertFlatPredicate,F as assertNoExplicitUndefined,hn as assertReadonly,st as assertShapeShardable,B as assertValidClientId,En as awaitWsDrain,q as backfillAggregateIndexes,v as backfillRankIndexes,K as backfillSearchIndexes,W as backfillSearchIndexesForTable,Mo as boundingBoxCenter,Do as boundingBoxGeohashes,rt as buildIndexRange,nn as buildPokeFrames,kt as buildReprojectionMigration,Ca as buildSeekBeforeWhere,Ta as buildSeekWhere,Yt as buildSettings,$t as buildShapeDiff,Y as bumpCdcEpoch,J as cdcCanVouchFor,Z as cdcSeqLeavingRows,$ as cdcTouchesTables,ee as cdcTrimmedError,jr as claimStreamRun,Et as clampPromotionThresholds,ia as clearCapturedMail,Xe as clearMemoryTables,La as clearQueueMessages,x as coerceAggregateNumber,re as compactCdcDocs,vn as compileWhereSql,Qe as computeRankPage,lt as containsRelationPredicate,Ft as countLegacyRows,yo as coveringGeohashes,Me as createCompanionSync,Er as createDependencyTracker,Xo as createFanoutCounters,Ho as createGlobalPollCounters,Nr as createIndexSql,Za as createReadFootprint,Pt as createRelayLink,Dt as createReplicaLink,on as createShapeDiffCache,zo as createShapeProbeCounters,G as createShardCtxDb,Mn as createSystemReader,oe as cursorBelowRetainedFloor,io as decideDurableAttach,Ea as decodeCursor,Ne as deleteGlobalShapeSnapshot,Oe as deleteGlobalShapeSnapshotsForConnection,tr as deleteShapePokeCursor,nr as deleteShapePokeCursorsForConnection,Yr as deleteStreamRun,Rr as depKey,po as diffExternalSource,sn as diffGlobalMembership,St as distinctValues,C as encodeAggregateKey,Ra as encodeCursor,No as encodeGeohash,ka as encodePartitionKey,ln as encodeRowsPatch,y as ensureAuditTable,sa as ensureMailTable,lo as envOptionalPositiveInt,co as envPositiveInt,o as exportShardRows,a as exportShardTable,Vo as facetColumn,ut as fanOutScalarCounts,Qo as findStorageReferences,Jr as finishStreamRun,T as foldAggregateTally,yt as gateReplicaDispatch,Or as geoTableName,an as globalShapeReadKey,vt as guardWriter,Nt as handleReplicaControl,Bn as hasTrigger,Oo as haversineMeters,je as hydrateDocsById,t as importShardRows,ot as indexKeysForRow,Jt as isDevEnvironment,kr as isFtsAvailable,Pa as isLossyBody,He as isMemoryTable,ct as isRelationPredicate,go as isSoftDeleted,_o as isSourceDue,Fr as jsonPath,Br as jsonPathSql,at as keysTouchRanges,uo as liftSourceId,xn as lintReadonlySql,Ha as listReactorStates,jo as listTables,Kn as literalInList,$a as markUnvouchableReads,Fa as matchesRankStaticWhere,p as matchesStaticWhere,Co as materializeExternalRows,To as materializeExternalRowsIncremental,ze as memoryTableNames,In as mergeChangedKeys,g as mergeWhere,ae as migrateCdcLog,te as migrateCdcMeta,Ee as migrateClientWatermark,be as migrateCommitSeq,Zr as migrateDurableStreams,ke as migrateGlobalShapeSnapshot,we as migrateIdempotency,za as migrateReactorState,$e as migrateSearchState,ir as migrateShapePokeCursor,ne as minCdcReplayableSeq,ie as minCdcSeq,sr as minShapePokeCursor,Rt as nextPromotionState,S as normalizeCountArgument,U as normalizeIdStructurally,Aa as normalizeOrderKeys,fo as normalizeSourceDocument,ho as normalizeSourceValue,Wr as param,n as parseExportShardArgs,i as parseImportShardArgs,_ as planAggregateLookup,ko as pointInBoundingBox,cn as projectColumns,Io as pullExternalSourceIncrementalTick,bo as pullExternalSourceTick,Gr as qualifiedJsonPath,Ur as qualifiedJsonPathSql,jn as quoteIdentifier,Ba as rankKeyFromDoc,Ga as rankTableName,Ka as reactiveCacheKey,Va as reactorNeedsRun,E as readAggregateValue,ue as readArchivedCdcChanges,N as readAuditLog,ua as readBookmark,la as readCapturedMail,fe as readCdcArchivedThrough,se as readCdcChangeKeys,le as readCdcChanges,ce as readCdcCursor,me as readCdcEpoch,Re as readClientWatermark,Le as readCommitSeq,Eo as readExternalSourceBaseline,Fe as readGlobalShapeSnapshot,qe as readIdempotent,hr as readMigrationStatus,Ma as readQueueMessageById,Da as readQueueMessages,Qa as readReactorState,Xt as readSchemaHistory,Ht as readSchemaVersion,er as readSearchBackfillState,lr as readShapePokeCursor,$r as readStreamChunks,eo as readStreamRun,Yo as readTablePage,ca as recordCapturedMail,bn as recordChangedKeys,Jo as recordFanoutPass,Zo as recordGlobalPollPass,ya as recordQueueMessages,zt as recordSchemaVersion,$o as recordShapeProbePass,ft as relationHooks,At as relayCountFor,Xr as renderSql,Bt as reprojectableFields,Vn as reprojectionMigrationId,Gt as reprojectionTables,Ua as resolveRankPartition,Ye as resolveRankSeekTuple,mt as resolveRelationPredicates,ht as resolveWith,wr as rowToDocument,xr as runDataMigration,_r as runDrizzle,Ro as runExternalSourceTick,Cn as runReadonlySql,xt as runRowValidators,Jn as runShardMigrations,Sn as runSocketPool,Ir as runSql,Gn as runTriggers,wn as selectExpiredIds,s as selectExportTables,I as selectIndexForAggregate,b as selectIndexForCount,L as selectIndexForGroupBy,ea as selectMatchingIds,pr as selectShapeMembers,Sr as selectShapeRows,Qt as serializeSqlValue,gt as shapeRoutingKey,ga as softDeleteScope,wa as sortColumnName,Hr as sqliteInList,$n as stableStringify,ri as stableWireKey,Rn as subscriptionFrames,An as subscriptionListDeltas,ra as summarizeFanoutTopics,oa as summarizeSubscriptions,qr as tableColumns,Ar as tableFromDepKey,u as throwingScheduler,_a as tiebreakDirectionFor,de as trimCdcChanges,ve as trimIdempotent,ro as trimStreamRuns,vr as tryRowToDocument,gn as trySendFrame,zr as unionAll,l as validateImportRow,he as writeCdcArchivedThrough,Be as writeGlobalShapeSnapshot,Ke as writeIdempotent,ja as writeReactorState,rr as writeSearchBackfillState,cr as writeShapePokeCursor,mr as writeShapePokeCursors,Ln as writeTouchesMemo};
|
|
1
|
+
import{exportShardRows as o,exportShardTable as a,importShardRows as t,parseExportShardArgs as n,parseImportShardArgs as i,selectExportTables as s,validateImportRow as l}from"./packem_shared/exportShardRows-Cgt3ITwH.mjs";import{AGGREGATE_SQL_FUNCTION as m,aggregateSqlFunction as d,matchesStaticWhere as p,normalizeCountArgument as S,throwingScheduler as u}from"./packem_shared/AGGREGATE_SQL_FUNCTION-m1iUU1rv.mjs";import{aggregateTableName as h,coerceAggregateNumber as x,encodeAggregateKey as C,foldAggregateTally as T,readAggregateValue as E}from"./packem_shared/aggregateTableName-XtEbp1DE.mjs";import{CountRlsUnsupportedError as A,mergeWhere as g,planAggregateLookup as _,selectIndexForAggregate as I,selectIndexForCount as b,selectIndexForGroupBy as L}from"./packem_shared/CountRlsUnsupportedError-Bdfupt3g.mjs";import{AUDIT_LOG_TABLE as M,appendAuditEntry as D,ensureAuditTable as y,readAuditLog as N}from"./packem_shared/AUDIT_LOG_TABLE-ONxmEAIz.mjs";import{NotUniqueError as k,assertNoExplicitUndefined as F,assertValidClientId as B,createShardCtxDb as G,normalizeIdStructurally as U}from"./packem_shared/NotUniqueError-DJFaCeQK.mjs";import{backfillAggregateIndexes as q,backfillRankIndexes as v,backfillSearchIndexes as K,backfillSearchIndexesForTable as W}from"./packem_shared/backfillAggregateIndexes-92hEoqfj.mjs";import{CDC_LOG_TABLE as H,CDC_LOG_TABLE_SEQ_INDEX as z,CDC_META_TABLE as V,appendCdcChange as Q,applyCdcChanges as j,bumpCdcEpoch as Y,cdcCanVouchFor as J,cdcSeqLeavingRows as Z,cdcTouchesTables as $,cdcTrimmedError as ee,compactCdcDocs as re,cursorBelowRetainedFloor as oe,migrateCdcLog as ae,migrateCdcMeta as te,minCdcReplayableSeq as ne,minCdcSeq as ie,readCdcChangeKeys as se,readCdcChanges as le,readCdcCursor as ce,readCdcEpoch as me,trimCdcChanges as de}from"./packem_shared/CDC_LOG_TABLE-BknLCi4r.mjs";import{archiveCdcSegment as Se,readArchivedCdcChanges as ue,readCdcArchivedThrough as fe,writeCdcArchivedThrough as he}from"./packem_shared/archiveCdcSegment-DU4uzDFQ.mjs";import{CLIENT_WATERMARK_TABLE as Ce,advanceClientWatermark as Te,migrateClientWatermark as Ee,readClientWatermark as Re}from"./packem_shared/CLIENT_WATERMARK_TABLE-CRnrAnJ2.mjs";import{COMMIT_SEQ_FIELD as ge,COMMIT_SEQ_TABLE as _e,allocateCommitSeq as Ie,migrateCommitSeq as be,readCommitSeq as Le}from"./packem_shared/COMMIT_SEQ_FIELD-BUdOMG5y.mjs";import{c as Me}from"./packem_shared/ctx-db-companions-BeVsHnEe.mjs";import{GLOBAL_SHAPE_SNAPSHOT_TABLE as ye,deleteGlobalShapeSnapshot as Ne,deleteGlobalShapeSnapshotsForConnection as Oe,migrateGlobalShapeSnapshot as ke,readGlobalShapeSnapshot as Fe,writeGlobalShapeSnapshot as Be}from"./packem_shared/GLOBAL_SHAPE_SNAPSHOT_TABLE-BicDuO0a.mjs";import{IDEMPOTENCY_TABLE as Ue,migrateIdempotency as we,readIdempotent as qe,trimIdempotent as ve,writeIdempotent as Ke}from"./packem_shared/IDEMPOTENCY_TABLE-DOpm_oMF.mjs";import{clearMemoryTables as Xe,isMemoryTable as He,memoryTableNames as ze}from"./packem_shared/clearMemoryTables-BGbmag2i.mjs";import{computeRankPage as Qe,hydrateDocsById as je,resolveRankSeekTuple as Ye}from"./packem_shared/computeRankPage-EhvBDg7F.mjs";import{SEARCH_STATE_TABLE as Ze,migrateSearchState as $e,readSearchBackfillState as er,writeSearchBackfillState as rr}from"./packem_shared/SEARCH_STATE_TABLE-BCqn5ksa.mjs";import{SHAPE_POKE_CURSOR_TABLE as ar,deleteShapePokeCursor as tr,deleteShapePokeCursorsForConnection as nr,migrateShapePokeCursor as ir,minShapePokeCursor as sr,readShapePokeCursor as lr,writeShapePokeCursor as cr,writeShapePokeCursors as mr}from"./packem_shared/SHAPE_POKE_CURSOR_TABLE-ByJVDHds.mjs";import{selectShapeMembers as pr,selectShapeRows as Sr}from"./packem_shared/selectShapeMembers-Ce5Jr6UH.mjs";import{DATA_MIGRATION_STATE_TABLE as fr,readMigrationStatus as hr,runDataMigration as xr}from"./packem_shared/DATA_MIGRATION_STATE_TABLE-Cp6pbyAp.mjs";import{SCAN_DEP as Tr,createDependencyTracker as Er,depKey as Rr,tableFromDepKey as Ar}from"./packem_shared/SCAN_DEP-D7qE3iUe.mjs";import{runDrizzle as _r,runSql as Ir}from"./packem_shared/runDrizzle-2ULFQR_k.mjs";import{A as Lr,a as Pr,b as Mr,D as Dr,c as yr,d as Nr,g as Or,i as kr,j as Fr,e as Br,q as Gr,f as Ur,r as wr,t as qr,h as vr}from"./packem_shared/do-sql-DqQTxsj_.mjs";import{param as Wr,renderSql as Xr,sqliteInList as Hr,unionAll as zr}from"./packem_shared/param-DlozcSQu.mjs";import{appendStreamChunk as Qr,claimStreamRun as jr,deleteStreamRun as Yr,finishStreamRun as Jr,migrateDurableStreams as Zr,readStreamChunks as $r,readStreamRun as eo,trimStreamRuns as ro}from"./packem_shared/appendStreamChunk-8eH4HB1Q.mjs";import{DurableStreamRunner as ao,MAX_DURABLE_STREAM_BYTES as to,MAX_DURABLE_STREAM_CHUNKS as no,decideDurableAttach as io}from"./packem_shared/DurableStreamRunner-cq7kMv9M.mjs";import{envOptionalPositiveInt as lo,envPositiveInt as co}from"./packem_shared/envOptionalPositiveInt-D2pY-c64.mjs";import{diffExternalSource as po}from"./packem_shared/diffExternalSource-DgDJhslq.mjs";import{liftSourceId as uo,normalizeSourceDocument as fo,normalizeSourceValue as ho}from"./packem_shared/liftSourceId-CA3ENhXj.mjs";import{materializeExternalRows as Co,materializeExternalRowsIncremental as To,readExternalSourceBaseline as Eo,runExternalSourceTick as Ro}from"./packem_shared/materializeExternalRows-C4G4u8QD.mjs";import{isSoftDeleted as go,isSourceDue as _o,pullExternalSourceIncrementalTick as Io,pullExternalSourceTick as bo}from"./packem_shared/isSoftDeleted-h1UH0yYz.mjs";import{GEO_DEFAULT_PRECISION as Po,boundingBoxCenter as Mo,boundingBoxGeohashes as Do,coveringGeohashes as yo,encodeGeohash as No,haversineMeters as Oo,pointInBoundingBox as ko}from"./packem_shared/GEO_DEFAULT_PRECISION-CqpQZ-J_.mjs";import{default as Bo}from"./packem_shared/GlobalPollTick-BNK4o-XT.mjs";import{ADMIN_FUNCTIONS as Uo,ADMIN_FUNCTION_PREFIX as wo,DEFAULT_FANOUT_TOPIC_LIMIT as qo,FLAGS_FUNCTION_PREFIX as vo,MAX_PAGE_SIZE as Ko,RELATION_FUNCTION_PREFIX as Wo,createFanoutCounters as Xo,createGlobalPollCounters as Ho,createShapeProbeCounters as zo,facetColumn as Vo,findStorageReferences as Qo,listTables as jo,readTablePage as Yo,recordFanoutPass as Jo,recordGlobalPollPass as Zo,recordShapeProbePass as $o,selectMatchingIds as ea,summarizeFanoutTopics as ra,summarizeSubscriptions as oa}from"./packem_shared/ADMIN_FUNCTIONS-DKos6M_I.mjs";import{MAIL_RETENTION as ta,MAIL_TABLE as na,clearCapturedMail as ia,ensureMailTable as sa,readCapturedMail as la,recordCapturedMail as ca}from"./packem_shared/MAIL_RETENTION-DGAQTHHs.mjs";import{NotFoundError as da}from"./packem_shared/NotFoundError-BhF7FeFr.mjs";import{armRestore as Sa,readBookmark as ua}from"./packem_shared/armRestore-Bu1_8SUa.mjs";import{CURSOR_PREFIX as ha,applySelect as xa,buildSeekBeforeWhere as Ca,buildSeekWhere as Ta,decodeCursor as Ea,encodeCursor as Ra,normalizeOrderKeys as Aa,softDeleteScope as ga,tiebreakDirectionFor as _a}from"./packem_shared/CURSOR_PREFIX-CheBVHA7.mjs";import{QUEUE_TABLE as ba,clearQueueMessages as La,isLossyBody as Pa,readQueueMessageById as Ma,readQueueMessages as Da,recordQueueMessages as ya}from"./packem_shared/QUEUE_TABLE-s7QJZvBz.mjs";import{RANK_TIEBREAK as Oa,encodePartitionKey as ka,matchesRankStaticWhere as Fa,rankKeyFromDoc as Ba,rankTableName as Ga,resolveRankPartition as Ua,sortColumnName as wa}from"./packem_shared/RANK_TIEBREAK-DBzb8aDX.mjs";import{ReactiveCache as va,reactiveCacheKey as Ka}from"./packem_shared/ReactiveCache-BpnU4D2r.mjs";import{REACTOR_STATE_TABLE as Xa,listReactorStates as Ha,migrateReactorState as za,reactorNeedsRun as Va,readReactorState as Qa,writeReactorState as ja}from"./packem_shared/REACTOR_STATE_TABLE-QPRFyxMS.mjs";import{UNVOUCHABLE_DEP as Ja,createReadFootprint as Za,markUnvouchableReads as $a}from"./packem_shared/UNVOUCHABLE_DEP-C68htACn.mjs";import{buildIndexRange as rt,indexKeysForRow as ot,keysTouchRanges as at}from"./packem_shared/buildIndexRange-CBKQmHSS.mjs";import{DEFAULT_MAX_RELATION_KEYS as nt,assertFlatPredicate as it,assertShapeShardable as st,containsRelationPredicate as lt,isRelationPredicate as ct,resolveRelationPredicates as mt}from"./packem_shared/DEFAULT_MAX_RELATION_KEYS-DrUSQbcU.mjs";import{applyOnDelete as pt,distinctValues as St,fanOutScalarCounts as ut,relationHooks as ft,resolveWith as ht,runRowValidators as xt}from"./packem_shared/applyOnDelete-DxgoRrx9.mjs";import{DEFAULT_PROMOTION_THRESHOLDS as Tt,clampPromotionThresholds as Et,nextPromotionState as Rt,relayCountFor as At,shapeRoutingKey as gt}from"./packem_shared/DEFAULT_PROMOTION_THRESHOLDS-DFAcRYsv.mjs";import{DEFAULT_MAX_RELAYS as It,OwnerRelay as bt,RelayMember as Lt,createRelayLink as Pt}from"./packem_shared/DEFAULT_MAX_RELAYS-JVr88opJ.mjs";import{createReplicaLink as Dt,gateReplicaDispatch as yt,handleReplicaControl as Nt}from"./packem_shared/createReplicaLink-GrknD9FY.mjs";import{buildReprojectionMigration as kt,countLegacyRows as Ft,reprojectableFields as Bt,reprojectionTables as Gt}from"./packem_shared/buildReprojectionMigration-DcEoW2QQ.mjs";import{RLS_UNWRAP_SYMBOL as wt,RlsRequiredError as qt,guardWriter as vt}from"./packem_shared/RLS_UNWRAP_SYMBOL-BWloGsd3.mjs";import{SCHEMA_HISTORY_MAX_VERSIONS as Wt,readSchemaHistory as Xt,readSchemaVersion as Ht,recordSchemaVersion as zt}from"./packem_shared/SCHEMA_HISTORY_MAX_VERSIONS-BluIj2s-.mjs";import{serializeSqlValue as Qt}from"./packem_shared/serializeSqlValue-DbI1VQYM.mjs";import{buildSettings as Yt,isDevEnvironment as Jt}from"./packem_shared/buildSettings-B4igo4rJ.mjs";import{buildShapeDiff as $t}from"./packem_shared/buildShapeDiff-CphrFTHd.mjs";import{ShapeDiffCache as rn,createShapeDiffCache as on,globalShapeReadKey as an}from"./packem_shared/ShapeDiffCache-DIqpvunX.mjs";import{buildPokeFrames as nn,diffGlobalMembership as sn,encodeRowsPatch as ln,projectColumns as cn}from"./packem_shared/buildPokeFrames-BvgtmTHk.mjs";import{ShardRunner as dn}from"./packem_shared/ShardRunner-C9p5DVOx.mjs";import{runSocketPool as Sn}from"./packem_shared/runSocketPool-CZJ2X9cF.mjs";import{MAX_SQL_ROWS as fn,assertReadonly as hn,lintReadonlySql as xn,runReadonlySql as Cn}from"./packem_shared/MAX_SQL_ROWS-gsiUV0Eo.mjs";import{awaitWsDrain as En,subscriptionFrames as Rn,subscriptionListDeltas as An,trySendFrame as gn}from"./packem_shared/awaitWsDrain-KLafbnds.mjs";import{mergeChangedKeys as In,recordChangedKeys as bn,writeTouchesMemo as Ln}from"./packem_shared/mergeChangedKeys-D1T-TPUb.mjs";import{createSystemReader as Mn}from"./packem_shared/createSystemReader-BtYeSMDb.mjs";import{ConflictError as yn}from"./packem_shared/ConflictError-C8GtJmjS.mjs";import{DEFAULT_TRANSACTION_LIMITS as On,TransactionHeadroomTracker as kn}from"./packem_shared/DEFAULT_TRANSACTION_LIMITS-Bcoi7Bvf.mjs";import{hasTrigger as Bn,runTriggers as Gn}from"./packem_shared/hasTrigger-CjlwI4le.mjs";import{selectExpiredIds as wn}from"./packem_shared/selectExpiredIds-rvmKjueQ.mjs";import{c as vn,l as Kn}from"./packem_shared/where-sql-DxCbgqDJ.mjs";import{RELATION_EXISTS_KEY as Xn}from"./packem_shared/RELATION_EXISTS_KEY-CFUhnZSZ.mjs";import{REPROJECTION_MIGRATION_PREFIX as zn,reprojectionMigrationId as Vn}from"./packem_shared/REPROJECTION_MIGRATION_PREFIX-Czcb6_mO.mjs";import{quoteIdentifier as jn}from"./packem_shared/quoteIdentifier-CObIFRhb.mjs";import{runShardMigrations as Jn}from"./packem_shared/runShardMigrations-DS2tQC3s.mjs";import{stableStringify as $n}from"./packem_shared/stableStringify-DibjylKD.mjs";import{stableWireKey as ri}from"./packem_shared/stableWireKey-DQUcEqhM.mjs";export{Uo as ADMIN_FUNCTIONS,wo as ADMIN_FUNCTION_PREFIX,m as AGGREGATE_SQL_FUNCTION,Lr as AGG_COUNT,Pr as AGG_KEY,Mr as AGG_VALUE,M as AUDIT_LOG_TABLE,H as CDC_LOG_TABLE,z as CDC_LOG_TABLE_SEQ_INDEX,V as CDC_META_TABLE,Ce as CLIENT_WATERMARK_TABLE,ge as COMMIT_SEQ_FIELD,_e as COMMIT_SEQ_TABLE,ha as CURSOR_PREFIX,yn as ConflictError,A as CountRlsUnsupportedError,fr as DATA_MIGRATION_STATE_TABLE,qo as DEFAULT_FANOUT_TOPIC_LIMIT,nt as DEFAULT_MAX_RELATION_KEYS,It as DEFAULT_MAX_RELAYS,Tt as DEFAULT_PROMOTION_THRESHOLDS,On as DEFAULT_TRANSACTION_LIMITS,Dr as DOC_COLUMN,ao as DurableStreamRunner,vo as FLAGS_FUNCTION_PREFIX,Po as GEO_DEFAULT_PRECISION,ye as GLOBAL_SHAPE_SNAPSHOT_TABLE,Bo as GlobalPollTick,Ue as IDEMPOTENCY_TABLE,ta as MAIL_RETENTION,na as MAIL_TABLE,to as MAX_DURABLE_STREAM_BYTES,no as MAX_DURABLE_STREAM_CHUNKS,Ko as MAX_PAGE_SIZE,fn as MAX_SQL_ROWS,da as NotFoundError,k as NotUniqueError,bt as OwnerRelay,ba as QUEUE_TABLE,Oa as RANK_TIEBREAK,Xa as REACTOR_STATE_TABLE,Xn as RELATION_EXISTS_KEY,Wo as RELATION_FUNCTION_PREFIX,zn as REPROJECTION_MIGRATION_PREFIX,wt as RLS_UNWRAP_SYMBOL,va as ReactiveCache,Lt as RelayMember,qt as RlsRequiredError,Tr as SCAN_DEP,Wt as SCHEMA_HISTORY_MAX_VERSIONS,Ze as SEARCH_STATE_TABLE,ar as SHAPE_POKE_CURSOR_TABLE,rn as ShapeDiffCache,dn as ShardRunner,kn as TransactionHeadroomTracker,Ja as UNVOUCHABLE_DEP,Te as advanceClientWatermark,yr as aggUpsertSql,d as aggregateSqlFunction,h as aggregateTableName,Ie as allocateCommitSeq,D as appendAuditEntry,Q as appendCdcChange,Qr as appendStreamChunk,j as applyCdcChanges,pt as applyOnDelete,xa as applySelect,Se as archiveCdcSegment,Sa as armRestore,it as assertFlatPredicate,F as assertNoExplicitUndefined,hn as assertReadonly,st as assertShapeShardable,B as assertValidClientId,En as awaitWsDrain,q as backfillAggregateIndexes,v as backfillRankIndexes,K as backfillSearchIndexes,W as backfillSearchIndexesForTable,Mo as boundingBoxCenter,Do as boundingBoxGeohashes,rt as buildIndexRange,nn as buildPokeFrames,kt as buildReprojectionMigration,Ca as buildSeekBeforeWhere,Ta as buildSeekWhere,Yt as buildSettings,$t as buildShapeDiff,Y as bumpCdcEpoch,J as cdcCanVouchFor,Z as cdcSeqLeavingRows,$ as cdcTouchesTables,ee as cdcTrimmedError,jr as claimStreamRun,Et as clampPromotionThresholds,ia as clearCapturedMail,Xe as clearMemoryTables,La as clearQueueMessages,x as coerceAggregateNumber,re as compactCdcDocs,vn as compileWhereSql,Qe as computeRankPage,lt as containsRelationPredicate,Ft as countLegacyRows,yo as coveringGeohashes,Me as createCompanionSync,Er as createDependencyTracker,Xo as createFanoutCounters,Ho as createGlobalPollCounters,Nr as createIndexSql,Za as createReadFootprint,Pt as createRelayLink,Dt as createReplicaLink,on as createShapeDiffCache,zo as createShapeProbeCounters,G as createShardCtxDb,Mn as createSystemReader,oe as cursorBelowRetainedFloor,io as decideDurableAttach,Ea as decodeCursor,Ne as deleteGlobalShapeSnapshot,Oe as deleteGlobalShapeSnapshotsForConnection,tr as deleteShapePokeCursor,nr as deleteShapePokeCursorsForConnection,Yr as deleteStreamRun,Rr as depKey,po as diffExternalSource,sn as diffGlobalMembership,St as distinctValues,C as encodeAggregateKey,Ra as encodeCursor,No as encodeGeohash,ka as encodePartitionKey,ln as encodeRowsPatch,y as ensureAuditTable,sa as ensureMailTable,lo as envOptionalPositiveInt,co as envPositiveInt,o as exportShardRows,a as exportShardTable,Vo as facetColumn,ut as fanOutScalarCounts,Qo as findStorageReferences,Jr as finishStreamRun,T as foldAggregateTally,yt as gateReplicaDispatch,Or as geoTableName,an as globalShapeReadKey,vt as guardWriter,Nt as handleReplicaControl,Bn as hasTrigger,Oo as haversineMeters,je as hydrateDocsById,t as importShardRows,ot as indexKeysForRow,Jt as isDevEnvironment,kr as isFtsAvailable,Pa as isLossyBody,He as isMemoryTable,ct as isRelationPredicate,go as isSoftDeleted,_o as isSourceDue,Fr as jsonPath,Br as jsonPathSql,at as keysTouchRanges,uo as liftSourceId,xn as lintReadonlySql,Ha as listReactorStates,jo as listTables,Kn as literalInList,$a as markUnvouchableReads,Fa as matchesRankStaticWhere,p as matchesStaticWhere,Co as materializeExternalRows,To as materializeExternalRowsIncremental,ze as memoryTableNames,In as mergeChangedKeys,g as mergeWhere,ae as migrateCdcLog,te as migrateCdcMeta,Ee as migrateClientWatermark,be as migrateCommitSeq,Zr as migrateDurableStreams,ke as migrateGlobalShapeSnapshot,we as migrateIdempotency,za as migrateReactorState,$e as migrateSearchState,ir as migrateShapePokeCursor,ne as minCdcReplayableSeq,ie as minCdcSeq,sr as minShapePokeCursor,Rt as nextPromotionState,S as normalizeCountArgument,U as normalizeIdStructurally,Aa as normalizeOrderKeys,fo as normalizeSourceDocument,ho as normalizeSourceValue,Wr as param,n as parseExportShardArgs,i as parseImportShardArgs,_ as planAggregateLookup,ko as pointInBoundingBox,cn as projectColumns,Io as pullExternalSourceIncrementalTick,bo as pullExternalSourceTick,Gr as qualifiedJsonPath,Ur as qualifiedJsonPathSql,jn as quoteIdentifier,Ba as rankKeyFromDoc,Ga as rankTableName,Ka as reactiveCacheKey,Va as reactorNeedsRun,E as readAggregateValue,ue as readArchivedCdcChanges,N as readAuditLog,ua as readBookmark,la as readCapturedMail,fe as readCdcArchivedThrough,se as readCdcChangeKeys,le as readCdcChanges,ce as readCdcCursor,me as readCdcEpoch,Re as readClientWatermark,Le as readCommitSeq,Eo as readExternalSourceBaseline,Fe as readGlobalShapeSnapshot,qe as readIdempotent,hr as readMigrationStatus,Ma as readQueueMessageById,Da as readQueueMessages,Qa as readReactorState,Xt as readSchemaHistory,Ht as readSchemaVersion,er as readSearchBackfillState,lr as readShapePokeCursor,$r as readStreamChunks,eo as readStreamRun,Yo as readTablePage,ca as recordCapturedMail,bn as recordChangedKeys,Jo as recordFanoutPass,Zo as recordGlobalPollPass,ya as recordQueueMessages,zt as recordSchemaVersion,$o as recordShapeProbePass,ft as relationHooks,At as relayCountFor,Xr as renderSql,Bt as reprojectableFields,Vn as reprojectionMigrationId,Gt as reprojectionTables,Ua as resolveRankPartition,Ye as resolveRankSeekTuple,mt as resolveRelationPredicates,ht as resolveWith,wr as rowToDocument,xr as runDataMigration,_r as runDrizzle,Ro as runExternalSourceTick,Cn as runReadonlySql,xt as runRowValidators,Jn as runShardMigrations,Sn as runSocketPool,Ir as runSql,Gn as runTriggers,wn as selectExpiredIds,s as selectExportTables,I as selectIndexForAggregate,b as selectIndexForCount,L as selectIndexForGroupBy,ea as selectMatchingIds,pr as selectShapeMembers,Sr as selectShapeRows,Qt as serializeSqlValue,gt as shapeRoutingKey,ga as softDeleteScope,wa as sortColumnName,Hr as sqliteInList,$n as stableStringify,ri as stableWireKey,Rn as subscriptionFrames,An as subscriptionListDeltas,ra as summarizeFanoutTopics,oa as summarizeSubscriptions,qr as tableColumns,Ar as tableFromDepKey,u as throwingScheduler,_a as tiebreakDirectionFor,de as trimCdcChanges,ve as trimIdempotent,ro as trimStreamRuns,vr as tryRowToDocument,gn as trySendFrame,zr as unionAll,l as validateImportRow,he as writeCdcArchivedThrough,Be as writeGlobalShapeSnapshot,Ke as writeIdempotent,ja as writeReactorState,rr as writeSearchBackfillState,cr as writeShapePokeCursor,mr as writeShapePokeCursors,Ln as writeTouchesMemo};
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import{LunoraError as b}from"@lunora/errors";import{runSql as c}from"./runDrizzle-2ULFQR_k.mjs";const n="__lunora_migrations",x=100,N=3e4,y=1e4,M=e=>{c(e,`CREATE TABLE IF NOT EXISTS "${n}" (
|
|
2
|
+
id TEXT PRIMARY KEY,
|
|
3
|
+
direction TEXT NOT NULL,
|
|
4
|
+
status TEXT NOT NULL,
|
|
5
|
+
cursor TEXT,
|
|
6
|
+
processed INTEGER NOT NULL DEFAULT 0,
|
|
7
|
+
changed INTEGER NOT NULL DEFAULT 0,
|
|
8
|
+
started_at REAL,
|
|
9
|
+
updated_at REAL,
|
|
10
|
+
error TEXT
|
|
11
|
+
)`)},R=e=>({changed:e.changed,cursor:typeof e.cursor=="string"?e.cursor:null,direction:e.direction==="down"?"down":"up",processed:e.processed,status:e.status==="completed"||e.status==="failed"?e.status:"in_progress"}),S=(e,t)=>{const r=c(e,`SELECT * FROM "${n}" WHERE id = ?`,t).toArray()[0];if(r)return{...R(r),startedAt:typeof r.started_at=="number"?r.started_at:void 0}},U=(e,t,s)=>{c(e,`DELETE FROM "${n}"
|
|
12
|
+
WHERE id = ? AND (status <> 'in_progress' OR updated_at IS NULL OR updated_at <= ?)`,t,s)},h=(e,t)=>{c(e,`INSERT INTO "${n}"
|
|
13
|
+
(id, direction, status, cursor, processed, changed, started_at, updated_at, error)
|
|
14
|
+
VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?)
|
|
15
|
+
ON CONFLICT(id) DO UPDATE SET
|
|
16
|
+
direction = excluded.direction,
|
|
17
|
+
status = excluded.status,
|
|
18
|
+
cursor = excluded.cursor,
|
|
19
|
+
processed = excluded.processed,
|
|
20
|
+
changed = excluded.changed,
|
|
21
|
+
updated_at = excluded.updated_at,
|
|
22
|
+
error = excluded.error`,t.id,t.direction,t.status,t.cursor,t.processed,t.changed,t.startedAt,t.updatedAt,t.error)},C=(e,t,s,r)=>(c(e,`INSERT INTO "${n}"
|
|
23
|
+
(id, direction, status, cursor, processed, changed, started_at, updated_at, error)
|
|
24
|
+
VALUES (?, ?, 'in_progress', NULL, 0, 0, ?, ?, NULL)
|
|
25
|
+
ON CONFLICT(id) DO UPDATE SET
|
|
26
|
+
status = 'in_progress',
|
|
27
|
+
updated_at = excluded.updated_at
|
|
28
|
+
WHERE
|
|
29
|
+
"${n}".status <> 'in_progress'
|
|
30
|
+
OR "${n}".updated_at IS NULL
|
|
31
|
+
OR "${n}".updated_at <= excluded.updated_at - ${String(N)}`,t,s,r,r),c(e,"SELECT changes() AS changed").one().changed>0),$=(e,t,s)=>{c(e,`UPDATE "${n}" SET updated_at = ? WHERE id = ? AND status = 'in_progress'`,s,t)},F=(e,t)=>{c(e,`UPDATE "${n}" SET updated_at = 0 WHERE id = ? AND status = 'in_progress'`,t)},B=(e,t)=>{if(c(e,"SELECT name FROM sqlite_master WHERE type = 'table' AND name = ? LIMIT 1",n).toArray().length===0)return[];const r=t===void 0?" ORDER BY id":" WHERE id = ?",i=t===void 0?[]:[t];return c(e,`SELECT * FROM "${n}"${r}`,...i).toArray().map(a=>({...R(a),error:typeof a.error=="string"?a.error:null,id:a.id,startedAt:typeof a.started_at=="number"?a.started_at:null,updatedAt:typeof a.updated_at=="number"?a.updated_at:null}))},w=async e=>{const{migration:t,sql:s,writer:r}=e,i=e.direction??"up",o=e.dryRun??!1,a=e.clock??(()=>Date.now()),I=e.maxBatches??Number.POSITIVE_INFINITY,O=e.batchSize??t.batchSize??x,f=i==="up"?t.up:t.down;if(!f)throw new b("INTERNAL",`data migration "${t.id}" has no \`${i}\` transform`);const D={db:{count:r.count.bind(r),findFirst:r.findFirst.bind(r),findMany:r.findMany.bind(r),get:r.get.bind(r)}};let p=null,_=0,g=0,A=a();if(!o){M(s);const d=S(s,t.id);if(d?.direction===i&&d.status==="completed")return{changed:d.changed,cursor:null,direction:i,dryRun:o,id:t.id,processed:d.processed,status:"completed"};if(d&&d.direction!==i&&U(s,t.id,a()-N),!C(s,t.id,i,a())){const u=S(s,t.id);return{changed:u?.changed??0,cursor:u?.cursor??p,direction:u?.direction??i,dryRun:o,id:t.id,processed:u?.processed??0,status:u?.status??"in_progress"}}const l=d?.direction===i?d:void 0;l&&(p=l.cursor,_=l.processed,g=l.changed,A=l.startedAt??A)}let T=!1,m=0,L=A;try{for(;!T&&m<I;){const d=await r.findMany(t.table,{cursor:p,limit:O});for(const E of d.page){_+=1;const l=await f(E,D);if(l!==void 0&&(g+=1,o||await r.replace(String(E._id),{...l,_creationTime:E._creationTime,_id:E._id},void 0,{allowExplicitId:!0})),!o){const u=a();u-L>=y&&($(s,t.id,u),L=u)}}if(p=d.continueCursor,T=d.isDone,m+=1,!o){const E=a();h(s,{changed:g,cursor:T?null:p,direction:i,error:null,id:t.id,processed:_,startedAt:A,status:T?"completed":"in_progress",updatedAt:E}),L=E;try{await e.onBatch?.({batches:m,changed:g,processed:_})}catch{}}}}catch(d){throw o||h(s,{changed:g,cursor:p,direction:i,error:d instanceof Error?d.message:String(d),id:t.id,processed:_,startedAt:A,status:"failed",updatedAt:a()}),d}if(!o&&!T)try{F(s,t.id)}catch(d){console.warn(`data migration "${t.id}": releaseClaim failed`,d)}return{changed:g,cursor:T?null:p,direction:i,dryRun:o,id:t.id,processed:_,status:T?"completed":"in_progress"}};export{n as DATA_MIGRATION_STATE_TABLE,B as readMigrationStatus,w as runDataMigration};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{stableWireKey as y}from"./stableWireKey-DQUcEqhM.mjs";import{depKey as b,SCAN_DEP as p}from"./SCAN_DEP-D7qE3iUe.mjs";import{e as m}from"./estimate-bytes-CzG5x1f8.mjs";import{keysTouchRanges as x}from"./buildIndexRange-CBKQmHSS.mjs";import{stableStringify as K}from"./stableStringify-DibjylKD.mjs";const l=(o,t,s)=>{let e=o.get(t);return e===void 0&&(e=s(),o.set(t,e)),e},v=1e3,E=4*1024*1024;class A{entries=new Map;tableIndex=new Map;rangeIndex=new Map;totalBytes=0;hits=0;misses=0;evictions=0;maxEntries;maxBytes;now;monotonic=0;generation=0;constructor(t={}){this.maxEntries=t.maxEntries??v,this.maxBytes=t.maxBytes??E,this.now=t.now??(()=>(this.monotonic+=1,this.monotonic))}async run(t,s,e,i=()=>[]){const n=this.entries.get(t);if(n)return this.hits+=1,n.lastUsed=this.now(),this.entries.delete(t),this.entries.set(t,n),n.result;this.misses+=1;const c=this.generation,a=await e();if(this.generation!==c)return a;const h=m(a);if(h===void 0)return a;const f=i(),u={bytes:h,deps:s,ranges:f,lastUsed:this.now(),result:a,subscribers:new Set},d=this.entries.get(t);if(d){this.dropEntry(t,d);for(const r of d.subscribers)u.subscribers.add(r)}this.entries.set(t,u),this.totalBytes+=h;for(const r of s)l(this.tableIndex,r,()=>new Set).add(t);for(const r of f){const g=l(this.rangeIndex,r.table,()=>new Map);l(g,r,()=>new Set).add(t)}return this.evict(),a}invalidate(t,s,e){this.generation+=1;const i=[];return this.collectAndDrop(b(t,s),i),this.collectAndDrop(b(t,p),i),this.dropRangeDeps(t,e,i),i}invalidateTable(t){this.generation+=1;const s=[],e=`${t}:`;for(const i of this.tableIndex.keys())i.startsWith(e)&&this.collectAndDrop(i,s);return this.dropRangeDeps(t,void 0,s),s}subscribe(t,s){const e=this.entries.get(t);e&&e.subscribers.add(s)}unsubscribe(t,s){const e=this.entries.get(t);e&&e.subscribers.delete(s)}size(){return{bytes:this.totalBytes,entries:this.entries.size}}clear(){this.generation+=1,this.entries.clear(),this.tableIndex.clear(),this.rangeIndex.clear(),this.totalBytes=0}subscribers(t){const s=this.entries.get(t);return s?[...s.subscribers]:[]}stats(){return{bytes:this.totalBytes,entries:this.entries.size,evictions:this.evictions,hits:this.hits,misses:this.misses}}dropRangeDeps(t,s,e){const i=this.rangeIndex.get(t);if(!(!i||i.size===0))for(const[n,c]of i)x([n],s)&&this.dropKeys(c,e)}collectAndDrop(t,s){const e=this.tableIndex.get(t);e&&this.dropKeys(e,s)}dropKeys(t,s){for(const e of t){const i=this.entries.get(e);i&&(this.dropEntry(e,i),s.push(e))}}dropEntry(t,s){this.entries.delete(t),this.totalBytes-=s.bytes;for(const e of s.deps){const i=this.tableIndex.get(e);i&&(i.delete(t),i.size===0&&this.tableIndex.delete(e))}for(const e of s.ranges){const i=this.rangeIndex.get(e.table),n=i?.get(e);n?.delete(t),i&&n?.size===0&&(i.delete(e),i.size===0&&this.rangeIndex.delete(e.table))}}evict(){if(!(this.entries.size<=this.maxEntries&&this.totalBytes<=this.maxBytes))for(const[t,s]of this.entries){if(this.entries.size<=this.maxEntries&&this.totalBytes<=this.maxBytes)return;s.subscribers.size>0||(this.dropEntry(t,s),this.evictions+=1)}}}const D=(o,t,s)=>`${s??"\0anon"}\0${o}:${y(t)}`;export{A as ReactiveCache,D as reactiveCacheKey,K as stableStringify,y as stableWireKey};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lunora/shard-engine",
|
|
3
|
-
"version": "1.0.0-alpha.
|
|
3
|
+
"version": "1.0.0-alpha.48",
|
|
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",
|
|
@@ -48,8 +48,8 @@
|
|
|
48
48
|
"access": "public"
|
|
49
49
|
},
|
|
50
50
|
"dependencies": {
|
|
51
|
-
"@lunora/errors": "1.0.0-alpha.
|
|
52
|
-
"@lunora/platform": "1.0.0-alpha.
|
|
51
|
+
"@lunora/errors": "1.0.0-alpha.26",
|
|
52
|
+
"@lunora/platform": "1.0.0-alpha.22",
|
|
53
53
|
"drizzle-orm": "^0.45.2"
|
|
54
54
|
},
|
|
55
55
|
"engines": {
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
import{LunoraError as b}from"@lunora/errors";import{runSql as c}from"./runDrizzle-2ULFQR_k.mjs";const n="__lunora_migrations",x=100,D=3e4,y=1e4,M=e=>{c(e,`CREATE TABLE IF NOT EXISTS "${n}" (
|
|
2
|
-
id TEXT PRIMARY KEY,
|
|
3
|
-
direction TEXT NOT NULL,
|
|
4
|
-
status TEXT NOT NULL,
|
|
5
|
-
cursor TEXT,
|
|
6
|
-
processed INTEGER NOT NULL DEFAULT 0,
|
|
7
|
-
changed INTEGER NOT NULL DEFAULT 0,
|
|
8
|
-
started_at REAL,
|
|
9
|
-
updated_at REAL,
|
|
10
|
-
error TEXT
|
|
11
|
-
)`)},N=e=>({changed:e.changed,cursor:typeof e.cursor=="string"?e.cursor:null,direction:e.direction==="down"?"down":"up",processed:e.processed,status:e.status==="completed"||e.status==="failed"?e.status:"in_progress"}),h=(e,t)=>{const r=c(e,`SELECT * FROM "${n}" WHERE id = ?`,t).toArray()[0];if(r)return{...N(r),startedAt:typeof r.started_at=="number"?r.started_at:void 0}},C=(e,t)=>{c(e,`DELETE FROM "${n}" WHERE id = ?`,t)},S=(e,t)=>{c(e,`INSERT INTO "${n}"
|
|
12
|
-
(id, direction, status, cursor, processed, changed, started_at, updated_at, error)
|
|
13
|
-
VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?)
|
|
14
|
-
ON CONFLICT(id) DO UPDATE SET
|
|
15
|
-
direction = excluded.direction,
|
|
16
|
-
status = excluded.status,
|
|
17
|
-
cursor = excluded.cursor,
|
|
18
|
-
processed = excluded.processed,
|
|
19
|
-
changed = excluded.changed,
|
|
20
|
-
updated_at = excluded.updated_at,
|
|
21
|
-
error = excluded.error`,t.id,t.direction,t.status,t.cursor,t.processed,t.changed,t.startedAt,t.updatedAt,t.error)},U=(e,t,s,r)=>(c(e,`INSERT INTO "${n}"
|
|
22
|
-
(id, direction, status, cursor, processed, changed, started_at, updated_at, error)
|
|
23
|
-
VALUES (?, ?, 'in_progress', NULL, 0, 0, ?, ?, NULL)
|
|
24
|
-
ON CONFLICT(id) DO UPDATE SET
|
|
25
|
-
status = 'in_progress',
|
|
26
|
-
updated_at = excluded.updated_at
|
|
27
|
-
WHERE
|
|
28
|
-
"${n}".direction <> excluded.direction
|
|
29
|
-
OR "${n}".status <> 'in_progress'
|
|
30
|
-
OR "${n}".updated_at IS NULL
|
|
31
|
-
OR "${n}".updated_at <= excluded.updated_at - ${String(D)}`,t,s,r,r),c(e,"SELECT changes() AS changed").one().changed>0),$=(e,t,s)=>{c(e,`UPDATE "${n}" SET updated_at = ? WHERE id = ? AND status = 'in_progress'`,s,t)},F=(e,t)=>{c(e,`UPDATE "${n}" SET updated_at = 0 WHERE id = ? AND status = 'in_progress'`,t)},B=(e,t)=>{if(c(e,"SELECT name FROM sqlite_master WHERE type = 'table' AND name = ? LIMIT 1",n).toArray().length===0)return[];const r=t===void 0?" ORDER BY id":" WHERE id = ?",i=t===void 0?[]:[t];return c(e,`SELECT * FROM "${n}"${r}`,...i).toArray().map(a=>({...N(a),error:typeof a.error=="string"?a.error:null,id:a.id,startedAt:typeof a.started_at=="number"?a.started_at:null,updatedAt:typeof a.updated_at=="number"?a.updated_at:null}))},w=async e=>{const{migration:t,sql:s,writer:r}=e,i=e.direction??"up",o=e.dryRun??!1,a=e.clock??(()=>Date.now()),R=e.maxBatches??Number.POSITIVE_INFINITY,I=e.batchSize??t.batchSize??x,L=i==="up"?t.up:t.down;if(!L)throw new b("INTERNAL",`data migration "${t.id}" has no \`${i}\` transform`);const O={db:{count:r.count.bind(r),findFirst:r.findFirst.bind(r),findMany:r.findMany.bind(r),get:r.get.bind(r)}};let T=null,_=0,g=0,A=a();if(!o){M(s);const d=h(s,t.id);if(d?.direction===i&&d.status==="completed")return{changed:d.changed,cursor:null,direction:i,dryRun:o,id:t.id,processed:d.processed,status:"completed"};if(d&&d.direction!==i&&C(s,t.id),!U(s,t.id,i,a())){const E=h(s,t.id);return{changed:E?.changed??0,cursor:E?.cursor??T,direction:i,dryRun:o,id:t.id,processed:E?.processed??0,status:E?.status??"in_progress"}}const l=d?.direction===i?d:void 0;l&&(T=l.cursor,_=l.processed,g=l.changed,A=l.startedAt??A)}let p=!1,m=0,f=A;try{for(;!p&&m<R;){const d=await r.findMany(t.table,{cursor:T,limit:I});for(const u of d.page){_+=1;const l=await L(u,O);if(l!==void 0&&(g+=1,o||await r.replace(String(u._id),{...l,_creationTime:u._creationTime,_id:u._id},void 0,{allowExplicitId:!0})),!o){const E=a();E-f>=y&&($(s,t.id,E),f=E)}}if(T=d.continueCursor,p=d.isDone,m+=1,!o){const u=a();S(s,{changed:g,cursor:p?null:T,direction:i,error:null,id:t.id,processed:_,startedAt:A,status:p?"completed":"in_progress",updatedAt:u}),f=u;try{await e.onBatch?.({batches:m,changed:g,processed:_})}catch{}}}}catch(d){throw o||S(s,{changed:g,cursor:T,direction:i,error:d instanceof Error?d.message:String(d),id:t.id,processed:_,startedAt:A,status:"failed",updatedAt:a()}),d}if(!o&&!p)try{F(s,t.id)}catch(d){console.warn(`data migration "${t.id}": releaseClaim failed`,d)}return{changed:g,cursor:p?null:T,direction:i,dryRun:o,id:t.id,processed:_,status:p?"completed":"in_progress"}};export{n as DATA_MIGRATION_STATE_TABLE,B as readMigrationStatus,w as runDataMigration};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{stableWireKey as b}from"./stableWireKey-DQUcEqhM.mjs";import{depKey as l,SCAN_DEP as y}from"./SCAN_DEP-D7qE3iUe.mjs";import{e as g}from"./estimate-bytes-CzG5x1f8.mjs";import{keysTouchRanges as p}from"./buildIndexRange-CBKQmHSS.mjs";import{stableStringify as A}from"./stableStringify-DibjylKD.mjs";const h=(o,t,s)=>{let e=o.get(t);return e===void 0&&(e=s(),o.set(t,e)),e},m=1e3,x=4*1024*1024;class w{entries=new Map;tableIndex=new Map;rangeIndex=new Map;totalBytes=0;hits=0;misses=0;evictions=0;maxEntries;maxBytes;now;monotonic=0;constructor(t={}){this.maxEntries=t.maxEntries??m,this.maxBytes=t.maxBytes??x,this.now=t.now??(()=>(this.monotonic+=1,this.monotonic))}async run(t,s,e,i=()=>[]){const n=this.entries.get(t);if(n)return this.hits+=1,n.lastUsed=this.now(),this.entries.delete(t),this.entries.set(t,n),n.result;this.misses+=1;const r=await e(),c=g(r);if(c===void 0)return r;const d=i(),f={bytes:c,deps:s,ranges:d,lastUsed:this.now(),result:r,subscribers:new Set};this.entries.set(t,f),this.totalBytes+=c;for(const a of s)h(this.tableIndex,a,()=>new Set).add(t);for(const a of d){const u=h(this.rangeIndex,a.table,()=>new Map);h(u,a,()=>new Set).add(t)}return this.evict(),r}invalidate(t,s,e){const i=[];return this.collectAndDrop(l(t,s),i),this.collectAndDrop(l(t,y),i),this.dropRangeDeps(t,e,i),i}invalidateTable(t){const s=[],e=`${t}:`;for(const i of this.tableIndex.keys())i.startsWith(e)&&this.collectAndDrop(i,s);return this.dropRangeDeps(t,void 0,s),s}subscribe(t,s){const e=this.entries.get(t);e&&e.subscribers.add(s)}unsubscribe(t,s){const e=this.entries.get(t);e&&e.subscribers.delete(s)}size(){return{bytes:this.totalBytes,entries:this.entries.size}}clear(){this.entries.clear(),this.tableIndex.clear(),this.rangeIndex.clear(),this.totalBytes=0}subscribers(t){const s=this.entries.get(t);return s?[...s.subscribers]:[]}stats(){return{bytes:this.totalBytes,entries:this.entries.size,evictions:this.evictions,hits:this.hits,misses:this.misses}}dropRangeDeps(t,s,e){const i=this.rangeIndex.get(t);if(!(!i||i.size===0))for(const[n,r]of i)p([n],s)&&this.dropKeys(r,e)}collectAndDrop(t,s){const e=this.tableIndex.get(t);e&&this.dropKeys(e,s)}dropKeys(t,s){for(const e of t){const i=this.entries.get(e);i&&(this.dropEntry(e,i),s.push(e))}}dropEntry(t,s){this.entries.delete(t),this.totalBytes-=s.bytes;for(const e of s.deps){const i=this.tableIndex.get(e);i&&(i.delete(t),i.size===0&&this.tableIndex.delete(e))}for(const e of s.ranges){const i=this.rangeIndex.get(e.table),n=i?.get(e);n?.delete(t),i&&n?.size===0&&(i.delete(e),i.size===0&&this.rangeIndex.delete(e.table))}}evict(){if(!(this.entries.size<=this.maxEntries&&this.totalBytes<=this.maxBytes))for(const[t,s]of this.entries){if(this.entries.size<=this.maxEntries&&this.totalBytes<=this.maxBytes)return;s.subscribers.size>0||(this.dropEntry(t,s),this.evictions+=1)}}}const z=(o,t,s)=>`${s??"\0anon"}\0${o}:${b(t)}`;export{w as ReactiveCache,z as reactiveCacheKey,A as stableStringify,b as stableWireKey};
|