@powerhousedao/connect 6.2.3-dev.11 → 6.2.3-dev.12
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/{ClearStorageModal-DmcvyYIt.js → ClearStorageModal-DPeEp0Uy.js} +4 -4
- package/dist/{ClearStorageModal-DmcvyYIt.js.map → ClearStorageModal-DPeEp0Uy.js.map} +1 -1
- package/dist/{DebugSettingsModal-DCHY1gxr.js → DebugSettingsModal-ViAF8fXV.js} +6 -6
- package/dist/{DebugSettingsModal-DCHY1gxr.js.map → DebugSettingsModal-ViAF8fXV.js.map} +1 -1
- package/dist/{InspectorModal-C-stEvbU.js → InspectorModal-3Bs1PQPO.js} +6 -6
- package/dist/{InspectorModal-C-stEvbU.js.map → InspectorModal-3Bs1PQPO.js.map} +1 -1
- package/dist/{MissingPackageModal-aotCq824.js → MissingPackageModal-Bar7ErIs.js} +4 -4
- package/dist/{MissingPackageModal-aotCq824.js.map → MissingPackageModal-Bar7ErIs.js.map} +1 -1
- package/dist/{OpenFileDocumentsModal-D6KDgv7k.js → OpenFileDocumentsModal-C8xf6Yiu.js} +4 -4
- package/dist/{OpenFileDocumentsModal-D6KDgv7k.js.map → OpenFileDocumentsModal-C8xf6Yiu.js.map} +1 -1
- package/dist/{SettingsModal-BUZo2YyO.js → SettingsModal-DEjFnBbg.js} +8 -7
- package/dist/{SettingsModal-BUZo2YyO.js.map → SettingsModal-DEjFnBbg.js.map} +1 -1
- package/dist/{app-loader-DmGPm7Sl.js → app-loader-BOmz0_wJ.js} +15 -15
- package/dist/{app-loader-DmGPm7Sl.js.map → app-loader-BOmz0_wJ.js.map} +1 -1
- package/dist/app-loader-DNF0HVVm.js +4 -0
- package/dist/{build-info-BaGdg_ws.js → build-info-D0HdsjsO.js} +5 -5
- package/dist/{build-info-BaGdg_ws.js.map → build-info-D0HdsjsO.js.map} +1 -1
- package/dist/{components-BCqRZRGY.js → components-C00AmqoA.js} +3 -3
- package/dist/{connect.config-CzrL0fQ8.js → connect.config-BofwIsWJ.js} +4 -3
- package/dist/{connect.config-CzrL0fQ8.js.map → connect.config-BofwIsWJ.js.map} +1 -1
- package/dist/{connection-state-B-ZALWjg.js → connection-state-DAqW06pk.js} +4 -4
- package/dist/{connection-state-B-ZALWjg.js.map → connection-state-DAqW06pk.js.map} +1 -1
- package/dist/{cookie-banner-DNkY7wrk.js → cookie-banner-BQescTYk.js} +4 -4
- package/dist/{cookie-banner-DNkY7wrk.js.map → cookie-banner-BQescTYk.js.map} +1 -1
- package/dist/{load-ChkCrcus.js → load-BCywb9js.js} +8 -8
- package/dist/{load-ChkCrcus.js.map → load-BCywb9js.js.map} +1 -1
- package/dist/main.js +1 -1
- package/dist/{package-manager-ncb8SFdW.js → package-manager-CKEdIJGv.js} +9 -4
- package/dist/package-manager-CKEdIJGv.js.map +1 -0
- package/dist/{pglite-seed-CMX1lzzo.js → pglite-seed-ChNTfFkc.js} +4 -4
- package/dist/{pglite-seed-CMX1lzzo.js.map → pglite-seed-ChNTfFkc.js.map} +1 -1
- package/dist/{preferences-store-D6w85eGd.js → preferences-store-Coa1SHvi.js} +4 -4
- package/dist/{preferences-store-D6w85eGd.js.map → preferences-store-Coa1SHvi.js.map} +1 -1
- package/dist/{reactor-CskVEvz2.js → reactor-DR2eIP5w.js} +10 -8
- package/dist/reactor-DR2eIP5w.js.map +1 -0
- package/dist/reactor.worker.js +22 -11
- package/dist/reactor.worker.js.map +1 -1
- package/dist/{registerServiceWorker-B3cnPnPC.js → registerServiceWorker-BAbPbSW4.js} +4 -4
- package/dist/{registerServiceWorker-B3cnPnPC.js.map → registerServiceWorker-BAbPbSW4.js.map} +1 -1
- package/dist/start-connect.js +1 -1
- package/dist/style.css +2038 -0
- package/dist/{useRegistryPackages-B4jnu65n.js → useRegistryPackages-C2WHmqn4.js} +4 -4
- package/dist/{useRegistryPackages-B4jnu65n.js.map → useRegistryPackages-C2WHmqn4.js.map} +1 -1
- package/package.json +13 -12
- package/style.css +4 -0
- package/dist/app-loader-8h_8WWHM.js +0 -4
- package/dist/package-manager-ncb8SFdW.js.map +0 -1
- package/dist/reactor-CskVEvz2.js.map +0 -1
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { t as AppLoader } from "./app-loader-BOmz0_wJ.js";
|
|
2
|
+
export { AppLoader };
|
|
3
|
+
!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]="6fda8d0e-d584-5035-8352-f5bc09bdf6be")}catch(e){}}();
|
|
4
|
+
//# debugId=6fda8d0e-d584-5035-8352-f5bc09bdf6be
|
|
@@ -1,12 +1,12 @@
|
|
|
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]="
|
|
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]="89564143-79ce-50a5-945d-abbf1ac665d8")}catch(e){}}();
|
|
3
3
|
import { buildTreeUrl, shortGitSha } from "@powerhousedao/shared";
|
|
4
4
|
//#region src/utils/build-info.ts
|
|
5
5
|
function getVersion() {
|
|
6
|
-
return "6.2.3-dev.
|
|
6
|
+
return "6.2.3-dev.12";
|
|
7
7
|
}
|
|
8
8
|
function getGitSha() {
|
|
9
|
-
return "
|
|
9
|
+
return "267f43263d21039df5f7c1daad6495af8ad6b9af";
|
|
10
10
|
}
|
|
11
11
|
/**
|
|
12
12
|
* Build identity baked in at build time (define PH_CONNECT_BUILD_HASH —
|
|
@@ -24,5 +24,5 @@ function getGitUrl() {
|
|
|
24
24
|
//#endregion
|
|
25
25
|
export { shortGitSha as a, getVersion as i, getGitSha as n, getGitUrl as r, getBuildHash as t };
|
|
26
26
|
|
|
27
|
-
//# sourceMappingURL=build-info-
|
|
28
|
-
//# debugId=
|
|
27
|
+
//# sourceMappingURL=build-info-D0HdsjsO.js.map
|
|
28
|
+
//# debugId=89564143-79ce-50a5-945d-abbf1ac665d8
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"build-info-
|
|
1
|
+
{"version":3,"file":"build-info-D0HdsjsO.js","sources":["../src/utils/build-info.ts"],"sourcesContent":["import { buildTreeUrl, shortGitSha } from \"@powerhousedao/shared\";\nimport { packageJson } from \"./package-json.js\";\n\nexport { shortGitSha };\n\ndeclare const CONNECT_VERSION: string | undefined;\ndeclare const CONNECT_GIT_SHA: string | undefined;\ndeclare const PH_CONNECT_BUILD_HASH: string | undefined;\n\nexport function getVersion(): string {\n if (typeof CONNECT_VERSION !== \"undefined\") return CONNECT_VERSION;\n return (\n process.env.WORKSPACE_VERSION ??\n process.env.npm_package_version ??\n packageJson.version\n );\n}\n\nexport function getGitSha(): string {\n if (typeof CONNECT_GIT_SHA !== \"undefined\") return CONNECT_GIT_SHA;\n return process.env.WORKSPACE_GIT_SHA ?? \"unknown\";\n}\n\n/**\n * Build identity baked in at build time (define PH_CONNECT_BUILD_HASH —\n * see builder-tools' connectBuildHashPlugin). Identical builds of the same\n * inputs produce the same hash; any change to the deployed content (Connect\n * version, project config, package list, build options) changes it.\n */\nexport function getBuildHash(): string {\n if (typeof PH_CONNECT_BUILD_HASH !== \"undefined\")\n return PH_CONNECT_BUILD_HASH;\n return \"unknown\";\n}\n\nexport function getGitUrl(): string | null {\n return buildTreeUrl(getGitSha());\n}\n"],"names":[],"mappings":";;;;AASA,SAAgB,aAAqB;AACS,QAAA;;AAQ9C,SAAgB,YAAoB;AACU,QAAA;;;;;;;;AAU9C,SAAgB,eAAuB;AACrC,KAAI,OAAO,0BAA0B,YACnC,QAAO;AACT,QAAO;;AAGT,SAAgB,YAA2B;AACzC,QAAO,aAAa,WAAW,CAAC","debug_id":"89564143-79ce-50a5-945d-abbf1ac665d8"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { t as AppSkeleton } from "./app-skeleton-C6RjKQuy.js";
|
|
2
|
-
import { _ as EditorLoader, a as Root, b as Analytics, c as DriveIcon, g as AppContainer, i as Router, l as DotsLoader, n as Sidebar, o as Footer, r as SearchBar, s as DocumentEditor, t as AppLoader, u as App, v as DocumentEditorContainer, y as OpenPanel } from "./app-loader-
|
|
2
|
+
import { _ as EditorLoader, a as Root, b as Analytics, c as DriveIcon, g as AppContainer, i as Router, l as DotsLoader, n as Sidebar, o as Footer, r as SearchBar, s as DocumentEditor, t as AppLoader, u as App, v as DocumentEditorContainer, y as OpenPanel } from "./app-loader-BOmz0_wJ.js";
|
|
3
3
|
export { Analytics, App, AppContainer, AppLoader, AppSkeleton, DocumentEditor, DocumentEditorContainer, DotsLoader, DriveIcon, EditorLoader, Footer, OpenPanel, Root, Router, SearchBar, Sidebar };
|
|
4
|
-
!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]="
|
|
5
|
-
//# debugId=
|
|
4
|
+
!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]="d51cf21b-2ef4-5d81-95d6-83cc6452af28")}catch(e){}}();
|
|
5
|
+
//# debugId=d51cf21b-2ef4-5d81-95d6-83cc6452af28
|
|
@@ -1,5 +1,5 @@
|
|
|
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]="
|
|
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]="403c52f3-f935-584b-b8c9-9a6e2d7485a1")}catch(e){}}();
|
|
3
3
|
import { n as getRuntimeConfig } from "./runtime-config-DL3QjcfM.js";
|
|
4
4
|
import { loadRuntimeEnv, normalizeBasePath } from "@powerhousedao/shared/connect";
|
|
5
5
|
import { setLogLevel } from "@powerhousedao/reactor-browser";
|
|
@@ -106,6 +106,7 @@ const PH_CONNECT_ANALYTICS_DATABASE_NAME = `${PH_CONNECT_BASE_PATH.replace(/\//g
|
|
|
106
106
|
const connectConfig = {
|
|
107
107
|
appVersion: env.PH_CONNECT_VERSION,
|
|
108
108
|
studioMode: runtime.app?.studioMode ?? false,
|
|
109
|
+
workflowsEnabled: runtime.app?.workflowsEnabled ?? false,
|
|
109
110
|
warnOutdatedApp: phGlobalConfig.warnOutdatedApp,
|
|
110
111
|
appVersionCheckInterval: 3600 * 1e3,
|
|
111
112
|
routerBasename: PH_CONNECT_BASE_PATH,
|
|
@@ -178,5 +179,5 @@ const connectConfig = {
|
|
|
178
179
|
//#endregion
|
|
179
180
|
export { defaultPHDocumentEditorConfig as a, defaultPHAppConfig as i, buildPHGlobalConfig as n, phGlobalConfig as o, connectConfig as r, PH_CONNECT_BASE_PATH as t };
|
|
180
181
|
|
|
181
|
-
//# sourceMappingURL=connect.config-
|
|
182
|
-
//# debugId=
|
|
182
|
+
//# sourceMappingURL=connect.config-BofwIsWJ.js.map
|
|
183
|
+
//# debugId=403c52f3-f935-584b-b8c9-9a6e2d7485a1
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"connect.config-CzrL0fQ8.js","sources":["../src/connect.config.ts"],"sourcesContent":["import {\n setLogLevel,\n type PHAppConfig,\n type PHDocumentEditorConfig,\n type PHGlobalConfig,\n} from \"@powerhousedao/reactor-browser\";\nimport type { PHConnectRuntimeConfig } from \"@powerhousedao/shared/clis\";\nimport {\n loadRuntimeEnv,\n normalizeBasePath,\n} from \"@powerhousedao/shared/connect\";\nimport { logger } from \"document-model\";\nimport { getRuntimeConfig } from \"./runtime-config.js\";\n\n// Env vars are reserved for version stamps and analytics processor toggles.\n// Everything in the Connect runtime schema (PHConnectRuntimeConfig) is read\n// from `runtime` below. The Sentry release tag is stamped at build time via\n// Vite's `define` so it always matches the sourcemap upload tag CI used.\nexport const env = loadRuntimeEnv({\n processEnv: import.meta.env,\n});\n\ndeclare const PH_CONNECT_SENTRY_RELEASE: string;\n\n// Runtime fields come from the JSON, not env. start-connect.tsx's top-level\n// await guarantees the loader cache is warm by the time this module\n// evaluates, so getRuntimeConfig() resolves synchronously. The cache merges\n// DEFAULT_CONNECT_CONFIG into whatever the file declared, so every leaf\n// under `runtime.*` is guaranteed defined.\nconst runtime = getRuntimeConfig().connect;\n\nfunction getRouterBasenameFromBasePath(basePath: string) {\n return basePath.endsWith(\"/\") ? basePath : basePath + \"/\";\n}\n\n// Runtime deploy base. In dynamic-base builds the plugin rewrites\n// import.meta.env.BASE_URL to (globalThis.__PH_DYNAMIC_BASE__||\"/\"), the same\n// base assets resolve against; it takes precedence so router basename and\n// path stripping match the served subpath. A baked runtime base path\n// (runtime.app.basePath) only applies to concrete-base builds, where the\n// dynamic global is unset.\nfunction getDeployBasePath() {\n if (\n typeof globalThis !== \"undefined\" &&\n (globalThis as { __PH_DYNAMIC_BASE__?: string }).__PH_DYNAMIC_BASE__\n ) {\n return import.meta.env.BASE_URL;\n }\n return runtime.app?.basePath || import.meta.env.BASE_URL;\n}\n\n// Hardcoded literal defaults for `PHGlobalConfig` fields whose env-var\n// source was removed. The fields stay on the type so wired-but-dead SW /\n// hook consumers keep typechecking; values mirror the previous Zod\n// defaults.\nfunction getBuiltInDefaults(): Omit<\n PHGlobalConfig,\n \"basePath\" | \"routerBasename\"\n> {\n const studioMode = runtime.app?.studioMode ?? false;\n // Drive containers, DocumentModel, and vetra builder-spec types are authored\n // via their own drives — never creatable from a generic drive.\n const disabledEditors = [\n \"powerhouse/document-drive\",\n \"powerhouse/reactor-drive\",\n \"powerhouse/document-model\",\n \"powerhouse/app\",\n \"powerhouse/document-editor\",\n \"powerhouse/processor\",\n \"powerhouse/subgraph\",\n \"powerhouse/package\",\n ];\n return {\n allowList: undefined,\n allowedDocumentTypes: [],\n isDragAndDropEnabled: true,\n isEditorDebugModeEnabled: false,\n isEditorReadModeEnabled: false,\n isExternalControlsEnabled: false,\n version: env.PH_CONNECT_VERSION,\n logLevel: runtime.app?.logLevel,\n requiresHardRefresh: true,\n warnOutdatedApp: true,\n studioMode,\n versionCheckInterval: 60 * 60 * 1000,\n cliVersion: env.PH_CONNECT_CLI_VERSION,\n fileUploadOperationsChunkSize: 50,\n gaTrackingId: undefined,\n defaultDrivesUrl: runtime.drives?.defaultDrives?.find(\n (drive) => \"url\" in drive,\n )?.url,\n drivesPreserveStrategy: runtime.drives?.preserveStrategy,\n enabledEditors: undefined,\n disabledEditors,\n\n /* Processors */\n isExternalProcessorsEnabled: true,\n // Analytics off by default; flip to true (or wire a runtime-config field)\n // when we want analytics enabled out of the box.\n isAnalyticsEnabled: false,\n isAnalyticsExternalProcessorsEnabled:\n env.PH_CONNECT_EXTERNAL_ANALYTICS_PROCESSORS_ENABLED,\n analyticsDatabaseName: undefined,\n isRelationalProcessorsEnabled: true,\n isExternalRelationalProcessorsEnabled: true,\n\n renownUrl: runtime.renown?.url,\n renownNetworkId: runtime.renown?.networkId,\n renownChainId: runtime.renown?.chainId,\n switchboardUrl: runtime.renown?.switchboardUrl,\n renownAdapters: runtime.renown?.adapters,\n sentryRelease: PH_CONNECT_SENTRY_RELEASE,\n sentryDsn: runtime.sentry?.dsn ?? undefined,\n sentryEnv: runtime.sentry?.env,\n isDiffAnalyticsEnabled: env.PH_CONNECT_DIFF_ANALYTICS_ENABLED,\n isDriveAnalyticsEnabled: env.PH_CONNECT_DRIVE_ANALYTICS_ENABLED,\n isPublicDrivesEnabled: runtime.drives?.sections?.remote?.enabled,\n isCloudDrivesEnabled: runtime.drives?.sections?.remote?.enabled ?? true,\n isLocalDrivesEnabled: runtime.drives?.sections?.local?.enabled,\n isSentryTracingEnabled: runtime.sentry?.tracing,\n isDocumentModelSelectionSettingsEnabled: false,\n isAddDriveEnabled: runtime.drives?.allowAddDrive,\n isAddPublicDrivesEnabled: runtime.drives?.sections?.remote?.allowAdd,\n isDeletePublicDrivesEnabled: runtime.drives?.sections?.remote?.allowDelete,\n isAddCloudDrivesEnabled: runtime.drives?.sections?.remote?.allowAdd ?? true,\n isDeleteCloudDrivesEnabled:\n runtime.drives?.sections?.remote?.allowDelete ?? true,\n isAddLocalDrivesEnabled: runtime.drives?.sections?.local?.allowAdd,\n isDeleteLocalDrivesEnabled: runtime.drives?.sections?.local?.allowDelete,\n isAnalyticsDatabaseWorkerEnabled: false,\n isExternalPackagesEnabled: runtime.packages?.externalEnabled,\n };\n}\n\nexport function buildPHGlobalConfig(\n basePath: string,\n routerBasename: string,\n connectFromConfig: PHConnectRuntimeConfig,\n): PHGlobalConfig {\n const defaults = getBuiltInDefaults();\n const fileOverrides: Partial<PHGlobalConfig> = {};\n\n if (connectFromConfig.drives?.allowAddDrive !== undefined) {\n fileOverrides.isAddDriveEnabled = connectFromConfig.drives.allowAddDrive;\n }\n\n return {\n basePath,\n routerBasename,\n ...defaults,\n ...fileOverrides,\n };\n}\n\nfunction getPHGlobalConfigFromRuntime(): PHGlobalConfig {\n // Deploy base wins via getDeployBasePath: the dynamic-base global when set,\n // else runtime.app.basePath (DEFAULT_CONNECT_CONFIG guarantees it defined),\n // with a \"/\" fallback as a defensive guard for typecheck.\n const basePath = getDeployBasePath() ?? \"/\";\n const routerBasename = getRouterBasenameFromBasePath(basePath);\n return buildPHGlobalConfig(basePath, routerBasename, runtime);\n}\n\nexport const phGlobalConfig = getPHGlobalConfigFromRuntime();\n\nexport const defaultPHDocumentEditorConfig: PHDocumentEditorConfig = {\n isExternalControlsEnabled: phGlobalConfig.isExternalControlsEnabled,\n};\n\nexport const defaultPHAppConfig: PHAppConfig = {\n allowedDocumentTypes: phGlobalConfig.allowedDocumentTypes,\n isDragAndDropEnabled: phGlobalConfig.isDragAndDropEnabled,\n};\n\n// Set log level from the runtime config (DEFAULT_CONNECT_CONFIG provides a\n// fallback, so this is always defined).\nconst RESOLVED_LOG_LEVEL = runtime.app?.logLevel;\nif (RESOLVED_LOG_LEVEL) {\n setLogLevel(RESOLVED_LOG_LEVEL);\n}\nlogger.debug(\"Setting log level to @level.\", RESOLVED_LOG_LEVEL);\n\n// Normalize the base path to ensure it starts and ends with a forward slash.\nexport const PH_CONNECT_BASE_PATH = normalizeBasePath(\n getDeployBasePath() ?? \"/\",\n);\n\n// Analytics database name — derived deterministically from the base path so\n// instances on different prefixes of one origin do not share an analytics DB.\n// Root resolves to \":analytics\".\nconst PH_CONNECT_ANALYTICS_DATABASE_NAME = `${PH_CONNECT_BASE_PATH.replace(\n /\\//g,\n \"\",\n)}:analytics`;\n\n// The CLOUD section was collapsed into the unified `remote` section. PUBLIC\n// keeps its existing string identifier in the legacy\n// connectConfig.drives.sections map to avoid rippling through downstream UI\n// components — both PUBLIC and the\n// soon-to-be-removed CLOUD readers point at runtime.drives.sections.remote.\nexport const connectConfig = {\n appVersion: env.PH_CONNECT_VERSION,\n studioMode: runtime.app?.studioMode ?? false,\n warnOutdatedApp: phGlobalConfig.warnOutdatedApp,\n appVersionCheckInterval: 60 * 60 * 1000,\n routerBasename: PH_CONNECT_BASE_PATH,\n offline: runtime.app?.offline ?? true,\n aiAssistantEnabled: runtime.ai?.assistantEnabled ?? false,\n externalPackagesEnabled: runtime.packages?.externalEnabled,\n processors: {\n enabled: true,\n externalProcessorsEnabled: true,\n },\n analytics: {\n enabled: true,\n databaseName: PH_CONNECT_ANALYTICS_DATABASE_NAME,\n useWorker: false,\n driveAnalyticsEnabled: env.PH_CONNECT_DRIVE_ANALYTICS_ENABLED,\n diffProcessorEnabled: env.PH_CONNECT_DIFF_ANALYTICS_ENABLED,\n externalProcessorsEnabled: true,\n },\n relational: {\n enabled: true,\n externalProcessorsEnabled: true,\n },\n openPanel: {\n clientId: env.PH_CONNECT_OPENPANEL_CLIENT_ID ?? \"\",\n apiUrl: env.PH_CONNECT_OPENPANEL_API_URL,\n // Intentionally dormant — no call sites gate on this yet; UI-event tracking is future work.\n trackUiEvents: env.PH_CONNECT_OPENPANEL_TRACK_UI_EVENTS,\n trackOperations: env.PH_CONNECT_OPENPANEL_TRACK_OPERATIONS,\n },\n renown: {\n url: runtime.renown?.url,\n networkId: runtime.renown?.networkId,\n chainId: runtime.renown?.chainId,\n namespace: runtime.renown?.namespace,\n switchboardUrl: runtime.renown?.switchboardUrl,\n adapters: runtime.renown?.adapters,\n },\n sentry: {\n release: PH_CONNECT_SENTRY_RELEASE,\n // `dsn: null` (default) means Sentry is disabled — useInitSentry bails.\n dsn: runtime.sentry?.dsn ?? null,\n env: runtime.sentry?.env,\n tracing: runtime.sentry?.tracing ?? false,\n },\n content: {\n showSearchBar: false,\n showDocumentModelSelectionSetting: false,\n },\n drives: {\n addDriveEnabled: runtime.drives?.allowAddDrive,\n preserveStrategy: runtime.drives?.preserveStrategy,\n // The legacy `SharingType` enum still includes a \"CLOUD\" variant.\n // Connect collapsed CLOUD into the unified remote section, so both CLOUD\n // and PUBLIC map to the same `runtime.drives.sections.remote` object —\n // the alias keeps `sections[sharingType]` lookups type-safe for every\n // SharingType value.\n sections: (() => {\n const remote = {\n enabled: runtime.drives?.sections?.remote?.enabled,\n allowAdd: runtime.drives?.sections?.remote?.allowAdd,\n allowDelete: runtime.drives?.sections?.remote?.allowDelete,\n };\n return {\n LOCAL: {\n enabled: runtime.drives?.sections?.local?.enabled,\n allowAdd: runtime.drives?.sections?.local?.allowAdd,\n allowDelete: runtime.drives?.sections?.local?.allowDelete,\n },\n PUBLIC: remote,\n CLOUD: remote,\n };\n })(),\n },\n gaTrackingId: undefined,\n phCliVersion: env.PH_CONNECT_CLI_VERSION,\n} as const;\n"],"names":[],"mappings":";;;;;;;AAkBA,MAAa,MAAM,eAAe,EAChC,YAAY,OAAO,KAAK,KACzB,CAAC;AASF,MAAM,UAAU,kBAAkB,CAAC;AAEnC,SAAS,8BAA8B,UAAkB;AACvD,QAAO,SAAS,SAAS,IAAI,GAAG,WAAW,WAAW;;AASxD,SAAS,oBAAoB;AAC3B,KACE,OAAO,eAAe,eACrB,WAAgD,oBAEjD,QAAO,OAAO,KAAK,IAAI;AAEzB,QAAO,QAAQ,KAAK,YAAY,OAAO,KAAK,IAAI;;AAOlD,SAAS,qBAGP;CACA,MAAM,aAAa,QAAQ,KAAK,cAAc;AAa9C,QAAO;EACL,WAAW,KAAA;EACX,sBAAsB,EAAE;EACxB,sBAAsB;EACtB,0BAA0B;EAC1B,yBAAyB;EACzB,2BAA2B;EAC3B,SAAS,IAAI;EACb,UAAU,QAAQ,KAAK;EACvB,qBAAqB;EACrB,iBAAiB;EACjB;EACA,sBAAsB,OAAU;EAChC,YAAY,IAAI;EAChB,+BAA+B;EAC/B,cAAc,KAAA;EACd,kBAAkB,QAAQ,QAAQ,eAAe,MAC9C,UAAU,SAAS,MACrB,EAAE;EACH,wBAAwB,QAAQ,QAAQ;EACxC,gBAAgB,KAAA;EAChB,iBA/BsB;GACtB;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACD;EAyBC,6BAA6B;EAG7B,oBAAoB;EACpB,sCACE,IAAI;EACN,uBAAuB,KAAA;EACvB,+BAA+B;EAC/B,uCAAuC;EAEvC,WAAW,QAAQ,QAAQ;EAC3B,iBAAiB,QAAQ,QAAQ;EACjC,eAAe,QAAQ,QAAQ;EAC/B,gBAAgB,QAAQ,QAAQ;EAChC,gBAAgB,QAAQ,QAA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,OAAO;KAC1C,UAAU,QAAQ,QAAQ,UAAU,OAAO;KAC3C,aAAa,QAAQ,QAAQ,UAAU,OAAO;KAC/C;IACD,QAAQ;IACR,OAAO;IACR;MACC;EACL;CACD,cAAc,KAAA;CACd,cAAc,IAAI;CACnB","debug_id":"ce54b62a-175b-53ea-9847-fa347a201e45"}
|
|
1
|
+
{"version":3,"file":"connect.config-BofwIsWJ.js","sources":["../src/connect.config.ts"],"sourcesContent":["import {\n setLogLevel,\n type PHAppConfig,\n type PHDocumentEditorConfig,\n type PHGlobalConfig,\n} from \"@powerhousedao/reactor-browser\";\nimport type { PHConnectRuntimeConfig } from \"@powerhousedao/shared/clis\";\nimport {\n loadRuntimeEnv,\n normalizeBasePath,\n} from \"@powerhousedao/shared/connect\";\nimport { logger } from \"document-model\";\nimport { getRuntimeConfig } from \"./runtime-config.js\";\n\n// Env vars are reserved for version stamps and analytics processor toggles.\n// Everything in the Connect runtime schema (PHConnectRuntimeConfig) is read\n// from `runtime` below. The Sentry release tag is stamped at build time via\n// Vite's `define` so it always matches the sourcemap upload tag CI used.\nexport const env = loadRuntimeEnv({\n processEnv: import.meta.env,\n});\n\ndeclare const PH_CONNECT_SENTRY_RELEASE: string;\n\n// Runtime fields come from the JSON, not env. start-connect.tsx's top-level\n// await guarantees the loader cache is warm by the time this module\n// evaluates, so getRuntimeConfig() resolves synchronously. The cache merges\n// DEFAULT_CONNECT_CONFIG into whatever the file declared, so every leaf\n// under `runtime.*` is guaranteed defined.\nconst runtime = getRuntimeConfig().connect;\n\nfunction getRouterBasenameFromBasePath(basePath: string) {\n return basePath.endsWith(\"/\") ? basePath : basePath + \"/\";\n}\n\n// Runtime deploy base. In dynamic-base builds the plugin rewrites\n// import.meta.env.BASE_URL to (globalThis.__PH_DYNAMIC_BASE__||\"/\"), the same\n// base assets resolve against; it takes precedence so router basename and\n// path stripping match the served subpath. A baked runtime base path\n// (runtime.app.basePath) only applies to concrete-base builds, where the\n// dynamic global is unset.\nfunction getDeployBasePath() {\n if (\n typeof globalThis !== \"undefined\" &&\n (globalThis as { __PH_DYNAMIC_BASE__?: string }).__PH_DYNAMIC_BASE__\n ) {\n return import.meta.env.BASE_URL;\n }\n return runtime.app?.basePath || import.meta.env.BASE_URL;\n}\n\n// Hardcoded literal defaults for `PHGlobalConfig` fields whose env-var\n// source was removed. The fields stay on the type so wired-but-dead SW /\n// hook consumers keep typechecking; values mirror the previous Zod\n// defaults.\nfunction getBuiltInDefaults(): Omit<\n PHGlobalConfig,\n \"basePath\" | \"routerBasename\"\n> {\n const studioMode = runtime.app?.studioMode ?? false;\n // Drive containers, DocumentModel, and vetra builder-spec types are authored\n // via their own drives — never creatable from a generic drive.\n const disabledEditors = [\n \"powerhouse/document-drive\",\n \"powerhouse/reactor-drive\",\n \"powerhouse/document-model\",\n \"powerhouse/app\",\n \"powerhouse/document-editor\",\n \"powerhouse/processor\",\n \"powerhouse/subgraph\",\n \"powerhouse/package\",\n ];\n return {\n allowList: undefined,\n allowedDocumentTypes: [],\n isDragAndDropEnabled: true,\n isEditorDebugModeEnabled: false,\n isEditorReadModeEnabled: false,\n isExternalControlsEnabled: false,\n version: env.PH_CONNECT_VERSION,\n logLevel: runtime.app?.logLevel,\n requiresHardRefresh: true,\n warnOutdatedApp: true,\n studioMode,\n versionCheckInterval: 60 * 60 * 1000,\n cliVersion: env.PH_CONNECT_CLI_VERSION,\n fileUploadOperationsChunkSize: 50,\n gaTrackingId: undefined,\n defaultDrivesUrl: runtime.drives?.defaultDrives?.find(\n (drive) => \"url\" in drive,\n )?.url,\n drivesPreserveStrategy: runtime.drives?.preserveStrategy,\n enabledEditors: undefined,\n disabledEditors,\n\n /* Processors */\n isExternalProcessorsEnabled: true,\n // Analytics off by default; flip to true (or wire a runtime-config field)\n // when we want analytics enabled out of the box.\n isAnalyticsEnabled: false,\n isAnalyticsExternalProcessorsEnabled:\n env.PH_CONNECT_EXTERNAL_ANALYTICS_PROCESSORS_ENABLED,\n analyticsDatabaseName: undefined,\n isRelationalProcessorsEnabled: true,\n isExternalRelationalProcessorsEnabled: true,\n\n renownUrl: runtime.renown?.url,\n renownNetworkId: runtime.renown?.networkId,\n renownChainId: runtime.renown?.chainId,\n switchboardUrl: runtime.renown?.switchboardUrl,\n renownAdapters: runtime.renown?.adapters,\n sentryRelease: PH_CONNECT_SENTRY_RELEASE,\n sentryDsn: runtime.sentry?.dsn ?? undefined,\n sentryEnv: runtime.sentry?.env,\n isDiffAnalyticsEnabled: env.PH_CONNECT_DIFF_ANALYTICS_ENABLED,\n isDriveAnalyticsEnabled: env.PH_CONNECT_DRIVE_ANALYTICS_ENABLED,\n isPublicDrivesEnabled: runtime.drives?.sections?.remote?.enabled,\n isCloudDrivesEnabled: runtime.drives?.sections?.remote?.enabled ?? true,\n isLocalDrivesEnabled: runtime.drives?.sections?.local?.enabled,\n isSentryTracingEnabled: runtime.sentry?.tracing,\n isDocumentModelSelectionSettingsEnabled: false,\n isAddDriveEnabled: runtime.drives?.allowAddDrive,\n isAddPublicDrivesEnabled: runtime.drives?.sections?.remote?.allowAdd,\n isDeletePublicDrivesEnabled: runtime.drives?.sections?.remote?.allowDelete,\n isAddCloudDrivesEnabled: runtime.drives?.sections?.remote?.allowAdd ?? true,\n isDeleteCloudDrivesEnabled:\n runtime.drives?.sections?.remote?.allowDelete ?? true,\n isAddLocalDrivesEnabled: runtime.drives?.sections?.local?.allowAdd,\n isDeleteLocalDrivesEnabled: runtime.drives?.sections?.local?.allowDelete,\n isAnalyticsDatabaseWorkerEnabled: false,\n isExternalPackagesEnabled: runtime.packages?.externalEnabled,\n };\n}\n\nexport function buildPHGlobalConfig(\n basePath: string,\n routerBasename: string,\n connectFromConfig: PHConnectRuntimeConfig,\n): PHGlobalConfig {\n const defaults = getBuiltInDefaults();\n const fileOverrides: Partial<PHGlobalConfig> = {};\n\n if (connectFromConfig.drives?.allowAddDrive !== undefined) {\n fileOverrides.isAddDriveEnabled = connectFromConfig.drives.allowAddDrive;\n }\n\n return {\n basePath,\n routerBasename,\n ...defaults,\n ...fileOverrides,\n };\n}\n\nfunction getPHGlobalConfigFromRuntime(): PHGlobalConfig {\n // Deploy base wins via getDeployBasePath: the dynamic-base global when set,\n // else runtime.app.basePath (DEFAULT_CONNECT_CONFIG guarantees it defined),\n // with a \"/\" fallback as a defensive guard for typecheck.\n const basePath = getDeployBasePath() ?? \"/\";\n const routerBasename = getRouterBasenameFromBasePath(basePath);\n return buildPHGlobalConfig(basePath, routerBasename, runtime);\n}\n\nexport const phGlobalConfig = getPHGlobalConfigFromRuntime();\n\nexport const defaultPHDocumentEditorConfig: PHDocumentEditorConfig = {\n isExternalControlsEnabled: phGlobalConfig.isExternalControlsEnabled,\n};\n\nexport const defaultPHAppConfig: PHAppConfig = {\n allowedDocumentTypes: phGlobalConfig.allowedDocumentTypes,\n isDragAndDropEnabled: phGlobalConfig.isDragAndDropEnabled,\n};\n\n// Set log level from the runtime config (DEFAULT_CONNECT_CONFIG provides a\n// fallback, so this is always defined).\nconst RESOLVED_LOG_LEVEL = runtime.app?.logLevel;\nif (RESOLVED_LOG_LEVEL) {\n setLogLevel(RESOLVED_LOG_LEVEL);\n}\nlogger.debug(\"Setting log level to @level.\", RESOLVED_LOG_LEVEL);\n\n// Normalize the base path to ensure it starts and ends with a forward slash.\nexport const PH_CONNECT_BASE_PATH = normalizeBasePath(\n getDeployBasePath() ?? \"/\",\n);\n\n// Analytics database name — derived deterministically from the base path so\n// instances on different prefixes of one origin do not share an analytics DB.\n// Root resolves to \":analytics\".\nconst PH_CONNECT_ANALYTICS_DATABASE_NAME = `${PH_CONNECT_BASE_PATH.replace(\n /\\//g,\n \"\",\n)}:analytics`;\n\n// The CLOUD section was collapsed into the unified `remote` section. PUBLIC\n// keeps its existing string identifier in the legacy\n// connectConfig.drives.sections map to avoid rippling through downstream UI\n// components — both PUBLIC and the\n// soon-to-be-removed CLOUD readers point at runtime.drives.sections.remote.\nexport const connectConfig = {\n appVersion: env.PH_CONNECT_VERSION,\n studioMode: runtime.app?.studioMode ?? false,\n // Boot-time constant, so it is read straight off the runtime config rather\n // than through the PHGlobalConfig event machinery. Off unless turned on.\n workflowsEnabled: runtime.app?.workflowsEnabled ?? false,\n warnOutdatedApp: phGlobalConfig.warnOutdatedApp,\n appVersionCheckInterval: 60 * 60 * 1000,\n routerBasename: PH_CONNECT_BASE_PATH,\n offline: runtime.app?.offline ?? true,\n aiAssistantEnabled: runtime.ai?.assistantEnabled ?? false,\n externalPackagesEnabled: runtime.packages?.externalEnabled,\n processors: {\n enabled: true,\n externalProcessorsEnabled: true,\n },\n analytics: {\n enabled: true,\n databaseName: PH_CONNECT_ANALYTICS_DATABASE_NAME,\n useWorker: false,\n driveAnalyticsEnabled: env.PH_CONNECT_DRIVE_ANALYTICS_ENABLED,\n diffProcessorEnabled: env.PH_CONNECT_DIFF_ANALYTICS_ENABLED,\n externalProcessorsEnabled: true,\n },\n relational: {\n enabled: true,\n externalProcessorsEnabled: true,\n },\n openPanel: {\n clientId: env.PH_CONNECT_OPENPANEL_CLIENT_ID ?? \"\",\n apiUrl: env.PH_CONNECT_OPENPANEL_API_URL,\n // Intentionally dormant — no call sites gate on this yet; UI-event tracking is future work.\n trackUiEvents: env.PH_CONNECT_OPENPANEL_TRACK_UI_EVENTS,\n trackOperations: env.PH_CONNECT_OPENPANEL_TRACK_OPERATIONS,\n },\n renown: {\n url: runtime.renown?.url,\n networkId: runtime.renown?.networkId,\n chainId: runtime.renown?.chainId,\n namespace: runtime.renown?.namespace,\n switchboardUrl: runtime.renown?.switchboardUrl,\n adapters: runtime.renown?.adapters,\n },\n sentry: {\n release: PH_CONNECT_SENTRY_RELEASE,\n // `dsn: null` (default) means Sentry is disabled — useInitSentry bails.\n dsn: runtime.sentry?.dsn ?? null,\n env: runtime.sentry?.env,\n tracing: runtime.sentry?.tracing ?? false,\n },\n content: {\n showSearchBar: false,\n showDocumentModelSelectionSetting: false,\n },\n drives: {\n addDriveEnabled: runtime.drives?.allowAddDrive,\n preserveStrategy: runtime.drives?.preserveStrategy,\n // The legacy `SharingType` enum still includes a \"CLOUD\" variant.\n // Connect collapsed CLOUD into the unified remote section, so both CLOUD\n // and PUBLIC map to the same `runtime.drives.sections.remote` object —\n // the alias keeps `sections[sharingType]` lookups type-safe for every\n // SharingType value.\n sections: (() => {\n const remote = {\n enabled: runtime.drives?.sections?.remote?.enabled,\n allowAdd: runtime.drives?.sections?.remote?.allowAdd,\n allowDelete: runtime.drives?.sections?.remote?.allowDelete,\n };\n return {\n LOCAL: {\n enabled: runtime.drives?.sections?.local?.enabled,\n allowAdd: runtime.drives?.sections?.local?.allowAdd,\n allowDelete: runtime.drives?.sections?.local?.allowDelete,\n },\n PUBLIC: remote,\n CLOUD: remote,\n };\n })(),\n },\n gaTrackingId: undefined,\n phCliVersion: env.PH_CONNECT_CLI_VERSION,\n} as const;\n"],"names":[],"mappings":";;;;;;;AAkBA,MAAa,MAAM,eAAe,EAChC,YAAY,OAAO,KAAK,KACzB,CAAC;AASF,MAAM,UAAU,kBAAkB,CAAC;AAEnC,SAAS,8BAA8B,UAAkB;AACvD,QAAO,SAAS,SAAS,IAAI,GAAG,WAAW,WAAW;;AASxD,SAAS,oBAAoB;AAC3B,KACE,OAAO,eAAe,eACrB,WAAgD,oBAEjD,QAAO,OAAO,KAAK,IAAI;AAEzB,QAAO,QAAQ,KAAK,YAAY,OAAO,KAAK,IAAI;;AAOlD,SAAS,qBAGP;CACA,MAAM,aAAa,QAAQ,KAAK,cAAc;AAa9C,QAAO;EACL,WAAW,KAAA;EACX,sBAAsB,EAAE;EACxB,sBAAsB;EACtB,0BAA0B;EAC1B,yBAAyB;EACzB,2BAA2B;EAC3B,SAAS,IAAI;EACb,UAAU,QAAQ,KAAK;EACvB,qBAAqB;EACrB,iBAAiB;EACjB;EACA,sBAAsB,OAAU;EAChC,YAAY,IAAI;EAChB,+BAA+B;EAC/B,cAAc,KAAA;EACd,kBAAkB,QAAQ,QAAQ,eAAe,MAC9C,UAAU,SAAS,MACrB,EAAE;EACH,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KAAK,QAAQ,QAAQ;EACrB,SAAS,QAAQ,QAAQ,WAAW;EACrC;CACD,SAAS;EACP,eAAe;EACf,mCAAmC;EACpC;CACD,QAAQ;EACN,iBAAiB,QAAQ,QAAQ;EACjC,kBAAkB,QAAQ,QAAQ;EAMlC,iBAAiB;GACf,MAAM,SAAS;IACb,SAAS,QAAQ,QAAQ,UAAU,QAAQ;IAC3C,UAAU,QAAQ,QAAQ,UAAU,QAAQ;IAC5C,aAAa,QAAQ,QAAQ,UAAU,QAAQ;IAChD;AACD,UAAO;IACL,OAAO;KACL,SAAS,QAAQ,QAAQ,UAAU,OAAO;KAC1C,UAAU,QAAQ,QAAQ,UAAU,OAAO;KAC3C,aAAa,QAAQ,QAAQ,UAAU,OAAO;KAC/C;IACD,QAAQ;IACR,OAAO;IACR;MACC;EACL;CACD,cAAc,KAAA;CACd,cAAc,IAAI;CACnB","debug_id":"403c52f3-f935-584b-b8c9-9a6e2d7485a1"}
|
|
@@ -1,8 +1,8 @@
|
|
|
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]="
|
|
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]="2834a590-1adc-54e5-af9a-33770bdfcc6b")}catch(e){}}();
|
|
3
3
|
import { n as getRuntimeConfig } from "./runtime-config-DL3QjcfM.js";
|
|
4
4
|
import { n as isMigratableMajor, t as coerceMajor, u as readPgVersionFile } from "./pglite-major-D3sdYMs2.js";
|
|
5
|
-
import { t as PH_CONNECT_BASE_PATH } from "./connect.config-
|
|
5
|
+
import { t as PH_CONNECT_BASE_PATH } from "./connect.config-BofwIsWJ.js";
|
|
6
6
|
import { ROOT_STORAGE_NAMESPACE, getStorageNamespace } from "@powerhousedao/shared/connect";
|
|
7
7
|
import { DEFAULT_RELATIONAL_PROCESSOR_DB_NAME, hashNamespace } from "@powerhousedao/shared/processors";
|
|
8
8
|
//#region src/utils/reactor-namespace.ts
|
|
@@ -122,5 +122,5 @@ function subscribeWorkerConnection(listener) {
|
|
|
122
122
|
//#endregion
|
|
123
123
|
export { detectReactorPgMajor as a, getCachedReactorPgMajor as c, subscribeReactorPgMajor as d, PRIMARY_IDB_NAMES as f, RELATIONAL_PGLITE_NAME as h, detectMigrationMajor as i, invalidateReactorPgMajorCache as l, REACTOR_PGLITE_NAME as m, setWorkerConnectionStatus as n, detectRelationalPgMajor as o, REACTOR_INSTANCE_NAMESPACE as p, subscribeWorkerConnection as r, getCachedMigrationMajor as s, getWorkerConnectionStatus as t, subscribeMigrationMajor as u };
|
|
124
124
|
|
|
125
|
-
//# sourceMappingURL=connection-state-
|
|
126
|
-
//# debugId=
|
|
125
|
+
//# sourceMappingURL=connection-state-DAqW06pk.js.map
|
|
126
|
+
//# debugId=2834a590-1adc-54e5-af9a-33770bdfcc6b
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"connection-state-
|
|
1
|
+
{"version":3,"file":"connection-state-DAqW06pk.js","sources":["../src/utils/reactor-namespace.ts","../src/utils/storage-namespace.ts","../src/utils/pglite-runtime.ts","../src/connection-state.ts"],"sourcesContent":["import { getStorageNamespace } from \"@powerhousedao/shared/connect\";\nimport { hashNamespace } from \"@powerhousedao/shared/processors\";\n\nexport type ReactorNamespaceInput = {\n basePath: string;\n explicit?: string;\n endpoint?: string;\n};\n\nexport function resolveReactorNamespace(input: ReactorNamespaceInput): string {\n const explicit = input.explicit?.trim();\n if (explicit) {\n return explicit;\n }\n const base = getStorageNamespace(input.basePath);\n const endpoint = input.endpoint?.trim();\n if (endpoint) {\n return `${base}--${hashNamespace(endpoint, 8)}`;\n }\n return base;\n}\n","import { DEFAULT_RELATIONAL_PROCESSOR_DB_NAME } from \"@powerhousedao/shared/processors\";\nimport { ROOT_STORAGE_NAMESPACE } from \"@powerhousedao/shared/connect\";\nimport { PH_CONNECT_BASE_PATH } from \"../connect.config.js\";\nimport { getRuntimeConfig } from \"../runtime-config.js\";\nimport { resolveReactorNamespace } from \"./reactor-namespace.js\";\n\nexport const REACTOR_INSTANCE_NAMESPACE = resolveReactorNamespace({\n basePath: PH_CONNECT_BASE_PATH,\n explicit: getRuntimeConfig().connect.instance?.namespace ?? undefined,\n});\n\nexport const REACTOR_PGLITE_NAME = REACTOR_INSTANCE_NAMESPACE;\n\nexport const RELATIONAL_PGLITE_NAME =\n REACTOR_INSTANCE_NAMESPACE === ROOT_STORAGE_NAMESPACE\n ? DEFAULT_RELATIONAL_PROCESSOR_DB_NAME\n : `${REACTOR_INSTANCE_NAMESPACE}-${DEFAULT_RELATIONAL_PROCESSOR_DB_NAME}`;\n\n// Here, not pglite-idb.ts, so those IDB helpers stay free of runtime-config\n// and remain importable by the reactor SharedWorker.\nexport const REACTOR_IDB_NAME = `/pglite/${REACTOR_PGLITE_NAME}`;\nexport const RELATIONAL_IDB_NAME = `/pglite/${RELATIONAL_PGLITE_NAME}`;\nexport const PRIMARY_IDB_NAMES = [\n REACTOR_IDB_NAME,\n RELATIONAL_IDB_NAME,\n] as const;\n","import { readPgVersionFile } from \"./pglite-idb.js\";\nimport {\n coerceMajor,\n isMigratableMajor,\n type DetectedMajor,\n} from \"./pglite-major.js\";\nimport { REACTOR_IDB_NAME, RELATIONAL_IDB_NAME } from \"./storage-namespace.js\";\n\nexport {\n CURRENT_PG_MAJOR,\n SUPPORTED_PG_MAJORS,\n coerceMajor,\n resolvePgMajorForRuntime,\n loadPGliteModule,\n loadPgDump,\n type SupportedPgMajor,\n type DetectedMajor,\n} from \"./pglite-major.js\";\n\nlet cachedReactorMajor: DetectedMajor | undefined;\nlet inflight: Promise<DetectedMajor> | undefined;\nconst majorListeners = new Set<() => void>();\n\nlet cachedMigrationMajor: DetectedMajor | undefined;\nlet migrationInflight: Promise<DetectedMajor> | undefined;\nconst migrationListeners = new Set<() => void>();\n\nfunction notifyMajorChanged() {\n for (const l of majorListeners) l();\n}\n\nfunction notifyMigrationChanged() {\n for (const l of migrationListeners) l();\n}\n\nexport function subscribeReactorPgMajor(cb: () => void): () => void {\n majorListeners.add(cb);\n return () => {\n majorListeners.delete(cb);\n };\n}\n\nexport async function detectReactorPgMajor(): Promise<DetectedMajor> {\n if (cachedReactorMajor !== undefined) return cachedReactorMajor;\n if (inflight) return inflight;\n\n inflight = (async () => {\n const major = coerceMajor(await readPgVersionFile(REACTOR_IDB_NAME));\n cachedReactorMajor = major;\n notifyMajorChanged();\n return major;\n })();\n try {\n return await inflight;\n } finally {\n inflight = undefined;\n }\n}\n\nexport function getCachedReactorPgMajor(): DetectedMajor | undefined {\n return cachedReactorMajor;\n}\n\nexport function invalidateReactorPgMajorCache(): void {\n cachedReactorMajor = undefined;\n cachedMigrationMajor = undefined;\n notifyMajorChanged();\n notifyMigrationChanged();\n}\n\nexport async function detectRelationalPgMajor(): Promise<DetectedMajor> {\n return coerceMajor(await readPgVersionFile(RELATIONAL_IDB_NAME));\n}\n\nexport function subscribeMigrationMajor(cb: () => void): () => void {\n migrationListeners.add(cb);\n return () => {\n migrationListeners.delete(cb);\n };\n}\n\nexport function getCachedMigrationMajor(): DetectedMajor | undefined {\n return cachedMigrationMajor;\n}\n\n/**\n * Legacy major the migration banner should prompt for: the first primary store\n * (reactor or relational) on a supported, non-current major. Spans both stores\n * to match migrateAllIfNeeded.\n */\nexport async function detectMigrationMajor(): Promise<DetectedMajor> {\n if (cachedMigrationMajor !== undefined) return cachedMigrationMajor;\n if (migrationInflight) return migrationInflight;\n\n migrationInflight = (async () => {\n const majors = await Promise.all([\n readPgVersionFile(REACTOR_IDB_NAME),\n readPgVersionFile(RELATIONAL_IDB_NAME),\n ]);\n const legacy = majors.find(isMigratableMajor) ?? null;\n cachedMigrationMajor = legacy;\n notifyMigrationChanged();\n return legacy;\n })();\n try {\n return await migrationInflight;\n } finally {\n migrationInflight = undefined;\n }\n}\n","export type WorkerConnectionStatus = \"connected\" | \"lost\";\n\nlet status: WorkerConnectionStatus = \"connected\";\nconst listeners = new Set<() => void>();\n\nexport function getWorkerConnectionStatus(): WorkerConnectionStatus {\n return status;\n}\n\nexport function setWorkerConnectionStatus(next: WorkerConnectionStatus): void {\n if (status === next) {\n return;\n }\n status = next;\n for (const listener of [...listeners]) {\n listener();\n }\n}\n\nexport function subscribeWorkerConnection(listener: () => void): () => void {\n listeners.add(listener);\n return () => {\n listeners.delete(listener);\n };\n}\n"],"names":[],"mappings":";;;;;;;;AASA,SAAgB,wBAAwB,OAAsC;CAC5E,MAAM,WAAW,MAAM,UAAU,MAAM;AACvC,KAAI,SACF,QAAO;CAET,MAAM,OAAO,oBAAoB,MAAM,SAAS;CAChD,MAAM,WAAW,MAAM,UAAU,MAAM;AACvC,KAAI,SACF,QAAO,GAAG,KAAK,IAAI,cAAc,UAAU,EAAE;AAE/C,QAAO;;;;ACbT,MAAa,6BAA6B,wBAAwB;CAChE,UAAU;CACV,UAAU,kBAAkB,CAAC,QAAQ,UAAU,aAAa,KAAA;CAC7D,CAAC;AAEF,MAAa,sBAAsB;AAEnC,MAAa,yBACX,+BAA+B,yBAC3B,uCACA,GAAG,2BAA2B,GAAG;AAIvC,MAAa,mBAAmB,WAAW;AAC3C,MAAa,sBAAsB,WAAW;AAC9C,MAAa,oBAAoB,CAC/B,kBACA,oBACD;;;ACND,IAAI;AACJ,IAAI;AACJ,MAAM,iCAAiB,IAAI,KAAiB;AAE5C,IAAI;AACJ,IAAI;AACJ,MAAM,qCAAqB,IAAI,KAAiB;AAEhD,SAAS,qBAAqB;AAC5B,MAAK,MAAM,KAAK,eAAgB,IAAG;;AAGrC,SAAS,yBAAyB;AAChC,MAAK,MAAM,KAAK,mBAAoB,IAAG;;AAGzC,SAAgB,wBAAwB,IAA4B;AAClE,g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,WAAU,IAAI,SAAS;AACvB,cAAa;AACX,YAAU,OAAO,SAAS","debug_id":"2834a590-1adc-54e5-af9a-33770bdfcc6b"}
|
|
@@ -1,7 +1,7 @@
|
|
|
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]="
|
|
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]="fa3623af-f876-5786-bd60-ed7b5bb30a6a")}catch(e){}}();
|
|
3
3
|
import { t as i18n } from "./i18n-90Q8hAPL.js";
|
|
4
|
-
import { n as useAcceptedCookies, r as useCookieBanner } from "./preferences-store-
|
|
4
|
+
import { n as useAcceptedCookies, r as useCookieBanner } from "./preferences-store-Coa1SHvi.js";
|
|
5
5
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
6
6
|
import { Trans, useTranslation } from "react-i18next";
|
|
7
7
|
import { CookieBanner as CookieBanner$1 } from "@powerhousedao/design-system/connect";
|
|
@@ -66,5 +66,5 @@ const CookieBanner = () => {
|
|
|
66
66
|
//#endregion
|
|
67
67
|
export { CookieBanner };
|
|
68
68
|
|
|
69
|
-
//# sourceMappingURL=cookie-banner-
|
|
70
|
-
//# debugId=
|
|
69
|
+
//# sourceMappingURL=cookie-banner-BQescTYk.js.map
|
|
70
|
+
//# debugId=fa3623af-f876-5786-bd60-ed7b5bb30a6a
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cookie-banner-
|
|
1
|
+
{"version":3,"file":"cookie-banner-BQescTYk.js","sources":["../src/components/cookie-banner.tsx"],"sourcesContent":["import {\n useAcceptedCookies,\n useCookieBanner,\n} from \"../hooks/preferences-store.js\";\nimport type { CookieInput } from \"@powerhousedao/design-system/connect\";\nimport { CookieBanner as PHCookieBanner } from \"@powerhousedao/design-system/connect\";\nimport { showPHModal } from \"@powerhousedao/reactor-browser\";\nimport { Trans, useTranslation } from \"react-i18next\";\nimport { i18n } from \"@powerhousedao/connect/i18n\";\n\nconst isCookieAccepted = (cookies: CookieInput[], id: string) => {\n return cookies.some((cookie) => cookie.id === id && cookie.value);\n};\n\nexport const CookieBanner = () => {\n const { t } = useTranslation(undefined, {\n useSuspense: true,\n i18n,\n });\n const [showBanner, setShowBanner] = useCookieBanner();\n const [, setAcceptedCookies] = useAcceptedCookies();\n\n const cookiesInput: CookieInput[] = [\n {\n id: \"analytics-cookie\",\n label: t(\"cookieBanner.cookies.analytics\"),\n value: true,\n },\n ];\n\n const handleAccept = (cookies: CookieInput[]) => {\n setShowBanner(false);\n\n if (isCookieAccepted(cookies, \"analytics-cookie\")) {\n setAcceptedCookies((acceptedCookies) => ({\n ...acceptedCookies,\n analytics: true,\n }));\n }\n };\n\n const handleReject = () => {\n setShowBanner(false);\n setAcceptedCookies(() => ({\n analytics: false,\n functional: false,\n marketing: false,\n }));\n };\n\n if (!showBanner) {\n return null;\n }\n\n return (\n <div className=\"absolute inset-0 z-10000 backdrop-blur-sm\">\n <div className=\"absolute inset-0 bg-primary opacity-15\" />\n <div className=\"absolute inset-x-0 bottom-0 flex justify-center bg-background px-10 pt-10 pb-16 shadow-lg\">\n <PHCookieBanner\n className=\"max-w-[1024px]\"\n cookies={cookiesInput}\n onSubmit={handleAccept}\n onReject={handleReject}\n submitLabel={t(\"cookieBanner.accept\")}\n rejectLabel={t(\"cookieBanner.reject\")}\n >\n <p className=\"font-semibold text-muted-foreground\">\n <Trans\n key={\"cookieBanner.message\"}\n i18nKey=\"cookieBanner.message\"\n components={{\n a: (\n <a\n onClick={() => showPHModal({ type: \"cookiesPolicy\" })}\n key={\"cookieBanner.message-link\"}\n className=\"cursor-pointer text-foreground hover:underline\"\n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 -1,12 +1,12 @@
|
|
|
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]="
|
|
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]="3980bf8e-b8e8-5742-ade4-86f1e5daf4ab")}catch(e){}}();
|
|
3
3
|
import { r as loadRuntimeConfig, t as applyConnectBranding } from "./runtime-config-DL3QjcfM.js";
|
|
4
|
-
import { r as connectConfig } from "./connect.config-
|
|
4
|
+
import { r as connectConfig } from "./connect.config-BofwIsWJ.js";
|
|
5
5
|
import { n as setUser } from "./sentry-QXKgQmr2.js";
|
|
6
|
-
import { t as getBuildHash } from "./build-info-
|
|
7
|
-
import { a as detectReactorPgMajor, i as detectMigrationMajor } from "./connection-state-
|
|
8
|
-
import { n as seedPendingPgVersion } from "./pglite-seed-
|
|
9
|
-
import { n as createReactor } from "./reactor-
|
|
6
|
+
import { t as getBuildHash } from "./build-info-D0HdsjsO.js";
|
|
7
|
+
import { a as detectReactorPgMajor, i as detectMigrationMajor } from "./connection-state-DAqW06pk.js";
|
|
8
|
+
import { n as seedPendingPgVersion } from "./pglite-seed-ChNTfFkc.js";
|
|
9
|
+
import { n as createReactor } from "./reactor-DR2eIP5w.js";
|
|
10
10
|
import { useEffect } from "react";
|
|
11
11
|
import { initTheme, useUser } from "@powerhousedao/reactor-browser";
|
|
12
12
|
import { logger } from "document-model";
|
|
@@ -127,5 +127,5 @@ async function loadComponent(localPackage) {
|
|
|
127
127
|
//#endregion
|
|
128
128
|
export { loadComponent };
|
|
129
129
|
|
|
130
|
-
//# sourceMappingURL=load-
|
|
131
|
-
//# debugId=
|
|
130
|
+
//# sourceMappingURL=load-BCywb9js.js.map
|
|
131
|
+
//# debugId=3980bf8e-b8e8-5742-ade4-86f1e5daf4ab
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"load-
|
|
1
|
+
{"version":3,"file":"load-BCywb9js.js","sources":["../src/hooks/useCheckLatestVersion.ts","../src/hooks/utils.ts","../src/store/user.ts","../src/components/load.tsx"],"sourcesContent":["import { connectConfig } from \"@powerhousedao/connect/config\";\nimport { getBuildHashStatus } from \"@powerhousedao/connect/hooks\";\nimport { logger } from \"document-model\";\nimport { useEffect } from \"react\";\n\n// Session-scoped guard: records the deployed hash this tab already reloaded\n// for, so a broken or rolling deploy (server hash keeps changing under us)\n// cannot turn the tab into a reload loop. Cleared implicitly with the tab.\nconst RELOADED_FOR_KEY = \"ph-reloaded-for-build-hash\";\n\n/**\n * Drop the service worker's stale caches (precache + the NetworkFirst shell\n * cache) before reloading onto a new deploy, so the post-reload navigation\n * is answered from the network / fresh build instead of leftovers of the\n * build we are leaving. Best-effort: if the Caches API is unavailable or a\n * delete fails, the reload still picks up the new shell (the navigation\n * route is NetworkFirst).\n */\nasync function clearStaleCaches(): Promise<void> {\n try {\n if (!(\"caches\" in window)) return;\n const keys = await window.caches.keys();\n await Promise.all(\n keys\n .filter((key) => key.includes(\"precache\") || key.includes(\"ph-shell\"))\n .map((key) => window.caches.delete(key)),\n );\n } catch (error) {\n logger.warn(\n \"Failed to clear stale caches before update reload @error\",\n error,\n );\n }\n}\n\n/**\n * Detects that the server is serving a different build than the one this\n * page was loaded from (a new deploy) and reloads onto it — once per session\n * per deployed hash. Checked on mount and whenever the tab returns to the\n * foreground, so a deploy that lands while the tab sits open is picked up on\n * the next focus without a manual reload. The in-tab \"new version available\"\n * service-worker prompt (ServiceWorkerUpdatePrompt) remains the opt-in path\n * for workers that are waiting but not yet controlling.\n */\nexport const useCheckLatestVersion = () => {\n useEffect(() => {\n if (\n import.meta.env.MODE === \"development\" ||\n connectConfig.studioMode ||\n !connectConfig.warnOutdatedApp\n ) {\n return;\n }\n\n const checkBuildHash = async () => {\n const status = await getBuildHashStatus();\n if (!status || status.isCurrent) return;\n\n const reloadedFor = window.sessionStorage.getItem(RELOADED_FOR_KEY);\n if (reloadedFor === status.deployedHash) return;\n window.sessionStorage.setItem(RELOADED_FOR_KEY, status.deployedHash);\n\n logger.info(\n \"New deploy detected — reloading from build @currentHash to @deployedHash\",\n status.currentHash,\n status.deployedHash,\n );\n await clearStaleCaches();\n window.location.reload();\n };\n\n void checkBuildHash();\n const onVisibilityChange = () => {\n if (document.visibilityState === \"visible\") void checkBuildHash();\n };\n document.addEventListener(\"visibilitychange\", onVisibilityChange);\n return () => {\n document.removeEventListener(\"visibilitychange\", onVisibilityChange);\n };\n }, []);\n};\n","import { getBuildHash } from \"../utils/build-info.js\";\n\nexport const isMac = window.navigator.appVersion.includes(\"Mac\");\n\nexport interface BuildHashStatus {\n /** Hash baked into the running build. */\n currentHash: string;\n /** Hash the server is currently serving. */\n deployedHash: string;\n /** true when the running build matches what the server serves. */\n isCurrent: boolean;\n}\n\n/**\n * Same-origin build-identity probe. The build bakes a hash of the inputs that\n * determine the deployed content into the bundle (define\n * `PH_CONNECT_BUILD_HASH`, see builder-tools' connectBuildHashPlugin) and\n * emits `build-hash.json` next to the app (served no-cache). Comparing the\n * two tells us whether the server is serving a different build than the one\n * this page was loaded from — the reliable \"a new deploy went out\" signal.\n * Unlike the old GitHub-raw version check it works on localhost (it compares\n * against what the origin actually serves, not a remote branch head) and\n * needs no network beyond the app's own origin.\n *\n * Returns null when there is nothing to compare: dev/studio builds (no hash\n * baked), a server predating `build-hash.json`, an offline fetch, or a\n * malformed body.\n */\nexport const getBuildHashStatus = async (): Promise<BuildHashStatus | null> => {\n const currentHash = getBuildHash();\n if (!currentHash || currentHash === \"unknown\") return null;\n try {\n const result = await fetch(`${import.meta.env.BASE_URL}build-hash.json`, {\n cache: \"no-cache\",\n });\n if (!result.ok) return null;\n const data = (await result.json()) as { hash?: unknown };\n if (typeof data.hash !== \"string\" || !data.hash) return null;\n return {\n currentHash,\n deployedHash: data.hash,\n isCurrent: data.hash === currentHash,\n };\n } catch {\n return null;\n }\n};\n","import { useUser } from \"@powerhousedao/reactor-browser\";\nimport type { User as SentryUser } from \"@sentry/react\";\nimport { useEffect } from \"react\";\nimport { setUser as setSentryUser } from \"../services/sentry.js\";\n\nexport function useSetSentryUser() {\n const user = useUser();\n useEffect(() => {\n let sentryUser: SentryUser | null = null;\n if (user) {\n // saves the user info except the credential\n const { credential: _credential, ...rest } = user;\n sentryUser = { id: rest.did, username: rest.ens?.name, ...rest };\n }\n setSentryUser(sentryUser);\n }, [user]);\n}\n","import { useCheckLatestVersion } from \"@powerhousedao/connect/hooks\";\nimport \"@powerhousedao/connect/i18n\";\nimport { createReactor, useSetSentryUser } from \"@powerhousedao/connect/store\";\nimport {\n detectMigrationMajor,\n detectReactorPgMajor,\n seedPendingPgVersion,\n} from \"@powerhousedao/connect/utils\";\nimport { initTheme } from \"@powerhousedao/reactor-browser\";\nimport type { DocumentModelLib } from \"document-model\";\nimport { type ReactNode } from \"react\";\nimport { applyConnectBranding, loadRuntimeConfig } from \"../runtime-config.js\";\n\nexport async function loadComponent(localPackage?: DocumentModelLib) {\n await seedPendingPgVersion();\n await Promise.all([detectReactorPgMajor(), detectMigrationMajor()]);\n const runtimeConfig = await loadRuntimeConfig();\n applyConnectBranding(runtimeConfig);\n await createReactor(localPackage);\n return {\n default: ({ children }: { children?: ReactNode }) => {\n initTheme();\n // eslint-disable-next-line react-hooks/rules-of-hooks\n useSetSentryUser();\n // eslint-disable-next-line react-hooks/rules-of-hooks\n useCheckLatestVersion();\n return children;\n },\n };\n}\n"],"names":[],"mappings":";;;;;;;;;;;;;AAQA,MAAM,mBAAmB;;;;;;;;;AAUzB,eAAe,mBAAkC;AAC/C,KAAI;AACF,MAAI,EAAE,YAAY,QAAS;EAC3B,MAAM,OAAO,MAAM,OAAO,OAAO,MAAM;AACvC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C1B;SACK;AACN,SAAO;;;;;ACvCX,SAAgB,mBAAmB;CACjC,MAAM,OAAO,SAAS;AACtB,iBAAgB;EACd,IAAI,aAAgC;AACpC,MAAI,MAAM;GAER,MAAM,EAAE,YAAY,aAAa,GAAG,SAAS;AAC7C,gBAAa;IAAE,IAAI,KAAK;IAAK,UAAU,KAAK,KAAK;IAAM,GAAG;IAAM;;AAElE,UAAc,WAAW;IACxB,CAAC,KAAK,CAAC;;;;ACFZ,eAAsB,cAAc,cAAiC;AACnE,OAAM,sBAAsB;AAC5B,OAAM,QAAQ,IAAI,CAAC,sBAAsB,EAAE,sBAAsB,CAAC,CAAC;AAEnE,sBADsB,MAAM,mBAAmB,CACZ;AACnC,OAAM,cAAc,aAAa;AACjC,QAAO,EACL,UAAU,EAAE,eAAyC;AACnD,aAAW;AAEX,oBAAkB;AAElB,yBAAuB;AACvB,SAAO;IAEV","debug_id":"3980bf8e-b8e8-5742-ade4-86f1e5daf4ab"}
|
package/dist/main.js
CHANGED
|
@@ -5,7 +5,7 @@ import { jsx } from "react/jsx-runtime";
|
|
|
5
5
|
//#region main.tsx
|
|
6
6
|
const root = await bootConnect();
|
|
7
7
|
if (root) {
|
|
8
|
-
const { AppLoader } = await import("./app-loader-
|
|
8
|
+
const { AppLoader } = await import("./app-loader-DNF0HVVm.js");
|
|
9
9
|
root.render(/* @__PURE__ */ jsx(AppLoader, {}));
|
|
10
10
|
}
|
|
11
11
|
//#endregion
|
|
@@ -1,5 +1,5 @@
|
|
|
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]="
|
|
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]="1b3f492a-b3e2-5b14-a419-ada62d3e771f")}catch(e){}}();
|
|
3
3
|
import { t as refreshPwaManifestLink } from "./pwa-manifest-link-B38lBmEu.js";
|
|
4
4
|
import { DYNAMIC_BASE_PLACEHOLDER, PWA_IDB_KEY, PWA_IDB_NAME, PWA_IDB_STORE, PWA_IDB_VERSION, checkSharedDeps, formatSharedDepWarnings, mergePwaConfig, withInferredCategory } from "@powerhousedao/shared/connect";
|
|
5
5
|
import { BrowserLocalStorage } from "@powerhousedao/reactor-browser";
|
|
@@ -8,6 +8,7 @@ import * as common from "@powerhousedao/powerhouse-vetra-packages";
|
|
|
8
8
|
import commonPkg from "@powerhousedao/powerhouse-vetra-packages/package.json" with { type: "json" };
|
|
9
9
|
import { PwaConfigSchema } from "@powerhousedao/shared/document-model";
|
|
10
10
|
import vetraPkg from "@powerhousedao/vetra/package.json" with { type: "json" };
|
|
11
|
+
import workflowPkg from "@powerhousedao/workflow/package.json" with { type: "json" };
|
|
11
12
|
//#region src/shared-deps.ts
|
|
12
13
|
/**
|
|
13
14
|
* Resolve the vendor's import-map values to absolute URLs: the
|
|
@@ -183,12 +184,16 @@ var BrowserPackageManager = class {
|
|
|
183
184
|
this.registryUrl = registryUrl;
|
|
184
185
|
this.#cdnUrl = registryUrl !== null ? toCdnUrl(registryUrl) : null;
|
|
185
186
|
}
|
|
186
|
-
async init(localPackage, localPackageVersion, studioMode) {
|
|
187
|
+
async init(localPackage, localPackageVersion, studioMode, workflowsEnabled) {
|
|
187
188
|
this.addLocalPackage(common.manifest.name, common, commonPkg.version);
|
|
188
189
|
if (studioMode) {
|
|
189
190
|
const vetra = await import("@powerhousedao/vetra");
|
|
190
191
|
this.addLocalPackage(vetra.manifest.name, vetra, vetraPkg.version);
|
|
191
192
|
}
|
|
193
|
+
if (workflowsEnabled) {
|
|
194
|
+
const workflow = await import("@powerhousedao/workflow");
|
|
195
|
+
this.addLocalPackage(workflow.manifest.name, workflow, workflowPkg.version);
|
|
196
|
+
}
|
|
192
197
|
if (localPackage) this.updateLocalPackage(localPackage, localPackageVersion);
|
|
193
198
|
for (const packageName of this.#storage.keys()) {
|
|
194
199
|
const specForReload = this.#storage.get(packageName)?.spec ?? packageName;
|
|
@@ -466,5 +471,5 @@ var BrowserPackageManager = class {
|
|
|
466
471
|
//#endregion
|
|
467
472
|
export { sharedDepMismatchWarnings as n, getSharedDeps as r, BrowserPackageManager as t };
|
|
468
473
|
|
|
469
|
-
//# sourceMappingURL=package-manager-
|
|
470
|
-
//# debugId=
|
|
474
|
+
//# sourceMappingURL=package-manager-CKEdIJGv.js.map
|
|
475
|
+
//# debugId=1b3f492a-b3e2-5b14-a419-ada62d3e771f
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"package-manager-CKEdIJGv.js","sources":["../src/shared-deps.ts","../src/utils/pwa-idb.ts","../src/package-manager.ts"],"sourcesContent":["import { DYNAMIC_BASE_PLACEHOLDER } from \"@powerhousedao/shared/connect\";\n\nexport type SharedDeps = {\n imports: Record<string, string>;\n versions: Record<string, string>;\n};\n\n/**\n * Resolve the vendor's import-map values to absolute URLs: the\n * dynamic-base placeholder (present in dynamic-base builds) is replaced\n * with the runtime base — which `import.meta.env.BASE_URL` already is,\n * since the dynamic-base plugin rewrites it to the resolved base — and\n * the result is made absolute against the page origin. Absolute URLs are\n * what the worker needs: its imports have no document context, so\n * relative or placeholder-based values would not resolve there.\n */\nexport function normalizeVendorImports(\n rawImports: Record<string, string>,\n runtimeBase: string,\n): Record<string, string> {\n // `location` is a browser global; the fallback keeps the helper usable\n // from node-based tests, where no origin exists.\n const origin =\n (globalThis as { location?: Location }).location?.origin ??\n \"http://localhost\";\n return Object.fromEntries(\n Object.entries(rawImports).map(([spec, value]) => [\n spec,\n new URL(value.replace(DYNAMIC_BASE_PLACEHOLDER, runtimeBase), origin)\n .href,\n ]),\n );\n}\n\nlet cached: Promise<SharedDeps | null> | null = null;\n\n/**\n * The production vendor's shared-deps table: import-map entries for the\n * shared dependency set plus the resolved version of every shared package\n * in this build. Fails soft (`null`) when the vendor is not present (dev,\n * or a `PH_CONNECT_VENDOR=0` build) — callers treat that as \"no sharing\".\n * The promise is cached: the vendor table is immutable per build.\n */\nexport function getSharedDeps(): Promise<SharedDeps | null> {\n cached ??= (async () => {\n try {\n const mod = (await import(\n /* @vite-ignore */ `${import.meta.env.BASE_URL}__vendor__/shared-deps.js`\n )) as {\n imports: Record<string, string>;\n versions: Record<string, string>;\n };\n return {\n imports: normalizeVendorImports(mod.imports, import.meta.env.BASE_URL),\n versions: mod.versions,\n };\n } catch {\n return null;\n }\n })();\n return cached;\n}\n","import {\n PWA_IDB_KEY,\n PWA_IDB_NAME,\n PWA_IDB_STORE,\n PWA_IDB_VERSION,\n type PHConnectPwa,\n type PHConnectPwaIcon,\n} from \"@powerhousedao/shared/connect\";\n\n// The page-owned mirror of the effective PWA fragment contributed by the\n// currently-installed packages. The service worker reads this (read-only) to\n// serve a live web-app manifest — a SW cannot reach localStorage (where the\n// package list lives), so BrowserPackageManager writes the merged fragment\n// here on every package change. The db/store/key/version constants are the\n// SHARED source of truth in @powerhousedao/shared/connect, imported by both\n// this writer and the SW reader so the two cannot desync.\n\nexport type PwaFragmentRecord = {\n version: 1;\n fragment: PHConnectPwa;\n updatedAt: number;\n};\n\n// Self-contained IDB open (not reusing pglite-idb) so this module — and its\n// pure `resolveFragmentAssetUrls` — carries no dependency on connect.config,\n// keeping it importable in isolation.\nfunction openPwaIdb(): Promise<IDBDatabase> {\n return new Promise((resolve, reject) => {\n const req = indexedDB.open(PWA_IDB_NAME, PWA_IDB_VERSION);\n req.onupgradeneeded = () => {\n if (!req.result.objectStoreNames.contains(PWA_IDB_STORE)) {\n req.result.createObjectStore(PWA_IDB_STORE);\n }\n };\n req.onerror = () => reject(req.error ?? new Error(\"ph-pwa open failed\"));\n req.onblocked = () => reject(new Error(\"ph-pwa open blocked\"));\n req.onsuccess = () => resolve(req.result);\n });\n}\n\n/** Write (replace) the single merged fragment record. Best-effort: a failure to\n * mirror the manifest must never break package installation, so callers ignore\n * rejections. No-op when IndexedDB is unavailable (SSR/tests). */\nexport async function writeMergedPwaFragment(\n fragment: PHConnectPwa,\n): Promise<void> {\n if (typeof indexedDB === \"undefined\") return;\n const db = await openPwaIdb();\n try {\n await new Promise<void>((resolve, reject) => {\n const tx = db.transaction(PWA_IDB_STORE, \"readwrite\");\n tx.oncomplete = () => resolve();\n tx.onerror = () =>\n reject(tx.error ?? new Error(\"PWA fragment write failed\"));\n tx.objectStore(PWA_IDB_STORE).put(\n {\n version: 1,\n fragment,\n updatedAt: Date.now(),\n } satisfies PwaFragmentRecord,\n PWA_IDB_KEY,\n );\n });\n } finally {\n db.close();\n }\n}\n\n/** Resolve `src` against the package `baseUrl`, absolute srcs passing through.\n * `baseUrl` may itself be relative (e.g. a same-origin-proxied registry, or the\n * dev `/node_modules/…` path), so it is first made absolute against the app\n * origin — `new URL(src, relativeBase)` would otherwise throw and silently\n * leave the src unresolved. A malformed src is left untouched. */\nfunction toAbsoluteAssetUrl(src: string, baseUrl: string): string {\n try {\n const origin =\n typeof location !== \"undefined\" ? location.href : \"http://localhost/\";\n return new URL(src, new URL(baseUrl, origin)).toString();\n } catch {\n return src;\n }\n}\n\nfunction resolveIconSrc(\n icon: PHConnectPwaIcon,\n baseUrl: string,\n): PHConnectPwaIcon {\n return { ...icon, src: toAbsoluteAssetUrl(icon.src, baseUrl) };\n}\n\n/**\n * Rewrite a package fragment's relative asset srcs (manifest icons and\n * file-handler icons) to absolute URLs against the package's base — a runtime\n * package's assets live on the registry CDN, not the app origin, so the served\n * manifest must point there. `baseUrl` null (a local/bundled package whose\n * assets are app-origin-relative) leaves srcs untouched.\n */\nexport function resolveFragmentAssetUrls(\n config: PHConnectPwa,\n baseUrl: string | null,\n): PHConnectPwa {\n if (!baseUrl || !config.manifest) return config;\n const m = config.manifest;\n const resolveIcons = (icons?: PHConnectPwaIcon[]) =>\n icons?.map((icon) => resolveIconSrc(icon, baseUrl));\n return {\n ...config,\n manifest: {\n ...m,\n icons: resolveIcons(m.icons),\n file_handlers: m.file_handlers?.map((handler) => ({\n ...handler,\n icons: resolveIcons(handler.icons),\n })),\n },\n };\n}\n","import * as common from \"@powerhousedao/powerhouse-vetra-packages\";\nimport commonPkg from \"@powerhousedao/powerhouse-vetra-packages/package.json\" with { type: \"json\" };\nimport type {\n IPackagesListener,\n PackageManagerInstallResult,\n} from \"@powerhousedao/reactor-browser\";\nimport {\n BrowserLocalStorage,\n type IPackageListerUnsubscribe,\n type IPackageManager,\n} from \"@powerhousedao/reactor-browser\";\nimport {\n checkSharedDeps,\n formatSharedDepWarnings,\n mergePwaConfig,\n type PHConnectPwa,\n type PwaContribution,\n withInferredCategory,\n} from \"@powerhousedao/shared/connect\";\nimport {\n type DocumentModelLib,\n type DocumentModelModule,\n PwaConfigSchema,\n} from \"@powerhousedao/shared/document-model\";\nimport { toCdnUrl } from \"@powerhousedao/shared/registry/urls\";\nimport { getSharedDeps } from \"./shared-deps.js\";\nimport {\n resolveFragmentAssetUrls,\n writeMergedPwaFragment,\n} from \"./utils/pwa-idb.js\";\nimport { refreshPwaManifestLink } from \"./utils/pwa-manifest-link.js\";\nimport vetraPkg from \"@powerhousedao/vetra/package.json\" with { type: \"json\" };\nimport workflowPkg from \"@powerhousedao/workflow/package.json\" with { type: \"json\" };\n\ntype PackageMeta = {\n name: string;\n importUrl: string | null;\n stylesheetUrl: string | null;\n version?: string;\n /**\n * Full spec the user asked for (e.g. `@scope/pkg@2.0.0-beta.2`). Kept so a\n * reload re-installs exactly the tag/version originally picked rather than\n * sliding to `latest`. Absent for legacy entries and local packages.\n */\n spec?: string;\n};\n\n/**\n * Strip any `@tag` / `@version` suffix from a package spec, returning the bare\n * package name. Mirrors `parsePackageSpec` on the UI side.\n */\nfunction parseBareName(spec: string): string {\n const trimmed = spec.trim();\n const at = trimmed.startsWith(\"@\")\n ? trimmed.lastIndexOf(\"@\")\n : trimmed.indexOf(\"@\");\n return at > 0 ? trimmed.slice(0, at) : trimmed;\n}\n\ntype PackageWithMeta = PackageMeta & {\n loadedPackage: DocumentModelLib<any>;\n spec?: string;\n};\n\ntype FetchedPackageJson = {\n version?: string;\n dependencies?: Record<string, unknown>;\n peerDependencies?: Record<string, unknown>;\n};\n\nasync function fetchPackageJson(\n baseUrl: string,\n): Promise<FetchedPackageJson | null> {\n try {\n const res = await fetch(baseUrl);\n if (!res.ok) return null;\n const pkg = (await res.json()) as {\n version?: unknown;\n dependencies?: Record<string, unknown>;\n peerDependencies?: Record<string, unknown>;\n };\n return {\n version: typeof pkg.version === \"string\" ? pkg.version : undefined,\n dependencies: pkg.dependencies,\n peerDependencies: pkg.peerDependencies,\n };\n } catch {\n return null;\n }\n}\n\nasync function fetchPackageJsonVersion(\n baseUrl: string,\n): Promise<string | undefined> {\n return (await fetchPackageJson(baseUrl))?.version;\n}\n\n/**\n * Human-readable warnings for shared-dep mismatches between a package's npm\n * `package.json` (as served by the CDN) and the host's shared-deps version\n * table. Empty when either side is unavailable — a dev / vendor-off host has\n * no table to compare against, and a missing package.json means the check\n * can't run. Used by both the install flow and the package-manager UI.\n */\nexport function sharedDepMismatchWarnings(\n pkgJson: FetchedPackageJson | null,\n hostVersions: Record<string, string> | null | undefined,\n): string[] {\n if (!pkgJson || !hostVersions) return [];\n return formatSharedDepWarnings(checkSharedDeps(pkgJson, hostVersions));\n}\n\nconst LOCAL_PACKAGE_NAME = \"Local\" as const;\n\nexport class BrowserPackageManager implements IPackageManager {\n registryUrl: string | null;\n #storage: BrowserLocalStorage<PackageMeta>;\n #packages: Map<string, DocumentModelLib<any>> = new Map();\n #subscribers = new Set<IPackagesListener>();\n #packagesMemo: DocumentModelLib<any>[] = [];\n #stylesheets: Map<string, HTMLStyleElement> = new Map();\n #localPackage: DocumentModelLib<any> | undefined;\n\n #cdnUrl: string | null;\n #localPackageVersion: string | undefined;\n #localPackageNames: Set<string> = new Set([LOCAL_PACKAGE_NAME]);\n #pwaSyncTimer: ReturnType<typeof setTimeout> | undefined;\n /** Serialized last-mirrored PWA fragment; lets a sync skip the IndexedDB\n * write + manifest re-attach when nothing PWA-relevant changed. */\n #lastSyncedFragmentJson: string | undefined;\n\n constructor(namespace: string, registryUrl: string | null) {\n this.#storage = new BrowserLocalStorage<PackageMeta>(\n namespace + \":PH_PACKAGES\",\n );\n this.registryUrl = registryUrl;\n this.#cdnUrl = registryUrl !== null ? toCdnUrl(registryUrl) : null;\n }\n\n async init(\n localPackage?: DocumentModelLib<any>,\n localPackageVersion?: string,\n studioMode?: boolean,\n workflowsEnabled?: boolean,\n ) {\n this.addLocalPackage(common.manifest.name, common, commonPkg.version);\n // Vetra is builder-only and not CDN-loadable; lazy-load it (code-split\n // chunk, never fetched in production) only in studio mode.\n if (studioMode) {\n const vetra = await import(\"@powerhousedao/vetra\");\n this.addLocalPackage(vetra.manifest.name, vetra, vetraPkg.version);\n }\n // Same shape for the workflow package, behind its own independent flag.\n // Only the package root: `./pieces` and `./reactor` are node-only.\n if (workflowsEnabled) {\n const workflow = await import(\"@powerhousedao/workflow\");\n this.addLocalPackage(\n workflow.manifest.name,\n workflow,\n workflowPkg.version,\n );\n }\n if (localPackage) {\n this.updateLocalPackage(localPackage, localPackageVersion);\n }\n for (const packageName of this.#storage.keys()) {\n // Re-hydrate with the originally-requested spec so a tag/version pick\n // sticks across reloads. Fall back to the bare key for legacy entries\n // (pre-spec) and for entries that never had a tag.\n const existingMeta = this.#storage.get(packageName);\n const specForReload = existingMeta?.spec ?? packageName;\n console.debug(\n `[Connect][PackageManager] Rehydrating \"${packageName}\" via spec \"${specForReload}\"`,\n );\n const result = await this.addPackage(specForReload);\n // Previously-installed package that no longer resolves (version\n // withdrawn from npm, registry moved, etc.) would otherwise\n // 404-toast on every boot forever. Drop it from persistent storage\n // so the failure is one-shot instead of sticky.\n if (result.type === \"error\") {\n this.#storage.delete(packageName);\n }\n }\n }\n\n addLocalPackage(\n name: string,\n loadedPackage: DocumentModelLib<any>,\n version?: string,\n ) {\n this.#localPackageNames.add(name);\n this.#registerPackage({\n name,\n importUrl: null,\n stylesheetUrl: null,\n loadedPackage,\n version,\n });\n }\n\n updateLocalPackage(pkg: DocumentModelLib<any>, version?: string) {\n console.debug(\"Updating local package:\", pkg);\n this.#localPackage = pkg;\n this.#registerPackage({\n name: LOCAL_PACKAGE_NAME,\n stylesheetUrl: null,\n importUrl: null,\n loadedPackage: pkg,\n });\n if (version) {\n this.#localPackageVersion = version;\n this.#notifyPackagesChanged();\n return;\n }\n fetchPackageJsonVersion(\"/package.json\")\n .then((fetchedVersion) => {\n this.#localPackageVersion = fetchedVersion;\n if (fetchedVersion) this.#notifyPackagesChanged();\n })\n .catch(() => {});\n }\n\n get packages() {\n return this.#packagesMemo;\n }\n\n get cdnUrl(): string | null {\n return this.#cdnUrl;\n }\n\n getPackageSource(packageName: string) {\n // check vs packages registered as local (Common, Vetra, bundled packages...)\n if (this.#localPackageNames.has(packageName)) {\n return \"common\";\n }\n // check if the package has the same name as the local project\n if (packageName === this.#localPackage?.manifest.name) return \"project\";\n const packageMeta = this.#storage.get(packageName);\n // if meta does not exist the package is not installed\n if (!packageMeta) return null;\n // if imported from node_modules then the package is installed locally\n if (packageMeta.importUrl === `/node_modules/${packageName}`)\n return \"local-install\";\n // all other import urls point to a registry\n return \"registry-install\";\n }\n\n /**\n * Return the registry-installed packages keyed by their storage name (which\n * is the registry spec, e.g. \"@powerhousedao/clint-common\"), with the\n * installed version when known. Excludes bundled (common) packages, the\n * local project package, and packages resolved out of `/node_modules/`.\n */\n getRegistryPackages(): { name: string; version: string | undefined }[] {\n const out: { name: string; version: string | undefined }[] = [];\n for (const [name, meta] of this.#storage) {\n if (this.#localPackageNames.has(name)) continue;\n if (name === LOCAL_PACKAGE_NAME) continue;\n if (meta.importUrl === `/node_modules/${name}`) continue;\n out.push({ name, version: meta.version });\n }\n return out;\n }\n\n getPackageVersion(packageName: string): string | undefined {\n if (packageName === this.#localPackage?.manifest.name) {\n return this.#localPackageVersion;\n }\n return this.#storage.get(packageName)?.version;\n }\n\n /**\n * The spec the user requested when this package was installed (e.g.\n * `name@dev` or `name@6.2.1`). Undefined for bare-name installs, legacy\n * entries, and local packages — the Package Manager treats that as the\n * `latest` stream when picking update targets.\n */\n getPackageSpec(packageName: string): string | undefined {\n return this.#storage.get(packageName)?.spec;\n }\n\n async addPackage(packageSpec: string): Promise<PackageManagerInstallResult> {\n // `packageSpec` may include a `@tag` / `@version` suffix (e.g. user picked\n // a specific version in the package manager UI, or re-hydrated on reload\n // from the persisted spec). We always register/look up by the bare name so\n // status tracking, version lookups, and uninstall all go through a single\n // canonical key. The spec itself is kept on the meta so reloads re-fetch\n // the same tag.\n const bareName = parseBareName(packageSpec);\n const hasTagOrVersion = bareName !== packageSpec;\n console.debug(\n `[Connect][PackageManager] addPackage spec=\"${packageSpec}\" bareName=\"${bareName}\"`,\n );\n\n const existingPackage = this.#packages.get(bareName);\n if (existingPackage) {\n const requestedVersion = hasTagOrVersion\n ? packageSpec.slice(bareName.length + 1)\n : undefined;\n const currentVersion = this.#storage.get(bareName)?.version;\n const isLocal = this.#localPackageNames.has(bareName);\n const sameVersion =\n !requestedVersion ||\n !currentVersion ||\n requestedVersion === currentVersion;\n if (isLocal || sameVersion) {\n console.debug(\n `[Connect][PackageManager] \"${bareName}\" already loaded; skipping re-fetch`,\n );\n return {\n type: \"success\",\n package: existingPackage,\n };\n }\n console.debug(\n `[Connect][PackageManager] \"${bareName}\" version bump ${currentVersion} → ${requestedVersion}; refetching`,\n );\n }\n try {\n const packageWithMeta = await this.#loadPackage(packageSpec);\n // `#loadPackage*` set `name` to whatever spec it built the URL from.\n // Canonicalize to the bare name for the map/storage keys, and stash the\n // original spec separately so reloads re-use it.\n packageWithMeta.name = bareName;\n if (hasTagOrVersion) {\n packageWithMeta.spec = packageSpec;\n }\n // Swap stylesheets only once the new package is in hand. If `#loadPackage`\n // throws above, the old stylesheet stays mounted and the UI keeps\n // rendering the previous version instead of unstyled markup.\n if (existingPackage) {\n this.#unmountStylesheet(bareName);\n }\n this.#registerPackage(packageWithMeta);\n\n return {\n type: \"success\",\n package: packageWithMeta.loadedPackage,\n };\n } catch (error) {\n const normalized =\n error instanceof Error ? error : new Error(String(error));\n console.error(\n `[Connect][PackageManager] Failed to install package \"${packageSpec}\": ${normalized.message}`,\n normalized,\n );\n return {\n type: \"error\",\n error: normalized,\n };\n }\n }\n\n async addPackages(packageNames: string[]) {\n const results: PackageManagerInstallResult[] = [];\n for (const packageName of packageNames) {\n const result = await this.addPackage(packageName);\n results.push(result);\n }\n return results;\n }\n\n removePackage(name: string) {\n this.#packages.delete(name);\n this.#storage.delete(name);\n this.#unmountStylesheet(name);\n this.#notifyPackagesChanged();\n }\n\n subscribe(handler: IPackagesListener): IPackageListerUnsubscribe {\n this.#subscribers.add(handler);\n return () => {\n this.#subscribers.delete(handler);\n };\n }\n\n load(documentType: string): Promise<DocumentModelModule<any>> {\n const documentModelModule = Array.from(\n this.#packages.values().flatMap((p) => p.documentModels),\n ).find((m) => m.documentModel.global.id === documentType);\n\n if (documentModelModule) return Promise.resolve(documentModelModule);\n return Promise.reject(new Error(\"Model not available\"));\n }\n\n async #loadPackageFromNodeModules(name: string): Promise<PackageWithMeta> {\n const importUrl = `/node_modules/${name}/browser/index.js`;\n const stylesheetUrl = `/node_modules/${name}/style.css`;\n\n const packageWithMeta = await this.#importPackage({\n name,\n importUrl,\n stylesheetUrl,\n });\n packageWithMeta.version = await fetchPackageJsonVersion(\n `/node_modules/${name}/package.json`,\n );\n\n return packageWithMeta;\n }\n\n async #loadPackageFromRegistry(name: string): Promise<PackageWithMeta> {\n const importUrl = `${this.#cdnUrl}/${name}/browser/index.js`;\n const stylesheetUrl = `${this.#cdnUrl}/${name}/style.css`;\n const packageWithMeta = await this.#importPackage({\n name,\n importUrl,\n stylesheetUrl,\n });\n const pkgJson = await fetchPackageJson(\n `${this.#cdnUrl}/${name}/package.json`,\n );\n packageWithMeta.version = pkgJson?.version;\n\n // Non-blocking warning: a package that pins a shared dep at a version\n // the host's vendor was built without still installs, but the host's\n // copy is what runs — surface the mismatch before it surprises the\n // user at runtime.\n const warnings = sharedDepMismatchWarnings(\n pkgJson,\n (await getSharedDeps())?.versions,\n );\n if (warnings.length > 0) {\n console.error(\n `[package-manager] shared-deps mismatch for ${name}:\\n` +\n warnings.join(\"\\n\"),\n );\n }\n\n return packageWithMeta;\n }\n\n async #importPackage(packageMeta: PackageMeta): Promise<PackageWithMeta> {\n const { name, importUrl, stylesheetUrl } = packageMeta;\n if (!importUrl) {\n throw new Error(`Import url not defined for package \"${name}\".`);\n }\n\n const loadedPackage = (await import(\n /* @vite-ignore */ importUrl\n )) as DocumentModelLib<any>;\n\n return {\n name,\n loadedPackage,\n importUrl,\n stylesheetUrl,\n };\n }\n\n async #loadPackage(packageName: string): Promise<PackageWithMeta> {\n if (this.#localPackageNames.has(packageName)) {\n throw new Error(\n `Package \"${packageName}\" is a local package and cannot be loaded dynamically.`,\n );\n }\n\n // only attemp to load from node_modules in dev mode\n if (!import.meta.env.PROD) {\n try {\n const packageWithMeta =\n await this.#loadPackageFromNodeModules(packageName);\n return packageWithMeta;\n } catch (error) {\n console.warn(\n `Failed to load package \"${packageName}\" from node_modules:`,\n error,\n );\n }\n }\n\n if (!this.registryUrl) {\n throw new Error(\"Registry url not defined.\");\n }\n\n return await this.#loadPackageFromRegistry(packageName);\n }\n\n #registerPackage(packageWithMeta: PackageWithMeta) {\n const { name, loadedPackage, importUrl, stylesheetUrl, version, spec } =\n packageWithMeta;\n\n if (stylesheetUrl !== null) {\n this.#mountStylesheet(name, stylesheetUrl);\n }\n this.#packages.set(name, loadedPackage);\n this.#storage.set(name, {\n name,\n importUrl,\n stylesheetUrl,\n version,\n ...(spec ? { spec } : {}),\n });\n console.debug(\n `[Connect][PackageManager] Registered \"${name}\" (version=${version ?? \"?\"}, spec=${spec ?? \"—\"})`,\n );\n\n this.#notifyPackagesChanged();\n }\n\n #mountStylesheet(name: string, href: string) {\n const existing = this.#stylesheets.get(name);\n if (existing) return existing;\n\n const style = document.createElement(\"style\");\n style.textContent = `@import url(\"${href}\") layer(external-packages);`;\n document.head.appendChild(style);\n\n this.#stylesheets.set(name, style);\n }\n\n #unmountStylesheet(name: string): void {\n const style = this.#stylesheets.get(name);\n if (!style) return;\n\n style.remove();\n this.#stylesheets.delete(name);\n }\n\n #notifyPackagesChanged() {\n this.#packagesMemo = Array.from(this.#packages.values());\n const packages = this.packages;\n this.#subscribers.forEach((handler) => {\n handler({ packages });\n });\n this.#schedulePwaSync();\n }\n\n /**\n * Debounced mirror of every loaded package's PWA fragment into IndexedDB, so\n * the service worker can serve a web-app manifest that reflects packages\n * installed AT RUNTIME (a SW can't read localStorage, where the package list\n * lives). Debounced because `init()` rehydrates many packages in a burst;\n * coalescing collapses that into a single write.\n */\n #schedulePwaSync() {\n if (typeof indexedDB === \"undefined\") return;\n clearTimeout(this.#pwaSyncTimer);\n this.#pwaSyncTimer = setTimeout(() => {\n void this.#syncPwaFragments();\n }, 50);\n }\n\n async #syncPwaFragments() {\n const contributions: PwaContribution[] = [];\n for (const [name, loadedPackage] of this.#packages) {\n const manifest = loadedPackage.manifest;\n let config: PHConnectPwa = {};\n if (manifest.pwa) {\n // Third-party package code must not inject arbitrary manifest fields the\n // SW will serve — validate strictly and skip (with a warning) on failure.\n const parsed = PwaConfigSchema.safeParse(manifest.pwa);\n if (parsed.success) {\n // A package's assets live at its base (CDN for registry installs);\n // make relative icon srcs absolute so the served manifest resolves.\n const importUrl = this.#storage.get(name)?.importUrl ?? null;\n const baseUrl = importUrl\n ? importUrl.replace(/browser\\/index\\.js$/, \"\")\n : null;\n config = resolveFragmentAssetUrls(parsed.data, baseUrl);\n } else {\n console.warn(\n `[Connect][PWA] \"${name}\" ships an invalid pwa fragment; skipped.`,\n parsed.error,\n );\n }\n }\n // `categories` is derived from the manifest's `category` field (not\n // authored under `pwa`); it unions into the SW-served manifest so a\n // runtime-installed package's category shows up like a build-time one.\n config = withInferredCategory(config, manifest.category);\n if (Object.keys(config).length === 0) continue;\n contributions.push({ source: name, config });\n }\n // Fold in load order (base-first ordering is preserved so a package cannot\n // hijack the built-in .phd/.phdm handler at merge time either).\n const merged = mergePwaConfig(contributions);\n // Most package operations don't touch PWA config; skip the write + manifest\n // re-attach (which forces a redundant manifest re-fetch) when unchanged.\n const mergedJson = JSON.stringify(merged);\n if (mergedJson === this.#lastSyncedFragmentJson) return;\n try {\n await writeMergedPwaFragment(merged);\n } catch (error) {\n // Leave #lastSyncedFragmentJson unset so a later sync retries the write.\n console.debug(\n \"[Connect][PWA] fragment mirror to IndexedDB failed:\",\n error,\n );\n return;\n }\n this.#lastSyncedFragmentJson = mergedJson;\n // The SW serves the manifest fresh from IndexedDB, but the browser only\n // parsed <link rel=\"manifest\"> at page load — re-attach it so it\n // re-consumes the now-updated manifest without a manual reload. (Kept out\n // of the write's try/catch so a DOM error isn't mislabeled as an IDB\n // failure; refreshPwaManifestLink is itself non-throwing.)\n refreshPwaManifestLink();\n }\n}\n"],"names":["#storage","#cdnUrl","#localPackageNames","#registerPackage","#localPackage","#localPackageVersion","#notifyPackagesChanged","#packagesMemo","#packages","#loadPackage","#unmountStylesheet","#subscribers","#loadPackageFromNodeModules","#importPackage","#loadPackageFromRegistry","#mountStylesheet","#stylesheets","#schedulePwaSync","#pwaSyncTimer","#syncPwaFragments","#lastSyncedFragmentJson"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAgBA,SAAgB,uBACd,YACA,aACwB;CAGxB,MAAM,SACH,WAAuC,UAAU,UAClD;AACF,QAAO,OAAO,YACZ,OAAO,QAAQ,WAAW,CAAC,KAAK,CAAC,MAAM,WAAW,CAChD,MACA,IAAI,IAAI,MAAM,QAAQ,0BAA0B,YAAY,EAAE,OAAO,CAClE,KACJ,CAAC,CACH;;AAGH,IAAI,SAA4C;;;;;;;;AAShD,SAAgB,gBAA4C;AAC1D,aAAY,YAAY;AACtB,MAAI;GACF,MAAM,MAAO,MAA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SAAS,gBAAgB,UAAU,SAAS,IAAI;AACtD,QAAI,OAAO,SAAS;KAGlB,MAAM,YAAY,MAAA,QAAc,IAAI,KAAK,EAAE,aAAa;KACxD,MAAM,UAAU,YACZ,UAAU,QAAQ,uBAAuB,GAAG,GAC5C;AACJ,cAAS,yBAAyB,OAAO,MAAM,QAAQ;UAEvD,SAAQ,KACN,mBAAmB,KAAK,4CACxB,OAAO,MACR;;AAML,YAAS,qBAAqB,QAAQ,SAAS,SAAS;AACxD,OAAI,OAAO,KAAK,OAAO,CAAC,WAAW,EAAG;AACtC,iBAAc,KAAK;IAAE,QAAQ;IAAM;IAAQ,CAAC;;EAI9C,MAAM,SAAS,eAAe,cAAc;EAG5C,MAAM,aAAa,KAAK,UAAU,OAAO;AACzC,MAAI,eAAe,MAAA,uBAA8B;AACjD,MAAI;AACF,SAAM,uBAAuB,OAAO;WAC7B,OAAO;AAEd,WAAQ,MACN,uDACA,MACD;AACD;;AAEF,QAAA,yBAA+B;AAM/B,0BAAwB","debug_id":"1b3f492a-b3e2-5b14-a419-ada62d3e771f"}
|
|
@@ -1,6 +1,6 @@
|
|
|
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 { l as invalidateReactorPgMajorCache, m as REACTOR_PGLITE_NAME } from "./connection-state-
|
|
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]="bd8e2641-6b5b-5817-b3e7-56d608001d34")}catch(e){}}();
|
|
3
|
+
import { l as invalidateReactorPgMajorCache, m as REACTOR_PGLITE_NAME } from "./connection-state-DAqW06pk.js";
|
|
4
4
|
//#region src/utils/pglite-seed.ts
|
|
5
5
|
const PENDING_PG_SEED_KEY = "ph:pending-pg-seed";
|
|
6
6
|
/**
|
|
@@ -45,5 +45,5 @@ async function seedPendingPgVersion() {
|
|
|
45
45
|
//#endregion
|
|
46
46
|
export { seedPendingPgVersion as n, PENDING_PG_SEED_KEY as t };
|
|
47
47
|
|
|
48
|
-
//# sourceMappingURL=pglite-seed-
|
|
49
|
-
//# debugId=
|
|
48
|
+
//# sourceMappingURL=pglite-seed-ChNTfFkc.js.map
|
|
49
|
+
//# debugId=bd8e2641-6b5b-5817-b3e7-56d608001d34
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pglite-seed-
|
|
1
|
+
{"version":3,"file":"pglite-seed-ChNTfFkc.js","sources":["../src/utils/pglite-seed.ts"],"sourcesContent":["import { invalidateReactorPgMajorCache } from \"./pglite-runtime.js\";\nimport { REACTOR_PGLITE_NAME } from \"./storage-namespace.js\";\n\nexport const PENDING_PG_SEED_KEY = \"ph:pending-pg-seed\";\n\n/**\n * If the Debug Inspector requested a forced PG version reset, this runs\n * before the reactor is created on the subsequent page load: opens a fresh\n * PGlite of the requested major against the reactor data dir, lets `initdb`\n * populate `PG_VERSION`, then closes. The next step of app boot then\n * detects this fresh data dir and picks the matching runtime.\n */\nexport async function seedPendingPgVersion(): Promise<void> {\n const raw = localStorage.getItem(PENDING_PG_SEED_KEY);\n if (!raw) return;\n\n const major = parseInt(raw, 10);\n console.info(`[pglite-seed] Seeding fresh PG${major} data dir...`);\n\n try {\n if (major === 16) {\n const { PGlite } = await import(\"pglite-legacy-02\");\n const pg = new PGlite(`idb://${REACTOR_PGLITE_NAME}`);\n try {\n await pg.waitReady;\n } finally {\n await pg.close();\n }\n } else if (major === 17) {\n const { PGlite } = await import(\"@electric-sql/pglite\");\n const pg = new PGlite(`idb://${REACTOR_PGLITE_NAME}`);\n try {\n await pg.waitReady;\n } finally {\n await pg.close();\n }\n } else {\n console.warn(`[pglite-seed] Unsupported version ${raw}, skipping`);\n return;\n }\n console.info(`[pglite-seed] Seeded PG${major} data dir.`);\n } finally {\n localStorage.removeItem(PENDING_PG_SEED_KEY);\n invalidateReactorPgMajorCache();\n }\n}\n"],"names":[],"mappings":";;;;AAGA,MAAa,sBAAsB;;;;;;;;AASnC,eAAsB,uBAAsC;CAC1D,MAAM,MAAM,aAAa,QAAQ,oBAAoB;AACrD,KAAI,CAAC,IAAK;CAEV,MAAM,QAAQ,SAAS,KAAK,GAAG;AAC/B,SAAQ,KAAK,iCAAiC,MAAM,cAAc;AAElE,KAAI;AACF,MAAI,UAAU,IAAI;GAChB,MAAM,EAAE,WAAW,MAAM,OAAO;GAChC,MAAM,KAAK,IAAI,OAAO,SAAS,sBAAsB;AACrD,OAAI;AACF,UAAM,GAAG;aACD;AACR,UAAM,GAAG,OAAO;;aAET,UAAU,IAAI;GACvB,MAAM,EAAE,WAAW,MAAM,OAAO;GAChC,MAAM,KAAK,IAAI,OAAO,SAAS,sBAAsB;AACrD,OAAI;AACF,UAAM,GAAG;aACD;AACR,UAAM,GAAG,OAAO;;SAEb;AACL,WAAQ,KAAK,qCAAqC,IAAI,YAAY;AAClE;;AAEF,UAAQ,KAAK,0BAA0B,MAAM,YAAY;WACjD;AACR,eAAa,WAAW,oBAAoB;AAC5C,iCAA+B","debug_id":"bd8e2641-6b5b-5817-b3e7-56d608001d34"}
|
|
@@ -1,7 +1,7 @@
|
|
|
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]="
|
|
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]="a5bccbaa-2593-591a-88b7-949de793080b")}catch(e){}}();
|
|
3
3
|
import { t as getIsEmbedded } from "./useIsEmbedded-B_AIFqBu.js";
|
|
4
|
-
import { r as connectConfig } from "./connect.config-
|
|
4
|
+
import { r as connectConfig } from "./connect.config-BofwIsWJ.js";
|
|
5
5
|
import { useSyncExternalStore } from "react";
|
|
6
6
|
//#region src/hooks/preferences-store.ts
|
|
7
7
|
const namespace = connectConfig.routerBasename;
|
|
@@ -81,5 +81,5 @@ const useCookieBanner = () => {
|
|
|
81
81
|
//#endregion
|
|
82
82
|
export { useAcceptedCookies as n, useCookieBanner as r, setBannerShown as t };
|
|
83
83
|
|
|
84
|
-
//# sourceMappingURL=preferences-store-
|
|
85
|
-
//# debugId=
|
|
84
|
+
//# sourceMappingURL=preferences-store-Coa1SHvi.js.map
|
|
85
|
+
//# debugId=a5bccbaa-2593-591a-88b7-949de793080b
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"preferences-store-
|
|
1
|
+
{"version":3,"file":"preferences-store-Coa1SHvi.js","sources":["../src/hooks/preferences-store.ts"],"sourcesContent":["import { connectConfig } from \"@powerhousedao/connect/config\";\nimport { useSyncExternalStore } from \"react\";\n\nimport { getIsEmbedded } from \"./useIsEmbedded.js\";\n\nconst namespace = connectConfig.routerBasename;\n\n/**\n * Block-proof home for Connect's consent and banner state.\n *\n * The file name deliberately avoids words that appear in ad-blocker\n * filter lists (cookie, banner, consent, analytics, ...). Modules in the\n * app's critical import chain import from here, never from files whose\n * URLs match those filters. If an ad blocker blocks the lazy-loaded\n * cookie-banner chunk instead, the app simply never shows the banner —\n * which leaves the flags at their rejected defaults (analytics off) —\n * and everything else keeps working.\n */\n\n// ---------------------------------------------------------------------------\n// Accepted cookies (analytics / marketing / functional)\n// ---------------------------------------------------------------------------\n\nexport const ACCEPTED_COOKIES_KEY_STORAGE = `${namespace}:acceptedCookies`;\n\nexport interface AcceptedCookies {\n analytics: boolean;\n marketing: boolean;\n functional: boolean;\n}\n\nconst REJECTED_COOKIES: AcceptedCookies = {\n analytics: false,\n marketing: false,\n functional: false,\n};\n\nconst cookieListeners = new Set<() => void>();\n\nlet acceptedCookies: AcceptedCookies = getInitialAcceptedCookies();\n\nfunction getInitialAcceptedCookies(): AcceptedCookies {\n try {\n const value = localStorage.getItem(ACCEPTED_COOKIES_KEY_STORAGE);\n return value ? (JSON.parse(value) as AcceptedCookies) : REJECTED_COOKIES;\n } catch {\n return REJECTED_COOKIES;\n }\n}\n\nfunction subscribeAcceptedCookies(fn: () => void) {\n cookieListeners.add(fn);\n return () => {\n cookieListeners.delete(fn);\n };\n}\n\nfunction getAcceptedCookies(): AcceptedCookies {\n return acceptedCookies;\n}\n\nexport function setAcceptedCookies(\n setter: (prev: AcceptedCookies) => AcceptedCookies,\n) {\n acceptedCookies = setter(acceptedCookies);\n localStorage.setItem(\n ACCEPTED_COOKIES_KEY_STORAGE,\n JSON.stringify(acceptedCookies),\n );\n cookieListeners.forEach((fn) => fn());\n}\n\nexport const useAcceptedCookies = () => {\n const cookies = useSyncExternalStore(\n subscribeAcceptedCookies,\n getAcceptedCookies,\n getAcceptedCookies,\n );\n return [cookies, setAcceptedCookies] as const;\n};\n\n// ---------------------------------------------------------------------------\n// Cookie banner visibility\n// ---------------------------------------------------------------------------\n\nexport const COOKIE_BANNER_KEY_STORAGE = `${namespace}:display-cookie-banner`;\n\nconst bannerListeners = new Set<() => void>();\n\nlet bannerShown = getInitialBannerShown();\n\nfunction getInitialBannerShown(): boolean {\n if (getIsEmbedded()) return false;\n try {\n const value = localStorage.getItem(COOKIE_BANNER_KEY_STORAGE);\n return value !== \"false\";\n } catch (error) {\n console.error(error);\n return true;\n }\n}\n\nfunction subscribeBannerShown(fn: () => void) {\n bannerListeners.add(fn);\n return () => {\n bannerListeners.delete(fn);\n };\n}\n\nfunction getBannerShown(): boolean {\n return bannerShown;\n}\n\nexport function setBannerShown(state: boolean) {\n bannerShown = state;\n localStorage.setItem(COOKIE_BANNER_KEY_STORAGE, JSON.stringify(state));\n bannerListeners.forEach((fn) => fn());\n}\n\nexport const useCookieBanner = () => {\n const shown = useSyncExternalStore(\n subscribeBannerShown,\n getBannerShown,\n getBannerShown,\n );\n return [shown, setBannerShown] as const;\n};\n"],"names":[],"mappings":";;;;;;AAKA,MAAM,YAAY,cAAc;;;;;;;;;;;;AAkBhC,MAAa,+BAA+B,GAAG,UAAU;AAQzD,MAAM,mBAAoC;CACxC,WAAW;CACX,WAAW;CACX,YAAY;CACb;AAED,MAAM,kCAAkB,IAAI,KAAiB;AAE7C,IAAI,kBAAmC,2BAA2B;AAElE,SAAS,4BAA6C;AACpD,KAAI;EACF,MAAM,QAAQ,aAAa,QAAQ,6BAA6B;AAChE,SAAO,QAAS,KAAK,MAAM,MAAM,GAAuB;SAClD;AACN,SAAO;;;AAIX,SAAS,yBAAyB,IAAgB;AAChD,iBAAgB,IAAI,GAAG;AACvB,cAAa;AACX,kBAAgB,OAAO,GAAG;;;AAI9B,SAAS,qBAAsC;AAC7C,QAAO;;AAGT,SAAgB,mBACd,QACA;AACA,mBAAkB,OAAO,gBAAgB;AACzC,cAAa,QACX,8BACA,KAAK,UAAU,gBAAgB,CAChC;AACD,iBAAgB,SAAS,OAAO,IAAI,CAAC;;AAGvC,MAAa,2BAA2B;AAMtC,QAAO,CALS,qBACd,0BACA,oBACA,mBACD,EACgB,mBAAmB;;AAOtC,MAAa,4BAA4B,GAAG,UAAU;AAEtD,MAAM,kCAAkB,IAAI,KAAiB;AAE7C,IAAI,cAAc,uBAAuB;AAEzC,SAAS,wBAAiC;AACxC,KAAI,eAAe,CAAE,QAAO;AAC5B,KAAI;AAEF,SADc,aAAa,QAAQ,0BAA0B,KAC5C;UACV,OAAO;AACd,UAAQ,MAAM,MAAM;AACpB,SAAO;;;AAIX,SAAS,qBAAqB,IAAgB;AAC5C,iBAAgB,IAAI,GAAG;AACvB,cAAa;AACX,kBAAgB,OAAO,GAAG;;;AAI9B,SAAS,iBAA0B;AACjC,QAAO;;AAG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