@powerhousedao/connect 6.2.3-dev.50 → 6.2.3-dev.52

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (50) hide show
  1. package/dist/{AddDriveModal-DhNfP94R.js → AddDriveModal-C5odBO8y.js} +5 -5
  2. package/dist/AddDriveModal-C5odBO8y.js.map +1 -0
  3. package/dist/{ClearStorageModal-BZs7-S10.js → ClearStorageModal-Iu9Zfa3B.js} +5 -5
  4. package/dist/{ClearStorageModal-BZs7-S10.js.map → ClearStorageModal-Iu9Zfa3B.js.map} +1 -1
  5. package/dist/{ConfirmDocumentUpgradeModal-DcOZy20m.js → ConfirmDocumentUpgradeModal-k79v2wM6.js} +4 -4
  6. package/dist/{ConfirmDocumentUpgradeModal-DcOZy20m.js.map → ConfirmDocumentUpgradeModal-k79v2wM6.js.map} +1 -1
  7. package/dist/{DebugSettingsModal-DuRuNVqr.js → DebugSettingsModal-B-T0d74l.js} +6 -6
  8. package/dist/{DebugSettingsModal-DuRuNVqr.js.map → DebugSettingsModal-B-T0d74l.js.map} +1 -1
  9. package/dist/{InspectorModal-ByqYDGHt.js → InspectorModal-Bv7eleSX.js} +6 -6
  10. package/dist/{InspectorModal-ByqYDGHt.js.map → InspectorModal-Bv7eleSX.js.map} +1 -1
  11. package/dist/{OpenFileDocumentsModal-CPVr7_UN.js → OpenFileDocumentsModal-Ba4kAGP_.js} +4 -4
  12. package/dist/{OpenFileDocumentsModal-CPVr7_UN.js.map → OpenFileDocumentsModal-Ba4kAGP_.js.map} +1 -1
  13. package/dist/{SettingsModal-e1X7sRE0.js → SettingsModal-C-o6P5UL.js} +7 -6
  14. package/dist/{SettingsModal-e1X7sRE0.js.map → SettingsModal-C-o6P5UL.js.map} +1 -1
  15. package/dist/{app-loader-F_rtUgPB.js → app-loader-CFawNxX-.js} +17 -17
  16. package/dist/{app-loader-F_rtUgPB.js.map → app-loader-CFawNxX-.js.map} +1 -1
  17. package/dist/app-loader-D5UrTuL1.js +4 -0
  18. package/dist/{build-info-BEK9jmfs.js → build-info-CJc_he5j.js} +5 -5
  19. package/dist/{build-info-BEK9jmfs.js.map → build-info-CJc_he5j.js.map} +1 -1
  20. package/dist/{components-CP73FuT3.js → components-DuOtPdzm.js} +3 -3
  21. package/dist/{connect.config-CaXMoB42.js → connect.config-m9zdOvO8.js} +5 -5
  22. package/dist/{connect.config-CaXMoB42.js.map → connect.config-m9zdOvO8.js.map} +1 -1
  23. package/dist/{connection-state-BKXJeu74.js → connection-state-D7RGI_TC.js} +4 -4
  24. package/dist/{connection-state-BKXJeu74.js.map → connection-state-D7RGI_TC.js.map} +1 -1
  25. package/dist/{cookie-banner-BxXvPdIY.js → cookie-banner-DzeXtywE.js} +4 -4
  26. package/dist/{cookie-banner-BxXvPdIY.js.map → cookie-banner-DzeXtywE.js.map} +1 -1
  27. package/dist/{load-BU73BPux.js → load-dZbdPG28.js} +9 -9
  28. package/dist/{load-BU73BPux.js.map → load-dZbdPG28.js.map} +1 -1
  29. package/dist/main.js +1 -1
  30. package/dist/multi-reactor-CcMPtKrf.js +201 -0
  31. package/dist/multi-reactor-CcMPtKrf.js.map +1 -0
  32. package/dist/{pglite-seed-C7hUK6X_.js → pglite-seed-BKiOpxGV.js} +4 -4
  33. package/dist/{pglite-seed-C7hUK6X_.js.map → pglite-seed-BKiOpxGV.js.map} +1 -1
  34. package/dist/{preferences-store-DZUIAkHE.js → preferences-store-CEwlLlXe.js} +4 -4
  35. package/dist/{preferences-store-DZUIAkHE.js.map → preferences-store-CEwlLlXe.js.map} +1 -1
  36. package/dist/{reactor-Dh29UPqN.js → reactor-D1wSZrzP.js} +226 -79
  37. package/dist/reactor-D1wSZrzP.js.map +1 -0
  38. package/dist/reactor.worker.js +102 -91
  39. package/dist/reactor.worker.js.map +1 -1
  40. package/dist/{registerServiceWorker-smkROQhm.js → registerServiceWorker-D4BhZIyI.js} +4 -4
  41. package/dist/{registerServiceWorker-smkROQhm.js.map → registerServiceWorker-D4BhZIyI.js.map} +1 -1
  42. package/dist/start-connect.js +1 -1
  43. package/dist/{store-lock-T8oyiDm4.js → store-lock-Bi3B9VJD.js} +12 -4
  44. package/dist/store-lock-Bi3B9VJD.js.map +1 -0
  45. package/dist/style.css +99 -28
  46. package/package.json +14 -13
  47. package/dist/AddDriveModal-DhNfP94R.js.map +0 -1
  48. package/dist/app-loader-DWsWZBTH.js +0 -4
  49. package/dist/reactor-Dh29UPqN.js.map +0 -1
  50. package/dist/store-lock-T8oyiDm4.js.map +0 -1
@@ -0,0 +1,4 @@
1
+ import { t as AppLoader } from "./app-loader-CFawNxX-.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]="f4aaa1ca-f03e-5375-a8f2-50d7582558a7")}catch(e){}}();
4
+ //# debugId=f4aaa1ca-f03e-5375-a8f2-50d7582558a7
@@ -1,16 +1,16 @@
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]="6ae0203e-3da2-58bf-a7be-e6ba8cb4a268")}catch(e){}}();
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]="abd7d999-79df-5d3f-91bb-ad5174fa4590")}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.50";
6
+ return "6.2.3-dev.52";
7
7
  }
8
8
  /** True in the tsdown dist projects install; false in the monorepo app, where Vite bundles the worker. */
9
9
  function isPackagedConnectDist() {
10
10
  return true;
11
11
  }
12
12
  function getGitSha() {
13
- return "01a5b0227313c401002362834697fee1ddd28fed";
13
+ return "a37f3ca1923c9cdd7aca3c82e8cc7ef5f3abc035";
14
14
  }
15
15
  /**
16
16
  * Build identity baked in at build time (define PH_CONNECT_BUILD_HASH —
@@ -28,5 +28,5 @@ function getGitUrl() {
28
28
  //#endregion
29
29
  export { isPackagedConnectDist as a, getVersion as i, getGitSha as n, shortGitSha as o, getGitUrl as r, getBuildHash as t };
30
30
 
31
- //# sourceMappingURL=build-info-BEK9jmfs.js.map
32
- //# debugId=6ae0203e-3da2-58bf-a7be-e6ba8cb4a268
31
+ //# sourceMappingURL=build-info-CJc_he5j.js.map
32
+ //# debugId=abd7d999-79df-5d3f-91bb-ad5174fa4590
@@ -1 +1 @@
1
- {"version":3,"file":"build-info-BEK9jmfs.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;\ndeclare const CONNECT_PACKAGED_DIST: boolean | 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\n/** True in the tsdown dist projects install; false in the monorepo app, where Vite bundles the worker. */\nexport function isPackagedConnectDist(): boolean {\n return typeof CONNECT_PACKAGED_DIST !== \"undefined\" && CONNECT_PACKAGED_DIST;\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":";;;;AAUA,SAAgB,aAAqB;CACS,OAAA;AAM9C;;AAGA,SAAgB,wBAAiC;CAC/C,OAAA;AACF;AAEA,SAAgB,YAAoB;CACU,OAAA;AAE9C;;;;;;;AAQA,SAAgB,eAAuB;CACrC,IAAI,OAAO,0BAA0B,aACnC,OAAO;CACT,OAAO;AACT;AAEA,SAAgB,YAA2B;CACzC,OAAO,aAAa,UAAU,CAAC;AACjC","debug_id":"6ae0203e-3da2-58bf-a7be-e6ba8cb4a268"}
1
+ {"version":3,"file":"build-info-CJc_he5j.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;\ndeclare const CONNECT_PACKAGED_DIST: boolean | 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\n/** True in the tsdown dist projects install; false in the monorepo app, where Vite bundles the worker. */\nexport function isPackagedConnectDist(): boolean {\n return typeof CONNECT_PACKAGED_DIST !== \"undefined\" && CONNECT_PACKAGED_DIST;\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":";;;;AAUA,SAAgB,aAAqB;CACS,OAAA;AAM9C;;AAGA,SAAgB,wBAAiC;CAC/C,OAAA;AACF;AAEA,SAAgB,YAAoB;CACU,OAAA;AAE9C;;;;;;;AAQA,SAAgB,eAAuB;CACrC,IAAI,OAAO,0BAA0B,aACnC,OAAO;CACT,OAAO;AACT;AAEA,SAAgB,YAA2B;CACzC,OAAO,aAAa,UAAU,CAAC;AACjC","debug_id":"abd7d999-79df-5d3f-91bb-ad5174fa4590"}
@@ -1,5 +1,5 @@
1
1
  import { t as AppSkeleton } from "./app-skeleton--Me5zlSz.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-F_rtUgPB.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-CFawNxX-.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]="76a823d5-a8c8-53e3-9e0f-75ef041ab622")}catch(e){}}();
5
- //# debugId=76a823d5-a8c8-53e3-9e0f-75ef041ab622
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]="1d16a0ce-2237-5286-a4b3-ab32657ade8b")}catch(e){}}();
5
+ //# debugId=1d16a0ce-2237-5286-a4b3-ab32657ade8b
@@ -1,9 +1,9 @@
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]="393ad854-91a3-56dd-a42b-613d747ff54e")}catch(e){}}();
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]="fc27a94b-0281-520d-8299-6ed9ada4fd4b")}catch(e){}}();
3
3
  import { n as getRuntimeConfig } from "./runtime-config-DtJIUgYw.js";
4
4
  import { loadRuntimeEnv, normalizeBasePath } from "@powerhousedao/shared/connect";
5
- import { setLogLevel } from "@powerhousedao/reactor-browser";
6
5
  import { logger } from "document-model";
6
+ import { setLogLevel as setLogLevel$1 } from "@powerhousedao/reactor-browser";
7
7
  //#region src/utils/openpanel-config.ts
8
8
  /**
9
9
  * Resolve Connect's OpenPanel settings. The runtime config
@@ -115,7 +115,7 @@ const defaultPHAppConfig = {
115
115
  isDragAndDropEnabled: phGlobalConfig.isDragAndDropEnabled
116
116
  };
117
117
  const RESOLVED_LOG_LEVEL = runtime.app?.logLevel;
118
- if (RESOLVED_LOG_LEVEL) setLogLevel(RESOLVED_LOG_LEVEL);
118
+ if (RESOLVED_LOG_LEVEL) setLogLevel$1(RESOLVED_LOG_LEVEL);
119
119
  logger.debug("Setting log level to @level.", RESOLVED_LOG_LEVEL);
120
120
  const PH_CONNECT_BASE_PATH = normalizeBasePath(getDeployBasePath() ?? "/");
121
121
  const PH_CONNECT_ANALYTICS_DATABASE_NAME = `${PH_CONNECT_BASE_PATH.replace(/\//g, "")}:analytics`;
@@ -190,5 +190,5 @@ const connectConfig = {
190
190
  //#endregion
191
191
  export { defaultPHDocumentEditorConfig as a, defaultPHAppConfig as i, buildPHGlobalConfig as n, phGlobalConfig as o, connectConfig as r, PH_CONNECT_BASE_PATH as t };
192
192
 
193
- //# sourceMappingURL=connect.config-CaXMoB42.js.map
194
- //# debugId=393ad854-91a3-56dd-a42b-613d747ff54e
193
+ //# sourceMappingURL=connect.config-m9zdOvO8.js.map
194
+ //# debugId=fc27a94b-0281-520d-8299-6ed9ada4fd4b
@@ -1 +1 @@
1
- {"version":3,"file":"connect.config-CaXMoB42.js","sources":["../src/utils/openpanel-config.ts","../src/connect.config.ts"],"sourcesContent":["import type { PHConnectOpenPanel } from \"@powerhousedao/shared/clis\";\n\n/** The build-time (Vite env) OpenPanel settings, as parsed by loadRuntimeEnv. */\nexport type OpenPanelBuildEnv = {\n PH_CONNECT_OPENPANEL_CLIENT_ID?: string;\n PH_CONNECT_OPENPANEL_API_URL?: string;\n PH_CONNECT_OPENPANEL_TRACK_UI_EVENTS: boolean;\n PH_CONNECT_OPENPANEL_TRACK_OPERATIONS: boolean;\n};\n\nexport type ResolvedOpenPanelConfig = {\n clientId: string;\n apiUrl: string | undefined;\n trackUiEvents: boolean;\n trackOperations: boolean;\n};\n\n/**\n * Resolve Connect's OpenPanel settings. The runtime config\n * (`connect.openPanel`, settable per deploy via PH_CONNECT_CONFIG_JSON) wins;\n * the build-time PH_CONNECT_OPENPANEL_* env is the fallback so builds that\n * bake it keep working. An empty clientId leaves OpenPanel disabled.\n */\nexport function resolveOpenPanelConfig(\n runtime: PHConnectOpenPanel | undefined,\n env: OpenPanelBuildEnv,\n): ResolvedOpenPanelConfig {\n return {\n clientId: runtime?.clientId || env.PH_CONNECT_OPENPANEL_CLIENT_ID || \"\",\n apiUrl: runtime?.apiUrl || env.PH_CONNECT_OPENPANEL_API_URL || undefined,\n trackUiEvents:\n runtime?.trackUiEvents ?? env.PH_CONNECT_OPENPANEL_TRACK_UI_EVENTS,\n trackOperations:\n runtime?.trackOperations ?? env.PH_CONNECT_OPENPANEL_TRACK_OPERATIONS,\n };\n}\n","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\";\nimport { resolveOpenPanelConfig } from \"./utils/openpanel-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 // Runtime `connect.openPanel` wins; the build-time PH_CONNECT_OPENPANEL_*\n // env is the fallback. An empty clientId (the default) keeps it disabled.\n // `trackUiEvents` is intentionally dormant — no call sites gate on it yet.\n openPanel: resolveOpenPanelConfig(runtime.openPanel, env),\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":";;;;;;;;;;;;;AAuBA,SAAgB,uBACd,SACA,KACyB;CACzB,OAAO;EACL,UAAU,SAAS,YAAY,IAAI,kCAAkC;EACrE,QAAQ,SAAS,UAAU,IAAI,gCAAgC,KAAA;EAC/D,eACE,SAAS,iBAAiB,IAAI;EAChC,iBACE,SAAS,mBAAmB,IAAI;CACpC;AACF;;;AChBA,MAAa,MAAM,eAAe,EAChC,YAAY,YAAY,IAC1B,CAAC;AASD,MAAM,UAAU,iBAAiB,CAAC,CAAC;AAEnC,SAAS,8BAA8B,UAAkB;CACvD,OAAO,SAAS,SAAS,GAAG,IAAI,WAAW,WAAW;AACxD;AAQA,SAAS,oBAAoB;CAC3B,IACE,OAAO,eAAe,eACrB,WAAgD,qBAEjD,OAAO,YAAY,IAAI;CAEzB,OAAO,QAAQ,KAAK,YAAY,YAAY,IAAI;AAClD;AAMA,SAAS,qBAGP;CACA,MAAM,aAAa,QAAQ,KAAK,cAAc;CAa9C,OAAO;EACL,WAA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,GAAG;CACxD,QAAQ;EACN,KAAK,QAAQ,QAAQ;EACrB,WAAW,QAAQ,QAAQ;EAC3B,SAAS,QAAQ,QAAQ;EACzB,WAAW,QAAQ,QAAQ;EAC3B,gBAAgB,QAAQ,QAAQ;EAChC,UAAU,QAAQ,QAAQ;CAC5B;CACA,QAAQ;EACN,SAAS;EAET,KAAK,QAAQ,QAAQ,OAAO;EAC5B,KAAK,QAAQ,QAAQ;EACrB,SAAS,QAAQ,QAAQ,WAAW;CACtC;CACA,SAAS;EACP,eAAe;EACf,mCAAmC;CACrC;CACA,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;GACjD;GACA,OAAO;IACL,OAAO;KACL,SAAS,QAAQ,QAAQ,UAAU,OAAO;KAC1C,UAAU,QAAQ,QAAQ,UAAU,OAAO;KAC3C,aAAa,QAAQ,QAAQ,UAAU,OAAO;IAChD;IACA,QAAQ;IACR,OAAO;GACT;EACF,EAAA,CAAG;CACL;CACA,cAAc,KAAA;CACd,cAAc,IAAI;AACpB","debug_id":"393ad854-91a3-56dd-a42b-613d747ff54e"}
1
+ {"version":3,"file":"connect.config-m9zdOvO8.js","sources":["../src/utils/openpanel-config.ts","../src/connect.config.ts"],"sourcesContent":["import type { PHConnectOpenPanel } from \"@powerhousedao/shared/clis\";\n\n/** The build-time (Vite env) OpenPanel settings, as parsed by loadRuntimeEnv. */\nexport type OpenPanelBuildEnv = {\n PH_CONNECT_OPENPANEL_CLIENT_ID?: string;\n PH_CONNECT_OPENPANEL_API_URL?: string;\n PH_CONNECT_OPENPANEL_TRACK_UI_EVENTS: boolean;\n PH_CONNECT_OPENPANEL_TRACK_OPERATIONS: boolean;\n};\n\nexport type ResolvedOpenPanelConfig = {\n clientId: string;\n apiUrl: string | undefined;\n trackUiEvents: boolean;\n trackOperations: boolean;\n};\n\n/**\n * Resolve Connect's OpenPanel settings. The runtime config\n * (`connect.openPanel`, settable per deploy via PH_CONNECT_CONFIG_JSON) wins;\n * the build-time PH_CONNECT_OPENPANEL_* env is the fallback so builds that\n * bake it keep working. An empty clientId leaves OpenPanel disabled.\n */\nexport function resolveOpenPanelConfig(\n runtime: PHConnectOpenPanel | undefined,\n env: OpenPanelBuildEnv,\n): ResolvedOpenPanelConfig {\n return {\n clientId: runtime?.clientId || env.PH_CONNECT_OPENPANEL_CLIENT_ID || \"\",\n apiUrl: runtime?.apiUrl || env.PH_CONNECT_OPENPANEL_API_URL || undefined,\n trackUiEvents:\n runtime?.trackUiEvents ?? env.PH_CONNECT_OPENPANEL_TRACK_UI_EVENTS,\n trackOperations:\n runtime?.trackOperations ?? env.PH_CONNECT_OPENPANEL_TRACK_OPERATIONS,\n };\n}\n","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\";\nimport { resolveOpenPanelConfig } from \"./utils/openpanel-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 // Runtime `connect.openPanel` wins; the build-time PH_CONNECT_OPENPANEL_*\n // env is the fallback. An empty clientId (the default) keeps it disabled.\n // `trackUiEvents` is intentionally dormant — no call sites gate on it yet.\n openPanel: resolveOpenPanelConfig(runtime.openPanel, env),\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":";;;;;;;;;;;;;AAuBA,SAAgB,uBACd,SACA,KACyB;CACzB,OAAO;EACL,UAAU,SAAS,YAAY,IAAI,kCAAkC;EACrE,QAAQ,SAAS,UAAU,IAAI,gCAAgC,KAAA;EAC/D,eACE,SAAS,iBAAiB,IAAI;EAChC,iBACE,SAAS,mBAAmB,IAAI;CACpC;AACF;;;AChBA,MAAa,MAAM,eAAe,EAChC,YAAY,YAAY,IAC1B,CAAC;AASD,MAAM,UAAU,iBAAiB,CAAC,CAAC;AAEnC,SAAS,8BAA8B,UAAkB;CACvD,OAAO,SAAS,SAAS,GAAG,IAAI,WAAW,WAAW;AACxD;AAQA,SAAS,oBAAoB;CAC3B,IACE,OAAO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AW;EACT,SAAS;EACT,cAAc;EACd,WAAW;EACX,uBAAuB,IAAI;EAC3B,sBAAsB,IAAI;EAC1B,2BAA2B;CAC7B;CACA,YAAY;EACV,SAAS;EACT,2BAA2B;CAC7B;CAIA,WAAW,uBAAuB,QAAQ,WAAW,GAAG;CACxD,QAAQ;EACN,KAAK,QAAQ,QAAQ;EACrB,WAAW,QAAQ,QAAQ;EAC3B,SAAS,QAAQ,QAAQ;EACzB,WAAW,QAAQ,QAAQ;EAC3B,gBAAgB,QAAQ,QAAQ;EAChC,UAAU,QAAQ,QAAQ;CAC5B;CACA,QAAQ;EACN,SAAS;EAET,KAAK,QAAQ,QAAQ,OAAO;EAC5B,KAAK,QAAQ,QAAQ;EACrB,SAAS,QAAQ,QAAQ,WAAW;CACtC;CACA,SAAS;EACP,eAAe;EACf,mCAAmC;CACrC;CACA,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;GACjD;GACA,OAAO;IACL,OAAO;KACL,SAAS,QAAQ,QAAQ,UAAU,OAAO;KAC1C,UAAU,QAAQ,QAAQ,UAAU,OAAO;KAC3C,aAAa,QAAQ,QAAQ,UAAU,OAAO;IAChD;IACA,QAAQ;IACR,OAAO;GACT;EACF,EAAA,CAAG;CACL;CACA,cAAc,KAAA;CACd,cAAc,IAAI;AACpB","debug_id":"fc27a94b-0281-520d-8299-6ed9ada4fd4b"}
@@ -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]="2e40d4f6-3bef-55f7-885b-19ab72d0bf99")}catch(e){}}();
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]="cb303857-ad73-5c07-b37b-89b14e130217")}catch(e){}}();
3
3
  import { n as getRuntimeConfig } from "./runtime-config-DtJIUgYw.js";
4
4
  import { n as isMigratableMajor, t as coerceMajor, u as readPgVersionFile } from "./pglite-major-p4_YefAE.js";
5
- import { t as PH_CONNECT_BASE_PATH } from "./connect.config-CaXMoB42.js";
5
+ import { t as PH_CONNECT_BASE_PATH } from "./connect.config-m9zdOvO8.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
@@ -133,5 +133,5 @@ function subscribeWorkerConnection(listener) {
133
133
  //#endregion
134
134
  export { detectMigrationMajor as a, getCachedMigrationMajor as c, subscribeMigrationMajor as d, subscribeReactorPgMajor as f, RELATIONAL_PGLITE_NAME as g, REACTOR_PGLITE_NAME as h, subscribeWorkerConnection as i, getCachedReactorPgMajor as l, REACTOR_INSTANCE_NAMESPACE as m, getWorkerConnectionStatus as n, detectReactorPgMajor as o, PRIMARY_IDB_NAMES as p, setWorkerConnectionStatus as r, detectRelationalPgMajor as s, clearStorageHeld as t, invalidateReactorPgMajorCache as u };
135
135
 
136
- //# sourceMappingURL=connection-state-BKXJeu74.js.map
137
- //# debugId=2e40d4f6-3bef-55f7-885b-19ab72d0bf99
136
+ //# sourceMappingURL=connection-state-D7RGI_TC.js.map
137
+ //# debugId=cb303857-ad73-5c07-b37b-89b14e130217
@@ -1 +1 @@
1
- {"version":3,"file":"connection-state-BKXJeu74.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 =\n | \"connected\"\n | \"lost\"\n | \"failed\"\n | \"storage-unusable\"\n | \"storage-held\"\n | \"version-conflict\";\n\nlet status: WorkerConnectionStatus = \"connected\";\nconst listeners = new Set<() => void>();\n\nexport function getWorkerConnectionStatus(): WorkerConnectionStatus {\n return status;\n}\n\nfunction publish(next: WorkerConnectionStatus): void {\n status = next;\n for (const listener of [...listeners]) {\n listener();\n }\n}\n\n/**\n * \"storage-unusable\" and \"version-conflict\" hold until the page reloads, and\n * \"storage-held\" until {@link clearStorageHeld}; a live worker's pong clears none.\n */\nexport function setWorkerConnectionStatus(next: WorkerConnectionStatus): void {\n if (\n status === next ||\n status === \"storage-unusable\" ||\n status === \"version-conflict\"\n ) {\n return;\n }\n if (status === \"storage-held\" && next === \"connected\") {\n return;\n }\n publish(next);\n}\n\nexport function clearStorageHeld(): void {\n if (status === \"storage-held\") {\n publish(\"connected\");\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,KAAK;CACtC,IAAI,UACF,OAAO;CA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ACtE,OAAO,YAAY,MAAM,kBAAkB,mBAAmB,CAAC;AACjE;AAEA,SAAgB,wBAAwB,IAA4B;CAClE,mBAAmB,IAAI,EAAE;CACzB,aAAa;EACX,mBAAmB,OAAO,EAAE;CAC9B;AACF;AAEA,SAAgB,0BAAqD;CACnE,OAAO;AACT;;;;;;AAOA,eAAsB,uBAA+C;CACnE,IAAI,yBAAyB,KAAA,GAAW,OAAO;CAC/C,IAAI,mBAAmB,OAAO;CAE9B,qBAAqB,YAAY;EAK/B,MAAM,UAAS,MAJM,QAAQ,IAAI,CAC/B,kBAAkB,gBAAgB,GAClC,kBAAkB,mBAAmB,CACvC,CAAC,EAAA,CACqB,KAAK,iBAAiB,KAAK;EACjD,uBAAuB;EACvB,uBAAuB;EACvB,OAAO;CACT,EAAA,CAAG;CACH,IAAI;EACF,OAAO,MAAM;CACf,UAAU;EACR,oBAAoB,KAAA;CACtB;AACF;;;ACrGA,IAAI,SAAiC;AACrC,MAAM,4BAAY,IAAI,IAAgB;AAEtC,SAAgB,4BAAoD;CAClE,OAAO;AACT;AAEA,SAAS,QAAQ,MAAoC;CACnD,SAAS;CACT,KAAK,MAAM,YAAY,CAAC,GAAG,SAAS,GAClC,SAAS;AAEb;;;;;AAMA,SAAgB,0BAA0B,MAAoC;CAC5E,IACE,WAAW,QACX,WAAW,sBACX,WAAW,oBAEX;CAEF,IAAI,WAAW,kBAAkB,SAAS,aACxC;CAEF,QAAQ,IAAI;AACd;AAEA,SAAgB,mBAAyB;CACvC,IAAI,WAAW,gBACb,QAAQ,WAAW;AAEvB;AAEA,SAAgB,0BAA0B,UAAkC;CAC1E,UAAU,IAAI,QAAQ;CACtB,aAAa;EACX,UAAU,OAAO,QAAQ;CAC3B;AACF","debug_id":"2e40d4f6-3bef-55f7-885b-19ab72d0bf99"}
1
+ {"version":3,"file":"connection-state-D7RGI_TC.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 =\n | \"connected\"\n | \"lost\"\n | \"failed\"\n | \"storage-unusable\"\n | \"storage-held\"\n | \"version-conflict\";\n\nlet status: WorkerConnectionStatus = \"connected\";\nconst listeners = new Set<() => void>();\n\nexport function getWorkerConnectionStatus(): WorkerConnectionStatus {\n return status;\n}\n\nfunction publish(next: WorkerConnectionStatus): void {\n status = next;\n for (const listener of [...listeners]) {\n listener();\n }\n}\n\n/**\n * \"storage-unusable\" and \"version-conflict\" hold until the page reloads, and\n * \"storage-held\" until {@link clearStorageHeld}; a live worker's pong clears none.\n */\nexport function setWorkerConnectionStatus(next: WorkerConnectionStatus): void {\n if (\n status === next ||\n status === \"storage-unusable\" ||\n status === \"version-conflict\"\n ) {\n return;\n }\n if (status === \"storage-held\" && next === \"connected\") {\n return;\n }\n publish(next);\n}\n\nexport function clearStorageHeld(): void {\n if (status === \"storage-held\") {\n publish(\"connected\");\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,KAAK;CACtC,IAAI,UACF,OAAO;CAET,MAAM,OAAO,oBAAoB,MAAM,QAAQ;CAC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CAAC;AACjE;AAEA,SAAgB,wBAAwB,IAA4B;CAClE,mBAAmB,IAAI,EAAE;CACzB,aAAa;EACX,mBAAmB,OAAO,EAAE;CAC9B;AACF;AAEA,SAAgB,0BAAqD;CACnE,OAAO;AACT;;;;;;AAOA,eAAsB,uBAA+C;CACnE,IAAI,yBAAyB,KAAA,GAAW,OAAO;CAC/C,IAAI,mBAAmB,OAAO;CAE9B,qBAAqB,YAAY;EAK/B,MAAM,UAAS,MAJM,QAAQ,IAAI,CAC/B,kBAAkB,gBAAgB,GAClC,kBAAkB,mBAAmB,CACvC,CAAC,EAAA,CACqB,KAAK,iBAAiB,KAAK;EACjD,uBAAuB;EACvB,uBAAuB;EACvB,OAAO;CACT,EAAA,CAAG;CACH,IAAI;EACF,OAAO,MAAM;CACf,UAAU;EACR,oBAAoB,KAAA;CACtB;AACF;;;ACrGA,IAAI,SAAiC;AACrC,MAAM,4BAAY,IAAI,IAAgB;AAEtC,SAAgB,4BAAoD;CAClE,OAAO;AACT;AAEA,SAAS,QAAQ,MAAoC;CACnD,SAAS;CACT,KAAK,MAAM,YAAY,CAAC,GAAG,SAAS,GAClC,SAAS;AAEb;;;;;AAMA,SAAgB,0BAA0B,MAAoC;CAC5E,IACE,WAAW,QACX,WAAW,sBACX,WAAW,oBAEX;CAEF,IAAI,WAAW,kBAAkB,SAAS,aACxC;CAEF,QAAQ,IAAI;AACd;AAEA,SAAgB,mBAAyB;CACvC,IAAI,WAAW,gBACb,QAAQ,WAAW;AAEvB;AAEA,SAAgB,0BAA0B,UAAkC;CAC1E,UAAU,IAAI,QAAQ;CACtB,aAAa;EACX,UAAU,OAAO,QAAQ;CAC3B;AACF","debug_id":"cb303857-ad73-5c07-b37b-89b14e130217"}
@@ -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]="34f550d6-36a8-59f2-9684-10eb8b12195d")}catch(e){}}();
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]="dc5bb993-d8be-5035-9f8f-38d95887f27f")}catch(e){}}();
3
3
  import { t as i18n } from "./i18n-CTgT1HG-.js";
4
- import { n as useAcceptedCookies, r as useCookieBanner } from "./preferences-store-DZUIAkHE.js";
4
+ import { n as useAcceptedCookies, r as useCookieBanner } from "./preferences-store-CEwlLlXe.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-BxXvPdIY.js.map
70
- //# debugId=34f550d6-36a8-59f2-9684-10eb8b12195d
69
+ //# sourceMappingURL=cookie-banner-DzeXtywE.js.map
70
+ //# debugId=dc5bb993-d8be-5035-9f8f-38d95887f27f
@@ -1 +1 @@
1
- {"version":3,"file":"cookie-banner-BxXvPdIY.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 />\n ),\n }}\n />\n </p>\n </PHCookieBanner>\n </div>\n </div>\n );\n};\n"],"names":["PHCookieBanner"],"mappings":";;;;;;;;;AAUA,MAAM,oBAAoB,SAAwB,OAAe;CAC/D,OAAO,QAAQ,MAAM,WAAW,OAAO,OAAO,MAAM,OAAO,KAAK;AAClE;AAEA,MAAa,qBAAqB;CAChC,MAAM,EAAE,MAAM,eAAe,KAAA,GAAW;EACtC,aAAa;EACb;CACF,CAAC;CACD,MAAM,CAAC,YAAY,iBAAiB,gBAAgB;CACpD,MAAM,GAAG,sBAAsB,mBAAmB;CAElD,MAAM,eAA8B,CAClC;EACE,IAAI;EACJ,OAAO,EAAE,gCAAgC;EACzC,OAAO;CACT,CACF;CAEA,MAAM,gBAAgB,YAA2B;EAC/C,cAAc,KAAK;EAEnB,IAAI,iBAAiB,SAAS,kBAAkB,GAC9C,oBAAoB,qBAAqB;GACvC,GAAG;GACH,WAAW;EACb,EAAE;CAEN;CAEA,MAAM,qBAAqB;EACzB,cAAc,KAAK;EACnB,0BAA0B;GACxB,WAAW;GACX,YAAY;GACZ,WAAW;EACb,EAAE;CACJ;CAEA,IAAI,CAAC,YACH,OAAO;CAGT,OACE,qBAAC,OAAD;EAAK,WAAU;EAAf,UAAA,CACE,oBAAC,OAAD,EAAK,WAAU,yCAA0C,CAAA,GACzD,oBAAC,OAAD;GAAK,WAAU;GACb,UAAA,oBAACA,gBAAD;IACE,WAAU;IACV,SAAS;IACT,UAAU;IACV,UAAU;IACV,aAAa,EAAE,qBAAqB;IACpC,aAAa,EAAE,qBAAqB;IAEpC,UAAA,oBAAC,KAAD;KAAG,WAAU;KACX,UAAA,oBAAC,OAAD;MAEE,SAAQ;MACR,YAAY,EACV,GACE,oBAAC,KAAD;OACE,eAAe,YAAY,EAAE,MAAM,gBAAgB,CAAC;OAEpD,WAAU;MACX,GAFM,2BAEN,EAEL;KACD,GAXM,sBAWN;IACA,CAAA;GACW,CAAA;EACb,CAAA,CACF;;AAET","debug_id":"34f550d6-36a8-59f2-9684-10eb8b12195d"}
1
+ {"version":3,"file":"cookie-banner-DzeXtywE.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 />\n ),\n }}\n />\n </p>\n </PHCookieBanner>\n </div>\n </div>\n );\n};\n"],"names":["PHCookieBanner"],"mappings":";;;;;;;;;AAUA,MAAM,oBAAoB,SAAwB,OAAe;CAC/D,OAAO,QAAQ,MAAM,WAAW,OAAO,OAAO,MAAM,OAAO,KAAK;AAClE;AAEA,MAAa,qBAAqB;CAChC,MAAM,EAAE,MAAM,eAAe,KAAA,GAAW;EACtC,aAAa;EACb;CACF,CAAC;CACD,MAAM,CAAC,YAAY,iBAAiB,gBAAgB;CACpD,MAAM,GAAG,sBAAsB,mBAAmB;CAElD,MAAM,eAA8B,CAClC;EACE,IAAI;EACJ,OAAO,EAAE,gCAAgC;EACzC,OAAO;CACT,CACF;CAEA,MAAM,gBAAgB,YAA2B;EAC/C,cAAc,KAAK;EAEnB,IAAI,iBAAiB,SAAS,kBAAkB,GAC9C,oBAAoB,qBAAqB;GACvC,GAAG;GACH,WAAW;EACb,EAAE;CAEN;CAEA,MAAM,qBAAqB;EACzB,cAAc,KAAK;EACnB,0BAA0B;GACxB,WAAW;GACX,YAAY;GACZ,WAAW;EACb,EAAE;CACJ;CAEA,IAAI,CAAC,YACH,OAAO;CAGT,OACE,qBAAC,OAAD;EAAK,WAAU;EAAf,UAAA,CACE,oBAAC,OAAD,EAAK,WAAU,yCAA0C,CAAA,GACzD,oBAAC,OAAD;GAAK,WAAU;GACb,UAAA,oBAACA,gBAAD;IACE,WAAU;IACV,SAAS;IACT,UAAU;IACV,UAAU;IACV,aAAa,EAAE,qBAAqB;IACpC,aAAa,EAAE,qBAAqB;IAEpC,UAAA,oBAAC,KAAD;KAAG,WAAU;KACX,UAAA,oBAAC,OAAD;MAEE,SAAQ;MACR,YAAY,EACV,GACE,oBAAC,KAAD;OACE,eAAe,YAAY,EAAE,MAAM,gBAAgB,CAAC;OAEpD,WAAU;MACX,GAFM,2BAEN,EAEL;KACD,GAXM,sBAWN;IACA,CAAA;GACW,CAAA;EACb,CAAA,CACF;;AAET","debug_id":"dc5bb993-d8be-5035-9f8f-38d95887f27f"}
@@ -1,16 +1,16 @@
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]="6d2270e5-54bf-5dba-9744-7d1e3d4bc96b")}catch(e){}}();
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]="d431ff58-1519-592c-8985-19041c56ce8d")}catch(e){}}();
3
3
  import { r as loadRuntimeConfig, t as applyConnectBranding } from "./runtime-config-DtJIUgYw.js";
4
4
  import "./i18n-CTgT1HG-.js";
5
- import { r as connectConfig } from "./connect.config-CaXMoB42.js";
5
+ import { r as connectConfig } from "./connect.config-m9zdOvO8.js";
6
6
  import { n as setUser } from "./sentry-jfDyrxdX.js";
7
- import { t as getBuildHash } from "./build-info-BEK9jmfs.js";
8
- import { a as detectMigrationMajor, o as detectReactorPgMajor } from "./connection-state-BKXJeu74.js";
9
- import { n as seedPendingPgVersion } from "./pglite-seed-C7hUK6X_.js";
10
- import { n as createReactor } from "./reactor-Dh29UPqN.js";
7
+ import { t as getBuildHash } from "./build-info-CJc_he5j.js";
8
+ import { a as detectMigrationMajor, o as detectReactorPgMajor } from "./connection-state-D7RGI_TC.js";
9
+ import { n as seedPendingPgVersion } from "./pglite-seed-BKiOpxGV.js";
10
+ import { n as createReactor } from "./reactor-D1wSZrzP.js";
11
+ import { logger } from "document-model";
11
12
  import { useEffect } from "react";
12
13
  import { initTheme, useUser } from "@powerhousedao/reactor-browser";
13
- import { logger } from "document-model";
14
14
  //#region src/hooks/useCheckLatestVersion.ts
15
15
  const RELOADED_FOR_KEY = "ph-reloaded-for-build-hash";
16
16
  /**
@@ -129,5 +129,5 @@ async function loadComponent(localPackage) {
129
129
  //#endregion
130
130
  export { loadComponent };
131
131
 
132
- //# sourceMappingURL=load-BU73BPux.js.map
133
- //# debugId=6d2270e5-54bf-5dba-9744-7d1e3d4bc96b
132
+ //# sourceMappingURL=load-dZbdPG28.js.map
133
+ //# debugId=d431ff58-1519-592c-8985-19041c56ce8d
@@ -1 +1 @@
1
- {"version":3,"file":"load-BU73BPux.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;CAC/C,IAAI;EACF,IAAI,EAAE,YAAY,SAAS;EAC3B,MAAM,OAAO,MAAM,OAAO,OAAO,KAAK;EACtC,MAAM,QAAQ,IACZ,KACG,QAAQ,QAAQ,IAAI,SAAS,UAAU,KAAK,IAAI,SAAS,UAAU,CAAC,CAAC,CACrE,KAAK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;CACrB,gBAAgB;EACd,IAAI,aAAgC;EACpC,IAAI,MAAM;GAER,MAAM,EAAE,YAAY,aAAa,GAAG,SAAS;GAC7C,aAAa;IAAE,IAAI,KAAK;IAAK,UAAU,KAAK,KAAK;IAAM,GAAG;GAAK;EACjE;EACA,QAAc,UAAU;CAC1B,GAAG,CAAC,IAAI,CAAC;AACX;;;ACHA,eAAsB,cAAc,cAAiC;CACnE,MAAM,qBAAqB;CAC3B,MAAM,QAAQ,IAAI,CAAC,qBAAqB,GAAG,qBAAqB,CAAC,CAAC;CAClE,MAAM,gBAAgB,MAAM,kBAAkB;CAC9C,qBAAqB,aAAa;CAClC,MAAM,cAAc,YAAY;CAChC,OAAO,EACL,UAAU,EAAE,eAAyC;EACnD,UAAU;EAEV,iBAAiB;EAEjB,sBAAsB;EACtB,OAAO;CACT,EACF;AACF","debug_id":"6d2270e5-54bf-5dba-9744-7d1e3d4bc96b"}
1
+ {"version":3,"file":"load-dZbdPG28.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;CAC/C,IAAI;EACF,IAAI,EAAE,YAAY,SAAS;EAC3B,MAAM,OAAO,MAAM,OAAO,OAAO,KAAK;EACtC,MAAM,QAAQ,IACZ,KACG,QAAQ,QAAQ,IAAI,SAAS,UAAU,KAAK,IAAI,SAAS,UAAU,CAAC,CAAC,CACrE,KAAK,QAAQ,OAAO,OAAO,OAAO,GAAG,CAAC,CAC3C;CACF,SAAS,OAAO;EACd,OAAO,KACL,4DACA,KACF;CACF;AACF;;;;;;;;;;AAWA,MAAa,8BAA8B;CACzC,gBAAgB;EACd,IACE,YAAY,IAAI,SAAS,iBACzB,cAAc,cACd,CAAC,cAAc,iBAEf;EAGF,MAAM,iBAAiB,YAAY;GACjC,MAAM,SAAS,MAAM,mBAAmB;GACxC,IAAI,CAAC,UAAU,OAAO,WAAW;GAGjC,IADoB,OAAO,eAAe,QAAQ,gBACpC,MAAM,OAAO,cAAc;GACzC,OAAO,eAAe,QAAQ,kBAAkB,OAAO,YAAY;GAEnE,OAAO,KACL,4EACA,OAAO,aACP,OAAO,YACT;GACA,MAAM,iBAAiB;GACvB,OAAO,SAAS,OAAO;EACzB;EAEA,eAAoB;EACpB,MAAM,2BAA2B;GAC/B,IAAI,SAAS,oBAAoB,WAAW,eAAoB;EAClE;EACA,SAAS,iBAAiB,oBAAoB,kBAAkB;EAChE,aAAa;GACX,SAAS,oBAAoB,oBAAoB,kBAAkB;EACrE;CACF,GAAG,CAAC,CAAC;AACP;AC9EqB,OAAO,UAAU,WAAW,SAAS,KAAK;;;;;;;;;;;;;;;;AA0B/D,MAAa,qBAAqB,YAA6C;CAC7E,MAAM,cAAc,aAAa;CACjC,IAAI,CAAC,eAAe,gBAAgB,WAAW,OAAO;CACtD,IAAI;EACF,MAAM,SAAS,MAAM,MAAM,GAAG,YAAY,IAAI,SAAS,kBAAkB,EACvE,OAAO,WACT,CAAC;EACD,IAAI,CAAC,OAAO,IAAI,OAAO;EACvB,MAAM,OAAQ,MAAM,OAAO,KAAK;EAChC,IAAI,OAAO,KAAK,SAAS,YAAY,CAAC,KAAK,MAAM,OAAO;EACxD,OAAO;GACL;GACA,cAAc,KAAK;GACnB,WAAW,KAAK,SAAS;EAC3B;CACF,QAAQ;EACN,OAAO;CACT;AACF;;;ACzCA,SAAgB,mBAAmB;CACjC,MAAM,OAAO,QAAQ;CACrB,gBAAgB;EACd,IAAI,aAAgC;EACpC,IAAI,MAAM;GAER,MAAM,EAAE,YAAY,aAAa,GAAG,SAAS;GAC7C,aAAa;IAAE,IAAI,KAAK;IAAK,UAAU,KAAK,KAAK;IAAM,GAAG;GAAK;EACjE;EACA,QAAc,UAAU;CAC1B,GAAG,CAAC,IAAI,CAAC;AACX;;;ACHA,eAAsB,cAAc,cAAiC;CACnE,MAAM,qBAAqB;CAC3B,MAAM,QAAQ,IAAI,CAAC,qBAAqB,GAAG,qBAAqB,CAAC,CAAC;CAClE,MAAM,gBAAgB,MAAM,kBAAkB;CAC9C,qBAAqB,aAAa;CAClC,MAAM,cAAc,YAAY;CAChC,OAAO,EACL,UAAU,EAAE,eAAyC;EACnD,UAAU;EAEV,iBAAiB;EAEjB,sBAAsB;EACtB,OAAO;CACT,EACF;AACF","debug_id":"d431ff58-1519-592c-8985-19041c56ce8d"}
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-DWsWZBTH.js");
8
+ const { AppLoader } = await import("./app-loader-D5UrTuL1.js");
9
9
  root.render(/* @__PURE__ */ jsx(AppLoader, {}));
10
10
  }
11
11
  //#endregion
@@ -0,0 +1,201 @@
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]="76788fc6-6885-5c8c-bc2d-0a1a5585ecb2")}catch(e){}}();
3
+ import { JOB_NOT_FOUND_ERROR_NAME, JobStatus, createReactorInspector } from "@powerhousedao/reactor";
4
+ import { logger } from "document-model";
5
+ import { DRIVE_DOCUMENT_TYPES, GraphQLReactorClient, findIsServableOverGraphQL } from "@powerhousedao/reactor-browser";
6
+ import { FanInPartialFailureError, RoutingReactorClient, fromReactorClient } from "@powerhousedao/reactor-router";
7
+ //#region src/store/graphql-routable-backend.ts
8
+ const REMOTE_INFO_QUERY = `
9
+ query RemoteReactorInfo {
10
+ inspection {
11
+ info {
12
+ storage {
13
+ engine
14
+ persistence
15
+ durable
16
+ selfHeal
17
+ }
18
+ workflows
19
+ syncChannels
20
+ }
21
+ }
22
+ }
23
+ `;
24
+ /** Ids and slugs of documents this backend answered as drives, by drive id. */
25
+ var KnownDrives = class {
26
+ ids = /* @__PURE__ */ new Map();
27
+ learn(document) {
28
+ const { id, slug, documentType } = document.header;
29
+ if (DRIVE_DOCUMENT_TYPES.includes(documentType)) {
30
+ this.ids.set(id, id);
31
+ if (slug) this.ids.set(slug, id);
32
+ }
33
+ return document;
34
+ }
35
+ learnPage(page) {
36
+ for (const document of page.results) this.learn(document);
37
+ return page;
38
+ }
39
+ driveOf(identifier) {
40
+ return identifier === void 0 ? void 0 : this.ids.get(identifier);
41
+ }
42
+ /** Names a drive only when this backend proved it is one. */
43
+ driveIdFor = (call) => {
44
+ switch (call.method) {
45
+ case "create":
46
+ case "find": return this.driveOf(call.parentId);
47
+ case "execute":
48
+ case "deleteDocument": return this.driveOf(call.documentId);
49
+ case "executeBatch":
50
+ for (const job of call.jobs ?? []) {
51
+ const drive = this.driveOf(job.documentId);
52
+ if (drive !== void 0) return drive;
53
+ }
54
+ return;
55
+ }
56
+ };
57
+ };
58
+ /** A Switchboard as a router backend; members GraphQL cannot serve are absent. */
59
+ function createGraphQLRoutableBackend(options) {
60
+ const drives = new KnownDrives();
61
+ const gql = new GraphQLReactorClient({
62
+ ...options,
63
+ driveIdFor: drives.driveIdFor
64
+ });
65
+ return {
66
+ backend: {
67
+ supports: {
68
+ find: findIsServableOverGraphQL,
69
+ pointInTimeViews: false
70
+ },
71
+ get: async (identifier, view, signal) => drives.learn(await gql.get(identifier, view, signal)),
72
+ getOperations: (identifier, view, filter, paging, signal) => gql.getOperations(identifier, view, filter, paging, signal),
73
+ find: async (search, view, paging, signal) => drives.learnPage(await gql.find(search, view, paging, signal)),
74
+ isServed: (identifier, view, signal) => gql.isServed(identifier, view, signal),
75
+ getOutgoingRelationships: (source, type, view, paging, signal) => gql.getOutgoingRelationships(source, type, view, paging, signal),
76
+ getIncomingRelationships: (target, type, view, paging, signal) => gql.getIncomingRelationships(target, type, view, paging, signal),
77
+ getOutgoingRelationshipEdges: (source, type, view, paging, signal) => gql.getOutgoingRelationshipEdges(source, type, view, paging, signal),
78
+ getIncomingRelationshipEdges: (target, type, view, paging, signal) => gql.getIncomingRelationshipEdges(target, type, view, paging, signal),
79
+ subscribe: (search, callback, view) => gql.subscribe(search, callback, view),
80
+ getCreateSignaturePolicy: () => gql.getCreateSignaturePolicy(),
81
+ getCreateProtocolVersions: (parent, signal) => gql.getCreateProtocolVersions(parent, signal),
82
+ create: async (document, parent, signal) => drives.learn(await gql.create(document, parent, signal)),
83
+ execute: async (identifier, branch, actions, signal) => drives.learn(await gql.execute(identifier, branch, actions, signal)),
84
+ executeBatch: (request, signal) => gql.executeBatch(request, signal),
85
+ deleteDocument: (identifier, propagate, signal) => gql.deleteDocument(identifier, propagate, signal),
86
+ setPreferredEditor: (identifier, editor, branch, signal) => gql.setPreferredEditor(identifier, editor, branch, signal),
87
+ getJob: async (jobId, signal) => {
88
+ const job = await gql.getJob(jobId, signal);
89
+ return job?.status === JobStatus.FAILED && job.error?.name === JOB_NOT_FOUND_ERROR_NAME ? void 0 : job;
90
+ },
91
+ waitForJob: (job, signal) => gql.waitForJob(job, signal)
92
+ },
93
+ info: async () => {
94
+ return {
95
+ ...(await gql.request(REMOTE_INFO_QUERY)).inspection.info,
96
+ access: {
97
+ admin: false,
98
+ sql: false
99
+ }
100
+ };
101
+ },
102
+ notifyCredentialsChanged: () => gql.notifyCredentialsChanged()
103
+ };
104
+ }
105
+ //#endregion
106
+ //#region src/store/multi-reactor.ts
107
+ const LOCAL_BACKEND_NAME = "connect-local";
108
+ const REMOTE_BACKEND_NAME = "switchboard-remote";
109
+ const REMOTE_REACH = Object.freeze({
110
+ hosting: "remote",
111
+ inspection: "none"
112
+ });
113
+ /** Only the tab's reactor is inspectable here, so new collections land on it. */
114
+ const PLACE_ON_LOCAL = Object.freeze({ inspectable: true });
115
+ function localReach(kind) {
116
+ return kind === "worker" ? {
117
+ hosting: "worker",
118
+ inspection: "rpc"
119
+ } : {
120
+ hosting: "in-process",
121
+ inspection: "direct"
122
+ };
123
+ }
124
+ /** Read at every refresh, never kept: a rebuilt reactor reports its own. */
125
+ function localFacts(module) {
126
+ if (module.kind === "worker") return () => module.inspector.info();
127
+ return async () => {
128
+ const reactorModule = module.reactorModule;
129
+ if (!reactorModule) throw new Error("The in-tab reactor exposes no module to inspect");
130
+ return createReactorInspector(reactorModule).info();
131
+ };
132
+ }
133
+ /** `<origin>[/<prefix>]/d/<slug>` -> `<origin>[/<prefix>]/graphql`. */
134
+ function deriveSwitchboardGraphqlUrl(remoteDriveUrl) {
135
+ let parsed;
136
+ try {
137
+ parsed = new URL(remoteDriveUrl);
138
+ } catch {
139
+ return;
140
+ }
141
+ const prefix = /^(.*)\/d\/[^/]+\/?$/.exec(parsed.pathname)?.[1];
142
+ return prefix === void 0 ? void 0 : `${parsed.origin}${prefix}/graphql`;
143
+ }
144
+ /** The router Connect installs, with Connect's handling of credentials and id checks. */
145
+ var ConnectRoutingClient = class extends RoutingReactorClient {
146
+ remote;
147
+ constructor(backends, options, remote) {
148
+ super(backends, options);
149
+ this.remote = remote;
150
+ }
151
+ /** Renown's sign-in and sign-out call this on whatever client is installed. */
152
+ notifyCredentialsChanged() {
153
+ this.remote.notifyCredentialsChanged();
154
+ }
155
+ /** The local answer stands when only the Switchboard could not answer. */
156
+ async isDocumentIdTaken(documentId, signal) {
157
+ try {
158
+ return await super.isDocumentIdTaken(documentId, signal);
159
+ } catch (error) {
160
+ if (!failedOnlyOnRemote(error)) throw error;
161
+ logger.warn("The Switchboard could not say whether @id is taken; using the local reactor's answer: @error", documentId, error);
162
+ return false;
163
+ }
164
+ }
165
+ };
166
+ function failedOnlyOnRemote(error) {
167
+ return error instanceof FanInPartialFailureError && error.failures.every((failure) => failure.backend === "switchboard-remote");
168
+ }
169
+ /** The router over the tab's reactor (primary) and the Switchboard. */
170
+ async function buildMultiReactorClient(params) {
171
+ const registry = params.module.reactorModule?.documentModelRegistry;
172
+ const remote = createGraphQLRoutableBackend({
173
+ url: params.remoteGraphqlUrl,
174
+ documentModels: () => registry?.getAllModules() ?? params.documentModelModules
175
+ });
176
+ const router = new ConnectRoutingClient([{
177
+ name: LOCAL_BACKEND_NAME,
178
+ backend: fromReactorClient(params.module.client),
179
+ facts: localFacts(params.module),
180
+ reach: localReach(params.module.kind),
181
+ refusesMisroutes: false
182
+ }, {
183
+ name: REMOTE_BACKEND_NAME,
184
+ backend: remote.backend,
185
+ facts: () => remote.info(),
186
+ reach: REMOTE_REACH,
187
+ refusesMisroutes: false
188
+ }], {
189
+ primaryBackend: LOCAL_BACKEND_NAME,
190
+ defaultRequirements: PLACE_ON_LOCAL,
191
+ signer: params.signer,
192
+ onDiagnostic: params.onDiagnostic
193
+ }, remote);
194
+ await router.refreshFacts();
195
+ return router;
196
+ }
197
+ //#endregion
198
+ export { ConnectRoutingClient, LOCAL_BACKEND_NAME, PLACE_ON_LOCAL, REMOTE_BACKEND_NAME, buildMultiReactorClient, deriveSwitchboardGraphqlUrl, localFacts, localReach };
199
+
200
+ //# sourceMappingURL=multi-reactor-CcMPtKrf.js.map
201
+ //# debugId=76788fc6-6885-5c8c-bc2d-0a1a5585ecb2
@@ -0,0 +1 @@
1
+ {"version":3,"file":"multi-reactor-CcMPtKrf.js","sources":["../src/store/graphql-routable-backend.ts","../src/store/multi-reactor.ts"],"sourcesContent":["import {\n JOB_NOT_FOUND_ERROR_NAME,\n JobStatus,\n type PagedResults,\n type ReactorInfo,\n type ViewFilter,\n} from \"@powerhousedao/reactor\";\nimport {\n DRIVE_DOCUMENT_TYPES,\n findIsServableOverGraphQL,\n GraphQLReactorClient,\n type DriveIdCall,\n type GraphQLReactorClientOptions,\n} from \"@powerhousedao/reactor-browser\";\nimport type { IRoutableBackend } from \"@powerhousedao/reactor-router\";\nimport type { Action, PHDocument } from \"@powerhousedao/shared/document-model\";\n\nconst REMOTE_INFO_QUERY = /* GraphQL */ `\n query RemoteReactorInfo {\n inspection {\n info {\n storage {\n engine\n persistence\n durable\n selfHeal\n }\n workflows\n syncChannels\n }\n }\n }\n`;\n\ntype RemoteReactorInfo = {\n inspection: { info: Omit<ReactorInfo, \"access\"> };\n};\n\n/** Ids and slugs of documents this backend answered as drives, by drive id. */\nclass KnownDrives {\n private readonly ids = new Map<string, string>();\n\n learn<T extends PHDocument>(document: T): T {\n const { id, slug, documentType } = document.header;\n if ((DRIVE_DOCUMENT_TYPES as readonly string[]).includes(documentType)) {\n this.ids.set(id, id);\n if (slug) {\n this.ids.set(slug, id);\n }\n }\n return document;\n }\n\n learnPage<T extends PHDocument>(page: PagedResults<T>): PagedResults<T> {\n for (const document of page.results) {\n this.learn(document);\n }\n return page;\n }\n\n driveOf(identifier: string | undefined): string | undefined {\n return identifier === undefined ? undefined : this.ids.get(identifier);\n }\n\n /** Names a drive only when this backend proved it is one. */\n driveIdFor = (call: DriveIdCall): string | undefined => {\n switch (call.method) {\n case \"create\":\n case \"find\":\n return this.driveOf(call.parentId);\n case \"execute\":\n case \"deleteDocument\":\n return this.driveOf(call.documentId);\n case \"executeBatch\":\n for (const job of call.jobs ?? []) {\n const drive = this.driveOf(job.documentId);\n if (drive !== undefined) {\n return drive;\n }\n }\n return undefined;\n }\n };\n}\n\nexport type GraphQLRoutableBackendOptions = Omit<\n GraphQLReactorClientOptions,\n \"driveIdFor\"\n>;\n\nexport type GraphQLRoutableBackend = {\n readonly backend: IRoutableBackend;\n /** The Switchboard's own facts, from its inspection subgraph. */\n info(): Promise<ReactorInfo>;\n /** Reopens the realtime socket on the new credentials. */\n notifyCredentialsChanged(): void;\n};\n\n/** A Switchboard as a router backend; members GraphQL cannot serve are absent. */\nexport function createGraphQLRoutableBackend(\n options: GraphQLRoutableBackendOptions,\n): GraphQLRoutableBackend {\n const drives = new KnownDrives();\n const gql = new GraphQLReactorClient({\n ...options,\n driveIdFor: drives.driveIdFor,\n });\n const backend: IRoutableBackend = {\n supports: { find: findIsServableOverGraphQL, pointInTimeViews: false },\n get: async <TDocument extends PHDocument>(\n identifier: string,\n view?: ViewFilter,\n signal?: AbortSignal,\n ) => drives.learn(await gql.get<TDocument>(identifier, view, signal)),\n getOperations: (identifier, view, filter, paging, signal) =>\n gql.getOperations(identifier, view, filter, paging, signal),\n find: async (search, view, paging, signal) =>\n drives.learnPage(await gql.find(search, view, paging, signal)),\n isServed: (identifier, view, signal) =>\n gql.isServed(identifier, view, signal),\n getOutgoingRelationships: (source, type, view, paging, signal) =>\n gql.getOutgoingRelationships(source, type, view, paging, signal),\n getIncomingRelationships: (target, type, view, paging, signal) =>\n gql.getIncomingRelationships(target, type, view, paging, signal),\n getOutgoingRelationshipEdges: (source, type, view, paging, signal) =>\n gql.getOutgoingRelationshipEdges(source, type, view, paging, signal),\n getIncomingRelationshipEdges: (target, type, view, paging, signal) =>\n gql.getIncomingRelationshipEdges(target, type, view, paging, signal),\n subscribe: (search, callback, view) =>\n gql.subscribe(search, callback, view),\n getCreateSignaturePolicy: () => gql.getCreateSignaturePolicy(),\n getCreateProtocolVersions: (parent, signal) =>\n gql.getCreateProtocolVersions(parent, signal),\n create: async <TDocument extends PHDocument = PHDocument>(\n document: PHDocument,\n parent?: string,\n signal?: AbortSignal,\n ) => drives.learn(await gql.create<TDocument>(document, parent, signal)),\n execute: async <TDocument extends PHDocument>(\n identifier: string,\n branch: string,\n actions: Action[],\n signal?: AbortSignal,\n ) =>\n drives.learn(\n await gql.execute<TDocument>(identifier, branch, actions, signal),\n ),\n executeBatch: (request, signal) => gql.executeBatch(request, signal),\n deleteDocument: (identifier, propagate, signal) =>\n gql.deleteDocument(identifier, propagate, signal),\n setPreferredEditor: (identifier, editor, branch, signal) =>\n gql.setPreferredEditor(identifier, editor, branch, signal),\n getJob: async (jobId, signal) => {\n const job = await gql.getJob(jobId, signal);\n return job?.status === JobStatus.FAILED &&\n job.error?.name === JOB_NOT_FOUND_ERROR_NAME\n ? undefined\n : job;\n },\n waitForJob: (job, signal) => gql.waitForJob(job, signal),\n };\n return {\n backend,\n info: async () => {\n const result = await gql.request<RemoteReactorInfo>(REMOTE_INFO_QUERY);\n return {\n ...result.inspection.info,\n access: { admin: false, sql: false },\n };\n },\n notifyCredentialsChanged: () => gql.notifyCredentialsChanged(),\n };\n}\n","import {\n createReactorInspector,\n type ReactorInfo,\n} from \"@powerhousedao/reactor\";\nimport type {\n BrowserReactorClientModule,\n WorkerReactorClientModule,\n} from \"@powerhousedao/reactor-browser\";\nimport {\n FanInPartialFailureError,\n fromReactorClient,\n RoutingReactorClient,\n type CollectionRequirementsInput,\n type ReactorReach,\n type RoutableBackendConfig,\n type RouterDiagnostic,\n type RoutingClientOptions,\n} from \"@powerhousedao/reactor-router\";\nimport type {\n DocumentModelModule,\n ISigner,\n} from \"@powerhousedao/shared/document-model\";\nimport { logger } from \"document-model\";\nimport {\n createGraphQLRoutableBackend,\n type GraphQLRoutableBackend,\n} from \"./graphql-routable-backend.js\";\n\nexport const LOCAL_BACKEND_NAME = \"connect-local\";\nexport const REMOTE_BACKEND_NAME = \"switchboard-remote\";\n\nexport type LocalReactorModule =\n | BrowserReactorClientModule\n | WorkerReactorClientModule;\n\nconst REMOTE_REACH: ReactorReach = Object.freeze({\n hosting: \"remote\",\n inspection: \"none\",\n});\n\n/** Only the tab's reactor is inspectable here, so new collections land on it. */\nexport const PLACE_ON_LOCAL: CollectionRequirementsInput = Object.freeze({\n inspectable: true,\n});\n\nexport function localReach(kind: LocalReactorModule[\"kind\"]): ReactorReach {\n return kind === \"worker\"\n ? { hosting: \"worker\", inspection: \"rpc\" }\n : { hosting: \"in-process\", inspection: \"direct\" };\n}\n\n/** Read at every refresh, never kept: a rebuilt reactor reports its own. */\nexport function localFacts(\n module: LocalReactorModule,\n): () => Promise<ReactorInfo> {\n if (module.kind === \"worker\") {\n return () => module.inspector.info();\n }\n return async () => {\n const reactorModule = module.reactorModule;\n if (!reactorModule) {\n throw new Error(\"The in-tab reactor exposes no module to inspect\");\n }\n return createReactorInspector(reactorModule).info();\n };\n}\n\n/** `<origin>[/<prefix>]/d/<slug>` -> `<origin>[/<prefix>]/graphql`. */\nexport function deriveSwitchboardGraphqlUrl(\n remoteDriveUrl: string,\n): string | undefined {\n let parsed: URL;\n try {\n parsed = new URL(remoteDriveUrl);\n } catch {\n return undefined;\n }\n const prefix = /^(.*)\\/d\\/[^/]+\\/?$/.exec(parsed.pathname)?.[1];\n return prefix === undefined ? undefined : `${parsed.origin}${prefix}/graphql`;\n}\n\nexport type MultiReactorParams = {\n /** The local module, built and ready. */\n module: LocalReactorModule;\n remoteGraphqlUrl: string;\n signer: ISigner;\n /** Signing models when the local module exposes no registry; the router asks the local reactor. */\n documentModelModules: readonly DocumentModelModule[];\n onDiagnostic?: RouterDiagnostic;\n};\n\n/** The router Connect installs, with Connect's handling of credentials and id checks. */\nexport class ConnectRoutingClient extends RoutingReactorClient {\n private readonly remote: GraphQLRoutableBackend;\n\n constructor(\n backends: readonly RoutableBackendConfig[],\n options: RoutingClientOptions,\n remote: GraphQLRoutableBackend,\n ) {\n super(backends, options);\n this.remote = remote;\n }\n\n /** Renown's sign-in and sign-out call this on whatever client is installed. */\n notifyCredentialsChanged(): void {\n this.remote.notifyCredentialsChanged();\n }\n\n /** The local answer stands when only the Switchboard could not answer. */\n override async isDocumentIdTaken(\n documentId: string,\n signal?: AbortSignal,\n ): Promise<boolean> {\n try {\n return await super.isDocumentIdTaken(documentId, signal);\n } catch (error) {\n if (!failedOnlyOnRemote(error)) {\n throw error;\n }\n logger.warn(\n \"The Switchboard could not say whether @id is taken; using the local reactor's answer: @error\",\n documentId,\n error,\n );\n return false;\n }\n }\n}\n\nfunction failedOnlyOnRemote(error: unknown): boolean {\n return (\n error instanceof FanInPartialFailureError &&\n error.failures.every((failure) => failure.backend === REMOTE_BACKEND_NAME)\n );\n}\n\n/** The router over the tab's reactor (primary) and the Switchboard. */\nexport async function buildMultiReactorClient(\n params: MultiReactorParams,\n): Promise<ConnectRoutingClient> {\n const registry = params.module.reactorModule?.documentModelRegistry;\n const remote = createGraphQLRoutableBackend({\n url: params.remoteGraphqlUrl,\n documentModels: () =>\n registry?.getAllModules() ?? params.documentModelModules,\n });\n const router = new ConnectRoutingClient(\n [\n {\n name: LOCAL_BACKEND_NAME,\n backend: fromReactorClient(params.module.client),\n facts: localFacts(params.module),\n reach: localReach(params.module.kind),\n refusesMisroutes: false,\n },\n {\n name: REMOTE_BACKEND_NAME,\n backend: remote.backend,\n facts: () => remote.info(),\n reach: REMOTE_REACH,\n refusesMisroutes: false,\n },\n ],\n {\n primaryBackend: LOCAL_BACKEND_NAME,\n defaultRequirements: PLACE_ON_LOCAL,\n signer: params.signer,\n onDiagnostic: params.onDiagnostic,\n },\n remote,\n );\n await router.refreshFacts();\n return router;\n}\n"],"names":[],"mappings":";;;;;;;AAiBA,MAAM,oBAAkC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