@powerhousedao/connect 6.2.3-dev.76 → 6.2.3-dev.78
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-BoF649HH.js → ClearStorageModal-Bv3yx3XD.js} +4 -4
- package/dist/{ClearStorageModal-BoF649HH.js.map → ClearStorageModal-Bv3yx3XD.js.map} +1 -1
- package/dist/{DebugSettingsModal-CKYdzHg3.js → DebugSettingsModal-DBCbplSU.js} +4 -4
- package/dist/{DebugSettingsModal-CKYdzHg3.js.map → DebugSettingsModal-DBCbplSU.js.map} +1 -1
- package/dist/{InspectorModal-B-CpFjkk.js → InspectorModal-C16IuKy9.js} +4 -4
- package/dist/{InspectorModal-B-CpFjkk.js.map → InspectorModal-C16IuKy9.js.map} +1 -1
- package/dist/{OpenFileDocumentsModal-B9c-CsKT.js → OpenFileDocumentsModal-DJsC1oR1.js} +10 -6
- package/dist/OpenFileDocumentsModal-DJsC1oR1.js.map +1 -0
- package/dist/{app-loader-CmhLUvkl.js → app-loader-BoL6R1vN.js} +7 -7
- package/dist/{app-loader-CmhLUvkl.js.map → app-loader-BoL6R1vN.js.map} +1 -1
- package/dist/app-loader-RoYImvm2.js +4 -0
- package/dist/app-skeleton-CPjpFScH.js +4 -0
- package/dist/{app-skeleton-ClRUYLE_.js → app-skeleton-WGKR7IBB.js} +17 -6
- package/dist/app-skeleton-WGKR7IBB.js.map +1 -0
- package/dist/{boot-DFAA5MSo.js → boot-CSPFrYcp.js} +5 -5
- package/dist/{boot-DFAA5MSo.js.map → boot-CSPFrYcp.js.map} +1 -1
- package/dist/{build-info-CLUgn9BD.js → build-info-DUlEdYeT.js} +5 -5
- package/dist/{build-info-CLUgn9BD.js.map → build-info-DUlEdYeT.js.map} +1 -1
- package/dist/{components-FreYm0r0.js → components-DnF3Nq24.js} +7 -7
- package/dist/{components-FreYm0r0.js.map → components-DnF3Nq24.js.map} +1 -1
- package/dist/generic.js +1 -1
- package/dist/{load-DjfJv058.js → load-DtN7O04V.js} +6 -6
- package/dist/{load-DjfJv058.js.map → load-DtN7O04V.js.map} +1 -1
- package/dist/{load-runtime-config-BF0w1ZDg.js → load-runtime-config-BpLOOkva.js} +4 -4
- package/dist/{load-runtime-config-BF0w1ZDg.js.map → load-runtime-config-BpLOOkva.js.map} +1 -1
- package/dist/main.js +2 -2
- package/dist/{package-manager-KIBOxb_u.js → package-manager-DYaxrAmr.js} +6 -6
- package/dist/{package-manager-KIBOxb_u.js.map → package-manager-DYaxrAmr.js.map} +1 -1
- package/dist/{plugins-D-wbWV2q.js → plugins-D3BJDmsQ.js} +4 -4
- package/dist/{plugins-D-wbWV2q.js.map → plugins-D3BJDmsQ.js.map} +1 -1
- package/dist/prerender.d.ts.map +1 -1
- package/dist/prerender.js +23 -16
- package/dist/prerender.js.map +1 -1
- package/dist/{reactor-CiSse3hi.js → reactor-CZLsF9Jy.js} +23 -13
- package/dist/reactor-CZLsF9Jy.js.map +1 -0
- package/dist/route-tree.js +1 -1
- package/dist/{route-views-D_873yb_.js → route-views-C84NRBou.js} +3 -3
- package/dist/{route-views-DmmQ1DzX.js → route-views-CKBivPxe.js} +4 -4
- package/dist/{route-views-DmmQ1DzX.js.map → route-views-CKBivPxe.js.map} +1 -1
- package/dist/{route-views-2aB1ZZPP.js → route-views-zHuBM6Nq.js} +4 -4
- package/dist/{route-views-2aB1ZZPP.js.map → route-views-zHuBM6Nq.js.map} +1 -1
- package/dist/route-views.js +3 -3
- package/dist/{router-DXpaaTeR.js → router-9jEQB-nr.js} +4 -4
- package/dist/{router-DXpaaTeR.js.map → router-9jEQB-nr.js.map} +1 -1
- package/dist/router-D8NyXlh0.js +4 -0
- package/dist/{settings-DuFReMb1.js → settings-F-qoymK-.js} +6 -6
- package/dist/{settings-DuFReMb1.js.map → settings-F-qoymK-.js.map} +1 -1
- package/dist/{settings-tabs-DNVwbelT.js → settings-tabs-QyWk0HzI.js} +4 -4
- package/dist/{settings-tabs-DNVwbelT.js.map → settings-tabs-QyWk0HzI.js.map} +1 -1
- package/dist/start-connect.js +2 -2
- package/dist/{ui-BOWaqYlz.js → ui-vaMYxGL2.js} +7 -7
- package/dist/{ui-BOWaqYlz.js.map → ui-vaMYxGL2.js.map} +1 -1
- package/package.json +16 -16
- package/dist/OpenFileDocumentsModal-B9c-CsKT.js.map +0 -1
- package/dist/app-loader-DjQ2opEo.js +0 -4
- package/dist/app-skeleton-BHgmbYld.js +0 -4
- package/dist/app-skeleton-ClRUYLE_.js.map +0 -1
- package/dist/reactor-CiSse3hi.js.map +0 -1
- package/dist/router-CBzb5FUq.js +0 -4
|
@@ -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]="a76c5f39-bea0-5bc4-889a-67ea4624d60d")}catch(e){}}();
|
|
3
3
|
import { a as genericConfigSchema, i as openPanelConfigSchema, n as vetraStudioConfigSchema, o as assistantConfigSchema, r as sentryConfigSchema, t as workflowsConnectConfigSchema } from "./workflows-C3qEvx1R.js";
|
|
4
4
|
import { DEFAULT_CONNECT_CONFIG } from "@powerhousedao/shared/connect";
|
|
5
5
|
import { z } from "zod";
|
|
@@ -182,7 +182,7 @@ const driveSectionOff = {
|
|
|
182
182
|
const connectPlugins = {
|
|
183
183
|
[GENERIC_PLUGIN]: {
|
|
184
184
|
create: createGenericPlugin,
|
|
185
|
-
ui: () => import("./ui-
|
|
185
|
+
ui: () => import("./ui-vaMYxGL2.js").then((m) => m.default),
|
|
186
186
|
shell: "generic",
|
|
187
187
|
whenAbsent: (config) => ({
|
|
188
188
|
...config,
|
|
@@ -259,5 +259,5 @@ const connectPlugins = {
|
|
|
259
259
|
//#endregion
|
|
260
260
|
export { connectPlugins };
|
|
261
261
|
|
|
262
|
-
//# sourceMappingURL=plugins-
|
|
263
|
-
//# debugId=
|
|
262
|
+
//# sourceMappingURL=plugins-D3BJDmsQ.js.map
|
|
263
|
+
//# debugId=a76c5f39-bea0-5bc4-889a-67ea4624d60d
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"plugins-D-wbWV2q.js","sources":["../src/plugins/entry-config.ts","../src/plugins/assistant.ts","../src/plugins/generic.ts","../src/plugins/openpanel.ts","../src/plugins/sentry.ts","../src/plugins/ids.ts","../src/plugins/vetra-studio.ts","../src/plugins/workflows.ts","../src/plugins/index.ts"],"sourcesContent":["import { PluginError } from \"@powerhousedao/host-core/plugins\";\nimport { z } from \"zod\";\n\n/**\n * Validate a built-in plugin's entry config against its configSchema, the way\n * host-core's resolveHostPlugins does on the server: a failure names the\n * plugin and every offending key instead of surfacing a bare ZodError from\n * the runtime-config load.\n */\nexport function parseEntryConfig<S extends z.ZodType>(\n specifier: string,\n schema: S,\n rawConfig: unknown,\n): z.output<S> {\n const parsed = schema.safeParse(rawConfig);\n if (!parsed.success) {\n throw new PluginError(\n `config for Connect plugin \"${specifier}\" is invalid:\\n` +\n z.prettifyError(parsed.error),\n `Fix the entry's config in the host's runner.plugins.`,\n );\n }\n return parsed.data;\n}\n","import type { PHConnectRuntimeConfig } from \"@powerhousedao/shared/clis\";\nimport type {\n ConnectPlugin,\n ConnectPluginFactory,\n} from \"@powerhousedao/connect-core/plugins\";\nimport { parseEntryConfig } from \"./entry-config.js\";\nimport {\n assistantConfigSchema,\n type AssistantConfigInput,\n} from \"../plugin-configs/assistant.js\";\n\n/**\n * The Connect AI assistant (`@powerhousedao/connect/plugins/assistant`).\n * Presence flips `ai.assistantEnabled` on; absence forces it off. The\n * assistant FAB in app.tsx already renders on `ai.assistantEnabled`, so this\n * plugin's config shuffle is immediately visible in the UI.\n *\n * It takes no entry config: `ai.assistantEnabled` is the only key of the\n * `connect.ai` slice, and presence is that switch. The endpoint and agent are\n * user settings in the browser, not host config.\n */\n\n// Schema and PHPluginConfigs augmentation: ../plugin-configs (zod-only).\nexport { assistantConfigSchema, type AssistantConfigInput };\n\nexport const createAssistantPlugin: ConnectPluginFactory = (rawConfig) => {\n parseEntryConfig(\n \"@powerhousedao/connect/plugins/assistant\",\n assistantConfigSchema,\n rawConfig,\n );\n const plugin: ConnectPlugin = {\n name: \"connect-assistant\",\n appliesTo: \"connect\",\n configSchema: assistantConfigSchema,\n hooks: {\n transformConnectConfig(served: PHConnectRuntimeConfig) {\n return {\n ...served,\n ai: { ...served.ai, assistantEnabled: true },\n };\n },\n },\n };\n return plugin;\n};\n\nexport default createAssistantPlugin;\n","import { DEFAULT_CONNECT_CONFIG } from \"@powerhousedao/shared/connect\";\nimport type {\n PHBackground,\n PHConnectExplorerIcons,\n PHConnectRuntimeConfig,\n} from \"@powerhousedao/shared/clis\";\nimport type {\n ConnectPlugin,\n ConnectPluginFactory,\n} from \"@powerhousedao/connect-core/plugins\";\nimport { parseEntryConfig } from \"./entry-config.js\";\nimport {\n genericConfigSchema,\n type GenericConfig,\n type GenericConfigInput,\n} from \"../plugin-configs/generic.js\";\n\n/**\n * The generic Connect shell plugin (`@powerhousedao/connect/plugins/generic`).\n *\n * It OWNS the drive-chrome UI toggles — `allowAddDrive` and the per-section\n * `sections.{remote,local}` switches (enabled / allowAdd / allowDelete) —\n * the explorer's `icons` (local/remote drive fallbacks, folder, document and\n * per-type document icons, which override the icons a package ships) and the\n * home screen's `homeBackground` (its layers over a page colour). These\n * describe nothing outside the generic chrome (connect.config.ts reads the\n * toggles to decide whether the add-drive affordance and the drive sections\n * render; the explorer components read the icons; the home screen is the\n * chrome's landing page), so under uniform runners they are configured HERE,\n * through this plugin's entry config, not as free-standing top-level\n * connect.drives / connect.home values:\n *\n * - present + entry provides a value -> that value\n * - present + entry omits it -> inherit DEFAULT_CONNECT_CONFIG\n * - absent from the composition -> zeroed off (see its whenAbsent\n * in ./index.ts — no chrome, no\n * toggles)\n *\n * The top-level served value is deliberately NOT a fallback: ownership means a\n * single source. `branding` is intentionally NOT handled here — it has reach\n * beyond the chrome (e.g. document.title), so it stays a Connect-level config\n * value that survives this plugin's absence.\n *\n * Icons and background images are image refs; a project path in host.js is\n * resolved to a data URI by the Connect build before the composition reaches\n * the browser, a URL or data URI passes through (the only forms for config\n * applied after the build). `null` keeps the built-in icon / gradient.\n */\n\n// Schema and PHPluginConfigs augmentation: ../plugin-configs (zod-only).\nexport { genericConfigSchema, type GenericConfig, type GenericConfigInput };\n\nconst DEFAULT_DRIVES = DEFAULT_CONNECT_CONFIG.drives;\nconst DEFAULT_HOME = DEFAULT_CONNECT_CONFIG.home;\n\nexport const createGenericPlugin: ConnectPluginFactory = (rawConfig) => {\n const config: GenericConfig = parseEntryConfig(\n \"@powerhousedao/connect/plugins/generic\",\n genericConfigSchema,\n rawConfig,\n );\n const plugin: ConnectPlugin = {\n name: \"connect-generic\",\n appliesTo: \"connect\",\n configSchema: genericConfigSchema,\n hooks: {\n transformConnectConfig(served: PHConnectRuntimeConfig) {\n const entrySections = config.sections ?? {};\n return {\n ...served,\n drives: {\n ...served.drives,\n // Owned: entry value, else the single-source default — never the\n // served top-level value.\n allowAddDrive:\n config.allowAddDrive ?? DEFAULT_DRIVES?.allowAddDrive,\n sections: {\n remote: {\n ...DEFAULT_DRIVES?.sections?.remote,\n ...entrySections.remote,\n },\n local: {\n ...DEFAULT_DRIVES?.sections?.local,\n ...entrySections.local,\n },\n },\n // Owned: the entry's icons (already resolved by the build), else\n // the default — the built-in icons.\n icons: (config.icons ?? null) as PHConnectExplorerIcons | null,\n } as never,\n home: {\n ...served.home,\n // Owned: the entry's background (images resolved by the build),\n // else the default — the bundled gradient.\n background: (config.homeBackground ??\n DEFAULT_HOME?.background ??\n null) as PHBackground | null,\n },\n };\n },\n },\n };\n return plugin;\n};\n\nexport default createGenericPlugin;\n","import type { PHConnectRuntimeConfig } from \"@powerhousedao/shared/clis\";\nimport type {\n ConnectPlugin,\n ConnectPluginFactory,\n} from \"@powerhousedao/connect-core/plugins\";\nimport { parseEntryConfig } from \"./entry-config.js\";\nimport {\n openPanelConfigSchema,\n type OpenPanelConfigInput,\n} from \"../plugin-configs/openpanel.js\";\n\n/**\n * OpenPanel analytics (`@powerhousedao/connect/plugins/openpanel`). Presence\n * is activation: the entry config (clientId, trackUiEvents, trackOperations)\n * merges into the served `openPanel` block; absence clears the clientId and\n * turns tracking off. Config shuffle today; the Analytics/OpenPanel\n * components that consume it already live in the app tree.\n *\n * The entry config IS the `connect.openPanel` slice, so it is typed and\n * validated by that slice's single-source schema (a typo'd key fails).\n */\n\n// Schema and PHPluginConfigs augmentation: ../plugin-configs (zod-only).\nexport { openPanelConfigSchema, type OpenPanelConfigInput };\n\nexport const createOpenPanelPlugin: ConnectPluginFactory = (rawConfig) => {\n const config = parseEntryConfig(\n \"@powerhousedao/connect/plugins/openpanel\",\n openPanelConfigSchema,\n rawConfig,\n );\n const plugin: ConnectPlugin = {\n name: \"connect-openpanel\",\n appliesTo: \"connect\",\n configSchema: openPanelConfigSchema,\n hooks: {\n transformConnectConfig(served: PHConnectRuntimeConfig) {\n return {\n ...served,\n openPanel: { ...served.openPanel, ...config } as never,\n };\n },\n },\n };\n return plugin;\n};\n\nexport default createOpenPanelPlugin;\n","import type { PHConnectRuntimeConfig } from \"@powerhousedao/shared/clis\";\nimport type {\n ConnectPlugin,\n ConnectPluginFactory,\n} from \"@powerhousedao/connect-core/plugins\";\nimport { parseEntryConfig } from \"./entry-config.js\";\nimport {\n sentryConfigSchema,\n type SentryConfigInput,\n} from \"../plugin-configs/sentry.js\";\n\n/**\n * Sentry error reporting (`@powerhousedao/connect/plugins/sentry`). Presence\n * is activation: listing it merges the entry config (dsn, env, tracing) into\n * the served `sentry` block; omitting it nulls the dsn (see the absence\n * zeroing in plugin-host). A thin config shuffle today — the SentryProvider\n * that reads this slice already exists in the app.\n *\n * The entry config IS the `connect.sentry` slice, so it is typed and\n * validated by that slice's single-source schema (a typo'd key fails).\n */\n\n// Schema and PHPluginConfigs augmentation: ../plugin-configs (zod-only).\nexport { sentryConfigSchema, type SentryConfigInput };\n\nexport const createSentryPlugin: ConnectPluginFactory = (rawConfig) => {\n const config = parseEntryConfig(\n \"@powerhousedao/connect/plugins/sentry\",\n sentryConfigSchema,\n rawConfig,\n );\n const plugin: ConnectPlugin = {\n name: \"connect-sentry\",\n appliesTo: \"connect\",\n configSchema: sentryConfigSchema,\n hooks: {\n transformConnectConfig(served: PHConnectRuntimeConfig) {\n return {\n ...served,\n sentry: { ...served.sentry, ...config } as never,\n };\n },\n },\n };\n return plugin;\n};\n\nexport default createSentryPlugin;\n","/** The generic shell: Connect's sidebar, home screen and settings tabs. */\nexport const GENERIC_PLUGIN = \"@powerhousedao/connect/plugins/generic\";\n","import type { PHConnectRuntimeConfig } from \"@powerhousedao/shared/clis\";\nimport type {\n ConnectPlugin,\n ConnectPluginFactory,\n} from \"@powerhousedao/connect-core/plugins\";\nimport { parseEntryConfig } from \"./entry-config.js\";\nimport {\n vetraStudioConfigSchema,\n type VetraStudioConfigInput,\n} from \"../plugin-configs/vetra-studio.js\";\n\n/**\n * Vetra Studio, browser side (`@powerhousedao/vetra-studio/connect`). Its\n * presence turns Connect's studio mode on; the classic `app.studioMode`\n * consumer paths run unchanged, and absence forces studio off (the zeroing in\n * plugin-host). Lives here, in Connect's own source, because the studio-mode\n * behaviour is Connect browser behaviour — the published vetra-studio/connect\n * module is only the server-resolvable identity of the same plugin.\n *\n * It takes no entry config: presence is the switch, and the rest of the\n * `connect.app` slice is Connect-level config, not this plugin's.\n */\n\n// Schema and PHPluginConfigs augmentation: ../plugin-configs (zod-only).\nexport { vetraStudioConfigSchema, type VetraStudioConfigInput };\n\nexport const createVetraStudioPlugin: ConnectPluginFactory = (rawConfig) => {\n parseEntryConfig(\n \"@powerhousedao/vetra-studio/connect\",\n vetraStudioConfigSchema,\n rawConfig,\n );\n const plugin: ConnectPlugin = {\n name: \"vetra-studio-connect\",\n appliesTo: \"connect\",\n configSchema: vetraStudioConfigSchema,\n hooks: {\n transformConnectConfig(served: PHConnectRuntimeConfig) {\n return {\n ...served,\n app: { ...served.app, studioMode: true },\n };\n },\n },\n };\n return plugin;\n};\n\nexport default createVetraStudioPlugin;\n","import { findToken } from \"@powerhousedao/host-core/schema\";\nimport type {\n PHConnectDefaultDrive,\n PHConnectRuntimeConfig,\n} from \"@powerhousedao/shared/clis\";\nimport type {\n ConnectPlugin,\n ConnectPluginFactory,\n} from \"@powerhousedao/connect-core/plugins\";\nimport { parseEntryConfig } from \"./entry-config.js\";\nimport {\n workflowsConnectConfigSchema,\n type WorkflowsConnectConfig,\n type WorkflowsConnectConfigInput,\n} from \"../plugin-configs/workflows.js\";\n\n/**\n * The workflows plugin, browser side (`@powerhousedao/connect/plugins/\n * workflows`) — the Connect half of the link whose server half is\n * `@powerhousedao/switchboard/plugins/workflows` (workflow-plugins plan).\n *\n * Presence is activation: listed, Connect loads the workflow package (so\n * Workflow Studio, the drive app the Workflows drive names as its preferred\n * editor, exists) and attaches the configured drive as a remote default\n * drive. Absent from a declared composition, `app.workflowsEnabled` is zeroed\n * (its whenAbsent in ./index.ts) — the classic `workflows.enabled` /\n * `connect.app.workflowsEnabled` values stop being the switch.\n *\n * `drive` is the switchboard's drive URL (`http://host:port/d/<slug>`). The\n * drive has to be a REMOTE of the switchboard that runs the workflow runtime:\n * Workflow Studio reaches that runtime through the selected drive's\n * switchboard, so a local copy would render the studio against the wrong\n * endpoint. Host files write it as the output token\n * `switchboard.drives.workflows.url`; `ph run` resolves it (from the\n * compound's live member or the switchboard's run record) before this\n * config reaches the browser.\n */\n\n// Schema and PHPluginConfigs augmentation: ../plugin-configs (zod-only).\nexport {\n workflowsConnectConfigSchema,\n type WorkflowsConnectConfig,\n type WorkflowsConnectConfigInput,\n};\n\nconst LOG = \"[connect:plugins:workflows]\";\n\nfunction withDrive(\n drives: PHConnectDefaultDrive[] | undefined,\n url: string,\n name: string | undefined,\n): PHConnectDefaultDrive[] {\n const existing = drives ?? [];\n if (existing.some((drive) => \"url\" in drive && drive.url === url)) {\n return existing;\n }\n return [...existing, { url, name: name ?? null, icon: null }];\n}\n\nexport const createWorkflowsPlugin: ConnectPluginFactory = (rawConfig) => {\n const config: WorkflowsConnectConfig = parseEntryConfig(\n \"@powerhousedao/connect/plugins/workflows\",\n workflowsConnectConfigSchema,\n rawConfig,\n );\n const plugin: ConnectPlugin = {\n name: \"connect-workflows\",\n appliesTo: \"connect\",\n configSchema: workflowsConnectConfigSchema,\n hooks: {\n transformConnectConfig(served: PHConnectRuntimeConfig) {\n const out: PHConnectRuntimeConfig = {\n ...served,\n app: { ...served.app, workflowsEnabled: true } as never,\n };\n const drive = config.drive;\n if (typeof drive === \"string\") {\n out.drives = {\n ...served.drives,\n defaultDrives: withDrive(\n served.drives?.defaultDrives,\n drive,\n config.name,\n ),\n } as never;\n } else if (drive !== undefined) {\n console.warn(\n `${LOG} drive is an unresolved output token (${findToken(drive)?.key ?? \"unknown\"}); no Workflows drive attached.`,\n );\n }\n return out;\n },\n },\n };\n return plugin;\n};\n\nexport default createWorkflowsPlugin;\n","import type { ConnectPluginDefinition } from \"@powerhousedao/connect-core/plugins\";\nimport createAssistantPlugin from \"./assistant.js\";\nimport createGenericPlugin from \"./generic.js\";\nimport createOpenPanelPlugin from \"./openpanel.js\";\nimport createSentryPlugin from \"./sentry.js\";\nimport { GENERIC_PLUGIN } from \"./ids.js\";\nimport createVetraStudioPlugin from \"./vetra-studio.js\";\nimport createWorkflowsPlugin from \"./workflows.js\";\n\nexport { GENERIC_PLUGIN };\n\n// Sentry and OpenPanel start only once the viewer accepts analytics cookies.\nconst ANALYTICS_CONSENT = { consent: true };\n\n// Each built-in zeroes the config slice it owns when a composition leaves it out.\nconst driveSectionOff = { enabled: false, allowAdd: false, allowDelete: false };\n\n/** Connect's built-in plugins, by the specifier a composition names. */\nexport const connectPlugins: Record<string, ConnectPluginDefinition> = {\n [GENERIC_PLUGIN]: {\n create: createGenericPlugin,\n ui: () => import(\"../generic/ui.js\").then((m) => m.default),\n shell: \"generic\",\n // The drive-chrome toggles, explorer icons and home screen go: no\n // add-drive affordance, the sections off, built-in icons, no home\n // background. Branding is not zeroed: it is Connect-level and outlives\n // the plugin.\n whenAbsent: (config) => ({\n ...config,\n drives: {\n ...config.drives,\n allowAddDrive: false,\n sections: { remote: driveSectionOff, local: driveSectionOff },\n icons: null,\n } as never,\n home: { ...config.home, background: null } as never,\n }),\n },\n \"@powerhousedao/connect/plugins/sentry\": {\n create: createSentryPlugin,\n ui: () => Promise.resolve(ANALYTICS_CONSENT),\n whenAbsent: (config) => ({\n ...config,\n sentry: { ...config.sentry, dsn: null } as never,\n }),\n },\n \"@powerhousedao/connect/plugins/openpanel\": {\n create: createOpenPanelPlugin,\n ui: () => Promise.resolve(ANALYTICS_CONSENT),\n whenAbsent: (config) => ({\n ...config,\n openPanel: {\n ...config.openPanel,\n clientId: \"\",\n trackUiEvents: false,\n trackOperations: false,\n } as never,\n }),\n },\n \"@powerhousedao/connect/plugins/assistant\": {\n create: createAssistantPlugin,\n whenAbsent: (config) => ({\n ...config,\n ai: { ...config.ai, assistantEnabled: false } as never,\n }),\n },\n \"@powerhousedao/connect/plugins/workflows\": {\n create: createWorkflowsPlugin,\n // The workflow package (Workflow Studio) loads only when the plugin is\n // composed in; the classic workflows.enabled value is not the switch.\n whenAbsent: (config) => ({\n ...config,\n app: { ...config.app, workflowsEnabled: false } as never,\n }),\n },\n \"@powerhousedao/vetra-studio/connect\": {\n create: createVetraStudioPlugin,\n whenAbsent: (config) => ({\n ...config,\n app: { ...config.app, studioMode: false } as never,\n }),\n },\n};\n"],"names":[],"mappings":";;;;;;;;;;;;;;AASA,SAAgB,iBACd,WACA,QACA,WACa;CACb,MAAM,SAAS,OAAO,UA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AO;EACT,EACF;CAEU;AACd;;;ACnFA,MAAM,oBAAoB,EAAE,SAAS,KAAK;AAG1C,MAAM,kBAAkB;CAAE,SAAS;CAAO,UAAU;CAAO,aAAa;AAAM;;AAG9E,MAAa,iBAA0D;EACpE,iBAAiB;EAChB,QAAQ;EACR,UAAU,OAAO,mBAAmB,CAAC,MAAM,MAAM,EAAE,OAAO;EAC1D,OAAO;EAKP,aAAa,YAAY;GACvB,GAAG;GACH,QAAQ;IACN,GAAG,OAAO;IACV,eAAe;IACf,UAAU;KAAE,QAAQ;KAAiB,OAAO;IAAgB;IAC5D,OAAO;GACT;GACA,MAAM;IAAE,GAAG,OAAO;IAAM,YAAY;GAAK;EAC3C;CACF;CACA,yCAAyC;EACvC,QAAQ;EACR,UAAU,QAAQ,QAAQ,iBAAiB;EAC3C,aAAa,YAAY;GACvB,GAAG;GACH,QAAQ;IAAE,GAAG,OAAO;IAAQ,KAAK;GAAK;EACxC;CACF;CACA,4CAA4C;EAC1C,QAAQ;EACR,UAAU,QAAQ,QAAQ,iBAAiB;EAC3C,aAAa,YAAY;GACvB,GAAG;GACH,WAAW;IACT,GAAG,OAAO;IACV,UAAU;IACV,eAAe;IACf,iBAAiB;GACnB;EACF;CACF;CACA,4CAA4C;EAC1C,QAAQ;EACR,aAAa,YAAY;GACvB,GAAG;GACH,IAAI;IAAE,GAAG,OAAO;IAAI,kBAAkB;GAAM;EAC9C;CACF;CACA,4CAA4C;EAC1C,QAAQ;EAGR,aAAa,YAAY;GACvB,GAAG;GACH,KAAK;IAAE,GAAG,OAAO;IAAK,kBAAkB;GAAM;EAChD;CACF;CACA,uCAAuC;EACrC,QAAQ;EACR,aAAa,YAAY;GACvB,GAAG;GACH,KAAK;IAAE,GAAG,OAAO;IAAK,YAAY;GAAM;EAC1C;CACF;AACF","debug_id":"2bf49e85-0548-5c43-a001-2f84e08c0307"}
|
|
1
|
+
{"version":3,"file":"plugins-D3BJDmsQ.js","sources":["../src/plugins/entry-config.ts","../src/plugins/assistant.ts","../src/plugins/generic.ts","../src/plugins/openpanel.ts","../src/plugins/sentry.ts","../src/plugins/ids.ts","../src/plugins/vetra-studio.ts","../src/plugins/workflows.ts","../src/plugins/index.ts"],"sourcesContent":["import { PluginError } from \"@powerhousedao/host-core/plugins\";\nimport { z } from \"zod\";\n\n/**\n * Validate a built-in plugin's entry config against its configSchema, the way\n * host-core's resolveHostPlugins does on the server: a failure names the\n * plugin and every offending key instead of surfacing a bare ZodError from\n * the runtime-config load.\n */\nexport function parseEntryConfig<S extends z.ZodType>(\n specifier: string,\n schema: S,\n rawConfig: unknown,\n): z.output<S> {\n const parsed = schema.safeParse(rawConfig);\n if (!parsed.success) {\n throw new PluginError(\n `config for Connect plugin \"${specifier}\" is invalid:\\n` +\n z.prettifyError(parsed.error),\n `Fix the entry's config in the host's runner.plugins.`,\n );\n }\n return parsed.data;\n}\n","import type { PHConnectRuntimeConfig } from \"@powerhousedao/shared/clis\";\nimport type {\n ConnectPlugin,\n ConnectPluginFactory,\n} from \"@powerhousedao/connect-core/plugins\";\nimport { parseEntryConfig } from \"./entry-config.js\";\nimport {\n assistantConfigSchema,\n type AssistantConfigInput,\n} from \"../plugin-configs/assistant.js\";\n\n/**\n * The Connect AI assistant (`@powerhousedao/connect/plugins/assistant`).\n * Presence flips `ai.assistantEnabled` on; absence forces it off. The\n * assistant FAB in app.tsx already renders on `ai.assistantEnabled`, so this\n * plugin's config shuffle is immediately visible in the UI.\n *\n * It takes no entry config: `ai.assistantEnabled` is the only key of the\n * `connect.ai` slice, and presence is that switch. The endpoint and agent are\n * user settings in the browser, not host config.\n */\n\n// Schema and PHPluginConfigs augmentation: ../plugin-configs (zod-only).\nexport { assistantConfigSchema, type AssistantConfigInput };\n\nexport const createAssistantPlugin: ConnectPluginFactory = (rawConfig) => {\n parseEntryConfig(\n \"@powerhousedao/connect/plugins/assistant\",\n assistantConfigSchema,\n rawConfig,\n );\n const plugin: ConnectPlugin = {\n name: \"connect-assistant\",\n appliesTo: \"connect\",\n configSchema: assistantConfigSchema,\n hooks: {\n transformConnectConfig(served: PHConnectRuntimeConfig) {\n return {\n ...served,\n ai: { ...served.ai, assistantEnabled: true },\n };\n },\n },\n };\n return plugin;\n};\n\nexport default createAssistantPlugin;\n","import { DEFAULT_CONNECT_CONFIG } from \"@powerhousedao/shared/connect\";\nimport type {\n PHBackground,\n PHConnectExplorerIcons,\n PHConnectRuntimeConfig,\n} from \"@powerhousedao/shared/clis\";\nimport type {\n ConnectPlugin,\n ConnectPluginFactory,\n} from \"@powerhousedao/connect-core/plugins\";\nimport { parseEntryConfig } from \"./entry-config.js\";\nimport {\n genericConfigSchema,\n type GenericConfig,\n type GenericConfigInput,\n} from \"../plugin-configs/generic.js\";\n\n/**\n * The generic Connect shell plugin (`@powerhousedao/connect/plugins/generic`).\n *\n * It OWNS the drive-chrome UI toggles — `allowAddDrive` and the per-section\n * `sections.{remote,local}` switches (enabled / allowAdd / allowDelete) —\n * the explorer's `icons` (local/remote drive fallbacks, folder, document and\n * per-type document icons, which override the icons a package ships) and the\n * home screen's `homeBackground` (its layers over a page colour). These\n * describe nothing outside the generic chrome (connect.config.ts reads the\n * toggles to decide whether the add-drive affordance and the drive sections\n * render; the explorer components read the icons; the home screen is the\n * chrome's landing page), so under uniform runners they are configured HERE,\n * through this plugin's entry config, not as free-standing top-level\n * connect.drives / connect.home values:\n *\n * - present + entry provides a value -> that value\n * - present + entry omits it -> inherit DEFAULT_CONNECT_CONFIG\n * - absent from the composition -> zeroed off (see its whenAbsent\n * in ./index.ts — no chrome, no\n * toggles)\n *\n * The top-level served value is deliberately NOT a fallback: ownership means a\n * single source. `branding` is intentionally NOT handled here — it has reach\n * beyond the chrome (e.g. document.title), so it stays a Connect-level config\n * value that survives this plugin's absence.\n *\n * Icons and background images are image refs; a project path in host.js is\n * resolved to a data URI by the Connect build before the composition reaches\n * the browser, a URL or data URI passes through (the only forms for config\n * applied after the build). `null` keeps the built-in icon / gradient.\n */\n\n// Schema and PHPluginConfigs augmentation: ../plugin-configs (zod-only).\nexport { genericConfigSchema, type GenericConfig, type GenericConfigInput };\n\nconst DEFAULT_DRIVES = DEFAULT_CONNECT_CONFIG.drives;\nconst DEFAULT_HOME = DEFAULT_CONNECT_CONFIG.home;\n\nexport const createGenericPlugin: ConnectPluginFactory = (rawConfig) => {\n const config: GenericConfig = parseEntryConfig(\n \"@powerhousedao/connect/plugins/generic\",\n genericConfigSchema,\n rawConfig,\n );\n const plugin: ConnectPlugin = {\n name: \"connect-generic\",\n appliesTo: \"connect\",\n configSchema: genericConfigSchema,\n hooks: {\n transformConnectConfig(served: PHConnectRuntimeConfig) {\n const entrySections = config.sections ?? {};\n return {\n ...served,\n drives: {\n ...served.drives,\n // Owned: entry value, else the single-source default — never the\n // served top-level value.\n allowAddDrive:\n config.allowAddDrive ?? DEFAULT_DRIVES?.allowAddDrive,\n sections: {\n remote: {\n ...DEFAULT_DRIVES?.sections?.remote,\n ...entrySections.remote,\n },\n local: {\n ...DEFAULT_DRIVES?.sections?.local,\n ...entrySections.local,\n },\n },\n // Owned: the entry's icons (already resolved by the build), else\n // the default — the built-in icons.\n icons: (config.icons ?? null) as PHConnectExplorerIcons | null,\n } as never,\n home: {\n ...served.home,\n // Owned: the entry's background (images resolved by the build),\n // else the default — the bundled gradient.\n background: (config.homeBackground ??\n DEFAULT_HOME?.background ??\n null) as PHBackground | null,\n },\n };\n },\n },\n };\n return plugin;\n};\n\nexport default createGenericPlugin;\n","import type { PHConnectRuntimeConfig } from \"@powerhousedao/shared/clis\";\nimport type {\n ConnectPlugin,\n ConnectPluginFactory,\n} from \"@powerhousedao/connect-core/plugins\";\nimport { parseEntryConfig } from \"./entry-config.js\";\nimport {\n openPanelConfigSchema,\n type OpenPanelConfigInput,\n} from \"../plugin-configs/openpanel.js\";\n\n/**\n * OpenPanel analytics (`@powerhousedao/connect/plugins/openpanel`). Presence\n * is activation: the entry config (clientId, trackUiEvents, trackOperations)\n * merges into the served `openPanel` block; absence clears the clientId and\n * turns tracking off. Config shuffle today; the Analytics/OpenPanel\n * components that consume it already live in the app tree.\n *\n * The entry config IS the `connect.openPanel` slice, so it is typed and\n * validated by that slice's single-source schema (a typo'd key fails).\n */\n\n// Schema and PHPluginConfigs augmentation: ../plugin-configs (zod-only).\nexport { openPanelConfigSchema, type OpenPanelConfigInput };\n\nexport const createOpenPanelPlugin: ConnectPluginFactory = (rawConfig) => {\n const config = parseEntryConfig(\n \"@powerhousedao/connect/plugins/openpanel\",\n openPanelConfigSchema,\n rawConfig,\n );\n const plugin: ConnectPlugin = {\n name: \"connect-openpanel\",\n appliesTo: \"connect\",\n configSchema: openPanelConfigSchema,\n hooks: {\n transformConnectConfig(served: PHConnectRuntimeConfig) {\n return {\n ...served,\n openPanel: { ...served.openPanel, ...config } as never,\n };\n },\n },\n };\n return plugin;\n};\n\nexport default createOpenPanelPlugin;\n","import type { PHConnectRuntimeConfig } from \"@powerhousedao/shared/clis\";\nimport type {\n ConnectPlugin,\n ConnectPluginFactory,\n} from \"@powerhousedao/connect-core/plugins\";\nimport { parseEntryConfig } from \"./entry-config.js\";\nimport {\n sentryConfigSchema,\n type SentryConfigInput,\n} from \"../plugin-configs/sentry.js\";\n\n/**\n * Sentry error reporting (`@powerhousedao/connect/plugins/sentry`). Presence\n * is activation: listing it merges the entry config (dsn, env, tracing) into\n * the served `sentry` block; omitting it nulls the dsn (see the absence\n * zeroing in plugin-host). A thin config shuffle today — the SentryProvider\n * that reads this slice already exists in the app.\n *\n * The entry config IS the `connect.sentry` slice, so it is typed and\n * validated by that slice's single-source schema (a typo'd key fails).\n */\n\n// Schema and PHPluginConfigs augmentation: ../plugin-configs (zod-only).\nexport { sentryConfigSchema, type SentryConfigInput };\n\nexport const createSentryPlugin: ConnectPluginFactory = (rawConfig) => {\n const config = parseEntryConfig(\n \"@powerhousedao/connect/plugins/sentry\",\n sentryConfigSchema,\n rawConfig,\n );\n const plugin: ConnectPlugin = {\n name: \"connect-sentry\",\n appliesTo: \"connect\",\n configSchema: sentryConfigSchema,\n hooks: {\n transformConnectConfig(served: PHConnectRuntimeConfig) {\n return {\n ...served,\n sentry: { ...served.sentry, ...config } as never,\n };\n },\n },\n };\n return plugin;\n};\n\nexport default createSentryPlugin;\n","/** The generic shell: Connect's sidebar, home screen and settings tabs. */\nexport const GENERIC_PLUGIN = \"@powerhousedao/connect/plugins/generic\";\n","import type { PHConnectRuntimeConfig } from \"@powerhousedao/shared/clis\";\nimport type {\n ConnectPlugin,\n ConnectPluginFactory,\n} from \"@powerhousedao/connect-core/plugins\";\nimport { parseEntryConfig } from \"./entry-config.js\";\nimport {\n vetraStudioConfigSchema,\n type VetraStudioConfigInput,\n} from \"../plugin-configs/vetra-studio.js\";\n\n/**\n * Vetra Studio, browser side (`@powerhousedao/vetra-studio/connect`). Its\n * presence turns Connect's studio mode on; the classic `app.studioMode`\n * consumer paths run unchanged, and absence forces studio off (the zeroing in\n * plugin-host). Lives here, in Connect's own source, because the studio-mode\n * behaviour is Connect browser behaviour — the published vetra-studio/connect\n * module is only the server-resolvable identity of the same plugin.\n *\n * It takes no entry config: presence is the switch, and the rest of the\n * `connect.app` slice is Connect-level config, not this plugin's.\n */\n\n// Schema and PHPluginConfigs augmentation: ../plugin-configs (zod-only).\nexport { vetraStudioConfigSchema, type VetraStudioConfigInput };\n\nexport const createVetraStudioPlugin: ConnectPluginFactory = (rawConfig) => {\n parseEntryConfig(\n \"@powerhousedao/vetra-studio/connect\",\n vetraStudioConfigSchema,\n rawConfig,\n );\n const plugin: ConnectPlugin = {\n name: \"vetra-studio-connect\",\n appliesTo: \"connect\",\n configSchema: vetraStudioConfigSchema,\n hooks: {\n transformConnectConfig(served: PHConnectRuntimeConfig) {\n return {\n ...served,\n app: { ...served.app, studioMode: true },\n };\n },\n },\n };\n return plugin;\n};\n\nexport default createVetraStudioPlugin;\n","import { findToken } from \"@powerhousedao/host-core/schema\";\nimport type {\n PHConnectDefaultDrive,\n PHConnectRuntimeConfig,\n} from \"@powerhousedao/shared/clis\";\nimport type {\n ConnectPlugin,\n ConnectPluginFactory,\n} from \"@powerhousedao/connect-core/plugins\";\nimport { parseEntryConfig } from \"./entry-config.js\";\nimport {\n workflowsConnectConfigSchema,\n type WorkflowsConnectConfig,\n type WorkflowsConnectConfigInput,\n} from \"../plugin-configs/workflows.js\";\n\n/**\n * The workflows plugin, browser side (`@powerhousedao/connect/plugins/\n * workflows`) — the Connect half of the link whose server half is\n * `@powerhousedao/switchboard/plugins/workflows` (workflow-plugins plan).\n *\n * Presence is activation: listed, Connect loads the workflow package (so\n * Workflow Studio, the drive app the Workflows drive names as its preferred\n * editor, exists) and attaches the configured drive as a remote default\n * drive. Absent from a declared composition, `app.workflowsEnabled` is zeroed\n * (its whenAbsent in ./index.ts) — the classic `workflows.enabled` /\n * `connect.app.workflowsEnabled` values stop being the switch.\n *\n * `drive` is the switchboard's drive URL (`http://host:port/d/<slug>`). The\n * drive has to be a REMOTE of the switchboard that runs the workflow runtime:\n * Workflow Studio reaches that runtime through the selected drive's\n * switchboard, so a local copy would render the studio against the wrong\n * endpoint. Host files write it as the output token\n * `switchboard.drives.workflows.url`; `ph run` resolves it (from the\n * compound's live member or the switchboard's run record) before this\n * config reaches the browser.\n */\n\n// Schema and PHPluginConfigs augmentation: ../plugin-configs (zod-only).\nexport {\n workflowsConnectConfigSchema,\n type WorkflowsConnectConfig,\n type WorkflowsConnectConfigInput,\n};\n\nconst LOG = \"[connect:plugins:workflows]\";\n\nfunction withDrive(\n drives: PHConnectDefaultDrive[] | undefined,\n url: string,\n name: string | undefined,\n): PHConnectDefaultDrive[] {\n const existing = drives ?? [];\n if (existing.some((drive) => \"url\" in drive && drive.url === url)) {\n return existing;\n }\n return [...existing, { url, name: name ?? null, icon: null }];\n}\n\nexport const createWorkflowsPlugin: ConnectPluginFactory = (rawConfig) => {\n const config: WorkflowsConnectConfig = parseEntryConfig(\n \"@powerhousedao/connect/plugins/workflows\",\n workflowsConnectConfigSchema,\n rawConfig,\n );\n const plugin: ConnectPlugin = {\n name: \"connect-workflows\",\n appliesTo: \"connect\",\n configSchema: workflowsConnectConfigSchema,\n hooks: {\n transformConnectConfig(served: PHConnectRuntimeConfig) {\n const out: PHConnectRuntimeConfig = {\n ...served,\n app: { ...served.app, workflowsEnabled: true } as never,\n };\n const drive = config.drive;\n if (typeof drive === \"string\") {\n out.drives = {\n ...served.drives,\n defaultDrives: withDrive(\n served.drives?.defaultDrives,\n drive,\n config.name,\n ),\n } as never;\n } else if (drive !== undefined) {\n console.warn(\n `${LOG} drive is an unresolved output token (${findToken(drive)?.key ?? \"unknown\"}); no Workflows drive attached.`,\n );\n }\n return out;\n },\n },\n };\n return plugin;\n};\n\nexport default createWorkflowsPlugin;\n","import type { ConnectPluginDefinition } from \"@powerhousedao/connect-core/plugins\";\nimport createAssistantPlugin from \"./assistant.js\";\nimport createGenericPlugin from \"./generic.js\";\nimport createOpenPanelPlugin from \"./openpanel.js\";\nimport createSentryPlugin from \"./sentry.js\";\nimport { GENERIC_PLUGIN } from \"./ids.js\";\nimport createVetraStudioPlugin from \"./vetra-studio.js\";\nimport createWorkflowsPlugin from \"./workflows.js\";\n\nexport { GENERIC_PLUGIN };\n\n// Sentry and OpenPanel start only once the viewer accepts analytics cookies.\nconst ANALYTICS_CONSENT = { consent: true };\n\n// Each built-in zeroes the config slice it owns when a composition leaves it out.\nconst driveSectionOff = { enabled: false, allowAdd: false, allowDelete: false };\n\n/** Connect's built-in plugins, by the specifier a composition names. */\nexport const connectPlugins: Record<string, ConnectPluginDefinition> = {\n [GENERIC_PLUGIN]: {\n create: createGenericPlugin,\n ui: () => import(\"../generic/ui.js\").then((m) => m.default),\n shell: \"generic\",\n // The drive-chrome toggles, explorer icons and home screen go: no\n // add-drive affordance, the sections off, built-in icons, no home\n // background. Branding is not zeroed: it is Connect-level and outlives\n // the plugin.\n whenAbsent: (config) => ({\n ...config,\n drives: {\n ...config.drives,\n allowAddDrive: false,\n sections: { remote: driveSectionOff, local: driveSectionOff },\n icons: null,\n } as never,\n home: { ...config.home, background: null } as never,\n }),\n },\n \"@powerhousedao/connect/plugins/sentry\": {\n create: createSentryPlugin,\n ui: () => Promise.resolve(ANALYTICS_CONSENT),\n whenAbsent: (config) => ({\n ...config,\n sentry: { ...config.sentry, dsn: null } as never,\n }),\n },\n \"@powerhousedao/connect/plugins/openpanel\": {\n create: createOpenPanelPlugin,\n ui: () => Promise.resolve(ANALYTICS_CONSENT),\n whenAbsent: (config) => ({\n ...config,\n openPanel: {\n ...config.openPanel,\n clientId: \"\",\n trackUiEvents: false,\n trackOperations: false,\n } as never,\n }),\n },\n \"@powerhousedao/connect/plugins/assistant\": {\n create: createAssistantPlugin,\n whenAbsent: (config) => ({\n ...config,\n ai: { ...config.ai, assistantEnabled: false } as never,\n }),\n },\n \"@powerhousedao/connect/plugins/workflows\": {\n create: createWorkflowsPlugin,\n // The workflow package (Workflow Studio) loads only when the plugin is\n // composed in; the classic workflows.enabled value is not the switch.\n whenAbsent: (config) => ({\n ...config,\n app: { ...config.app, workflowsEnabled: false } as never,\n }),\n },\n \"@powerhousedao/vetra-studio/connect\": {\n create: createVetraStudioPlugin,\n whenAbsent: (config) => ({\n ...config,\n app: { ...config.app, studioMode: false } as never,\n }),\n },\n};\n"],"names":[],"mappings":";;;;;;;;;;;;;;AASA,SAAgB,iBACd,WACA,QACA,WACa;CACb,MAAM,SAAS,OAAO,UAAU,SAAS;CACzC,IAAI,CAAC,OAAO,SACV,MAAM,IAAI,YACR,8BAA8B,UAAU,mBACtC,EAAE,cAAc,OAAO,KAAK,GAC9B,sDACF;CAEF,OAAO,OAAO;AAChB;;;ACEA,MAAa,yBAA+C,cAAc;CACxE,iBACE,4CACA,uBACA,SACF;CAcA,OAAO;EAZL,MAAM;EACN,WAAW;EACX,cAAc;EACd,OAAO,EACL,uBAAuB,QAAgC;GACrD,OAAO;IACL,GAAG;IACH,IAAI;KAAE,GAAG,OAAO;KAAI,kBAAkB;IAAK;GAC7C;EACF,EACF;CAEU;AACd;;;ACOA,MAAM,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AAM;IAAE,GAAG,OAAO;IAAM,YAAY;GAAK;EAC3C;CACF;CACA,yCAAyC;EACvC,QAAQ;EACR,UAAU,QAAQ,QAAQ,iBAAiB;EAC3C,aAAa,YAAY;GACvB,GAAG;GACH,QAAQ;IAAE,GAAG,OAAO;IAAQ,KAAK;GAAK;EACxC;CACF;CACA,4CAA4C;EAC1C,QAAQ;EACR,UAAU,QAAQ,QAAQ,iBAAiB;EAC3C,aAAa,YAAY;GACvB,GAAG;GACH,WAAW;IACT,GAAG,OAAO;IACV,UAAU;IACV,eAAe;IACf,iBAAiB;GACnB;EACF;CACF;CACA,4CAA4C;EAC1C,QAAQ;EACR,aAAa,YAAY;GACvB,GAAG;GACH,IAAI;IAAE,GAAG,OAAO;IAAI,kBAAkB;GAAM;EAC9C;CACF;CACA,4CAA4C;EAC1C,QAAQ;EAGR,aAAa,YAAY;GACvB,GAAG;GACH,KAAK;IAAE,GAAG,OAAO;IAAK,kBAAkB;GAAM;EAChD;CACF;CACA,uCAAuC;EACrC,QAAQ;EACR,aAAa,YAAY;GACvB,GAAG;GACH,KAAK;IAAE,GAAG,OAAO;IAAK,YAAY;GAAM;EAC1C;CACF;AACF","debug_id":"a76c5f39-bea0-5bc4-889a-67ea4624d60d"}
|
package/dist/prerender.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"prerender.d.ts","names":[],"sources":["../src/prerender/app-shell.ts","../src/prerender/shell-css.ts","../src/prerender/shell.tsx"],"mappings":";;KAMY;;qBAGC;;;wBA8DG,YAAY;;;wBAYZ,SACd,MAAM,cACN,6BACA,gBACA;EAME;EAGA;;;;;;wBCnEkB,SACpB,eACA,gBACA,eAAiC;;;;wBCUb,gBAAgB,QACpC,QAAQ,OAAO;;YAUL;;;wBAMU,YACpB,UAAS,cACT,OAAM,eACL;;;
|
|
1
|
+
{"version":3,"file":"prerender.d.ts","names":[],"sources":["../src/prerender/app-shell.ts","../src/prerender/shell-css.ts","../src/prerender/shell.tsx"],"mappings":";;KAMY;;qBAGC;;;wBA8DG,YAAY;;;wBAYZ,SACd,MAAM,cACN,6BACA,gBACA;EAME;EAGA;;;;;;wBCnEkB,SACpB,eACA,gBACA,eAAiC;;;;wBCUb,gBAAgB,QACpC,QAAQ,OAAO;;YAUL;;;wBAMU,YACpB,UAAS,cACT,OAAM,eACL;;;wBA2EmB,oBAAoB,oBAAoB,eAAY,QAAA,QAAA,OAAA;EACrB;EAAc"}
|
package/dist/prerender.js
CHANGED
|
@@ -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]="b14c6d0e-8f4f-5f75-be86-cfd57859628f")}catch(e){}}();
|
|
3
3
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
4
4
|
import { primeRuntimeConfig } from "@powerhousedao/connect-core/runtime-config";
|
|
5
5
|
import { PHStoreProvider, createPHStore } from "@powerhousedao/reactor-browser";
|
|
@@ -120,7 +120,7 @@ async function loadDefaultConfig(variant) {
|
|
|
120
120
|
const plugin = (await shellPlugins())[variant];
|
|
121
121
|
await loadConnectPluginUi(plugin ? [{ module: plugin }] : []);
|
|
122
122
|
}
|
|
123
|
-
const connectPlugins = () => import("./plugins-
|
|
123
|
+
const connectPlugins = () => import("./plugins-D3BJDmsQ.js").then((m) => m.connectPlugins);
|
|
124
124
|
/** Each prerendered shell's plugin, whose presence in a composition picks it; core's has none. */
|
|
125
125
|
async function shellPlugins() {
|
|
126
126
|
return Object.fromEntries(Object.entries(await connectPlugins()).flatMap(([module, definition]) => definition.shell ? [[definition.shell, module]] : []));
|
|
@@ -129,10 +129,11 @@ async function shellPlugins() {
|
|
|
129
129
|
* loader: Connect's logo for its chrome, core's spinner otherwise. */
|
|
130
130
|
async function renderShell(variant = "generic", kind = variant) {
|
|
131
131
|
await loadDefaultConfig(variant);
|
|
132
|
-
const [{ routeTree }, { RouterChrome }, routerModule] = await Promise.all([
|
|
132
|
+
const [{ routeTree }, { RouterChrome }, routerModule, skeleton] = await Promise.all([
|
|
133
133
|
import("@powerhousedao/connect/route-tree"),
|
|
134
|
-
import("./route-views-
|
|
135
|
-
import("@powerhousedao/connect-core/router")
|
|
134
|
+
import("./route-views-C84NRBou.js"),
|
|
135
|
+
import("@powerhousedao/connect-core/router"),
|
|
136
|
+
import("./app-skeleton-CPjpFScH.js")
|
|
136
137
|
]);
|
|
137
138
|
const store = createPHStore();
|
|
138
139
|
delete globalThis.__TSR_CACHE__;
|
|
@@ -152,16 +153,22 @@ async function renderShell(variant = "generic", kind = variant) {
|
|
|
152
153
|
const Loader = kind === "generic" ? ShellLoader : kind === "project" && layoutPending ? () => null : CoreShellLoader;
|
|
153
154
|
const errors = [];
|
|
154
155
|
const causes = [];
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
156
|
+
skeleton.setPrerenderingCustomShell(kind === "project");
|
|
157
|
+
let prelude;
|
|
158
|
+
try {
|
|
159
|
+
({prelude} = await prerender(/* @__PURE__ */ jsxs(PHStoreProvider, {
|
|
160
|
+
store,
|
|
161
|
+
children: [/* @__PURE__ */ jsx(RouterProvider, { router: connectRouter.router }), /* @__PURE__ */ jsx(Loader, {})]
|
|
162
|
+
}), {
|
|
163
|
+
progressiveChunkSize: Number.POSITIVE_INFINITY,
|
|
164
|
+
onError: (error, info) => {
|
|
165
|
+
errors.push(error);
|
|
166
|
+
causes.push(describeRenderError(error, info?.componentStack));
|
|
167
|
+
}
|
|
168
|
+
}));
|
|
169
|
+
} finally {
|
|
170
|
+
skeleton.setPrerenderingCustomShell(false);
|
|
171
|
+
}
|
|
165
172
|
resetConnectPluginUi(routeTree);
|
|
166
173
|
if (errors.length) throw new AggregateError(errors, `The app shell failed to prerender:\n${causes.join("\n")}`);
|
|
167
174
|
return await new Response(prelude).text();
|
|
@@ -185,4 +192,4 @@ function describeRenderError(error, componentStack) {
|
|
|
185
192
|
export { APP_NAME_TOKEN, appShell, renderProjectShells, renderShell, shellCss, shellMarkup, shellPlugins };
|
|
186
193
|
|
|
187
194
|
//# sourceMappingURL=prerender.js.map
|
|
188
|
-
//# debugId=
|
|
195
|
+
//# debugId=b14c6d0e-8f4f-5f75-be86-cfd57859628f
|
package/dist/prerender.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"prerender.js","sources":["../src/prerender/app-shell.ts","../src/prerender/shell-css.ts","../src/prerender/shell-loader.tsx","../src/prerender/shell.tsx"],"sourcesContent":["// Turns a rendered shell into what index.html carries: #root's markup and <head>'s CSS.\n\n/** The marker boot.tsx and the project build look for. */\nexport const SHELL_MARKER = \"data-ph-shell\";\n\n/** `generic`: Connect's chrome. `core`: core's views. `project`: a project's routes. */\nexport type AppShellKind = \"generic\" | \"core\" | \"project\";\n\n/** Rendered where the app's name goes. */\nexport const APP_NAME_TOKEN = \"__PH_SHELL_APP_NAME__\";\n\n// The app's name, delimited for the project build to fill in; the default is core's own.\n// Keep in sync with builder-tools' app-shell.ts.\nconst APP_NAME_REGION =\n \"<!--ph-shell:app-name-->Connect<!--/ph-shell:app-name-->\";\n\n// Before first paint: no sidebar in an embed, and the home view hidden off the home path.\nconst GUARD_SCRIPT =\n `(function(){try{var h=document.documentElement;` +\n `var e=new URLSearchParams(location.search).get('embed');` +\n `if(e!==null&&e!=='0'&&e!=='false')h.classList.add('ph-shell-embed');` +\n `var p=location.pathname;` +\n `if(!/\\\\/$/.test(p)||/\\\\/d\\\\//.test(p))h.classList.add('ph-shell-route')` +\n `}catch(x){}})();`;\n\n// The shell renders `/`: off it, its links mark no current page until the app routes.\nconst CURRENT_GUARD_SCRIPT =\n `(function(){if(!document.documentElement.classList.contains('ph-shell-route'))return;` +\n `document.querySelectorAll('[${SHELL_MARKER}] [aria-current]').forEach(function(e){` +\n `e.removeAttribute('aria-current');e.classList.remove('active')})})();`;\n\n// The loader fades in late so fast loads never show it; --ph-shell-t (set when\n// React re-renders the shell) keeps both animations on the navigation's clock.\nconst LOADER_CSS =\n `@keyframes ph-shell-loader-in{from{opacity:0}to{opacity:1}}` +\n `.ph-shell-loader{animation:ph-shell-loader-in .2s ease-in both;animation-delay:calc(.25s + var(--ph-shell-t,0ms))}` +\n `.ph-shell-loader>*{animation-delay:var(--ph-shell-t,0ms)}`;\n\n// The shell renders `/`: off the home path its content view hides until the app routes.\nconst ROUTE_GUARD = `.ph-shell-route [${SHELL_MARKER}] #content-view{visibility:hidden}`;\n\n// Core's header goes in an embed, and its static theme toggle shows the wrong glyph in one theme.\nconst GUARD_CSS: Record<AppShellKind, string> = {\n generic:\n `.ph-shell-embed [${SHELL_MARKER}] #sidebar{display:none}` +\n ROUTE_GUARD +\n LOADER_CSS,\n core:\n `.ph-shell-embed [${SHELL_MARKER}] header{display:none}` +\n `[${SHELL_MARKER}] header button{visibility:hidden}` +\n LOADER_CSS,\n project: ROUTE_GUARD + LOADER_CSS,\n};\n\n// Data-URI images (the login button's PNGs) weigh more than the rest of the\n// shell; a box of their size keeps the layout.\nfunction replaceInlineImages(html: string) {\n return html.replace(/<img\\b[^>]*\\bsrc=\"data:[^\"]*\"[^>]*>/g, (img) => {\n const attr = (name: string) =>\n new RegExp(`\\\\b${name}=\"([^\"]*)\"`).exec(img)?.[1];\n // A hidden variant (e.g. the hover image) needs no box.\n if (/(^| )hidden( |$)/.test(attr(\"class\") ?? \"\")) return \"\";\n const width = attr(\"width\");\n const height = attr(\"height\");\n const size = `${width ? `width:${width}px;` : \"\"}${height ? `height:${height}px;` : \"\"}`;\n return `<span style=\"display:inline-block;${size}\"></span>`;\n });\n}\n\n/** The rendered shell as #root's static markup: no scripts or title, images as\n * boxes, the app's name delimited. */\nexport function shellMarkup(rendered: string) {\n // The router's scroll restoration script is for hydration, and the page keeps\n // its own title until the app's routes set one.\n return replaceInlineImages(\n rendered\n .replace(/<script\\b[^>]*>[\\s\\S]*?<\\/script>/g, \"\")\n .replace(/<title\\b[^>]*>[\\s\\S]*?<\\/title>/g, \"\"),\n ).replaceAll(APP_NAME_TOKEN, APP_NAME_REGION);\n}\n\n/** #root's markup and <head>'s critical CSS (`css`, see shellCss) and guard.\n * `variant` names it for a server that swaps it. */\nexport function appShell(\n kind: AppShellKind,\n variant: \"generic\" | \"core\",\n markup: string,\n css: string,\n) {\n const guard = GUARD_CSS[kind];\n const marker = `${SHELL_MARKER}=\"${variant}\"`;\n return {\n // Inert: clicks and focus wait for the app; a static shell does nothing with them.\n body:\n `<div ${marker} inert style=\"display:contents\">${markup}</div>` +\n `<script ${marker}>${CURRENT_GUARD_SCRIPT}</script>`,\n head:\n `<style ${marker}>${css}${guard}</style>` +\n `<script ${marker}>${GUARD_SCRIPT}</script>`,\n };\n}\n","// The loading screen's CSS: Tailwind builds a stylesheet for just the classes its markup uses.\nimport { compile, optimize } from \"@tailwindcss/node\";\nimport { mkdtempSync, readFileSync, writeFileSync } from \"node:fs\";\nimport { tmpdir } from \"node:os\";\nimport { dirname, join } from \"node:path\";\n\nlet emptyFile: string | undefined;\nconst empty = () => {\n if (!emptyFile) {\n emptyFile = join(mkdtempSync(join(tmpdir(), \"ph-shell-\")), \"empty.css\");\n writeFileSync(emptyFile, \"\");\n }\n return emptyFile;\n};\n\n// Plain third-party CSS stays out: a vendor.css, or another package's stylesheet.\nconst isVendor = (id: string) =>\n id.endsWith(\"/vendor.css\") ||\n !(\n id.startsWith(\".\") ||\n id.startsWith(\"/\") ||\n id.startsWith(\"tailwindcss\") ||\n id.startsWith(\"@powerhousedao/\")\n );\n\nconst CLASS_ATTRIBUTE = /\\sclass=\"([^\"]*)\"/g;\n\n/** `entry`, a Tailwind stylesheet (its text `css` when given), built for the\n * classes in `markup` only: its tokens, reset and rules, without third-party CSS. */\nexport async function shellCss(\n entry: string,\n markup: string,\n css = readFileSync(entry, \"utf8\"),\n) {\n const compiler = await compile(css, {\n base: dirname(entry),\n from: entry,\n onDependency: () => {},\n customCssResolver: (id) =>\n Promise.resolve(isVendor(id) ? empty() : undefined),\n });\n const classes = new Set(\n [...markup.matchAll(CLASS_ATTRIBUTE)].flatMap((m) => m[1].split(/\\s+/)),\n );\n const built = compiler.build([...classes].filter(Boolean));\n return optimize(built, { file: entry, minify: true }).code;\n}\n","import { Icon } from \"@powerhousedao/design-system\";\n\n/** Class of the shell's loader; scripts/prerender-shell.ts fades it in. */\nexport const SHELL_LOADER_CLASS = \"ph-shell-loader\";\n\n// The static shell's \"starting\" state: a pulsing Powerhouse logo, CSS only.\nexport function ShellLoader() {\n return (\n <div\n role=\"status\"\n aria-label=\"Starting Connect\"\n className={`${SHELL_LOADER_CLASS} pointer-events-none fixed inset-0 z-10 flex items-center justify-center`}\n >\n {/* data-ph-loader-slot: a project build swaps this logo for its own\n loader (connect.branding.loader). */}\n <div\n data-ph-loader-slot=\"\"\n className=\"animate-pulse rounded-full bg-background p-4 text-foreground shadow-lg motion-reduce:animate-none\"\n >\n <Icon name=\"ConnectSmall\" size={40} />\n </div>\n </div>\n );\n}\n\n// Core's \"starting\" state: a small neutral spinner, no logo. The project's\n// loader (connect.branding.loader) is Connect-level branding, so a project\n// build swaps the spinner for it here too.\nexport function CoreShellLoader() {\n return (\n <div\n role=\"status\"\n aria-label=\"Starting\"\n className={`${SHELL_LOADER_CLASS} pointer-events-none fixed inset-0 z-10 flex items-center justify-center`}\n >\n <div\n data-ph-loader-slot=\"\"\n className=\"size-5 animate-spin rounded-full border-2 border-core-border border-t-core-muted motion-reduce:animate-none\"\n />\n </div>\n );\n}\n","// Renders the app shell at `/` before the reactor is up; `pnpm build` writes it to dist/shell.html.\nimport { createPHStore, PHStoreProvider } from \"@powerhousedao/reactor-browser\";\nimport type { AnyRoute } from \"@tanstack/react-router\";\nimport { createMemoryHistory, RouterProvider } from \"@tanstack/react-router\";\nimport { prerender } from \"react-dom/static\";\nimport {\n getConnectPluginUi,\n loadConnectPluginUi,\n registerConnectPlugins,\n resetConnectPluginUi,\n} from \"@powerhousedao/connect-core/plugins\";\nimport { primeRuntimeConfig } from \"@powerhousedao/connect-core/runtime-config\";\nimport type { RuntimePowerhouseConfig } from \"@powerhousedao/shared/connect\";\nimport { DEFAULT_CONNECT_CONFIG } from \"@powerhousedao/shared/connect\";\nimport type { AppShellKind } from \"./app-shell.js\";\nimport { APP_NAME_TOKEN, appShell, shellMarkup } from \"./app-shell.js\";\nimport { shellCss } from \"./shell-css.js\";\nimport { CoreShellLoader, ShellLoader } from \"./shell-loader.js\";\n\nexport { appShell, shellCss, shellMarkup };\nexport type { AppShellKind };\n\nasync function loadDefaultConfig(variant: ShellVariant) {\n // The config file is read at runtime; the shell renders Connect's defaults.\n // Not through the config loader: its cache is the realm's, so a dev server's\n // next render would read the variant primed last.\n primeRuntimeConfig({\n connect: {\n ...DEFAULT_CONNECT_CONFIG,\n // Core's shell is the one for a composition without a plugin that has a shell.\n composition: variant === \"core\" ? [] : undefined,\n },\n } as RuntimePowerhouseConfig);\n registerConnectPlugins(connectPlugins);\n const plugin = (await shellPlugins())[variant];\n await loadConnectPluginUi(plugin ? [{ module: plugin }] : []);\n}\n\nconst connectPlugins = () =>\n import(\"../plugins/index.js\").then((m) => m.connectPlugins);\n\n/** Each prerendered shell's plugin, whose presence in a composition picks it; core's has none. */\nexport async function shellPlugins(): Promise<\n Partial<Record<ShellVariant, string>>\n> {\n return Object.fromEntries(\n Object.entries(await connectPlugins()).flatMap(([module, definition]) =>\n definition.shell ? [[definition.shell, module]] : [],\n ),\n );\n}\n\n/** `generic`: Connect's chrome. `core`: core's views, for a composition without the generic plugin. */\nexport type ShellVariant = \"generic\" | \"core\";\n\nexport { APP_NAME_TOKEN };\n\n/** Renders the route tree at `/` before the reactor is up. `kind` picks the\n * loader: Connect's logo for its chrome, core's spinner otherwise. */\nexport async function renderShell(\n variant: ShellVariant = \"generic\",\n kind: AppShellKind = variant,\n): Promise<string> {\n await loadDefaultConfig(variant);\n // After the config: these modules read it as they evaluate.\n const [{ routeTree }, { RouterChrome }, routerModule] = await Promise.all([\n import(\"@powerhousedao/connect/route-tree\"),\n import(\"../components/route-views.js\"),\n import(\"@powerhousedao/connect-core/router\"),\n ]);\n // No reactor and no drives, as the app is until the reactor is up.\n const store = createPHStore();\n // A server router reuses the tree processed for the last variant; plugins' routes change it.\n delete (globalThis as { __TSR_CACHE__?: unknown }).__TSR_CACHE__;\n const connectRouter = routerModule.createConnectRouter({\n routeTree,\n store,\n history: createMemoryHistory({ initialEntries: [\"/\"] }),\n InnerWrap: RouterChrome,\n // The project's name is only known at its build; scripts/prerender-shell.ts marks this.\n appName: APP_NAME_TOKEN,\n // A project's layout shows its pendingComponent in place of the page.\n shell: kind === \"project\",\n pluginUi: getConnectPluginUi(),\n });\n routerModule.bindConnectRouter(connectRouter, store);\n await connectRouter.router.load();\n // A project layout's own pending view is its loader; core's spinner without one.\n const { appRoute } = routerModule.connectRoutes(routeTree as AnyRoute);\n const layoutPending = appRoute.options.pendingComponent;\n const Loader =\n kind === \"generic\"\n ? ShellLoader\n : kind === \"project\" && layoutPending\n ? () => null\n : CoreShellLoader;\n\n const errors: unknown[] = [];\n const causes: string[] = [];\n const { prelude } = await prerender(\n <PHStoreProvider store={store}>\n <RouterProvider router={connectRouter.router} />\n <Loader />\n </PHStoreProvider>,\n {\n // Inline every boundary; outlined ones need React's runtime to reveal.\n progressiveChunkSize: Number.POSITIVE_INFINITY,\n onError: (error, info) => {\n errors.push(error);\n causes.push(describeRenderError(error, info?.componentStack));\n },\n },\n );\n // The next variant renders the tree with its own plugins' UI.\n resetConnectPluginUi(routeTree as AnyRoute);\n // A boundary that errored renders its fallback, which is not the shell.\n if (errors.length) {\n throw new AggregateError(\n errors,\n `The app shell failed to prerender:\\n${causes.join(\"\\n\")}`,\n );\n }\n return await new Response(prelude).text();\n}\n\n/** A project's shells, one per variant: its route tree rendered at `/`, with\n * CSS that `stylesheet`, its Tailwind entry (text `css`), builds for the markup's classes. */\nexport async function renderProjectShells(stylesheet: string, css?: string) {\n const shells: Partial<Record<ShellVariant, { body: string; head: string }>> =\n {};\n for (const variant of [\"generic\", \"core\"] as const) {\n const markup = shellMarkup(await renderShell(variant, \"project\"));\n const shellStyles = await shellCss(stylesheet, markup, css);\n shells[variant] = appShell(\"project\", variant, markup, shellStyles);\n }\n return shells;\n}\n\n// The message and the component it came from: the stack is Connect's own code.\nfunction describeRenderError(error: unknown, componentStack?: string | null) {\n const message = error instanceof Error ? error.message : String(error);\n const component = componentStack?.trim().split(\"\\n\")[0]?.trim();\n return ` - ${message}${component ? ` (${component})` : \"\"}`;\n}\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAGA,MAAa,eAAe;;AAM5B,MAAa,iBAAiB;AAI9B,MAAM,kBACJ;AAGF,MAAM,eACJ;AAQF,MAAM,uBACJ,oHAC+B,aAAa;AAK9C,MAAM,aACJ;AAKF,MAAM,cAAc,oBAAoB,aAAa;AAGrD,MAAM,YAA0C;CAC9C,SACE,oBAAoB,aAAa,4BACjC,cACA;CACF,MACE,oBAAoB,aAAa,yBAC7B,aAAa;CAEnB,SAAS,cAAc;AACzB;AAIA,SAAS,oBAAoB,MAAc;CACzC,OAAO,KAAK,QAAQ,yCAAyC,QAAQ;EACnE,MAAM,QAAQ,SACZ,IAAI,OAAO,MAAM,KAAK,WAAW,CAAC,CAAC,KAAK,GAAG,CAAC,GAAG;EAEjD,IAAI,mBAAmB,KAAK,KAAK,OAAO,KAAK,EAAE,GAAG,OAAO;EACzD,MAAM,QAAQ,KAAK,OAAO;EAC1B,MAAM,SAAS,KAAK,QAAQ;EAE5B,OAAO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AD7B,SAAS,YAAY,QAAQ,GAAG,CACQ;CACpE;CACA,OAAO;AACT;AAGA,SAAS,oBAAoB,OAAgB,gBAAgC;CAC3E,MAAM,UAAU,iBAAiB,QAAQ,MAAM,UAAU,OAAO,KAAK;CACrE,MAAM,YAAY,gBAAgB,KAAK,CAAC,CAAC,MAAM,IAAI,CAAC,CAAC,EAAE,EAAE,KAAK;CAC9D,OAAO,MAAM,UAAU,YAAY,KAAK,UAAU,KAAK;AACzD","debug_id":"305fb767-6f6e-5988-a96a-bf319e034ac6"}
|
|
1
|
+
{"version":3,"file":"prerender.js","sources":["../src/prerender/app-shell.ts","../src/prerender/shell-css.ts","../src/prerender/shell-loader.tsx","../src/prerender/shell.tsx"],"sourcesContent":["// Turns a rendered shell into what index.html carries: #root's markup and <head>'s CSS.\n\n/** The marker boot.tsx and the project build look for. */\nexport const SHELL_MARKER = \"data-ph-shell\";\n\n/** `generic`: Connect's chrome. `core`: core's views. `project`: a project's routes. */\nexport type AppShellKind = \"generic\" | \"core\" | \"project\";\n\n/** Rendered where the app's name goes. */\nexport const APP_NAME_TOKEN = \"__PH_SHELL_APP_NAME__\";\n\n// The app's name, delimited for the project build to fill in; the default is core's own.\n// Keep in sync with builder-tools' app-shell.ts.\nconst APP_NAME_REGION =\n \"<!--ph-shell:app-name-->Connect<!--/ph-shell:app-name-->\";\n\n// Before first paint: no sidebar in an embed, and the home view hidden off the home path.\nconst GUARD_SCRIPT =\n `(function(){try{var h=document.documentElement;` +\n `var e=new URLSearchParams(location.search).get('embed');` +\n `if(e!==null&&e!=='0'&&e!=='false')h.classList.add('ph-shell-embed');` +\n `var p=location.pathname;` +\n `if(!/\\\\/$/.test(p)||/\\\\/d\\\\//.test(p))h.classList.add('ph-shell-route')` +\n `}catch(x){}})();`;\n\n// The shell renders `/`: off it, its links mark no current page until the app routes.\nconst CURRENT_GUARD_SCRIPT =\n `(function(){if(!document.documentElement.classList.contains('ph-shell-route'))return;` +\n `document.querySelectorAll('[${SHELL_MARKER}] [aria-current]').forEach(function(e){` +\n `e.removeAttribute('aria-current');e.classList.remove('active')})})();`;\n\n// The loader fades in late so fast loads never show it; --ph-shell-t (set when\n// React re-renders the shell) keeps both animations on the navigation's clock.\nconst LOADER_CSS =\n `@keyframes ph-shell-loader-in{from{opacity:0}to{opacity:1}}` +\n `.ph-shell-loader{animation:ph-shell-loader-in .2s ease-in both;animation-delay:calc(.25s + var(--ph-shell-t,0ms))}` +\n `.ph-shell-loader>*{animation-delay:var(--ph-shell-t,0ms)}`;\n\n// The shell renders `/`: off the home path its content view hides until the app routes.\nconst ROUTE_GUARD = `.ph-shell-route [${SHELL_MARKER}] #content-view{visibility:hidden}`;\n\n// Core's header goes in an embed, and its static theme toggle shows the wrong glyph in one theme.\nconst GUARD_CSS: Record<AppShellKind, string> = {\n generic:\n `.ph-shell-embed [${SHELL_MARKER}] #sidebar{display:none}` +\n ROUTE_GUARD +\n LOADER_CSS,\n core:\n `.ph-shell-embed [${SHELL_MARKER}] header{display:none}` +\n `[${SHELL_MARKER}] header button{visibility:hidden}` +\n LOADER_CSS,\n project: ROUTE_GUARD + LOADER_CSS,\n};\n\n// Data-URI images (the login button's PNGs) weigh more than the rest of the\n// shell; a box of their size keeps the layout.\nfunction replaceInlineImages(html: string) {\n return html.replace(/<img\\b[^>]*\\bsrc=\"data:[^\"]*\"[^>]*>/g, (img) => {\n const attr = (name: string) =>\n new RegExp(`\\\\b${name}=\"([^\"]*)\"`).exec(img)?.[1];\n // A hidden variant (e.g. the hover image) needs no box.\n if (/(^| )hidden( |$)/.test(attr(\"class\") ?? \"\")) return \"\";\n const width = attr(\"width\");\n const height = attr(\"height\");\n const size = `${width ? `width:${width}px;` : \"\"}${height ? `height:${height}px;` : \"\"}`;\n return `<span style=\"display:inline-block;${size}\"></span>`;\n });\n}\n\n/** The rendered shell as #root's static markup: no scripts or title, images as\n * boxes, the app's name delimited. */\nexport function shellMarkup(rendered: string) {\n // The router's scroll restoration script is for hydration, and the page keeps\n // its own title until the app's routes set one.\n return replaceInlineImages(\n rendered\n .replace(/<script\\b[^>]*>[\\s\\S]*?<\\/script>/g, \"\")\n .replace(/<title\\b[^>]*>[\\s\\S]*?<\\/title>/g, \"\"),\n ).replaceAll(APP_NAME_TOKEN, APP_NAME_REGION);\n}\n\n/** #root's markup and <head>'s critical CSS (`css`, see shellCss) and guard.\n * `variant` names it for a server that swaps it. */\nexport function appShell(\n kind: AppShellKind,\n variant: \"generic\" | \"core\",\n markup: string,\n css: string,\n) {\n const guard = GUARD_CSS[kind];\n const marker = `${SHELL_MARKER}=\"${variant}\"`;\n return {\n // Inert: clicks and focus wait for the app; a static shell does nothing with them.\n body:\n `<div ${marker} inert style=\"display:contents\">${markup}</div>` +\n `<script ${marker}>${CURRENT_GUARD_SCRIPT}</script>`,\n head:\n `<style ${marker}>${css}${guard}</style>` +\n `<script ${marker}>${GUARD_SCRIPT}</script>`,\n };\n}\n","// The loading screen's CSS: Tailwind builds a stylesheet for just the classes its markup uses.\nimport { compile, optimize } from \"@tailwindcss/node\";\nimport { mkdtempSync, readFileSync, writeFileSync } from \"node:fs\";\nimport { tmpdir } from \"node:os\";\nimport { dirname, join } from \"node:path\";\n\nlet emptyFile: string | undefined;\nconst empty = () => {\n if (!emptyFile) {\n emptyFile = join(mkdtempSync(join(tmpdir(), \"ph-shell-\")), \"empty.css\");\n writeFileSync(emptyFile, \"\");\n }\n return emptyFile;\n};\n\n// Plain third-party CSS stays out: a vendor.css, or another package's stylesheet.\nconst isVendor = (id: string) =>\n id.endsWith(\"/vendor.css\") ||\n !(\n id.startsWith(\".\") ||\n id.startsWith(\"/\") ||\n id.startsWith(\"tailwindcss\") ||\n id.startsWith(\"@powerhousedao/\")\n );\n\nconst CLASS_ATTRIBUTE = /\\sclass=\"([^\"]*)\"/g;\n\n/** `entry`, a Tailwind stylesheet (its text `css` when given), built for the\n * classes in `markup` only: its tokens, reset and rules, without third-party CSS. */\nexport async function shellCss(\n entry: string,\n markup: string,\n css = readFileSync(entry, \"utf8\"),\n) {\n const compiler = await compile(css, {\n base: dirname(entry),\n from: entry,\n onDependency: () => {},\n customCssResolver: (id) =>\n Promise.resolve(isVendor(id) ? empty() : undefined),\n });\n const classes = new Set(\n [...markup.matchAll(CLASS_ATTRIBUTE)].flatMap((m) => m[1].split(/\\s+/)),\n );\n const built = compiler.build([...classes].filter(Boolean));\n return optimize(built, { file: entry, minify: true }).code;\n}\n","import { Icon } from \"@powerhousedao/design-system\";\n\n/** Class of the shell's loader; scripts/prerender-shell.ts fades it in. */\nexport const SHELL_LOADER_CLASS = \"ph-shell-loader\";\n\n// The static shell's \"starting\" state: a pulsing Powerhouse logo, CSS only.\nexport function ShellLoader() {\n return (\n <div\n role=\"status\"\n aria-label=\"Starting Connect\"\n className={`${SHELL_LOADER_CLASS} pointer-events-none fixed inset-0 z-10 flex items-center justify-center`}\n >\n {/* data-ph-loader-slot: a project build swaps this logo for its own\n loader (connect.branding.loader). */}\n <div\n data-ph-loader-slot=\"\"\n className=\"animate-pulse rounded-full bg-background p-4 text-foreground shadow-lg motion-reduce:animate-none\"\n >\n <Icon name=\"ConnectSmall\" size={40} />\n </div>\n </div>\n );\n}\n\n// Core's \"starting\" state: a small neutral spinner, no logo. The project's\n// loader (connect.branding.loader) is Connect-level branding, so a project\n// build swaps the spinner for it here too.\nexport function CoreShellLoader() {\n return (\n <div\n role=\"status\"\n aria-label=\"Starting\"\n className={`${SHELL_LOADER_CLASS} pointer-events-none fixed inset-0 z-10 flex items-center justify-center`}\n >\n <div\n data-ph-loader-slot=\"\"\n className=\"size-5 animate-spin rounded-full border-2 border-core-border border-t-core-muted motion-reduce:animate-none\"\n />\n </div>\n );\n}\n","// Renders the app shell at `/` before the reactor is up; `pnpm build` writes it to dist/shell.html.\nimport { createPHStore, PHStoreProvider } from \"@powerhousedao/reactor-browser\";\nimport type { AnyRoute } from \"@tanstack/react-router\";\nimport { createMemoryHistory, RouterProvider } from \"@tanstack/react-router\";\nimport { prerender } from \"react-dom/static\";\nimport {\n getConnectPluginUi,\n loadConnectPluginUi,\n registerConnectPlugins,\n resetConnectPluginUi,\n} from \"@powerhousedao/connect-core/plugins\";\nimport { primeRuntimeConfig } from \"@powerhousedao/connect-core/runtime-config\";\nimport type { RuntimePowerhouseConfig } from \"@powerhousedao/shared/connect\";\nimport { DEFAULT_CONNECT_CONFIG } from \"@powerhousedao/shared/connect\";\nimport type { AppShellKind } from \"./app-shell.js\";\nimport { APP_NAME_TOKEN, appShell, shellMarkup } from \"./app-shell.js\";\nimport { shellCss } from \"./shell-css.js\";\nimport { CoreShellLoader, ShellLoader } from \"./shell-loader.js\";\n\nexport { appShell, shellCss, shellMarkup };\nexport type { AppShellKind };\n\nasync function loadDefaultConfig(variant: ShellVariant) {\n // The config file is read at runtime; the shell renders Connect's defaults.\n // Not through the config loader: its cache is the realm's, so a dev server's\n // next render would read the variant primed last.\n primeRuntimeConfig({\n connect: {\n ...DEFAULT_CONNECT_CONFIG,\n // Core's shell is the one for a composition without a plugin that has a shell.\n composition: variant === \"core\" ? [] : undefined,\n },\n } as RuntimePowerhouseConfig);\n registerConnectPlugins(connectPlugins);\n const plugin = (await shellPlugins())[variant];\n await loadConnectPluginUi(plugin ? [{ module: plugin }] : []);\n}\n\nconst connectPlugins = () =>\n import(\"../plugins/index.js\").then((m) => m.connectPlugins);\n\n/** Each prerendered shell's plugin, whose presence in a composition picks it; core's has none. */\nexport async function shellPlugins(): Promise<\n Partial<Record<ShellVariant, string>>\n> {\n return Object.fromEntries(\n Object.entries(await connectPlugins()).flatMap(([module, definition]) =>\n definition.shell ? [[definition.shell, module]] : [],\n ),\n );\n}\n\n/** `generic`: Connect's chrome. `core`: core's views, for a composition without the generic plugin. */\nexport type ShellVariant = \"generic\" | \"core\";\n\nexport { APP_NAME_TOKEN };\n\n/** Renders the route tree at `/` before the reactor is up. `kind` picks the\n * loader: Connect's logo for its chrome, core's spinner otherwise. */\nexport async function renderShell(\n variant: ShellVariant = \"generic\",\n kind: AppShellKind = variant,\n): Promise<string> {\n await loadDefaultConfig(variant);\n // After the config: these modules read it as they evaluate.\n const [{ routeTree }, { RouterChrome }, routerModule, skeleton] =\n await Promise.all([\n import(\"@powerhousedao/connect/route-tree\"),\n import(\"../components/route-views.js\"),\n import(\"@powerhousedao/connect-core/router\"),\n import(\"../components/app-skeleton.js\"),\n ]);\n // No reactor and no drives, as the app is until the reactor is up.\n const store = createPHStore();\n // A server router reuses the tree processed for the last variant; plugins' routes change it.\n delete (globalThis as { __TSR_CACHE__?: unknown }).__TSR_CACHE__;\n const connectRouter = routerModule.createConnectRouter({\n routeTree,\n store,\n history: createMemoryHistory({ initialEntries: [\"/\"] }),\n InnerWrap: RouterChrome,\n // The project's name is only known at its build; scripts/prerender-shell.ts marks this.\n appName: APP_NAME_TOKEN,\n // A project's layout shows its pendingComponent in place of the page.\n shell: kind === \"project\",\n pluginUi: getConnectPluginUi(),\n });\n routerModule.bindConnectRouter(connectRouter, store);\n await connectRouter.router.load();\n // A project layout's own pending view is its loader; core's spinner without one.\n const { appRoute } = routerModule.connectRoutes(routeTree as AnyRoute);\n const layoutPending = appRoute.options.pendingComponent;\n const Loader =\n kind === \"generic\"\n ? ShellLoader\n : kind === \"project\" && layoutPending\n ? () => null\n : CoreShellLoader;\n\n const errors: unknown[] = [];\n const causes: string[] = [];\n // A project's own layout loads with the loader alone, as the browser's\n // skeleton does once it sees the project's meta tag: not Connect's sidebar.\n skeleton.setPrerenderingCustomShell(kind === \"project\");\n let prelude: ReadableStream<Uint8Array>;\n try {\n ({ prelude } = await prerender(\n <PHStoreProvider store={store}>\n <RouterProvider router={connectRouter.router} />\n <Loader />\n </PHStoreProvider>,\n {\n // Inline every boundary; outlined ones need React's runtime to reveal.\n progressiveChunkSize: Number.POSITIVE_INFINITY,\n onError: (error, info) => {\n errors.push(error);\n causes.push(describeRenderError(error, info?.componentStack));\n },\n },\n ));\n } finally {\n skeleton.setPrerenderingCustomShell(false);\n }\n // The next variant renders the tree with its own plugins' UI.\n resetConnectPluginUi(routeTree as AnyRoute);\n // A boundary that errored renders its fallback, which is not the shell.\n if (errors.length) {\n throw new AggregateError(\n errors,\n `The app shell failed to prerender:\\n${causes.join(\"\\n\")}`,\n );\n }\n return await new Response(prelude).text();\n}\n\n/** A project's shells, one per variant: its route tree rendered at `/`, with\n * CSS that `stylesheet`, its Tailwind entry (text `css`), builds for the markup's classes. */\nexport async function renderProjectShells(stylesheet: string, css?: string) {\n const shells: Partial<Record<ShellVariant, { body: string; head: string }>> =\n {};\n for (const variant of [\"generic\", \"core\"] as const) {\n const markup = shellMarkup(await renderShell(variant, \"project\"));\n const shellStyles = await shellCss(stylesheet, markup, css);\n shells[variant] = appShell(\"project\", variant, markup, shellStyles);\n }\n return shells;\n}\n\n// The message and the component it came from: the stack is Connect's own code.\nfunction describeRenderError(error: unknown, componentStack?: string | null) {\n const message = error instanceof Error ? error.message : String(error);\n const component = componentStack?.trim().split(\"\\n\")[0]?.trim();\n return ` - ${message}${component ? ` (${component})` : \"\"}`;\n}\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAGA,MAAa,eAAe;;AAM5B,MAAa,iBAAiB;AAI9B,MAAM,kBACJ;AAGF,MAAM,eACJ;AAQF,MAAM,uBACJ,oHAC+B,aAAa;AAK9C,MAAM,aACJ;AAKF,MAAM,cAAc,oBAAoB,aAAa;AAGrD,MAAM,YAA0C;CAC9C,SACE,oBAAoB,aAAa,4BACjC,cACA;CACF,MACE,oBAAoB,aAAa,yBAC7B,aAAa;CAEnB,SAAS,cAAc;AACzB;AAIA,SAAS,oBAAoB,MAAc;CACzC,OAAO,KAAK,QAAQ,yCAAyC,QAAQ;EACnE,MAAM,QAAQ,SACZ,IAAI,OAAO,MAAM,KAAK,WAAW,CAAC,CAAC,KAAK,GAAG,CAAC,GAAG;EAEjD,IAAI,mBAAmB,KAAK,KAAK,OAAO,KAAK,EAAE,GAAG,OAAO;EACzD,MAAM,QAAQ,KAAK,OAAO;EAC1B,MAAM,SAAS,KAAK,QAAQ;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W,CAAC,WAAW,MAAM,GAAY;EAClD,MAAM,SAAS,YAAY,MAAM,YAAY,SAAS,SAAS,CAAC;EAEhE,OAAO,WAAW,SAAS,WAAW,SAAS,QAAQ,MAD7B,SAAS,YAAY,QAAQ,GAAG,CACQ;CACpE;CACA,OAAO;AACT;AAGA,SAAS,oBAAoB,OAAgB,gBAAgC;CAC3E,MAAM,UAAU,iBAAiB,QAAQ,MAAM,UAAU,OAAO,KAAK;CACrE,MAAM,YAAY,gBAAgB,KAAK,CAAC,CAAC,MAAM,IAAI,CAAC,CAAC,EAAE,EAAE,KAAK;CAC9D,OAAO,MAAM,UAAU,YAAY,KAAK,UAAU,KAAK;AACzD","debug_id":"b14c6d0e-8f4f-5f75-be86-cfd57859628f"}
|
|
@@ -1,14 +1,14 @@
|
|
|
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]="48a9d370-bf32-5d10-a903-c66afab35272")}catch(e){}}();
|
|
3
3
|
import { n as buildPHGlobalConfig, o as phGlobalConfig, r as connectConfig } from "./connect.config-DL9nKtlW.js";
|
|
4
|
-
import { a as isPackagedConnectDist, i as getVersion, n as getGitSha } from "./build-info-
|
|
5
|
-
import { i as pageSharedImports, r as getSharedDeps, t as BrowserPackageManager } from "./package-manager-
|
|
4
|
+
import { a as isPackagedConnectDist, i as getVersion, n as getGitSha } from "./build-info-DUlEdYeT.js";
|
|
5
|
+
import { i as pageSharedImports, r as getSharedDeps, t as BrowserPackageManager } from "./package-manager-DYaxrAmr.js";
|
|
6
6
|
import { r as toast } from "./toast-C6WW-_O-.js";
|
|
7
7
|
import { a as closeWithin, n as watchStoreLockWait, o as configureConnectChannelScheme, s as createConnectSignerConfig } from "./store-lock-Bi3B9VJD.js";
|
|
8
8
|
import { a as resolvePgMajorForRuntime, f as toStoredDocumentsRefused, r as loadPGliteModule } from "./pglite-major-p4_YefAE.js";
|
|
9
9
|
import { g as RELATIONAL_PGLITE_NAME, h as REACTOR_PGLITE_NAME, m as REACTOR_INSTANCE_NAMESPACE, n as getWorkerConnectionStatus, o as detectReactorPgMajor, r as setWorkerConnectionStatus, s as detectRelationalPgMajor, t as clearStorageHeld } from "./connection-state-Bwm9Agwy.js";
|
|
10
10
|
import { holdConnectRoutes } from "@powerhousedao/connect-core/router";
|
|
11
|
-
import { BrowserLocalStorage, DRIVE_DOCUMENT_TYPES, DocumentCache, DocumentChangeType, ReactorBuilder, ReactorClientBuilder, RegistryClient, addDrive, addPHEventHandlers, addRemoteDrive, createAnalyticsStore, getFullReactorClient, getPHStore, isDriveAuthError, login,
|
|
11
|
+
import { BrowserLocalStorage, DRIVE_DOCUMENT_TYPES, DocumentCache, DocumentChangeType, ReactorBuilder, ReactorClientBuilder, RegistryClient, addDrive, addPHEventHandlers, addRemoteDrive, createAnalyticsStore, createDriveChangeHandler, getFullReactorClient, getPHStore, isDriveAuthError, login, setAttachmentService, setDefaultPHGlobalConfig, setDocumentCache, setDriveMetadata, setDrives, setFeatures, setPGliteDB, setPHToast, setPackageDiscoveryService, setReactorClient, setReactorClientModule, setRenown, setSelectedDrive, setSelectedNode, setVetraPackageManager, trackDriveArrival, untilDriveListed, waitForDocumentReady } from "@powerhousedao/reactor-browser";
|
|
12
12
|
import { ConsoleLogger, logger, setLogLevel as setLogLevel$1 } from "document-model";
|
|
13
13
|
import { getConnectPluginUi } from "@powerhousedao/connect-core/plugins";
|
|
14
14
|
import { createRelationalDb } from "@powerhousedao/shared/processors";
|
|
@@ -284,7 +284,7 @@ async function addLocalDefaultDrive(drive) {
|
|
|
284
284
|
try {
|
|
285
285
|
const reactorClient = getFullReactorClient();
|
|
286
286
|
if (reactorClient) {
|
|
287
|
-
if (await reactorClient.isDocumentIdTaken(drive.id)) return;
|
|
287
|
+
if (await reactorClient.write.isDocumentIdTaken(drive.id)) return;
|
|
288
288
|
}
|
|
289
289
|
await addDrive({
|
|
290
290
|
id: drive.id,
|
|
@@ -858,6 +858,8 @@ function createWorkerReactorClientModule(args) {
|
|
|
858
858
|
args.renown.on("user", (user) => postReactorIdentity(router, toReactorIdentity(user)));
|
|
859
859
|
const reactorClientModule = {
|
|
860
860
|
kind: "worker",
|
|
861
|
+
read: clientProxy.read,
|
|
862
|
+
write: clientProxy.write,
|
|
861
863
|
client: clientProxy,
|
|
862
864
|
adminClient: createWorkerAdminClient(router),
|
|
863
865
|
inspector: createInspectorProxy(router),
|
|
@@ -1120,7 +1122,12 @@ var NullAttachmentService = class {
|
|
|
1120
1122
|
return Promise.reject(/* @__PURE__ */ new Error("NullAttachmentService: no attachment service configured"));
|
|
1121
1123
|
}
|
|
1122
1124
|
};
|
|
1123
|
-
|
|
1125
|
+
/**
|
|
1126
|
+
* Builds the tab's processor host module over the reactor client module:
|
|
1127
|
+
* processors read through its read half and `dispatch` writes through its
|
|
1128
|
+
* write half; the facade stays on `client` for processors not yet moved.
|
|
1129
|
+
*/
|
|
1130
|
+
async function createProcessorHostModule(clients, readModels, attachmentService) {
|
|
1124
1131
|
try {
|
|
1125
1132
|
const { pgLite, relationalDb } = await getDb();
|
|
1126
1133
|
setPGliteDB({
|
|
@@ -1131,7 +1138,9 @@ async function createProcessorHostModule(reactorClient, readModels, attachmentSe
|
|
|
1131
1138
|
const { store: analyticsStore } = await createAnalyticsStore({ pgLite });
|
|
1132
1139
|
return {
|
|
1133
1140
|
...createReactorHostModuleBase({
|
|
1134
|
-
client:
|
|
1141
|
+
client: clients.client,
|
|
1142
|
+
read: clients.read,
|
|
1143
|
+
write: clients.write,
|
|
1135
1144
|
readModels,
|
|
1136
1145
|
relationalDb,
|
|
1137
1146
|
analyticsStore,
|
|
@@ -1401,11 +1410,12 @@ async function createReactor(localPackage, store) {
|
|
|
1401
1410
|
else if (remoteUrl) trackDriveArrival(addRemoteDrive(remoteUrl, void 0).then((driveId) => untilDriveListed(store, driveId))).catch((error) => console.error(`Failed to add remote drive from ${remoteUrl}:`, error));
|
|
1402
1411
|
setDrives(drives);
|
|
1403
1412
|
const reactorClient = appReactorClient;
|
|
1404
|
-
|
|
1413
|
+
const onDriveChange = createDriveChangeHandler(reactorClient.read, { onError: (e) => logger.error("@error", e) });
|
|
1414
|
+
for (const driveType of DRIVE_DOCUMENT_TYPES) reactorClient.read.subscribe({ type: driveType }, (event) => {
|
|
1405
1415
|
logger.verbose("ReactorClient subscription event: @event", event);
|
|
1406
|
-
|
|
1416
|
+
onDriveChange(event);
|
|
1407
1417
|
});
|
|
1408
|
-
reactorClient.subscribe({}, (event) => {
|
|
1418
|
+
reactorClient.read.subscribe({}, (event) => {
|
|
1409
1419
|
closeDeletedSelection(event, {
|
|
1410
1420
|
selectedDriveId: store.selectedDriveId,
|
|
1411
1421
|
selectedNodeId: store.selectedNodeId,
|
|
@@ -1421,7 +1431,7 @@ async function createReactor(localPackage, store) {
|
|
|
1421
1431
|
else if (packagesWithProcessorFactories.length > 0 && !reactorModule) for (const pkg of packagesWithProcessorFactories) logger.warn("Skipping processor factory @name: processors are not supported on the worker reactor path yet", pkg.manifest.name);
|
|
1422
1432
|
else if (packagesWithProcessorFactories.length > 0 && reactorModule && reactorClientModule) {
|
|
1423
1433
|
const readModels = reactorModule.readModelCoordinator.readModels;
|
|
1424
|
-
const processorHostModule = await createProcessorHostModule(reactorClientModule
|
|
1434
|
+
const processorHostModule = await createProcessorHostModule(reactorClientModule, readModels, store.attachmentService);
|
|
1425
1435
|
if (processorHostModule !== void 0) await Promise.all(packagesWithProcessorFactories.map(async (pkg) => {
|
|
1426
1436
|
const { manifest, processorFactory } = pkg;
|
|
1427
1437
|
const name = manifest.name;
|
|
@@ -1448,5 +1458,5 @@ function getDriveUrl() {
|
|
|
1448
1458
|
//#endregion
|
|
1449
1459
|
export { createReactor as n, clearReactorStorage as t };
|
|
1450
1460
|
|
|
1451
|
-
//# sourceMappingURL=reactor-
|
|
1452
|
-
//# debugId=
|
|
1461
|
+
//# sourceMappingURL=reactor-CZLsF9Jy.js.map
|
|
1462
|
+
//# debugId=48a9d370-bf32-5d10-a903-c66afab35272
|