@powerhousedao/connect 6.2.0-dev.50 → 6.2.0-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.
- package/assets/pwa-192x192.png +0 -0
- package/assets/pwa-512x512.png +0 -0
- package/dist/{ClearStorageModal-Diwwy202.js → ClearStorageModal-4MkxmnIp.js} +4 -4
- package/dist/{ClearStorageModal-Diwwy202.js.map → ClearStorageModal-4MkxmnIp.js.map} +1 -1
- package/dist/{DebugSettingsModal-BPtsm2ux.js → DebugSettingsModal-DZ4a_vFY.js} +6 -6
- package/dist/{DebugSettingsModal-BPtsm2ux.js.map → DebugSettingsModal-DZ4a_vFY.js.map} +1 -1
- package/dist/{DriveAuthRequiredModal-B5-ZfKsb.js → DriveAuthRequiredModal-BA2vS3oF.js} +10 -6
- package/dist/DriveAuthRequiredModal-BA2vS3oF.js.map +1 -0
- package/dist/{InspectorModal-Dp1FBq9d.js → InspectorModal-s7_K9yPo.js} +6 -6
- package/dist/{InspectorModal-Dp1FBq9d.js.map → InspectorModal-s7_K9yPo.js.map} +1 -1
- package/dist/{SettingsModal-muq2HR8F.js → SettingsModal-CsRy5mNK.js} +6 -6
- package/dist/{SettingsModal-muq2HR8F.js.map → SettingsModal-CsRy5mNK.js.map} +1 -1
- package/dist/app-loader-BoTn1LSc.js +4 -0
- package/dist/{app-loader-AudT2qbl.js → app-loader-Bx_o6cZK.js} +62 -29
- package/dist/app-loader-Bx_o6cZK.js.map +1 -0
- package/dist/{build-info-CfGW54mJ.js → build-info-CrFlT7e6.js} +5 -5
- package/dist/{build-info-CfGW54mJ.js.map → build-info-CrFlT7e6.js.map} +1 -1
- package/dist/components-DJw4_DFC.js +5 -0
- package/dist/{connect.config-BG681xG9.js → connect.config-p8UTNojR.js} +4 -3
- package/dist/{connect.config-BG681xG9.js.map → connect.config-p8UTNojR.js.map} +1 -1
- package/dist/{connection-state-Cig644T0.js → connection-state-B7b2E8-L.js} +5 -8
- package/dist/{connection-state-Cig644T0.js.map → connection-state-B7b2E8-L.js.map} +1 -1
- package/dist/{load-MsCco4SR.js → load-C0qmCc_V.js} +9 -10
- package/dist/load-C0qmCc_V.js.map +1 -0
- package/dist/main.js +1 -1
- package/dist/{package-CiQlaJud.js → package-Do80N5uy.js} +4 -4
- package/dist/package-Do80N5uy.js.map +1 -0
- package/dist/{pglite-seed-9rjhdCs5.js → pglite-seed-OvaK2kRv.js} +4 -4
- package/dist/{pglite-seed-9rjhdCs5.js.map → pglite-seed-OvaK2kRv.js.map} +1 -1
- package/dist/{reactor-DAj2miMQ.js → reactor-ozZgs2eJ.js} +42 -38
- package/dist/reactor-ozZgs2eJ.js.map +1 -0
- package/dist/registerServiceWorker-BGIXpgGV.js +127 -0
- package/dist/registerServiceWorker-BGIXpgGV.js.map +1 -0
- package/dist/{reload-connect-toast-qibmlgQm.js → reload-connect-toast-D1Iqw9E_.js} +13 -4
- package/dist/reload-connect-toast-D1Iqw9E_.js.map +1 -0
- package/dist/start-connect.js +1 -1
- package/dist/style.css +18 -4
- package/package.json +11 -11
- package/dist/DriveAuthRequiredModal-B5-ZfKsb.js.map +0 -1
- package/dist/app-loader-AudT2qbl.js.map +0 -1
- package/dist/app-loader-DXGHddpJ.js +0 -4
- package/dist/components-DpeD6Icw.js +0 -5
- package/dist/load-MsCco4SR.js.map +0 -1
- package/dist/package-CiQlaJud.js.map +0 -1
- package/dist/reactor-DAj2miMQ.js.map +0 -1
- package/dist/registerServiceWorker-2tRbkdJj.js +0 -81
- package/dist/registerServiceWorker-2tRbkdJj.js.map +0 -1
- package/dist/reload-connect-toast-qibmlgQm.js.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"connect.config-BG681xG9.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,oBAEjD,QAAO,OAAO,KAAK,IAAI;AAEzB,QAAO,QAAQ,KAAK,YAAY,OAAO,KAAK,IAAI;;AAOlD,SAAS,qBAGP;AACA,QAAO;EACL,WAAW,KAAA;EACX,sBAAsB,EAAE;EACxB,sBAAsB;EACtB,0BAA0B;EAC1B,yBAAyB;EACzB,2BAA2B;EAC3B,SAAS,IAAI;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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":"277adfc7-7e86-55c4-bc87-b31da3bcfb3d"}
|
|
1
|
+
{"version":3,"file":"connect.config-p8UTNojR.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 offline: runtime.app?.offline ?? true,\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,oBAEjD,QAAO,OAAO,KAAK,IAAI;AAEzB,QAAO,QAAQ,KAAK,YAAY,OAAO,KAAK,IAAI;;AAOlD,SAAS,qBAGP;AACA,QAAO;EACL,WAAW,KAAA;EACX,sBAAsB,EAAE;EACxB,sBAAsB;EACtB,0BAA0B;EAC1B,yBAAyB;EACzB,2BAA2B;EAC3B,SAAS,IAAI;EACb,UAAU,QAAQ,KAAK;EACvB,qBAAqB;EACrB,iBAAiB;EACjB,YAAY;EACZ,sBAAsB,OAAU;EAChC,YAAY,IAAI;EAChB,+BAA+B;EAC/B,cAAc,KAAA;EACd,kBAAkB,QAAQ,QAAQ,gBAAgB,IAAI;EACtD,wBAAwB,QAAQ,QAAQ;EACxC,gBAAgB,KAAA;EAChB,iBAAiB,CAAC,4BAA4B;EAG9C,6BAA6B;EAG7B,oBAAoB;EACpB,sCACE,IAAI;EACN,uBAAuB,KAAA;EACvB,+BAA+B;EAC/B,uCAAuC;EAEvC,WAAW,QAAQ,QAAQ;EAC3B,iBAAiB,QAAQ,QAAQ;EACjC,eAAe,QAAQ,QAAQ;EAC/B,eAAe;EACf,WAAW,QAAQ,QAAQ,OAAO,KAAA;EAClC,WAAW,QAAQ,QAAQ;EAC3B,wBAAwB,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|
|
|
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]="3d461450-bb34-5169-9062-77a7f5e78a09")}catch(e){}}();
|
|
3
3
|
import { n as getRuntimeConfig } from "./runtime-config-DL3QjcfM.js";
|
|
4
4
|
import { n as isMigratableMajor, t as coerceMajor, u as readPgVersionFile } from "./pglite-major-B39aOEiE.js";
|
|
5
|
-
import { t as PH_CONNECT_BASE_PATH } from "./connect.config-
|
|
5
|
+
import { t as PH_CONNECT_BASE_PATH } from "./connect.config-p8UTNojR.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
|
|
@@ -69,9 +69,6 @@ function invalidateReactorPgMajorCache() {
|
|
|
69
69
|
notifyMajorChanged();
|
|
70
70
|
notifyMigrationChanged();
|
|
71
71
|
}
|
|
72
|
-
async function detectRelationalPgMajor() {
|
|
73
|
-
return coerceMajor(await readPgVersionFile(RELATIONAL_IDB_NAME));
|
|
74
|
-
}
|
|
75
72
|
function subscribeMigrationMajor(cb) {
|
|
76
73
|
migrationListeners.add(cb);
|
|
77
74
|
return () => {
|
|
@@ -120,7 +117,7 @@ function subscribeWorkerConnection(listener) {
|
|
|
120
117
|
};
|
|
121
118
|
}
|
|
122
119
|
//#endregion
|
|
123
|
-
export { detectReactorPgMajor as a,
|
|
120
|
+
export { detectReactorPgMajor as a, invalidateReactorPgMajorCache as c, PRIMARY_IDB_NAMES as d, REACTOR_INSTANCE_NAMESPACE as f, detectMigrationMajor as i, subscribeMigrationMajor as l, RELATIONAL_PGLITE_NAME as m, setWorkerConnectionStatus as n, getCachedMigrationMajor as o, REACTOR_PGLITE_NAME as p, subscribeWorkerConnection as r, getCachedReactorPgMajor as s, getWorkerConnectionStatus as t, subscribeReactorPgMajor as u };
|
|
124
121
|
|
|
125
|
-
//# sourceMappingURL=connection-state-
|
|
126
|
-
//# debugId=
|
|
122
|
+
//# sourceMappingURL=connection-state-B7b2E8-L.js.map
|
|
123
|
+
//# debugId=3d461450-bb34-5169-9062-77a7f5e78a09
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"connection-state-
|
|
1
|
+
{"version":3,"file":"connection-state-B7b2E8-L.js","sources":["../src/utils/reactor-namespace.ts","../src/utils/storage-namespace.ts","../src/utils/pglite-runtime.ts","../src/connection-state.ts"],"sourcesContent":["import { getStorageNamespace } from \"@powerhousedao/shared/connect\";\nimport { hashNamespace } from \"@powerhousedao/shared/processors\";\n\nexport type ReactorNamespaceInput = {\n basePath: string;\n explicit?: string;\n endpoint?: string;\n};\n\nexport function resolveReactorNamespace(input: ReactorNamespaceInput): string {\n const explicit = input.explicit?.trim();\n if (explicit) {\n return explicit;\n }\n const base = getStorageNamespace(input.basePath);\n const endpoint = input.endpoint?.trim();\n if (endpoint) {\n return `${base}--${hashNamespace(endpoint, 8)}`;\n }\n return base;\n}\n","import { DEFAULT_RELATIONAL_PROCESSOR_DB_NAME } from \"@powerhousedao/shared/processors\";\nimport { ROOT_STORAGE_NAMESPACE } from \"@powerhousedao/shared/connect\";\nimport { PH_CONNECT_BASE_PATH } from \"../connect.config.js\";\nimport { getRuntimeConfig } from \"../runtime-config.js\";\nimport { resolveReactorNamespace } from \"./reactor-namespace.js\";\n\nexport const REACTOR_INSTANCE_NAMESPACE = resolveReactorNamespace({\n basePath: PH_CONNECT_BASE_PATH,\n explicit: getRuntimeConfig().connect.instance?.namespace ?? undefined,\n});\n\nexport const REACTOR_PGLITE_NAME = REACTOR_INSTANCE_NAMESPACE;\n\nexport const RELATIONAL_PGLITE_NAME =\n REACTOR_INSTANCE_NAMESPACE === ROOT_STORAGE_NAMESPACE\n ? DEFAULT_RELATIONAL_PROCESSOR_DB_NAME\n : `${REACTOR_INSTANCE_NAMESPACE}-${DEFAULT_RELATIONAL_PROCESSOR_DB_NAME}`;\n\n// Here, not pglite-idb.ts, so those IDB helpers stay free of runtime-config\n// and remain importable by the reactor SharedWorker.\nexport const REACTOR_IDB_NAME = `/pglite/${REACTOR_PGLITE_NAME}`;\nexport const RELATIONAL_IDB_NAME = `/pglite/${RELATIONAL_PGLITE_NAME}`;\nexport const PRIMARY_IDB_NAMES = [\n REACTOR_IDB_NAME,\n RELATIONAL_IDB_NAME,\n] as const;\n","import { readPgVersionFile } from \"./pglite-idb.js\";\nimport {\n coerceMajor,\n isMigratableMajor,\n type DetectedMajor,\n} from \"./pglite-major.js\";\nimport { REACTOR_IDB_NAME, RELATIONAL_IDB_NAME } from \"./storage-namespace.js\";\n\nexport {\n CURRENT_PG_MAJOR,\n SUPPORTED_PG_MAJORS,\n coerceMajor,\n resolvePgMajorForRuntime,\n loadPGliteModule,\n loadPgDump,\n type SupportedPgMajor,\n type DetectedMajor,\n} from \"./pglite-major.js\";\n\nlet cachedReactorMajor: DetectedMajor | undefined;\nlet inflight: Promise<DetectedMajor> | undefined;\nconst majorListeners = new Set<() => void>();\n\nlet cachedMigrationMajor: DetectedMajor | undefined;\nlet migrationInflight: Promise<DetectedMajor> | undefined;\nconst migrationListeners = new Set<() => void>();\n\nfunction notifyMajorChanged() {\n for (const l of majorListeners) l();\n}\n\nfunction notifyMigrationChanged() {\n for (const l of migrationListeners) l();\n}\n\nexport function subscribeReactorPgMajor(cb: () => void): () => void {\n majorListeners.add(cb);\n return () => {\n majorListeners.delete(cb);\n };\n}\n\nexport async function detectReactorPgMajor(): Promise<DetectedMajor> {\n if (cachedReactorMajor !== undefined) return cachedReactorMajor;\n if (inflight) return inflight;\n\n inflight = (async () => {\n const major = coerceMajor(await readPgVersionFile(REACTOR_IDB_NAME));\n cachedReactorMajor = major;\n notifyMajorChanged();\n return major;\n })();\n try {\n return await inflight;\n } finally {\n inflight = undefined;\n }\n}\n\nexport function getCachedReactorPgMajor(): DetectedMajor | undefined {\n return cachedReactorMajor;\n}\n\nexport function invalidateReactorPgMajorCache(): void {\n cachedReactorMajor = undefined;\n cachedMigrationMajor = undefined;\n notifyMajorChanged();\n notifyMigrationChanged();\n}\n\nexport async function detectRelationalPgMajor(): Promise<DetectedMajor> {\n return coerceMajor(await readPgVersionFile(RELATIONAL_IDB_NAME));\n}\n\nexport function subscribeMigrationMajor(cb: () => void): () => void {\n migrationListeners.add(cb);\n return () => {\n migrationListeners.delete(cb);\n };\n}\n\nexport function getCachedMigrationMajor(): DetectedMajor | undefined {\n return cachedMigrationMajor;\n}\n\n/**\n * Legacy major the migration banner should prompt for: the first primary store\n * (reactor or relational) on a supported, non-current major. Spans both stores\n * to match migrateAllIfNeeded.\n */\nexport async function detectMigrationMajor(): Promise<DetectedMajor> {\n if (cachedMigrationMajor !== undefined) return cachedMigrationMajor;\n if (migrationInflight) return migrationInflight;\n\n migrationInflight = (async () => {\n const majors = await Promise.all([\n readPgVersionFile(REACTOR_IDB_NAME),\n readPgVersionFile(RELATIONAL_IDB_NAME),\n ]);\n const legacy = majors.find(isMigratableMajor) ?? null;\n cachedMigrationMajor = legacy;\n notifyMigrationChanged();\n return legacy;\n })();\n try {\n return await migrationInflight;\n } finally {\n migrationInflight = undefined;\n }\n}\n","export type WorkerConnectionStatus = \"connected\" | \"lost\";\n\nlet status: WorkerConnectionStatus = \"connected\";\nconst listeners = new Set<() => void>();\n\nexport function getWorkerConnectionStatus(): WorkerConnectionStatus {\n return status;\n}\n\nexport function setWorkerConnectionStatus(next: WorkerConnectionStatus): void {\n if (status === next) {\n return;\n }\n status = next;\n for (const listener of [...listeners]) {\n listener();\n }\n}\n\nexport function subscribeWorkerConnection(listener: () => void): () => void {\n listeners.add(listener);\n return () => {\n listeners.delete(listener);\n };\n}\n"],"names":[],"mappings":";;;;;;;;AASA,SAAgB,wBAAwB,OAAsC;CAC5E,MAAM,WAAW,MAAM,UAAU,MAAM;AACvC,KAAI,SACF,QAAO;CAET,MAAM,OAAO,oBAAoB,MAAM,SAAS;CAChD,MAAM,WAAW,MAAM,UAAU,MAAM;AACvC,KAAI,SACF,QAAO,GAAG,KAAK,IAAI,cAAc,UAAU,EAAE;AAE/C,QAAO;;;;ACbT,MAAa,6BAA6B,wBAAwB;CAChE,UAAU;CACV,UAAU,kBAAkB,CAAC,QAAQ,UAAU,aAAa,KAAA;CAC7D,CAAC;AAEF,MAAa,sBAAsB;AAEnC,MAAa,yBACX,+BAA+B,yBAC3B,uCACA,GAAG,2BAA2B,GAAG;AAIvC,MAAa,mBAAmB,WAAW;AAC3C,MAAa,sBAAsB,WAAW;AAC9C,MAAa,oBAAoB,CAC/B,kBACA,oBACD;;;ACND,IAAI;AACJ,IAAI;AACJ,MAAM,iCAAiB,IAAI,KAAiB;AAE5C,IAAI;AACJ,IAAI;AACJ,MAAM,qCAAqB,IAAI,KAAiB;AAEhD,SAAS,qBAAqB;AAC5B,MAAK,MAAM,KAAK,eAAgB,IAAG;;AAGrC,SAAS,yBAAyB;AAChC,MAAK,MAAM,KAAK,mBAAoB,IAAG;;AAGzC,SAAgB,wBAAwB,IAA4B;AAClE,gBAAe,IAAI,GAAG;AACtB,cAAa;AACX,iBAAe,OAAO,GAAG;;;AAI7B,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,wBAAuB,KAAA;AACvB,qBAAoB;AACpB,yBAAwB;;AAO1B,SAAgB,wBAAwB,IAA4B;AAClE,oBAAmB,IAAI,GAAG;AAC1B,cAAa;AACX,qBAAmB,OAAO,GAAG;;;AAIjC,SAAgB,0BAAqD;AACnE,QAAO;;;;;;;AAQT,eAAsB,uBAA+C;AACnE,KAAI,yBAAyB,KAAA,EAAW,QAAO;AAC/C,KAAI,kBAAmB,QAAO;AAE9B,sBAAqB,YAAY;EAK/B,MAAM,UAJS,MAAM,QAAQ,IAAI,CAC/B,kBAAkB,iBAAiB,EACnC,kBAAkB,oBAAoB,CACvC,CAAC,EACoB,KAAK,kBAAkB,IAAI;AACjD,yBAAuB;AACvB,0BAAwB;AACxB,SAAO;KACL;AACJ,KAAI;AACF,SAAO,MAAM;WACL;AACR,sBAAoB,KAAA;;;;;ACzGxB,IAAI,SAAiC;AACrC,MAAM,4BAAY,IAAI,KAAiB;AAEvC,SAAgB,4BAAoD;AAClE,QAAO;;AAGT,SAAgB,0BAA0B,MAAoC;AAC5E,KAAI,WAAW,KACb;AAEF,UAAS;AACT,MAAK,MAAM,YAAY,CAAC,GAAG,UAAU,CACnC,WAAU;;AAId,SAAgB,0BAA0B,UAAkC;AAC1E,WAAU,IAAI,SAAS;AACvB,cAAa;AACX,YAAU,OAAO,SAAS","debug_id":"3d461450-bb34-5169-9062-77a7f5e78a09"}
|
|
@@ -1,17 +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]="
|
|
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]="dd09aa35-96e8-5cd7-aeb9-b38ff1321623")}catch(e){}}();
|
|
3
3
|
import { r as loadRuntimeConfig, t as applyConnectBranding } from "./runtime-config-DL3QjcfM.js";
|
|
4
|
-
import { t as ReloadConnectToast } from "./reload-connect-toast-
|
|
5
|
-
import { t as package_default } from "./package-
|
|
6
|
-
import { r as connectConfig } from "./connect.config-
|
|
7
|
-
import { a as detectReactorPgMajor, i as detectMigrationMajor } from "./connection-state-
|
|
8
|
-
import { n as seedPendingPgVersion } from "./pglite-seed-
|
|
9
|
-
import { n as createReactor } from "./reactor-
|
|
4
|
+
import { r as setUser, t as ReloadConnectToast } from "./reload-connect-toast-D1Iqw9E_.js";
|
|
5
|
+
import { t as package_default } from "./package-Do80N5uy.js";
|
|
6
|
+
import { r as connectConfig } from "./connect.config-p8UTNojR.js";
|
|
7
|
+
import { a as detectReactorPgMajor, i as detectMigrationMajor } from "./connection-state-B7b2E8-L.js";
|
|
8
|
+
import { n as seedPendingPgVersion } from "./pglite-seed-OvaK2kRv.js";
|
|
9
|
+
import { n as createReactor } from "./reactor-ozZgs2eJ.js";
|
|
10
10
|
import { n as toast } from "./toast-4t-VimvD.js";
|
|
11
11
|
import { createElement, useEffect } from "react";
|
|
12
12
|
import { initTheme, useUser } from "@powerhousedao/reactor-browser";
|
|
13
13
|
import { logger } from "document-model";
|
|
14
|
-
import { setUser } from "@sentry/react";
|
|
15
14
|
//#region src/hooks/useCheckLatestVersion.ts
|
|
16
15
|
const useCheckLatestVersion = () => {
|
|
17
16
|
async function checkLatestVersion() {
|
|
@@ -97,5 +96,5 @@ async function loadComponent(localPackage) {
|
|
|
97
96
|
//#endregion
|
|
98
97
|
export { loadComponent };
|
|
99
98
|
|
|
100
|
-
//# sourceMappingURL=load-
|
|
101
|
-
//# debugId=
|
|
99
|
+
//# sourceMappingURL=load-C0qmCc_V.js.map
|
|
100
|
+
//# debugId=dd09aa35-96e8-5cd7-aeb9-b38ff1321623
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"load-C0qmCc_V.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 { 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-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,SAAgB,mBAAmB;CACjC,MAAM,OAAO,SAAS;AACtB,iBAAgB;EACd,IAAI,aAAgC;AACpC,MAAI,MAAM;GAER,MAAM,EAAE,YAAY,aAAa,GAAG,SAAS;AAC7C,gBAAa;IAAE,IAAI,KAAK;IAAK,UAAU,KAAK,KAAK;IAAM,GAAG;IAAM;;AAElE,UAAc,WAAW;IACxB,CAAC,KAAK,CAAC;;;;ACFZ,eAAsB,cAAc,cAAiC;AACnE,OAAM,sBAAsB;AAC5B,OAAM,QAAQ,IAAI,CAAC,sBAAsB,EAAE,sBAAsB,CAAC,CAAC;AAEnE,sBADsB,MAAM,mBAAmB,CACZ;AACnC,OAAM,cAAc,aAAa;AACjC,QAAO,EACL,UAAU,EAAE,eAAyC;AACnD,aAAW;AAEX,oBAAkB;AAElB,yBAAuB;AACvB,SAAO;IAEV","debug_id":"dd09aa35-96e8-5cd7-aeb9-b38ff1321623"}
|
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-BoTn1LSc.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]="f08a51ef-3fc6-5783-8479-298ba1051484")}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.52",
|
|
8
8
|
description: "Powerhouse Connect",
|
|
9
9
|
main: "dist/index.html",
|
|
10
10
|
type: "module",
|
|
@@ -123,5 +123,5 @@ var package_default = {
|
|
|
123
123
|
//#endregion
|
|
124
124
|
export { package_default as t };
|
|
125
125
|
|
|
126
|
-
//# sourceMappingURL=package-
|
|
127
|
-
//# debugId=
|
|
126
|
+
//# sourceMappingURL=package-Do80N5uy.js.map
|
|
127
|
+
//# debugId=f08a51ef-3fc6-5783-8479-298ba1051484
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"package-Do80N5uy.js","sources":["../package.json"],"sourcesContent":[""],"names":[],"mappings":"","debug_id":"f08a51ef-3fc6-5783-8479-298ba1051484"}
|
|
@@ -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 {
|
|
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]="11c77bd1-2c04-5eab-bf51-4e4936587aea")}catch(e){}}();
|
|
3
|
+
import { c as invalidateReactorPgMajorCache, p as REACTOR_PGLITE_NAME } from "./connection-state-B7b2E8-L.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-OvaK2kRv.js.map
|
|
49
|
+
//# debugId=11c77bd1-2c04-5eab-bf51-4e4936587aea
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pglite-seed-
|
|
1
|
+
{"version":3,"file":"pglite-seed-OvaK2kRv.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":"11c77bd1-2c04-5eab-bf51-4e4936587aea"}
|
|
@@ -1,10 +1,10 @@
|
|
|
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]="a96f3e1f-2f54-5c26-ae66-e9c2009a7ef6")}catch(e){}}();
|
|
3
3
|
import { n as getRuntimeConfig } from "./runtime-config-DL3QjcfM.js";
|
|
4
4
|
import { a as resolvePgMajorForRuntime, r as loadPGliteModule } from "./pglite-major-B39aOEiE.js";
|
|
5
|
-
import { r as getVersion, t as getGitSha } from "./build-info-
|
|
6
|
-
import { n as buildPHGlobalConfig, o as phGlobalConfig } from "./connect.config-
|
|
7
|
-
import { a as detectReactorPgMajor,
|
|
5
|
+
import { r as getVersion, t as getGitSha } from "./build-info-CrFlT7e6.js";
|
|
6
|
+
import { n as buildPHGlobalConfig, o as phGlobalConfig } from "./connect.config-p8UTNojR.js";
|
|
7
|
+
import { a as detectReactorPgMajor, f as REACTOR_INSTANCE_NAMESPACE, m as RELATIONAL_PGLITE_NAME, n as setWorkerConnectionStatus, p as REACTOR_PGLITE_NAME } from "./connection-state-B7b2E8-L.js";
|
|
8
8
|
import { n as toast } from "./toast-4t-VimvD.js";
|
|
9
9
|
import { createRelationalDb } from "@powerhousedao/shared/processors";
|
|
10
10
|
import { DocumentModelRegistry, DocumentModelResolver, ReactorEventTypes } from "@powerhousedao/reactor";
|
|
@@ -20,6 +20,37 @@ import * as common from "@powerhousedao/powerhouse-vetra-packages";
|
|
|
20
20
|
import commonPkg from "@powerhousedao/powerhouse-vetra-packages/package.json" with { type: "json" };
|
|
21
21
|
import * as vetra from "@powerhousedao/vetra";
|
|
22
22
|
import vetraPkg from "@powerhousedao/vetra/package.json" with { type: "json" };
|
|
23
|
+
//#region src/pglite.db.ts
|
|
24
|
+
async function createMainThreadPGlite(major) {
|
|
25
|
+
const { PGlite } = await loadPGliteModule(major);
|
|
26
|
+
const { live } = major === 16 ? await import("pglite-legacy-02/live") : await import("@electric-sql/pglite/live");
|
|
27
|
+
return new PGlite(`idb://${REACTOR_PGLITE_NAME}`, {
|
|
28
|
+
relaxedDurability: true,
|
|
29
|
+
extensions: { live }
|
|
30
|
+
});
|
|
31
|
+
}
|
|
32
|
+
let sharedPGlite;
|
|
33
|
+
function getSharedPGlite() {
|
|
34
|
+
if (sharedPGlite) return sharedPGlite;
|
|
35
|
+
const pending = (async () => {
|
|
36
|
+
const major = resolvePgMajorForRuntime(await detectReactorPgMajor());
|
|
37
|
+
if (major !== 17) console.warn(`[reactor] Opening legacy Postgres ${major} data dir. Migrate to PG17 from the banner or the Inspector → Debug tab.`);
|
|
38
|
+
return createMainThreadPGlite(major);
|
|
39
|
+
})();
|
|
40
|
+
sharedPGlite = pending;
|
|
41
|
+
pending.catch(() => {
|
|
42
|
+
if (sharedPGlite === pending) sharedPGlite = void 0;
|
|
43
|
+
});
|
|
44
|
+
return pending;
|
|
45
|
+
}
|
|
46
|
+
async function getDb() {
|
|
47
|
+
const pgLite = await getSharedPGlite();
|
|
48
|
+
return {
|
|
49
|
+
pgLite,
|
|
50
|
+
relationalDb: createRelationalDb(new Kysely({ dialect: new PGliteDialect(pgLite) }))
|
|
51
|
+
};
|
|
52
|
+
}
|
|
53
|
+
//#endregion
|
|
23
54
|
//#region src/utils/reactor.ts
|
|
24
55
|
/**
|
|
25
56
|
* Creates a Reactor that plugs into legacy storage but syncs through the new
|
|
@@ -34,10 +65,7 @@ async function createBrowserReactor(documentModelModules, upgradeManifests, reno
|
|
|
34
65
|
if (!renown.user) return;
|
|
35
66
|
return renown.getBearerToken({ expiresIn: 10 });
|
|
36
67
|
};
|
|
37
|
-
const
|
|
38
|
-
if (major !== 17) console.warn(`[reactor] Running against legacy PGlite data dir (Postgres ${major}). Migrate to PG17 from the banner or the Inspector → Debug tab.`);
|
|
39
|
-
const { PGlite } = await loadPGliteModule(major);
|
|
40
|
-
const pg = new PGlite(`idb://${REACTOR_PGLITE_NAME}`, { relaxedDurability: true });
|
|
68
|
+
const pg = await getSharedPGlite();
|
|
41
69
|
const logger = new ConsoleLogger(["reactor-client"]);
|
|
42
70
|
const builder = new ReactorClientBuilder$1().withLogger(logger).withSigner(signerConfig).withReactorBuilder(new ReactorBuilder$1().withDocumentModels(documentModelModules).withUpgradeManifests(upgradeManifests).withChannelScheme(ChannelScheme$1.CONNECT).withJwtHandler(jwtHandler).withKysely(new Kysely({ dialect: new PGliteDialect(pg) })));
|
|
43
71
|
if (documentModelLoader) builder.withDocumentModelLoader(documentModelLoader);
|
|
@@ -426,6 +454,10 @@ var PackageDiscoveryService = class {
|
|
|
426
454
|
} catch {}
|
|
427
455
|
}
|
|
428
456
|
async #discover(documentType) {
|
|
457
|
+
if (typeof navigator !== "undefined" && navigator.onLine === false) {
|
|
458
|
+
this.#recordFailure(documentType, "offline", [], null);
|
|
459
|
+
return Promise.reject(/* @__PURE__ */ new Error(`Offline: cannot discover document type "${documentType}"`));
|
|
460
|
+
}
|
|
429
461
|
let packageNames;
|
|
430
462
|
try {
|
|
431
463
|
packageNames = await this.#registryClient.getPackagesByDocumentType(documentType);
|
|
@@ -940,34 +972,6 @@ function parseFlag(value) {
|
|
|
940
972
|
if (normalized === "false" || normalized === "0") return false;
|
|
941
973
|
}
|
|
942
974
|
//#endregion
|
|
943
|
-
//#region src/pglite.db.ts
|
|
944
|
-
async function createPGliteWorkerForMajor(major) {
|
|
945
|
-
const meta = { dbName: RELATIONAL_PGLITE_NAME };
|
|
946
|
-
if (major === 16) {
|
|
947
|
-
const [legacyWorker, legacyLive] = await Promise.all([import("pglite-legacy-02/worker"), import("pglite-legacy-02/live")]);
|
|
948
|
-
const worker = new Worker(new URL("./pglite.worker.legacy.js", import.meta.url), { type: "module" });
|
|
949
|
-
return legacyWorker.PGliteWorker.create(worker, {
|
|
950
|
-
meta,
|
|
951
|
-
extensions: { live: legacyLive.live }
|
|
952
|
-
});
|
|
953
|
-
}
|
|
954
|
-
const [{ PGliteWorker }, { live }] = await Promise.all([import("@electric-sql/pglite/worker"), import("@electric-sql/pglite/live")]);
|
|
955
|
-
const worker = new Worker(new URL("./pglite.worker.js", import.meta.url), { type: "module" });
|
|
956
|
-
return PGliteWorker.create(worker, {
|
|
957
|
-
meta,
|
|
958
|
-
extensions: { live }
|
|
959
|
-
});
|
|
960
|
-
}
|
|
961
|
-
async function getDb() {
|
|
962
|
-
const major = resolvePgMajorForRuntime(await detectRelationalPgMajor());
|
|
963
|
-
if (major !== 17) console.warn(`[reactor] Relational worker is opening legacy Postgres ${major} data dir. Migrate to PG17 from the banner or the Inspector → Debug tab.`);
|
|
964
|
-
const pgLite = await createPGliteWorkerForMajor(major);
|
|
965
|
-
return {
|
|
966
|
-
pgLite,
|
|
967
|
-
relationalDb: createRelationalDb(new Kysely({ dialect: new PGliteDialect(pgLite) }))
|
|
968
|
-
};
|
|
969
|
-
}
|
|
970
|
-
//#endregion
|
|
971
975
|
//#region src/store/processor-host-module.ts
|
|
972
976
|
var NullAttachmentService = class {
|
|
973
977
|
reserve() {
|
|
@@ -1252,5 +1256,5 @@ function getDriveUrl() {
|
|
|
1252
1256
|
//#endregion
|
|
1253
1257
|
export { createReactor as n, clearReactorStorage as t };
|
|
1254
1258
|
|
|
1255
|
-
//# sourceMappingURL=reactor-
|
|
1256
|
-
//# debugId=
|
|
1259
|
+
//# sourceMappingURL=reactor-ozZgs2eJ.js.map
|
|
1260
|
+
//# debugId=a96f3e1f-2f54-5c26-ae66-e9c2009a7ef6
|