@powerhousedao/connect 6.2.0-dev.4 → 6.2.0-dev.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{ClearStorageModal-BSNg-Ymg.js → ClearStorageModal-9qqxbO1y.js} +4 -4
- package/dist/{ClearStorageModal-BSNg-Ymg.js.map → ClearStorageModal-9qqxbO1y.js.map} +1 -1
- package/dist/{DebugSettingsModal-D4Mk5SmY.js → DebugSettingsModal-B6VpstBi.js} +6 -6
- package/dist/{DebugSettingsModal-D4Mk5SmY.js.map → DebugSettingsModal-B6VpstBi.js.map} +1 -1
- package/dist/{InspectorModal-DyrVQ4fu.js → InspectorModal-v4CyjztA.js} +6 -6
- package/dist/{InspectorModal-DyrVQ4fu.js.map → InspectorModal-v4CyjztA.js.map} +1 -1
- package/dist/{SettingsModal-NqDM9cwJ.js → SettingsModal-CVBYoo51.js} +6 -6
- package/dist/{SettingsModal-NqDM9cwJ.js.map → SettingsModal-CVBYoo51.js.map} +1 -1
- package/dist/app-loader-DzZzLHfJ.js +4 -0
- package/dist/{app-loader-DxoMZXTL.js → app-loader-JZy0JhJp.js} +11 -11
- package/dist/{app-loader-DxoMZXTL.js.map → app-loader-JZy0JhJp.js.map} +1 -1
- package/dist/{build-info-CL8h_tYH.js → build-info-D3DrUL7u.js} +4 -4
- package/dist/{build-info-CL8h_tYH.js.map → build-info-D3DrUL7u.js.map} +1 -1
- package/dist/{components-Dd4Xq0Cj.js → components-D41DrMgC.js} +3 -3
- package/dist/{connect.config-aPx3rHZQ.js → connect.config-Bt4pvvWV.js} +9 -5
- package/dist/connect.config-Bt4pvvWV.js.map +1 -0
- package/dist/{load-BLx_riHu.js → load-CLVMr6Cp.js} +8 -8
- package/dist/{load-BLx_riHu.js.map → load-CLVMr6Cp.js.map} +1 -1
- package/dist/main.js +1 -1
- package/dist/{package-Bcan1Erm.js → package-DYtQroyQ.js} +4 -4
- package/dist/package-DYtQroyQ.js.map +1 -0
- package/dist/{pglite-runtime-toc1-TWa.js → pglite-runtime-Ch2YeUAA.js} +4 -4
- package/dist/{pglite-runtime-toc1-TWa.js.map → pglite-runtime-Ch2YeUAA.js.map} +1 -1
- package/dist/{pglite-seed-D8oSKkep.js → pglite-seed-BWk7yOwr.js} +4 -4
- package/dist/{pglite-seed-D8oSKkep.js.map → pglite-seed-BWk7yOwr.js.map} +1 -1
- package/dist/{reactor-RZaraEfU.js → reactor-BAZd7zrS.js} +5 -5
- package/dist/{reactor-RZaraEfU.js.map → reactor-BAZd7zrS.js.map} +1 -1
- package/dist/{registerServiceWorker-B7uKpkci.js → registerServiceWorker-D9l1kja7.js} +4 -4
- package/dist/{registerServiceWorker-B7uKpkci.js.map → registerServiceWorker-D9l1kja7.js.map} +1 -1
- package/dist/start-connect.js +1 -1
- package/package.json +10 -10
- package/dist/app-loader-B0Va8NxF.js +0 -4
- package/dist/connect.config-aPx3rHZQ.js.map +0 -1
- package/dist/package-Bcan1Erm.js.map +0 -1
|
@@ -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]="
|
|
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]="7a34aa25-334f-5bb5-bd7b-55854bafb447")}catch(e){}}();
|
|
3
3
|
import { buildTreeUrl, shortGitSha } from "@powerhousedao/shared";
|
|
4
4
|
//#region src/utils/build-info.ts
|
|
5
5
|
function getGitSha() {
|
|
6
|
-
return "
|
|
6
|
+
return "2f4c6441f5b9324a395cc4649fcc95fc33038b6b";
|
|
7
7
|
}
|
|
8
8
|
function getGitUrl() {
|
|
9
9
|
return buildTreeUrl(getGitSha());
|
|
@@ -11,5 +11,5 @@ function getGitUrl() {
|
|
|
11
11
|
//#endregion
|
|
12
12
|
export { getGitUrl as n, shortGitSha as r, getGitSha as t };
|
|
13
13
|
|
|
14
|
-
//# sourceMappingURL=build-info-
|
|
15
|
-
//# debugId=
|
|
14
|
+
//# sourceMappingURL=build-info-D3DrUL7u.js.map
|
|
15
|
+
//# debugId=7a34aa25-334f-5bb5-bd7b-55854bafb447
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"build-info-
|
|
1
|
+
{"version":3,"file":"build-info-D3DrUL7u.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;\n\nexport function getVersion(): string {\n if (typeof CONNECT_VERSION !== \"undefined\") return CONNECT_VERSION;\n return (\n process.env.WORKSPACE_VERSION ??\n process.env.npm_package_version ??\n packageJson.version\n );\n}\n\nexport function getGitSha(): string {\n if (typeof CONNECT_GIT_SHA !== \"undefined\") return CONNECT_GIT_SHA;\n return process.env.WORKSPACE_GIT_SHA ?? \"unknown\";\n}\n\nexport function getGitUrl(): string | null {\n return buildTreeUrl(getGitSha());\n}\n"],"names":[],"mappings":";;;;AAiBA,SAAgB,YAAoB;AACU,QAAA;;AAI9C,SAAgB,YAA2B;AACzC,QAAO,aAAa,WAAW,CAAC","debug_id":"7a34aa25-334f-5bb5-bd7b-55854bafb447"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import "./reload-connect-toast-CwvSc6F-.js";
|
|
2
|
-
import { t as AppLoader } from "./app-loader-
|
|
2
|
+
import { t as AppLoader } from "./app-loader-JZy0JhJp.js";
|
|
3
3
|
export { AppLoader };
|
|
4
|
-
!function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="
|
|
5
|
-
//# debugId=
|
|
4
|
+
!function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="bd8038c2-2b06-5ed8-a344-1bc2a434b1de")}catch(e){}}();
|
|
5
|
+
//# debugId=bd8038c2-2b06-5ed8-a344-1bc2a434b1de
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
|
|
2
|
-
!function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="
|
|
2
|
+
!function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="1929e5c6-2fcf-504d-9b33-4790264371b5")}catch(e){}}();
|
|
3
3
|
import { n as getRuntimeConfig } from "./runtime-config-DL3QjcfM.js";
|
|
4
4
|
import { loadRuntimeEnv, normalizeBasePath } from "@powerhousedao/shared/connect";
|
|
5
5
|
import { setLogLevel } from "@powerhousedao/reactor-browser";
|
|
@@ -10,6 +10,10 @@ const runtime = getRuntimeConfig().connect;
|
|
|
10
10
|
function getRouterBasenameFromBasePath(basePath) {
|
|
11
11
|
return basePath.endsWith("/") ? basePath : basePath + "/";
|
|
12
12
|
}
|
|
13
|
+
function getDeployBasePath() {
|
|
14
|
+
if (typeof globalThis !== "undefined" && globalThis.__PH_DYNAMIC_BASE__) return import.meta.env.BASE_URL;
|
|
15
|
+
return runtime.app?.basePath || import.meta.env.BASE_URL;
|
|
16
|
+
}
|
|
13
17
|
function getBuiltInDefaults() {
|
|
14
18
|
return {
|
|
15
19
|
allowList: void 0,
|
|
@@ -73,7 +77,7 @@ function buildPHGlobalConfig(basePath, routerBasename, connectFromConfig) {
|
|
|
73
77
|
};
|
|
74
78
|
}
|
|
75
79
|
function getPHGlobalConfigFromRuntime() {
|
|
76
|
-
const basePath =
|
|
80
|
+
const basePath = getDeployBasePath() ?? "/";
|
|
77
81
|
return buildPHGlobalConfig(basePath, getRouterBasenameFromBasePath(basePath), runtime);
|
|
78
82
|
}
|
|
79
83
|
const phGlobalConfig = getPHGlobalConfigFromRuntime();
|
|
@@ -85,7 +89,7 @@ const defaultPHAppConfig = {
|
|
|
85
89
|
const RESOLVED_LOG_LEVEL = runtime.app?.logLevel;
|
|
86
90
|
if (RESOLVED_LOG_LEVEL) setLogLevel(RESOLVED_LOG_LEVEL);
|
|
87
91
|
logger.debug("Setting log level to @level.", RESOLVED_LOG_LEVEL);
|
|
88
|
-
const PH_CONNECT_BASE_PATH = normalizeBasePath(
|
|
92
|
+
const PH_CONNECT_BASE_PATH = normalizeBasePath(getDeployBasePath() ?? "/");
|
|
89
93
|
const PH_CONNECT_ANALYTICS_DATABASE_NAME = `${PH_CONNECT_BASE_PATH.replace(/\//g, "")}:analytics`;
|
|
90
94
|
const connectConfig = {
|
|
91
95
|
appVersion: env.PH_CONNECT_VERSION,
|
|
@@ -157,5 +161,5 @@ const connectConfig = {
|
|
|
157
161
|
//#endregion
|
|
158
162
|
export { defaultPHDocumentEditorConfig as a, defaultPHAppConfig as i, buildPHGlobalConfig as n, phGlobalConfig as o, connectConfig as r, PH_CONNECT_BASE_PATH as t };
|
|
159
163
|
|
|
160
|
-
//# sourceMappingURL=connect.config-
|
|
161
|
-
//# debugId=
|
|
164
|
+
//# sourceMappingURL=connect.config-Bt4pvvWV.js.map
|
|
165
|
+
//# debugId=1929e5c6-2fcf-504d-9b33-4790264371b5
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"connect.config-Bt4pvvWV.js","sources":["../src/connect.config.ts"],"sourcesContent":["import {\n setLogLevel,\n type PHAppConfig,\n type PHDocumentEditorConfig,\n type PHGlobalConfig,\n} from \"@powerhousedao/reactor-browser\";\nimport type { PHConnectRuntimeConfig } from \"@powerhousedao/shared/clis\";\nimport {\n loadRuntimeEnv,\n normalizeBasePath,\n} from \"@powerhousedao/shared/connect\";\nimport { logger } from \"document-model\";\nimport { getRuntimeConfig } from \"./runtime-config.js\";\n\n// Env vars are reserved for version stamps and analytics processor toggles.\n// Everything in the Connect runtime schema (PHConnectRuntimeConfig) is read\n// from `runtime` below. The Sentry release tag is stamped at build time via\n// Vite's `define` so it always matches the sourcemap upload tag CI used.\nexport const env = loadRuntimeEnv({\n processEnv: import.meta.env,\n});\n\ndeclare const PH_CONNECT_SENTRY_RELEASE: string;\n\n// Runtime fields come from the JSON, not env. start-connect.tsx's top-level\n// await guarantees the loader cache is warm by the time this module\n// evaluates, so getRuntimeConfig() resolves synchronously. The cache merges\n// DEFAULT_CONNECT_CONFIG into whatever the file declared, so every leaf\n// under `runtime.*` is guaranteed defined.\nconst runtime = getRuntimeConfig().connect;\n\nfunction getRouterBasenameFromBasePath(basePath: string) {\n return basePath.endsWith(\"/\") ? basePath : basePath + \"/\";\n}\n\n// Runtime deploy base. In dynamic-base builds the plugin rewrites\n// import.meta.env.BASE_URL to (globalThis.__PH_DYNAMIC_BASE__||\"/\"), the same\n// base assets resolve against; it takes precedence so router basename and\n// path stripping match the served subpath. A baked runtime base path\n// (runtime.app.basePath) only applies to concrete-base builds, where the\n// dynamic global is unset.\nfunction getDeployBasePath() {\n if (\n typeof globalThis !== \"undefined\" &&\n (globalThis as { __PH_DYNAMIC_BASE__?: string }).__PH_DYNAMIC_BASE__\n ) {\n return import.meta.env.BASE_URL;\n }\n return runtime.app?.basePath || import.meta.env.BASE_URL;\n}\n\n// Hardcoded literal defaults for `PHGlobalConfig` fields whose env-var\n// source was removed. The fields stay on the type so wired-but-dead SW /\n// hook consumers keep typechecking; values mirror the previous Zod\n// defaults.\nfunction getBuiltInDefaults(): Omit<\n PHGlobalConfig,\n \"basePath\" | \"routerBasename\"\n> {\n 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: false,\n studioMode: false,\n versionCheckInterval: 60 * 60 * 1000,\n cliVersion: env.PH_CONNECT_CLI_VERSION,\n fileUploadOperationsChunkSize: 50,\n gaTrackingId: undefined,\n defaultDrivesUrl: runtime.drives?.defaultDrives?.[0]?.url,\n drivesPreserveStrategy: runtime.drives?.preserveStrategy,\n enabledEditors: undefined,\n disabledEditors: [\"powerhouse/document-drive\"],\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 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: false,\n warnOutdatedApp: false,\n appVersionCheckInterval: 60 * 60 * 1000,\n routerBasename: PH_CONNECT_BASE_PATH,\n externalPackagesEnabled: runtime.packages?.externalEnabled,\n processors: {\n enabled: true,\n externalProcessorsEnabled: true,\n },\n analytics: {\n enabled: true,\n databaseName: PH_CONNECT_ANALYTICS_DATABASE_NAME,\n useWorker: false,\n driveAnalyticsEnabled: env.PH_CONNECT_DRIVE_ANALYTICS_ENABLED,\n diffProcessorEnabled: env.PH_CONNECT_DIFF_ANALYTICS_ENABLED,\n externalProcessorsEnabled: true,\n },\n relational: {\n enabled: true,\n externalProcessorsEnabled: true,\n },\n openPanel: {\n clientId: env.PH_CONNECT_OPENPANEL_CLIENT_ID ?? \"\",\n apiUrl: env.PH_CONNECT_OPENPANEL_API_URL,\n // Intentionally dormant — no call sites gate on this yet; UI-event tracking is future work.\n trackUiEvents: env.PH_CONNECT_OPENPANEL_TRACK_UI_EVENTS,\n trackOperations: env.PH_CONNECT_OPENPANEL_TRACK_OPERATIONS,\n },\n renown: {\n url: runtime.renown?.url,\n networkId: runtime.renown?.networkId,\n chainId: runtime.renown?.chainId,\n },\n sentry: {\n release: PH_CONNECT_SENTRY_RELEASE,\n // `dsn: null` (default) means Sentry is disabled — useInitSentry bails.\n dsn: runtime.sentry?.dsn ?? null,\n env: runtime.sentry?.env,\n tracing: runtime.sentry?.tracing ?? false,\n },\n content: {\n showSearchBar: false,\n showDocumentModelSelectionSetting: false,\n },\n drives: {\n addDriveEnabled: runtime.drives?.allowAddDrive,\n preserveStrategy: runtime.drives?.preserveStrategy,\n // The legacy `SharingType` enum still includes a \"CLOUD\" variant.\n // Connect collapsed CLOUD into the unified remote section, so both CLOUD\n // and PUBLIC map to the same `runtime.drives.sections.remote` object —\n // the alias keeps `sections[sharingType]` lookups type-safe for every\n // SharingType value.\n sections: (() => {\n const remote = {\n enabled: runtime.drives?.sections?.remote?.enabled,\n allowAdd: runtime.drives?.sections?.remote?.allowAdd,\n allowDelete: runtime.drives?.sections?.remote?.allowDelete,\n };\n return {\n LOCAL: {\n enabled: runtime.drives?.sections?.local?.enabled,\n allowAdd: runtime.drives?.sections?.local?.allowAdd,\n allowDelete: runtime.drives?.sections?.local?.allowDelete,\n },\n PUBLIC: remote,\n CLOUD: remote,\n };\n })(),\n },\n gaTrackingId: undefined,\n phCliVersion: env.PH_CONNECT_CLI_VERSION,\n} as const;\n"],"names":[],"mappings":";;;;;;;AAkBA,MAAa,MAAM,eAAe,EAChC,YAAY,OAAO,KAAK,KACzB,CAAC;AASF,MAAM,UAAU,kBAAkB,CAAC;AAEnC,SAAS,8BAA8B,UAAkB;AACvD,QAAO,SAAS,SAAS,IAAI,GAAG,WAAW,WAAW;;AASxD,SAAS,oBAAoB;AAC3B,KACE,OAAO,eAAe,eACrB,WAAgD,oBA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AAQ,QAAQ;EAC3B,SAAS,QAAQ,QAAQ;EAC1B;CACD,QAAQ;EACN,SAAS;EAET,KAAK,QAAQ,QAAQ,OAAO;EAC5B,KAAK,QAAQ,QAAQ;EACrB,SAAS,QAAQ,QAAQ,WAAW;EACrC;CACD,SAAS;EACP,eAAe;EACf,mCAAmC;EACpC;CACD,QAAQ;EACN,iBAAiB,QAAQ,QAAQ;EACjC,kBAAkB,QAAQ,QAAQ;EAMlC,iBAAiB;GACf,MAAM,SAAS;IACb,SAAS,QAAQ,QAAQ,UAAU,QAAQ;IAC3C,UAAU,QAAQ,QAAQ,UAAU,QAAQ;IAC5C,aAAa,QAAQ,QAAQ,UAAU,QAAQ;IAChD;AACD,UAAO;IACL,OAAO;KACL,SAAS,QAAQ,QAAQ,UAAU,OAAO;KAC1C,UAAU,QAAQ,QAAQ,UAAU,OAAO;KAC3C,aAAa,QAAQ,QAAQ,UAAU,OAAO;KAC/C;IACD,QAAQ;IACR,OAAO;IACR;MACC;EACL;CACD,cAAc,KAAA;CACd,cAAc,IAAI;CACnB","debug_id":"1929e5c6-2fcf-504d-9b33-4790264371b5"}
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
|
|
2
|
-
!function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="
|
|
2
|
+
!function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="e612f381-bfcf-5503-9fc6-8ace531f5b51")}catch(e){}}();
|
|
3
3
|
import { r as loadRuntimeConfig, t as applyConnectBranding } from "./runtime-config-DL3QjcfM.js";
|
|
4
4
|
import { t as ReloadConnectToast } from "./reload-connect-toast-CwvSc6F-.js";
|
|
5
|
-
import { t as package_default } from "./package-
|
|
6
|
-
import { r as connectConfig } from "./connect.config-
|
|
7
|
-
import { t as detectReactorPgMajor } from "./pglite-runtime-
|
|
8
|
-
import { n as seedPendingPgVersion } from "./pglite-seed-
|
|
9
|
-
import { n as createReactor } from "./reactor-
|
|
5
|
+
import { t as package_default } from "./package-DYtQroyQ.js";
|
|
6
|
+
import { r as connectConfig } from "./connect.config-Bt4pvvWV.js";
|
|
7
|
+
import { t as detectReactorPgMajor } from "./pglite-runtime-Ch2YeUAA.js";
|
|
8
|
+
import { n as seedPendingPgVersion } from "./pglite-seed-BWk7yOwr.js";
|
|
9
|
+
import { n as createReactor } from "./reactor-BAZd7zrS.js";
|
|
10
10
|
import { n as toast } from "./toast-BEy42aYx.js";
|
|
11
11
|
import { createElement, useEffect } from "react";
|
|
12
12
|
import { initTheme, useUser } from "@powerhousedao/reactor-browser";
|
|
@@ -97,5 +97,5 @@ async function loadComponent(localPackage) {
|
|
|
97
97
|
//#endregion
|
|
98
98
|
export { loadComponent };
|
|
99
99
|
|
|
100
|
-
//# sourceMappingURL=load-
|
|
101
|
-
//# debugId=
|
|
100
|
+
//# sourceMappingURL=load-CLVMr6Cp.js.map
|
|
101
|
+
//# debugId=e612f381-bfcf-5503-9fc6-8ace531f5b51
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"load-
|
|
1
|
+
{"version":3,"file":"load-CLVMr6Cp.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 { isLatestVersion } from \"@powerhousedao/connect/hooks\";\nimport { toast } from \"@powerhousedao/connect/services\";\nimport { logger } from \"document-model\";\nimport { createElement, useEffect } from \"react\";\nimport { ReloadConnectToast } from \"../components/reload-connect-toast.js\";\n\nexport const useCheckLatestVersion = () => {\n async function checkLatestVersion() {\n const result = await isLatestVersion();\n if (result === null) return;\n // ignore dev/staging versions\n if (result.isLatest || result.currentVersion.includes(\"-\")) {\n return true;\n }\n\n if (\n import.meta.env.MODE === \"development\" ||\n connectConfig.studioMode ||\n !connectConfig.warnOutdatedApp\n ) {\n logger.warn(\n \"Connect is outdated: \\nCurrent: @currentVersion\\nLatest: @latestVersion\",\n result.currentVersion,\n result.latestVersion,\n );\n } else {\n toast(createElement(ReloadConnectToast), {\n type: \"connect-warning\",\n toastId: \"outdated-app\",\n autoClose: false,\n });\n }\n }\n\n useEffect(() => {\n checkLatestVersion().catch(console.error);\n }, []);\n};\n","import { packageJson } from \"../utils/package-json.js\";\n\nexport const isMac = window.navigator.appVersion.includes(\"Mac\");\n\nconst urlBranchMap: Record<string, string> = {\n \"staging/makerdao\": \"deployments/staging/makerdao\",\n \"staging/arbitrum\": \"arb-ltip\",\n \"staging/powerhouse\": \"staging\",\n makerdao: \"deployments/makerdao\",\n arbitrum: \"deployments/arbitrum\",\n arbgrants: \"deployments/arbitrum\",\n localhost: \"develop\",\n};\n\nconst getGithubLinkFromUrl = () => {\n const githubLink = \"https://raw.githubusercontent.com/powerhouse-inc/connect\";\n const url = window.location.href;\n\n const env = Object.keys(urlBranchMap).find((env) => url.includes(env));\n const value = env ? urlBranchMap[env] : undefined;\n if (!value) {\n return undefined;\n } else {\n return `${githubLink}/${value}/package.json`;\n }\n};\n\nconst fetchLatestVersion = async () => {\n const link = getGithubLinkFromUrl();\n if (!link) {\n return undefined;\n }\n const result = await fetch(link);\n const data = (await result.json()) as { version: string };\n const { version } = data;\n return version;\n};\n\nexport const isLatestVersion = async () => {\n const currentVersion = packageJson.version;\n const deployed = await fetchLatestVersion();\n\n if (deployed) {\n return {\n isLatest: deployed === currentVersion,\n currentVersion,\n latestVersion: deployed,\n };\n }\n\n return null;\n};\n","import { useUser } from \"@powerhousedao/reactor-browser\";\nimport type { User as SentryUser } from \"@sentry/react\";\nimport { setUser as setSentryUser } from \"@sentry/react\";\nimport { useEffect } from \"react\";\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 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 detectReactorPgMajor();\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":["packageJson"],"mappings":";;;;;;;;;;;;;;;AAOA,MAAa,8BAA8B;CACzC,eAAe,qBAAqB;EAClC,MAAM,SAAS,MAAM,iBAAiB;AACtC,MAAI,WAAW,KAAM;AAErB,MAAI,OAAO,YAAY,OAAO,eAAe,SAAS,IAAI,CACxD,QAAO;AAGT,MACE,OAAO,KAAK,IAAI,SAAS,iBACzB,cAAc,cACd,CAAC,cAAc,gBAEf,QAAO,KACL,2EACA,OAAO,gBACP,OAAO,cACR;MAED,OAAM,cAAc,mBAAmB,EAAE;GACvC,MAAM;GACN,SAAS;GACT,WAAW;GACZ,CAAC;;AAIN,iBAAgB;AACd,sBAAoB,CAAC,MAAM,QAAQ,MAAM;IACxC,EAAE,CAAC;;ACnCa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5b51"}
|
package/dist/main.js
CHANGED
|
@@ -6,7 +6,7 @@ import { jsx } from "react/jsx-runtime";
|
|
|
6
6
|
//#region main.tsx
|
|
7
7
|
if (!window.ph) window.ph = {};
|
|
8
8
|
await loadRuntimeConfig();
|
|
9
|
-
const { AppLoader } = await import("./app-loader-
|
|
9
|
+
const { AppLoader } = await import("./app-loader-DzZzLHfJ.js");
|
|
10
10
|
createRoot(document.getElementById("root")).render(/* @__PURE__ */ jsx(AppLoader, {}));
|
|
11
11
|
//#endregion
|
|
12
12
|
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
//#region package.json
|
|
2
2
|
|
|
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]="
|
|
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]="44c35976-271c-5a94-abf8-4b7aa4c5a947")}catch(e){}}();
|
|
4
4
|
var package_default = {
|
|
5
5
|
name: "@powerhousedao/connect",
|
|
6
6
|
productName: "Powerhouse-Connect",
|
|
7
|
-
version: "6.2.0-dev.
|
|
7
|
+
version: "6.2.0-dev.6",
|
|
8
8
|
description: "Powerhouse Connect",
|
|
9
9
|
main: "dist/index.html",
|
|
10
10
|
type: "module",
|
|
@@ -121,5 +121,5 @@ var package_default = {
|
|
|
121
121
|
//#endregion
|
|
122
122
|
export { package_default as t };
|
|
123
123
|
|
|
124
|
-
//# sourceMappingURL=package-
|
|
125
|
-
//# debugId=
|
|
124
|
+
//# sourceMappingURL=package-DYtQroyQ.js.map
|
|
125
|
+
//# debugId=44c35976-271c-5a94-abf8-4b7aa4c5a947
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"package-DYtQroyQ.js","sources":["../package.json"],"sourcesContent":[""],"names":[],"mappings":"","debug_id":"44c35976-271c-5a94-abf8-4b7aa4c5a947"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
|
|
2
|
-
!function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="
|
|
3
|
-
import { t as PH_CONNECT_BASE_PATH } from "./connect.config-
|
|
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]="6b00b32d-5b00-5709-a1ee-057d1433add8")}catch(e){}}();
|
|
3
|
+
import { t as PH_CONNECT_BASE_PATH } from "./connect.config-Bt4pvvWV.js";
|
|
4
4
|
import { ROOT_STORAGE_NAMESPACE, getStorageNamespace } from "@powerhousedao/shared/connect";
|
|
5
5
|
import { DEFAULT_RELATIONAL_PROCESSOR_DB_NAME } from "@powerhousedao/shared/processors";
|
|
6
6
|
const STORAGE_NAMESPACE = getStorageNamespace(PH_CONNECT_BASE_PATH);
|
|
@@ -137,5 +137,5 @@ async function loadPgDump(major) {
|
|
|
137
137
|
//#endregion
|
|
138
138
|
export { loadPGliteModule as a, subscribeReactorPgMajor as c, createFileDataStore as d, idbError as f, RELATIONAL_PGLITE_NAME as g, REACTOR_PGLITE_NAME as h, invalidateReactorPgMajorCache as i, IDB_STORE_NAME as l, readPgVersionFile as m, detectRelationalPgMajor as n, loadPgDump as o, openIdb as p, getCachedReactorPgMajor as r, resolvePgMajorForRuntime as s, detectReactorPgMajor as t, PRIMARY_IDB_NAMES as u };
|
|
139
139
|
|
|
140
|
-
//# sourceMappingURL=pglite-runtime-
|
|
141
|
-
//# debugId=
|
|
140
|
+
//# sourceMappingURL=pglite-runtime-Ch2YeUAA.js.map
|
|
141
|
+
//# debugId=6b00b32d-5b00-5709-a1ee-057d1433add8
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pglite-runtime-toc1-TWa.js","sources":["../src/utils/storage-namespace.ts","../src/utils/pglite-idb.ts","../src/utils/pglite-runtime.ts"],"sourcesContent":["import { DEFAULT_RELATIONAL_PROCESSOR_DB_NAME } from \"@powerhousedao/shared/processors\";\nimport {\n getStorageNamespace,\n ROOT_STORAGE_NAMESPACE,\n} from \"@powerhousedao/shared/connect\";\nimport { PH_CONNECT_BASE_PATH } from \"../connect.config.js\";\n\n// Single owner of the origin-scoped storage namespace. Reuses the same\n// resolved base path connect.config.ts feeds the router so every store agrees.\nconst basePath = PH_CONNECT_BASE_PATH;\n\n// \"reactor\" at the root, \"reactor--<slug>\" under a path prefix.\nexport const STORAGE_NAMESPACE = getStorageNamespace(basePath);\n\n// PGlite data-dir name for the reactor store, fed to `idb://`.\nexport const REACTOR_PGLITE_NAME = STORAGE_NAMESPACE;\n\n// IdbFs name for the relational-processor worker store.\nexport const RELATIONAL_PGLITE_NAME =\n STORAGE_NAMESPACE === ROOT_STORAGE_NAMESPACE\n ? DEFAULT_RELATIONAL_PROCESSOR_DB_NAME\n : `${STORAGE_NAMESPACE}-${DEFAULT_RELATIONAL_PROCESSOR_DB_NAME}`;\n","import {\n REACTOR_PGLITE_NAME,\n RELATIONAL_PGLITE_NAME,\n} from \"./storage-namespace.js\";\n\nexport const IDB_STORE_NAME = \"FILE_DATA\";\nexport const IDB_DB_VERSION = 21;\n\nexport const REACTOR_IDB_NAME = `/pglite/${REACTOR_PGLITE_NAME}`;\nexport const RELATIONAL_IDB_NAME = `/pglite/${RELATIONAL_PGLITE_NAME}`;\n\nexport const PRIMARY_IDB_NAMES = [\n REACTOR_IDB_NAME,\n RELATIONAL_IDB_NAME,\n] as const;\n\ntype FileDataValue = {\n contents: Uint8Array | number[];\n mode: number;\n timestamp: Date | number;\n};\n\nexport function idbError(\n req: IDBRequest | IDBTransaction,\n context: string,\n): Error {\n const cause = req.error ?? new Error(\"unknown IDB error\");\n return new Error(`${context}: ${cause.message}`, { cause });\n}\n\nexport function indexedDbExists(name: string): Promise<boolean> {\n if (typeof indexedDB.databases === \"function\") {\n return indexedDB\n .databases()\n .then((dbs) => dbs.some((d) => d.name === name))\n .catch(() => true);\n }\n return Promise.resolve(true);\n}\n\nexport function openIdb(\n name: string,\n version: number,\n upgrade?: (db: IDBDatabase) => void,\n): Promise<IDBDatabase> {\n return new Promise((resolve, reject) => {\n const req = indexedDB.open(name, version);\n req.onerror = () => reject(idbError(req, `IDB open failed for ${name}`));\n req.onblocked = () => reject(new Error(`IDB open blocked for ${name}`));\n req.onupgradeneeded = () => upgrade?.(req.result);\n req.onsuccess = () => resolve(req.result);\n });\n}\n\nexport function createFileDataStore(db: IDBDatabase): void {\n if (!db.objectStoreNames.contains(IDB_STORE_NAME)) {\n const store = db.createObjectStore(IDB_STORE_NAME);\n store.createIndex(\"timestamp\", \"timestamp\", { unique: false });\n }\n}\n\nexport async function readPgVersionFile(\n idbName: string,\n): Promise<number | null> {\n if (!(await indexedDbExists(idbName))) return null;\n let db: IDBDatabase;\n try {\n db = await openIdb(idbName, IDB_DB_VERSION, createFileDataStore);\n } catch {\n return null;\n }\n try {\n if (!db.objectStoreNames.contains(IDB_STORE_NAME)) return null;\n const tx = db.transaction(IDB_STORE_NAME, \"readonly\");\n const store = tx.objectStore(IDB_STORE_NAME);\n const value = await new Promise<FileDataValue | null>((resolve, reject) => {\n const req = store.openCursor();\n req.onerror = () =>\n reject(idbError(req, `FILE_DATA cursor failed for ${idbName}`));\n req.onsuccess = () => {\n const cursor = req.result;\n if (!cursor) return resolve(null);\n const key = typeof cursor.key === \"string\" ? cursor.key : \"\";\n if (key.endsWith(\"/PG_VERSION\")) {\n resolve(cursor.value as FileDataValue);\n } else {\n cursor.continue();\n }\n };\n });\n if (!value) return null;\n const bytes =\n value.contents instanceof Uint8Array\n ? value.contents\n : new Uint8Array(value.contents);\n const text = new TextDecoder().decode(bytes).trim();\n const major = parseInt(text, 10);\n return Number.isFinite(major) ? major : null;\n } finally {\n db.close();\n }\n}\n","import type * as CurrentPGliteModuleNs from \"@electric-sql/pglite\";\nimport {\n readPgVersionFile,\n REACTOR_IDB_NAME,\n RELATIONAL_IDB_NAME,\n} from \"./pglite-idb.js\";\n\nexport const CURRENT_PG_MAJOR = 17;\nexport const SUPPORTED_PG_MAJORS = [16, 17] as const;\nexport type SupportedPgMajor = (typeof SUPPORTED_PG_MAJORS)[number];\n\ntype DetectedMajor = SupportedPgMajor | null;\n\ntype CurrentPGliteModule = typeof CurrentPGliteModuleNs;\n\nlet cachedReactorMajor: DetectedMajor | undefined;\nlet inflight: Promise<DetectedMajor> | undefined;\nconst majorListeners = new Set<() => void>();\n\nfunction notifyMajorChanged() {\n for (const l of majorListeners) l();\n}\n\nexport function subscribeReactorPgMajor(cb: () => void): () => void {\n majorListeners.add(cb);\n return () => {\n majorListeners.delete(cb);\n };\n}\n\nfunction coerceMajor(value: number | null): DetectedMajor {\n if (value === null) return null;\n return (SUPPORTED_PG_MAJORS as readonly number[]).includes(value)\n ? (value as SupportedPgMajor)\n : null;\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 notifyMajorChanged();\n}\n\nexport async function detectRelationalPgMajor(): Promise<DetectedMajor> {\n return coerceMajor(await readPgVersionFile(RELATIONAL_IDB_NAME));\n}\n\n/**\n * Pick the PGlite major to use for *new* reactor clients: fall back to the\n * current version when there is no existing data dir.\n */\nexport function resolvePgMajorForRuntime(\n detected: DetectedMajor,\n): SupportedPgMajor {\n return detected ?? CURRENT_PG_MAJOR;\n}\n\n/**\n * Loads the PGlite module that matches an on-disk data dir major version.\n *\n * The 0.2.x and 0.3.x modules expose the same runtime interface (PGlite class,\n * `idb://` data-dir support, waitReady, exec/query/transaction, close). The\n * return type is pinned to the current package's module so callers can use it\n * against `kysely-pglite-dialect` which peer-depends on both majors.\n */\nexport async function loadPGliteModule(\n major: SupportedPgMajor,\n): Promise<CurrentPGliteModule> {\n if (major === 16) {\n return (await import(\"pglite-legacy-02\")) as unknown as CurrentPGliteModule;\n }\n if (major === 17) return import(\"@electric-sql/pglite\");\n throw new Error(`Unsupported PGlite major: ${String(major)}`);\n}\n\ntype PgDumpFn = (options: {\n pg: unknown;\n}) => Promise<{ text(): Promise<string> }>;\n\n/**\n * Loads the pg_dump tool for the given PGlite major. pg_dump's VFS layout is\n * version-specific, so using the wrong major against a live PGlite instance\n * fails with Emscripten ENOENT (errno 44).\n */\nexport async function loadPgDump(major: SupportedPgMajor): Promise<PgDumpFn> {\n if (major === 16) {\n const mod = (await import(\"pglite-tools-legacy-02/pg_dump\")) as {\n pgDump: PgDumpFn;\n };\n return mod.pgDump;\n }\n if (major === 17) {\n const mod = (await import(\"@electric-sql/pglite-tools/pg_dump\")) as {\n pgDump: PgDumpFn;\n };\n return mod.pgDump;\n }\n throw new Error(`Unsupported PGlite major: ${String(major)}`);\n}\n"],"names":[],"mappings":";;;;;AAYA,MAAa,oBAAoB,oBAHhB,qBAG6C;AAG9D,MAAa,sBAAsB;AAGnC,MAAa,yBACX,sBAAsB,yBAClB,uCACA,GAAG,kBAAkB,GAAG;;;AChB9B,MAAa,iBAAiB;AAG9B,MAAa,mBAAmB,WAAW;AAC3C,MAAa,sBAAsB,WAAW;AAE9C,MAAa,oBAAoB,CAC/B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B;;AAGtB,eAAsB,0BAAkD;AACtE,QAAO,YAAY,MAAM,kBAAkB,oBAAoB,CAAC;;;;;;AAOlE,SAAgB,yBACd,UACkB;AAClB,QAAO,YAAA;;;;;;;;;;AAWT,eAAsB,iBACpB,OAC8B;AAC9B,KAAI,UAAU,GACZ,QAAQ,MAAM,OAAO;AAEvB,KAAI,UAAU,GAAI,QAAO,OAAO;AAChC,OAAM,IAAI,MAAM,6BAA6B,OAAO,MAAM,GAAG;;;;;;;AAY/D,eAAsB,WAAW,OAA4C;AAC3E,KAAI,UAAU,GAIZ,SAHa,MAAM,OAAO,mCAGf;AAEb,KAAI,UAAU,GAIZ,SAHa,MAAM,OAAO,uCAGf;AAEb,OAAM,IAAI,MAAM,6BAA6B,OAAO,MAAM,GAAG","debug_id":"8646820c-6f27-5ef6-a1f1-39f46bed434a"}
|
|
1
|
+
{"version":3,"file":"pglite-runtime-Ch2YeUAA.js","sources":["../src/utils/storage-namespace.ts","../src/utils/pglite-idb.ts","../src/utils/pglite-runtime.ts"],"sourcesContent":["import { DEFAULT_RELATIONAL_PROCESSOR_DB_NAME } from \"@powerhousedao/shared/processors\";\nimport {\n getStorageNamespace,\n ROOT_STORAGE_NAMESPACE,\n} from \"@powerhousedao/shared/connect\";\nimport { PH_CONNECT_BASE_PATH } from \"../connect.config.js\";\n\n// Single owner of the origin-scoped storage namespace. Reuses the same\n// resolved base path connect.config.ts feeds the router so every store agrees.\nconst basePath = PH_CONNECT_BASE_PATH;\n\n// \"reactor\" at the root, \"reactor--<slug>\" under a path prefix.\nexport const STORAGE_NAMESPACE = getStorageNamespace(basePath);\n\n// PGlite data-dir name for the reactor store, fed to `idb://`.\nexport const REACTOR_PGLITE_NAME = STORAGE_NAMESPACE;\n\n// IdbFs name for the relational-processor worker store.\nexport const RELATIONAL_PGLITE_NAME =\n STORAGE_NAMESPACE === ROOT_STORAGE_NAMESPACE\n ? DEFAULT_RELATIONAL_PROCESSOR_DB_NAME\n : `${STORAGE_NAMESPACE}-${DEFAULT_RELATIONAL_PROCESSOR_DB_NAME}`;\n","import {\n REACTOR_PGLITE_NAME,\n RELATIONAL_PGLITE_NAME,\n} from \"./storage-namespace.js\";\n\nexport const IDB_STORE_NAME = \"FILE_DATA\";\nexport const IDB_DB_VERSION = 21;\n\nexport const REACTOR_IDB_NAME = `/pglite/${REACTOR_PGLITE_NAME}`;\nexport const RELATIONAL_IDB_NAME = `/pglite/${RELATIONAL_PGLITE_NAME}`;\n\nexport const PRIMARY_IDB_NAMES = [\n REACTOR_IDB_NAME,\n RELATIONAL_IDB_NAME,\n] as const;\n\ntype FileDataValue = {\n contents: Uint8Array | number[];\n mode: number;\n timestamp: Date | number;\n};\n\nexport function idbError(\n req: IDBRequest | IDBTransaction,\n context: string,\n): Error {\n const cause = req.error ?? new Error(\"unknown IDB error\");\n return new Error(`${context}: ${cause.message}`, { cause });\n}\n\nexport function indexedDbExists(name: string): Promise<boolean> {\n if (typeof indexedDB.databases === \"function\") {\n return indexedDB\n .databases()\n .then((dbs) => dbs.some((d) => d.name === name))\n .catch(() => true);\n }\n return Promise.resolve(true);\n}\n\nexport function openIdb(\n name: string,\n version: number,\n upgrade?: (db: IDBDatabase) => void,\n): Promise<IDBDatabase> {\n return new Promise((resolve, reject) => {\n const req = indexedDB.open(name, version);\n req.onerror = () => reject(idbError(req, `IDB open failed for ${name}`));\n req.onblocked = () => reject(new Error(`IDB open blocked for ${name}`));\n req.onupgradeneeded = () => upgrade?.(req.result);\n req.onsuccess = () => resolve(req.result);\n });\n}\n\nexport function createFileDataStore(db: IDBDatabase): void {\n if (!db.objectStoreNames.contains(IDB_STORE_NAME)) {\n const store = db.createObjectStore(IDB_STORE_NAME);\n store.createIndex(\"timestamp\", \"timestamp\", { unique: false });\n }\n}\n\nexport async function readPgVersionFile(\n idbName: string,\n): Promise<number | null> {\n if (!(await indexedDbExists(idbName))) return null;\n let db: IDBDatabase;\n try {\n db = await openIdb(idbName, IDB_DB_VERSION, createFileDataStore);\n } catch {\n return null;\n }\n try {\n if (!db.objectStoreNames.contains(IDB_STORE_NAME)) return null;\n const tx = db.transaction(IDB_STORE_NAME, \"readonly\");\n const store = tx.objectStore(IDB_STORE_NAME);\n const value = await new Promise<FileDataValue | null>((resolve, reject) => {\n const req = store.openCursor();\n req.onerror = () =>\n reject(idbError(req, `FILE_DATA cursor failed for ${idbName}`));\n req.onsuccess = () => {\n const cursor = req.result;\n if (!cursor) return resolve(null);\n const key = typeof cursor.key === \"string\" ? cursor.key : \"\";\n if (key.endsWith(\"/PG_VERSION\")) {\n resolve(cursor.value as FileDataValue);\n } else {\n cursor.continue();\n }\n };\n });\n if (!value) return null;\n const bytes =\n value.contents instanceof Uint8Array\n ? value.contents\n : new Uint8Array(value.contents);\n const text = new TextDecoder().decode(bytes).trim();\n const major = parseInt(text, 10);\n return Number.isFinite(major) ? major : null;\n } finally {\n db.close();\n }\n}\n","import type * as CurrentPGliteModuleNs from \"@electric-sql/pglite\";\nimport {\n readPgVersionFile,\n REACTOR_IDB_NAME,\n RELATIONAL_IDB_NAME,\n} from \"./pglite-idb.js\";\n\nexport const CURRENT_PG_MAJOR = 17;\nexport const SUPPORTED_PG_MAJORS = [16, 17] as const;\nexport type SupportedPgMajor = (typeof SUPPORTED_PG_MAJORS)[number];\n\ntype DetectedMajor = SupportedPgMajor | null;\n\ntype CurrentPGliteModule = typeof CurrentPGliteModuleNs;\n\nlet cachedReactorMajor: DetectedMajor | undefined;\nlet inflight: Promise<DetectedMajor> | undefined;\nconst majorListeners = new Set<() => void>();\n\nfunction notifyMajorChanged() {\n for (const l of majorListeners) l();\n}\n\nexport function subscribeReactorPgMajor(cb: () => void): () => void {\n majorListeners.add(cb);\n return () => {\n majorListeners.delete(cb);\n };\n}\n\nfunction coerceMajor(value: number | null): DetectedMajor {\n if (value === null) return null;\n return (SUPPORTED_PG_MAJORS as readonly number[]).includes(value)\n ? (value as SupportedPgMajor)\n : null;\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 notifyMajorChanged();\n}\n\nexport async function detectRelationalPgMajor(): Promise<DetectedMajor> {\n return coerceMajor(await readPgVersionFile(RELATIONAL_IDB_NAME));\n}\n\n/**\n * Pick the PGlite major to use for *new* reactor clients: fall back to the\n * current version when there is no existing data dir.\n */\nexport function resolvePgMajorForRuntime(\n detected: DetectedMajor,\n): SupportedPgMajor {\n return detected ?? CURRENT_PG_MAJOR;\n}\n\n/**\n * Loads the PGlite module that matches an on-disk data dir major version.\n *\n * The 0.2.x and 0.3.x modules expose the same runtime interface (PGlite class,\n * `idb://` data-dir support, waitReady, exec/query/transaction, close). The\n * return type is pinned to the current package's module so callers can use it\n * against `kysely-pglite-dialect` which peer-depends on both majors.\n */\nexport async function loadPGliteModule(\n major: SupportedPgMajor,\n): Promise<CurrentPGliteModule> {\n if (major === 16) {\n return (await import(\"pglite-legacy-02\")) as unknown as CurrentPGliteModule;\n }\n if (major === 17) return import(\"@electric-sql/pglite\");\n throw new Error(`Unsupported PGlite major: ${String(major)}`);\n}\n\ntype PgDumpFn = (options: {\n pg: unknown;\n}) => Promise<{ text(): Promise<string> }>;\n\n/**\n * Loads the pg_dump tool for the given PGlite major. pg_dump's VFS layout is\n * version-specific, so using the wrong major against a live PGlite instance\n * fails with Emscripten ENOENT (errno 44).\n */\nexport async function loadPgDump(major: SupportedPgMajor): Promise<PgDumpFn> {\n if (major === 16) {\n const mod = (await import(\"pglite-tools-legacy-02/pg_dump\")) as {\n pgDump: PgDumpFn;\n };\n return mod.pgDump;\n }\n if (major === 17) {\n const mod = (await import(\"@electric-sql/pglite-tools/pg_dump\")) as {\n pgDump: PgDumpFn;\n };\n return mod.pgDump;\n }\n throw new Error(`Unsupported PGlite major: ${String(major)}`);\n}\n"],"names":[],"mappings":";;;;;AAYA,MAAa,oBAAoB,oBAHhB,qBAG6C;AAG9D,MAAa,sBAAsB;AAGnC,MAAa,yBACX,sBAAsB,yBAClB,uCACA,GAAG,kBAAkB,GAAG;;;AChB9B,MAAa,iBAAiB;AAG9B,MAAa,mBAAmB,WAAW;AAC3C,MAAa,sBAAsB,WAAW;AAE9C,MAAa,oBAAoB,CAC/B,kBACA,oBACD;AAQD,SAAgB,SACd,KACA,SACO;CACP,MAAM,QAAQ,IAAI,yBAAS,IAAI,MAAM,oBAAoB;AACzD,QAAO,IAAI,MAAM,GAAG,QAAQ,IAAI,MAAM,WAAW,EAAE,OAAO,CAAC;;AAG7D,SAAgB,gBAAgB,MAAgC;AAC9D,KAAI,OAAO,UAAU,cAAc,WACjC,QAAO,UACJ,WAAW,CACX,MAAM,QAAQ,IAAI,MAAM,MAAM,EAAE,SAAS,KAAK,CAAC,CAC/C,YAAY,KAAK;AAEtB,QAAO,QAAQ,QAAQ,KAAK;;AAG9B,SAAgB,QACd,MACA,SACA,SACsB;AACtB,QAAO,IAAI,SAAS,SAAS,WAAW;EACtC,MAAM,MAAM,UAAU,KAAK,MAAM,QAAQ;AACzC,MAAI,gBAAgB,OAAO,SAAS,KAAK,uBAAuB,OAAO,CAAC;AACxE,MAAI,kBAAkB,uBAAO,IAAI,MAAM,wBAAwB,OAAO,CAAC;AACvE,MAAI,wBAAwB,UAAU,IAAI,OAAO;AACjD,MAAI,kBAAkB,QAAQ,IAAI,OAAO;GACzC;;AAGJ,SAAgB,oBAAoB,IAAuB;AACzD,KAAI,CAAC,GAAG,iBAAiB,SAAA,YAAwB,CACjC,IAAG,kBAAkB,eAAe,CAC5C,YAAY,aAAa,aAAa,EAAE,QAAQ,OAAO,CAAC;;AAIlE,eA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Q,oBAA0C,SAAS,MAAM,GAC5D,QACD;;AAGN,eAAsB,uBAA+C;AACnE,KAAI,uBAAuB,KAAA,EAAW,QAAO;AAC7C,KAAI,SAAU,QAAO;AAErB,aAAY,YAAY;EACtB,MAAM,QAAQ,YAAY,MAAM,kBAAkB,iBAAiB,CAAC;AACpE,uBAAqB;AACrB,sBAAoB;AACpB,SAAO;KACL;AACJ,KAAI;AACF,SAAO,MAAM;WACL;AACR,aAAW,KAAA;;;AAIf,SAAgB,0BAAqD;AACnE,QAAO;;AAGT,SAAgB,gCAAsC;AACpD,sBAAqB,KAAA;AACrB,qBAAoB;;AAGtB,eAAsB,0BAAkD;AACtE,QAAO,YAAY,MAAM,kBAAkB,oBAAoB,CAAC;;;;;;AAOlE,SAAgB,yBACd,UACkB;AAClB,QAAO,YAAA;;;;;;;;;;AAWT,eAAsB,iBACpB,OAC8B;AAC9B,KAAI,UAAU,GACZ,QAAQ,MAAM,OAAO;AAEvB,KAAI,UAAU,GAAI,QAAO,OAAO;AAChC,OAAM,IAAI,MAAM,6BAA6B,OAAO,MAAM,GAAG;;;;;;;AAY/D,eAAsB,WAAW,OAA4C;AAC3E,KAAI,UAAU,GAIZ,SAHa,MAAM,OAAO,mCAGf;AAEb,KAAI,UAAU,GAIZ,SAHa,MAAM,OAAO,uCAGf;AAEb,OAAM,IAAI,MAAM,6BAA6B,OAAO,MAAM,GAAG","debug_id":"6b00b32d-5b00-5709-a1ee-057d1433add8"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
|
|
2
|
-
!function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="
|
|
3
|
-
import { h as REACTOR_PGLITE_NAME, i as invalidateReactorPgMajorCache } from "./pglite-runtime-
|
|
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]="4ef4b473-18d1-5fb1-b13f-fcacfcbbe632")}catch(e){}}();
|
|
3
|
+
import { h as REACTOR_PGLITE_NAME, i as invalidateReactorPgMajorCache } from "./pglite-runtime-Ch2YeUAA.js";
|
|
4
4
|
//#region src/utils/pglite-seed.ts
|
|
5
5
|
const PENDING_PG_SEED_KEY = "ph:pending-pg-seed";
|
|
6
6
|
/**
|
|
@@ -45,5 +45,5 @@ async function seedPendingPgVersion() {
|
|
|
45
45
|
//#endregion
|
|
46
46
|
export { seedPendingPgVersion as n, PENDING_PG_SEED_KEY as t };
|
|
47
47
|
|
|
48
|
-
//# sourceMappingURL=pglite-seed-
|
|
49
|
-
//# debugId=
|
|
48
|
+
//# sourceMappingURL=pglite-seed-BWk7yOwr.js.map
|
|
49
|
+
//# debugId=4ef4b473-18d1-5fb1-b13f-fcacfcbbe632
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pglite-seed-
|
|
1
|
+
{"version":3,"file":"pglite-seed-BWk7yOwr.js","sources":["../src/utils/pglite-seed.ts"],"sourcesContent":["import { invalidateReactorPgMajorCache } from \"./pglite-runtime.js\";\nimport { REACTOR_PGLITE_NAME } from \"./storage-namespace.js\";\n\nexport const PENDING_PG_SEED_KEY = \"ph:pending-pg-seed\";\n\n/**\n * If the Debug Inspector requested a forced PG version reset, this runs\n * before the reactor is created on the subsequent page load: opens a fresh\n * PGlite of the requested major against the reactor data dir, lets `initdb`\n * populate `PG_VERSION`, then closes. The next step of app boot then\n * detects this fresh data dir and picks the matching runtime.\n */\nexport async function seedPendingPgVersion(): Promise<void> {\n const raw = localStorage.getItem(PENDING_PG_SEED_KEY);\n if (!raw) return;\n\n const major = parseInt(raw, 10);\n console.info(`[pglite-seed] Seeding fresh PG${major} data dir...`);\n\n try {\n if (major === 16) {\n const { PGlite } = await import(\"pglite-legacy-02\");\n const pg = new PGlite(`idb://${REACTOR_PGLITE_NAME}`);\n try {\n await pg.waitReady;\n } finally {\n await pg.close();\n }\n } else if (major === 17) {\n const { PGlite } = await import(\"@electric-sql/pglite\");\n const pg = new PGlite(`idb://${REACTOR_PGLITE_NAME}`);\n try {\n await pg.waitReady;\n } finally {\n await pg.close();\n }\n } else {\n console.warn(`[pglite-seed] Unsupported version ${raw}, skipping`);\n return;\n }\n console.info(`[pglite-seed] Seeded PG${major} data dir.`);\n } finally {\n localStorage.removeItem(PENDING_PG_SEED_KEY);\n invalidateReactorPgMajorCache();\n }\n}\n"],"names":[],"mappings":";;;;AAGA,MAAa,sBAAsB;;;;;;;;AASnC,eAAsB,uBAAsC;CAC1D,MAAM,MAAM,aAAa,QAAQ,oBAAoB;AACrD,KAAI,CAAC,IAAK;CAEV,MAAM,QAAQ,SAAS,KAAK,GAAG;AAC/B,SAAQ,KAAK,iCAAiC,MAAM,cAAc;AAElE,KAAI;AACF,MAAI,UAAU,IAAI;GAChB,MAAM,EAAE,WAAW,MAAM,OAAO;GAChC,MAAM,KAAK,IAAI,OAAO,SAAS,sBAAsB;AACrD,OAAI;AACF,UAAM,GAAG;aACD;AACR,UAAM,GAAG,OAAO;;aAET,UAAU,IAAI;GACvB,MAAM,EAAE,WAAW,MAAM,OAAO;GAChC,MAAM,KAAK,IAAI,OAAO,SAAS,sBAAsB;AACrD,OAAI;AACF,UAAM,GAAG;aACD;AACR,UAAM,GAAG,OAAO;;SAEb;AACL,WAAQ,KAAK,qCAAqC,IAAI,YAAY;AAClE;;AAEF,UAAQ,KAAK,0BAA0B,MAAM,YAAY;WACjD;AACR,eAAa,WAAW,oBAAoB;AAC5C,iCAA+B","debug_id":"4ef4b473-18d1-5fb1-b13f-fcacfcbbe632"}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
|
|
2
|
-
!function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="
|
|
2
|
+
!function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="c7b932d6-499a-581f-8b8e-217a69028ecd")}catch(e){}}();
|
|
3
3
|
import { n as getRuntimeConfig } from "./runtime-config-DL3QjcfM.js";
|
|
4
|
-
import { n as buildPHGlobalConfig, o as phGlobalConfig } from "./connect.config-
|
|
5
|
-
import { a as loadPGliteModule, g as RELATIONAL_PGLITE_NAME, h as REACTOR_PGLITE_NAME, n as detectRelationalPgMajor, s as resolvePgMajorForRuntime, t as detectReactorPgMajor } from "./pglite-runtime-
|
|
4
|
+
import { n as buildPHGlobalConfig, o as phGlobalConfig } from "./connect.config-Bt4pvvWV.js";
|
|
5
|
+
import { a as loadPGliteModule, g as RELATIONAL_PGLITE_NAME, h as REACTOR_PGLITE_NAME, n as detectRelationalPgMajor, s as resolvePgMajorForRuntime, t as detectReactorPgMajor } from "./pglite-runtime-Ch2YeUAA.js";
|
|
6
6
|
import { n as toast } from "./toast-BEy42aYx.js";
|
|
7
7
|
import { createRelationalDb } from "@powerhousedao/shared/processors";
|
|
8
8
|
import { BrowserLocalStorage, ChannelScheme, DocumentCache, DocumentChangeType, ReactorBuilder, ReactorClientBuilder, RegistryClient, addPHEventHandlers, addRemoteDrive, createAnalyticsStore, extractDriveSlugFromPath, extractNodeSlugFromPath, getDrives, login, refreshReactorDataClient, setAttachmentService, setDefaultPHGlobalConfig, setDocumentCache, setDriveMetadata, setDrives, setFeatures, setPHToast, setPackageDiscoveryService, setReactorClient, setReactorClientModule, setRenown, setSelectedDrive, setSelectedNode, setVetraPackageManager, waitForDocumentReady } from "@powerhousedao/reactor-browser";
|
|
@@ -1049,5 +1049,5 @@ function getDriveUrl() {
|
|
|
1049
1049
|
//#endregion
|
|
1050
1050
|
export { createReactor as n, clearReactorStorage as t };
|
|
1051
1051
|
|
|
1052
|
-
//# sourceMappingURL=reactor-
|
|
1053
|
-
//# debugId=
|
|
1052
|
+
//# sourceMappingURL=reactor-BAZd7zrS.js.map
|
|
1053
|
+
//# debugId=c7b932d6-499a-581f-8b8e-217a69028ecd
|