@powerhousedao/connect-core 6.2.3-dev.81 → 6.2.3-dev.83
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index-ZFFeYX4A.d.ts +365 -0
- package/dist/index-ZFFeYX4A.d.ts.map +1 -0
- package/dist/index.d.ts +2 -2
- package/dist/index.js +2 -2
- package/dist/multi-reactor-Dvwv69u1.js +129 -0
- package/dist/multi-reactor-Dvwv69u1.js.map +1 -0
- package/dist/runtime-LvAkxbdf.js +609 -0
- package/dist/runtime-LvAkxbdf.js.map +1 -0
- package/dist/runtime.d.ts +2 -2
- package/dist/runtime.js +2 -2
- package/package.json +8 -8
- package/src/runtime/app-reactor-client.ts +71 -29
- package/src/runtime/drive-placement.ts +210 -0
- package/src/runtime/drive-placements.ts +361 -0
- package/src/runtime/index.ts +30 -0
- package/src/runtime/multi-reactor.ts +82 -53
- package/dist/index-BMlma368.d.ts +0 -199
- package/dist/index-BMlma368.d.ts.map +0 -1
- package/dist/multi-reactor-D_2B4jmu.js +0 -219
- package/dist/multi-reactor-D_2B4jmu.js.map +0 -1
- package/dist/runtime-D20_LlB_.js +0 -239
- package/dist/runtime-D20_LlB_.js.map +0 -1
- package/src/runtime/graphql-routable-backend.ts +0 -182
package/dist/index-BMlma368.d.ts
DELETED
|
@@ -1,199 +0,0 @@
|
|
|
1
|
-
import "./runtime-config-D3YPhYyj.js";
|
|
2
|
-
import { BrowserReactorClientModule, GraphQLReactorClientOptions, PHStore, WorkerReactorClientModule } from "@powerhousedao/reactor-browser";
|
|
3
|
-
import { PHReactorClientMode } from "@powerhousedao/shared/clis";
|
|
4
|
-
import { DocumentDriveDocument } from "@powerhousedao/shared/document-drive";
|
|
5
|
-
import { DocumentModelModule, ISigner } from "@powerhousedao/shared/document-model";
|
|
6
|
-
import { IReactorClient, ReactorInfo } from "@powerhousedao/reactor";
|
|
7
|
-
import { CollectionRequirementsInput, IRoutableBackend, ReactorReach, RoutableBackendConfig, RouterDiagnostic, RoutingClientOptions, RoutingReactorClient } from "@powerhousedao/reactor-router";
|
|
8
|
-
import { DocumentModelLib } from "document-model";
|
|
9
|
-
//#endregion
|
|
10
|
-
//#region src/runtime/runtime-flag.d.ts
|
|
11
|
-
type RuntimeFlagInput = {
|
|
12
|
-
configFlag: boolean;
|
|
13
|
-
queryParam?: string | null;
|
|
14
|
-
storedValue?: string | null;
|
|
15
|
-
};
|
|
16
|
-
declare function resolveRuntimeFlag(input: RuntimeFlagInput): boolean;
|
|
17
|
-
type RuntimeFlagKeys = {
|
|
18
|
-
queryKey: string;
|
|
19
|
-
storageKey: string;
|
|
20
|
-
readConfigFlag: () => boolean;
|
|
21
|
-
};
|
|
22
|
-
declare function isRuntimeFlagEnabled(keys: RuntimeFlagKeys): boolean;
|
|
23
|
-
//#endregion
|
|
24
|
-
//#region src/runtime/multi-reactor-flag.d.ts
|
|
25
|
-
declare function isMultiReactorEnabled(): boolean;
|
|
26
|
-
//#endregion
|
|
27
|
-
//#region src/runtime/reactor-worker-flag.d.ts
|
|
28
|
-
declare const REACTOR_WORKER_QUERY_KEY = "reactorWorker";
|
|
29
|
-
declare const REACTOR_WORKER_STORAGE_KEY = "ph:reactorWorker";
|
|
30
|
-
type ReactorWorkerFlagInput = RuntimeFlagInput;
|
|
31
|
-
declare function resolveReactorWorkerEnabled(input: ReactorWorkerFlagInput): boolean;
|
|
32
|
-
declare function isReactorWorkerEnabled(): boolean;
|
|
33
|
-
//#endregion
|
|
34
|
-
//#region src/runtime/reactor-client-mode.d.ts
|
|
35
|
-
/**
|
|
36
|
-
* Which of the four reactor clients Connect boots. Standardized by the
|
|
37
|
-
* multi-reactor work; this resolves the single selector Connect acts on:
|
|
38
|
-
*
|
|
39
|
-
* in-process | worker | remote | router
|
|
40
|
-
*
|
|
41
|
-
* Precedence: an explicit `?reactorClient=` query override (kept in
|
|
42
|
-
* localStorage so it survives a reload), then a stored override, then the
|
|
43
|
-
* served `connect.instance.reactorClient` (projected from the host's reactor
|
|
44
|
-
* backends), then the LEGACY booleans — so a config that only sets
|
|
45
|
-
* reactorWorker/multiReactor behaves exactly as before.
|
|
46
|
-
*
|
|
47
|
-
* `remote` is the only mode that builds NO local reactor (no PGlite): it is a
|
|
48
|
-
* pure client to a remote Switchboard. `router` keeps the local reactor and
|
|
49
|
-
* adds remote backends; `worker`/`in-process` are the local reactor alone.
|
|
50
|
-
*/
|
|
51
|
-
type ReactorClientMode = PHReactorClientMode;
|
|
52
|
-
declare const REACTOR_CLIENT_QUERY_KEY = "reactorClient";
|
|
53
|
-
declare const REACTOR_CLIENT_STORAGE_KEY = "ph:reactorClient";
|
|
54
|
-
declare function resolveReactorClientMode(): ReactorClientMode;
|
|
55
|
-
//#endregion
|
|
56
|
-
//#region src/runtime/graphql-routable-backend.d.ts
|
|
57
|
-
type GraphQLRoutableBackendOptions = Omit<GraphQLReactorClientOptions, "driveIdFor">;
|
|
58
|
-
type GraphQLRoutableBackend = {
|
|
59
|
-
readonly backend: IRoutableBackend;
|
|
60
|
-
/** The Switchboard's own facts, from its inspection subgraph. */
|
|
61
|
-
info(): Promise<ReactorInfo>;
|
|
62
|
-
/** Reopens the realtime socket on the new credentials. */
|
|
63
|
-
notifyCredentialsChanged(): void;
|
|
64
|
-
};
|
|
65
|
-
/** A Switchboard as a router backend; members GraphQL cannot serve are absent. */
|
|
66
|
-
declare function createGraphQLRoutableBackend(options: GraphQLRoutableBackendOptions): GraphQLRoutableBackend;
|
|
67
|
-
declare namespace multi_reactor_d_exports {
|
|
68
|
-
export { ConnectRoutingClient, GraphQLRoutableBackend, GraphQLRoutableBackendOptions, LOCAL_BACKEND_NAME, LoadedDocumentModels, LocalReactorModule, MultiReactorParams, PLACE_ON_LOCAL, PLACE_ON_REMOTE, REMOTE_BACKEND_NAME, buildMultiReactorClient, createGraphQLRoutableBackend, deriveSwitchboardGraphqlUrl, localFacts, localReach };
|
|
69
|
-
}
|
|
70
|
-
declare const LOCAL_BACKEND_NAME = "connect-local";
|
|
71
|
-
declare const REMOTE_BACKEND_NAME = "switchboard-remote";
|
|
72
|
-
type LocalReactorModule = BrowserReactorClientModule | WorkerReactorClientModule;
|
|
73
|
-
/** Only the tab's reactor is inspectable here, so new collections land on it. */
|
|
74
|
-
declare const PLACE_ON_LOCAL: CollectionRequirementsInput;
|
|
75
|
-
declare function localReach(kind: LocalReactorModule["kind"]): ReactorReach;
|
|
76
|
-
/** Read at every refresh, never kept: a rebuilt reactor reports its own. */
|
|
77
|
-
declare function localFacts(module: LocalReactorModule): () => Promise<ReactorInfo>;
|
|
78
|
-
/** `<origin>[/<prefix>]/d/<slug>` -> `<origin>[/<prefix>]/graphql`. */
|
|
79
|
-
declare function deriveSwitchboardGraphqlUrl(remoteDriveUrl: string): string | undefined;
|
|
80
|
-
/** The loaded document models, or a getter that reads the current ones. */
|
|
81
|
-
type LoadedDocumentModels = readonly DocumentModelModule[] | (() => readonly DocumentModelModule[]);
|
|
82
|
-
type MultiReactorParams = {
|
|
83
|
-
/** The local module, built and ready. Undefined builds a REMOTE-ONLY router
|
|
84
|
-
* (no local backend → no local reactor, no PGlite): the `remote` client. */
|
|
85
|
-
module: LocalReactorModule | undefined;
|
|
86
|
-
remoteGraphqlUrl: string;
|
|
87
|
-
/** Signs routed writes; unsigned (anonymous) without one. */
|
|
88
|
-
signer?: ISigner;
|
|
89
|
-
/** Signing models when the local module exposes no registry; the router asks the local reactor (or, remote-only, the loaded set). */
|
|
90
|
-
documentModelModules: LoadedDocumentModels;
|
|
91
|
-
onDiagnostic?: RouterDiagnostic;
|
|
92
|
-
};
|
|
93
|
-
/** Remote-only placement: the Switchboard serves every collection. (It offers
|
|
94
|
-
* no inspection surface over GraphQL, so PLACE_ON_LOCAL's `inspectable`
|
|
95
|
-
* requirement must NOT apply, or no backend would be eligible.) */
|
|
96
|
-
declare const PLACE_ON_REMOTE: CollectionRequirementsInput;
|
|
97
|
-
/** The router Connect installs, with Connect's handling of credentials and id checks. */
|
|
98
|
-
declare class ConnectRoutingClient extends RoutingReactorClient {
|
|
99
|
-
private readonly remote;
|
|
100
|
-
constructor(backends: readonly RoutableBackendConfig[], options: RoutingClientOptions, remote: GraphQLRoutableBackend, hasLocal: boolean);
|
|
101
|
-
/** Renown's sign-in and sign-out call this on whatever client is installed. */
|
|
102
|
-
notifyCredentialsChanged(): void;
|
|
103
|
-
}
|
|
104
|
-
/**
|
|
105
|
-
* Build the Connect routing client. With a local `module` it is the router
|
|
106
|
-
* over the tab's reactor (primary) and the Switchboard; WITHOUT one it is the
|
|
107
|
-
* `remote` client — a remote-only router whose single backend is the
|
|
108
|
-
* Switchboard, so no local reactor (and no PGlite) is built. Either way the
|
|
109
|
-
* result is a full IReactorClient the app graph consumes unchanged.
|
|
110
|
-
*/
|
|
111
|
-
declare function buildMultiReactorClient(params: MultiReactorParams): Promise<ConnectRoutingClient>;
|
|
112
|
-
//#endregion
|
|
113
|
-
//#region src/runtime/app-reactor-client.d.ts
|
|
114
|
-
type MultiReactorModule = typeof multi_reactor_d_exports;
|
|
115
|
-
type AppReactorClientParams = {
|
|
116
|
-
mode: ReactorClientMode;
|
|
117
|
-
/** Built, and ready (the worker has started up). Undefined in `remote`
|
|
118
|
-
* mode, where no local reactor is built. */
|
|
119
|
-
module: LocalReactorModule | undefined;
|
|
120
|
-
remoteDriveUrl: string | undefined;
|
|
121
|
-
/** Signs routed writes; unsigned (anonymous) without one. */
|
|
122
|
-
signer?: ISigner;
|
|
123
|
-
documentModelModules: LoadedDocumentModels;
|
|
124
|
-
loadRouter?: () => Promise<MultiReactorModule>;
|
|
125
|
-
};
|
|
126
|
-
/** What a mode builds in the tab; `remote` builds no local reactor (no PGlite). */
|
|
127
|
-
type ReactorClientPlan = {
|
|
128
|
-
mode: ReactorClientMode;
|
|
129
|
-
/** `router`: the local reactor plus remote backends. */
|
|
130
|
-
multiReactor: boolean;
|
|
131
|
-
needsLocalReactor: boolean;
|
|
132
|
-
/** The local reactor runs in the shared worker. */
|
|
133
|
-
localAsWorker: boolean;
|
|
134
|
-
};
|
|
135
|
-
declare function planReactorClient(mode?: ReactorClientMode): ReactorClientPlan;
|
|
136
|
-
/** Builds the tab's reactor, e.g. Connect's PGlite or worker reactor. */
|
|
137
|
-
type LocalReactorFactory = (plan: ReactorClientPlan) => Promise<LocalReactorModule>;
|
|
138
|
-
type CreateAppReactorClientOptions = Omit<AppReactorClientParams, "mode" | "module"> & {
|
|
139
|
-
plan?: ReactorClientPlan;
|
|
140
|
-
/** Called only when the plan needs a local reactor. */
|
|
141
|
-
localReactor?: LocalReactorFactory;
|
|
142
|
-
};
|
|
143
|
-
/** Builds the local reactor the plan needs, then selects the app's client. */
|
|
144
|
-
declare function createAppReactorClient(options: CreateAppReactorClientOptions): Promise<{
|
|
145
|
-
plan: ReactorClientPlan;
|
|
146
|
-
module: LocalReactorModule | undefined;
|
|
147
|
-
client: IReactorClient;
|
|
148
|
-
}>;
|
|
149
|
-
/**
|
|
150
|
-
* Pick the client for the resolved mode:
|
|
151
|
-
* - `in-process` / `worker`: the local client, router module never loaded.
|
|
152
|
-
* - `router`: the local reactor plus remote backends.
|
|
153
|
-
* - `remote`: a remote-only router — a full IReactorClient that proxies to
|
|
154
|
-
* the Switchboard over GraphQL with NO local reactor (no PGlite).
|
|
155
|
-
*/
|
|
156
|
-
declare function selectAppReactorClient(params: AppReactorClientParams): Promise<IReactorClient>;
|
|
157
|
-
/**
|
|
158
|
-
* A Switchboard that cannot answer must not fail boot: list the tab's drives.
|
|
159
|
-
*
|
|
160
|
-
* A Switchboard that REFUSES the caller (401/403) must not fail boot either:
|
|
161
|
-
* the refusal is recorded (`backendAuth`) so the root view shows the sign-in
|
|
162
|
-
* gate, and the drive list is empty until the user is someone the backend
|
|
163
|
-
* accepts. A remote-only client has no local drives to fall back on.
|
|
164
|
-
*/
|
|
165
|
-
declare function getAppDrives(client: IReactorClient, local: IReactorClient): Promise<DocumentDriveDocument[]>;
|
|
166
|
-
/**
|
|
167
|
-
* The boot refresh of the drives store. It lists through `getAppDrives`
|
|
168
|
-
* whichever client is in use, so a Switchboard that refuses the caller is
|
|
169
|
-
* recorded for the sign-in gate here too: the remote-only client is its own
|
|
170
|
-
* `local`, and a bare `refreshReactorDataClient` would let the 401 escape
|
|
171
|
-
* and fail the boot before the gate can render.
|
|
172
|
-
*/
|
|
173
|
-
declare function refreshAppDrives(client: IReactorClient, local: IReactorClient): Promise<void>;
|
|
174
|
-
/**
|
|
175
|
-
* Lists the drives again as the caller the tab now is, through the clients
|
|
176
|
-
* boot left in the store: after a sign-in landing or a sign-out that followed
|
|
177
|
-
* a backend's refusal. Nothing to do before boot has set a client.
|
|
178
|
-
*/
|
|
179
|
-
declare function relistAppDrives(): Promise<void>;
|
|
180
|
-
//#endregion
|
|
181
|
-
//#region src/runtime/ph-store.d.ts
|
|
182
|
-
/** The app's PH store: the active one, else a new one bound to `window.ph`.
|
|
183
|
-
* Values set on `window.ph` before carry over. */
|
|
184
|
-
declare function getConnectPHStore(): PHStore;
|
|
185
|
-
//#endregion
|
|
186
|
-
//#region src/runtime/local-package.d.ts
|
|
187
|
-
/** A module namespace, as `import * as pkg` or Vite HMR hands it over. */
|
|
188
|
-
type ModuleNamespace = Record<string, any> & {
|
|
189
|
-
[Symbol.toStringTag]: "Module";
|
|
190
|
-
};
|
|
191
|
-
type LocalPackage = DocumentModelLib<any> | ModuleNamespace;
|
|
192
|
-
/** The package itself, or a loader (`() => import("./index.js")`) that keeps it off the boot path. */
|
|
193
|
-
type LocalPackageSource = LocalPackage | (() => Promise<LocalPackage>);
|
|
194
|
-
/** Starts loading the project's package; a loader runs once, here. */
|
|
195
|
-
declare function loadLocalPackage(source: LocalPackageSource | undefined): DocumentModelLib | Promise<DocumentModelLib> | undefined;
|
|
196
|
-
//#endregion
|
|
197
|
-
export { isRuntimeFlagEnabled as A, REACTOR_WORKER_STORAGE_KEY as C, isMultiReactorEnabled as D, resolveReactorWorkerEnabled as E, RuntimeFlagInput as O, REACTOR_WORKER_QUERY_KEY as S, isReactorWorkerEnabled as T, LocalReactorModule as _, getConnectPHStore as a, ReactorClientMode as b, LocalReactorFactory as c, getAppDrives as d, planReactorClient as f, LoadedDocumentModels as g, selectAppReactorClient as h, loadLocalPackage as i, resolveRuntimeFlag as j, RuntimeFlagKeys as k, ReactorClientPlan as l, relistAppDrives as m, LocalPackageSource as n, AppReactorClientParams as o, refreshAppDrives as p, ModuleNamespace as r, CreateAppReactorClientOptions as s, LocalPackage as t, createAppReactorClient as u, REACTOR_CLIENT_QUERY_KEY as v, ReactorWorkerFlagInput as w, resolveReactorClientMode as x, REACTOR_CLIENT_STORAGE_KEY as y };
|
|
198
|
-
export {};
|
|
199
|
-
//# sourceMappingURL=index-BMlma368.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index-BMlma368.d.ts","names":[],"sources":["../src/runtime/runtime-flag.ts","../src/runtime/multi-reactor-flag.ts","../src/runtime/reactor-worker-flag.ts","../src/runtime/reactor-client-mode.ts","../src/runtime/graphql-routable-backend.ts","../src/runtime/multi-reactor.ts","../src/runtime/app-reactor-client.ts","../src/runtime/ph-store.ts","../src/runtime/local-package.ts"],"mappings":";;;;;;;;;;KAAY;EACV;EACA;EACA;;iBAIc,mBAAmB,OAAO;KAY9B;EACV;EACA;EACA;;iBAKc,qBAAqB,MAAM;;;iBCxB3B;;;cCIH;cACA;KAED,yBAAyB;iBAErB,4BACd,OAAO;iBAKO;;;;;;;;;;;;;;;;;;;KCGJ,oBAAoB;cASnB;cACA;iBA2BG,4BAA4B;;;KC2BhC,gCAAgC,KAC1C;KAIU;WACD,SAAS;;EAElB,QAAQ,QAAQ;;EAEhB;;;iBAIc,6BACd,SAAS,gCACR;;;;cCnEU;cACA;KAED,qBACR,6BACA;;cAQS,gBAAgB;iBAIb,WAAW,MAAM,6BAA6B;;iBAO9C,WACd,QAAQ,2BACD,QAAQ;;iBAcD,4BACd;;KAaU,gCACC,wCACO;KAER;;;EAGV,QAAQ;EACR;;EAEA,SAAS;;EAET,sBAAsB;EACtB,eAAe;;;;;cAMJ,iBAAiB;;cAwBjB,6BAA6B;mBACvB;EAEjB,YACE,mBAAmB,yBACnB,SAAS,sBACT,QAAQ,wBACR;;EAYF;;;;;;;;;iBAmBoB,wBACpB,QAAQ,qBACP,QAAQ;;;KCpJN,4BAA4B;KAErB;EACV,MAAM;;;EAGN,QAAQ;EACR;;EAEA,SAAS;EACT,sBAAsB;EACtB,mBAAmB,QAAQ;;;KAOjB;EACV,MAAM;;EAEN;EACA;;EAEA;;iBAGc,kBACd,OAAM,oBACL;;KAaS,uBACV,MAAM,sBACH,QAAQ;KAED,gCAAgC,KAC1C;EAGA,OAAO;;EAEP,eAAe;;;iBAIK,uBACpB,SAAS,gCAA6B;;;;;;;;;;;;iBA4BlB,uBACpB,QAAQ,yBACP,QAAQ;;;;;;;;;iBAoCW,aACpB,QAAQ,gBACR,OAAO,iBACN,QAAQ;;;;;;;;iBA4CW,iBACpB,QAAQ,gBACR,OAAO,iBACN;;;;;;iBASmB,mBAAmB;;;;;iBCpMzB,qBAAqB;;;;KCNzB,kBAAkB;GAC3B,OAAO;;KAGE,eAAe,wBAAwB;;KAGvC,qBAAqB,sBAAsB,QAAQ;;iBAG/C,iBACd,QAAQ,iCACP,mBAAmB,QAAQ"}
|
|
@@ -1,219 +0,0 @@
|
|
|
1
|
-
import { DRIVE_DOCUMENT_TYPES, GraphQLReactorClient, findIsServableOverGraphQL } from "@powerhousedao/reactor-browser";
|
|
2
|
-
import { logger } from "document-model";
|
|
3
|
-
import { JOB_NOT_FOUND_ERROR_NAME, JobStatus, createReactorInspector } from "@powerhousedao/reactor";
|
|
4
|
-
import { FanInPartialFailureError, RoutingReactorClient, fromReactorClient } from "@powerhousedao/reactor-router";
|
|
5
|
-
//#region src/runtime/graphql-routable-backend.ts
|
|
6
|
-
const REMOTE_INFO_QUERY = `
|
|
7
|
-
query RemoteReactorInfo {
|
|
8
|
-
inspection {
|
|
9
|
-
info {
|
|
10
|
-
storage {
|
|
11
|
-
engine
|
|
12
|
-
persistence
|
|
13
|
-
durable
|
|
14
|
-
selfHeal
|
|
15
|
-
}
|
|
16
|
-
workflows
|
|
17
|
-
syncChannels
|
|
18
|
-
}
|
|
19
|
-
}
|
|
20
|
-
}
|
|
21
|
-
`;
|
|
22
|
-
/** Ids and slugs of documents this backend answered as drives, by drive id. */
|
|
23
|
-
var KnownDrives = class {
|
|
24
|
-
ids = /* @__PURE__ */ new Map();
|
|
25
|
-
learn(document) {
|
|
26
|
-
const { id, slug, documentType } = document.header;
|
|
27
|
-
if (DRIVE_DOCUMENT_TYPES.includes(documentType)) {
|
|
28
|
-
this.ids.set(id, id);
|
|
29
|
-
if (slug) this.ids.set(slug, id);
|
|
30
|
-
}
|
|
31
|
-
return document;
|
|
32
|
-
}
|
|
33
|
-
learnPage(page) {
|
|
34
|
-
for (const document of page.results) this.learn(document);
|
|
35
|
-
return page;
|
|
36
|
-
}
|
|
37
|
-
driveOf(identifier) {
|
|
38
|
-
return identifier === void 0 ? void 0 : this.ids.get(identifier);
|
|
39
|
-
}
|
|
40
|
-
/** Names a drive only when this backend proved it is one. */
|
|
41
|
-
driveIdFor = (call) => {
|
|
42
|
-
switch (call.method) {
|
|
43
|
-
case "create":
|
|
44
|
-
case "find": return this.driveOf(call.parentId);
|
|
45
|
-
case "execute":
|
|
46
|
-
case "deleteDocument": return this.driveOf(call.documentId);
|
|
47
|
-
case "executeBatch":
|
|
48
|
-
for (const job of call.jobs ?? []) {
|
|
49
|
-
const drive = this.driveOf(job.documentId);
|
|
50
|
-
if (drive !== void 0) return drive;
|
|
51
|
-
}
|
|
52
|
-
return;
|
|
53
|
-
}
|
|
54
|
-
};
|
|
55
|
-
};
|
|
56
|
-
/** A Switchboard as a router backend; members GraphQL cannot serve are absent. */
|
|
57
|
-
function createGraphQLRoutableBackend(options) {
|
|
58
|
-
const drives = new KnownDrives();
|
|
59
|
-
const gql = new GraphQLReactorClient({
|
|
60
|
-
...options,
|
|
61
|
-
driveIdFor: drives.driveIdFor
|
|
62
|
-
});
|
|
63
|
-
return {
|
|
64
|
-
backend: {
|
|
65
|
-
supports: {
|
|
66
|
-
find: findIsServableOverGraphQL,
|
|
67
|
-
pointInTimeViews: false
|
|
68
|
-
},
|
|
69
|
-
drives: gql.read.drives,
|
|
70
|
-
get: async (identifier, view, signal) => drives.learn(await gql.get(identifier, view, signal)),
|
|
71
|
-
getMany: async (ids, view, signal) => (await gql.getMany(ids, view, signal)).map((document) => drives.learn(document)),
|
|
72
|
-
getOperations: (identifier, view, filter, paging, signal) => gql.getOperations(identifier, view, filter, paging, signal),
|
|
73
|
-
find: async (search, view, paging, signal) => drives.learnPage(await gql.find(search, view, paging, signal)),
|
|
74
|
-
isServed: (identifier, view, signal) => gql.isServed(identifier, view, signal),
|
|
75
|
-
getOutgoingRelationships: (source, type, view, paging, signal) => gql.getOutgoingRelationships(source, type, view, paging, signal),
|
|
76
|
-
getIncomingRelationships: (target, type, view, paging, signal) => gql.getIncomingRelationships(target, type, view, paging, signal),
|
|
77
|
-
getOutgoingRelationshipEdges: (source, type, view, paging, signal) => gql.getOutgoingRelationshipEdges(source, type, view, paging, signal),
|
|
78
|
-
getIncomingRelationshipEdges: (target, type, view, paging, signal) => gql.getIncomingRelationshipEdges(target, type, view, paging, signal),
|
|
79
|
-
subscribe: (search, callback, view) => gql.subscribe(search, callback, view),
|
|
80
|
-
getCreateSignaturePolicy: () => gql.getCreateSignaturePolicy(),
|
|
81
|
-
getCreateProtocolVersions: (options, signal) => gql.getCreateProtocolVersions(options, signal),
|
|
82
|
-
create: async (document, parent, signal) => drives.learn(await gql.create(document, parent, signal)),
|
|
83
|
-
execute: async (identifier, branch, actions, signal) => drives.learn(await gql.execute(identifier, branch, actions, signal)),
|
|
84
|
-
executeBatch: (request, signal) => gql.executeBatch(request, signal),
|
|
85
|
-
deleteDocument: (identifier, propagate, signal) => gql.deleteDocument(identifier, propagate, signal),
|
|
86
|
-
setPreferredEditor: (identifier, editor, branch, signal) => gql.setPreferredEditor(identifier, editor, branch, signal),
|
|
87
|
-
getJob: async (jobId, signal) => {
|
|
88
|
-
const job = await gql.getJob(jobId, signal);
|
|
89
|
-
return job?.status === JobStatus.FAILED && job.error?.name === JOB_NOT_FOUND_ERROR_NAME ? void 0 : job;
|
|
90
|
-
},
|
|
91
|
-
waitForJob: (job, signal) => gql.waitForJob(job, signal)
|
|
92
|
-
},
|
|
93
|
-
info: async () => {
|
|
94
|
-
return {
|
|
95
|
-
...(await gql.request(REMOTE_INFO_QUERY)).inspection.info,
|
|
96
|
-
access: {
|
|
97
|
-
admin: false,
|
|
98
|
-
sql: false
|
|
99
|
-
}
|
|
100
|
-
};
|
|
101
|
-
},
|
|
102
|
-
notifyCredentialsChanged: () => gql.notifyCredentialsChanged()
|
|
103
|
-
};
|
|
104
|
-
}
|
|
105
|
-
//#endregion
|
|
106
|
-
//#region src/runtime/multi-reactor.ts
|
|
107
|
-
const LOCAL_BACKEND_NAME = "connect-local";
|
|
108
|
-
const REMOTE_BACKEND_NAME = "switchboard-remote";
|
|
109
|
-
const REMOTE_REACH = Object.freeze({
|
|
110
|
-
hosting: "remote",
|
|
111
|
-
inspection: "none"
|
|
112
|
-
});
|
|
113
|
-
/** Only the tab's reactor is inspectable here, so new collections land on it. */
|
|
114
|
-
const PLACE_ON_LOCAL = Object.freeze({ inspectable: true });
|
|
115
|
-
function localReach(kind) {
|
|
116
|
-
return kind === "worker" ? {
|
|
117
|
-
hosting: "worker",
|
|
118
|
-
inspection: "rpc"
|
|
119
|
-
} : {
|
|
120
|
-
hosting: "in-process",
|
|
121
|
-
inspection: "direct"
|
|
122
|
-
};
|
|
123
|
-
}
|
|
124
|
-
/** Read at every refresh, never kept: a rebuilt reactor reports its own. */
|
|
125
|
-
function localFacts(module) {
|
|
126
|
-
if (module.kind === "worker") return () => module.inspector.info();
|
|
127
|
-
return async () => {
|
|
128
|
-
const reactorModule = module.reactorModule;
|
|
129
|
-
if (!reactorModule) throw new Error("The in-tab reactor exposes no module to inspect");
|
|
130
|
-
return createReactorInspector(reactorModule).info();
|
|
131
|
-
};
|
|
132
|
-
}
|
|
133
|
-
/** `<origin>[/<prefix>]/d/<slug>` -> `<origin>[/<prefix>]/graphql`. */
|
|
134
|
-
function deriveSwitchboardGraphqlUrl(remoteDriveUrl) {
|
|
135
|
-
let parsed;
|
|
136
|
-
try {
|
|
137
|
-
parsed = new URL(remoteDriveUrl);
|
|
138
|
-
} catch {
|
|
139
|
-
return;
|
|
140
|
-
}
|
|
141
|
-
const prefix = /^(.*)\/d\/[^/]+\/?$/.exec(parsed.pathname)?.[1];
|
|
142
|
-
return prefix === void 0 ? void 0 : `${parsed.origin}${prefix}/graphql`;
|
|
143
|
-
}
|
|
144
|
-
/** Remote-only placement: the Switchboard serves every collection. (It offers
|
|
145
|
-
* no inspection surface over GraphQL, so PLACE_ON_LOCAL's `inspectable`
|
|
146
|
-
* requirement must NOT apply, or no backend would be eligible.) */
|
|
147
|
-
const PLACE_ON_REMOTE = Object.freeze({});
|
|
148
|
-
/**
|
|
149
|
-
* The local answer stands when only the Switchboard could not answer -- but
|
|
150
|
-
* only when there IS a local backend. Remote-only has nothing to fall back to,
|
|
151
|
-
* so its errors surface. Installed as the router's `answerFailedIdCheck`, so
|
|
152
|
-
* the facade and `write.isDocumentIdTaken` both apply it.
|
|
153
|
-
*/
|
|
154
|
-
function localIdCheckAnswer(documentId, error) {
|
|
155
|
-
if (!failedOnlyOnRemote(error)) return;
|
|
156
|
-
logger.warn("The Switchboard could not say whether @id is taken; using the local reactor's answer: @error", documentId, error);
|
|
157
|
-
return false;
|
|
158
|
-
}
|
|
159
|
-
/** The router Connect installs, with Connect's handling of credentials and id checks. */
|
|
160
|
-
var ConnectRoutingClient = class extends RoutingReactorClient {
|
|
161
|
-
remote;
|
|
162
|
-
constructor(backends, options, remote, hasLocal) {
|
|
163
|
-
super(backends, {
|
|
164
|
-
...options,
|
|
165
|
-
answerFailedIdCheck: hasLocal ? localIdCheckAnswer : options.answerFailedIdCheck
|
|
166
|
-
});
|
|
167
|
-
this.remote = remote;
|
|
168
|
-
}
|
|
169
|
-
/** Renown's sign-in and sign-out call this on whatever client is installed. */
|
|
170
|
-
notifyCredentialsChanged() {
|
|
171
|
-
this.remote.notifyCredentialsChanged();
|
|
172
|
-
}
|
|
173
|
-
};
|
|
174
|
-
function failedOnlyOnRemote(error) {
|
|
175
|
-
return error instanceof FanInPartialFailureError && error.failures.every((failure) => failure.backend === "switchboard-remote");
|
|
176
|
-
}
|
|
177
|
-
/**
|
|
178
|
-
* Build the Connect routing client. With a local `module` it is the router
|
|
179
|
-
* over the tab's reactor (primary) and the Switchboard; WITHOUT one it is the
|
|
180
|
-
* `remote` client — a remote-only router whose single backend is the
|
|
181
|
-
* Switchboard, so no local reactor (and no PGlite) is built. Either way the
|
|
182
|
-
* result is a full IReactorClient the app graph consumes unchanged.
|
|
183
|
-
*/
|
|
184
|
-
async function buildMultiReactorClient(params) {
|
|
185
|
-
const module = params.module;
|
|
186
|
-
const registry = module?.reactorModule?.documentModelRegistry;
|
|
187
|
-
const loaded = params.documentModelModules;
|
|
188
|
-
const loadedModules = typeof loaded === "function" ? loaded : () => loaded;
|
|
189
|
-
const remote = createGraphQLRoutableBackend({
|
|
190
|
-
url: params.remoteGraphqlUrl,
|
|
191
|
-
documentModels: () => registry?.getAllModules() ?? loadedModules()
|
|
192
|
-
});
|
|
193
|
-
const remoteBackend = {
|
|
194
|
-
name: REMOTE_BACKEND_NAME,
|
|
195
|
-
backend: remote.backend,
|
|
196
|
-
facts: () => remote.info(),
|
|
197
|
-
reach: REMOTE_REACH,
|
|
198
|
-
refusesMisroutes: false
|
|
199
|
-
};
|
|
200
|
-
const router = new ConnectRoutingClient(module ? [{
|
|
201
|
-
name: LOCAL_BACKEND_NAME,
|
|
202
|
-
backend: fromReactorClient(module.client),
|
|
203
|
-
facts: localFacts(module),
|
|
204
|
-
reach: localReach(module.kind),
|
|
205
|
-
refusesMisroutes: false
|
|
206
|
-
}, remoteBackend] : [remoteBackend], {
|
|
207
|
-
primaryBackend: module ? LOCAL_BACKEND_NAME : REMOTE_BACKEND_NAME,
|
|
208
|
-
defaultRequirements: module ? PLACE_ON_LOCAL : PLACE_ON_REMOTE,
|
|
209
|
-
signer: params.signer,
|
|
210
|
-
onDiagnostic: params.onDiagnostic,
|
|
211
|
-
documentModelModules: module ? void 0 : loadedModules
|
|
212
|
-
}, remote, Boolean(module));
|
|
213
|
-
await router.refreshFacts();
|
|
214
|
-
return router;
|
|
215
|
-
}
|
|
216
|
-
//#endregion
|
|
217
|
-
export { ConnectRoutingClient, LOCAL_BACKEND_NAME, PLACE_ON_LOCAL, PLACE_ON_REMOTE, REMOTE_BACKEND_NAME, buildMultiReactorClient, createGraphQLRoutableBackend, deriveSwitchboardGraphqlUrl, localFacts, localReach };
|
|
218
|
-
|
|
219
|
-
//# sourceMappingURL=multi-reactor-D_2B4jmu.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"multi-reactor-D_2B4jmu.js","names":[],"sources":["../src/runtime/graphql-routable-backend.ts","../src/runtime/multi-reactor.ts"],"sourcesContent":["import {\n JOB_NOT_FOUND_ERROR_NAME,\n JobStatus,\n type PagedResults,\n type ReactorInfo,\n type ViewFilter,\n} from \"@powerhousedao/reactor\";\nimport {\n DRIVE_DOCUMENT_TYPES,\n findIsServableOverGraphQL,\n GraphQLReactorClient,\n type DriveIdCall,\n type GraphQLReactorClientOptions,\n} from \"@powerhousedao/reactor-browser\";\nimport type { IRoutableBackend } from \"@powerhousedao/reactor-router\";\nimport type { Action, PHDocument } from \"@powerhousedao/shared/document-model\";\n\nconst REMOTE_INFO_QUERY = /* GraphQL */ `\n query RemoteReactorInfo {\n inspection {\n info {\n storage {\n engine\n persistence\n durable\n selfHeal\n }\n workflows\n syncChannels\n }\n }\n }\n`;\n\ntype RemoteReactorInfo = {\n inspection: { info: Omit<ReactorInfo, \"access\"> };\n};\n\n/** Ids and slugs of documents this backend answered as drives, by drive id. */\nclass KnownDrives {\n private readonly ids = new Map<string, string>();\n\n learn<T extends PHDocument>(document: T): T {\n const { id, slug, documentType } = document.header;\n if ((DRIVE_DOCUMENT_TYPES as readonly string[]).includes(documentType)) {\n this.ids.set(id, id);\n if (slug) {\n this.ids.set(slug, id);\n }\n }\n return document;\n }\n\n learnPage<T extends PHDocument>(page: PagedResults<T>): PagedResults<T> {\n for (const document of page.results) {\n this.learn(document);\n }\n return page;\n }\n\n driveOf(identifier: string | undefined): string | undefined {\n return identifier === undefined ? undefined : this.ids.get(identifier);\n }\n\n /** Names a drive only when this backend proved it is one. */\n driveIdFor = (call: DriveIdCall): string | undefined => {\n switch (call.method) {\n case \"create\":\n case \"find\":\n return this.driveOf(call.parentId);\n case \"execute\":\n case \"deleteDocument\":\n return this.driveOf(call.documentId);\n case \"executeBatch\":\n for (const job of call.jobs ?? []) {\n const drive = this.driveOf(job.documentId);\n if (drive !== undefined) {\n return drive;\n }\n }\n return undefined;\n }\n };\n}\n\nexport type GraphQLRoutableBackendOptions = Omit<\n GraphQLReactorClientOptions,\n \"driveIdFor\"\n>;\n\nexport type GraphQLRoutableBackend = {\n readonly backend: IRoutableBackend;\n /** The Switchboard's own facts, from its inspection subgraph. */\n info(): Promise<ReactorInfo>;\n /** Reopens the realtime socket on the new credentials. */\n notifyCredentialsChanged(): void;\n};\n\n/** A Switchboard as a router backend; members GraphQL cannot serve are absent. */\nexport function createGraphQLRoutableBackend(\n options: GraphQLRoutableBackendOptions,\n): GraphQLRoutableBackend {\n const drives = new KnownDrives();\n const gql = new GraphQLReactorClient({\n ...options,\n driveIdFor: drives.driveIdFor,\n });\n const backend: IRoutableBackend = {\n supports: { find: findIsServableOverGraphQL, pointInTimeViews: false },\n drives: gql.read.drives,\n get: async <TDocument extends PHDocument>(\n identifier: string,\n view?: ViewFilter,\n signal?: AbortSignal,\n ) => drives.learn(await gql.get<TDocument>(identifier, view, signal)),\n getMany: async <TDocument extends PHDocument>(\n ids: string[],\n view?: ViewFilter,\n signal?: AbortSignal,\n ) =>\n (await gql.getMany<TDocument>(ids, view, signal)).map((document) =>\n drives.learn(document),\n ),\n getOperations: (identifier, view, filter, paging, signal) =>\n gql.getOperations(identifier, view, filter, paging, signal),\n find: async (search, view, paging, signal) =>\n drives.learnPage(await gql.find(search, view, paging, signal)),\n isServed: (identifier, view, signal) =>\n gql.isServed(identifier, view, signal),\n getOutgoingRelationships: (source, type, view, paging, signal) =>\n gql.getOutgoingRelationships(source, type, view, paging, signal),\n getIncomingRelationships: (target, type, view, paging, signal) =>\n gql.getIncomingRelationships(target, type, view, paging, signal),\n getOutgoingRelationshipEdges: (source, type, view, paging, signal) =>\n gql.getOutgoingRelationshipEdges(source, type, view, paging, signal),\n getIncomingRelationshipEdges: (target, type, view, paging, signal) =>\n gql.getIncomingRelationshipEdges(target, type, view, paging, signal),\n subscribe: (search, callback, view) =>\n gql.subscribe(search, callback, view),\n getCreateSignaturePolicy: () => gql.getCreateSignaturePolicy(),\n getCreateProtocolVersions: (options, signal) =>\n gql.getCreateProtocolVersions(options, signal),\n create: async <TDocument extends PHDocument = PHDocument>(\n document: PHDocument,\n parent?: string,\n signal?: AbortSignal,\n ) => drives.learn(await gql.create<TDocument>(document, parent, signal)),\n execute: async <TDocument extends PHDocument>(\n identifier: string,\n branch: string,\n actions: Action[],\n signal?: AbortSignal,\n ) =>\n drives.learn(\n await gql.execute<TDocument>(identifier, branch, actions, signal),\n ),\n executeBatch: (request, signal) => gql.executeBatch(request, signal),\n deleteDocument: (identifier, propagate, signal) =>\n gql.deleteDocument(identifier, propagate, signal),\n setPreferredEditor: (identifier, editor, branch, signal) =>\n gql.setPreferredEditor(identifier, editor, branch, signal),\n getJob: async (jobId, signal) => {\n const job = await gql.getJob(jobId, signal);\n return job?.status === JobStatus.FAILED &&\n job.error?.name === JOB_NOT_FOUND_ERROR_NAME\n ? undefined\n : job;\n },\n waitForJob: (job, signal) => gql.waitForJob(job, signal),\n };\n return {\n backend,\n info: async () => {\n const result = await gql.request<RemoteReactorInfo>(REMOTE_INFO_QUERY);\n return {\n ...result.inspection.info,\n access: { admin: false, sql: false },\n };\n },\n notifyCredentialsChanged: () => gql.notifyCredentialsChanged(),\n };\n}\n","import {\n createReactorInspector,\n type ReactorInfo,\n} from \"@powerhousedao/reactor\";\nimport type {\n BrowserReactorClientModule,\n WorkerReactorClientModule,\n} from \"@powerhousedao/reactor-browser\";\nimport {\n FanInPartialFailureError,\n fromReactorClient,\n RoutingReactorClient,\n type CollectionRequirementsInput,\n type ReactorReach,\n type RoutableBackendConfig,\n type RouterDiagnostic,\n type RoutingClientOptions,\n} from \"@powerhousedao/reactor-router\";\nimport type {\n DocumentModelModule,\n ISigner,\n} from \"@powerhousedao/shared/document-model\";\nimport { logger } from \"document-model\";\nimport {\n createGraphQLRoutableBackend,\n type GraphQLRoutableBackend,\n} from \"./graphql-routable-backend.js\";\n\nexport { createGraphQLRoutableBackend } from \"./graphql-routable-backend.js\";\nexport type {\n GraphQLRoutableBackend,\n GraphQLRoutableBackendOptions,\n} from \"./graphql-routable-backend.js\";\n\nexport const LOCAL_BACKEND_NAME = \"connect-local\";\nexport const REMOTE_BACKEND_NAME = \"switchboard-remote\";\n\nexport type LocalReactorModule =\n | BrowserReactorClientModule\n | WorkerReactorClientModule;\n\nconst REMOTE_REACH: ReactorReach = Object.freeze({\n hosting: \"remote\",\n inspection: \"none\",\n});\n\n/** Only the tab's reactor is inspectable here, so new collections land on it. */\nexport const PLACE_ON_LOCAL: CollectionRequirementsInput = Object.freeze({\n inspectable: true,\n});\n\nexport function localReach(kind: LocalReactorModule[\"kind\"]): ReactorReach {\n return kind === \"worker\"\n ? { hosting: \"worker\", inspection: \"rpc\" }\n : { hosting: \"in-process\", inspection: \"direct\" };\n}\n\n/** Read at every refresh, never kept: a rebuilt reactor reports its own. */\nexport function localFacts(\n module: LocalReactorModule,\n): () => Promise<ReactorInfo> {\n if (module.kind === \"worker\") {\n return () => module.inspector.info();\n }\n return async () => {\n const reactorModule = module.reactorModule;\n if (!reactorModule) {\n throw new Error(\"The in-tab reactor exposes no module to inspect\");\n }\n return createReactorInspector(reactorModule).info();\n };\n}\n\n/** `<origin>[/<prefix>]/d/<slug>` -> `<origin>[/<prefix>]/graphql`. */\nexport function deriveSwitchboardGraphqlUrl(\n remoteDriveUrl: string,\n): string | undefined {\n let parsed: URL;\n try {\n parsed = new URL(remoteDriveUrl);\n } catch {\n return undefined;\n }\n const prefix = /^(.*)\\/d\\/[^/]+\\/?$/.exec(parsed.pathname)?.[1];\n return prefix === undefined ? undefined : `${parsed.origin}${prefix}/graphql`;\n}\n\n/** The loaded document models, or a getter that reads the current ones. */\nexport type LoadedDocumentModels =\n | readonly DocumentModelModule[]\n | (() => readonly DocumentModelModule[]);\n\nexport type MultiReactorParams = {\n /** The local module, built and ready. Undefined builds a REMOTE-ONLY router\n * (no local backend → no local reactor, no PGlite): the `remote` client. */\n module: LocalReactorModule | undefined;\n remoteGraphqlUrl: string;\n /** Signs routed writes; unsigned (anonymous) without one. */\n signer?: ISigner;\n /** Signing models when the local module exposes no registry; the router asks the local reactor (or, remote-only, the loaded set). */\n documentModelModules: LoadedDocumentModels;\n onDiagnostic?: RouterDiagnostic;\n};\n\n/** Remote-only placement: the Switchboard serves every collection. (It offers\n * no inspection surface over GraphQL, so PLACE_ON_LOCAL's `inspectable`\n * requirement must NOT apply, or no backend would be eligible.) */\nexport const PLACE_ON_REMOTE: CollectionRequirementsInput = Object.freeze({});\n\n/**\n * The local answer stands when only the Switchboard could not answer -- but\n * only when there IS a local backend. Remote-only has nothing to fall back to,\n * so its errors surface. Installed as the router's `answerFailedIdCheck`, so\n * the facade and `write.isDocumentIdTaken` both apply it.\n */\nfunction localIdCheckAnswer(\n documentId: string,\n error: unknown,\n): boolean | undefined {\n if (!failedOnlyOnRemote(error)) {\n return undefined;\n }\n logger.warn(\n \"The Switchboard could not say whether @id is taken; using the local reactor's answer: @error\",\n documentId,\n error,\n );\n return false;\n}\n\n/** The router Connect installs, with Connect's handling of credentials and id checks. */\nexport class ConnectRoutingClient extends RoutingReactorClient {\n private readonly remote: GraphQLRoutableBackend;\n\n constructor(\n backends: readonly RoutableBackendConfig[],\n options: RoutingClientOptions,\n remote: GraphQLRoutableBackend,\n hasLocal: boolean,\n ) {\n super(backends, {\n ...options,\n answerFailedIdCheck: hasLocal\n ? localIdCheckAnswer\n : options.answerFailedIdCheck,\n });\n this.remote = remote;\n }\n\n /** Renown's sign-in and sign-out call this on whatever client is installed. */\n notifyCredentialsChanged(): void {\n this.remote.notifyCredentialsChanged();\n }\n}\n\nfunction failedOnlyOnRemote(error: unknown): boolean {\n return (\n error instanceof FanInPartialFailureError &&\n error.failures.every((failure) => failure.backend === REMOTE_BACKEND_NAME)\n );\n}\n\n/**\n * Build the Connect routing client. With a local `module` it is the router\n * over the tab's reactor (primary) and the Switchboard; WITHOUT one it is the\n * `remote` client — a remote-only router whose single backend is the\n * Switchboard, so no local reactor (and no PGlite) is built. Either way the\n * result is a full IReactorClient the app graph consumes unchanged.\n */\nexport async function buildMultiReactorClient(\n params: MultiReactorParams,\n): Promise<ConnectRoutingClient> {\n const module = params.module;\n const registry = module?.reactorModule?.documentModelRegistry;\n const loaded = params.documentModelModules;\n const loadedModules = typeof loaded === \"function\" ? loaded : () => loaded;\n const remote = createGraphQLRoutableBackend({\n url: params.remoteGraphqlUrl,\n documentModels: () => registry?.getAllModules() ?? loadedModules(),\n });\n const remoteBackend: RoutableBackendConfig = {\n name: REMOTE_BACKEND_NAME,\n backend: remote.backend,\n facts: () => remote.info(),\n reach: REMOTE_REACH,\n refusesMisroutes: false,\n };\n const backends: RoutableBackendConfig[] = module\n ? [\n {\n name: LOCAL_BACKEND_NAME,\n backend: fromReactorClient(module.client),\n facts: localFacts(module),\n reach: localReach(module.kind),\n refusesMisroutes: false,\n },\n remoteBackend,\n ]\n : [remoteBackend];\n const router = new ConnectRoutingClient(\n backends,\n {\n // Remote-only: the Switchboard is primary and serves every collection;\n // with a local reactor, new collections land on it (inspectable).\n primaryBackend: module ? LOCAL_BACKEND_NAME : REMOTE_BACKEND_NAME,\n defaultRequirements: module ? PLACE_ON_LOCAL : PLACE_ON_REMOTE,\n signer: params.signer,\n onDiagnostic: params.onDiagnostic,\n // The Switchboard serves no models over GraphQL; remote-only uses the loaded set.\n documentModelModules: module ? undefined : loadedModules,\n },\n remote,\n Boolean(module),\n );\n await router.refreshFacts();\n return router;\n}\n"],"mappings":";;;;;AAiBA,MAAM,oBAAkC;;;;;;;;;;;;;;;;;AAsBxC,IAAM,cAAN,MAAkB;CAChB,sBAAuB,IAAI,IAAoB;CAE/C,MAA4B,UAAgB;EAC1C,MAAM,EAAE,IAAI,MAAM,iBAAiB,SAAS;EAC5C,IAAK,qBAA2C,SAAS,YAAY,GAAG;GACtE,KAAK,IAAI,IAAI,IAAI,EAAE;GACnB,IAAI,MACF,KAAK,IAAI,IAAI,MAAM,EAAE;EAEzB;EACA,OAAO;CACT;CAEA,UAAgC,MAAwC;EACtE,KAAK,MAAM,YAAY,KAAK,SAC1B,KAAK,MAAM,QAAQ;EAErB,OAAO;CACT;CAEA,QAAQ,YAAoD;EAC1D,OAAO,eAAe,KAAA,IAAY,KAAA,IAAY,KAAK,IAAI,IAAI,UAAU;CACvE;;CAGA,cAAc,SAA0C;EACtD,QAAQ,KAAK,QAAb;GACE,KAAK;GACL,KAAK,QACH,OAAO,KAAK,QAAQ,KAAK,QAAQ;GACnC,KAAK;GACL,KAAK,kBACH,OAAO,KAAK,QAAQ,KAAK,UAAU;GACrC,KAAK;IACH,KAAK,MAAM,OAAO,KAAK,QAAQ,CAAC,GAAG;KACjC,MAAM,QAAQ,KAAK,QAAQ,IAAI,UAAU;KACzC,IAAI,UAAU,KAAA,GACZ,OAAO;IAEX;IACA;EACJ;CACF;AACF;;AAgBA,SAAgB,6BACd,SACwB;CACxB,MAAM,SAAS,IAAI,YAAY;CAC/B,MAAM,MAAM,IAAI,qBAAqB;EACnC,GAAG;EACH,YAAY,OAAO;CACrB,CAAC;CAgED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