@powerhousedao/ph-run 6.2.3-dev.99 → 6.3.0-dev.2
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/{classic-args-BYccyIIC.mjs → classic-args-BJMDXYLJ.mjs} +11 -5
- package/dist/{classic-args-BYccyIIC.mjs.map → classic-args-BJMDXYLJ.mjs.map} +1 -1
- package/dist/{classic-args-Dm0_3O5p.d.mts → classic-args-BKI4gEVD.d.mts} +4 -2
- package/dist/{classic-args-Dm0_3O5p.d.mts.map → classic-args-BKI4gEVD.d.mts.map} +1 -1
- package/dist/cli.mjs +9 -8
- package/dist/cli.mjs.map +1 -1
- package/dist/{connect-serve-1WAi0KJL.mjs → connect-serve-TZFWyrHe.mjs} +10 -5
- package/dist/connect-serve-TZFWyrHe.mjs.map +1 -0
- package/dist/{connect-serve-COWXf_41.d.mts → connect-serve-kfNeXmO2.d.mts} +5 -2
- package/dist/connect-serve-kfNeXmO2.d.mts.map +1 -0
- package/dist/{member-config-Bs3yOT6y.mjs → member-config-BvlBqovs.mjs} +5 -4
- package/dist/member-config-BvlBqovs.mjs.map +1 -0
- package/dist/observability-CrfdAtHw.mjs +25 -0
- package/dist/observability-CrfdAtHw.mjs.map +1 -0
- package/dist/runner-args-DduJxV1b.mjs +74 -0
- package/dist/runner-args-DduJxV1b.mjs.map +1 -0
- package/dist/runners/connect.d.mts +48 -3
- package/dist/runners/connect.d.mts.map +1 -1
- package/dist/runners/connect.mjs +76 -14
- package/dist/runners/connect.mjs.map +1 -1
- package/dist/runners/member-config.d.mts +30 -0
- package/dist/runners/member-config.d.mts.map +1 -1
- package/dist/runners/member-config.mjs +3 -3
- package/dist/runners/switchboard.d.mts +126 -1
- package/dist/runners/switchboard.d.mts.map +1 -1
- package/dist/runners/switchboard.mjs +96 -13
- package/dist/runners/switchboard.mjs.map +1 -1
- package/dist/services/classic-args.d.mts +2 -2
- package/dist/services/classic-args.mjs +4 -4
- package/dist/services/connect-serve.d.mts +1 -1
- package/dist/services/connect-serve.mjs +3 -3
- package/dist/services/connect-server.d.mts +5 -4
- package/dist/services/connect-server.d.mts.map +1 -1
- package/dist/services/connect-server.mjs +14 -6
- package/dist/services/connect-server.mjs.map +1 -1
- package/dist/services/run/start-run.d.mts +7 -1
- package/dist/services/run/start-run.d.mts.map +1 -1
- package/dist/services/run/start-run.mjs +3 -3
- package/dist/services/switchboard.d.mts +1 -1
- package/dist/{start-run-DWn2cVyi.mjs → start-run-DUfxuOde.mjs} +38 -19
- package/dist/start-run-DUfxuOde.mjs.map +1 -0
- package/dist/superseded-config-bNn_JyUj.mjs +31 -0
- package/dist/superseded-config-bNn_JyUj.mjs.map +1 -0
- package/package.json +7 -7
- package/dist/connect-serve-1WAi0KJL.mjs.map +0 -1
- package/dist/connect-serve-COWXf_41.d.mts.map +0 -1
- package/dist/member-config-Bs3yOT6y.mjs.map +0 -1
- package/dist/start-run-DWn2cVyi.mjs.map +0 -1
- package/dist/superseded-config-CpHrCuNq.mjs +0 -53
- package/dist/superseded-config-CpHrCuNq.mjs.map +0 -1
|
@@ -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]="a8745327-b475-543f-b474-7eefcc3fa87e")}catch(e){}}();
|
|
3
3
|
import { connectPreviewArgs, switchboardArgs } from "@powerhousedao/shared/clis/args";
|
|
4
4
|
import { command, runSafely } from "cmd-ts";
|
|
5
5
|
//#region src/services/classic-args.ts
|
|
@@ -19,7 +19,7 @@ const classicSwitchboard = command({
|
|
|
19
19
|
args: switchboardArgs,
|
|
20
20
|
handler: (args) => args
|
|
21
21
|
});
|
|
22
|
-
command({
|
|
22
|
+
const classicConnectPreview = command({
|
|
23
23
|
name: "preview",
|
|
24
24
|
args: connectPreviewArgs,
|
|
25
25
|
handler: (args) => args
|
|
@@ -29,8 +29,14 @@ async function classicSwitchboardArgs(argv = []) {
|
|
|
29
29
|
if (result._tag === "error") throw new Error(`classic switchboard args did not parse: ${result.error.config.message}`);
|
|
30
30
|
return result.value;
|
|
31
31
|
}
|
|
32
|
+
/** The classic `ph connect preview` argument shape, the same way. */
|
|
33
|
+
async function classicConnectPreviewArgs(argv = []) {
|
|
34
|
+
const result = await runSafely(classicConnectPreview, argv);
|
|
35
|
+
if (result._tag === "error") throw new Error(`classic connect preview args did not parse: ${result.error.config.message}`);
|
|
36
|
+
return result.value;
|
|
37
|
+
}
|
|
32
38
|
//#endregion
|
|
33
|
-
export { classicSwitchboardArgs as t };
|
|
39
|
+
export { classicSwitchboardArgs as n, classicConnectPreviewArgs as t };
|
|
34
40
|
|
|
35
|
-
//# sourceMappingURL=classic-args-
|
|
36
|
-
//# debugId=
|
|
41
|
+
//# sourceMappingURL=classic-args-BJMDXYLJ.mjs.map
|
|
42
|
+
//# debugId=a8745327-b475-543f-b474-7eefcc3fa87e
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"classic-args-
|
|
1
|
+
{"version":3,"file":"classic-args-BJMDXYLJ.mjs","sources":["../src/services/classic-args.ts"],"sourcesContent":["import type { ParsedCmdResult } from \"@powerhousedao/shared/clis\";\nimport {\n connectPreviewArgs,\n switchboardArgs,\n} from \"@powerhousedao/shared/clis/args\";\nimport { command, runSafely } from \"cmd-ts\";\n\n/**\n * The classic `ph switchboard` argument shape, produced by the SAME cmd-ts\n * definitions the classic command parses — not re-derived by hand. A runner\n * starts from this object and overlays only the keys its host file owns, so\n * every key the classic command carries (including the ones it carries as\n * `undefined`, e.g. `dbPath`) reaches the service exactly as it does on the\n * classic path. The uniform-runners switchboard runner once hand-built a\n * partial object that omitted `dbPath`; the service's then-default\n * `.ph/read-model.db` became both the reactor and the read-model PGlite dir —\n * two instances on one PGDATA (see uniform-runners-plan/legacy-parity-rectification.md).\n */\nconst classicSwitchboard = command({\n name: \"switchboard\",\n args: switchboardArgs,\n handler: (args) => args,\n});\n\nconst classicConnectPreview = command({\n name: \"preview\",\n args: connectPreviewArgs,\n handler: (args) => args,\n});\n\nexport type SwitchboardArgs = ParsedCmdResult<typeof classicSwitchboard>;\nexport type ConnectPreviewArgs = ParsedCmdResult<typeof classicConnectPreview>;\n\nexport async function classicSwitchboardArgs(\n argv: string[] = [],\n): Promise<SwitchboardArgs> {\n const result = await runSafely(classicSwitchboard, argv);\n if (result._tag === \"error\") {\n throw new Error(\n `classic switchboard args did not parse: ${result.error.config.message}`,\n );\n }\n return result.value;\n}\n\n/** The classic `ph connect preview` argument shape, the same way. */\nexport async function classicConnectPreviewArgs(\n argv: string[] = [],\n): Promise<ConnectPreviewArgs> {\n const result = await runSafely(classicConnectPreview, argv);\n if (result._tag === \"error\") {\n throw new Error(\n `classic connect preview args did not parse: ${result.error.config.message}`,\n );\n }\n return result.value;\n}\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAkBA,MAAM,qBAAqB,QAAQ;CACjC,MAAM;CACN,MAAM;CACN,UAAU,SAAS;AACrB,CAAC;AAED,MAAM,wBAAwB,QAAQ;CACpC,MAAM;CACN,MAAM;CACN,UAAU,SAAS;AACrB,CAAC;AAKD,eAAsB,uBACpB,OAAiB,CAAC,GACQ;CAC1B,MAAM,SAAS,MAAM,UAAU,oBAAoB,IAAI;CACvD,IAAI,OAAO,SAAS,SAClB,MAAM,IAAI,MACR,2CAA2C,OAAO,MAAM,OAAO,SACjE;CAEF,OAAO,OAAO;AAChB;;AAGA,eAAsB,0BACpB,OAAiB,CAAC,GACW;CAC7B,MAAM,SAAS,MAAM,UAAU,uBAAuB,IAAI;CAC1D,IAAI,OAAO,SAAS,SAClB,MAAM,IAAI,MACR,+CAA+C,OAAO,MAAM,OAAO,SACrE;CAEF,OAAO,OAAO;AAChB","debug_id":"a8745327-b475-543f-b474-7eefcc3fa87e"}
|
|
@@ -188,7 +188,9 @@ declare const classicConnectPreview: Partial<import("cmd-ts/dist/cjs/argparser.j
|
|
|
188
188
|
type SwitchboardArgs = ParsedCmdResult<typeof classicSwitchboard>;
|
|
189
189
|
type ConnectPreviewArgs = ParsedCmdResult<typeof classicConnectPreview>;
|
|
190
190
|
declare function classicSwitchboardArgs(argv?: string[]): Promise<SwitchboardArgs>;
|
|
191
|
+
/** The classic `ph connect preview` argument shape, the same way. */
|
|
192
|
+
declare function classicConnectPreviewArgs(argv?: string[]): Promise<ConnectPreviewArgs>;
|
|
191
193
|
//#endregion
|
|
192
|
-
export { SwitchboardArgs as n,
|
|
194
|
+
export { classicSwitchboardArgs as i, SwitchboardArgs as n, classicConnectPreviewArgs as r, ConnectPreviewArgs as t };
|
|
193
195
|
export {};
|
|
194
|
-
//# sourceMappingURL=classic-args-
|
|
196
|
+
//# sourceMappingURL=classic-args-BKI4gEVD.d.mts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"classic-args-
|
|
1
|
+
{"version":3,"file":"classic-args-BKI4gEVD.d.mts","names":[],"sources":["../src/services/classic-args.ts"],"mappings":";;;;;;;;;;;;;cAkBM,oBAAkB,+CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IAItB,6CAAA,iDAAA,mDAAA;cAEI,uBAAqB,+CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IAIzB,6CAAA,iDAAA,mDAAA;KAEU,kBAAkB,uBAAuB;KACzC,qBAAqB,uBAAuB;iBAElC,uBACpB,kBACC,QAAQ;;iBAWW,0BACpB,kBACC,QAAQ"}
|
package/dist/cli.mjs
CHANGED
|
@@ -1,24 +1,25 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
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]="
|
|
4
|
-
import { t as startRun } from "./start-run-
|
|
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]="817c0983-d2e8-5816-9e98-f01321351283")}catch(e){}}();
|
|
4
|
+
import { t as startRun } from "./start-run-DUfxuOde.mjs";
|
|
5
|
+
import { splitRunArgv } from "@powerhousedao/host-core";
|
|
5
6
|
import { assertNodeVersion } from "@powerhousedao/shared/clis/utils";
|
|
6
7
|
//#region src/cli.ts
|
|
7
8
|
/**
|
|
8
|
-
* `ph-run run <host> [verb]`: what `ph run` does and nothing else `ph` does, so
|
|
9
|
+
* `ph-run run <host> [verb] [runner arguments]`: what `ph run` does and nothing else `ph` does, so
|
|
9
10
|
* a packaged app can run a host with none of the tools that build one. It takes
|
|
10
11
|
* `run` as its first word so a supervisor can start either of the two the same
|
|
11
12
|
* way.
|
|
12
13
|
*/
|
|
13
14
|
async function main(args) {
|
|
14
15
|
assertNodeVersion();
|
|
15
|
-
const
|
|
16
|
-
|
|
17
|
-
if (command !== "run" || !host) throw new Error("Usage: ph-run run <host> [verb] [--debug]");
|
|
16
|
+
const { host, verb, own, argv } = splitRunArgv(args.slice(1));
|
|
17
|
+
if (args[0] !== "run" || !host) throw new Error("Usage: ph-run run <host> [verb] [--debug] [runner arguments]");
|
|
18
18
|
await startRun({
|
|
19
19
|
host,
|
|
20
20
|
verb,
|
|
21
|
-
debug
|
|
21
|
+
debug: own.includes("--debug"),
|
|
22
|
+
argv
|
|
22
23
|
});
|
|
23
24
|
}
|
|
24
25
|
await main(process.argv.slice(2)).catch((error) => {
|
|
@@ -29,4 +30,4 @@ await main(process.argv.slice(2)).catch((error) => {
|
|
|
29
30
|
export {};
|
|
30
31
|
|
|
31
32
|
//# sourceMappingURL=cli.mjs.map
|
|
32
|
-
//# debugId=
|
|
33
|
+
//# debugId=817c0983-d2e8-5816-9e98-f01321351283
|
package/dist/cli.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cli.mjs","sources":["../src/cli.ts"],"sourcesContent":["#!/usr/bin/env node\nimport { assertNodeVersion } from \"@powerhousedao/shared/clis/utils\";\nimport { startRun } from \"./services/run/start-run.js\";\n\n/**\n * `ph-run run <host> [verb]`: what `ph run` does and nothing else `ph` does, so\n * a packaged app can run a host with none of the tools that build one. It takes\n * `run` as its first word so a supervisor can start either of the two the same\n * way.\n */\nasync function main(args: string[]) {\n assertNodeVersion();\n const
|
|
1
|
+
{"version":3,"file":"cli.mjs","sources":["../src/cli.ts"],"sourcesContent":["#!/usr/bin/env node\nimport { splitRunArgv } from \"@powerhousedao/host-core\";\nimport { assertNodeVersion } from \"@powerhousedao/shared/clis/utils\";\nimport { startRun } from \"./services/run/start-run.js\";\n\n/**\n * `ph-run run <host> [verb] [runner arguments]`: what `ph run` does and nothing else `ph` does, so\n * a packaged app can run a host with none of the tools that build one. It takes\n * `run` as its first word so a supervisor can start either of the two the same\n * way.\n */\nasync function main(args: string[]) {\n assertNodeVersion();\n const { host, verb, own, argv } = splitRunArgv(args.slice(1));\n if (args[0] !== \"run\" || !host) {\n throw new Error(\n \"Usage: ph-run run <host> [verb] [--debug] [runner arguments]\",\n );\n }\n await startRun({ host, verb, debug: own.includes(\"--debug\"), argv });\n}\n\nawait main(process.argv.slice(2)).catch((error: unknown) => {\n console.error(error instanceof Error ? error.message : error);\n process.exit(1);\n});\n"],"names":[],"mappings":";;;;;;;;;;;;;AAWA,eAAe,KAAK,MAAgB;CAClC,kBAAkB;CAClB,MAAM,EAAE,MAAM,MAAM,KAAK,SAAS,aAAa,KAAK,MAAM,CAAC,CAAC;CAC5D,IAAI,KAAK,OAAO,SAAS,CAAC,MACxB,MAAM,IAAI,MACR,8DACF;CAEF,MAAM,SAAS;EAAE;EAAM;EAAM,OAAO,IAAI,SAAS,SAAS;EAAG;CAAK,CAAC;AACrE;AAEA,MAAM,KAAK,QAAQ,KAAK,MAAM,CAAC,CAAC,CAAC,CAAC,OAAO,UAAmB;CAC1D,QAAQ,MAAM,iBAAiB,QAAQ,MAAM,UAAU,KAAK;CAC5D,QAAQ,KAAK,CAAC;AAChB,CAAC","debug_id":"817c0983-d2e8-5816-9e98-f01321351283"}
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
|
|
2
|
-
!function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="
|
|
2
|
+
!function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="84da26cc-d907-59bf-9556-240d6940a58f")}catch(e){}}();
|
|
3
|
+
import { defaultConnectComposition } from "@powerhousedao/host-core";
|
|
3
4
|
import { DEFAULT_CONNECT_OUTDIR } from "@powerhousedao/shared/clis";
|
|
5
|
+
import { deepMerge, normalizeBasePath } from "@powerhousedao/shared/connect";
|
|
4
6
|
import { isHtmlNavigation, isSwitchboardProxyPath } from "@powerhousedao/shared/connect/origin-placeholder";
|
|
5
7
|
import path from "node:path";
|
|
6
8
|
import { existsSync, readFileSync } from "node:fs";
|
|
7
9
|
import { getConfig } from "@powerhousedao/config/node";
|
|
8
|
-
import { deepMerge, normalizeBasePath } from "@powerhousedao/shared/connect";
|
|
9
10
|
import { APP_SHELLS_FILE, appShellVariant, appShellVariantOf, readShellPluginsIn, swapAppShell, withShellAppName } from "@powerhousedao/shared/connect/app-shell";
|
|
10
11
|
import sirv from "sirv";
|
|
11
12
|
//#region src/services/connect-serve.ts
|
|
@@ -40,7 +41,11 @@ function overrideFromEnv(env = process.env) {
|
|
|
40
41
|
function mergedConfigBody(outDir, override) {
|
|
41
42
|
const file = path.join(outDir, "powerhouse.config.json");
|
|
42
43
|
const baked = existsSync(file) ? JSON.parse(readFileSync(file, "utf8")) : {};
|
|
43
|
-
const
|
|
44
|
+
const merged = override.connect ? deepMerge(baked.connect ?? {}, override.connect) : baked.connect;
|
|
45
|
+
const connect = override.defaultComposition && !merged?.composition ? {
|
|
46
|
+
...merged,
|
|
47
|
+
composition: defaultConnectComposition(merged)
|
|
48
|
+
} : merged;
|
|
44
49
|
return JSON.stringify({
|
|
45
50
|
...baked,
|
|
46
51
|
connect,
|
|
@@ -197,5 +202,5 @@ function connectBaseOf(args, outDirAbs, dirname) {
|
|
|
197
202
|
//#endregion
|
|
198
203
|
export { isProxiedRequest as a, precompressedAssets as c, serveOverrideStep as d, shellSwapFor as f, connectBaseOf as i, previewCacheControl as l, assertConnectBuild as n, overrideFromEnv as o, stripBase as p, cacheHeaders as r, patchCspScriptSrc as s, PRECOMPRESS_EXTENSIONS as t, resolvePreviewBase as u };
|
|
199
204
|
|
|
200
|
-
//# sourceMappingURL=connect-serve-
|
|
201
|
-
//# debugId=
|
|
205
|
+
//# sourceMappingURL=connect-serve-TZFWyrHe.mjs.map
|
|
206
|
+
//# debugId=84da26cc-d907-59bf-9556-240d6940a58f
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"connect-serve-TZFWyrHe.mjs","sources":["../src/services/connect-serve.ts"],"sourcesContent":["import { getConfig } from \"@powerhousedao/config/node\";\nimport { defaultConnectComposition } from \"@powerhousedao/host-core\";\nimport {\n DEFAULT_CONNECT_OUTDIR,\n type PHConnectRuntimeConfig,\n} from \"@powerhousedao/shared/clis\";\nimport { deepMerge, normalizeBasePath } from \"@powerhousedao/shared/connect\";\nimport {\n APP_SHELLS_FILE,\n appShellVariant,\n appShellVariantOf,\n readShellPluginsIn,\n swapAppShell,\n withShellAppName,\n type AppShells,\n} from \"@powerhousedao/shared/connect/app-shell\";\nimport {\n isHtmlNavigation,\n isSwitchboardProxyPath,\n} from \"@powerhousedao/shared/connect/origin-placeholder\";\nimport { existsSync, readFileSync } from \"node:fs\";\nimport type { IncomingMessage, ServerResponse } from \"node:http\";\nimport path from \"node:path\";\nimport sirv from \"sirv\";\nimport type { ConnectPreviewArgs } from \"./classic-args.js\";\n\n/**\n * Runtime shaping for a served (built) Connect, desktop shape: the compound\n * projects the live switchboard's drive into the connect member's config, and\n * this override makes the STATIC dist serve it — the built\n * powerhouse.config.json is baked, so without this the drive injection never\n * reaches the SPA. `cspRegistrySync` additionally patches the baked CSP's\n * script-src with the runtime registry (the build bakes the CSP for the\n * registry it was built against; setting the registry at run time breaks that\n * coupling and every package import gets blocked otherwise).\n */\nexport interface ConnectServeOverride {\n connect?: PHConnectRuntimeConfig;\n cspRegistrySync?: boolean;\n /** Overrides the baked top-level packageRegistryUrl in the served config. */\n packageRegistryUrl?: string;\n /** Serve Connect's default composition when neither the build nor `connect`\n * carries one: set for a host that declares no `runner.plugins`. */\n defaultComposition?: boolean;\n}\n\n/**\n * The env contract a supervisor can drive the preview with — the same\n * variables the Docker entrypoint and clint's service manager already speak:\n * PH_CONNECT_DEFAULT_DRIVES_URL (comma-separated drive urls, injected into\n * drives.defaultDrives), PH_CONNECT_DRIVES_PRESERVE_STRATEGY, and\n * PH_CONNECT_PACKAGES_REGISTRY (runtime registry: served config + baked-CSP\n * patch). Lets `ph connect preview` replace hand-rolled static servers\n * (clint's connect-server, the ph-win sidecar) without losing injection.\n */\nexport function overrideFromEnv(\n env: Record<string, string | undefined> = process.env,\n): ConnectServeOverride | undefined {\n const drivesUrl = env.PH_CONNECT_DEFAULT_DRIVES_URL;\n const registry = env.PH_CONNECT_PACKAGES_REGISTRY;\n if (!drivesUrl && !registry) return undefined;\n const override: ConnectServeOverride = {};\n if (drivesUrl) {\n override.connect = {\n drives: {\n defaultDrives: drivesUrl\n .split(\",\")\n .map((s) => s.trim())\n .filter(Boolean)\n .map((url) => ({ url, name: null, icon: null })),\n preserveStrategy:\n env.PH_CONNECT_DRIVES_PRESERVE_STRATEGY ?? \"preserve-all\",\n },\n } as PHConnectRuntimeConfig;\n }\n if (registry) {\n override.packageRegistryUrl = registry;\n override.cspRegistrySync = true;\n }\n return override;\n}\n\nfunction mergedConfigBody(\n outDir: string,\n override: ConnectServeOverride,\n): string {\n const file = path.join(outDir, \"powerhouse.config.json\");\n const baked = existsSync(file)\n ? (JSON.parse(readFileSync(file, \"utf8\")) as Record<string, unknown>)\n : {};\n const merged = override.connect\n ? deepMerge(\n (baked.connect ?? {}) as PHConnectRuntimeConfig,\n override.connect,\n )\n : (baked.connect as PHConnectRuntimeConfig | undefined);\n // Worked out from the config as served, so it follows the build's values\n // and a config file changed after the build.\n const connect =\n override.defaultComposition && !merged?.composition\n ? { ...merged, composition: defaultConnectComposition(merged) }\n : merged;\n return JSON.stringify({\n ...baked,\n connect,\n ...(override.packageRegistryUrl\n ? { packageRegistryUrl: override.packageRegistryUrl }\n : {}),\n });\n}\n\n/**\n * Append the registry origin to the baked CSP's script-src. The attribute\n * value is HTML-escaped (every CSP keyword is `'`-quoted, which contains a\n * semicolon), so decode before touching directives and re-escape after —\n * ported from the ph-win-desktop sidecar, which this path replaces.\n */\nexport function patchCspScriptSrc(html: string, registryUrl: string): string {\n return html.replace(\n /(<meta\\s+http-equiv=\"Content-Security-Policy\"\\s+content=\")([^\"]*)(\")/i,\n (_match, open: string, escaped: string, close: string) => {\n const policy = escaped.replace(/&/g, \"&\").replace(/'/g, \"'\");\n if (policy.includes(registryUrl)) return open + escaped + close;\n const patched = policy.replace(\n /script-src\\s+([^;]*)/i,\n (_directive, sources: string) =>\n `script-src ${sources.trim()} ${registryUrl}`,\n );\n const reEscaped = patched.replace(/&/g, \"&\").replace(/'/g, \"'\");\n return open + reEscaped + close;\n },\n );\n}\n\n// The serve base: an explicit `--base`, else the basePath the dist was built with.\nexport function resolvePreviewBase(\n argBase: string | undefined,\n outDirAbs: string,\n): string | undefined {\n if (argBase && argBase !== \"/\") return normalizeBasePath(argBase);\n try {\n const built = JSON.parse(\n readFileSync(path.join(outDirAbs, \"powerhouse.config.json\"), \"utf8\"),\n ) as { connect?: { app?: { basePath?: unknown } } };\n const basePath = built.connect?.app?.basePath;\n if (typeof basePath === \"string\" && basePath) {\n return normalizeBasePath(basePath);\n }\n } catch {\n // no readable dist config\n }\n return undefined;\n}\n\n// `pathname` relative to the deploy base (\"/\" + rest), or itself when outside it.\nexport function stripBase(pathname: string, base: string): string {\n return base !== \"/\" && pathname.startsWith(base)\n ? `/${pathname.slice(base.length)}`\n : pathname;\n}\n\n/** The steps both Connect servers run, in the order they run them. */\nexport type ConnectMiddleware = (\n req: IncomingMessage,\n res: ServerResponse,\n next: () => void,\n) => void;\n\nconst IMMUTABLE = \"public, max-age=31536000, immutable\";\n\nconst HASHED_DIRS = [\"/assets/\", \"/fonts/\", \"/__reactor_worker__/assets/\"];\n\n// Content-addressed output (hashed names, or a `v` query on the worker's), as in the nginx image.\nexport function previewCacheControl(\n pathname: string,\n search: string,\n): string | undefined {\n if (HASHED_DIRS.some((dir) => pathname.startsWith(dir))) return IMMUTABLE;\n if (pathname.startsWith(\"/__vendor__/\")) {\n return /\\/(shared-deps|import-map)\\.js(on)?$/.test(pathname)\n ? \"no-cache\"\n : IMMUTABLE;\n }\n if (pathname.startsWith(\"/__react__/\")) return IMMUTABLE;\n if (pathname.startsWith(\"/__reactor_worker__/\")) {\n return new URLSearchParams(search).has(\"v\") ? IMMUTABLE : \"no-cache\";\n }\n return undefined;\n}\n\nexport function cacheHeaders(outDir: string, base: string): ConnectMiddleware {\n return (req, res, next) => {\n const [rawPath, search = \"\"] = (req.url ?? \"/\").split(\"?\");\n const rel = stripBase(rawPath, base);\n let value = previewCacheControl(rel, search);\n // A cached 404 would outlive the next deploy.\n if (value === IMMUTABLE && !existsSync(path.join(outDir, rel))) {\n value = undefined;\n }\n if (value) res.setHeader(\"Cache-Control\", value);\n next();\n };\n}\n\ntype HtmlTransform = (html: string) => string;\n\n/** The dist's shell for the served config: its composition's variant and its app name. */\nexport function shellSwapFor(\n outDir: string,\n override: ConnectServeOverride,\n base = \"/\",\n): HtmlTransform | undefined {\n const composition = override.connect?.composition;\n const renamed = override.connect?.branding?.appName !== undefined;\n if (!composition && !renamed) return undefined;\n const file = path.join(outDir, APP_SHELLS_FILE);\n // The manifest the build copied from the Connect it used.\n const variant =\n composition && appShellVariant(composition, readShellPluginsIn(outDir));\n const shell =\n variant && existsSync(file)\n ? (JSON.parse(readFileSync(file, \"utf8\")) as AppShells)[variant]\n : undefined;\n // The name the app will title itself with: the served (baked + override) config's.\n const appName = (\n JSON.parse(mergedConfigBody(outDir, override)) as {\n connect?: { branding?: { appName?: string } };\n }\n ).connect?.branding?.appName;\n return (html) =>\n shell && appShellVariantOf(html) !== variant\n ? swapAppShell(html, shell, base, appName)\n : withShellAppName(html, appName);\n}\n\n/**\n * Whether a request on a proxying server belongs to the switchboard: its\n * paths go to the proxy, untouched, except a browser navigation under `/d/`\n * (Connect's own drive routes), as switchboardProxy splits them.\n */\nexport function isProxiedRequest(urlPath: string, accept: string | undefined) {\n if (!isSwitchboardProxyPath(urlPath)) return false;\n return !(urlPath.startsWith(\"/d/\") && isHtmlNavigation(accept));\n}\n\nexport function serveOverrideStep(\n outDir: string,\n override: ConnectServeOverride,\n base = \"/\",\n swapShell?: HtmlTransform,\n proxied = false,\n): ConnectMiddleware {\n return (req, res, next) => {\n const urlPath = stripBase((req.url ?? \"/\").split(\"?\")[0], base);\n if (urlPath === \"/powerhouse.config.json\") {\n res.writeHead(200, {\n \"content-type\": \"application/json; charset=utf-8\",\n \"cache-control\": \"no-store\",\n });\n res.end(mergedConfigBody(outDir, override));\n return;\n }\n // The switchboard's paths are the proxy's, which runs after this:\n // served the SPA shell instead, /graphql would never reach it.\n if (proxied && isProxiedRequest(urlPath, req.headers.accept)) {\n next();\n return;\n }\n // index.html and extensionless SPA routes get the CSP patch.\n const isHtml =\n urlPath === \"/\" ||\n urlPath.endsWith(\"/index.html\") ||\n !path.extname(urlPath);\n if ((override.cspRegistrySync || swapShell) && isHtml) {\n const file = path.join(outDir, \"index.html\");\n if (existsSync(file)) {\n let html = readFileSync(file, \"utf8\");\n if (override.cspRegistrySync) {\n const merged = JSON.parse(mergedConfigBody(outDir, override)) as {\n packageRegistryUrl?: string;\n };\n const registry = merged.packageRegistryUrl;\n if (registry) html = patchCspScriptSrc(html, registry);\n }\n if (swapShell) html = swapShell(html);\n res.writeHead(200, {\n \"content-type\": \"text/html; charset=utf-8\",\n \"cache-control\": \"no-store\",\n });\n res.end(html);\n return;\n }\n }\n next();\n };\n}\n\n/** Extensions whose files have `.gz` siblings. */\nexport const PRECOMPRESS_EXTENSIONS = [\".wasm\", \".data\"] as const;\n\nconst PRECOMPRESSED_TYPES: Record<string, string> = {\n \".wasm\": \"application/wasm\",\n \".data\": \"application/octet-stream\",\n};\n\n// Serves the build's `.gz` siblings of wasm/data, which the main sirv ignores.\nexport function precompressedAssets(\n outDir: string,\n base = \"/\",\n): ConnectMiddleware {\n const serve = sirv(outDir, {\n dev: true,\n etag: true,\n gzip: true,\n extensions: [],\n setHeaders(res, pathname) {\n res.setHeader(\n \"Content-Type\",\n PRECOMPRESSED_TYPES[path.extname(pathname)],\n );\n },\n });\n return (req, res, next) => {\n const url = req.url ?? \"/\";\n const [rawPath, search] = url.split(\"?\");\n const rel = stripBase(rawPath, base);\n // Ranges are byte offsets into the identity body: leave them to the server.\n if (\n !(PRECOMPRESS_EXTENSIONS as readonly string[]).includes(\n path.extname(rel),\n ) ||\n req.headers.range ||\n (base !== \"/\" && rel === rawPath)\n ) {\n next();\n return;\n }\n req.url = search === undefined ? rel : `${rel}?${search}`;\n serve(req, res, () => {\n req.url = url;\n next();\n });\n };\n}\n\n/** Throws, naming the missing file and the build, when `outDirAbs` holds no build. */\nexport function assertConnectBuild(\n outDirArg: string,\n outDirAbs: string,\n dirname: string,\n): void {\n const file = path.join(outDirAbs, \"index.html\");\n if (existsSync(file)) return;\n const relative = path.relative(dirname, file);\n const shown = (\n relative === \"..\" ||\n relative.startsWith(`..${path.sep}`) ||\n path.isAbsolute(relative)\n ? file\n : relative\n )\n .split(path.sep)\n .join(\"/\");\n // A default build, maybe another project's (a monitor copy serves its source's).\n const project = path.resolve(outDirAbs, \"../../..\");\n const build =\n path.resolve(project, DEFAULT_CONNECT_OUTDIR) !== outDirAbs\n ? `\\`ph connect build --outDir ${JSON.stringify(outDirArg)}\\``\n : project === path.resolve(dirname)\n ? \"`ph connect build`\"\n : `\\`ph connect build\\` in ${project.split(path.sep).join(\"/\")}`;\n throw new Error(\n `No Connect build to serve: ${shown} is missing. Build it first with ${build}, or \\`ph run <host> build\\` for a host's Connect.`,\n );\n}\n\n/** The served base: `--base`, else what the dist or the project was built with. */\nexport function connectBaseOf(\n args: Pick<ConnectPreviewArgs, \"connectBasePath\">,\n outDirAbs: string,\n dirname: string,\n): string {\n // Serving a dist needs only its base, not the build's plugin stack.\n const sourceBasePath = getConfig(path.join(dirname, \"powerhouse.config.json\"))\n .connect?.app?.basePath;\n return (\n resolvePreviewBase(args.connectBasePath, outDirAbs) ??\n (sourceBasePath ? normalizeBasePath(sourceBasePath) : \"/\")\n );\n}\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;AAuDA,SAAgB,gBACd,MAA0C,QAAQ,KAChB;CAClC,MAAM,YAAY,IAAI;CACtB,MAAM,WAAW,IAAI;CACrB,IAAI,CAAC,aAAa,CAAC,UAAU,OAAO,KAAA;CACpC,MAAM,WAAiC,CAAC;CAC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KAAK,KACnC,KAAK,WAAW,QAAQ,IACpB,OACA,SAAA,CAEH,MAAM,KAAK,GAAG,CAAC,CACf,KAAK,GAAG;CAEX,MAAM,UAAU,KAAK,QAAQ,WAAW,UAAU;CAClD,MAAM,QACJ,KAAK,QAAQ,SAAS,sBAAsB,MAAM,YAC9C,+BAA+B,KAAK,UAAU,SAAS,EAAE,MACzD,YAAY,KAAK,QAAQ,OAAO,IAC9B,uBACA,2BAA2B,QAAQ,MAAM,KAAK,GAAG,CAAC,CAAC,KAAK,GAAG;CACnE,MAAM,IAAI,MACR,8BAA8B,MAAM,mCAAmC,MAAM,mDAC/E;AACF;;AAGA,SAAgB,cACd,MACA,WACA,SACQ;CAER,MAAM,iBAAiB,UAAU,KAAK,KAAK,SAAS,wBAAwB,CAAC,CAAC,CAC3E,SAAS,KAAK;CACjB,OACE,mBAAmB,KAAK,iBAAiB,SAAS,MACjD,iBAAiB,kBAAkB,cAAc,IAAI;AAE1D","debug_id":"84da26cc-d907-59bf-9556-240d6940a58f"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { t as ConnectPreviewArgs } from "./classic-args-
|
|
1
|
+
import { t as ConnectPreviewArgs } from "./classic-args-BKI4gEVD.mjs";
|
|
2
2
|
import { PHConnectRuntimeConfig } from "@powerhousedao/shared/clis";
|
|
3
3
|
import { IncomingMessage, ServerResponse } from "node:http";
|
|
4
4
|
//#region src/services/connect-serve.d.ts
|
|
@@ -17,6 +17,9 @@ interface ConnectServeOverride {
|
|
|
17
17
|
cspRegistrySync?: boolean;
|
|
18
18
|
/** Overrides the baked top-level packageRegistryUrl in the served config. */
|
|
19
19
|
packageRegistryUrl?: string;
|
|
20
|
+
/** Serve Connect's default composition when neither the build nor `connect`
|
|
21
|
+
* carries one: set for a host that declares no `runner.plugins`. */
|
|
22
|
+
defaultComposition?: boolean;
|
|
20
23
|
}
|
|
21
24
|
/**
|
|
22
25
|
* The env contract a supervisor can drive the preview with — the same
|
|
@@ -61,4 +64,4 @@ declare function connectBaseOf(args: Pick<ConnectPreviewArgs, "connectBasePath">
|
|
|
61
64
|
//#endregion
|
|
62
65
|
export { cacheHeaders as a, overrideFromEnv as c, previewCacheControl as d, resolvePreviewBase as f, stripBase as h, assertConnectBuild as i, patchCspScriptSrc as l, shellSwapFor as m, ConnectServeOverride as n, connectBaseOf as o, serveOverrideStep as p, PRECOMPRESS_EXTENSIONS as r, isProxiedRequest as s, ConnectMiddleware as t, precompressedAssets as u };
|
|
63
66
|
export {};
|
|
64
|
-
//# sourceMappingURL=connect-serve-
|
|
67
|
+
//# sourceMappingURL=connect-serve-kfNeXmO2.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"connect-serve-kfNeXmO2.d.mts","names":[],"sources":["../src/services/connect-serve.ts"],"mappings":";;;;;;;;;;;;;;UAoCiB;EACf,UAAU;EACV;;EAEA;;;EAGA;;;;;;;;;;;iBAYc,gBACd,MAAK,qCACJ;;;;;;;iBA4Da,kBAAkB,cAAc;iBAkBhC,mBACd,6BACA;iBAkBc,UAAU,kBAAkB;;KAOhC,qBACV,KAAK,iBACL,KAAK,gBACL;iBAQc,oBACd,kBACA;iBAec,aAAa,gBAAgB,eAAe;KAcvD,iBAAiB;;iBAGN,aACd,gBACA,UAAU,sBACV,gBACC;;;;;;iBA6Ba,iBAAiB,iBAAiB;iBAKlC,kBACd,gBACA,UAAU,sBACV,eACA,YAAY,eACZ,oBACC;;cA+CU;iBAQG,oBACd,gBACA,gBACC;;iBAqCa,mBACd,mBACA,mBACA;;iBA4Bc,cACd,MAAM,KAAK,wCACX,mBACA"}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
|
|
2
|
-
!function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="
|
|
2
|
+
!function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="7ed8b1a3-a6dc-5f1b-8459-f41f1be3b467")}catch(e){}}();
|
|
3
3
|
import { assertProtocolConsistency, primaryBackend, protocolEnv, reactorBlockToSwitchboardConfig } from "@powerhousedao/host-core";
|
|
4
|
+
import { DEPRECATIONS_REMOVED_IN, MIGRATION_GUIDE_URL } from "@powerhousedao/shared/clis/deprecations";
|
|
4
5
|
import path from "node:path";
|
|
5
6
|
import fs from "node:fs";
|
|
6
7
|
import { mergeSwitchboardConfig, switchboardConfigLayerSchema } from "@powerhousedao/switchboard/config";
|
|
@@ -99,7 +100,7 @@ function readModelAsReactorStore(reactor, env, hostFileLabel) {
|
|
|
99
100
|
if (!url || storage.reactor || env.PH_REACTOR_DATABASE_URL !== void 0 || env.PH_SWITCHBOARD_DATABASE_URL !== void 0) return;
|
|
100
101
|
return {
|
|
101
102
|
url,
|
|
102
|
-
warning: `${hostFileLabel}: reactor readModel.url (${url}) also holds the reactor store, because no storage names one. This is deprecated: set the backend's storage explicitly (the same Postgres url, or a path dataDir)
|
|
103
|
+
warning: `${hostFileLabel}: reactor readModel.url (${url}) also holds the reactor store, because no storage names one. This is deprecated and stops working in ${DEPRECATIONS_REMOVED_IN}: set the backend's storage explicitly (the same Postgres url, or a path dataDir). See ${MIGRATION_GUIDE_URL}`
|
|
103
104
|
};
|
|
104
105
|
}
|
|
105
106
|
/**
|
|
@@ -157,5 +158,5 @@ function switchboardDevMode(devVerb, runner) {
|
|
|
157
158
|
//#endregion
|
|
158
159
|
export { overlappingKeys as a, readModelAsReactorStore as c, missingPostgresUrl as i, rememberShellNames as l, memberSwitchboardConfig as n, prepareMemberStorage as o, memberSwitchboardConfigSchema as r, reactorBlockConflicts as s, memberEnvOf as t, switchboardDevMode as u };
|
|
159
160
|
|
|
160
|
-
//# sourceMappingURL=member-config-
|
|
161
|
-
//# debugId=
|
|
161
|
+
//# sourceMappingURL=member-config-BvlBqovs.mjs.map
|
|
162
|
+
//# debugId=7ed8b1a3-a6dc-5f1b-8459-f41f1be3b467
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"member-config-BvlBqovs.mjs","sources":["../src/runners/member-config.ts"],"sourcesContent":["import fs from \"node:fs\";\nimport path from \"node:path\";\nimport {\n assertProtocolConsistency,\n primaryBackend,\n protocolEnv,\n reactorBlockToSwitchboardConfig,\n type ReactorConfig,\n} from \"@powerhousedao/host-core\";\nimport {\n mergeSwitchboardConfig,\n switchboardConfigLayerSchema,\n type SwitchboardConfigInput,\n} from \"@powerhousedao/switchboard/config\";\nimport {\n DEPRECATIONS_REMOVED_IN,\n MIGRATION_GUIDE_URL,\n} from \"@powerhousedao/shared/clis/deprecations\";\nimport {\n envNamesBeforeProjectEnv,\n isDotenvDisabled,\n} from \"@powerhousedao/shared/clis/project-env\";\nimport type { ILogger } from \"document-model\";\nimport dotenv from \"dotenv\";\n\ntype Env = Readonly<Record<string, string | undefined>>;\n\n/** The operator's env, split by where each value came from. */\nexport interface MemberEnv {\n /** Set by the shell: wins over the host file. */\n shell: Env;\n /** Only in the project `.env`: the host file's keys win over these. */\n dotenv: Env;\n}\n\n// The server's dotenv.config() ignores a file it cannot read.\nfunction readDotenv(cwd: string): Record<string, string> {\n try {\n return dotenv.parse(fs.readFileSync(path.join(cwd, \".env\")));\n } catch {\n return {};\n }\n}\n\nconst shellNamesByEnv = new WeakMap<object, ReadonlySet<string>>();\n\n/** Records which names of `env` the shell set, before a `.env` loads into it. */\nexport function rememberShellNames(env: Env, names: Iterable<string>): void {\n shellNamesByEnv.set(env, new Set(names));\n}\n\n// Taken the first time an env is seen: before the first member's server\n// import loads the .env into it, and reused for every later member.\nfunction shellNamesOf(env: Env): ReadonlySet<string> {\n let names = shellNamesByEnv.get(env);\n if (!names) {\n names =\n (env === process.env ? envNamesBeforeProjectEnv() : undefined) ??\n new Set(Object.keys(env));\n shellNamesByEnv.set(env, names);\n }\n return names;\n}\n\n/**\n * Splits `env` into the shell's values and the `.env` the switchboard server\n * loads from `cwd` (the same file). A name the shell set stays the shell's,\n * whatever the file says.\n */\nexport function memberEnvOf(env: Env, cwd: string = process.cwd()): MemberEnv {\n const file = isDotenvDisabled({ ...env }) ? {} : readDotenv(cwd);\n const shellNames = shellNamesOf(env);\n const shell: Record<string, string | undefined> = {};\n for (const [name, value] of Object.entries(env)) {\n if (file[name] === undefined || shellNames.has(name)) shell[name] = value;\n }\n const fromFile: Record<string, string> = {};\n for (const [name, value] of Object.entries(file)) {\n if (!shellNames.has(name)) fromFile[name] = value;\n }\n return { shell, dotenv: fromFile };\n}\n\n/** The env vars the block sets, which a `.env` value does not override. */\nfunction blockEnvNames(reactor: ReactorConfig | undefined): string[] {\n const block = reactorBlockToSwitchboardConfig(reactor);\n return [\n ...Object.keys(protocolEnv(reactor?.protocol)),\n ...(block.packages?.dynamic ? [\"DYNAMIC_MODEL_LOADING\"] : []),\n ...(block.features ? [\"PH_WORKFLOWS_ENABLED\"] : []),\n ];\n}\n\n/** `config.switchboard`: a member's own switchboard config. The omitted keys\n * live in the reactor block (storage, protocol, dynamic packages) or the\n * runner (port, dev verb, drives, plugins), or are process-wide or not JSON. */\nexport const memberSwitchboardConfigSchema = switchboardConfigLayerSchema([\n \"logLevel\",\n \"server.port\",\n \"server.dev\",\n \"storage.reactor\",\n \"storage.readModel\",\n \"protocol\",\n \"telemetry\",\n \"packages.dynamic\",\n \"drive\",\n \"remoteDrives\",\n \"features.pluginHost\",\n \"processorConfig\",\n]);\n\nexport interface SwitchboardMember {\n reactor?: ReactorConfig;\n config?: { switchboard?: SwitchboardConfigInput };\n}\n\nfunction isPlainObject(value: unknown): value is Record<string, unknown> {\n return (\n typeof value === \"object\" &&\n value !== null &&\n Object.getPrototypeOf(value) === Object.prototype\n );\n}\n\n/** The dotted keys both layers set. */\nexport function overlappingKeys(\n a: Record<string, unknown>,\n b: Record<string, unknown>,\n path = \"\",\n): string[] {\n return Object.entries(b).flatMap(([key, value]) => {\n const other = a[key];\n if (value === undefined || other === undefined) return [];\n const at = path ? `${path}.${key}` : key;\n return isPlainObject(value) && isPlainObject(other)\n ? overlappingKeys(other, value, at)\n : [at];\n });\n}\n\n/** Each `config.switchboard` key the reactor block already sets. */\nexport function reactorBlockConflicts(member: SwitchboardMember): string[] {\n const own = member.config?.switchboard;\n if (!own) return [];\n return overlappingKeys(\n reactorBlockToSwitchboardConfig(member.reactor) as Record<string, unknown>,\n own as Record<string, unknown>,\n ).map(\n (key) =>\n `config.switchboard.${key} is also set by the reactor block; set it in one place.`,\n );\n}\n\n/**\n * The deprecation notice for a block whose `readModel.url` still names the\n * reactor store too: nothing else names the store, as it did when\n * readModel.url rode `dbPath`.\n */\nexport function readModelAsReactorStore(\n reactor: ReactorConfig | undefined,\n env: Env,\n hostFileLabel: string,\n): { url: string; warning: string } | undefined {\n const storage = reactorBlockToSwitchboardConfig(reactor).storage;\n const url = storage?.readModel?.url;\n if (\n !url ||\n storage.reactor ||\n env.PH_REACTOR_DATABASE_URL !== undefined ||\n env.PH_SWITCHBOARD_DATABASE_URL !== undefined\n ) {\n return undefined;\n }\n return {\n url,\n warning:\n `${hostFileLabel}: reactor readModel.url (${url}) also holds the reactor store, because no storage names one. ` +\n `This is deprecated and stops working in ${DEPRECATIONS_REMOVED_IN}: set the backend's storage explicitly (the same Postgres url, or a path dataDir). ` +\n `See ${MIGRATION_GUIDE_URL}`,\n };\n}\n\n/**\n * The member's switchboard config under the runner's own arguments: its\n * reactor block, then `config.switchboard`, then the env over both, mapped\n * once as the server read it (the shell over the `.env`, whose values for the\n * block's own vars are dropped). The block keeps the precedence it had as\n * set-if-absent env and `dbPath`: only a shell PH_REACTOR_DATABASE_URL\n * overrides its store, and no env var overrides its read model. Writes nothing.\n */\nexport async function memberSwitchboardConfig(\n member: SwitchboardMember,\n env: MemberEnv,\n options: {\n /** The host declares `runner.plugins`. Without them the env decides:\n * unset boots the server's default composition. */\n pluginHost: boolean;\n logger?: ILogger;\n /** Under everything else: values no flag or host file set. */\n defaults?: SwitchboardConfigInput;\n },\n): Promise<SwitchboardConfigInput> {\n // Lazy: the env mapping loads reactor-api, which the runner module must not.\n const { switchboardConfigFromEnv } =\n await import(\"@powerhousedao/switchboard/config/env\");\n const block = reactorBlockToSwitchboardConfig(member.reactor);\n const legacy = readModelAsReactorStore(member.reactor, env.shell, \"\");\n if (legacy) {\n block.storage = { ...block.storage, reactor: { url: legacy.url } };\n }\n // One env, as the server read it: the .env under the block's own vars,\n // the shell over both.\n const dotenvValues: Record<string, string | undefined> = { ...env.dotenv };\n for (const name of blockEnvNames(member.reactor)) delete dotenvValues[name];\n const fromEnv = switchboardConfigFromEnv(\n { ...dotenvValues, ...env.shell },\n { logger: options.logger },\n );\n const storage = { ...fromEnv.storage };\n if (\n block.storage?.reactor &&\n env.shell.PH_REACTOR_DATABASE_URL === undefined\n ) {\n delete storage.reactor;\n }\n if (block.storage?.readModel) delete storage.readModel;\n return mergeSwitchboardConfig(\n options.defaults ?? {},\n block,\n member.config?.switchboard ?? {},\n { ...fromEnv, storage },\n // A declared composition turns the plugin host on, whatever the env says.\n options.pluginHost ? { features: { pluginHost: true } } : {},\n );\n}\n\n/** A Postgres store no url names: the server would use a folder instead. */\nexport function missingPostgresUrl(\n reactor: ReactorConfig | undefined,\n config: SwitchboardConfigInput,\n hostFileLabel: string,\n): string | undefined {\n if (primaryBackend(reactor)?.storage?.kind !== \"postgres\") return undefined;\n if (config.storage?.reactor?.url) return undefined;\n return `${hostFileLabel}: the reactor's storage is Postgres, but nothing names the database. Set the backend's storage.url, or PH_REACTOR_DATABASE_URL.`;\n}\n\n/**\n * Fails when the operator's env contradicts the member's protocol block, then\n * creates the block's path-storage dir (the server's own mkdir is not\n * recursive).\n */\nexport function prepareMemberStorage(\n reactor: ReactorConfig | undefined,\n env: Env,\n hostFileLabel: string,\n): void {\n assertProtocolConsistency(reactor?.protocol, { ...env }, hostFileLabel);\n const storage = primaryBackend(reactor)?.storage;\n if (storage?.kind !== \"path\" || !storage.dataDir) return;\n // `ph run` resolves `$env` and the `${userData}` sugar before the verb;\n // an unresolved one here would mkdir a literal \"${userData}\" folder.\n if (/\\$\\{(userData|projectRoot)\\}/.test(storage.dataDir)) {\n throw new Error(\n `${hostFileLabel}: storage.dataDir \"${storage.dataDir}\" was not resolved; resolve the host (resolveHostOutputs) before starting it.`,\n );\n }\n fs.mkdirSync(storage.dataDir, { recursive: true });\n}\n\n/** The verb owns dev mode; `runner.dev` is the host-file spelling of it. */\nexport function switchboardDevMode(\n devVerb: boolean,\n runner: { dev?: boolean },\n): boolean {\n return devVerb || runner.dev === true;\n}\n"],"names":[],"mappings":";;;;;;;;;;AAoCA,SAAS,WAAW,KAAqC;CACvD,IAAI;EACF,OAAO,OAAO,MAAM,GAAG,aAAa,KAAK,KAAK,KAAK,MAAM,CAAC,CAAC;CAC7D,QAAQ;EACN,OAAO,CAAC;CACV;AACF;AAEA,MAAM,kCAAkB,IAAI,QAAqC;;AAGjE,SAAgB,mBAAmB,KAAU,OAA+B;CAC1E,gBAAgB,IAAI,KAAK,IAAI,IAAI,KAAK,CAAC;AACzC;AAIA,SAAS,aAAa,KAA+B;CACnD,IAAI,QAAQ,gBAAgB,IAAI,GAAG;CACnC,IAAI,CAAC,OAAO;EACV,SACG,QAAQ,QAAQ,MAAM,yBAAyB,IAAI,KAAA,MACpD,IAAI,IAAI,OAAO,KAAK,GAAG,CAAC;EAC1B,gBAAgB,IAAI,KAAK,KAAK;CAChC;CACA,OAAO;AACT;;;;;;AAOA,SAAgB,YAAY,KAAU,MAAc,QAAQ,IAAI,GAAc;CAC5E,MAAM,OAAO,iBAAiB,EAAE,GAAG,IAAI,CAAC,IAAI,CAAC,IAAI,WAAW,GAAG;CAC/D,MAAM,aAAa,aAAa,GAAG;CACnC,MAAM,QAA4C,CAAC;CACnD,KAAK,MAAM,CAAC,MAAM,UA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SAAS,SAAS,YAAY,OAAO,KAAA;CAClE,IAAI,OAAO,SAAS,SAAS,KAAK,OAAO,KAAA;CACzC,OAAO,GAAG,cAAc;AAC1B;;;;;;AAOA,SAAgB,qBACd,SACA,KACA,eACM;CACN,0BAA0B,SAAS,UAAU,EAAE,GAAG,IAAI,GAAG,aAAa;CACtE,MAAM,UAAU,eAAe,OAAO,CAAC,EAAE;CACzC,IAAI,SAAS,SAAS,UAAU,CAAC,QAAQ,SAAS;CAGlD,IAAI,+BAA+B,KAAK,QAAQ,OAAO,GACrD,MAAM,IAAI,MACR,GAAG,cAAc,qBAAqB,QAAQ,QAAQ,8EACxD;CAEF,GAAG,UAAU,QAAQ,SAAS,EAAE,WAAW,KAAK,CAAC;AACnD;;AAGA,SAAgB,mBACd,SACA,QACS;CACT,OAAO,WAAW,OAAO,QAAQ;AACnC","debug_id":"7ed8b1a3-a6dc-5f1b-8459-f41f1be3b467"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
//#region src/services/observability.ts
|
|
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]="bda99064-bb32-5306-9e7f-84d88d00c186")}catch(e){}}();
|
|
4
|
+
const DESTINATION_ENV = [
|
|
5
|
+
"SENTRY_DSN",
|
|
6
|
+
"TEMPO_ENDPOINT",
|
|
7
|
+
"OTEL_EXPORTER_OTLP_ENDPOINT"
|
|
8
|
+
];
|
|
9
|
+
function observabilityConfigured(env = process.env) {
|
|
10
|
+
return DESTINATION_ENV.some((name) => Boolean(env[name]?.trim()));
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* Loads the switchboard's observability module when the env names a
|
|
14
|
+
* destination. The module initializes at load and the module cache keeps it
|
|
15
|
+
* to once per process, so every caller gets the same instance.
|
|
16
|
+
*/
|
|
17
|
+
async function loadObservability(env = process.env) {
|
|
18
|
+
if (!observabilityConfigured(env)) return void 0;
|
|
19
|
+
return import("@powerhousedao/switchboard/observability");
|
|
20
|
+
}
|
|
21
|
+
//#endregion
|
|
22
|
+
export { loadObservability };
|
|
23
|
+
|
|
24
|
+
//# sourceMappingURL=observability-CrfdAtHw.mjs.map
|
|
25
|
+
//# debugId=bda99064-bb32-5306-9e7f-84d88d00c186
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"observability-CrfdAtHw.mjs","sources":["../src/services/observability.ts"],"sourcesContent":["// The switchboard bin imports its observability module before anything else,\n// so OpenTelemetry's require-time hooks patch http/express/pg/graphql as they\n// load. `ph run` does the same before it loads a host.\n\nimport type * as ObservabilityModule from \"@powerhousedao/switchboard/observability\";\n\ntype Observability = typeof ObservabilityModule;\n\n// What the module reads to pick a destination. With none of them set it only\n// starts idle SDKs, so it is not loaded: a run without observability pays\n// nothing.\nconst DESTINATION_ENV = [\n \"SENTRY_DSN\",\n \"TEMPO_ENDPOINT\",\n \"OTEL_EXPORTER_OTLP_ENDPOINT\",\n] as const;\n\nexport function observabilityConfigured(\n env: NodeJS.ProcessEnv = process.env,\n): boolean {\n return DESTINATION_ENV.some((name) => Boolean(env[name]?.trim()));\n}\n\n/**\n * Loads the switchboard's observability module when the env names a\n * destination. The module initializes at load and the module cache keeps it\n * to once per process, so every caller gets the same instance.\n */\nexport async function loadObservability(\n env: NodeJS.ProcessEnv = process.env,\n): Promise<Observability | undefined> {\n if (!observabilityConfigured(env)) return undefined;\n return import(\"@powerhousedao/switchboard/observability\");\n}\n"],"names":[],"mappings":";;;AAWA,MAAM,kBAAkB;CACtB;CACA;CACA;AACF;AAEA,SAAgB,wBACd,MAAyB,QAAQ,KACxB;CACT,OAAO,gBAAgB,MAAM,SAAS,QAAQ,IAAI,KAAK,EAAE,KAAK,CAAC,CAAC;AAClE;;;;;;AAOA,eAAsB,kBACpB,MAAyB,QAAQ,KACG;CACpC,IAAI,CAAC,wBAAwB,GAAG,GAAG,OAAO,KAAA;CAC1C,OAAO,OAAO;AAChB","debug_id":"bda99064-bb32-5306-9e7f-84d88d00c186"}
|
|
@@ -0,0 +1,74 @@
|
|
|
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]="a1788377-7f00-5ebb-8b11-04f474a3c3d2")}catch(e){}}();
|
|
3
|
+
import { DEPRECATIONS_REMOVED_IN, connectChromeConfigKeys, formatDeprecation, presentConfigKeys } from "@powerhousedao/shared/clis/deprecations";
|
|
4
|
+
//#region src/runners/host-deprecations.ts
|
|
5
|
+
/**
|
|
6
|
+
* Host file settings that still work and that DEPRECATIONS_REMOVED_IN
|
|
7
|
+
* removes. A runner prints the line when it starts, so a run warns once per
|
|
8
|
+
* host file. A scaffolded host file sets none of them.
|
|
9
|
+
*/
|
|
10
|
+
/** The `reactor.workflows` boolean: workflows are a listed plugin instead. */
|
|
11
|
+
function reactorWorkflowsDeprecation(reactor, hostFile, plugin) {
|
|
12
|
+
if (reactor?.workflows === void 0) return void 0;
|
|
13
|
+
return formatDeprecation(`${hostFile}: reactor.workflows is deprecated and stops working in ${DEPRECATIONS_REMOVED_IN}. Workflows are a plugin: "${plugin}" under runner.plugins switches them on, leaving it out switches them off. Remove the key.`);
|
|
14
|
+
}
|
|
15
|
+
/** Where the generic plugin's entry config takes each chrome key. */
|
|
16
|
+
const CHROME_ENTRY_KEYS = {
|
|
17
|
+
"connect.drives.allowAddDrive": "allowAddDrive",
|
|
18
|
+
"connect.drives.sections": "sections",
|
|
19
|
+
"connect.drives.icons": "icons",
|
|
20
|
+
"connect.home.background": "homeBackground"
|
|
21
|
+
};
|
|
22
|
+
/**
|
|
23
|
+
* The top-level Connect chrome keys of a host without `runner.plugins`: only
|
|
24
|
+
* the classic Connect boot reads them there. `config` is the host's connect
|
|
25
|
+
* config block.
|
|
26
|
+
*/
|
|
27
|
+
function connectChromeDeprecation(config, composed, hostFile) {
|
|
28
|
+
if (composed) return void 0;
|
|
29
|
+
const present = presentConfigKeys({ connect: config }, connectChromeConfigKeys);
|
|
30
|
+
if (present.length === 0) return void 0;
|
|
31
|
+
const keys = present.map((key) => `config.${key.slice(8)}`);
|
|
32
|
+
const entryKeys = present.map((key) => CHROME_ENTRY_KEYS[key]);
|
|
33
|
+
return formatDeprecation(`${hostFile}: ${keys.join(", ")} ${keys.length === 1 ? "is" : "are"} only read by the classic Connect boot, which ${DEPRECATIONS_REMOVED_IN} removes. List "@powerhousedao/connect/plugins/generic" under runner.plugins and set ${entryKeys.join(", ")} in its entry config.`);
|
|
34
|
+
}
|
|
35
|
+
//#endregion
|
|
36
|
+
//#region src/runners/runner-args.ts
|
|
37
|
+
function namesOf(arg) {
|
|
38
|
+
const names = {
|
|
39
|
+
forceFlagLongNames: /* @__PURE__ */ new Set(),
|
|
40
|
+
forceFlagShortNames: /* @__PURE__ */ new Set(),
|
|
41
|
+
forceOptionLongNames: /* @__PURE__ */ new Set(),
|
|
42
|
+
forceOptionShortNames: /* @__PURE__ */ new Set()
|
|
43
|
+
};
|
|
44
|
+
arg.register?.(names);
|
|
45
|
+
return {
|
|
46
|
+
options: [...[...names.forceOptionLongNames].map((name) => `--${name}`), ...[...names.forceOptionShortNames].map((name) => `-${name}`)],
|
|
47
|
+
flags: [...[...names.forceFlagLongNames].map((name) => `--${name}`), ...[...names.forceFlagShortNames].map((name) => `-${name}`)]
|
|
48
|
+
};
|
|
49
|
+
}
|
|
50
|
+
/** The schema of a set of cmd-ts arguments, as typed on the command line. */
|
|
51
|
+
function runnerArgsSchemaOf(args, extra = {}) {
|
|
52
|
+
const all = Object.values(args).map(namesOf);
|
|
53
|
+
return {
|
|
54
|
+
options: all.flatMap((names) => names.options),
|
|
55
|
+
flags: all.flatMap((names) => names.flags),
|
|
56
|
+
...extra
|
|
57
|
+
};
|
|
58
|
+
}
|
|
59
|
+
/** The parsed values `argv` names itself: a definition's default is not an
|
|
60
|
+
* argument, and must not override the host file. */
|
|
61
|
+
function onlyPassed(values, args, argv) {
|
|
62
|
+
const passed = {};
|
|
63
|
+
for (const key of Object.keys(values)) {
|
|
64
|
+
const { options, flags } = namesOf(args[key]);
|
|
65
|
+
const names = [...options, ...flags];
|
|
66
|
+
if (argv.some((token) => names.some((name) => token === name || token.startsWith(`${name}=`)))) passed[key] = values[key];
|
|
67
|
+
}
|
|
68
|
+
return passed;
|
|
69
|
+
}
|
|
70
|
+
//#endregion
|
|
71
|
+
export { reactorWorkflowsDeprecation as i, runnerArgsSchemaOf as n, connectChromeDeprecation as r, onlyPassed as t };
|
|
72
|
+
|
|
73
|
+
//# sourceMappingURL=runner-args-DduJxV1b.mjs.map
|
|
74
|
+
//# debugId=a1788377-7f00-5ebb-8b11-04f474a3c3d2
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"runner-args-DduJxV1b.mjs","sources":["../src/runners/host-deprecations.ts","../src/runners/runner-args.ts"],"sourcesContent":["import type { ReactorConfig } from \"@powerhousedao/host-core\";\nimport {\n connectChromeConfigKeys,\n DEPRECATIONS_REMOVED_IN,\n formatDeprecation,\n presentConfigKeys,\n} from \"@powerhousedao/shared/clis/deprecations\";\n\n/**\n * Host file settings that still work and that DEPRECATIONS_REMOVED_IN\n * removes. A runner prints the line when it starts, so a run warns once per\n * host file. A scaffolded host file sets none of them.\n */\n\n/** The `reactor.workflows` boolean: workflows are a listed plugin instead. */\nexport function reactorWorkflowsDeprecation(\n reactor: ReactorConfig | undefined,\n hostFile: string,\n plugin: string,\n): string | undefined {\n if (reactor?.workflows === undefined) return undefined;\n return formatDeprecation(\n `${hostFile}: reactor.workflows is deprecated and stops working in ${DEPRECATIONS_REMOVED_IN}. ` +\n `Workflows are a plugin: \"${plugin}\" under runner.plugins switches them on, leaving it out switches them off. ` +\n \"Remove the key.\",\n );\n}\n\n/** Where the generic plugin's entry config takes each chrome key. */\nconst CHROME_ENTRY_KEYS: Readonly<Record<string, string>> = {\n \"connect.drives.allowAddDrive\": \"allowAddDrive\",\n \"connect.drives.sections\": \"sections\",\n \"connect.drives.icons\": \"icons\",\n \"connect.home.background\": \"homeBackground\",\n};\n\n/**\n * The top-level Connect chrome keys of a host without `runner.plugins`: only\n * the classic Connect boot reads them there. `config` is the host's connect\n * config block.\n */\nexport function connectChromeDeprecation(\n config: Record<string, unknown> | undefined,\n composed: boolean,\n hostFile: string,\n): string | undefined {\n if (composed) return undefined;\n const present = presentConfigKeys(\n { connect: config },\n connectChromeConfigKeys,\n );\n if (present.length === 0) return undefined;\n const keys = present.map((key) => `config.${key.slice(\"connect.\".length)}`);\n const entryKeys = present.map((key) => CHROME_ENTRY_KEYS[key]);\n return formatDeprecation(\n `${hostFile}: ${keys.join(\", \")} ${keys.length === 1 ? \"is\" : \"are\"} only read by the classic Connect boot, which ${DEPRECATIONS_REMOVED_IN} removes. ` +\n `List \"@powerhousedao/connect/plugins/generic\" under runner.plugins and set ${entryKeys.join(\", \")} in its entry config.`,\n );\n}\n","import type { RunnerArgsSchema } from \"@powerhousedao/host-core\";\n\n/**\n * A runner's `argsSchema` and its per-invocation values, from the SAME cmd-ts\n * definitions the classic commands parse (`@powerhousedao/shared/clis/args`),\n * so a name or a type cannot drift from them.\n */\n\n/** The names a cmd-ts argument registers with the parser. */\ninterface ArgNames {\n forceFlagLongNames: Set<string>;\n forceFlagShortNames: Set<string>;\n forceOptionLongNames: Set<string>;\n forceOptionShortNames: Set<string>;\n}\n\n/** The slice of a cmd-ts argument definition read here. */\ninterface NamedArg {\n register?: (names: ArgNames) => void;\n}\n\nfunction namesOf(arg: NamedArg): { options: string[]; flags: string[] } {\n const names: ArgNames = {\n forceFlagLongNames: new Set(),\n forceFlagShortNames: new Set(),\n forceOptionLongNames: new Set(),\n forceOptionShortNames: new Set(),\n };\n arg.register?.(names);\n return {\n options: [\n ...[...names.forceOptionLongNames].map((name) => `--${name}`),\n ...[...names.forceOptionShortNames].map((name) => `-${name}`),\n ],\n flags: [\n ...[...names.forceFlagLongNames].map((name) => `--${name}`),\n ...[...names.forceFlagShortNames].map((name) => `-${name}`),\n ],\n };\n}\n\n/** The schema of a set of cmd-ts arguments, as typed on the command line. */\nexport function runnerArgsSchemaOf(\n args: Record<string, NamedArg>,\n extra: Pick<RunnerArgsSchema, \"memberOptions\" | \"retired\"> = {},\n): RunnerArgsSchema {\n const all = Object.values(args).map(namesOf);\n return {\n options: all.flatMap((names) => names.options),\n flags: all.flatMap((names) => names.flags),\n ...extra,\n };\n}\n\n/** The parsed values `argv` names itself: a definition's default is not an\n * argument, and must not override the host file. */\nexport function onlyPassed<T extends Record<string, unknown>>(\n values: T,\n args: Record<keyof T & string, NamedArg>,\n argv: readonly string[],\n): Partial<T> {\n const passed: Partial<T> = {};\n for (const key of Object.keys(values) as (keyof T & string)[]) {\n const { options, flags } = namesOf(args[key]);\n const names = [...options, ...flags];\n const named = argv.some((token) =>\n names.some((name) => token === name || token.startsWith(`${name}=`)),\n );\n if (named) passed[key] = values[key];\n }\n return passed;\n}\n"],"names":[],"mappings":";;;;;;;;;;AAeA,SAAgB,4BACd,SACA,UACA,QACoB;CACpB,IAAI,SAAS,cAAc,KAAA,GAAW,OAAO,KAAA;CAC7C,OAAO,kBACL,GAAG,SAAS,yDAAyD,wBAAwB,6BAC/D,OAAO,2FAEvC;AACF;;AAGA,MAAM,oBAAsD;CAC1D,gCAAgC;CAChC,2BAA2B;CAC3B,wBAAwB;CACxB,2BAA2B;AAC7B;;;;;;AAOA,SAAgB,yBACd,QACA,UACA,UACoB;CACpB,IAAI,UAAU,OAAO,KAAA;CACrB,MAAM,UAAU,kBACd,EAAE,SAAS,OAAO,GAClB,uBACF;CACA,IAAI,QAAQ,WAAW,GAAG,OAAO,KAAA;CACjC,MAAM,OAAO,QAAQ,KAAK,QAAQ,UAAU,IAAI,MAAM,CAAiB,GAAG;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AM,SAAS,UAAU,QAAQ,MAAM,WAAW,GAAG,KAAK,EAAE,CAAC,CAE7D,GAAG,OAAO,OAAO,OAAO;CAClC;CACA,OAAO;AACT","debug_id":"a1788377-7f00-5ebb-8b11-04f474a3c3d2"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { t as ConnectPreviewArgs } from "../classic-args-
|
|
2
|
-
import { n as ConnectServeOverride } from "../connect-serve-
|
|
1
|
+
import { t as ConnectPreviewArgs } from "../classic-args-BKI4gEVD.mjs";
|
|
2
|
+
import { n as ConnectServeOverride } from "../connect-serve-kfNeXmO2.mjs";
|
|
3
3
|
import { RunnerContext, RunnerHandle } from "@powerhousedao/host-core";
|
|
4
|
-
import { PHConnectRuntimeConfig } from "@powerhousedao/shared/clis";
|
|
4
|
+
import { PHConnectRuntimeConfig, ParsedCmdResult, PowerhouseConfig } from "@powerhousedao/shared/clis";
|
|
5
5
|
import { z } from "zod";
|
|
6
6
|
//#region src/runners/connect.d.ts
|
|
7
7
|
/**
|
|
@@ -791,6 +791,17 @@ export declare function connectHandle(server: ListeningServer, requested: {
|
|
|
791
791
|
* from. A host may also write `${origin}/…` itself; that passes through.
|
|
792
792
|
*/
|
|
793
793
|
export declare function callerOverride(host: ConnectHostParsed, ctx?: RunnerContext, verb?: string): PHConnectRuntimeConfig | undefined;
|
|
794
|
+
/** Whether the host leaves its composition to Connect's default, which the
|
|
795
|
+
* terminal is told in place of a composition plan. */
|
|
796
|
+
export declare function servesDefaultComposition(host: ConnectHostParsed): boolean;
|
|
797
|
+
/**
|
|
798
|
+
* `override` with Connect's default composition, for a host that declares no
|
|
799
|
+
* `runner.plugins` and is served by a build tool. The composition is worked
|
|
800
|
+
* out from the config Connect would be served without one: the project's
|
|
801
|
+
* powerhouse.config.json (`source`) under the override, under what the
|
|
802
|
+
* service lays over both (`over`: Studio's studio mode).
|
|
803
|
+
*/
|
|
804
|
+
export declare function withDefaultComposition(override: PHConnectRuntimeConfig | undefined, source: Pick<PowerhouseConfig, "connect" | "workflows">, over?: PHConnectRuntimeConfig): PHConnectRuntimeConfig;
|
|
794
805
|
/**
|
|
795
806
|
* Start a server; under a supervising compound (`ctx.parent`), drop the
|
|
796
807
|
* process-exiting signal listeners it installed (vite's dev and preview
|
|
@@ -1249,6 +1260,40 @@ export declare function withoutBuiltImages(config: PHConnectRuntimeConfig | unde
|
|
|
1249
1260
|
} | null | undefined;
|
|
1250
1261
|
};
|
|
1251
1262
|
} | undefined;
|
|
1263
|
+
declare const invocation: Partial<import("cmd-ts/dist/cjs/argparser.js").Register> & {
|
|
1264
|
+
parse(context: import("cmd-ts/dist/cjs/argparser.js").ParseContext): Promise<import("cmd-ts/dist/cjs/argparser.js").ParsingResult<{
|
|
1265
|
+
port: number;
|
|
1266
|
+
host: string | undefined;
|
|
1267
|
+
open: boolean | undefined;
|
|
1268
|
+
cors: boolean | undefined;
|
|
1269
|
+
strictPort: boolean | undefined;
|
|
1270
|
+
}>>;
|
|
1271
|
+
} & import("cmd-ts/dist/cjs/helpdoc.js").PrintHelp & import("cmd-ts/dist/cjs/helpdoc.js").ProvidesHelp & import("cmd-ts/dist/cjs/helpdoc.js").Named & Partial<import("cmd-ts/dist/cjs/helpdoc.js").Versioned> & import("cmd-ts/dist/cjs/argparser.js").Register & import("cmd-ts/dist/cjs/runner.js").Handling<{
|
|
1272
|
+
port: number;
|
|
1273
|
+
host: string | undefined;
|
|
1274
|
+
open: boolean | undefined;
|
|
1275
|
+
cors: boolean | undefined;
|
|
1276
|
+
strictPort: boolean | undefined;
|
|
1277
|
+
}, {
|
|
1278
|
+
port: number;
|
|
1279
|
+
host: string | undefined;
|
|
1280
|
+
open: boolean | undefined;
|
|
1281
|
+
cors: boolean | undefined;
|
|
1282
|
+
strictPort: boolean | undefined;
|
|
1283
|
+
}> & {
|
|
1284
|
+
run(context: import("cmd-ts/dist/cjs/argparser.js").ParseContext): Promise<import("cmd-ts/dist/cjs/argparser.js").ParsingResult<{
|
|
1285
|
+
port: number;
|
|
1286
|
+
host: string | undefined;
|
|
1287
|
+
open: boolean | undefined;
|
|
1288
|
+
cors: boolean | undefined;
|
|
1289
|
+
strictPort: boolean | undefined;
|
|
1290
|
+
}>>;
|
|
1291
|
+
} & Partial<import("cmd-ts/dist/cjs/helpdoc.js").Versioned & import("cmd-ts/dist/cjs/helpdoc.js").Descriptive & import("cmd-ts/dist/cjs/helpdoc.js").Aliased>;
|
|
1292
|
+
export type ConnectInvocationArgs = Partial<ParsedCmdResult<typeof invocation>>;
|
|
1293
|
+
export declare const argsSchema: import("@powerhousedao/host-core").RunnerArgsSchema;
|
|
1294
|
+
/** This invocation's arguments (`ctx.argv`), parsed by the classic
|
|
1295
|
+
* definitions; only the ones passed. They win over the host file. */
|
|
1296
|
+
export declare function connectInvocationArgs(host: ConnectHostParsed, ctx: RunnerContext): Promise<ConnectInvocationArgs>;
|
|
1252
1297
|
/** A server for a built Connect, given what to serve and how. */
|
|
1253
1298
|
export type ConnectServerStart = (args: ConnectPreviewArgs, override?: ConnectServeOverride, dirname?: string, options?: {
|
|
1254
1299
|
proxy?: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"connect.d.mts","names":[],"sources":["../../src/runners/connect.ts"],"mappings":";;;;;;;;;;;;
|
|
1
|
+
{"version":3,"file":"connect.d.mts","names":[],"sources":["../../src/runners/connect.ts"],"mappings":";;;;;;;;;;;;qBAyDa;qBA0CA,oBAAkB,EAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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