@drfed/drfed 0.2.0-dev.685 → 0.2.0-dev.703

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (58) hide show
  1. package/README.md +7 -6
  2. package/dist/api-mail-parser.d.mts +1 -1
  3. package/dist/{api-mail-settings-BcGaqQ9f.d.mts → api-mail-settings-DK41LiGe.d.mts} +4 -4
  4. package/dist/{api-mail-settings-BcGaqQ9f.d.mts.map → api-mail-settings-DK41LiGe.d.mts.map} +1 -1
  5. package/dist/api-mail-settings.d.mts +1 -1
  6. package/dist/commands/account-program.d.mts +1 -1
  7. package/dist/commands/account-program.mjs +1 -1
  8. package/dist/commands/account.mjs +1 -1
  9. package/dist/commands/migrate-program.d.mts +1 -1
  10. package/dist/commands/migrate-program.mjs +1 -1
  11. package/dist/commands/migrate.mjs +1 -1
  12. package/dist/commands/web-program.d.mts +1 -1
  13. package/dist/commands/web-program.d.mts.map +1 -1
  14. package/dist/commands/web-program.mjs +5 -4
  15. package/dist/commands/web-program.mjs.map +1 -1
  16. package/dist/commands/web.mjs +1 -1
  17. package/dist/{configuration-DVVF7xNv.d.mts → configuration-368lwC4r.d.mts} +17 -3
  18. package/dist/{configuration-DVVF7xNv.d.mts.map → configuration-368lwC4r.d.mts.map} +1 -1
  19. package/dist/configuration.d.mts +2 -2
  20. package/dist/configuration.mjs +22 -5
  21. package/dist/configuration.mjs.map +1 -1
  22. package/dist/data-path.d.mts +1 -1
  23. package/dist/data-path.d.mts.map +1 -1
  24. package/dist/data-path.mjs +5 -4
  25. package/dist/data-path.mjs.map +1 -1
  26. package/dist/database-runtime.d.mts +1 -1
  27. package/dist/database-settings.d.mts +1 -1
  28. package/dist/diagnostics.d.mts +2 -2
  29. package/dist/index.mjs +2 -2
  30. package/dist/jmap-parser.d.mts +1 -1
  31. package/dist/{jmap-settings-BXNAF1ep.d.mts → jmap-settings-h6lwIv6a.d.mts} +4 -4
  32. package/dist/{jmap-settings-BXNAF1ep.d.mts.map → jmap-settings-h6lwIv6a.d.mts.map} +1 -1
  33. package/dist/jmap-settings.d.mts +1 -1
  34. package/dist/listen-defaults.d.mts +15 -0
  35. package/dist/listen-defaults.d.mts.map +1 -0
  36. package/dist/listen-defaults.mjs +23 -0
  37. package/dist/listen-defaults.mjs.map +1 -0
  38. package/dist/logging.d.mts +1 -1
  39. package/dist/{mail-parser-DyI4wuQp.d.mts → mail-parser-D7BM1mzn.d.mts} +2 -2
  40. package/dist/{mail-parser-DyI4wuQp.d.mts.map → mail-parser-D7BM1mzn.d.mts.map} +1 -1
  41. package/dist/mail-parser.d.mts +1 -1
  42. package/dist/mail-runtime.d.mts +1 -1
  43. package/dist/{mail-settings-DjWMAUaE.d.mts → mail-settings-DpY8GyiB.d.mts} +6 -6
  44. package/dist/{mail-settings-DjWMAUaE.d.mts.map → mail-settings-DpY8GyiB.d.mts.map} +1 -1
  45. package/dist/mail-settings.d.mts +1 -1
  46. package/dist/package-Dji3wWVx.mjs +6 -0
  47. package/dist/package-Dji3wWVx.mjs.map +1 -0
  48. package/dist/{parser-TANGHRjL.d.mts → parser-C0dRu62q.d.mts} +3 -3
  49. package/dist/{parser-TANGHRjL.d.mts.map → parser-C0dRu62q.d.mts.map} +1 -1
  50. package/dist/{parser-DGIQTgS7.mjs → parser-Czr4z4-a.mjs} +6 -5
  51. package/dist/parser-Czr4z4-a.mjs.map +1 -0
  52. package/dist/{secret-source-BeZx72Ue.d.mts → secret-source-CM9cHsZH.d.mts} +2 -2
  53. package/dist/{secret-source-BeZx72Ue.d.mts.map → secret-source-CM9cHsZH.d.mts.map} +1 -1
  54. package/dist/secret-source.d.mts +1 -1
  55. package/package.json +15 -10
  56. package/dist/package-D3PlyrNP.mjs +0 -6
  57. package/dist/package-D3PlyrNP.mjs.map +0 -1
  58. package/dist/parser-DGIQTgS7.mjs.map +0 -1
package/README.md CHANGED
@@ -20,12 +20,13 @@ drfed-server --root-origin https://drfed.example.com \
20
20
  ~~~~
21
21
 
22
22
  The server listens on `localhost:8888` by default. Pass `--listen HOST:PORT`
23
- to override. Automatic database migrations run on startup unless `--no-migrate`
24
- is given. The frontend and exact `/graphql` endpoint share this listener. Open
25
- the configured root origin for the frontend, or set `--public-origin` to a
26
- different control authority. Instance and deeper subdomains cannot be selected
27
- as its authority. Other control authorities still serve `/graphql`, but web
28
- requests on them receive 421.
23
+ to override. The official container image sets `DRFED_CONTAINER=1`, which
24
+ changes only that default host to `0.0.0.0`. Automatic database migrations run
25
+ on startup unless `--no-migrate` is given. The frontend and exact `/graphql`
26
+ endpoint share this listener. Open the configured root origin for the frontend,
27
+ or set `--public-origin` to a different control authority. Instance and deeper
28
+ subdomains cannot be selected as its authority. Other control authorities still
29
+ serve `/graphql`, but web requests on them receive 421.
29
30
 
30
31
  CLI parsing validates settings before opening database or mail resources.
31
32
  `--help`, `--version`, and `--generate-graphql-schema` can run without starting
@@ -1,4 +1,4 @@
1
- import { m as createConfigurationBindings, s as Sourced } from "./configuration-DVVF7xNv.mjs";
1
+ import { c as Sourced, h as createConfigurationBindings } from "./configuration-368lwC4r.mjs";
2
2
  //#region src/api-mail-parser.d.ts
3
3
  /** API service options included in pure metadata argument arity. */
4
4
  declare const apiMailValueOptionNames: {
@@ -1,6 +1,6 @@
1
- import { s as Sourced } from "./configuration-DVVF7xNv.mjs";
2
- import { t as RawMailOptions } from "./mail-parser-DyI4wuQp.mjs";
3
- import { t as SecretSource } from "./secret-source-BeZx72Ue.mjs";
1
+ import { c as Sourced } from "./configuration-368lwC4r.mjs";
2
+ import { t as RawMailOptions } from "./mail-parser-D7BM1mzn.mjs";
3
+ import { t as SecretSource } from "./secret-source-CM9cHsZH.mjs";
4
4
  import { LettermintConfig } from "@upyo/lettermint";
5
5
  import { MailerooConfig } from "@upyo/maileroo";
6
6
  import { MailgunConfig } from "@upyo/mailgun";
@@ -139,4 +139,4 @@ declare function resolveApiMailSettings(raw: RawMailOptions, cwd: string, provid
139
139
  };
140
140
  //#endregion
141
141
  export { resolveApiMailSettings as n, validateApiMailCredential as r, ApiMailSettings as t };
142
- //# sourceMappingURL=api-mail-settings-BcGaqQ9f.d.mts.map
142
+ //# sourceMappingURL=api-mail-settings-DK41LiGe.d.mts.map
@@ -1 +1 @@
1
- {"version":3,"file":"api-mail-settings-BcGaqQ9f.d.mts","names":[],"sources":["../src/api-mail-settings.ts"],"mappings":";;;;;;;;;;;;KAiCY;WAEG;WACA,YAAY,KACnB;WAGO,YAAY;;WAGZ;WACA,YAAY,KACnB;WAGO,YAAY;;WAGZ;WACA,YAAY,KACnB;WAGO,YAAY;;WAGZ;WACA,YAAY,KACnB;WAGO,YAAY;;WAGZ;WACA,YAAY,KAAK;WACjB,YAAY;;WAGZ;WACA,YAAY,KAAK;WACjB,YAAY;;WAGZ;WACA,YAAY,KACnB;WAQO,YAAY;;KAGtB,QAAQ;;iBAMG,0BAA0B;;;;iBAyW1B,uBACd,KAAK,gBACL,aACA,WAAU;;aAzZc;aACC,YAAA,KACnB;aAGmB,YAAA;;;;;;;;;;;;aAGD;aACC,YAAA,KACnB;aAGmB,YAAA;;;;;;;;;;;aAGD;aACC,YAAA,KAAK;aACL,YAAA;;;;IAkTrB;IACA;;;;aAhToB;aACC,YAAA,KAAK;aACL,YAAA;;;;IA6UrB;IACA;IACA;;;;aA5UoB;aACC,YAAA,KACnB;aAQmB,YAAA;;;;IAyWrB;IACA;;;;aAtZoB;aACC,YAAA,KACnB;aAGmB,YAAA;;;;;;;;;;;;;aAbD;aACC,YAAA,KACnB;aAGmB,YAAA"}
1
+ {"version":3,"file":"api-mail-settings-DK41LiGe.d.mts","names":[],"sources":["../src/api-mail-settings.ts"],"mappings":";;;;;;;;;;;;KAiCY;WAEG;WACA,YAAY,KACnB;WAGO,YAAY;;WAGZ;WACA,YAAY,KACnB;WAGO,YAAY;;WAGZ;WACA,YAAY,KACnB;WAGO,YAAY;;WAGZ;WACA,YAAY,KACnB;WAGO,YAAY;;WAGZ;WACA,YAAY,KAAK;WACjB,YAAY;;WAGZ;WACA,YAAY,KAAK;WACjB,YAAY;;WAGZ;WACA,YAAY,KACnB;WAQO,YAAY;;KAGtB,QAAQ;;iBAMG,0BAA0B;;;;iBAyW1B,uBACd,KAAK,gBACL,aACA,WAAU;;aAzZc;aACC,YAAA,KACnB;aAGmB,YAAA;;;;;;;;;;;;aAGD;aACC,YAAA,KACnB;aAGmB,YAAA;;;;;;;;;;;aAGD;aACC,YAAA,KAAK;aACL,YAAA;;;;IAkTrB;IACA;;;;aAhToB;aACC,YAAA,KAAK;aACL,YAAA;;;;IA6UrB;IACA;IACA;;;;aA5UoB;aACC,YAAA,KACnB;aAQmB,YAAA;;;;IAyWrB;IACA;;;;aAtZoB;aACC,YAAA,KACnB;aAGmB,YAAA;;;;;;;;;;;;;aAbD;aACC,YAAA,KACnB;aAGmB,YAAA"}
@@ -1,2 +1,2 @@
1
- import { n as resolveApiMailSettings, r as validateApiMailCredential, t as ApiMailSettings } from "./api-mail-settings-BcGaqQ9f.mjs";
1
+ import { n as resolveApiMailSettings, r as validateApiMailCredential, t as ApiMailSettings } from "./api-mail-settings-DK41LiGe.mjs";
2
2
  export { ApiMailSettings, resolveApiMailSettings, validateApiMailCredential };
@@ -1,4 +1,4 @@
1
- import { m as createConfigurationBindings, o as ConfigurationSource, r as ConfigurationFile, s as Sourced } from "../configuration-DVVF7xNv.mjs";
1
+ import { c as Sourced, h as createConfigurationBindings, o as ConfigurationSource, r as ConfigurationFile } from "../configuration-368lwC4r.mjs";
2
2
  import { InferValue } from "@optique/core/parser";
3
3
  //#region src/commands/account-program.d.ts
4
4
  /**
@@ -1,6 +1,6 @@
1
1
  import { configurationBoolean, configurationProjection, configurationProvenance, configurationSettings, createConfigurationBindings } from "../configuration.mjs";
2
2
  import { resolveDatabaseSettings } from "../database-settings.mjs";
3
- import { r as valueOptionNames } from "../parser-DGIQTgS7.mjs";
3
+ import { r as valueOptionNames } from "../parser-Czr4z4-a.mjs";
4
4
  import { accountEmail, resolveAccountInput } from "./account-create.mjs";
5
5
  import { message } from "@optique/core/message";
6
6
  import { map, optional, withDefault } from "@optique/core/modifiers";
@@ -1,4 +1,4 @@
1
- import { t as version } from "../package-D3PlyrNP.mjs";
1
+ import { t as version } from "../package-Dji3wWVx.mjs";
2
2
  import { OperationRegistry } from "../operations.mjs";
3
3
  import { ResourceOwner } from "../resources.mjs";
4
4
  import { openDatabaseRuntime } from "../database-runtime.mjs";
@@ -1,4 +1,4 @@
1
- import { m as createConfigurationBindings, o as ConfigurationSource, r as ConfigurationFile, s as Sourced } from "../configuration-DVVF7xNv.mjs";
1
+ import { c as Sourced, h as createConfigurationBindings, o as ConfigurationSource, r as ConfigurationFile } from "../configuration-368lwC4r.mjs";
2
2
  import { InferValue } from "@optique/core/parser";
3
3
  //#region src/commands/migrate-program.d.ts
4
4
  /**
@@ -1,6 +1,6 @@
1
1
  import { configurationProjection, configurationProvenance, configurationSettings, createConfigurationBindings } from "../configuration.mjs";
2
2
  import { resolveDatabaseSettings } from "../database-settings.mjs";
3
- import { r as valueOptionNames } from "../parser-DGIQTgS7.mjs";
3
+ import { r as valueOptionNames } from "../parser-Czr4z4-a.mjs";
4
4
  import { message } from "@optique/core/message";
5
5
  import { map, optional, withDefault } from "@optique/core/modifiers";
6
6
  import { integer, string, url } from "@optique/core/valueparser";
@@ -1,4 +1,4 @@
1
- import { t as version } from "../package-D3PlyrNP.mjs";
1
+ import { t as version } from "../package-Dji3wWVx.mjs";
2
2
  import { OperationRegistry } from "../operations.mjs";
3
3
  import { ResourceOwner } from "../resources.mjs";
4
4
  import { openDatabaseRuntime } from "../database-runtime.mjs";
@@ -1,4 +1,4 @@
1
- import { m as createConfigurationBindings, o as ConfigurationSource, r as ConfigurationFile, s as Sourced } from "../configuration-DVVF7xNv.mjs";
1
+ import { c as Sourced, h as createConfigurationBindings, o as ConfigurationSource, r as ConfigurationFile } from "../configuration-368lwC4r.mjs";
2
2
  import { InferValue } from "@optique/core/parser";
3
3
  //#region src/commands/web-program.d.ts
4
4
  /** Build a web-only CLI from the shared TOML and environment registry.
@@ -1 +1 @@
1
- {"version":3,"file":"web-program.d.mts","names":["_$___configuration_ts0.Sourced","_$___configuration_ts0.ConfigurationFile","_$___configuration_ts0.ConfigurationSource"],"sources":["../../src/commands/web-program.ts"],"mappings":";;;;;;iBAuCgB,iBACd,UAAS,kBAAkB;;;MAmErB;MACA,6CAAW;;;2BApERA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;KA6EN,gBAAgB,WACnB,kBAAkB;;;;iBAMJ,kBAAkB,KAAK,eAAe;;;;;;;;;;;;;;;;;;KAgD1C,aAAa,kBAAkB;;;;iBAK3B,yBAAyB,SAAS;EAgB9C;EACA;;eAjB8CE;;;;;EAuB9C"}
1
+ {"version":3,"file":"web-program.d.mts","names":["_$___configuration_ts0.Sourced","_$___configuration_ts0.ConfigurationFile","_$___configuration_ts0.ConfigurationSource"],"sources":["../../src/commands/web-program.ts"],"mappings":";;;;;;iBAyCgB,iBACd,UAAS,kBAAkB;;;MAsErB;MACA,6CAAW;;;2BAvERA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;KAgFN,gBAAgB,WACnB,kBAAkB;;;;iBAMJ,kBAAkB,KAAK,eAAe;;;;;;;;;;;;;;;;;;KAgD1C,aAAa,kBAAkB;;;;iBAK3B,yBAAyB,SAAS;EAgB9C;EACA;;eAjB8CE;;;;;EAuB9C"}
@@ -1,4 +1,5 @@
1
- import { configurationBoolean, configurationProjection, configurationProvenance, configurationSettings, createConfigurationBindings } from "../configuration.mjs";
1
+ import { configurationBoolean, configurationProjection, configurationProvenance, configurationSettings, createConfigurationBindings, lazyDefault } from "../configuration.mjs";
2
+ import { defaultListenHost } from "../listen-defaults.mjs";
2
3
  import { createLoggingParser, resolveLogging } from "../logging.mjs";
3
4
  import { message } from "@optique/core/message";
4
5
  import { textFormatter } from "@optique/logtape";
@@ -25,10 +26,10 @@ function createWebProgram(options = {}) {
25
26
  publicOrigin: bind(option("--public-origin", webOrigin, { description: message`The public HTTP or HTTPS web origin, including the external scheme behind TLS termination. Required.` }), configurationSettings.publicOrigin, webOrigin, String),
26
27
  backendUrl: bind(option("--backend-url", webOrigin, { description: message`The backend origin. HTTPS is required outside loopback unless explicitly allowed. GraphQL requests target its /graphql endpoint. Required.` }), configurationSettings.backendUrl, webOrigin, String),
27
28
  allowInsecureBackend: bind(or(flag("--allow-insecure-backend", { description: message`Allow HTTP to a non-loopback backend only on a trusted internal network. Session tokens travel without encryption.` }), map(flag("--no-allow-insecure-backend", { description: message`Require HTTPS for non-loopback backends, overriding environment and configuration permission.` }), () => false)), configurationSettings.allowInsecureBackend, configurationBoolean(), String, false),
28
- address: bind(option("--listen", "-l", address, { description: message`The web address to listen on; independent of the backend server listen setting.` }), configurationSettings.webListen, address, String, {
29
- host: "localhost",
29
+ address: bind(option("--listen", "-l", address, { description: message`The web address to listen on; independent of the backend server listen setting.` }), configurationSettings.webListen, address, String, lazyDefault(() => ({
30
+ host: defaultListenHost(bindings.env),
30
31
  port: 3e3
31
- }),
32
+ }))),
32
33
  logging: createLoggingParser(bindings),
33
34
  printConfig: withDefault(flag("--print-config", { description: message`Print effective settings and provenance, then exit without starting the web runtime or opening logging outputs.` }), false)
34
35
  });
@@ -1 +1 @@
1
- {"version":3,"file":"web-program.mjs","names":["settings"],"sources":["../../src/commands/web-program.ts"],"sourcesContent":["// DrFed: A web-based platform for developing and debugging ActivityPub apps\n// Copyright (C) 2026 DrFed team\n//\n// This program is free software: you can redistribute it and/or modify\n// it under the terms of the GNU Affero General Public License as published by\n// the Free Software Foundation, either version 3 of the License, or\n// (at your option) any later version.\n//\n// This program is distributed in the hope that it will be useful,\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n// GNU Affero General Public License for more details.\n//\n// You should have received a copy of the GNU Affero General Public License\n// along with this program. If not, see <https://www.gnu.org/licenses/>.\n\nimport { isIP } from \"node:net\";\n\nimport { object, or } from \"@optique/core/constructs\";\nimport { message } from \"@optique/core/message\";\nimport { map, optional, withDefault } from \"@optique/core/modifiers\";\nimport type { InferValue } from \"@optique/core/parser\";\nimport { flag, option } from \"@optique/core/primitives\";\nimport { origin, socketAddress } from \"@optique/core/valueparser\";\nimport { textFormatter } from \"@optique/logtape\";\nimport { path } from \"@optique/run/valueparser\";\n\nimport {\n configurationBoolean,\n configurationProjection,\n configurationProvenance,\n createConfigurationBindings,\n configurationSettings as settings,\n} from \"../configuration.ts\";\nimport { createLoggingParser, resolveLogging } from \"../logging.ts\";\n\n/** Build a web-only CLI from the shared TOML and environment registry.\n * @returns Pure metadata, parser contexts and the configuration loader.\n */\nexport function createWebProgram(\n options: Parameters<typeof createConfigurationBindings>[0] = {},\n) {\n const bindings = createConfigurationBindings(options);\n const { bind } = bindings;\n const webOrigin = origin({ allowedProtocols: [\"http:\", \"https:\"] });\n const address = socketAddress({ requirePort: true });\n const parser = object({\n configPath: optional(\n bindings.bindConfigPath(\n option(\"--config\", path({ metavar: \"FILE\", type: \"file\" }), {\n description: message`Read the shared DrFed TOML configuration file.`,\n }),\n ),\n ),\n publicOrigin: bind(\n option(\"--public-origin\", webOrigin, {\n description: message`The public HTTP or HTTPS web origin, including the external scheme behind TLS termination. Required.`,\n }),\n settings.publicOrigin,\n webOrigin,\n String,\n ),\n backendUrl: bind(\n option(\"--backend-url\", webOrigin, {\n description: message`The backend origin. HTTPS is required outside loopback unless explicitly allowed. GraphQL requests target its /graphql endpoint. Required.`,\n }),\n settings.backendUrl,\n webOrigin,\n String,\n ),\n allowInsecureBackend: bind(\n or(\n flag(\"--allow-insecure-backend\", {\n description: message`Allow HTTP to a non-loopback backend only on a trusted internal network. Session tokens travel without encryption.`,\n }),\n map(\n flag(\"--no-allow-insecure-backend\", {\n description: message`Require HTTPS for non-loopback backends, overriding environment and configuration permission.`,\n }),\n () => false,\n ),\n ),\n settings.allowInsecureBackend,\n configurationBoolean(),\n String,\n false,\n ),\n address: bind(\n option(\"--listen\", \"-l\", address, {\n description: message`The web address to listen on; independent of the backend server listen setting.`,\n }),\n settings.webListen,\n address,\n String,\n { host: \"localhost\", port: 3000 },\n ),\n logging: createLoggingParser(bindings),\n printConfig: withDefault(\n flag(\"--print-config\", {\n description: message`Print effective settings and provenance, then exit without starting the web runtime or opening logging outputs.`,\n }),\n false,\n ),\n });\n return {\n program: {\n metadata: {\n name: \"drfed-web\",\n description: message`Run the DrFed web frontend with a separately running GraphQL backend.`,\n },\n parser,\n },\n contexts: bindings.contexts,\n load: bindings.load,\n };\n}\n\ntype RawWebOptions = InferValue<\n ReturnType<typeof createWebProgram>[\"program\"][\"parser\"]\n>;\n\n/** Resolve operational web settings before acquiring resources.\n * @returns The web-only deployment and logging settings with provenance.\n */\nexport function resolveWebOptions(raw: RawWebOptions, cwd = process.cwd()) {\n const publicOrigin = raw.publicOrigin?.value;\n const backendUrl = raw.backendUrl?.value;\n const address = raw.address?.value;\n if (publicOrigin === undefined) {\n throw new Error(\n \"Missing --public-origin, DRFED_PUBLIC_ORIGIN or web.public_origin.\",\n );\n }\n if (backendUrl === undefined) {\n throw new Error(\n \"Missing --backend-url, DRFED_BACKEND_URL or web.backend_url.\",\n );\n }\n const allowInsecureBackend = raw.allowInsecureBackend?.value ?? false;\n const hostname = backendUrl.hostname;\n const loopback =\n hostname === \"localhost\" ||\n hostname.endsWith(\".localhost\") ||\n (isIP(hostname) === 4 && hostname.startsWith(\"127.\")) ||\n hostname === \"[::1]\";\n const insecureBackend = backendUrl.protocol === \"http:\" && !loopback;\n if (insecureBackend && !allowInsecureBackend) {\n throw new Error(\n \"The backend requires HTTPS outside loopback. Use --allow-insecure-backend only on a trusted internal network.\",\n );\n }\n if (address === undefined) throw new Error(\"Missing web listen address.\");\n return {\n publicOrigin,\n backendUrl,\n allowInsecureBackend,\n insecureBackend,\n address,\n logging: resolveLogging(raw.logging, cwd),\n printConfig: raw.printConfig,\n provenance: configurationProvenance({\n publicOrigin: raw.publicOrigin,\n backendUrl: raw.backendUrl,\n allowInsecureBackend: raw.allowInsecureBackend,\n webListen: raw.address,\n logLevel: raw.logging.level,\n logFormat: raw.logging.format,\n logOutput: raw.logging.output,\n }),\n };\n}\n\nexport type WebOptions = ReturnType<typeof resolveWebOptions>;\n\n/** Describe the web projection without reading backend database or mail settings.\n * @returns Effective public values, their sources and unused sections.\n */\nexport function describeWebConfiguration(options: WebOptions) {\n const { formatter } = options.logging.logOutput;\n const values = {\n logFormat:\n formatter === undefined ? \"default\" : textFormatter().format(formatter),\n publicOrigin: options.publicOrigin.origin,\n backendUrl: options.backendUrl.origin,\n allowInsecureBackend: options.allowInsecureBackend,\n webListen: options.address,\n logLevel: options.logging.logLevel,\n logOutput:\n options.logging.logOutput.type === \"console\"\n ? \"-\"\n : options.logging.logOutput.path,\n };\n return {\n command: \"web\",\n settings: Object.fromEntries(\n Object.entries(values).map(([key, value]) => {\n const setting = settings[key as keyof typeof settings];\n return [setting.toml, { value, ...options.provenance[key] }];\n }),\n ),\n ignored: configurationProjection(\"web\").unusedAreas.map((area) => ({\n area,\n reason: \"unused by this command\",\n })),\n };\n}\n"],"mappings":";;;;;;;;;;;;;;AAuCA,SAAgB,iBACd,UAA6D,CAAC,GAC9D;CACA,MAAM,WAAW,4BAA4B,OAAO;CACpD,MAAM,EAAE,SAAS;CACjB,MAAM,YAAY,OAAO,EAAE,kBAAkB,CAAC,SAAS,QAAQ,EAAE,CAAC;CAClE,MAAM,UAAU,cAAc,EAAE,aAAa,KAAK,CAAC;CACnD,MAAM,SA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"sourcesContent":["// DrFed: A web-based platform for developing and debugging ActivityPub apps\n// Copyright (C) 2026 DrFed team\n//\n// This program is free software: you can redistribute it and/or modify\n// it under the terms of the GNU Affero General Public License as published by\n// the Free Software Foundation, either version 3 of the License, or\n// (at your option) any later version.\n//\n// This program is distributed in the hope that it will be useful,\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n// GNU Affero General Public License for more details.\n//\n// You should have received a copy of the GNU Affero General Public License\n// along with this program. If not, see <https://www.gnu.org/licenses/>.\n\nimport { isIP } from \"node:net\";\n\nimport { object, or } from \"@optique/core/constructs\";\nimport { message } from \"@optique/core/message\";\nimport { map, optional, withDefault } from \"@optique/core/modifiers\";\nimport type { InferValue } from \"@optique/core/parser\";\nimport { flag, option } from \"@optique/core/primitives\";\nimport { origin, socketAddress } from \"@optique/core/valueparser\";\nimport { textFormatter } from \"@optique/logtape\";\nimport { path } from \"@optique/run/valueparser\";\n\nimport {\n configurationBoolean,\n configurationProjection,\n configurationProvenance,\n createConfigurationBindings,\n lazyDefault,\n configurationSettings as settings,\n} from \"../configuration.ts\";\nimport { defaultListenHost } from \"../listen-defaults.ts\";\nimport { createLoggingParser, resolveLogging } from \"../logging.ts\";\n\n/** Build a web-only CLI from the shared TOML and environment registry.\n * @returns Pure metadata, parser contexts and the configuration loader.\n */\nexport function createWebProgram(\n options: Parameters<typeof createConfigurationBindings>[0] = {},\n) {\n const bindings = createConfigurationBindings(options);\n const { bind } = bindings;\n const webOrigin = origin({ allowedProtocols: [\"http:\", \"https:\"] });\n const address = socketAddress({ requirePort: true });\n const parser = object({\n configPath: optional(\n bindings.bindConfigPath(\n option(\"--config\", path({ metavar: \"FILE\", type: \"file\" }), {\n description: message`Read the shared DrFed TOML configuration file.`,\n }),\n ),\n ),\n publicOrigin: bind(\n option(\"--public-origin\", webOrigin, {\n description: message`The public HTTP or HTTPS web origin, including the external scheme behind TLS termination. Required.`,\n }),\n settings.publicOrigin,\n webOrigin,\n String,\n ),\n backendUrl: bind(\n option(\"--backend-url\", webOrigin, {\n description: message`The backend origin. HTTPS is required outside loopback unless explicitly allowed. GraphQL requests target its /graphql endpoint. Required.`,\n }),\n settings.backendUrl,\n webOrigin,\n String,\n ),\n allowInsecureBackend: bind(\n or(\n flag(\"--allow-insecure-backend\", {\n description: message`Allow HTTP to a non-loopback backend only on a trusted internal network. Session tokens travel without encryption.`,\n }),\n map(\n flag(\"--no-allow-insecure-backend\", {\n description: message`Require HTTPS for non-loopback backends, overriding environment and configuration permission.`,\n }),\n () => false,\n ),\n ),\n settings.allowInsecureBackend,\n configurationBoolean(),\n String,\n false,\n ),\n address: bind(\n option(\"--listen\", \"-l\", address, {\n description: message`The web address to listen on; independent of the backend server listen setting.`,\n }),\n settings.webListen,\n address,\n String,\n lazyDefault(() => ({\n host: defaultListenHost(bindings.env),\n port: 3000,\n })),\n ),\n logging: createLoggingParser(bindings),\n printConfig: withDefault(\n flag(\"--print-config\", {\n description: message`Print effective settings and provenance, then exit without starting the web runtime or opening logging outputs.`,\n }),\n false,\n ),\n });\n return {\n program: {\n metadata: {\n name: \"drfed-web\",\n description: message`Run the DrFed web frontend with a separately running GraphQL backend.`,\n },\n parser,\n },\n contexts: bindings.contexts,\n load: bindings.load,\n };\n}\n\ntype RawWebOptions = InferValue<\n ReturnType<typeof createWebProgram>[\"program\"][\"parser\"]\n>;\n\n/** Resolve operational web settings before acquiring resources.\n * @returns The web-only deployment and logging settings with provenance.\n */\nexport function resolveWebOptions(raw: RawWebOptions, cwd = process.cwd()) {\n const publicOrigin = raw.publicOrigin?.value;\n const backendUrl = raw.backendUrl?.value;\n const address = raw.address?.value;\n if (publicOrigin === undefined) {\n throw new Error(\n \"Missing --public-origin, DRFED_PUBLIC_ORIGIN or web.public_origin.\",\n );\n }\n if (backendUrl === undefined) {\n throw new Error(\n \"Missing --backend-url, DRFED_BACKEND_URL or web.backend_url.\",\n );\n }\n const allowInsecureBackend = raw.allowInsecureBackend?.value ?? false;\n const hostname = backendUrl.hostname;\n const loopback =\n hostname === \"localhost\" ||\n hostname.endsWith(\".localhost\") ||\n (isIP(hostname) === 4 && hostname.startsWith(\"127.\")) ||\n hostname === \"[::1]\";\n const insecureBackend = backendUrl.protocol === \"http:\" && !loopback;\n if (insecureBackend && !allowInsecureBackend) {\n throw new Error(\n \"The backend requires HTTPS outside loopback. Use --allow-insecure-backend only on a trusted internal network.\",\n );\n }\n if (address === undefined) throw new Error(\"Missing web listen address.\");\n return {\n publicOrigin,\n backendUrl,\n allowInsecureBackend,\n insecureBackend,\n address,\n logging: resolveLogging(raw.logging, cwd),\n printConfig: raw.printConfig,\n provenance: configurationProvenance({\n publicOrigin: raw.publicOrigin,\n backendUrl: raw.backendUrl,\n allowInsecureBackend: raw.allowInsecureBackend,\n webListen: raw.address,\n logLevel: raw.logging.level,\n logFormat: raw.logging.format,\n logOutput: raw.logging.output,\n }),\n };\n}\n\nexport type WebOptions = ReturnType<typeof resolveWebOptions>;\n\n/** Describe the web projection without reading backend database or mail settings.\n * @returns Effective public values, their sources and unused sections.\n */\nexport function describeWebConfiguration(options: WebOptions) {\n const { formatter } = options.logging.logOutput;\n const values = {\n logFormat:\n formatter === undefined ? \"default\" : textFormatter().format(formatter),\n publicOrigin: options.publicOrigin.origin,\n backendUrl: options.backendUrl.origin,\n allowInsecureBackend: options.allowInsecureBackend,\n webListen: options.address,\n logLevel: options.logging.logLevel,\n logOutput:\n options.logging.logOutput.type === \"console\"\n ? \"-\"\n : options.logging.logOutput.path,\n };\n return {\n command: \"web\",\n settings: Object.fromEntries(\n Object.entries(values).map(([key, value]) => {\n const setting = settings[key as keyof typeof settings];\n return [setting.toml, { value, ...options.provenance[key] }];\n }),\n ),\n ignored: configurationProjection(\"web\").unusedAreas.map((area) => ({\n area,\n reason: \"unused by this command\",\n })),\n };\n}\n"],"mappings":";;;;;;;;;;;;;;;AAyCA,SAAgB,iBACd,UAA6D,CAAC,GAC9D;CACA,MA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E;IAAO,GAAG,QAAQ,WAAW;GAAK,CAAC;EAC7D,CAAC,CACH;EACA,SAAS,wBAAwB,KAAK,CAAC,CAAC,YAAY,KAAK,UAAU;GACjE;GACA,QAAQ;EACV,EAAE;CACJ;AACF"}
@@ -1,4 +1,4 @@
1
- import { t as version } from "../package-D3PlyrNP.mjs";
1
+ import { t as version } from "../package-Dji3wWVx.mjs";
2
2
  import { OperationRegistry } from "../operations.mjs";
3
3
  import { ResourceOwner } from "../resources.mjs";
4
4
  import { createWebProgram, describeWebConfiguration, resolveWebOptions } from "./web-program.mjs";
@@ -277,6 +277,19 @@ declare function configurationProvenance(values: Readonly<Record<string, Sourced
277
277
  configPath?: string;
278
278
  };
279
279
  };
280
+ /**
281
+ * A default computed when a parse or help output first needs it, so that
282
+ * building a parser or completing a command reads nothing.
283
+ */
284
+ interface LazyDefault<T> {
285
+ readonly lazy: () => T;
286
+ }
287
+ /**
288
+ * Defer a default value until it is used.
289
+ * @param compute Computes the default; called at most once.
290
+ * @returns A default that {@link createConfigurationBindings}' `bind` accepts.
291
+ */
292
+ declare function lazyDefault<T>(compute: () => T): LazyDefault<T>;
280
293
  /**
281
294
  * Create independent contexts for one parse. Environment lookup remains lazy;
282
295
  * only the fields bound by the command are consumed. No .env file is loaded.
@@ -286,7 +299,7 @@ declare function createConfigurationBindings(options?: {
286
299
  readonly env?: (name: string) => string | undefined;
287
300
  readonly cwd?: string;
288
301
  }): {
289
- bind: <T, TState, TRaw>(cli: Parser<"sync", T, TState>, definition: ConfigurationSetting<TRaw>, valueParser: ValueParser<"sync", T>, encode: (value: TRaw) => string, defaultValue?: T) => import("@optique/core/modifiers").FluentParser<"sync", Sourced<T | undefined> | undefined, TState>;
302
+ bind: <T, TState, TRaw>(cli: Parser<"sync", T, TState>, definition: ConfigurationSetting<TRaw>, valueParser: ValueParser<"sync", T>, encode: (value: TRaw) => string, fallback?: T | LazyDefault<T>) => import("@optique/core/modifiers").FluentParser<"sync", Sourced<T | undefined> | undefined, TState>;
290
303
  bindConfigPath: <TState>(cli: Parser<"sync", string, TState>) => import("@optique/core/modifiers").FluentParser<"sync", Sourced<string>, TState>;
291
304
  load: (parsed: {
292
305
  readonly configPath?: Sourced<string> | undefined;
@@ -419,6 +432,7 @@ declare function createConfigurationBindings(options?: {
419
432
  log_content?: boolean | undefined;
420
433
  } | undefined;
421
434
  }, ConfigMeta>];
435
+ env: (name: string) => string | undefined;
422
436
  };
423
437
  /**
424
438
  * Value parser for JSON string arrays, including the empty array.
@@ -428,5 +442,5 @@ declare function stringArray(): ValueParser<"sync", string[]>;
428
442
  /** Environment and TOML Boolean spelling, shared with Optique. */
429
443
  declare const configurationBoolean: typeof bool;
430
444
  //#endregion
431
- export { ConfigurationSetting as a, configurationBoolean as c, configurationProvenance as d, configurationSchema as f, stringArray as g, decodeConfiguration as h, ConfigurationProjection as i, configurationPath as l, createConfigurationBindings as m, ConfigurationCommand as n, ConfigurationSource as o, configurationSettings as p, ConfigurationFile as r, Sourced as s, ConfigurationArea as t, configurationProjection as u };
432
- //# sourceMappingURL=configuration-DVVF7xNv.d.mts.map
445
+ export { lazyDefault as _, ConfigurationSetting as a, Sourced as c, configurationProjection as d, configurationProvenance as f, decodeConfiguration as g, createConfigurationBindings as h, ConfigurationProjection as i, configurationBoolean as l, configurationSettings as m, ConfigurationCommand as n, ConfigurationSource as o, configurationSchema as p, ConfigurationFile as r, LazyDefault as s, ConfigurationArea as t, configurationPath as u, stringArray as v };
446
+ //# sourceMappingURL=configuration-368lwC4r.d.mts.map
@@ -1 +1 @@
1
- {"version":3,"file":"configuration-DVVF7xNv.d.mts","names":[],"sources":["../src/configuration.ts"],"mappings":";;;;;;;KAiCY;;UAGK,QAAQ;WACd,OAAO;WACP,QAAQ;WACR;;;cAUE,qBAAmB,EAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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Ae;WAQf,qBAAmB;WAQnB,uBAAqB;WAQrB,mBAAiB;WAQjB,cAAY;WAQZ,eAAa;WAQb,YAAU;WAQV,cAAY;WAQZ,aAAW;;;UAWI;WACN,mBAAmB;WACnB,gBAAgB;WAChB,sBAAsB;;;;;;iBAOjB,wBACd,SAAS,sBACT,yBAAwB,sBACvB;;;;;iBAsBa,oBAAoB,mBAAmB;;;;;iBAuBvC,kBACd,OAAO,6BACP;;;;;iBAec,wBACd,QAAQ,SAAS,eAAe;;;;;;;;;;UAwBjB,YAAY;WAClB,YAAY;;;;;;;iBAQP,YAAY,GAAG,eAAe,IAAI,YAAY;;;;;;iBAqB9C,4BACd;WACW,OAAO;WACP;;EAUG,OAAA,GAAG,QAAQ,MAAI,KACtB,eAAe,GAAG,SAAO,YAClB,qBAAqB,OAAK,aACzB,oBAAoB,IAAE,SAC1B,OAAO,iBAAe,WACpB,IAAI,YAAY,yCAAE,qBAAA,QAAA,4BAAA;EAoGP,iBAAA,QAAM,KAAO,uBAAuB,8CAAO,qBAAA,iBAAA;EAiBvC,OAAA;aACjB,aAAa;QACpB;IAAU,QAAQ;IAAmB,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAvIvB,MAAA;;;;;;iBAoKV,eAAe;;cA+BlB,6BAAoB"}
@@ -1,2 +1,2 @@
1
- import { a as ConfigurationSetting, c as configurationBoolean, d as configurationProvenance, f as configurationSchema, g as stringArray, h as decodeConfiguration, i as ConfigurationProjection, l as configurationPath, m as createConfigurationBindings, n as ConfigurationCommand, o as ConfigurationSource, p as configurationSettings, r as ConfigurationFile, s as Sourced, t as ConfigurationArea, u as configurationProjection } from "./configuration-DVVF7xNv.mjs";
2
- export { ConfigurationArea, ConfigurationCommand, ConfigurationFile, ConfigurationProjection, ConfigurationSetting, ConfigurationSource, Sourced, configurationBoolean, configurationPath, configurationProjection, configurationProvenance, configurationSchema, configurationSettings, createConfigurationBindings, decodeConfiguration, stringArray };
1
+ import { _ as lazyDefault, a as ConfigurationSetting, c as Sourced, d as configurationProjection, f as configurationProvenance, g as decodeConfiguration, h as createConfigurationBindings, i as ConfigurationProjection, l as configurationBoolean, m as configurationSettings, n as ConfigurationCommand, o as ConfigurationSource, p as configurationSchema, r as ConfigurationFile, s as LazyDefault, t as ConfigurationArea, u as configurationPath, v as stringArray } from "./configuration-368lwC4r.mjs";
2
+ export { ConfigurationArea, ConfigurationCommand, ConfigurationFile, ConfigurationProjection, ConfigurationSetting, ConfigurationSource, LazyDefault, Sourced, configurationBoolean, configurationPath, configurationProjection, configurationProvenance, configurationSchema, configurationSettings, createConfigurationBindings, decodeConfiguration, lazyDefault, stringArray };
@@ -1,4 +1,5 @@
1
1
  import { readFile } from "node:fs/promises";
2
+ import { env } from "node:process";
2
3
  import { message } from "@optique/core/message";
3
4
  import { dirname, resolve } from "node:path";
4
5
  import { bindConfig, createConfigContext } from "@optique/config";
@@ -312,6 +313,18 @@ function configurationProvenance(values) {
312
313
  }]));
313
314
  }
314
315
  /**
316
+ * Defer a default value until it is used.
317
+ * @param compute Computes the default; called at most once.
318
+ * @returns A default that {@link createConfigurationBindings}' `bind` accepts.
319
+ */
320
+ function lazyDefault(compute) {
321
+ let computed;
322
+ return { lazy: () => (computed ??= { value: compute() }).value };
323
+ }
324
+ function isLazyDefault(value) {
325
+ return typeof value === "object" && value !== null && "lazy" in value && typeof value.lazy === "function";
326
+ }
327
+ /**
315
328
  * Create independent contexts for one parse. Environment lookup remains lazy;
316
329
  * only the fields bound by the command are consumed. No .env file is loaded.
317
330
  * @returns Bindings, independent contexts, and a strict explicit-file loader.
@@ -323,7 +336,8 @@ function createConfigurationBindings(options = {}) {
323
336
  ...options.env === void 0 ? {} : { source: options.env }
324
337
  });
325
338
  const configContext = createConfigContext({ schema: configurationSchema });
326
- function bind(cli, definition, valueParser, encode, defaultValue) {
339
+ function bind(cli, definition, valueParser, encode, fallback) {
340
+ const defaultValue = () => fallback !== void 0 && isLazyDefault(fallback) ? fallback.lazy() : fallback;
327
341
  const tagged = map(cli, (value) => ({
328
342
  value,
329
343
  source: "cli"
@@ -346,7 +360,7 @@ function createConfigurationBindings(options = {}) {
346
360
  };
347
361
  };
348
362
  }
349
- tagged.getDocFragments = (state) => cli.getDocFragments(state, definition.secret ? void 0 : defaultValue);
363
+ tagged.getDocFragments = (state) => cli.getDocFragments(state, definition.secret ? void 0 : defaultValue());
350
364
  const envValueParser = {
351
365
  ...valueParser,
352
366
  parse(input) {
@@ -371,7 +385,9 @@ function createConfigurationBindings(options = {}) {
371
385
  };
372
386
  },
373
387
  default: {
374
- value: defaultValue,
388
+ get value() {
389
+ return defaultValue();
390
+ },
375
391
  source: "default"
376
392
  }
377
393
  }), {
@@ -427,7 +443,8 @@ function createConfigurationBindings(options = {}) {
427
443
  bind,
428
444
  bindConfigPath,
429
445
  load,
430
- contexts: [envContext, configContext]
446
+ contexts: [envContext, configContext],
447
+ env: options.env ?? ((name) => env[name])
431
448
  };
432
449
  }
433
450
  /**
@@ -464,6 +481,6 @@ function stringArray() {
464
481
  /** Environment and TOML Boolean spelling, shared with Optique. */
465
482
  const configurationBoolean = bool;
466
483
  //#endregion
467
- export { configurationBoolean, configurationPath, configurationProjection, configurationProvenance, configurationSchema, configurationSettings, createConfigurationBindings, decodeConfiguration, stringArray };
484
+ export { configurationBoolean, configurationPath, configurationProjection, configurationProvenance, configurationSchema, configurationSettings, createConfigurationBindings, decodeConfiguration, lazyDefault, stringArray };
468
485
 
469
486
  //# sourceMappingURL=configuration.mjs.map