@powerhousedao/connect 6.2.3-dev.9 → 6.2.3
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/{AddDriveModal-xAw48kdl.js → AddDriveModal-DhNfP94R.js} +5 -5
- package/dist/{AddDriveModal-xAw48kdl.js.map → AddDriveModal-DhNfP94R.js.map} +1 -1
- package/dist/{ClearStorageModal-C1BXHTq3.js → ClearStorageModal-DyU-FIgY.js} +5 -5
- package/dist/{ClearStorageModal-C1BXHTq3.js.map → ClearStorageModal-DyU-FIgY.js.map} +1 -1
- package/dist/{ConfirmDocumentUpgradeModal-FUOhZsk7.js → ConfirmDocumentUpgradeModal-DcOZy20m.js} +8 -7
- package/dist/{ConfirmDocumentUpgradeModal-FUOhZsk7.js.map → ConfirmDocumentUpgradeModal-DcOZy20m.js.map} +1 -1
- package/dist/{CookiesPolicyModal-BpyPPyxS.js → CookiesPolicyModal-BLw4pnhn.js} +4 -4
- package/dist/{CookiesPolicyModal-BpyPPyxS.js.map → CookiesPolicyModal-BLw4pnhn.js.map} +1 -1
- package/dist/{CreateDocumentModal-C45W8J0V.js → CreateDocumentModal-Bmv0V-kY.js} +6 -5
- package/dist/{CreateDocumentModal-C45W8J0V.js.map → CreateDocumentModal-Bmv0V-kY.js.map} +1 -1
- package/dist/{DebugSettingsModal-ClqHzcxM.js → DebugSettingsModal-CwUN9gIr.js} +7 -7
- package/dist/{DebugSettingsModal-ClqHzcxM.js.map → DebugSettingsModal-CwUN9gIr.js.map} +1 -1
- package/dist/{DeleteDriveModal-Dug84t1j.js → DeleteDriveModal-CjGnG0ht.js} +5 -5
- package/dist/{DeleteDriveModal-Dug84t1j.js.map → DeleteDriveModal-CjGnG0ht.js.map} +1 -1
- package/dist/{DeleteItemModal-mMzy3V8o.js → DeleteItemModal-BbY_4_xT.js} +5 -5
- package/dist/{DeleteItemModal-mMzy3V8o.js.map → DeleteItemModal-BbY_4_xT.js.map} +1 -1
- package/dist/{DisclaimerModal-DvpD5dPM.js → DisclaimerModal-DuglmEwL.js} +4 -4
- package/dist/{DisclaimerModal-DvpD5dPM.js.map → DisclaimerModal-DuglmEwL.js.map} +1 -1
- package/dist/{DocumentVersionUnsupportedModal-C3Q0V75l.js → DocumentVersionUnsupportedModal-C4fy7fZ6.js} +4 -4
- package/dist/{DocumentVersionUnsupportedModal-C3Q0V75l.js.map → DocumentVersionUnsupportedModal-C4fy7fZ6.js.map} +1 -1
- package/dist/{DownloadDocumentWithErrorsModal-IKl0ljQb.js → DownloadDocumentWithErrorsModal-BsPQ5qgy.js} +6 -5
- package/dist/{DownloadDocumentWithErrorsModal-IKl0ljQb.js.map → DownloadDocumentWithErrorsModal-BsPQ5qgy.js.map} +1 -1
- package/dist/{DriveAuthRequiredModal-DVK7ZQzO.js → DriveAuthRequiredModal-CtsB0kwH.js} +5 -5
- package/dist/{DriveAuthRequiredModal-DVK7ZQzO.js.map → DriveAuthRequiredModal-CtsB0kwH.js.map} +1 -1
- package/dist/{DriveSettingsModal-C6-mRQiv.js → DriveSettingsModal-d1L0eYof.js} +4 -4
- package/dist/{DriveSettingsModal-C6-mRQiv.js.map → DriveSettingsModal-d1L0eYof.js.map} +1 -1
- package/dist/{InspectorModal-7FQBTEzt.js → InspectorModal-Cd8kbCV8.js} +61 -21
- package/dist/InspectorModal-Cd8kbCV8.js.map +1 -0
- package/dist/{LoginModal-CybbOm3N.js → LoginModal-CI0ogC2-.js} +5 -5
- package/dist/{LoginModal-CybbOm3N.js.map → LoginModal-CI0ogC2-.js.map} +1 -1
- package/dist/{MissingPackageModal-nBnExqO0.js → MissingPackageModal-HFUPQMML.js} +5 -5
- package/dist/{MissingPackageModal-nBnExqO0.js.map → MissingPackageModal-HFUPQMML.js.map} +1 -1
- package/dist/{OpenFileDocumentsModal-DGaYJpXW.js → OpenFileDocumentsModal-BQsaBP4x.js} +8 -7
- package/dist/{OpenFileDocumentsModal-DGaYJpXW.js.map → OpenFileDocumentsModal-BQsaBP4x.js.map} +1 -1
- package/dist/{SettingsModal-CPv3_jmp.js → SettingsModal-CgjW-M2a.js} +17 -15
- package/dist/{SettingsModal-CPv3_jmp.js.map → SettingsModal-CgjW-M2a.js.map} +1 -1
- package/dist/{UpgradeDriveModal-_8t9slxQ.js → UpgradeDriveModal-CXX6D5Au.js} +4 -4
- package/dist/{UpgradeDriveModal-_8t9slxQ.js.map → UpgradeDriveModal-CXX6D5Au.js.map} +1 -1
- package/dist/app-loader-D2bV-77j.js +4 -0
- package/dist/{app-loader-DyGcBhGV.js → app-loader-l5wtQh5z.js} +1160 -1121
- package/dist/app-loader-l5wtQh5z.js.map +1 -0
- package/dist/app-skeleton--Me5zlSz.js +112 -0
- package/dist/app-skeleton--Me5zlSz.js.map +1 -0
- package/dist/app-skeleton-CBN4tenZ.js +4 -0
- package/dist/boot-DPNEOI2A.js +210 -0
- package/dist/boot-DPNEOI2A.js.map +1 -0
- package/dist/buffer-DNTcuap_.js +66 -0
- package/dist/buffer-DNTcuap_.js.map +1 -0
- package/dist/{build-info-D9_h0032.js → build-info-BV8UtyA4.js} +5 -5
- package/dist/{build-info-D9_h0032.js.map → build-info-BV8UtyA4.js.map} +1 -1
- package/dist/components-BH57lxCU.js +5 -0
- package/dist/{connect.config-DaHDEUrw.js → connect.config-CaXMoB42.js} +24 -12
- package/dist/connect.config-CaXMoB42.js.map +1 -0
- package/dist/{connection-state-3w4liC1X.js → connection-state-Eqc2izmt.js} +6 -6
- package/dist/{connection-state-3w4liC1X.js.map → connection-state-Eqc2izmt.js.map} +1 -1
- package/dist/{cookie-banner-BH6bIq24.js → cookie-banner-BxXvPdIY.js} +6 -6
- package/dist/{cookie-banner-BH6bIq24.js.map → cookie-banner-BxXvPdIY.js.map} +1 -1
- package/dist/{i18n-CWO0vYVd.js → i18n-CTgT1HG-.js} +3 -3
- package/dist/{i18n-CWO0vYVd.js.map → i18n-CTgT1HG-.js.map} +1 -1
- package/dist/{load-Cu7S9GPc.js → load-ftpCX1HI.js} +13 -11
- package/dist/{load-Cu7S9GPc.js.map → load-ftpCX1HI.js.map} +1 -1
- package/dist/main.d.ts +2 -1
- package/dist/main.js +8 -8
- package/dist/main.js.map +1 -1
- package/dist/package-manager-BbzIV9aN.js +485 -0
- package/dist/package-manager-BbzIV9aN.js.map +1 -0
- package/dist/{pglite-major-B39aOEiE.js → pglite-major-p4_YefAE.js} +23 -5
- package/dist/pglite-major-p4_YefAE.js.map +1 -0
- package/dist/{pglite-migrate-core-Boxqqx-c.js → pglite-migrate-core-BcXcImng.js} +8 -6
- package/dist/{pglite-migrate-core-Boxqqx-c.js.map → pglite-migrate-core-BcXcImng.js.map} +1 -1
- package/dist/{pglite-seed-BqAUvNFw.js → pglite-seed-Cl2d-iyl.js} +4 -4
- package/dist/{pglite-seed-BqAUvNFw.js.map → pglite-seed-Cl2d-iyl.js.map} +1 -1
- package/dist/pglite.worker.d.ts +2 -1
- package/dist/pglite.worker.js +4 -3
- package/dist/pglite.worker.js.map +1 -1
- package/dist/pglite.worker.legacy.d.ts +2 -1
- package/dist/pglite.worker.legacy.js +4 -3
- package/dist/pglite.worker.legacy.js.map +1 -1
- package/dist/{preferences-store-_5Cw4_YV.js → preferences-store-DZUIAkHE.js} +6 -25
- package/dist/preferences-store-DZUIAkHE.js.map +1 -0
- package/dist/{pwa-manifest-link-DIgOSo2Q.js → pwa-manifest-link-DQRJpF0r.js} +3 -3
- package/dist/{pwa-manifest-link-DIgOSo2Q.js.map → pwa-manifest-link-DQRJpF0r.js.map} +1 -1
- package/dist/{reactor-yC8BveHb.js → reactor-CItc8KaF.js} +68 -437
- package/dist/reactor-CItc8KaF.js.map +1 -0
- package/dist/reactor.worker.d.ts +2 -1
- package/dist/reactor.worker.js +76 -21
- package/dist/reactor.worker.js.map +1 -1
- package/dist/{registerServiceWorker-BSzbNfvz.js → registerServiceWorker-smkROQhm.js} +5 -5
- package/dist/{registerServiceWorker-BSzbNfvz.js.map → registerServiceWorker-smkROQhm.js.map} +1 -1
- package/dist/renown-trust-DRgHpxlZ.js +34 -0
- package/dist/renown-trust-DRgHpxlZ.js.map +1 -0
- package/dist/{runtime-config-DL3QjcfM.js → runtime-config-DtJIUgYw.js} +3 -3
- package/dist/{runtime-config-DL3QjcfM.js.map → runtime-config-DtJIUgYw.js.map} +1 -1
- package/dist/{sentry-QXKgQmr2.js → sentry-jfDyrxdX.js} +3 -3
- package/dist/{sentry-QXKgQmr2.js.map → sentry-jfDyrxdX.js.map} +1 -1
- package/dist/start-connect.d.ts +4 -5
- package/dist/start-connect.d.ts.map +1 -1
- package/dist/start-connect.js +6 -8
- package/dist/start-connect.js.map +1 -1
- package/dist/style.css +2907 -1
- package/dist/{toast-BXIGd4Eb.js → toast-C6WW-_O-.js} +3 -3
- package/dist/{toast-BXIGd4Eb.js.map → toast-C6WW-_O-.js.map} +1 -1
- package/dist/{use-renown-login-Cf3va6u_.js → use-renown-login-BzOSQETV.js} +3 -3
- package/dist/{use-renown-login-Cf3va6u_.js.map → use-renown-login-BzOSQETV.js.map} +1 -1
- package/dist/useIsEmbedded-BWJ0qb7w.js +26 -0
- package/dist/useIsEmbedded-BWJ0qb7w.js.map +1 -0
- package/dist/{useRegistryPackages-BnUcL_nZ.js → useRegistryPackages-DuoU75ap.js} +73 -10
- package/dist/useRegistryPackages-DuoU75ap.js.map +1 -0
- package/package.json +19 -19
- package/style.css +7 -5
- package/dist/InspectorModal-7FQBTEzt.js.map +0 -1
- package/dist/app-loader-C4pFYc82.js +0 -4
- package/dist/app-loader-DyGcBhGV.js.map +0 -1
- package/dist/components-MEmS6hgr.js +0 -4
- package/dist/connect.config-DaHDEUrw.js.map +0 -1
- package/dist/pglite-major-B39aOEiE.js.map +0 -1
- package/dist/preferences-store-_5Cw4_YV.js.map +0 -1
- package/dist/reactor-yC8BveHb.js.map +0 -1
- package/dist/useRegistryPackages-BnUcL_nZ.js.map +0 -1
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
|
|
2
|
-
!function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="
|
|
3
|
-
import { n as getRuntimeConfig } from "./runtime-config-
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import { n as buildPHGlobalConfig, o as phGlobalConfig } from "./connect.config-
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
2
|
+
!function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="e9dffb1a-3523-5af8-8cad-60683e091ce0")}catch(e){}}();
|
|
3
|
+
import { n as getRuntimeConfig } from "./runtime-config-DtJIUgYw.js";
|
|
4
|
+
import { t as createConnectSignerConfig } from "./renown-trust-DRgHpxlZ.js";
|
|
5
|
+
import { a as resolvePgMajorForRuntime, f as toStoredDocumentsRefused, r as loadPGliteModule } from "./pglite-major-p4_YefAE.js";
|
|
6
|
+
import { n as buildPHGlobalConfig, o as phGlobalConfig, r as connectConfig } from "./connect.config-CaXMoB42.js";
|
|
7
|
+
import { r as toast } from "./toast-C6WW-_O-.js";
|
|
8
|
+
import { r as getSharedDeps, t as BrowserPackageManager } from "./package-manager-BbzIV9aN.js";
|
|
9
|
+
import { i as getVersion, n as getGitSha } from "./build-info-BV8UtyA4.js";
|
|
10
|
+
import { a as detectReactorPgMajor, h as RELATIONAL_PGLITE_NAME, m as REACTOR_PGLITE_NAME, n as setWorkerConnectionStatus, o as detectRelationalPgMajor, p as REACTOR_INSTANCE_NAMESPACE } from "./connection-state-Eqc2izmt.js";
|
|
11
11
|
import { createRelationalDb } from "@powerhousedao/shared/processors";
|
|
12
12
|
import { DocumentModelRegistry, DocumentModelResolver, ReactorEventTypes, createReactorHostModuleBase } from "@powerhousedao/reactor";
|
|
13
13
|
import { MessageRouter, RPC_PROTOCOL_VERSION, SyncManagerProxy, connectReactorClient, createInspectorProxy, createPortTransport, createReactorEventBusProxy, createRelationalPgliteProxy, createWorkerAdminClient, postReactorIdentity } from "@powerhousedao/reactor-browser/rpc";
|
|
@@ -15,90 +15,9 @@ import { Kysely } from "kysely";
|
|
|
15
15
|
import { PGliteDialect } from "kysely-pglite-dialect";
|
|
16
16
|
import { BrowserLocalStorage, ChannelScheme as ChannelScheme$1, DRIVE_DOCUMENT_TYPES, DocumentCache, DocumentChangeType, ReactorBuilder as ReactorBuilder$1, ReactorClientBuilder as ReactorClientBuilder$1, RegistryClient, addDrive, addPHEventHandlers, addRemoteDrive, createAnalyticsStore, extractDriveSlugFromPath, extractNodeSlugFromPath, getDrives, isDriveAuthError, login, refreshReactorDataClient, setAttachmentService, setDefaultPHGlobalConfig, setDocumentCache, setDriveMetadata, setDrives, setFeatures, setPGliteDB, setPHToast, setPackageDiscoveryService, setReactorClient, setReactorClientModule, setRenown, setSelectedDrive, setSelectedNode, setVetraPackageManager, waitForDocumentReady } from "@powerhousedao/reactor-browser";
|
|
17
17
|
import { ConsoleLogger, logger, setLogLevel as setLogLevel$1 } from "document-model";
|
|
18
|
-
import { BrowserKeyStorage, RenownBuilder, RenownCryptoBuilder, createSignatureVerifier } from "@renown/sdk";
|
|
19
|
-
import { PwaConfigSchema } from "@powerhousedao/shared/document-model";
|
|
20
18
|
import { createAttachmentClient, createRemoteAttachmentService, createXhrUploadTransport } from "@powerhousedao/reactor-attachments/client";
|
|
19
|
+
import { BrowserKeyStorage, RenownBuilder, RenownCryptoBuilder } from "@renown/sdk";
|
|
21
20
|
import { OpenFeature } from "@openfeature/web-sdk";
|
|
22
|
-
import * as common from "@powerhousedao/powerhouse-vetra-packages";
|
|
23
|
-
import commonPkg from "@powerhousedao/powerhouse-vetra-packages/package.json" with { type: "json" };
|
|
24
|
-
import { toCdnUrl } from "@powerhousedao/shared/registry/urls";
|
|
25
|
-
import vetraPkg from "@powerhousedao/vetra/package.json" with { type: "json" };
|
|
26
|
-
//#region src/utils/pwa-idb.ts
|
|
27
|
-
function openPwaIdb() {
|
|
28
|
-
return new Promise((resolve, reject) => {
|
|
29
|
-
const req = indexedDB.open(PWA_IDB_NAME, PWA_IDB_VERSION);
|
|
30
|
-
req.onupgradeneeded = () => {
|
|
31
|
-
if (!req.result.objectStoreNames.contains(PWA_IDB_STORE)) req.result.createObjectStore(PWA_IDB_STORE);
|
|
32
|
-
};
|
|
33
|
-
req.onerror = () => reject(req.error ?? /* @__PURE__ */ new Error("ph-pwa open failed"));
|
|
34
|
-
req.onblocked = () => reject(/* @__PURE__ */ new Error("ph-pwa open blocked"));
|
|
35
|
-
req.onsuccess = () => resolve(req.result);
|
|
36
|
-
});
|
|
37
|
-
}
|
|
38
|
-
/** Write (replace) the single merged fragment record. Best-effort: a failure to
|
|
39
|
-
* mirror the manifest must never break package installation, so callers ignore
|
|
40
|
-
* rejections. No-op when IndexedDB is unavailable (SSR/tests). */
|
|
41
|
-
async function writeMergedPwaFragment(fragment) {
|
|
42
|
-
if (typeof indexedDB === "undefined") return;
|
|
43
|
-
const db = await openPwaIdb();
|
|
44
|
-
try {
|
|
45
|
-
await new Promise((resolve, reject) => {
|
|
46
|
-
const tx = db.transaction(PWA_IDB_STORE, "readwrite");
|
|
47
|
-
tx.oncomplete = () => resolve();
|
|
48
|
-
tx.onerror = () => reject(tx.error ?? /* @__PURE__ */ new Error("PWA fragment write failed"));
|
|
49
|
-
tx.objectStore(PWA_IDB_STORE).put({
|
|
50
|
-
version: 1,
|
|
51
|
-
fragment,
|
|
52
|
-
updatedAt: Date.now()
|
|
53
|
-
}, PWA_IDB_KEY);
|
|
54
|
-
});
|
|
55
|
-
} finally {
|
|
56
|
-
db.close();
|
|
57
|
-
}
|
|
58
|
-
}
|
|
59
|
-
/** Resolve `src` against the package `baseUrl`, absolute srcs passing through.
|
|
60
|
-
* `baseUrl` may itself be relative (e.g. a same-origin-proxied registry, or the
|
|
61
|
-
* dev `/node_modules/…` path), so it is first made absolute against the app
|
|
62
|
-
* origin — `new URL(src, relativeBase)` would otherwise throw and silently
|
|
63
|
-
* leave the src unresolved. A malformed src is left untouched. */
|
|
64
|
-
function toAbsoluteAssetUrl(src, baseUrl) {
|
|
65
|
-
try {
|
|
66
|
-
const origin = typeof location !== "undefined" ? location.href : "http://localhost/";
|
|
67
|
-
return new URL(src, new URL(baseUrl, origin)).toString();
|
|
68
|
-
} catch {
|
|
69
|
-
return src;
|
|
70
|
-
}
|
|
71
|
-
}
|
|
72
|
-
function resolveIconSrc(icon, baseUrl) {
|
|
73
|
-
return {
|
|
74
|
-
...icon,
|
|
75
|
-
src: toAbsoluteAssetUrl(icon.src, baseUrl)
|
|
76
|
-
};
|
|
77
|
-
}
|
|
78
|
-
/**
|
|
79
|
-
* Rewrite a package fragment's relative asset srcs (manifest icons and
|
|
80
|
-
* file-handler icons) to absolute URLs against the package's base — a runtime
|
|
81
|
-
* package's assets live on the registry CDN, not the app origin, so the served
|
|
82
|
-
* manifest must point there. `baseUrl` null (a local/bundled package whose
|
|
83
|
-
* assets are app-origin-relative) leaves srcs untouched.
|
|
84
|
-
*/
|
|
85
|
-
function resolveFragmentAssetUrls(config, baseUrl) {
|
|
86
|
-
if (!baseUrl || !config.manifest) return config;
|
|
87
|
-
const m = config.manifest;
|
|
88
|
-
const resolveIcons = (icons) => icons?.map((icon) => resolveIconSrc(icon, baseUrl));
|
|
89
|
-
return {
|
|
90
|
-
...config,
|
|
91
|
-
manifest: {
|
|
92
|
-
...m,
|
|
93
|
-
icons: resolveIcons(m.icons),
|
|
94
|
-
file_handlers: m.file_handlers?.map((handler) => ({
|
|
95
|
-
...handler,
|
|
96
|
-
icons: resolveIcons(handler.icons)
|
|
97
|
-
}))
|
|
98
|
-
}
|
|
99
|
-
};
|
|
100
|
-
}
|
|
101
|
-
//#endregion
|
|
102
21
|
//#region src/pglite.db.ts
|
|
103
22
|
async function createMainThreadPGlite(major, dbName) {
|
|
104
23
|
const { PGlite } = await loadPGliteModule(major);
|
|
@@ -153,20 +72,25 @@ async function getDb() {
|
|
|
153
72
|
* Creates a Reactor that plugs into legacy storage but syncs through the new
|
|
154
73
|
* Reactor GQL API.
|
|
155
74
|
*/
|
|
156
|
-
async function createBrowserReactor(documentModelModules, upgradeManifests, renown, featureFlags, documentModelLoader) {
|
|
157
|
-
const signerConfig =
|
|
158
|
-
signer: renown.signer,
|
|
159
|
-
verifier: createSignatureVerifier()
|
|
160
|
-
};
|
|
75
|
+
async function createBrowserReactor(documentModelModules, upgradeManifests, renown, featureFlags, documentModelLoader, createSignaturePolicy, renownEndpoints = {}, unsupportedStoredDocuments) {
|
|
76
|
+
const signerConfig = await createConnectSignerConfig(renown.signer, featureFlags, renownEndpoints);
|
|
161
77
|
const jwtHandler = async (_url) => {
|
|
162
78
|
if (!renown.user) return;
|
|
163
79
|
return renown.getBearerToken({ expiresIn: 10 });
|
|
164
80
|
};
|
|
165
81
|
const pg = await getReactorPGlite();
|
|
166
82
|
const logger = new ConsoleLogger(["reactor-client"]);
|
|
167
|
-
const
|
|
83
|
+
const reactorBuilder = new ReactorBuilder$1().withDocumentModelSources(documentModelModules).withUpgradeManifests(upgradeManifests).withChannelScheme(ChannelScheme$1.CONNECT).withExecutorConfig({ featureFlags }).withJwtHandler(jwtHandler).withKysely(new Kysely({ dialect: new PGliteDialect(pg) }));
|
|
84
|
+
const builder = new ReactorClientBuilder$1().withLogger(logger).withSigner(signerConfig).withReactorBuilder(reactorBuilder);
|
|
168
85
|
if (documentModelLoader) builder.withDocumentModelLoader(documentModelLoader);
|
|
169
|
-
|
|
86
|
+
if (createSignaturePolicy) builder.withCreateSignaturePolicy(createSignaturePolicy);
|
|
87
|
+
if (unsupportedStoredDocuments) reactorBuilder.withUnsupportedStoredDocuments(unsupportedStoredDocuments);
|
|
88
|
+
let module;
|
|
89
|
+
try {
|
|
90
|
+
module = await builder.buildModule();
|
|
91
|
+
} catch (error) {
|
|
92
|
+
throw toStoredDocumentsRefused(error);
|
|
93
|
+
}
|
|
170
94
|
return {
|
|
171
95
|
...module,
|
|
172
96
|
kind: "browser",
|
|
@@ -683,325 +607,6 @@ var PackageDiscoveryService = class {
|
|
|
683
607
|
}
|
|
684
608
|
};
|
|
685
609
|
//#endregion
|
|
686
|
-
//#region src/package-manager.ts
|
|
687
|
-
/**
|
|
688
|
-
* Strip any `@tag` / `@version` suffix from a package spec, returning the bare
|
|
689
|
-
* package name. Mirrors `parsePackageSpec` on the UI side.
|
|
690
|
-
*/
|
|
691
|
-
function parseBareName(spec) {
|
|
692
|
-
const trimmed = spec.trim();
|
|
693
|
-
const at = trimmed.startsWith("@") ? trimmed.lastIndexOf("@") : trimmed.indexOf("@");
|
|
694
|
-
return at > 0 ? trimmed.slice(0, at) : trimmed;
|
|
695
|
-
}
|
|
696
|
-
async function fetchPackageJsonVersion(baseUrl) {
|
|
697
|
-
try {
|
|
698
|
-
const res = await fetch(baseUrl);
|
|
699
|
-
if (!res.ok) return void 0;
|
|
700
|
-
const pkg = await res.json();
|
|
701
|
-
return typeof pkg.version === "string" ? pkg.version : void 0;
|
|
702
|
-
} catch {
|
|
703
|
-
return;
|
|
704
|
-
}
|
|
705
|
-
}
|
|
706
|
-
const LOCAL_PACKAGE_NAME = "Local";
|
|
707
|
-
var BrowserPackageManager = class {
|
|
708
|
-
registryUrl;
|
|
709
|
-
#storage;
|
|
710
|
-
#packages = /* @__PURE__ */ new Map();
|
|
711
|
-
#subscribers = /* @__PURE__ */ new Set();
|
|
712
|
-
#packagesMemo = [];
|
|
713
|
-
#stylesheets = /* @__PURE__ */ new Map();
|
|
714
|
-
#localPackage;
|
|
715
|
-
#cdnUrl;
|
|
716
|
-
#localPackageVersion;
|
|
717
|
-
#localPackageNames = new Set([LOCAL_PACKAGE_NAME]);
|
|
718
|
-
#pwaSyncTimer;
|
|
719
|
-
/** Serialized last-mirrored PWA fragment; lets a sync skip the IndexedDB
|
|
720
|
-
* write + manifest re-attach when nothing PWA-relevant changed. */
|
|
721
|
-
#lastSyncedFragmentJson;
|
|
722
|
-
constructor(namespace, registryUrl) {
|
|
723
|
-
this.#storage = new BrowserLocalStorage(namespace + ":PH_PACKAGES");
|
|
724
|
-
this.registryUrl = registryUrl;
|
|
725
|
-
this.#cdnUrl = registryUrl !== null ? toCdnUrl(registryUrl) : null;
|
|
726
|
-
}
|
|
727
|
-
async init(localPackage, localPackageVersion, studioMode) {
|
|
728
|
-
this.addLocalPackage(common.manifest.name, common, commonPkg.version);
|
|
729
|
-
if (studioMode) {
|
|
730
|
-
const vetra = await import("@powerhousedao/vetra");
|
|
731
|
-
this.addLocalPackage(vetra.manifest.name, vetra, vetraPkg.version);
|
|
732
|
-
}
|
|
733
|
-
if (localPackage) this.updateLocalPackage(localPackage, localPackageVersion);
|
|
734
|
-
for (const packageName of this.#storage.keys()) {
|
|
735
|
-
const specForReload = this.#storage.get(packageName)?.spec ?? packageName;
|
|
736
|
-
console.debug(`[Connect][PackageManager] Rehydrating "${packageName}" via spec "${specForReload}"`);
|
|
737
|
-
if ((await this.addPackage(specForReload)).type === "error") this.#storage.delete(packageName);
|
|
738
|
-
}
|
|
739
|
-
}
|
|
740
|
-
addLocalPackage(name, loadedPackage, version) {
|
|
741
|
-
this.#localPackageNames.add(name);
|
|
742
|
-
this.#registerPackage({
|
|
743
|
-
name,
|
|
744
|
-
importUrl: null,
|
|
745
|
-
stylesheetUrl: null,
|
|
746
|
-
loadedPackage,
|
|
747
|
-
version
|
|
748
|
-
});
|
|
749
|
-
}
|
|
750
|
-
updateLocalPackage(pkg, version) {
|
|
751
|
-
console.debug("Updating local package:", pkg);
|
|
752
|
-
this.#localPackage = pkg;
|
|
753
|
-
this.#registerPackage({
|
|
754
|
-
name: LOCAL_PACKAGE_NAME,
|
|
755
|
-
stylesheetUrl: null,
|
|
756
|
-
importUrl: null,
|
|
757
|
-
loadedPackage: pkg
|
|
758
|
-
});
|
|
759
|
-
if (version) {
|
|
760
|
-
this.#localPackageVersion = version;
|
|
761
|
-
this.#notifyPackagesChanged();
|
|
762
|
-
return;
|
|
763
|
-
}
|
|
764
|
-
fetchPackageJsonVersion("/package.json").then((fetchedVersion) => {
|
|
765
|
-
this.#localPackageVersion = fetchedVersion;
|
|
766
|
-
if (fetchedVersion) this.#notifyPackagesChanged();
|
|
767
|
-
}).catch(() => {});
|
|
768
|
-
}
|
|
769
|
-
get packages() {
|
|
770
|
-
return this.#packagesMemo;
|
|
771
|
-
}
|
|
772
|
-
get cdnUrl() {
|
|
773
|
-
return this.#cdnUrl;
|
|
774
|
-
}
|
|
775
|
-
getPackageSource(packageName) {
|
|
776
|
-
if (this.#localPackageNames.has(packageName)) return "common";
|
|
777
|
-
if (packageName === this.#localPackage?.manifest.name) return "project";
|
|
778
|
-
const packageMeta = this.#storage.get(packageName);
|
|
779
|
-
if (!packageMeta) return null;
|
|
780
|
-
if (packageMeta.importUrl === `/node_modules/${packageName}`) return "local-install";
|
|
781
|
-
return "registry-install";
|
|
782
|
-
}
|
|
783
|
-
/**
|
|
784
|
-
* Return the registry-installed packages keyed by their storage name (which
|
|
785
|
-
* is the registry spec, e.g. "@powerhousedao/clint-common"), with the
|
|
786
|
-
* installed version when known. Excludes bundled (common) packages, the
|
|
787
|
-
* local project package, and packages resolved out of `/node_modules/`.
|
|
788
|
-
*/
|
|
789
|
-
getRegistryPackages() {
|
|
790
|
-
const out = [];
|
|
791
|
-
for (const [name, meta] of this.#storage) {
|
|
792
|
-
if (this.#localPackageNames.has(name)) continue;
|
|
793
|
-
if (name === LOCAL_PACKAGE_NAME) continue;
|
|
794
|
-
if (meta.importUrl === `/node_modules/${name}`) continue;
|
|
795
|
-
out.push({
|
|
796
|
-
name,
|
|
797
|
-
version: meta.version
|
|
798
|
-
});
|
|
799
|
-
}
|
|
800
|
-
return out;
|
|
801
|
-
}
|
|
802
|
-
getPackageVersion(packageName) {
|
|
803
|
-
if (packageName === this.#localPackage?.manifest.name) return this.#localPackageVersion;
|
|
804
|
-
return this.#storage.get(packageName)?.version;
|
|
805
|
-
}
|
|
806
|
-
/**
|
|
807
|
-
* The spec the user requested when this package was installed (e.g.
|
|
808
|
-
* `name@dev` or `name@6.2.1`). Undefined for bare-name installs, legacy
|
|
809
|
-
* entries, and local packages — the Package Manager treats that as the
|
|
810
|
-
* `latest` stream when picking update targets.
|
|
811
|
-
*/
|
|
812
|
-
getPackageSpec(packageName) {
|
|
813
|
-
return this.#storage.get(packageName)?.spec;
|
|
814
|
-
}
|
|
815
|
-
async addPackage(packageSpec) {
|
|
816
|
-
const bareName = parseBareName(packageSpec);
|
|
817
|
-
const hasTagOrVersion = bareName !== packageSpec;
|
|
818
|
-
console.debug(`[Connect][PackageManager] addPackage spec="${packageSpec}" bareName="${bareName}"`);
|
|
819
|
-
const existingPackage = this.#packages.get(bareName);
|
|
820
|
-
if (existingPackage) {
|
|
821
|
-
const requestedVersion = hasTagOrVersion ? packageSpec.slice(bareName.length + 1) : void 0;
|
|
822
|
-
const currentVersion = this.#storage.get(bareName)?.version;
|
|
823
|
-
if (this.#localPackageNames.has(bareName) || !requestedVersion || !currentVersion || requestedVersion === currentVersion) {
|
|
824
|
-
console.debug(`[Connect][PackageManager] "${bareName}" already loaded; skipping re-fetch`);
|
|
825
|
-
return {
|
|
826
|
-
type: "success",
|
|
827
|
-
package: existingPackage
|
|
828
|
-
};
|
|
829
|
-
}
|
|
830
|
-
console.debug(`[Connect][PackageManager] "${bareName}" version bump ${currentVersion} → ${requestedVersion}; refetching`);
|
|
831
|
-
}
|
|
832
|
-
try {
|
|
833
|
-
const packageWithMeta = await this.#loadPackage(packageSpec);
|
|
834
|
-
packageWithMeta.name = bareName;
|
|
835
|
-
if (hasTagOrVersion) packageWithMeta.spec = packageSpec;
|
|
836
|
-
if (existingPackage) this.#unmountStylesheet(bareName);
|
|
837
|
-
this.#registerPackage(packageWithMeta);
|
|
838
|
-
return {
|
|
839
|
-
type: "success",
|
|
840
|
-
package: packageWithMeta.loadedPackage
|
|
841
|
-
};
|
|
842
|
-
} catch (error) {
|
|
843
|
-
const normalized = error instanceof Error ? error : new Error(String(error));
|
|
844
|
-
console.error(`[Connect][PackageManager] Failed to install package "${packageSpec}": ${normalized.message}`, normalized);
|
|
845
|
-
return {
|
|
846
|
-
type: "error",
|
|
847
|
-
error: normalized
|
|
848
|
-
};
|
|
849
|
-
}
|
|
850
|
-
}
|
|
851
|
-
async addPackages(packageNames) {
|
|
852
|
-
const results = [];
|
|
853
|
-
for (const packageName of packageNames) {
|
|
854
|
-
const result = await this.addPackage(packageName);
|
|
855
|
-
results.push(result);
|
|
856
|
-
}
|
|
857
|
-
return results;
|
|
858
|
-
}
|
|
859
|
-
removePackage(name) {
|
|
860
|
-
this.#packages.delete(name);
|
|
861
|
-
this.#storage.delete(name);
|
|
862
|
-
this.#unmountStylesheet(name);
|
|
863
|
-
this.#notifyPackagesChanged();
|
|
864
|
-
}
|
|
865
|
-
subscribe(handler) {
|
|
866
|
-
this.#subscribers.add(handler);
|
|
867
|
-
return () => {
|
|
868
|
-
this.#subscribers.delete(handler);
|
|
869
|
-
};
|
|
870
|
-
}
|
|
871
|
-
load(documentType) {
|
|
872
|
-
const documentModelModule = Array.from(this.#packages.values().flatMap((p) => p.documentModels)).find((m) => m.documentModel.global.id === documentType);
|
|
873
|
-
if (documentModelModule) return Promise.resolve(documentModelModule);
|
|
874
|
-
return Promise.reject(/* @__PURE__ */ new Error("Model not available"));
|
|
875
|
-
}
|
|
876
|
-
async #loadPackageFromNodeModules(name) {
|
|
877
|
-
const importUrl = `/node_modules/${name}/browser/index.js`;
|
|
878
|
-
const stylesheetUrl = `/node_modules/${name}/style.css`;
|
|
879
|
-
const packageWithMeta = await this.#importPackage({
|
|
880
|
-
name,
|
|
881
|
-
importUrl,
|
|
882
|
-
stylesheetUrl
|
|
883
|
-
});
|
|
884
|
-
packageWithMeta.version = await fetchPackageJsonVersion(`/node_modules/${name}/package.json`);
|
|
885
|
-
return packageWithMeta;
|
|
886
|
-
}
|
|
887
|
-
async #loadPackageFromRegistry(name) {
|
|
888
|
-
const importUrl = `${this.#cdnUrl}/${name}/browser/index.js`;
|
|
889
|
-
const stylesheetUrl = `${this.#cdnUrl}/${name}/style.css`;
|
|
890
|
-
const packageWithMeta = await this.#importPackage({
|
|
891
|
-
name,
|
|
892
|
-
importUrl,
|
|
893
|
-
stylesheetUrl
|
|
894
|
-
});
|
|
895
|
-
packageWithMeta.version = await fetchPackageJsonVersion(`${this.#cdnUrl}/${name}/package.json`);
|
|
896
|
-
return packageWithMeta;
|
|
897
|
-
}
|
|
898
|
-
async #importPackage(packageMeta) {
|
|
899
|
-
const { name, importUrl, stylesheetUrl } = packageMeta;
|
|
900
|
-
if (!importUrl) throw new Error(`Import url not defined for package "${name}".`);
|
|
901
|
-
return {
|
|
902
|
-
name,
|
|
903
|
-
loadedPackage: await import(
|
|
904
|
-
/* @vite-ignore */
|
|
905
|
-
importUrl
|
|
906
|
-
),
|
|
907
|
-
importUrl,
|
|
908
|
-
stylesheetUrl
|
|
909
|
-
};
|
|
910
|
-
}
|
|
911
|
-
async #loadPackage(packageName) {
|
|
912
|
-
if (this.#localPackageNames.has(packageName)) throw new Error(`Package "${packageName}" is a local package and cannot be loaded dynamically.`);
|
|
913
|
-
if (!import.meta.env.PROD) try {
|
|
914
|
-
return await this.#loadPackageFromNodeModules(packageName);
|
|
915
|
-
} catch (error) {
|
|
916
|
-
console.warn(`Failed to load package "${packageName}" from node_modules:`, error);
|
|
917
|
-
}
|
|
918
|
-
if (!this.registryUrl) throw new Error("Registry url not defined.");
|
|
919
|
-
return await this.#loadPackageFromRegistry(packageName);
|
|
920
|
-
}
|
|
921
|
-
#registerPackage(packageWithMeta) {
|
|
922
|
-
const { name, loadedPackage, importUrl, stylesheetUrl, version, spec } = packageWithMeta;
|
|
923
|
-
if (stylesheetUrl !== null) this.#mountStylesheet(name, stylesheetUrl);
|
|
924
|
-
this.#packages.set(name, loadedPackage);
|
|
925
|
-
this.#storage.set(name, {
|
|
926
|
-
name,
|
|
927
|
-
importUrl,
|
|
928
|
-
stylesheetUrl,
|
|
929
|
-
version,
|
|
930
|
-
...spec ? { spec } : {}
|
|
931
|
-
});
|
|
932
|
-
console.debug(`[Connect][PackageManager] Registered "${name}" (version=${version ?? "?"}, spec=${spec ?? "—"})`);
|
|
933
|
-
this.#notifyPackagesChanged();
|
|
934
|
-
}
|
|
935
|
-
#mountStylesheet(name, href) {
|
|
936
|
-
const existing = this.#stylesheets.get(name);
|
|
937
|
-
if (existing) return existing;
|
|
938
|
-
const style = document.createElement("style");
|
|
939
|
-
style.textContent = `@import url("${href}") layer(external-packages);`;
|
|
940
|
-
document.head.appendChild(style);
|
|
941
|
-
this.#stylesheets.set(name, style);
|
|
942
|
-
}
|
|
943
|
-
#unmountStylesheet(name) {
|
|
944
|
-
const style = this.#stylesheets.get(name);
|
|
945
|
-
if (!style) return;
|
|
946
|
-
style.remove();
|
|
947
|
-
this.#stylesheets.delete(name);
|
|
948
|
-
}
|
|
949
|
-
#notifyPackagesChanged() {
|
|
950
|
-
this.#packagesMemo = Array.from(this.#packages.values());
|
|
951
|
-
const packages = this.packages;
|
|
952
|
-
this.#subscribers.forEach((handler) => {
|
|
953
|
-
handler({ packages });
|
|
954
|
-
});
|
|
955
|
-
this.#schedulePwaSync();
|
|
956
|
-
}
|
|
957
|
-
/**
|
|
958
|
-
* Debounced mirror of every loaded package's PWA fragment into IndexedDB, so
|
|
959
|
-
* the service worker can serve a web-app manifest that reflects packages
|
|
960
|
-
* installed AT RUNTIME (a SW can't read localStorage, where the package list
|
|
961
|
-
* lives). Debounced because `init()` rehydrates many packages in a burst;
|
|
962
|
-
* coalescing collapses that into a single write.
|
|
963
|
-
*/
|
|
964
|
-
#schedulePwaSync() {
|
|
965
|
-
if (typeof indexedDB === "undefined") return;
|
|
966
|
-
clearTimeout(this.#pwaSyncTimer);
|
|
967
|
-
this.#pwaSyncTimer = setTimeout(() => {
|
|
968
|
-
this.#syncPwaFragments();
|
|
969
|
-
}, 50);
|
|
970
|
-
}
|
|
971
|
-
async #syncPwaFragments() {
|
|
972
|
-
const contributions = [];
|
|
973
|
-
for (const [name, loadedPackage] of this.#packages) {
|
|
974
|
-
const manifest = loadedPackage.manifest;
|
|
975
|
-
let config = {};
|
|
976
|
-
if (manifest.pwa) {
|
|
977
|
-
const parsed = PwaConfigSchema.safeParse(manifest.pwa);
|
|
978
|
-
if (parsed.success) {
|
|
979
|
-
const importUrl = this.#storage.get(name)?.importUrl ?? null;
|
|
980
|
-
const baseUrl = importUrl ? importUrl.replace(/browser\/index\.js$/, "") : null;
|
|
981
|
-
config = resolveFragmentAssetUrls(parsed.data, baseUrl);
|
|
982
|
-
} else console.warn(`[Connect][PWA] "${name}" ships an invalid pwa fragment; skipped.`, parsed.error);
|
|
983
|
-
}
|
|
984
|
-
config = withInferredCategory(config, manifest.category);
|
|
985
|
-
if (Object.keys(config).length === 0) continue;
|
|
986
|
-
contributions.push({
|
|
987
|
-
source: name,
|
|
988
|
-
config
|
|
989
|
-
});
|
|
990
|
-
}
|
|
991
|
-
const merged = mergePwaConfig(contributions);
|
|
992
|
-
const mergedJson = JSON.stringify(merged);
|
|
993
|
-
if (mergedJson === this.#lastSyncedFragmentJson) return;
|
|
994
|
-
try {
|
|
995
|
-
await writeMergedPwaFragment(merged);
|
|
996
|
-
} catch (error) {
|
|
997
|
-
console.debug("[Connect][PWA] fragment mirror to IndexedDB failed:", error);
|
|
998
|
-
return;
|
|
999
|
-
}
|
|
1000
|
-
this.#lastSyncedFragmentJson = mergedJson;
|
|
1001
|
-
refreshPwaManifestLink();
|
|
1002
|
-
}
|
|
1003
|
-
};
|
|
1004
|
-
//#endregion
|
|
1005
610
|
//#region src/reactor-worker-name.ts
|
|
1006
611
|
const GEN_KEY_PREFIX = "ph-reactor-gen:";
|
|
1007
612
|
function reactorWorkerName(namespace) {
|
|
@@ -1072,9 +677,14 @@ function createWorkerReactorClientModule(args) {
|
|
|
1072
677
|
relationalNamespace: args.relationalNamespace,
|
|
1073
678
|
cdnUrl: args.cdnUrl,
|
|
1074
679
|
packageSpecs: args.packageSpecs,
|
|
680
|
+
sharedImports: args.sharedImports,
|
|
1075
681
|
studioMode: args.studioMode,
|
|
682
|
+
workflowsEnabled: args.workflowsEnabled,
|
|
1076
683
|
renownChainId: args.renownChainId,
|
|
1077
|
-
featureFlags: args.featureFlags
|
|
684
|
+
featureFlags: args.featureFlags,
|
|
685
|
+
createSignaturePolicy: args.createSignaturePolicy,
|
|
686
|
+
unsupportedStoredDocuments: args.unsupportedStoredDocuments,
|
|
687
|
+
renownEndpoints: args.renownEndpoints
|
|
1078
688
|
},
|
|
1079
689
|
packages: args.packageSpecs
|
|
1080
690
|
}, args.onReload, documentModelRegistry);
|
|
@@ -1305,9 +915,12 @@ async function createReactor(localPackage) {
|
|
|
1305
915
|
const runtimeConfig = getRuntimeConfig();
|
|
1306
916
|
const packageManager = new BrowserPackageManager(phGlobalConfig.routerBasename ?? "", runtimeConfig.packageRegistryUrl ?? null);
|
|
1307
917
|
setVetraPackageManager(packageManager);
|
|
1308
|
-
await packageManager.init(localPackage, runtimeConfig.localPackage?.version, phGlobalConfig.studioMode);
|
|
918
|
+
await packageManager.init(localPackage, runtimeConfig.localPackage?.version, phGlobalConfig.studioMode, connectConfig.workflowsEnabled);
|
|
1309
919
|
try {
|
|
1310
|
-
const { default: registerBundledPackages } = await import(
|
|
920
|
+
const { default: registerBundledPackages } = await import(
|
|
921
|
+
/* @vite-ignore */
|
|
922
|
+
"ph-bundled-packages-virtual"
|
|
923
|
+
);
|
|
1311
924
|
registerBundledPackages(packageManager);
|
|
1312
925
|
} catch {}
|
|
1313
926
|
const remotePackages = runtimeConfig.packages.filter((p) => p.provider !== "local").map((p) => p.version ? `${p.packageName}@${p.version}` : p.packageName);
|
|
@@ -1325,30 +938,43 @@ async function createReactor(localPackage) {
|
|
|
1325
938
|
const reactorFeatureFlags = runtimeConfig.connect?.reactor?.featureFlags ?? {};
|
|
1326
939
|
const enabledReactorFlags = Object.entries(reactorFeatureFlags).filter(([, enabled]) => enabled).map(([name]) => name);
|
|
1327
940
|
if (enabledReactorFlags.length > 0) logger.info(`Reactor feature flags: ${enabledReactorFlags.join(", ")}`);
|
|
941
|
+
const createSignaturePolicy = runtimeConfig.connect?.reactor?.createSignaturePolicy;
|
|
942
|
+
const unsupportedStoredDocuments = runtimeConfig.connect?.reactor?.unsupportedStoredDocuments;
|
|
943
|
+
const renownEndpoints = {
|
|
944
|
+
renownUrl: phGlobalConfig.renownUrl,
|
|
945
|
+
switchboardUrl: phGlobalConfig.switchboardUrl
|
|
946
|
+
};
|
|
1328
947
|
let reactorClientModule;
|
|
1329
948
|
if (isReactorWorkerEnabled()) {
|
|
1330
949
|
const packageSpecs = packageManager.getRegistryPackages().map((p) => p.version ? `${p.name}@${p.version}` : p.name);
|
|
1331
950
|
const registryClient = new RegistryClient(packageManager.cdnUrl ?? "");
|
|
951
|
+
const documentModelLoader = { async load(documentType) {
|
|
952
|
+
const names = packageManager.cdnUrl ? await registryClient.getPackagesByDocumentType(documentType) : [];
|
|
953
|
+
for (const name of names) {
|
|
954
|
+
const result = await packageManager.addPackage(name);
|
|
955
|
+
if (result.type === "error") throw new Error(`Failed to install package "${name}" for document model: ${documentType}`, { cause: result.error });
|
|
956
|
+
}
|
|
957
|
+
const module = packageManager.packages.flatMap((p) => p.documentModels).find((m) => m.documentModel.global.id === documentType);
|
|
958
|
+
if (!module) throw new Error(names.length > 0 ? `Installed [${names.join(", ")}] but document model not available: ${documentType}` : `No package found for document model: ${documentType} (cdnUrl: ${packageManager.cdnUrl ?? "none"})`);
|
|
959
|
+
return module;
|
|
960
|
+
} };
|
|
961
|
+
const sharedImports = (await getSharedDeps())?.imports;
|
|
1332
962
|
const workerClient = createWorkerReactorClientModule({
|
|
1333
963
|
namespace: REACTOR_INSTANCE_NAMESPACE,
|
|
1334
964
|
relationalNamespace: RELATIONAL_PGLITE_NAME,
|
|
1335
965
|
cdnUrl: packageManager.cdnUrl ?? "",
|
|
1336
966
|
packageSpecs,
|
|
967
|
+
sharedImports,
|
|
1337
968
|
studioMode: phGlobalConfig.studioMode,
|
|
969
|
+
workflowsEnabled: connectConfig.workflowsEnabled,
|
|
1338
970
|
renownChainId,
|
|
1339
971
|
featureFlags: reactorFeatureFlags,
|
|
972
|
+
createSignaturePolicy,
|
|
973
|
+
unsupportedStoredDocuments,
|
|
974
|
+
renownEndpoints,
|
|
1340
975
|
documentModelModules,
|
|
1341
976
|
upgradeManifests,
|
|
1342
|
-
documentModelLoader
|
|
1343
|
-
const names = packageManager.cdnUrl ? await registryClient.getPackagesByDocumentType(documentType) : [];
|
|
1344
|
-
for (const name of names) {
|
|
1345
|
-
const result = await packageManager.addPackage(name);
|
|
1346
|
-
if (result.type === "error") throw new Error(`Failed to install package "${name}" for document model: ${documentType}`, { cause: result.error });
|
|
1347
|
-
}
|
|
1348
|
-
const module = packageManager.packages.flatMap((p) => p.documentModels).find((m) => m.documentModel.global.id === documentType);
|
|
1349
|
-
if (!module) throw new Error(names.length > 0 ? `Installed [${names.join(", ")}] but document model not available: ${documentType}` : `No package found for document model: ${documentType} (cdnUrl: ${packageManager.cdnUrl ?? "none"})`);
|
|
1350
|
-
return module;
|
|
1351
|
-
} },
|
|
977
|
+
documentModelLoader,
|
|
1352
978
|
renown,
|
|
1353
979
|
onReload: (reason, workerGen) => {
|
|
1354
980
|
logger.warn("Reactor worker requested reload: @reason", reason);
|
|
@@ -1364,11 +990,15 @@ async function createReactor(localPackage) {
|
|
|
1364
990
|
logger.error("Reactor worker failed to start: @error", error);
|
|
1365
991
|
throw error;
|
|
1366
992
|
}
|
|
1367
|
-
} else reactorClientModule = await createBrowserReactor(documentModelModules, upgradeManifests, renown, reactorFeatureFlags, discoveryService);
|
|
993
|
+
} else reactorClientModule = await createBrowserReactor(documentModelModules, upgradeManifests, renown, reactorFeatureFlags, discoveryService, createSignaturePolicy, renownEndpoints, unsupportedStoredDocuments);
|
|
1368
994
|
const drives = await getDrives(reactorClientModule.client);
|
|
1369
|
-
|
|
995
|
+
const didFromUrl = getDidFromUrl();
|
|
996
|
+
await login(didFromUrl, renown);
|
|
1370
997
|
const documentCache = new DocumentCache(reactorClientModule.client);
|
|
1371
|
-
|
|
998
|
+
const basePath = phGlobalConfig.basePath ?? "/";
|
|
999
|
+
const routerBasename = phGlobalConfig.routerBasename ?? "/";
|
|
1000
|
+
const mergedGlobalConfig = buildPHGlobalConfig(basePath, routerBasename, runtimeConfig.connect ?? {});
|
|
1001
|
+
setDefaultPHGlobalConfig(mergedGlobalConfig);
|
|
1372
1002
|
const path = window.location.pathname;
|
|
1373
1003
|
const driveSlug = extractDriveSlugFromPath(path);
|
|
1374
1004
|
const nodeSlug = extractNodeSlugFromPath(path);
|
|
@@ -1385,11 +1015,12 @@ async function createReactor(localPackage) {
|
|
|
1385
1015
|
if (!renown.user) return void 0;
|
|
1386
1016
|
return renown.getBearerToken({ expiresIn: 10 });
|
|
1387
1017
|
};
|
|
1388
|
-
|
|
1018
|
+
const attachmentService = createRemoteAttachmentService({
|
|
1389
1019
|
remoteUrl: switchboardOrigin,
|
|
1390
1020
|
jwtHandler: attachmentJwtHandler,
|
|
1391
1021
|
uploadTransport: createXhrUploadTransport()
|
|
1392
|
-
})
|
|
1022
|
+
});
|
|
1023
|
+
setAttachmentService(attachmentService);
|
|
1393
1024
|
}
|
|
1394
1025
|
}
|
|
1395
1026
|
setDocumentCache(documentCache);
|
|
@@ -1460,5 +1091,5 @@ function getDriveUrl() {
|
|
|
1460
1091
|
//#endregion
|
|
1461
1092
|
export { createReactor as n, clearReactorStorage as t };
|
|
1462
1093
|
|
|
1463
|
-
//# sourceMappingURL=reactor-
|
|
1464
|
-
//# debugId=
|
|
1094
|
+
//# sourceMappingURL=reactor-CItc8KaF.js.map
|
|
1095
|
+
//# debugId=e9dffb1a-3523-5af8-8cad-60683e091ce0
|