@party-stack/runtime 0.4.0 → 0.4.1
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/lib/coordinator/createPersistedCollectionCoordinator.d.ts +4 -2
- package/lib/coordinator/createPersistedCollectionCoordinator.d.ts.map +1 -1
- package/lib/coordinator/createPersistedCollectionCoordinator.js +491 -555
- package/lib/coordinator/createPersistedCollectionCoordinator.js.map +1 -1
- package/lib/coordinator/index.d.ts +2 -2
- package/lib/coordinator/index.js +2 -2
- package/lib/effection/index.d.ts +4 -2
- package/lib/effection/index.d.ts.map +1 -1
- package/lib/effection/index.js +25 -25
- package/lib/effection/index.js.map +1 -1
- package/lib/index.d.ts +11 -11
- package/lib/index.js +10 -9
- package/lib/memory/MemoryBlobBytesStore.d.ts +8 -6
- package/lib/memory/MemoryBlobBytesStore.d.ts.map +1 -1
- package/lib/memory/MemoryBlobBytesStore.js +22 -20
- package/lib/memory/MemoryBlobBytesStore.js.map +1 -1
- package/lib/types.d.ts +31 -29
- package/lib/types.d.ts.map +1 -1
- package/lib/types.js +0 -1
- package/lib/utils/BrowserAuthenticationCancelledError.d.ts +3 -1
- package/lib/utils/BrowserAuthenticationCancelledError.d.ts.map +1 -1
- package/lib/utils/BrowserAuthenticationCancelledError.js +10 -6
- package/lib/utils/BrowserAuthenticationCancelledError.js.map +1 -1
- package/lib/utils/createCollectionPersistence.d.ts +4 -2
- package/lib/utils/createCollectionPersistence.d.ts.map +1 -1
- package/lib/utils/createCollectionPersistence.js +20 -16
- package/lib/utils/createCollectionPersistence.js.map +1 -1
- package/lib/utils/createDefaultRuntime.d.ts +4 -1
- package/lib/utils/createDefaultRuntime.d.ts.map +1 -1
- package/lib/utils/createDefaultRuntime.js +15 -11
- package/lib/utils/createDefaultRuntime.js.map +1 -1
- package/lib/utils/createLocalCollection.d.ts +8 -6
- package/lib/utils/createLocalCollection.d.ts.map +1 -1
- package/lib/utils/createLocalCollection.js +19 -15
- package/lib/utils/createLocalCollection.js.map +1 -1
- package/lib/utils/defineRuntime.d.ts +3 -2
- package/lib/utils/defineRuntime.d.ts.map +1 -1
- package/lib/utils/defineRuntime.js +26 -30
- package/lib/utils/defineRuntime.js.map +1 -1
- package/package.json +8 -14
- package/lib/coordinator/index.d.ts.map +0 -1
- package/lib/coordinator/index.js.map +0 -1
- package/lib/index.d.ts.map +0 -1
- package/lib/index.js.map +0 -1
- package/lib/memory/MemoryBlobBytesStore.test.d.ts +0 -2
- package/lib/memory/MemoryBlobBytesStore.test.d.ts.map +0 -1
- package/lib/memory/MemoryBlobBytesStore.test.js +0 -12
- package/lib/memory/MemoryBlobBytesStore.test.js.map +0 -1
- package/lib/types.js.map +0 -1
- package/lib/utils/createLocalCollection.test.d.ts +0 -2
- package/lib/utils/createLocalCollection.test.d.ts.map +0 -1
- package/lib/utils/createLocalCollection.test.js +0 -748
- package/lib/utils/createLocalCollection.test.js.map +0 -1
- package/lib/utils/defineRuntime.test.d.ts +0 -2
- package/lib/utils/defineRuntime.test.d.ts.map +0 -1
- package/lib/utils/defineRuntime.test.js +0 -40
- package/lib/utils/defineRuntime.test.js.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"createPersistedCollectionCoordinator.js","sourceRoot":"","sources":["../../src/coordinator/createPersistedCollectionCoordinator.ts"],"names":[],"mappings":"AAAA,OAAO,EACH,kBAAkB,GAIrB,MAAM,2BAA2B,CAAC;AACnC,OAAO,EACH,cAAc,EACd,wBAAwB,EACxB,8BAA8B,EAC9B,oCAAoC,GACvC,MAAM,sCAAsC,CAAC;AAiB9C,MAAM,mBAAmB,GAAG,4BAA4B,CAAC;AACzD,MAAM,yBAAyB,GAAG,KAAK,CAAC;AACxC,MAAM,kBAAkB,GAAG,KAAK,CAAC;AACjC,MAAM,wBAAwB,GAAG,GAAG,CAAC;AA0FrC,MAAM,gBAAgB,GAAG,IAAI,OAAO,EAGjC,CAAC;AAEJ,SAAS,QAAQ,CAAC,KAAc;I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AAI,EAAE,mBAAmB;gBACzB,KAAK,EAAE,KAAK,CAAC,KAAK;gBAClB,EAAE,EAAE,IAAI;gBACR,UAAU,EAAE,MAAM,EAAE,UAAU,IAAI,QAAQ,CAAC,IAAI;gBAC/C,SAAS,EAAE,MAAM,EAAE,SAAS,IAAI,QAAQ,CAAC,GAAG;gBAC5C,gBAAgB,EAAE,MAAM,EAAE,gBAAgB,IAAI,QAAQ,CAAC,UAAU;gBACjE,kBAAkB,EAAE,IAAI;aAC3B,CAAC;QACN,CAAC;QACD,OAAO;YACH,IAAI,EAAE,mBAAmB;YACzB,KAAK,EAAE,KAAK,CAAC,KAAK;YAClB,EAAE,EAAE,IAAI;YACR,UAAU,EAAE,MAAM,EAAE,UAAU,IAAI,QAAQ,CAAC,IAAI;YAC/C,SAAS,EAAE,MAAM,EAAE,SAAS,IAAI,QAAQ,CAAC,GAAG;YAC5C,gBAAgB,EAAE,MAAM,CAAC,gBAAgB;YACzC,kBAAkB,EAAE,KAAK;YACzB,WAAW,EAAE,MAAM,CAAC,WAAW;YAC/B,WAAW,EAAE,MAAM,CAAC,WAAW;YAC/B,MAAM,EAAE,MAAM,CAAC,MAAM;SACxB,CAAC;IACN,CAAC;IAEO,iBAAiB;QACrB,OAAO,OAAO,IAAI,IAAI,CAAC,YAAY,IAAI,OAAO,IAAI,CAAC,YAAY,CAAC,KAAK,KAAK,QAAQ;YAC9E,CAAC,CAAC,IAAI,CAAC,YAAY,CAAC,KAAK;YACzB,CAAC,CAAC,aAAa,CAAC;IACxB,CAAC;CACJ"}
|
|
1
|
+
{"version":3,"file":"createPersistedCollectionCoordinator.js","names":[],"sources":["../../src/coordinator/createPersistedCollectionCoordinator.ts"],"sourcesContent":["import {\n isCoordinationHost,\n type Coordination,\n type CoordinationServiceClient,\n type CoordinationServiceServer,\n} from \"@party-stack/coordination\";\nimport {\n safeRandomUUID,\n SingleProcessCoordinator,\n toTransportedLoadSubsetOptions,\n toPersistedCollectionDurabilityError,\n} from \"@tanstack/db-sqlite-persistence-core\";\nimport type { LoadSubsetOptions } from \"@tanstack/db\";\nimport type {\n ApplyLocalMutationsResponse,\n ApplyCommittedTxResponse,\n HydrationPersistenceAdapter,\n PersistedCollectionCoordinator,\n PersistedIndexSpec,\n PersistedMutationEnvelope,\n PersistenceAdapter,\n PersistedTx,\n RemoteSubsetOwner,\n ProtocolEnvelope,\n PullSinceResponse,\n ReplayableTxDelta,\n} from \"@tanstack/db-sqlite-persistence-core\";\n\nconst PERSISTENCE_SERVICE = \"party-stack.persistence.v1\";\nconst MAX_DEDUPLICATION_ENTRIES = 1_000;\nconst MAX_PENDING_RELAYS = 1_000;\nconst MAX_COLLECTION_POSITIONS = 128;\n\ninterface CollectionPosition {\n term: number;\n seq: number;\n rowVersion: number;\n}\n\ninterface EnsureLeadershipInput {\n collectionId: string;\n}\n\ninterface EnsureRemoteSubsetInput {\n collectionId: string;\n options: LoadSubsetOptions;\n acquisitionId: string;\n}\n\ninterface ApplyCommittedTxInput {\n schemaVersion?: number;\n collectionId: string;\n tx: PersistedTx;\n}\n\ninterface EnsurePersistedIndexInput {\n schemaVersion?: number;\n collectionId: string;\n signature: string;\n spec: PersistedIndexSpec;\n}\n\ninterface ApplyLocalMutationsInput {\n schemaVersion?: number;\n collectionId: string;\n rpcId: string;\n envelopeId: string;\n mutations: PersistedMutationEnvelope[];\n}\n\ninterface PullSinceInput {\n schemaVersion?: number;\n collectionId: string;\n rpcId: string;\n fromRowVersion: number;\n}\n\ninterface RelayMessageInput {\n collectionId: string;\n message: ProtocolEnvelope<unknown>;\n}\n\ninterface PersistenceCoordinationService {\n methods: {\n ensureLeadership(input: EnsureLeadershipInput): Promise<void>;\n ensureRemoteSubset(input: EnsureRemoteSubsetInput): Promise<void>;\n releaseRemoteSubset(input: EnsureRemoteSubsetInput): Promise<void>;\n applyCommittedTx(input: ApplyCommittedTxInput): Promise<ApplyCommittedTxResponse>;\n ensurePersistedIndex(input: EnsurePersistedIndexInput): Promise<void>;\n applyLocalMutations(input: ApplyLocalMutationsInput): Promise<ApplyLocalMutationsResponse>;\n pullSince(input: PullSinceInput): Promise<PullSinceResponse>;\n relayMessage(input: RelayMessageInput): Promise<void>;\n };\n events: {\n message: RelayMessageInput;\n };\n}\n\ntype AdapterWithPullSince = PersistenceAdapter & {\n pullSince?: (\n collectionId: string,\n fromRowVersion: number\n ) => Promise<\n | {\n latestRowVersion: number;\n latestTerm?: number;\n latestSeq?: number;\n requiresFullReload: true;\n }\n | {\n latestRowVersion: number;\n latestTerm?: number;\n latestSeq?: number;\n requiresFullReload: false;\n changedKeys: Array<string | number>;\n deletedKeys: Array<string | number>;\n deltas?: Array<ReplayableTxDelta<Record<string, unknown>, string | number>>;\n }\n >;\n};\n\nconst coordinatorCache = new WeakMap<\n Coordination,\n WeakMap<PersistenceAdapter, PersistedCollectionCoordinator>\n>();\n\nfunction isRecord(value: unknown): value is Record<string, unknown> {\n return typeof value === \"object\" && value !== null;\n}\n\nfunction relayKey(collectionId: string, message: ProtocolEnvelope<unknown>): string {\n const payload = isRecord(message.payload) ? message.payload : {};\n return JSON.stringify([\n collectionId,\n message.senderId,\n payload.type,\n payload.txId,\n payload.resetEpoch,\n payload.term,\n payload.seq,\n ]);\n}\n\nexport function createPersistedCollectionCoordinator(\n coordination: Coordination,\n adapter: PersistenceAdapter\n): PersistedCollectionCoordinator {\n let adapters = coordinatorCache.get(coordination);\n if (!adapters) {\n adapters = new WeakMap();\n coordinatorCache.set(coordination, adapters);\n }\n const existing = adapters.get(adapter);\n if (existing) return existing;\n\n const created = new CoordinationPersistenceShim(coordination, adapter);\n adapters.set(adapter, created);\n return created;\n}\n\nclass CoordinationPersistenceShim implements PersistedCollectionCoordinator {\n private readonly nodeId = safeRandomUUID();\n private readonly collectionAdapters = new Map<string, AdapterWithPullSince>();\n private readonly collectionSubscriptions = new Map<string, number>();\n private readonly resumeChecks = new Map<string, Set<(force?: boolean) => Promise<void>>>();\n private readonly localMutationBursts = new Map<\n string,\n {\n pending: Set<string>;\n needsReload: boolean;\n timer?: ReturnType<typeof setTimeout>;\n }\n >();\n private stopResumeListeners: (() => void) | undefined;\n private checkingResume = false;\n private resumeRequested = false;\n\n private requestResumeCheck = (): void => {\n this.resumeRequested = true;\n if (this.checkingResume) return;\n this.checkingResume = true;\n void (async () => {\n try {\n while (this.resumeRequested && this.resumeChecks.size > 0) {\n this.resumeRequested = false;\n await Promise.all(\n [...this.resumeChecks.values()].flatMap((checks) =>\n [...checks].map((check) => check())\n )\n );\n }\n } finally {\n this.checkingResume = false;\n this.resumeRequested = false;\n }\n })();\n };\n\n private startResumeListeners(): void {\n if (this.stopResumeListeners || typeof window === \"undefined\" || typeof document === \"undefined\")\n return;\n const page = window;\n const visibility = document;\n const onVisible = () => {\n if (visibility.visibilityState === \"visible\") this.requestResumeCheck();\n };\n page.addEventListener(\"pageshow\", this.requestResumeCheck);\n page.addEventListener(\"focus\", onVisible);\n visibility.addEventListener(\"visibilitychange\", onVisible);\n this.stopResumeListeners = () => {\n page.removeEventListener(\"pageshow\", this.requestResumeCheck);\n page.removeEventListener(\"focus\", onVisible);\n visibility.removeEventListener(\"visibilitychange\", onVisible);\n };\n }\n\n setAdapterForCollection(collectionId: string, adapter: HydrationPersistenceAdapter): void {\n this.collectionAdapters.set(collectionId, adapter);\n this.positions.delete(collectionId);\n }\n\n private adapterForCollection(collectionId: string, schemaVersion?: number): AdapterWithPullSince {\n const adapter = this.collectionAdapters.get(collectionId) ?? this.adapter;\n if (schemaVersion !== undefined && this.schemaVersion(adapter) !== schemaVersion) {\n throw new Error(\n `Persistence schema mismatch for collection \"${collectionId}\". Reload the coordination host before writing through another schema version.`\n );\n }\n return adapter;\n }\n\n private schemaVersion(adapter: PersistenceAdapter): number | undefined {\n return \"schemaVersion\" in adapter && typeof adapter.schemaVersion === \"number\"\n ? adapter.schemaVersion\n : undefined;\n }\n private readonly positions = new Map<string, Promise<CollectionPosition>>();\n private readonly appliedEnvelopes = new Map<string, Extract<ApplyLocalMutationsResponse, { ok: true }>>();\n private readonly relayedMessages = new Set<string>();\n private readonly service: CoordinationServiceClient<PersistenceCoordinationService>;\n private readonly server: CoordinationServiceServer<PersistenceCoordinationService> | undefined;\n private pendingRelays = 0;\n private readonly remoteSubsets = new SingleProcessCoordinator();\n private readonly acquisitionIds = new WeakMap<LoadSubsetOptions, Map<string, string>>();\n private readonly remoteAcquisitions = new Map<\n string,\n {\n collectionId: string;\n options: LoadSubsetOptions;\n }\n >();\n\n constructor(\n private readonly coordination: Coordination,\n private readonly adapter: AdapterWithPullSince\n ) {\n this.service = coordination.service<PersistenceCoordinationService>(PERSISTENCE_SERVICE);\n this.server = isCoordinationHost(coordination)\n ? coordination.serve<PersistenceCoordinationService>(PERSISTENCE_SERVICE, {\n ensureLeadership: () => Promise.resolve(),\n ensureRemoteSubset: async (input) => {\n let options = this.remoteAcquisitions.get(input.acquisitionId)?.options;\n if (!options) {\n options = input.options;\n this.remoteAcquisitions.set(input.acquisitionId, {\n collectionId: input.collectionId,\n options,\n });\n }\n try {\n await this.remoteSubsets.requestEnsureRemoteSubset(input.collectionId, options);\n } catch (error) {\n // Owner invocation transfers a lease even if loading fails.\n // Release it before dropping our strong reference to its options.\n if (this.remoteAcquisitions.get(input.acquisitionId)?.options === options) {\n this.remoteAcquisitions.delete(input.acquisitionId);\n await this.remoteSubsets\n .requestReleaseRemoteSubset(input.collectionId, options)\n .catch(() => undefined);\n }\n throw error;\n }\n },\n releaseRemoteSubset: (input) => {\n const options = this.remoteAcquisitions.get(input.acquisitionId)?.options;\n this.remoteAcquisitions.delete(input.acquisitionId);\n return options\n ? this.remoteSubsets.requestReleaseRemoteSubset(input.collectionId, options)\n : Promise.resolve();\n },\n applyCommittedTx: (input) => this.applyCommittedTx(input),\n ensurePersistedIndex: (input) =>\n this.adapterForCollection(input.collectionId, input.schemaVersion).ensureIndex(\n input.collectionId,\n input.signature,\n input.spec\n ),\n applyLocalMutations: (input) => this.applyMutations(input),\n pullSince: (input) => this.handlePullSince(input),\n relayMessage: (input) => this.relayMessage(input),\n })\n : undefined;\n }\n\n getNodeId(): string {\n return this.nodeId;\n }\n\n subscribe(collectionId: string, callback: (message: ProtocolEnvelope<unknown>) => void): () => void {\n let active = true;\n let observed: { latestTerm: number; latestSeq: number; latestRowVersion: number } | undefined;\n const unsubscribe = this.service.events.subscribe(\"message\", (event) => {\n if (!active) return;\n if (event.collectionId === collectionId) {\n const payload = event.message.payload;\n const burst = this.localMutationBursts.get(collectionId);\n if (\n burst &&\n isRecord(payload) &&\n payload.type === \"tx:committed\" &&\n typeof payload.txId === \"string\" &&\n !burst.pending.has(payload.txId)\n ) {\n burst.needsReload = true;\n }\n if (\n isRecord(payload) &&\n payload.type === \"tx:committed\" &&\n typeof payload.term === \"number\" &&\n typeof payload.seq === \"number\" &&\n typeof payload.latestRowVersion === \"number\" &&\n (!observed ||\n payload.term > observed.latestTerm ||\n (payload.term === observed.latestTerm && payload.seq > observed.latestSeq))\n ) {\n observed = {\n latestTerm: payload.term,\n latestSeq: payload.seq,\n latestRowVersion: payload.latestRowVersion,\n };\n }\n callback(event.message);\n }\n });\n const checkResume = async (force = false) => {\n try {\n if (!active) return;\n const adapter = this.adapterForCollection(collectionId);\n const current = await adapter.getStreamPosition?.(collectionId);\n if (!active) return;\n if (\n !force &&\n current &&\n observed &&\n current.latestTerm === observed.latestTerm &&\n current.latestSeq === observed.latestSeq &&\n current.latestRowVersion === observed.latestRowVersion\n )\n return;\n // A local reset notification makes upstream reload active subsets atomically.\n // No storage reset or broadcast is performed. Before our first notification,\n // the hydration position is unknown, so a resume conservatively reloads once.\n callback({\n v: 1,\n dbName: this.coordinationScope(),\n collectionId,\n senderId: `resume:${this.nodeId}`,\n ts: Date.now(),\n payload: {\n type: \"collection:reset\",\n schemaVersion: this.schemaVersion(adapter) ?? 1,\n resetEpoch: 0,\n },\n });\n observed = current;\n } catch (error) {\n if (active) console.warn(`Failed to refresh resumed collection \"${collectionId}\".`, error);\n }\n };\n const checks = this.resumeChecks.get(collectionId) ?? new Set();\n checks.add(checkResume);\n this.resumeChecks.set(collectionId, checks);\n this.startResumeListeners();\n this.collectionSubscriptions.set(\n collectionId,\n (this.collectionSubscriptions.get(collectionId) ?? 0) + 1\n );\n return () => {\n if (!active) return;\n active = false;\n checks.delete(checkResume);\n if (checks.size === 0) {\n this.resumeChecks.delete(collectionId);\n const burst = this.localMutationBursts.get(collectionId);\n if (burst?.timer !== undefined) clearTimeout(burst.timer);\n this.localMutationBursts.delete(collectionId);\n }\n if (this.resumeChecks.size === 0) {\n this.stopResumeListeners?.();\n this.stopResumeListeners = undefined;\n }\n try {\n unsubscribe();\n } finally {\n const remaining = this.collectionSubscriptions.get(collectionId)! - 1;\n if (remaining > 0) {\n this.collectionSubscriptions.set(collectionId, remaining);\n } else {\n this.collectionSubscriptions.delete(collectionId);\n this.collectionAdapters.delete(collectionId);\n this.positions.delete(collectionId);\n }\n }\n };\n }\n\n publish(collectionId: string, message: ProtocolEnvelope<unknown>): void {\n if (this.server && isCoordinationHost(this.coordination) && this.coordination.isLeader) {\n this.publishMessage({\n collectionId,\n message,\n });\n return;\n }\n if (this.pendingRelays >= MAX_PENDING_RELAYS) {\n console.warn(\n `Dropping persistence relay for \"${collectionId}\" because the pending relay limit was reached.`\n );\n return;\n }\n this.pendingRelays += 1;\n void this.service.methods\n .relayMessage({\n collectionId,\n message,\n })\n .catch((error: unknown) => {\n console.warn(`Failed to relay persistence message for \"${collectionId}\".`, error);\n })\n .finally(() => {\n this.pendingRelays -= 1;\n });\n }\n\n isLeader(): boolean {\n return isCoordinationHost(this.coordination) && this.coordination.isLeader;\n }\n\n ensureLeadership(): Promise<void> {\n return this.service.methods.ensureLeadership({\n collectionId: \"*\",\n });\n }\n\n requestEnsureRemoteSubset(collectionId: string, options: LoadSubsetOptions): Promise<void> {\n let collectionIds = this.acquisitionIds.get(options);\n if (!collectionIds) {\n collectionIds = new Map();\n this.acquisitionIds.set(options, collectionIds);\n }\n let acquisitionId = collectionIds.get(collectionId);\n if (!acquisitionId) {\n acquisitionId = safeRandomUUID();\n collectionIds.set(collectionId, acquisitionId);\n }\n return this.service.methods.ensureRemoteSubset({\n collectionId,\n options: toTransportedLoadSubsetOptions(options) as LoadSubsetOptions,\n acquisitionId,\n });\n }\n\n requestReleaseRemoteSubset(collectionId: string, options: LoadSubsetOptions): Promise<void> {\n const collectionIds = this.acquisitionIds.get(options);\n const acquisitionId = collectionIds?.get(collectionId);\n if (!acquisitionId) return Promise.resolve();\n collectionIds!.delete(collectionId);\n if (collectionIds!.size === 0) this.acquisitionIds.delete(options);\n return this.service.methods.releaseRemoteSubset({ collectionId, options: {}, acquisitionId });\n }\n\n registerRemoteSubsetOwner(collectionId: string, owner: RemoteSubsetOwner): () => void {\n const unregister = this.remoteSubsets.registerRemoteSubsetOwner(collectionId, owner);\n let registered = true;\n return () => {\n if (!registered) return;\n registered = false;\n unregister();\n for (const [id, acquisition] of this.remoteAcquisitions) {\n if (acquisition.collectionId === collectionId) this.remoteAcquisitions.delete(id);\n }\n };\n }\n\n requestApplyCommittedTx(\n collectionId: string,\n tx: PersistedTx,\n scopedAdapter?: HydrationPersistenceAdapter\n ): Promise<ApplyCommittedTxResponse> {\n return this.isLeader()\n ? this.applyCommittedTx({ collectionId, tx }, scopedAdapter)\n : this.service.methods.applyCommittedTx({\n collectionId,\n tx,\n schemaVersion:\n this.schemaVersion(scopedAdapter ?? this.adapterForCollection(collectionId)) ??\n this.schemaVersion(this.adapterForCollection(collectionId)),\n });\n }\n\n private async applyCommittedTx(\n { collectionId, tx, schemaVersion }: ApplyCommittedTxInput,\n scopedAdapter?: HydrationPersistenceAdapter\n ): Promise<ApplyCommittedTxResponse> {\n try {\n await (scopedAdapter ?? this.adapterForCollection(collectionId, schemaVersion)).applyCommittedTx(\n collectionId,\n tx\n );\n } catch (error) {\n throw toPersistedCollectionDurabilityError(collectionId, error);\n }\n this.positions.delete(collectionId);\n return {\n type: \"rpc:applyCommittedTx:res\",\n rpcId: safeRandomUUID(),\n ok: true,\n term: tx.term,\n seq: tx.seq,\n latestRowVersion: tx.rowVersion,\n };\n }\n\n requestEnsurePersistedIndex(\n collectionId: string,\n signature: string,\n spec: PersistedIndexSpec,\n scopedAdapter?: HydrationPersistenceAdapter,\n localEnsureCompleted?: boolean\n ): Promise<void> {\n if (this.isLeader()) {\n return localEnsureCompleted\n ? Promise.resolve()\n : (scopedAdapter ?? this.adapterForCollection(collectionId)).ensureIndex(\n collectionId,\n signature,\n spec\n );\n }\n return this.service.methods.ensurePersistedIndex({\n collectionId,\n signature,\n spec,\n schemaVersion:\n this.schemaVersion(scopedAdapter ?? this.adapterForCollection(collectionId)) ??\n this.schemaVersion(this.adapterForCollection(collectionId)),\n });\n }\n\n async requestApplyLocalMutations(\n collectionId: string,\n mutations: PersistedMutationEnvelope[]\n ): Promise<ApplyLocalMutationsResponse> {\n const envelopeId = safeRandomUUID();\n const burst = this.resumeChecks.has(collectionId)\n ? (this.localMutationBursts.get(collectionId) ?? {\n pending: new Set<string>(),\n needsReload: false,\n timer: undefined,\n })\n : undefined;\n if (burst) {\n if (burst.timer !== undefined) clearTimeout(burst.timer);\n if (burst.pending.size > 0) burst.needsReload = true;\n burst.pending.add(envelopeId);\n this.localMutationBursts.set(collectionId, burst);\n }\n try {\n return await this.service.methods.applyLocalMutations({\n collectionId,\n rpcId: safeRandomUUID(),\n envelopeId,\n schemaVersion: this.schemaVersion(this.adapterForCollection(collectionId)),\n mutations,\n });\n } finally {\n burst?.pending.delete(envelopeId);\n if (burst && burst.pending.size === 0 && this.localMutationBursts.get(collectionId) === burst) {\n // Upstream advances its observed sequence from local RPC acknowledgements\n // before queued commit messages can run. Reconcile overlapping foreign\n // commits after the local mutation burst, without changing RPC positions.\n burst.timer = setTimeout(() => {\n if (this.localMutationBursts.get(collectionId) !== burst) return;\n this.localMutationBursts.delete(collectionId);\n if (burst.needsReload) {\n for (const check of this.resumeChecks.get(collectionId) ?? []) void check(true);\n }\n }, 0);\n }\n }\n }\n\n pullSince(collectionId: string, fromRowVersion: number): Promise<PullSinceResponse> {\n return this.service.methods.pullSince({\n collectionId,\n rpcId: safeRandomUUID(),\n fromRowVersion,\n schemaVersion: this.schemaVersion(this.adapterForCollection(collectionId)),\n });\n }\n\n private relayMessage(input: RelayMessageInput): Promise<void> {\n const key = relayKey(input.collectionId, input.message);\n if (this.relayedMessages.has(key)) {\n return Promise.resolve();\n }\n this.relayedMessages.add(key);\n if (this.relayedMessages.size > MAX_DEDUPLICATION_ENTRIES) {\n const oldest = this.relayedMessages.values().next().value;\n if (oldest) {\n this.relayedMessages.delete(oldest);\n }\n }\n this.publishMessage(input);\n return Promise.resolve();\n }\n\n private publishMessage(input: RelayMessageInput): void {\n this.server?.events.publish(\"message\", input);\n }\n\n private async position(collectionId: string): Promise<CollectionPosition> {\n let position = this.positions.get(collectionId);\n if (!position) {\n const adapter = this.adapterForCollection(collectionId);\n position = Promise.resolve(\n adapter.getStreamPosition\n ? adapter.getStreamPosition(collectionId)\n : adapter.loadResumeSnapshot(collectionId, { includeRows: false })\n ).then((current) => ({\n term: (current?.latestTerm ?? 0) + 1,\n seq: current?.latestSeq ?? 0,\n rowVersion: current?.latestRowVersion ?? 0,\n }));\n }\n this.positions.delete(collectionId);\n this.positions.set(collectionId, position);\n while (this.positions.size > MAX_COLLECTION_POSITIONS) {\n const oldest = this.positions.keys().next().value;\n if (oldest !== undefined) this.positions.delete(oldest);\n }\n void position.catch(() => {\n if (this.positions.get(collectionId) === position) this.positions.delete(collectionId);\n });\n return position;\n }\n\n private async applyMutations(input: ApplyLocalMutationsInput): Promise<ApplyLocalMutationsResponse> {\n const adapter = this.adapterForCollection(input.collectionId, input.schemaVersion);\n const envelopeKey = JSON.stringify([input.collectionId, input.envelopeId]);\n const previous = this.appliedEnvelopes.get(envelopeKey);\n if (previous) {\n return {\n ...previous,\n rpcId: input.rpcId,\n };\n }\n\n const position = await this.position(input.collectionId);\n const nextPosition = { ...position, seq: position.seq + 1, rowVersion: position.rowVersion + 1 };\n const txId = input.envelopeId;\n await adapter.applyCommittedTx(input.collectionId, {\n txId,\n term: nextPosition.term,\n seq: nextPosition.seq,\n rowVersion: nextPosition.rowVersion,\n mutations: input.mutations.map(({ mutationId, ...mutation }) => {\n void mutationId;\n return mutation;\n }),\n });\n Object.assign(position, nextPosition);\n const committed: ProtocolEnvelope<unknown> = {\n v: 1,\n dbName: this.coordinationScope(),\n collectionId: input.collectionId,\n senderId: this.nodeId,\n ts: Date.now(),\n payload: {\n type: \"tx:committed\",\n term: position.term,\n seq: position.seq,\n txId,\n latestRowVersion: position.rowVersion,\n requiresFullReload: false,\n changedRows: input.mutations\n .filter((mutation) => mutation.type !== \"delete\")\n .map((mutation) => ({\n key: mutation.key,\n value: mutation.value,\n })),\n deletedKeys: input.mutations\n .filter((mutation) => mutation.type === \"delete\")\n .map((mutation) => mutation.key),\n rowMetadataMutations: input.mutations.flatMap((mutation) =>\n mutation.type !== \"delete\" &&\n (mutation.metadataChanged || mutation.metadata !== undefined)\n ? [\n mutation.metadata === undefined\n ? { type: \"delete\" as const, key: mutation.key }\n : { type: \"set\" as const, key: mutation.key, value: mutation.metadata },\n ]\n : []\n ),\n },\n };\n this.publishMessage({\n collectionId: input.collectionId,\n message: committed,\n });\n\n const response: Extract<ApplyLocalMutationsResponse, { ok: true }> = {\n type: \"rpc:applyLocalMutations:res\",\n rpcId: input.rpcId,\n ok: true,\n term: position.term,\n seq: position.seq,\n latestRowVersion: position.rowVersion,\n acceptedMutationIds: input.mutations.map((mutation) => mutation.mutationId),\n };\n this.appliedEnvelopes.set(envelopeKey, response);\n if (this.appliedEnvelopes.size > MAX_DEDUPLICATION_ENTRIES) {\n const oldest = this.appliedEnvelopes.keys().next().value;\n if (oldest) {\n this.appliedEnvelopes.delete(oldest);\n }\n }\n return response;\n }\n\n private async handlePullSince(input: PullSinceInput): Promise<PullSinceResponse> {\n const adapter = this.adapterForCollection(input.collectionId, input.schemaVersion);\n const current = await adapter.getStreamPosition?.(input.collectionId);\n const position = current\n ? { term: current.latestTerm, seq: current.latestSeq, rowVersion: current.latestRowVersion }\n : await this.position(input.collectionId);\n const result = await adapter.pullSince?.(input.collectionId, input.fromRowVersion);\n if (!result || result.requiresFullReload) {\n return {\n type: \"rpc:pullSince:res\",\n rpcId: input.rpcId,\n ok: true,\n latestTerm: result?.latestTerm ?? position.term,\n latestSeq: result?.latestSeq ?? position.seq,\n latestRowVersion: result?.latestRowVersion ?? position.rowVersion,\n requiresFullReload: true,\n };\n }\n return {\n type: \"rpc:pullSince:res\",\n rpcId: input.rpcId,\n ok: true,\n latestTerm: result?.latestTerm ?? position.term,\n latestSeq: result?.latestSeq ?? position.seq,\n latestRowVersion: result.latestRowVersion,\n requiresFullReload: false,\n changedKeys: result.changedKeys,\n deletedKeys: result.deletedKeys,\n deltas: result.deltas,\n };\n }\n\n private coordinationScope(): string {\n return \"scope\" in this.coordination && typeof this.coordination.scope === \"string\"\n ? this.coordination.scope\n : \"party-stack\";\n }\n}\n"],"mappings":";;;AA4BA,MAAM,sBAAsB;AAC5B,MAAM,4BAA4B;AAClC,MAAM,qBAAqB;AAC3B,MAAM,2BAA2B;AA0FjC,MAAM,mCAAmB,IAAI,QAG3B;AAEF,SAAS,SAAS,OAAkD;CAChE,OAAO,OAAO,UAAU,YAAY,UAAU;AAClD;AAEA,SAAS,SAAS,cAAsB,SAA4C;CAChF,MAAM,UAAU,SAAS,QAAQ,OAAO,IAAI,QAAQ,UAAU,CAAC;CAC/D,OAAO,KAAK,UAAU;EAClB;EACA,QAAQ;EACR,QAAQ;EACR,QAAQ;EACR,QAAQ;EACR,QAAQ;EACR,QAAQ;CACZ,CAAC;AACL;AAEA,SAAgB,qCACZ,cACA,SAC8B;CAC9B,IAAI,WAAW,iBAAiB,IAAI,YAAY;CAChD,IAAI,CAAC,UAAU;EACX,2BAAW,IAAI,QAAQ;EACvB,iBAAiB,IAAI,cAAc,QAAQ;CAC/C;CACA,MAAM,WAAW,SAAS,IAAI,OAAO;CACrC,IAAI,UAAU,OAAO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AO;GACzB,oBAAoB;GACpB,aAAa,OAAO;GACpB,aAAa,OAAO;GACpB,QAAQ,OAAO;EACnB;CACJ;CAEA,oBAAoC;EAChC,OAAO,WAAW,KAAK,gBAAgB,OAAO,KAAK,aAAa,UAAU,WACpE,KAAK,aAAa,QAClB;CACV;AACJ"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
import { createPersistedCollectionCoordinator } from "./createPersistedCollectionCoordinator.js";
|
|
2
|
+
export { createPersistedCollectionCoordinator };
|
package/lib/coordinator/index.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
import { createPersistedCollectionCoordinator } from "./createPersistedCollectionCoordinator.js";
|
|
2
|
+
export { createPersistedCollectionCoordinator };
|
package/lib/effection/index.d.ts
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import
|
|
1
|
+
import { RuntimeAdapter, RuntimeAdapterProvider } from "../types.js";
|
|
2
|
+
import { Operation, Stream } from "effection";
|
|
3
|
+
//#region src/effection/index.d.ts
|
|
3
4
|
export declare function useRuntimeAdapter(provider: RuntimeAdapter | RuntimeAdapterProvider, owner: string, namespace: string): Operation<RuntimeAdapter>;
|
|
4
5
|
export declare function useConnectivityChanges(runtime: RuntimeAdapter): Operation<Stream<boolean, void>>;
|
|
6
|
+
//#endregion
|
|
5
7
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","
|
|
1
|
+
{"version":3,"file":"index.d.ts","names":[],"sources":["../../src/effection/index.ts"],"mappings":";;;wBAGgB,kBACZ,UAAU,iBAAiB,wBAC3B,eACA,oBACD,UAAU;wBAcG,uBAAuB,SAAS,iBAAiB,UAAU"}
|
package/lib/effection/index.js
CHANGED
|
@@ -1,28 +1,28 @@
|
|
|
1
|
-
import { createSignal, resource, until
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
}
|
|
13
|
-
});
|
|
1
|
+
import { createSignal, resource, until } from "effection";
|
|
2
|
+
//#region src/effection/index.ts
|
|
3
|
+
function useRuntimeAdapter(provider, owner, namespace) {
|
|
4
|
+
return resource(function* (provide) {
|
|
5
|
+
const runtime = typeof provider === "function" ? yield* until(Promise.resolve(provider(owner, namespace))) : provider;
|
|
6
|
+
try {
|
|
7
|
+
yield* provide(runtime);
|
|
8
|
+
} finally {
|
|
9
|
+
yield* until(Promise.resolve(runtime.cleanup?.()));
|
|
10
|
+
}
|
|
11
|
+
});
|
|
14
12
|
}
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
});
|
|
13
|
+
function useConnectivityChanges(runtime) {
|
|
14
|
+
return resource(function* (provide) {
|
|
15
|
+
const signal = createSignal();
|
|
16
|
+
const unsubscribe = runtime.connectivity?.subscribe((isConnected) => signal.send(isConnected));
|
|
17
|
+
try {
|
|
18
|
+
yield* provide(signal);
|
|
19
|
+
} finally {
|
|
20
|
+
unsubscribe?.();
|
|
21
|
+
signal.close();
|
|
22
|
+
}
|
|
23
|
+
});
|
|
27
24
|
}
|
|
25
|
+
//#endregion
|
|
26
|
+
export { useConnectivityChanges, useRuntimeAdapter };
|
|
27
|
+
|
|
28
28
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","
|
|
1
|
+
{"version":3,"file":"index.js","names":[],"sources":["../../src/effection/index.ts"],"sourcesContent":["import { createSignal, resource, until, type Operation, type Stream } from \"effection\";\nimport type { RuntimeAdapter, RuntimeAdapterProvider } from \"../types.js\";\n\nexport function useRuntimeAdapter(\n provider: RuntimeAdapter | RuntimeAdapterProvider,\n owner: string,\n namespace: string\n): Operation<RuntimeAdapter> {\n return resource(function* (provide) {\n const runtime =\n typeof provider === \"function\"\n ? yield* until(Promise.resolve(provider(owner, namespace)))\n : provider;\n try {\n yield* provide(runtime);\n } finally {\n yield* until(Promise.resolve(runtime.cleanup?.()));\n }\n });\n}\n\nexport function useConnectivityChanges(runtime: RuntimeAdapter): Operation<Stream<boolean, void>> {\n return resource(function* (provide) {\n const signal = createSignal<boolean, void>();\n const unsubscribe = runtime.connectivity?.subscribe((isConnected) => signal.send(isConnected));\n try {\n yield* provide(signal);\n } finally {\n unsubscribe?.();\n signal.close();\n }\n });\n}\n"],"mappings":";;AAGA,SAAgB,kBACZ,UACA,OACA,WACyB;CACzB,OAAO,SAAS,WAAW,SAAS;EAChC,MAAM,UACF,OAAO,aAAa,aACd,OAAO,MAAM,QAAQ,QAAQ,SAAS,OAAO,SAAS,CAAC,CAAC,IACxD;EACV,IAAI;GACA,OAAO,QAAQ,OAAO;EAC1B,UAAU;GACN,OAAO,MAAM,QAAQ,QAAQ,QAAQ,UAAU,CAAC,CAAC;EACrD;CACJ,CAAC;AACL;AAEA,SAAgB,uBAAuB,SAA2D;CAC9F,OAAO,SAAS,WAAW,SAAS;EAChC,MAAM,SAAS,aAA4B;EAC3C,MAAM,cAAc,QAAQ,cAAc,WAAW,gBAAgB,OAAO,KAAK,WAAW,CAAC;EAC7F,IAAI;GACA,OAAO,QAAQ,MAAM;EACzB,UAAU;GACN,cAAc;GACd,OAAO,MAAM;EACjB;CACJ,CAAC;AACL"}
|
package/lib/index.d.ts
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
1
|
+
import { createPersistedCollectionCoordinator } from "./coordinator/createPersistedCollectionCoordinator.js";
|
|
2
|
+
import "./coordinator/index.js";
|
|
3
|
+
import { BlobBytesStore, BrowserAuthentication, BrowserAuthenticationPresentation, BrowserAuthenticationSession, NetworkConnectivity, PersistenceAdapter, RuntimeAdapter, RuntimeAdapterProvider, SecretStore } from "./types.js";
|
|
4
|
+
import { createDefaultRuntime } from "./utils/createDefaultRuntime.js";
|
|
5
|
+
import { defineRuntime } from "./utils/defineRuntime.js";
|
|
6
|
+
import { createCollectionPersistence } from "./utils/createCollectionPersistence.js";
|
|
7
|
+
import { createLocalCollection } from "./utils/createLocalCollection.js";
|
|
8
|
+
import { MemoryBlobBytesStore } from "./memory/MemoryBlobBytesStore.js";
|
|
9
|
+
import { BrowserAuthenticationCancelledError } from "./utils/BrowserAuthenticationCancelledError.js";
|
|
10
|
+
import { Coordination, CoordinationCallOptions, CoordinationClient, CoordinationClosedError, CoordinationError, CoordinationErrorCode, CoordinationHost, CoordinationMethodInput, CoordinationMethodResult, CoordinationOptions, CoordinationProtocolError, CoordinationService, CoordinationServiceClient, CoordinationServiceError, CoordinationServiceEvents, CoordinationServiceHandler, CoordinationServiceHandlers, CoordinationServiceMethods, CoordinationServicePublisher, CoordinationServiceServer, CoordinationTaskContext, CoordinationTaskRejectedError, CoordinationTransportError, LockBroadcastCoordination, LockBroadcastCoordinationOptions, SingleProcessCoordination, isCoordinationHost } from "@party-stack/coordination";
|
|
11
|
+
export { type BlobBytesStore, type BrowserAuthentication, BrowserAuthenticationCancelledError, type BrowserAuthenticationPresentation, type BrowserAuthenticationSession, type Coordination, type CoordinationCallOptions, type CoordinationClient, CoordinationClosedError, CoordinationError, type CoordinationErrorCode, type CoordinationHost, type CoordinationMethodInput, type CoordinationMethodResult, type CoordinationOptions, CoordinationProtocolError, type CoordinationService, type CoordinationServiceClient, CoordinationServiceError, type CoordinationServiceEvents, type CoordinationServiceHandler, type CoordinationServiceHandlers, type CoordinationServiceMethods, type CoordinationServicePublisher, type CoordinationServiceServer, type CoordinationTaskContext, CoordinationTaskRejectedError, CoordinationTransportError, LockBroadcastCoordination, type LockBroadcastCoordinationOptions, MemoryBlobBytesStore, type NetworkConnectivity, type PersistenceAdapter, type RuntimeAdapter, type RuntimeAdapterProvider, type SecretStore, SingleProcessCoordination, createCollectionPersistence, createDefaultRuntime, createLocalCollection, createPersistedCollectionCoordinator, defineRuntime, isCoordinationHost };
|
package/lib/index.js
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
1
|
+
import { createPersistedCollectionCoordinator } from "./coordinator/createPersistedCollectionCoordinator.js";
|
|
2
|
+
import "./coordinator/index.js";
|
|
3
|
+
import { MemoryBlobBytesStore } from "./memory/MemoryBlobBytesStore.js";
|
|
4
|
+
import { defineRuntime } from "./utils/defineRuntime.js";
|
|
5
|
+
import { createDefaultRuntime } from "./utils/createDefaultRuntime.js";
|
|
6
|
+
import { createCollectionPersistence } from "./utils/createCollectionPersistence.js";
|
|
7
|
+
import { createLocalCollection } from "./utils/createLocalCollection.js";
|
|
8
|
+
import { BrowserAuthenticationCancelledError } from "./utils/BrowserAuthenticationCancelledError.js";
|
|
9
|
+
import { CoordinationClosedError, CoordinationError, CoordinationProtocolError, CoordinationServiceError, CoordinationTaskRejectedError, CoordinationTransportError, LockBroadcastCoordination, SingleProcessCoordination, isCoordinationHost } from "@party-stack/coordination";
|
|
10
|
+
export { BrowserAuthenticationCancelledError, CoordinationClosedError, CoordinationError, CoordinationProtocolError, CoordinationServiceError, CoordinationTaskRejectedError, CoordinationTransportError, LockBroadcastCoordination, MemoryBlobBytesStore, SingleProcessCoordination, createCollectionPersistence, createDefaultRuntime, createLocalCollection, createPersistedCollectionCoordinator, defineRuntime, isCoordinationHost };
|
|
@@ -1,9 +1,11 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { BlobBytesStore } from "../types.js";
|
|
2
|
+
//#region src/memory/MemoryBlobBytesStore.d.ts
|
|
2
3
|
export declare class MemoryBlobBytesStore implements BlobBytesStore {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
4
|
+
readonly blobs: Map<string, Blob>;
|
|
5
|
+
constructor(blobs?: Map<string, Blob>);
|
|
6
|
+
write(id: string, blob: Blob): Promise<void>;
|
|
7
|
+
read(id: string): Promise<Blob>;
|
|
8
|
+
delete(id: string): Promise<void>;
|
|
8
9
|
}
|
|
10
|
+
//#endregion
|
|
9
11
|
//# sourceMappingURL=MemoryBlobBytesStore.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MemoryBlobBytesStore.d.ts","
|
|
1
|
+
{"version":3,"file":"MemoryBlobBytesStore.d.ts","names":[],"sources":["../../src/memory/MemoryBlobBytesStore.ts"],"mappings":";;qBAEa,gCAAgC;WACpB,OAAK,YAAA;EAA1B,YAAqB,QAAK,YAAA;EAE1B,MAAM,YAAY,MAAM,OAAO;EAK/B,KAAK,aAAa,QAAQ;EAK1B,OAAO,aAAa"}
|
|
@@ -1,21 +1,23 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
1
|
+
//#region src/memory/MemoryBlobBytesStore.ts
|
|
2
|
+
var MemoryBlobBytesStore = class {
|
|
3
|
+
blobs;
|
|
4
|
+
constructor(blobs = /* @__PURE__ */ new Map()) {
|
|
5
|
+
this.blobs = blobs;
|
|
6
|
+
}
|
|
7
|
+
write(id, blob) {
|
|
8
|
+
this.blobs.set(id, blob);
|
|
9
|
+
return Promise.resolve();
|
|
10
|
+
}
|
|
11
|
+
read(id) {
|
|
12
|
+
const blob = this.blobs.get(id);
|
|
13
|
+
return blob ? Promise.resolve(blob) : Promise.reject(/* @__PURE__ */ new Error(`Blob bytes not found for "${id}".`));
|
|
14
|
+
}
|
|
15
|
+
delete(id) {
|
|
16
|
+
this.blobs.delete(id);
|
|
17
|
+
return Promise.resolve();
|
|
18
|
+
}
|
|
19
|
+
};
|
|
20
|
+
//#endregion
|
|
21
|
+
export { MemoryBlobBytesStore };
|
|
22
|
+
|
|
21
23
|
//# sourceMappingURL=MemoryBlobBytesStore.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MemoryBlobBytesStore.js","
|
|
1
|
+
{"version":3,"file":"MemoryBlobBytesStore.js","names":[],"sources":["../../src/memory/MemoryBlobBytesStore.ts"],"sourcesContent":["import type { BlobBytesStore } from \"../types.js\";\n\nexport class MemoryBlobBytesStore implements BlobBytesStore {\n constructor(readonly blobs = new Map<string, Blob>()) {}\n\n write(id: string, blob: Blob): Promise<void> {\n this.blobs.set(id, blob);\n return Promise.resolve();\n }\n\n read(id: string): Promise<Blob> {\n const blob = this.blobs.get(id);\n return blob ? Promise.resolve(blob) : Promise.reject(new Error(`Blob bytes not found for \"${id}\".`));\n }\n\n delete(id: string): Promise<void> {\n this.blobs.delete(id);\n return Promise.resolve();\n }\n}\n"],"mappings":";AAEA,IAAa,uBAAb,MAA4D;CACnC;CAArB,YAAY,wBAAiB,IAAI,IAAkB,GAAG;EAAjC,KAAA,QAAA;CAAkC;CAEvD,MAAM,IAAY,MAA2B;EACzC,KAAK,MAAM,IAAI,IAAI,IAAI;EACvB,OAAO,QAAQ,QAAQ;CAC3B;CAEA,KAAK,IAA2B;EAC5B,MAAM,OAAO,KAAK,MAAM,IAAI,EAAE;EAC9B,OAAO,OAAO,QAAQ,QAAQ,IAAI,IAAI,QAAQ,uBAAO,IAAI,MAAM,6BAA6B,GAAG,GAAG,CAAC;CACvG;CAEA,OAAO,IAA2B;EAC9B,KAAK,MAAM,OAAO,EAAE;EACpB,OAAO,QAAQ,QAAQ;CAC3B;AACJ"}
|
package/lib/types.d.ts
CHANGED
|
@@ -1,44 +1,46 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
1
|
+
import { Coordination } from "@party-stack/coordination";
|
|
2
|
+
import { PersistedCollectionPersistence, PersistenceAdapter } from "@tanstack/db-sqlite-persistence-core";
|
|
3
|
+
//#region src/types.d.ts
|
|
3
4
|
export interface BlobBytesStore {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
5
|
+
write(id: string, blob: Blob): Promise<void>;
|
|
6
|
+
read(id: string): Promise<Blob>;
|
|
7
|
+
delete(id: string): Promise<void>;
|
|
7
8
|
}
|
|
8
9
|
export interface NetworkConnectivity {
|
|
9
|
-
|
|
10
|
-
|
|
10
|
+
readonly isConnected: boolean;
|
|
11
|
+
subscribe(callback: (isConnected: boolean) => void): () => void;
|
|
11
12
|
}
|
|
12
13
|
export interface SecretStore {
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
14
|
+
get(key: string): Promise<string | undefined>;
|
|
15
|
+
set(key: string, value: string): Promise<void>;
|
|
16
|
+
delete(key: string): Promise<void>;
|
|
16
17
|
}
|
|
17
18
|
export type BrowserAuthenticationPresentation = "popup" | "redirect";
|
|
18
19
|
export interface BrowserAuthenticationSession {
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
20
|
+
open(authorizationUrl: string): Promise<{
|
|
21
|
+
callbackUrl: string;
|
|
22
|
+
}>;
|
|
23
|
+
close(): void | Promise<void>;
|
|
23
24
|
}
|
|
24
25
|
export interface BrowserAuthentication {
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
26
|
+
start(options: {
|
|
27
|
+
redirectUrl: string;
|
|
28
|
+
presentation?: BrowserAuthenticationPresentation;
|
|
29
|
+
}): BrowserAuthenticationSession;
|
|
29
30
|
}
|
|
30
|
-
export type { PersistenceAdapter } from "@tanstack/db-sqlite-persistence-core";
|
|
31
31
|
export interface RuntimeAdapter {
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
32
|
+
readonly owner: string;
|
|
33
|
+
readonly namespace: string;
|
|
34
|
+
blobBytes: BlobBytesStore;
|
|
35
|
+
coordination: Coordination;
|
|
36
|
+
connectivity?: NetworkConnectivity;
|
|
37
|
+
browserAuthentication?: BrowserAuthentication;
|
|
38
|
+
secrets?: SecretStore;
|
|
39
|
+
persistence?: PersistedCollectionPersistence;
|
|
40
|
+
cleanup?: () => void | Promise<void>;
|
|
41
|
+
destroy?: () => void | Promise<void>;
|
|
42
42
|
}
|
|
43
43
|
export type RuntimeAdapterProvider = (owner: string, namespace: string) => RuntimeAdapter | Promise<RuntimeAdapter>;
|
|
44
|
+
//#endregion
|
|
45
|
+
export type { PersistenceAdapter };
|
|
44
46
|
//# sourceMappingURL=types.d.ts.map
|
package/lib/types.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","
|
|
1
|
+
{"version":3,"file":"types.d.ts","names":[],"sources":["../src/types.ts"],"mappings":";;;iBAGiB;EACb,MAAM,YAAY,MAAM,OAAO;EAC/B,KAAK,aAAa,QAAQ;EAC1B,OAAO,aAAa;;iBAGP;WACJ;EACT,UAAU,WAAW;;iBAGR;EACb,IAAI,cAAc;EAClB,IAAI,aAAa,gBAAgB;EACjC,OAAO,cAAc;;YAGb;iBAEK;EACb,KAAK,2BAA2B;IAAU;;EAC1C,gBAAgB;;iBAGH;EACb,MAAM;IACF;IACA,eAAe;MACf;;iBAKS;WACJ;WACA;EACT,WAAW;EACX,cAAc;EACd,eAAe;EACf,wBAAwB;EACxB,UAAU;EACV,cAAc;EACd,uBAAuB;EACvB,uBAAuB;;YAGf,0BACR,eACA,sBACC,iBAAiB,QAAQ"}
|
package/lib/types.js
CHANGED
|
@@ -1,4 +1,6 @@
|
|
|
1
|
+
//#region src/utils/BrowserAuthenticationCancelledError.d.ts
|
|
1
2
|
export declare class BrowserAuthenticationCancelledError extends Error {
|
|
2
|
-
|
|
3
|
+
constructor(message?: string);
|
|
3
4
|
}
|
|
5
|
+
//#endregion
|
|
4
6
|
//# sourceMappingURL=BrowserAuthenticationCancelledError.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BrowserAuthenticationCancelledError.d.ts","
|
|
1
|
+
{"version":3,"file":"BrowserAuthenticationCancelledError.d.ts","names":[],"sources":["../../src/utils/BrowserAuthenticationCancelledError.ts"],"mappings":";qBAAa,4CAA4C;EACrD,YAAY"}
|
|
@@ -1,7 +1,11 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
}
|
|
1
|
+
//#region src/utils/BrowserAuthenticationCancelledError.ts
|
|
2
|
+
var BrowserAuthenticationCancelledError = class extends Error {
|
|
3
|
+
constructor(message = "Browser authentication was cancelled.") {
|
|
4
|
+
super(message);
|
|
5
|
+
this.name = "BrowserAuthenticationCancelledError";
|
|
6
|
+
}
|
|
7
|
+
};
|
|
8
|
+
//#endregion
|
|
9
|
+
export { BrowserAuthenticationCancelledError };
|
|
10
|
+
|
|
7
11
|
//# sourceMappingURL=BrowserAuthenticationCancelledError.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BrowserAuthenticationCancelledError.js","
|
|
1
|
+
{"version":3,"file":"BrowserAuthenticationCancelledError.js","names":[],"sources":["../../src/utils/BrowserAuthenticationCancelledError.ts"],"sourcesContent":["export class BrowserAuthenticationCancelledError extends Error {\n constructor(message = \"Browser authentication was cancelled.\") {\n super(message);\n this.name = \"BrowserAuthenticationCancelledError\";\n }\n}\n"],"mappings":";AAAA,IAAa,sCAAb,cAAyD,MAAM;CAC3D,YAAY,UAAU,yCAAyC;EAC3D,MAAM,OAAO;EACb,KAAK,OAAO;CAChB;AACJ"}
|
|
@@ -1,5 +1,7 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
1
|
+
import { Coordination } from "@party-stack/coordination";
|
|
2
|
+
import { PersistedCollectionPersistence } from "@tanstack/db-sqlite-persistence-core";
|
|
3
|
+
//#region src/utils/createCollectionPersistence.d.ts
|
|
3
4
|
/** Use the runtime coordinator while preserving the persistence factory's standard resolvers. */
|
|
4
5
|
export declare function createCollectionPersistence(coordination: Coordination, persistence: PersistedCollectionPersistence): PersistedCollectionPersistence;
|
|
6
|
+
//#endregion
|
|
5
7
|
//# sourceMappingURL=createCollectionPersistence.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"createCollectionPersistence.d.ts","
|
|
1
|
+
{"version":3,"file":"createCollectionPersistence.d.ts","names":[],"sources":["../../src/utils/createCollectionPersistence.ts"],"mappings":";;;;wBAKgB,4BACZ,cAAc,cACd,aAAa,iCACd"}
|
|
@@ -1,20 +1,24 @@
|
|
|
1
1
|
import { createPersistedCollectionCoordinator } from "../coordinator/createPersistedCollectionCoordinator.js";
|
|
2
|
+
//#region src/utils/createCollectionPersistence.ts
|
|
2
3
|
/** Use the runtime coordinator while preserving the persistence factory's standard resolvers. */
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
4
|
+
function createCollectionPersistence(coordination, persistence) {
|
|
5
|
+
const coordinator = createPersistedCollectionCoordinator(coordination, persistence.adapter);
|
|
6
|
+
return {
|
|
7
|
+
...persistence,
|
|
8
|
+
coordinator,
|
|
9
|
+
resolvePersistenceForMode: (mode) => ({
|
|
10
|
+
...persistence.resolvePersistenceForMode?.(mode) ?? persistence,
|
|
11
|
+
coordinator
|
|
12
|
+
}),
|
|
13
|
+
resolvePersistenceForCollection: (context) => {
|
|
14
|
+
return {
|
|
15
|
+
...persistence.resolvePersistenceForCollection?.(context) ?? persistence.resolvePersistenceForMode?.(context.mode) ?? persistence,
|
|
16
|
+
coordinator
|
|
17
|
+
};
|
|
18
|
+
}
|
|
19
|
+
};
|
|
19
20
|
}
|
|
21
|
+
//#endregion
|
|
22
|
+
export { createCollectionPersistence };
|
|
23
|
+
|
|
20
24
|
//# sourceMappingURL=createCollectionPersistence.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"createCollectionPersistence.js","
|
|
1
|
+
{"version":3,"file":"createCollectionPersistence.js","names":[],"sources":["../../src/utils/createCollectionPersistence.ts"],"sourcesContent":["import { createPersistedCollectionCoordinator } from \"../coordinator/createPersistedCollectionCoordinator.js\";\nimport type { Coordination } from \"@party-stack/coordination\";\nimport type { PersistedCollectionPersistence } from \"@tanstack/db-sqlite-persistence-core\";\n\n/** Use the runtime coordinator while preserving the persistence factory's standard resolvers. */\nexport function createCollectionPersistence(\n coordination: Coordination,\n persistence: PersistedCollectionPersistence\n): PersistedCollectionPersistence {\n const coordinator = createPersistedCollectionCoordinator(coordination, persistence.adapter);\n return {\n ...persistence,\n coordinator,\n resolvePersistenceForMode: (mode) => ({\n ...(persistence.resolvePersistenceForMode?.(mode) ?? persistence),\n coordinator,\n }),\n resolvePersistenceForCollection: (context) => {\n const resolved =\n persistence.resolvePersistenceForCollection?.(context) ??\n persistence.resolvePersistenceForMode?.(context.mode) ??\n persistence;\n return { ...resolved, coordinator };\n },\n };\n}\n"],"mappings":";;;AAKA,SAAgB,4BACZ,cACA,aAC8B;CAC9B,MAAM,cAAc,qCAAqC,cAAc,YAAY,OAAO;CAC1F,OAAO;EACH,GAAG;EACH;EACA,4BAA4B,UAAU;GAClC,GAAI,YAAY,4BAA4B,IAAI,KAAK;GACrD;EACJ;EACA,kCAAkC,YAAY;GAK1C,OAAO;IAAE,GAHL,YAAY,kCAAkC,OAAO,KACrD,YAAY,4BAA4B,QAAQ,IAAI,KACpD;IACkB;GAAY;EACtC;CACJ;AACJ"}
|
|
@@ -1,2 +1,5 @@
|
|
|
1
|
-
|
|
1
|
+
import { RuntimeAdapter } from "../types.js";
|
|
2
|
+
//#region src/utils/createDefaultRuntime.d.ts
|
|
3
|
+
export declare const createDefaultRuntime: (owner: string, namespace: string) => RuntimeAdapter;
|
|
4
|
+
//#endregion
|
|
2
5
|
//# sourceMappingURL=createDefaultRuntime.d.ts.map
|