@powerhousedao/reactor-browser 6.2.3-dev.45 → 6.2.3-dev.46

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (37) hide show
  1. package/dist/{attachment-service-Dqu-2kwn.d.ts → attachment-service-CkxtGxj8.d.ts} +2 -2
  2. package/dist/{attachment-service-Dqu-2kwn.d.ts.map → attachment-service-CkxtGxj8.d.ts.map} +1 -1
  3. package/dist/{dispatch-t-XkZYGh.js → dispatch-C1VVTn5S.js} +2 -2
  4. package/dist/{dispatch-t-XkZYGh.js.map → dispatch-C1VVTn5S.js.map} +1 -1
  5. package/dist/{document-by-id-CQZMsJ9I.js → document-by-id-BRDkvmpn.js} +2 -2
  6. package/dist/{document-by-id-CQZMsJ9I.js.map → document-by-id-BRDkvmpn.js.map} +1 -1
  7. package/dist/{document-model-modules-Bfi0VEWy.js → document-model-modules-Drsqa5FM.js} +22 -4
  8. package/dist/{document-model-modules-Bfi0VEWy.js.map → document-model-modules-Drsqa5FM.js.map} +1 -1
  9. package/dist/{document-operations-DJxHHfWq.js → document-operations-BGUnt-rW.js} +5 -5
  10. package/dist/{document-operations-DJxHHfWq.js.map → document-operations-BGUnt-rW.js.map} +1 -1
  11. package/dist/{global-DsTZXSmU.d.ts → global-BUpRlWcM.d.ts} +8 -1
  12. package/dist/global-BUpRlWcM.d.ts.map +1 -0
  13. package/dist/{index-x4XYd5DN.d.ts → index-rWaqlBoo.d.ts} +2 -2
  14. package/dist/{index-x4XYd5DN.d.ts.map → index-rWaqlBoo.d.ts.map} +1 -1
  15. package/dist/index.d.ts +14 -3
  16. package/dist/index.d.ts.map +1 -1
  17. package/dist/index.js +9 -9
  18. package/dist/{make-ph-event-functions-FzpvQtj6.js → make-ph-event-functions-CdsvEl5t.js} +4 -2
  19. package/dist/{make-ph-event-functions-FzpvQtj6.js.map → make-ph-event-functions-CdsvEl5t.js.map} +1 -1
  20. package/dist/{renown-C9pYZRqf.js → renown-CPAeJt5L.js} +2 -2
  21. package/dist/{renown-C9pYZRqf.js.map → renown-CPAeJt5L.js.map} +1 -1
  22. package/dist/{renown-Def5iO8k.js → renown-D05wkobG.js} +2 -2
  23. package/dist/{renown-Def5iO8k.js.map → renown-D05wkobG.js.map} +1 -1
  24. package/dist/src/ai/index.js +2 -2
  25. package/dist/src/analytics/index.js +1 -1
  26. package/dist/src/graphql-client/entry.d.ts +2 -2
  27. package/dist/src/graphql-client/entry.js +3 -3
  28. package/dist/src/renown/index.d.ts +1 -1
  29. package/dist/src/renown/index.js +2 -2
  30. package/dist/src/rpc/index.d.ts +31 -4
  31. package/dist/src/rpc/index.d.ts.map +1 -1
  32. package/dist/src/rpc/index.js +126 -17
  33. package/dist/src/rpc/index.js.map +1 -1
  34. package/dist/{switchboard-kKDuDWxY.js → switchboard-2L8zxwUX.js} +3 -3
  35. package/dist/{switchboard-kKDuDWxY.js.map → switchboard-2L8zxwUX.js.map} +1 -1
  36. package/package.json +9 -9
  37. package/dist/global-DsTZXSmU.d.ts.map +0 -1
@@ -1,5 +1,5 @@
1
- import { ct as IOperationCache, lt as OperationsCacheEntry, rt as IReactorBrowserClient } from "../../global-DsTZXSmU.js";
2
- import { $ as useSwitchboardClient, A as useGetDocument, B as StaticPackageManager, Bt as isOperationCache, D as useDocumentCache, E as useDocument, F as DocumentChangesSubscriptionOptions, G as stampAction, H as resolveDocumentModelModule, I as isAuthRefusalClose, J as MutateDocumentWithOperationsVariables, K as MutateDocumentWithOperationsDocument, L as makeAuthConnectionParams, Lt as DocumentCache, M as useGetDocuments, N as ConnectionParams, O as useDocumentSafe, P as DocumentChangesEventPayload, Q as ensurePHEventHandlers, R as startDocumentChangesSubscription, Rt as IDLE_OPERATIONS_ENTRY, T as setDocumentCache, U as prepareSignedActions, V as packageFromDocumentModels, Vt as readPromiseState, W as signStampedAction, X as GraphQLReactorProvider, Y as ReactorOperationFieldsFragmentDoc, Z as GraphQLReactorProviderProps, _t as phDocumentFromMutation, a as DocumentOperationsState, at as SubgraphSdkFactory, b as useReactorClient, c as useDocumentModelModuleById, ct as describeGraphQLDocument, d as UseDispatchResult, dt as ambientRenownTokenProvider, et as GraphQLReactorClient, f as useDispatch, ft as makeAuthMiddleware, gt as phDocumentFromGetDocument, h as setReactorClient, ht as RevisionsListSelection, i as DocumentOperationsResult, it as GraphQLRequestOptions, j as useGetDocumentAsync, k as useDocuments, l as useDocumentModelModules, lt as subgraphUrlFromGraphqlUrl, mt as GetDocumentQueryResult, nt as isGraphQLReactorClient, o as UseDocumentOperationsOptions, ot as SubgraphSdkRegistry, pt as GetDocumentQueryFields, q as MutateDocumentWithOperationsResult, r as useAttachmentService, rt as viewFilterInputFromViewFilter, s as useDocumentOperations, st as TypedGraphQLDocument, tt as GraphQLReactorClientOptions, u as DispatchFn, ut as BearerTokenProvider, vt as revisionMapFromRevisionsList, z as subscriptionsUrlFromGraphqlUrl, zt as addPromiseState } from "../../attachment-service-Dqu-2kwn.js";
1
+ import { ct as IOperationCache, lt as OperationsCacheEntry, rt as IReactorBrowserClient } from "../../global-BUpRlWcM.js";
2
+ import { $ as useSwitchboardClient, A as useGetDocument, B as StaticPackageManager, Bt as isOperationCache, D as useDocumentCache, E as useDocument, F as DocumentChangesSubscriptionOptions, G as stampAction, H as resolveDocumentModelModule, I as isAuthRefusalClose, J as MutateDocumentWithOperationsVariables, K as MutateDocumentWithOperationsDocument, L as makeAuthConnectionParams, Lt as DocumentCache, M as useGetDocuments, N as ConnectionParams, O as useDocumentSafe, P as DocumentChangesEventPayload, Q as ensurePHEventHandlers, R as startDocumentChangesSubscription, Rt as IDLE_OPERATIONS_ENTRY, T as setDocumentCache, U as prepareSignedActions, V as packageFromDocumentModels, Vt as readPromiseState, W as signStampedAction, X as GraphQLReactorProvider, Y as ReactorOperationFieldsFragmentDoc, Z as GraphQLReactorProviderProps, _t as phDocumentFromMutation, a as DocumentOperationsState, at as SubgraphSdkFactory, b as useReactorClient, c as useDocumentModelModuleById, ct as describeGraphQLDocument, d as UseDispatchResult, dt as ambientRenownTokenProvider, et as GraphQLReactorClient, f as useDispatch, ft as makeAuthMiddleware, gt as phDocumentFromGetDocument, h as setReactorClient, ht as RevisionsListSelection, i as DocumentOperationsResult, it as GraphQLRequestOptions, j as useGetDocumentAsync, k as useDocuments, l as useDocumentModelModules, lt as subgraphUrlFromGraphqlUrl, mt as GetDocumentQueryResult, nt as isGraphQLReactorClient, o as UseDocumentOperationsOptions, ot as SubgraphSdkRegistry, pt as GetDocumentQueryFields, q as MutateDocumentWithOperationsResult, r as useAttachmentService, rt as viewFilterInputFromViewFilter, s as useDocumentOperations, st as TypedGraphQLDocument, tt as GraphQLReactorClientOptions, u as DispatchFn, ut as BearerTokenProvider, vt as revisionMapFromRevisionsList, z as subscriptionsUrlFromGraphqlUrl, zt as addPromiseState } from "../../attachment-service-CkxtGxj8.js";
3
3
  import { k as SdkFunctionWrapper } from "../../types-Cww0HJmz.js";
4
4
  export { BearerTokenProvider, ConnectionParams, type DispatchFn, DocumentCache, DocumentChangesEventPayload, DocumentChangesSubscriptionOptions, type DocumentOperationsResult, type DocumentOperationsState, GetDocumentQueryFields, GetDocumentQueryResult, GraphQLReactorClient, GraphQLReactorClientOptions, GraphQLReactorProvider, GraphQLReactorProviderProps, GraphQLRequestOptions, IDLE_OPERATIONS_ENTRY, type IOperationCache, type IReactorBrowserClient, MutateDocumentWithOperationsDocument, MutateDocumentWithOperationsResult, MutateDocumentWithOperationsVariables, type OperationsCacheEntry, ReactorOperationFieldsFragmentDoc, RevisionsListSelection, type SdkFunctionWrapper, StaticPackageManager, SubgraphSdkFactory, SubgraphSdkRegistry, TypedGraphQLDocument, type UseDispatchResult, type UseDocumentOperationsOptions, addPromiseState, ambientRenownTokenProvider, describeGraphQLDocument, ensurePHEventHandlers, isAuthRefusalClose, isGraphQLReactorClient, isOperationCache, makeAuthConnectionParams, makeAuthMiddleware, packageFromDocumentModels, phDocumentFromGetDocument, phDocumentFromMutation, prepareSignedActions, readPromiseState, resolveDocumentModelModule, revisionMapFromRevisionsList, setDocumentCache, setReactorClient, signStampedAction, stampAction, startDocumentChangesSubscription, subgraphUrlFromGraphqlUrl, subscriptionsUrlFromGraphqlUrl, useAttachmentService, useDispatch, useDocument, useDocumentCache, useDocumentModelModuleById, useDocumentModelModules, useDocumentOperations, useDocumentSafe, useDocuments, useGetDocument, useGetDocumentAsync, useGetDocuments, useReactorClient, useSwitchboardClient, viewFilterInputFromViewFilter };
5
5
  export {};
@@ -1,4 +1,4 @@
1
- import { a as useDocumentCache, c as useGetDocument, d as DocumentCache, f as IDLE_OPERATIONS_ENTRY, h as readPromiseState, i as useDocument, l as useGetDocumentAsync, m as isOperationCache, o as useDocumentSafe, p as addPromiseState, r as setDocumentCache, s as useDocuments, t as useDispatch, u as useGetDocuments } from "../../dispatch-t-XkZYGh.js";
2
- import { B as makeAuthMiddleware, n as useDocumentModelModules, t as useDocumentModelModuleById, z as ambientRenownTokenProvider } from "../../document-model-modules-Bfi0VEWy.js";
3
- import { $r as isAuthRefusalClose, J as useAttachmentService, Qr as viewFilterInputFromViewFilter, Xr as GraphQLReactorClient, Zr as isGraphQLReactorClient, ai as subgraphUrlFromGraphqlUrl, ci as resolveDocumentModelModule, di as stampAction, ei as makeAuthConnectionParams, fi as MutateDocumentWithOperationsDocument, gi as revisionMapFromRevisionsList, hi as phDocumentFromMutation, i as useSwitchboardClient, ii as describeGraphQLDocument, k as useReactorClient, li as prepareSignedActions, mi as phDocumentFromGetDocument, n as GraphQLReactorProvider, ni as subscriptionsUrlFromGraphqlUrl, oi as StaticPackageManager, pi as ReactorOperationFieldsFragmentDoc, r as ensurePHEventHandlers, ri as SubgraphSdkRegistry, si as packageFromDocumentModels, t as useDocumentOperations, ti as startDocumentChangesSubscription, ui as signStampedAction, w as setReactorClient } from "../../document-operations-DJxHHfWq.js";
1
+ import { a as useDocumentCache, c as useGetDocument, d as DocumentCache, f as IDLE_OPERATIONS_ENTRY, h as readPromiseState, i as useDocument, l as useGetDocumentAsync, m as isOperationCache, o as useDocumentSafe, p as addPromiseState, r as setDocumentCache, s as useDocuments, t as useDispatch, u as useGetDocuments } from "../../dispatch-C1VVTn5S.js";
2
+ import { B as ambientRenownTokenProvider, V as makeAuthMiddleware, n as useDocumentModelModules, t as useDocumentModelModuleById } from "../../document-model-modules-Drsqa5FM.js";
3
+ import { $r as isAuthRefusalClose, J as useAttachmentService, Qr as viewFilterInputFromViewFilter, Xr as GraphQLReactorClient, Zr as isGraphQLReactorClient, ai as subgraphUrlFromGraphqlUrl, ci as resolveDocumentModelModule, di as stampAction, ei as makeAuthConnectionParams, fi as MutateDocumentWithOperationsDocument, gi as revisionMapFromRevisionsList, hi as phDocumentFromMutation, i as useSwitchboardClient, ii as describeGraphQLDocument, k as useReactorClient, li as prepareSignedActions, mi as phDocumentFromGetDocument, n as GraphQLReactorProvider, ni as subscriptionsUrlFromGraphqlUrl, oi as StaticPackageManager, pi as ReactorOperationFieldsFragmentDoc, r as ensurePHEventHandlers, ri as SubgraphSdkRegistry, si as packageFromDocumentModels, t as useDocumentOperations, ti as startDocumentChangesSubscription, ui as signStampedAction, w as setReactorClient } from "../../document-operations-BGUnt-rW.js";
4
4
  export { DocumentCache, GraphQLReactorClient, GraphQLReactorProvider, IDLE_OPERATIONS_ENTRY, MutateDocumentWithOperationsDocument, ReactorOperationFieldsFragmentDoc, StaticPackageManager, SubgraphSdkRegistry, addPromiseState, ambientRenownTokenProvider, describeGraphQLDocument, ensurePHEventHandlers, isAuthRefusalClose, isGraphQLReactorClient, isOperationCache, makeAuthConnectionParams, makeAuthMiddleware, packageFromDocumentModels, phDocumentFromGetDocument, phDocumentFromMutation, prepareSignedActions, readPromiseState, resolveDocumentModelModule, revisionMapFromRevisionsList, setDocumentCache, setReactorClient, signStampedAction, stampAction, startDocumentChangesSubscription, subgraphUrlFromGraphqlUrl, subscriptionsUrlFromGraphqlUrl, useAttachmentService, useDispatch, useDocument, useDocumentCache, useDocumentModelModuleById, useDocumentModelModules, useDocumentOperations, useDocumentSafe, useDocuments, useGetDocument, useGetDocumentAsync, useGetDocuments, useReactorClient, useSwitchboardClient, viewFilterInputFromViewFilter };
@@ -1,3 +1,3 @@
1
- import { A as RENOWN_RETURN_URL_STRIPPED_PARAMS, B as UserIcon, C as CREDENTIAL_SCHEMA_EIP712_TYPE, D as ISSUER_TYPE, E as DOMAIN_TYPE, F as ChevronDownIcon, G as RenownLoginButtonProps, H as RenownUserButtonMenuItem, I as CopyIcon, K as RenownAuthButton, L as DisconnectIcon, M as VERIFIABLE_CREDENTIAL_EIP712_TYPE, N as initConnectCrypto, O as RENOWN_CHAIN_ID, P as initRenownCrypto, Q as useRenown, R as RenownLogo, S as useRenownInitialUser, T as CREDENTIAL_TYPES, U as RenownUserButtonProps, V as RenownUserButton, W as RenownLoginButton, _ as RENOWN_INITIAL_UNKNOWN, a as RenownWalletProviderProps, at as RenownAuthResolution, b as RenownInitialUserProviderProps, c as Renown, ct as useRenownAuthAsync, d as useRenownInit, f as RenownSessionCookieOptions, g as RENOWN_INITIAL_ANONYMOUS, h as useRenownSessionSynced, i as RenownWalletProvider, it as RenownAuthAsync, j as RENOWN_URL, k as RENOWN_NETWORK_ID, l as RenownProps, m as useRenownSessionCookie, n as RenownLoginMethod, nt as openRenown, o as RenownProvider, ot as RenownAuthStatus, p as RenownSessionCookieState, q as RenownAuthButtonProps, r as useRenownLoginMethods, rt as RenownAuth, s as RenownProviderProps, st as useRenownAuth, t as useRenownWalletAdapter, u as RenownInitOptions, v as RenownInitialAuth, w as CREDENTIAL_SUBJECT_TYPE, x as useRenownInitialAuth, y as RenownInitialUserProvider, z as SpinnerIcon } from "../../index-x4XYd5DN.js";
1
+ import { A as RENOWN_RETURN_URL_STRIPPED_PARAMS, B as UserIcon, C as CREDENTIAL_SCHEMA_EIP712_TYPE, D as ISSUER_TYPE, E as DOMAIN_TYPE, F as ChevronDownIcon, G as RenownLoginButtonProps, H as RenownUserButtonMenuItem, I as CopyIcon, K as RenownAuthButton, L as DisconnectIcon, M as VERIFIABLE_CREDENTIAL_EIP712_TYPE, N as initConnectCrypto, O as RENOWN_CHAIN_ID, P as initRenownCrypto, Q as useRenown, R as RenownLogo, S as useRenownInitialUser, T as CREDENTIAL_TYPES, U as RenownUserButtonProps, V as RenownUserButton, W as RenownLoginButton, _ as RENOWN_INITIAL_UNKNOWN, a as RenownWalletProviderProps, at as RenownAuthResolution, b as RenownInitialUserProviderProps, c as Renown, ct as useRenownAuthAsync, d as useRenownInit, f as RenownSessionCookieOptions, g as RENOWN_INITIAL_ANONYMOUS, h as useRenownSessionSynced, i as RenownWalletProvider, it as RenownAuthAsync, j as RENOWN_URL, k as RENOWN_NETWORK_ID, l as RenownProps, m as useRenownSessionCookie, n as RenownLoginMethod, nt as openRenown, o as RenownProvider, ot as RenownAuthStatus, p as RenownSessionCookieState, q as RenownAuthButtonProps, r as useRenownLoginMethods, rt as RenownAuth, s as RenownProviderProps, st as useRenownAuth, t as useRenownWalletAdapter, u as RenownInitOptions, v as RenownInitialAuth, w as CREDENTIAL_SUBJECT_TYPE, x as useRenownInitialAuth, y as RenownInitialUserProvider, z as SpinnerIcon } from "../../index-rWaqlBoo.js";
2
2
  export { CREDENTIAL_SCHEMA_EIP712_TYPE, CREDENTIAL_SUBJECT_TYPE, CREDENTIAL_TYPES, ChevronDownIcon, CopyIcon, DOMAIN_TYPE, DisconnectIcon, ISSUER_TYPE, RENOWN_CHAIN_ID, RENOWN_INITIAL_ANONYMOUS, RENOWN_INITIAL_UNKNOWN, RENOWN_NETWORK_ID, RENOWN_RETURN_URL_STRIPPED_PARAMS, RENOWN_URL, Renown, type RenownAuth, type RenownAuthAsync, RenownAuthButton, type RenownAuthButtonProps, type RenownAuthResolution, type RenownAuthStatus, type RenownInitOptions, type RenownInitialAuth, RenownInitialUserProvider, type RenownInitialUserProviderProps, RenownLoginButton, type RenownLoginButtonProps, type RenownLoginMethod, RenownLogo, type RenownProps, RenownProvider, type RenownProviderProps, type RenownSessionCookieOptions, type RenownSessionCookieState, RenownUserButton, type RenownUserButtonMenuItem, type RenownUserButtonProps, RenownWalletProvider, type RenownWalletProviderProps, SpinnerIcon, UserIcon, VERIFIABLE_CREDENTIAL_EIP712_TYPE, initConnectCrypto, initRenownCrypto, openRenown, useRenown, useRenownAuth, useRenownAuthAsync, useRenownInit, useRenownInitialAuth, useRenownInitialUser, useRenownLoginMethods, useRenownSessionCookie, useRenownSessionSynced, useRenownWalletAdapter };
3
3
  export {};
@@ -1,3 +1,3 @@
1
- import { a as useRenown, c as RENOWN_INITIAL_UNKNOWN, d as useRenownInitialUser, l as RenownInitialUserProvider, s as RENOWN_INITIAL_ANONYMOUS, u as useRenownInitialAuth } from "../../renown-Def5iO8k.js";
2
- import { A as RENOWN_CHAIN_ID, D as CREDENTIAL_TYPES, E as CREDENTIAL_SUBJECT_TYPE, M as RENOWN_RETURN_URL_STRIPPED_PARAMS, N as RENOWN_URL, O as DOMAIN_TYPE, P as VERIFIABLE_CREDENTIAL_EIP712_TYPE, T as CREDENTIAL_SCHEMA_EIP712_TYPE, _ as RenownLogo, a as Renown, b as useRenownAuth, c as useRenownSessionSynced, d as RenownAuthButton, f as RenownUserButton, g as DisconnectIcon, h as CopyIcon, i as RenownWalletProvider, j as RENOWN_NETWORK_ID, k as ISSUER_TYPE, l as initConnectCrypto, m as ChevronDownIcon, n as useRenownLoginMethods, o as useRenownInit, p as RenownLoginButton, r as RenownProvider, s as useRenownSessionCookie, t as useRenownWalletAdapter, u as initRenownCrypto, v as SpinnerIcon, w as openRenown, x as useRenownAuthAsync, y as UserIcon } from "../../renown-C9pYZRqf.js";
1
+ import { a as useRenown, c as RENOWN_INITIAL_UNKNOWN, d as useRenownInitialUser, l as RenownInitialUserProvider, s as RENOWN_INITIAL_ANONYMOUS, u as useRenownInitialAuth } from "../../renown-D05wkobG.js";
2
+ import { A as RENOWN_CHAIN_ID, D as CREDENTIAL_TYPES, E as CREDENTIAL_SUBJECT_TYPE, M as RENOWN_RETURN_URL_STRIPPED_PARAMS, N as RENOWN_URL, O as DOMAIN_TYPE, P as VERIFIABLE_CREDENTIAL_EIP712_TYPE, T as CREDENTIAL_SCHEMA_EIP712_TYPE, _ as RenownLogo, a as Renown, b as useRenownAuth, c as useRenownSessionSynced, d as RenownAuthButton, f as RenownUserButton, g as DisconnectIcon, h as CopyIcon, i as RenownWalletProvider, j as RENOWN_NETWORK_ID, k as ISSUER_TYPE, l as initConnectCrypto, m as ChevronDownIcon, n as useRenownLoginMethods, o as useRenownInit, p as RenownLoginButton, r as RenownProvider, s as useRenownSessionCookie, t as useRenownWalletAdapter, u as initRenownCrypto, v as SpinnerIcon, w as openRenown, x as useRenownAuthAsync, y as UserIcon } from "../../renown-CPAeJt5L.js";
3
3
  export { CREDENTIAL_SCHEMA_EIP712_TYPE, CREDENTIAL_SUBJECT_TYPE, CREDENTIAL_TYPES, ChevronDownIcon, CopyIcon, DOMAIN_TYPE, DisconnectIcon, ISSUER_TYPE, RENOWN_CHAIN_ID, RENOWN_INITIAL_ANONYMOUS, RENOWN_INITIAL_UNKNOWN, RENOWN_NETWORK_ID, RENOWN_RETURN_URL_STRIPPED_PARAMS, RENOWN_URL, Renown, RenownAuthButton, RenownInitialUserProvider, RenownLoginButton, RenownLogo, RenownProvider, RenownUserButton, RenownWalletProvider, SpinnerIcon, UserIcon, VERIFIABLE_CREDENTIAL_EIP712_TYPE, initConnectCrypto, initRenownCrypto, openRenown, useRenown, useRenownAuth, useRenownAuthAsync, useRenownInit, useRenownInitialAuth, useRenownInitialUser, useRenownLoginMethods, useRenownSessionCookie, useRenownSessionSynced, useRenownWalletAdapter };
@@ -1,8 +1,8 @@
1
1
  import { r as PGliteWithLive } from "../../index-rtDmzViP.js";
2
2
  import { i as createWorkerAdminClient, n as createInspectorProxy, r as IWorkerAdminClient, t as IInspectorProxy } from "../../inspector-proxy-DKOjxSGE.js";
3
3
  import { ChannelConfig, DriveCollectionId, IDocumentModelLoader, IDocumentModelRegistry, IEventBus, IPeerAgreement, IReactorClient, ISyncManager, Remote, RemoteFilter, RemoteOptions, ShutdownStatus, SyncHold, SyncStatus, SyncStatusChangeCallback, Unsubscribe } from "@powerhousedao/reactor";
4
- import { DocumentModelModule, PeerManifest } from "@powerhousedao/shared/document-model";
5
- import { ClientMessage, CorrelationId, ErrorInfo, ICorrelatedSubscriptions, IHostResponder, IRpcTransport, IRpcTransport as IRpcTransport$1, KeyedListeners, Listeners, MessageRouter, MessageRouter as MessageRouter$1, MethodCallMessage, OpKind, OpKind as OpKind$1, OwnerMessage, RPC_PROTOCOL_VERSION, ReactorHostServer, ReactorIdentity, ReactorIdentity as ReactorIdentity$1, RpcCorrelator, RpcDbOp, RpcLiveEvent, RpcLiveSubscribe, RpcLiveUnsub, RpcMessage, RpcPoster, RpcRequestOptions, SubscriptionStore, VersionFingerprint, VersionFingerprint as VersionFingerprint$1, WorkerInspectorInfo, WorkerMigrationState, WorkerMigrationState as WorkerMigrationState$1, createCorrelatedSubscriptions, createPortTransport, createReactorClientProxy, fromErrorInfo, hostResponder, toErrorInfo } from "@powerhousedao/reactor/rpc";
4
+ import { DocumentModelModule, PeerManifest, UpgradeManifest } from "@powerhousedao/shared/document-model";
5
+ import { ClientMessage, CorrelationId, ErrorInfo, ICorrelatedSubscriptions, IHostResponder, IRpcTransport, IRpcTransport as IRpcTransport$1, KeyedListeners, Listeners, MessageRouter, MessageRouter as MessageRouter$1, MethodCallMessage, OpKind, OpKind as OpKind$1, OwnerMessage, RPC_PROTOCOL_VERSION, ReactorHostServer, ReactorIdentity, ReactorIdentity as ReactorIdentity$1, RpcCorrelator, RpcDbOp, RpcLiveEvent, RpcLiveSubscribe, RpcLiveUnsub, RpcMessage, RpcPoster, RpcRequestOptions, SubscriptionStore, VersionFingerprint, VersionFingerprint as VersionFingerprint$1, WorkerInspectorInfo, WorkerMigrationState, WorkerMigrationState as WorkerMigrationState$1, WorkerPackageSource, WorkerPackageSource as WorkerPackageSource$1, createCorrelatedSubscriptions, createPortTransport, createReactorClientProxy, fromErrorInfo, hostResponder, toErrorInfo } from "@powerhousedao/reactor/rpc";
6
6
  //#region src/rpc/op-channel.d.ts
7
7
  export declare const RPC_DEFAULT_TIMEOUT_MS = 30000;
8
8
  export declare function toVoid(promise: Promise<unknown>): Promise<void>;
@@ -51,7 +51,7 @@ export declare function postReactorIdentity(router: MessageRouter$1, user: React
51
51
  type ReactorHostOptions = {
52
52
  client?: IReactorClient;
53
53
  build?: (construct: unknown) => Promise<IReactorClient>;
54
- registerPackages?: (specs: string[]) => Promise<void>;
54
+ registerPackages?: (specs: string[], sources?: WorkerPackageSource$1[]) => Promise<void>;
55
55
  unregisterPackages?: (names: string[]) => Promise<void>;
56
56
  onIdentity?: (user: ReactorIdentity$1 | null) => void;
57
57
  onSyncOp?: (method: string, args: unknown[]) => Promise<unknown>;
@@ -158,6 +158,7 @@ type PackageLoadFailure = {
158
158
  url: string;
159
159
  error: unknown;
160
160
  };
161
+ type AnyUpgradeManifest = UpgradeManifest<readonly number[]>;
161
162
  export declare class WorkerPackageLoader implements IDocumentModelLoader {
162
163
  private readonly cdnUrl;
163
164
  private readonly importPackage;
@@ -165,19 +166,45 @@ export declare class WorkerPackageLoader implements IDocumentModelLoader {
165
166
  private readonly sharedImports?;
166
167
  private readonly importSource?;
167
168
  private readonly modulesByKey;
169
+ private readonly manifestsByType;
170
+ private readonly keysBySource;
171
+ private readonly manifestTypesBySource;
168
172
  private readonly loadedSpecs;
169
173
  private readonly failures;
174
+ private readonly pendingLoads;
175
+ private readonly generationBySource;
176
+ private generation;
170
177
  constructor(options: WorkerPackageLoaderOptions);
171
178
  loadPackages(specs: string[]): Promise<DocumentModelModule[]>;
179
+ /** Loads URL-addressed packages (local project packages). Idempotent. */
180
+ loadSources(sources: WorkerPackageSource$1[]): Promise<void>;
181
+ /**
182
+ * Replaces previously loaded sources with freshly imported ones (a vetra
183
+ * watch rebuild re-sends the same source under a cache-busted URL). Returns
184
+ * every document type touched - removed, re-added, or new - so the caller
185
+ * can replace the registry's version families. A source whose import fails
186
+ * keeps its previous modules and is reported in `failures`; one superseded
187
+ * by a newer reload of the same source contributes nothing.
188
+ */
189
+ reloadSources(sources: WorkerPackageSource$1[]): Promise<{
190
+ types: string[];
191
+ failures: PackageLoadFailure[];
192
+ }>;
172
193
  load(documentType: string): Promise<DocumentModelModule>;
173
194
  get models(): DocumentModelModule[];
195
+ get upgradeManifests(): AnyUpgradeManifest[];
174
196
  get loadFailures(): PackageLoadFailure[];
175
197
  /** The highest registered version for a type, which is what a bare load resolves to. */
176
198
  private latestForType;
177
199
  private notLoadedError;
178
200
  private loadPackage;
201
+ private loadFromUrl;
202
+ private replaceSource;
203
+ private importNamespace;
204
+ /** Registers a namespace as the key's whole contribution; returns its module types. */
205
+ private registerNamespace;
179
206
  }
180
207
  //#endregion
181
- export { type ClientMessage, type CorrelationId, type ErrorInfo, type ICorrelatedSubscriptions, type IHostResponder, type IInspectorProxy, type ILiveQueryProxy, type IOpChannel, type IRpcTransport, type IWorkerAdminClient, KeyedListeners, Listeners, MessageRouter, type MethodCallMessage, type OpKind, type OwnerMessage, type PackageImporter, RPC_PROTOCOL_VERSION, type ReactorHello, ReactorHostServer, type ReactorIdentity, RpcCorrelator, type RpcDbOp, type RpcLiveEvent, type RpcLiveSubscribe, type RpcLiveUnsub, type RpcMessage, type RpcPoster, type RpcRequestOptions, SubscriptionStore, type SyncStatusChangedBusEvent, type VersionFingerprint, type WorkerInspectorInfo, type WorkerMigrationState, type WorkerPackageLoaderOptions, createCorrelatedSubscriptions, createInspectorProxy, createPortTransport, createReactorClientProxy, createWorkerAdminClient, fromErrorInfo, hostResponder, toErrorInfo };
208
+ export { type ClientMessage, type CorrelationId, type ErrorInfo, type ICorrelatedSubscriptions, type IHostResponder, type IInspectorProxy, type ILiveQueryProxy, type IOpChannel, type IRpcTransport, type IWorkerAdminClient, KeyedListeners, Listeners, MessageRouter, type MethodCallMessage, type OpKind, type OwnerMessage, type PackageImporter, type PackageLoadFailure, RPC_PROTOCOL_VERSION, type ReactorHello, ReactorHostServer, type ReactorIdentity, RpcCorrelator, type RpcDbOp, type RpcLiveEvent, type RpcLiveSubscribe, type RpcLiveUnsub, type RpcMessage, type RpcPoster, type RpcRequestOptions, SubscriptionStore, type SyncStatusChangedBusEvent, type VersionFingerprint, type WorkerInspectorInfo, type WorkerMigrationState, type WorkerPackageLoaderOptions, type WorkerPackageSource, createCorrelatedSubscriptions, createInspectorProxy, createPortTransport, createReactorClientProxy, createWorkerAdminClient, fromErrorInfo, hostResponder, toErrorInfo };
182
209
  export {};
183
210
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","names":[],"sources":["../../../src/rpc/op-channel.ts","../../../src/rpc/live-query-proxy.ts","../../../src/rpc/relational-db-proxy.ts","../../../src/rpc/event-bus-proxy.ts","../../../src/rpc/forwarded-events.ts","../../../src/rpc/connect-reactor.ts","../../../src/rpc/reactor-host.ts","../../../src/rpc/sync-manager-proxy.ts","../../../src/rpc/worker-package-loader.ts"],"mappings":";;;;;;qBAMa;wBAEG,OAAO,SAAS,mBAAmB;UAIlC;EACf,KAAK,gBAAgB,mBAAmB;EACxC,SAAS,gBAAgB,mBAAmB;;wBAG9B,UACd,QAAQ,iBACR,MAAM,UACN,qBACC;;;KCfS,4BAA4B;KAC5B,0BAA0B;UAErB;EACf,MACE,aACA,mBACA,WAAW,0BACX,UAAU;;wBASE,qBAAqB,QAAQ,kBAAgB;;;wBClB7C,4BACd,QAAQ,kBACP;;;;qBCAU,gCAAgC;mBAC1B;mBACA;EAKjB,YAAY,QAAQ;EAMpB,UAAU,GACR,cACA,aAAa,cAAc,OAAO,aAAa,gBAC9C;EAaH,QAAQ;;wBASM,2BAA2B,QAAQ,kBAAgB;;;qBC1CtD;qBASA;;;KCDD;EACV,SAAS;EACT;EACA;;wBAGc,qBACd,QAAQ,iBACR,OAAO,cACP,YAAY,gBAAgB,6BAC5B,WAAW,yBACV;wBAaa,oBACd,QAAQ,iBACR,MAAM;;;KCEI;EACV,SAAS;EACT,SAAS,uBAAuB,QAAQ;EACxC,oBAAoB,oBAAoB;EACxC,sBAAsB,oBAAoB;EAC1C,cAAc,MAAM;EACpB,YAAY,gBAAgB,oBAAoB;EAChD,UAAU,gBAAgB,oBAAoB;EAC9C,iBAAiB,gBAAgB,oBAAoB;EACrD,eACE,aACA,mBACA,YAAY,8BACT;EAEL;EACA;EACA;EACA;EACA;EACA,4BAA4B;EAC5B,uBAAuB;;qBA6CZ;mBACM;mBACA;mBACA;UACT;UAEA;UACA;mBACS;mBACA;UACT;EAER,YAAY,SAAS;EASrB,QAAQ,WAAW;EA+GnB,YAAY,MAAM;EAKlB,kBAAkB,mBAAmB;EAOrC,gBAAgB,gBAAgB;EAOhC,kBAAkB,OAAO;MAOrB;UAII;UAgCM;UAUN;UAqBM;UAUN;UAaM;UA8BA;UASA;UASA;UAqBA;;;;qBCpYH;KAED;EACV;EACA,QAAQ;;qBAoFG,4BAA4B;mBACtB;mBACA;mBAIA;mBACA;mBACA;UACT;UACA;UACA;EAER,YAAY,QAAQ,iBAAe,UAAU;EAqBvC,WAAW;EAkBjB,YAAY;EAIZ,UAAU,eAAe;EAQzB,QAAQ,aAAa;EAQf,IACJ,cACA,cAAc,mBACd,eAAe,eACf,SAAS,cACT,UAAU,gBACT,QAAQ;EAYL,gBACJ,YACA,UAAU,sBACT;;EAMH,iBAAiB;EAIX,UAAU;IACd;IACA;MACE,QAAQ;EAIZ,aAAa;UAOL;EASF,WAAW,YAAY,uBAAuB;EAKpD,YAAY;EAMN,OAAO,eAAe;EAK5B,QAAQ;EAIR,eAAe;EAMf,cAAc,qBAAqB;EAInC,mBAAmB,UAAU;UAIrB;UAIA;UAQA;UAgCM;UAoBN;;wBAsBM,uBACd,QAAQ,iBACR,UAAU,YACT;;;KC9WS,mBAAmB,gBAAgB,QAAQ;KAE3C;EACV;EACA,eAAe;EACf,mBAAmB,yBAAyB;;;EAG5C,gBAAgB;;;EAGhB,gBAAgB,mBAAmB,QAAQ;;KAGjC;EACV;EACA;EACA;;qBA0BW,+BAA+B;mBACzB;mBACA;mBACA;mBACA;mBACA;mBAKA;mBACA;mBACA;EAEjB,YAAY,SAAS;EAYf,aAAa,kBAAkB,QAAQ;EAQvC,KAAK,uBAAuB,QAAQ;MAqBtC,UAAU;MAIV,gBAAgB;;UAKZ;UAaA;UAuBM"}
1
+ {"version":3,"file":"index.d.ts","names":[],"sources":["../../../src/rpc/op-channel.ts","../../../src/rpc/live-query-proxy.ts","../../../src/rpc/relational-db-proxy.ts","../../../src/rpc/event-bus-proxy.ts","../../../src/rpc/forwarded-events.ts","../../../src/rpc/connect-reactor.ts","../../../src/rpc/reactor-host.ts","../../../src/rpc/sync-manager-proxy.ts","../../../src/rpc/worker-package-loader.ts"],"mappings":";;;;;;qBAMa;wBAEG,OAAO,SAAS,mBAAmB;UAIlC;EACf,KAAK,gBAAgB,mBAAmB;EACxC,SAAS,gBAAgB,mBAAmB;;wBAG9B,UACd,QAAQ,iBACR,MAAM,UACN,qBACC;;;KCfS,4BAA4B;KAC5B,0BAA0B;UAErB;EACf,MACE,aACA,mBACA,WAAW,0BACX,UAAU;;wBASE,qBAAqB,QAAQ,kBAAgB;;;wBClB7C,4BACd,QAAQ,kBACP;;;;qBCAU,gCAAgC;mBAC1B;mBACA;EAKjB,YAAY,QAAQ;EAMpB,UAAU,GACR,cACA,aAAa,cAAc,OAAO,aAAa,gBAC9C;EAaH,QAAQ;;wBASM,2BAA2B,QAAQ,kBAAgB;;;qBC1CtD;qBASA;;;KCDD;EACV,SAAS;EACT;EACA;;wBAGc,qBACd,QAAQ,iBACR,OAAO,cACP,YAAY,gBAAgB,6BAC5B,WAAW,yBACV;wBAaa,oBACd,QAAQ,iBACR,MAAM;;;KCGI;EACV,SAAS;EACT,SAAS,uBAAuB,QAAQ;EACxC,oBACE,iBACA,UAAU,4BACP;EACL,sBAAsB,oBAAoB;EAC1C,cAAc,MAAM;EACpB,YAAY,gBAAgB,oBAAoB;EAChD,UAAU,gBAAgB,oBAAoB;EAC9C,iBAAiB,gBAAgB,oBAAoB;EACrD,eACE,aACA,mBACA,YAAY,8BACT;EAEL;EACA;EACA;EACA;EACA;EACA,4BAA4B;EAC5B,uBAAuB;;qBA6CZ;mBACM;mBACA;mBACA;UACT;UAEA;UACA;mBACS;mBACA;UACT;EAER,YAAY,SAAS;EASrB,QAAQ,WAAW;EA+GnB,YAAY,MAAM;EAKlB,kBAAkB,mBAAmB;EAOrC,gBAAgB,gBAAgB;EAOhC,kBAAkB,OAAO;MAOrB;UAII;UAgCM;UAUN;UAqBM;UAUN;UAaM;UA8BA;UASA;UASA;UAqBA;;;;qBCxYH;KAED;EACV;EACA,QAAQ;;qBAoFG,4BAA4B;mBACtB;mBACA;mBAIA;mBACA;mBACA;UACT;UACA;UACA;EAER,YAAY,QAAQ,iBAAe,UAAU;EAqBvC,WAAW;EAkBjB,YAAY;EAIZ,UAAU,eAAe;EAQzB,QAAQ,aAAa;EAQf,IACJ,cACA,cAAc,mBACd,eAAe,eACf,SAAS,cACT,UAAU,gBACT,QAAQ;EAYL,gBACJ,YACA,UAAU,sBACT;;EAMH,iBAAiB;EAIX,UAAU;IACd;IACA;MACE,QAAQ;EAIZ,aAAa;UAOL;EASF,WAAW,YAAY,uBAAuB;EAKpD,YAAY;EAMN,OAAO,eAAe;EAK5B,QAAQ;EAIR,eAAe;EAMf,cAAc,qBAAqB;EAInC,mBAAmB,UAAU;UAIrB;UAIA;UAQA;UAgCM;UAoBN;;wBAsBM,uBACd,QAAQ,iBACR,UAAU,YACT;;;KC1WS,mBAAmB,gBAAgB,QAAQ;KAE3C;EACV;EACA,eAAe;EACf,mBAAmB,yBAAyB;;;EAG5C,gBAAgB;;;EAGhB,gBAAgB,mBAAmB,QAAQ;;KAGjC;EACV;EACA;EACA;;KAsCG,qBAAqB;qBAgCb,+BAA+B;mBACzB;mBACA;mBACA;mBACA;mBACA;mBAKA;mBAEA;mBAEA;mBACA;mBACA;mBACA;mBACA;mBACA;UACT;EAER,YAAY,SAAS;EAYf,aAAa,kBAAkB,QAAQ;;EAQvC,YAAY,SAAS,0BAAwB;;;;;;;;;EAc7C,cACJ,SAAS,0BACR;IAAU;IAAiB,UAAU;;EAmBlC,KAAK,uBAAuB,QAAQ;MAqBtC,UAAU;MAIV,oBAAoB;MAIpB,gBAAgB;;UAKZ;UAaA;UAuBM;UAQN;UAgBM;UAoCA;;UA2BN"}
@@ -632,7 +632,7 @@ var ReactorHost = class {
632
632
  }
633
633
  async handleRegister(message, reply) {
634
634
  await reply.run(message.id, async () => {
635
- await this.options.registerPackages?.(message.specs);
635
+ await this.options.registerPackages?.(message.specs, message.sources);
636
636
  });
637
637
  }
638
638
  async handleUnregister(message, reply) {
@@ -674,9 +674,11 @@ var ReactorHost = class {
674
674
  };
675
675
  //#endregion
676
676
  //#region src/rpc/worker-package-loader.ts
677
- function packageName(spec) {
678
- const at = spec.lastIndexOf("@");
679
- return at > 0 ? spec.slice(0, at) : spec;
677
+ const SOURCE_KEY_PREFIX = "src:";
678
+ function packageName(key) {
679
+ if (key.startsWith(SOURCE_KEY_PREFIX)) return key.slice(4);
680
+ const at = key.lastIndexOf("@");
681
+ return at > 0 ? key.slice(0, at) : key;
680
682
  }
681
683
  function moduleKey(module) {
682
684
  return `${module.documentModel.global.id}@${module.version ?? 1}`;
@@ -686,6 +688,24 @@ function isDocumentModelModule(value) {
686
688
  const candidate = value;
687
689
  return typeof candidate.reducer === "function" && typeof candidate.documentModel?.global?.id === "string";
688
690
  }
691
+ function isUpgradeManifest(value) {
692
+ if (typeof value !== "object" || value === null) return false;
693
+ const candidate = value;
694
+ return typeof candidate.documentType === "string" && typeof candidate.upgrades === "object" && candidate.upgrades !== null;
695
+ }
696
+ function manifestsOf(namespace) {
697
+ const out = [];
698
+ for (const value of Object.values(namespace)) {
699
+ if (isUpgradeManifest(value)) {
700
+ out.push(value);
701
+ continue;
702
+ }
703
+ if (Array.isArray(value)) {
704
+ for (const inner of value) if (isUpgradeManifest(inner)) out.push(inner);
705
+ }
706
+ }
707
+ return out;
708
+ }
689
709
  var WorkerPackageLoader = class {
690
710
  cdnUrl;
691
711
  importPackage;
@@ -693,8 +713,14 @@ var WorkerPackageLoader = class {
693
713
  sharedImports;
694
714
  importSource;
695
715
  modulesByKey = /* @__PURE__ */ new Map();
716
+ manifestsByType = /* @__PURE__ */ new Map();
717
+ keysBySource = /* @__PURE__ */ new Map();
718
+ manifestTypesBySource = /* @__PURE__ */ new Map();
696
719
  loadedSpecs = /* @__PURE__ */ new Set();
697
720
  failures = [];
721
+ pendingLoads = /* @__PURE__ */ new Map();
722
+ generationBySource = /* @__PURE__ */ new Map();
723
+ generation = 0;
698
724
  constructor(options) {
699
725
  this.cdnUrl = options.cdnUrl.replace(/\/$/, "");
700
726
  this.importPackage = options.importPackage;
@@ -707,6 +733,29 @@ var WorkerPackageLoader = class {
707
733
  await Promise.all([...new Set(specs)].map((spec) => this.loadPackage(spec)));
708
734
  return this.models;
709
735
  }
736
+ /** Loads URL-addressed packages (local project packages). Idempotent. */
737
+ async loadSources(sources) {
738
+ await Promise.all(sources.map((source) => this.loadFromUrl(sourceKey(source), source.url)));
739
+ }
740
+ /**
741
+ * Replaces previously loaded sources with freshly imported ones (a vetra
742
+ * watch rebuild re-sends the same source under a cache-busted URL). Returns
743
+ * every document type touched - removed, re-added, or new - so the caller
744
+ * can replace the registry's version families. A source whose import fails
745
+ * keeps its previous modules and is reported in `failures`; one superseded
746
+ * by a newer reload of the same source contributes nothing.
747
+ */
748
+ async reloadSources(sources) {
749
+ const results = await Promise.all(sources.map((source) => this.replaceSource(sourceKey(source), source.url)));
750
+ const types = /* @__PURE__ */ new Set();
751
+ const failures = [];
752
+ for (const result of results) if (result.status === "replaced") for (const type of result.types) types.add(type);
753
+ else if (result.status === "failed") failures.push(result.failure);
754
+ return {
755
+ types: [...types],
756
+ failures
757
+ };
758
+ }
710
759
  async load(documentType) {
711
760
  const existing = this.latestForType(documentType);
712
761
  if (existing) return existing;
@@ -720,6 +769,9 @@ var WorkerPackageLoader = class {
720
769
  get models() {
721
770
  return [...new Set(this.modulesByKey.values())];
722
771
  }
772
+ get upgradeManifests() {
773
+ return [...this.manifestsByType.values()];
774
+ }
723
775
  get loadFailures() {
724
776
  return [...this.failures];
725
777
  }
@@ -739,28 +791,85 @@ var WorkerPackageLoader = class {
739
791
  return new Error(`Failed to import package(s) [${packageNames.join(", ")}] for document model: ${documentType}`, { cause });
740
792
  }
741
793
  async loadPackage(spec) {
742
- if (this.loadedSpecs.has(spec)) return;
743
794
  const name = packageName(spec);
744
795
  const url = `${this.cdnUrl}/${name}/browser/document-models/index.js`;
796
+ await this.loadFromUrl(spec, url);
797
+ }
798
+ loadFromUrl(key, url) {
799
+ if (this.loadedSpecs.has(key)) return Promise.resolve();
800
+ let pending = this.pendingLoads.get(key);
801
+ if (!pending) {
802
+ pending = this.replaceSource(key, url).finally(() => this.pendingLoads.delete(key)).then(() => void 0);
803
+ this.pendingLoads.set(key, pending);
804
+ }
805
+ return pending;
806
+ }
807
+ async replaceSource(key, url) {
808
+ const generation = ++this.generation;
809
+ this.generationBySource.set(key, generation);
810
+ let namespace;
745
811
  try {
746
- const source = this.sharedImports !== void 0 && Object.keys(this.sharedImports).length > 0 ? await (await fetch(url)).text() : void 0;
747
- const rewritten = source !== void 0 ? rewritePackageSource(source, url, this.sharedImports) : source;
748
- let namespace;
749
- if (rewritten !== void 0 && rewritten !== source) {
750
- if (!this.importSource) throw new Error("importSource is required to load a package that imports shared deps");
751
- namespace = await this.importSource(rewritten);
752
- } else namespace = await this.importPackage(url);
753
- for (const value of Object.values(namespace)) if (isDocumentModelModule(value)) this.modulesByKey.set(moduleKey(value), value);
754
- this.loadedSpecs.add(spec);
812
+ namespace = await this.importNamespace(url);
755
813
  } catch (error) {
756
- this.failures.push({
757
- name,
814
+ if (this.generationBySource.get(key) !== generation) return { status: "stale" };
815
+ const failure = {
816
+ name: packageName(key),
758
817
  url,
759
818
  error
760
- });
819
+ };
820
+ this.failures.push(failure);
821
+ return {
822
+ status: "failed",
823
+ failure
824
+ };
825
+ }
826
+ if (this.generationBySource.get(key) !== generation) return { status: "stale" };
827
+ const types = /* @__PURE__ */ new Set();
828
+ for (const removedKey of this.keysBySource.get(key) ?? []) {
829
+ const removed = this.modulesByKey.get(removedKey);
830
+ if (removed) types.add(removed.documentModel.global.id);
831
+ this.modulesByKey.delete(removedKey);
832
+ }
833
+ for (const type of this.manifestTypesBySource.get(key) ?? []) this.manifestsByType.delete(type);
834
+ for (const added of this.registerNamespace(key, namespace)) types.add(added);
835
+ this.loadedSpecs.add(key);
836
+ return {
837
+ status: "replaced",
838
+ types
839
+ };
840
+ }
841
+ async importNamespace(url) {
842
+ const source = this.sharedImports !== void 0 && Object.keys(this.sharedImports).length > 0 ? await (await fetch(url)).text() : void 0;
843
+ const rewritten = source !== void 0 ? rewritePackageSource(source, url, this.sharedImports) : source;
844
+ if (rewritten !== void 0 && rewritten !== source) {
845
+ if (!this.importSource) throw new Error("importSource is required to load a package that imports shared deps");
846
+ return this.importSource(rewritten);
761
847
  }
848
+ return this.importPackage(url);
849
+ }
850
+ /** Registers a namespace as the key's whole contribution; returns its module types. */
851
+ registerNamespace(key, namespace) {
852
+ const keys = /* @__PURE__ */ new Set();
853
+ const manifestTypes = /* @__PURE__ */ new Set();
854
+ const types = /* @__PURE__ */ new Set();
855
+ for (const value of Object.values(namespace)) if (isDocumentModelModule(value)) {
856
+ const k = moduleKey(value);
857
+ this.modulesByKey.set(k, value);
858
+ keys.add(k);
859
+ types.add(value.documentModel.global.id);
860
+ }
861
+ for (const manifest of manifestsOf(namespace)) {
862
+ this.manifestsByType.set(manifest.documentType, manifest);
863
+ manifestTypes.add(manifest.documentType);
864
+ }
865
+ this.keysBySource.set(key, keys);
866
+ this.manifestTypesBySource.set(key, manifestTypes);
867
+ return types;
762
868
  }
763
869
  };
870
+ function sourceKey(source) {
871
+ return `${SOURCE_KEY_PREFIX}${source.name}`;
872
+ }
764
873
  //#endregion
765
874
  export { FORWARDED_BUS_EVENT_TYPES, FORWARDED_EVENT_TYPES, KeyedListeners, Listeners, MessageRouter, RPC_DEFAULT_TIMEOUT_MS, RPC_PROTOCOL_VERSION, ReactorEventBusProxy, ReactorHost, ReactorHostServer, RpcCorrelator, SYNC_STATUS_CHANGED_EVENT, SubscriptionStore, SyncManagerProxy, WorkerPackageLoader, connectReactorClient, createCorrelatedSubscriptions, createInspectorProxy, createLiveQueryProxy, createPortTransport, createReactorClientProxy, createReactorEventBusProxy, createRelationalPgliteProxy, createSyncManagerProxy, createWorkerAdminClient, fromErrorInfo, hostResponder, opChannel, postReactorIdentity, toErrorInfo, toVoid };
766
875