@drfed/drfed 0.0.0-stage → 0.1.0-dev.561
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/LICENSE +661 -0
- package/README.md +1198 -2
- package/bin/drfed-account.mjs +20 -0
- package/bin/drfed-migrate.mjs +20 -0
- package/bin/drfed-server.mjs +20 -0
- package/bin/drfed-web.mjs +20 -0
- package/completions/bash/drfed-account +219 -0
- package/completions/bash/drfed-migrate +219 -0
- package/completions/bash/drfed-server +219 -0
- package/completions/bash/drfed-web +219 -0
- package/completions/fish/drfed-account.fish +264 -0
- package/completions/fish/drfed-migrate.fish +264 -0
- package/completions/fish/drfed-server.fish +264 -0
- package/completions/fish/drfed-web.fish +264 -0
- package/completions/nu/drfed-account.nu +293 -0
- package/completions/nu/drfed-migrate.nu +293 -0
- package/completions/nu/drfed-server.nu +293 -0
- package/completions/nu/drfed-web.nu +293 -0
- package/completions/pwsh/drfed-account.ps1 +183 -0
- package/completions/pwsh/drfed-migrate.ps1 +183 -0
- package/completions/pwsh/drfed-server.ps1 +183 -0
- package/completions/pwsh/drfed-web.ps1 +183 -0
- package/completions/zsh/_drfed-account +145 -0
- package/completions/zsh/_drfed-migrate +145 -0
- package/completions/zsh/_drfed-server +145 -0
- package/completions/zsh/_drfed-web +145 -0
- package/dist/api-mail-parser.d.mts +106 -0
- package/dist/api-mail-parser.d.mts.map +1 -0
- package/dist/api-mail-parser.mjs +145 -0
- package/dist/api-mail-parser.mjs.map +1 -0
- package/dist/api-mail-settings-BcGaqQ9f.d.mts +142 -0
- package/dist/api-mail-settings-BcGaqQ9f.d.mts.map +1 -0
- package/dist/api-mail-settings.d.mts +2 -0
- package/dist/api-mail-settings.mjs +272 -0
- package/dist/api-mail-settings.mjs.map +1 -0
- package/dist/bounded-mail-runtime.d.mts +9 -0
- package/dist/bounded-mail-runtime.d.mts.map +1 -0
- package/dist/bounded-mail-runtime.mjs +66 -0
- package/dist/bounded-mail-runtime.mjs.map +1 -0
- package/dist/commands/account-create.d.mts +37 -0
- package/dist/commands/account-create.d.mts.map +1 -0
- package/dist/commands/account-create.mjs +87 -0
- package/dist/commands/account-create.mjs.map +1 -0
- package/dist/commands/account-program.d.mts +223 -0
- package/dist/commands/account-program.d.mts.map +1 -0
- package/dist/commands/account-program.mjs +116 -0
- package/dist/commands/account-program.mjs.map +1 -0
- package/dist/commands/account.d.mts +6 -0
- package/dist/commands/account.d.mts.map +1 -0
- package/dist/commands/account.mjs +91 -0
- package/dist/commands/account.mjs.map +1 -0
- package/dist/commands/migrate-program.d.mts +219 -0
- package/dist/commands/migrate-program.d.mts.map +1 -0
- package/dist/commands/migrate-program.mjs +116 -0
- package/dist/commands/migrate-program.mjs.map +1 -0
- package/dist/commands/migrate.d.mts +6 -0
- package/dist/commands/migrate.d.mts.map +1 -0
- package/dist/commands/migrate.mjs +85 -0
- package/dist/commands/migrate.mjs.map +1 -0
- package/dist/commands/web-program.d.mts +213 -0
- package/dist/commands/web-program.d.mts.map +1 -0
- package/dist/commands/web-program.mjs +112 -0
- package/dist/commands/web-program.mjs.map +1 -0
- package/dist/commands/web.d.mts +6 -0
- package/dist/commands/web.d.mts.map +1 -0
- package/dist/commands/web.mjs +184 -0
- package/dist/commands/web.mjs.map +1 -0
- package/dist/configuration-DVVF7xNv.d.mts +432 -0
- package/dist/configuration-DVVF7xNv.d.mts.map +1 -0
- package/dist/configuration.d.mts +2 -0
- package/dist/configuration.mjs +469 -0
- package/dist/configuration.mjs.map +1 -0
- package/dist/data-path.d.mts +9 -0
- package/dist/data-path.d.mts.map +1 -0
- package/dist/data-path.mjs +21 -0
- package/dist/data-path.mjs.map +1 -0
- package/dist/database-runtime.d.mts +26 -0
- package/dist/database-runtime.d.mts.map +1 -0
- package/dist/database-runtime.mjs +92 -0
- package/dist/database-runtime.mjs.map +1 -0
- package/dist/database-settings.d.mts +36 -0
- package/dist/database-settings.d.mts.map +1 -0
- package/dist/database-settings.mjs +67 -0
- package/dist/database-settings.mjs.map +1 -0
- package/dist/diagnostics.d.mts +29 -0
- package/dist/diagnostics.d.mts.map +1 -0
- package/dist/diagnostics.mjs +61 -0
- package/dist/diagnostics.mjs.map +1 -0
- package/dist/index.d.mts +5 -0
- package/dist/index.d.mts.map +1 -0
- package/dist/index.mjs +344 -0
- package/dist/index.mjs.map +1 -0
- package/dist/jmap-parser.d.mts +35 -0
- package/dist/jmap-parser.d.mts.map +1 -0
- package/dist/jmap-parser.mjs +42 -0
- package/dist/jmap-parser.mjs.map +1 -0
- package/dist/jmap-runtime.d.mts +10 -0
- package/dist/jmap-runtime.d.mts.map +1 -0
- package/dist/jmap-runtime.mjs +17 -0
- package/dist/jmap-runtime.mjs.map +1 -0
- package/dist/jmap-settings-BXNAF1ep.d.mts +41 -0
- package/dist/jmap-settings-BXNAF1ep.d.mts.map +1 -0
- package/dist/jmap-settings.d.mts +2 -0
- package/dist/jmap-settings.mjs +104 -0
- package/dist/jmap-settings.mjs.map +1 -0
- package/dist/logging.d.mts +33 -0
- package/dist/logging.d.mts.map +1 -0
- package/dist/logging.mjs +56 -0
- package/dist/logging.mjs.map +1 -0
- package/dist/mail-parser-DyI4wuQp.d.mts +246 -0
- package/dist/mail-parser-DyI4wuQp.d.mts.map +1 -0
- package/dist/mail-parser.d.mts +2 -0
- package/dist/mail-parser.mjs +100 -0
- package/dist/mail-parser.mjs.map +1 -0
- package/dist/mail-runtime-YROIQ8up.mjs +314 -0
- package/dist/mail-runtime-YROIQ8up.mjs.map +1 -0
- package/dist/mail-runtime.d.mts +68 -0
- package/dist/mail-runtime.d.mts.map +1 -0
- package/dist/mail-runtime.mjs +2 -0
- package/dist/mail-settings-BD1TQ0rt.mjs +427 -0
- package/dist/mail-settings-BD1TQ0rt.mjs.map +1 -0
- package/dist/mail-settings-DjWMAUaE.d.mts +80 -0
- package/dist/mail-settings-DjWMAUaE.d.mts.map +1 -0
- package/dist/mail-settings.d.mts +2 -0
- package/dist/mail-settings.mjs +2 -0
- package/dist/operations.d.mts +32 -0
- package/dist/operations.d.mts.map +1 -0
- package/dist/operations.mjs +55 -0
- package/dist/operations.mjs.map +1 -0
- package/dist/package-D1pbtLwn.mjs +6 -0
- package/dist/package-D1pbtLwn.mjs.map +1 -0
- package/dist/parser-DGIQTgS7.mjs +178 -0
- package/dist/parser-DGIQTgS7.mjs.map +1 -0
- package/dist/parser-TANGHRjL.d.mts +305 -0
- package/dist/parser-TANGHRjL.d.mts.map +1 -0
- package/dist/postgres-settings.d.mts +20 -0
- package/dist/postgres-settings.d.mts.map +1 -0
- package/dist/postgres-settings.mjs +60 -0
- package/dist/postgres-settings.mjs.map +1 -0
- package/dist/query-logger.d.mts +9 -0
- package/dist/query-logger.d.mts.map +1 -0
- package/dist/query-logger.mjs +17 -0
- package/dist/query-logger.mjs.map +1 -0
- package/dist/resources.d.mts +20 -0
- package/dist/resources.d.mts.map +1 -0
- package/dist/resources.mjs +34 -0
- package/dist/resources.mjs.map +1 -0
- package/dist/secret-source-BeZx72Ue.d.mts +21 -0
- package/dist/secret-source-BeZx72Ue.d.mts.map +1 -0
- package/dist/secret-source.d.mts +2 -0
- package/dist/secret-source.mjs +58 -0
- package/dist/secret-source.mjs.map +1 -0
- package/dist/serving.d.mts +82 -0
- package/dist/serving.d.mts.map +1 -0
- package/dist/serving.mjs +138 -0
- package/dist/serving.mjs.map +1 -0
- package/dist/smtp-settings.d.mts +11 -0
- package/dist/smtp-settings.d.mts.map +1 -0
- package/dist/smtp-settings.mjs +38 -0
- package/dist/smtp-settings.mjs.map +1 -0
- package/dist/valueparser.d.mts +46 -0
- package/dist/valueparser.d.mts.map +1 -0
- package/dist/valueparser.mjs +121 -0
- package/dist/valueparser.mjs.map +1 -0
- package/package.json +287 -3
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
import { resolveSecretSource } from "./secret-source.mjs";
|
|
2
|
+
//#region src/jmap-settings.ts
|
|
3
|
+
const priorities = {
|
|
4
|
+
default: 0,
|
|
5
|
+
config: 1,
|
|
6
|
+
env: 2,
|
|
7
|
+
cli: 3
|
|
8
|
+
};
|
|
9
|
+
const rank = (input) => input?.value === void 0 ? -1 : priorities[input.source];
|
|
10
|
+
function endpoint(input, field, required = false) {
|
|
11
|
+
if (input?.value === void 0 && !required) return void 0;
|
|
12
|
+
try {
|
|
13
|
+
const value = new URL(input?.value ?? "");
|
|
14
|
+
const local = [
|
|
15
|
+
"localhost",
|
|
16
|
+
"127.0.0.1",
|
|
17
|
+
"[::1]"
|
|
18
|
+
].includes(value.hostname);
|
|
19
|
+
if (value.protocol !== "https:" && !(value.protocol === "http:" && local) || value.username !== "" || value.password !== "" || value.hash !== "") throw new Error();
|
|
20
|
+
if (field === "base URL" && (value.pathname !== "/" || value.search !== "")) throw new Error();
|
|
21
|
+
return field === "base URL" ? value.origin : value.href;
|
|
22
|
+
} catch {
|
|
23
|
+
throw new Error(`Invalid JMAP ${field}; use HTTPS or local loopback HTTP without credentials.`);
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
function number(input, fallback, minimum, maximum, field) {
|
|
27
|
+
if (input?.value === void 0) return fallback;
|
|
28
|
+
const value = Number(input.value);
|
|
29
|
+
if (!/^\d+$/u.test(input.value) || !Number.isSafeInteger(value) || value < minimum || value > maximum) throw new Error(`Invalid JMAP ${field}.`);
|
|
30
|
+
return value;
|
|
31
|
+
}
|
|
32
|
+
/** Validate credentials without including their contents in error messages. */
|
|
33
|
+
function validateJmapCredential(type, credential, user) {
|
|
34
|
+
if (type === "bearer") {
|
|
35
|
+
if (credential === "" || /[^\x21-\x7e]/u.test(credential)) throw new Error("Invalid JMAP bearer authentication.");
|
|
36
|
+
} else if (user === void 0 || user === "" || user.includes(":") || /[^\x20-\x7e]/u.test(user) || /[^\x20-\x7e]/u.test(credential)) throw new Error("Invalid JMAP basic authentication; the pinned SDK requires printable ASCII credentials.");
|
|
37
|
+
}
|
|
38
|
+
function authentication(raw, cwd) {
|
|
39
|
+
const bearerRank = Math.max(rank(raw.jmapBearerToken), rank(raw.jmapBearerTokenFile));
|
|
40
|
+
const passwordRank = Math.max(rank(raw.jmapPassword), rank(raw.jmapPasswordFile));
|
|
41
|
+
if (bearerRank < 0 && passwordRank < 0) throw new Error("JMAP requires a bearer token or basic authentication.");
|
|
42
|
+
if (bearerRank === passwordRank) throw new Error("JMAP authentication variants at the same source disagree.");
|
|
43
|
+
const bearer = bearerRank > passwordRank;
|
|
44
|
+
const secret = resolveSecretSource(bearer ? raw.jmapBearerToken : raw.jmapPassword, bearer ? raw.jmapBearerTokenFile : raw.jmapPasswordFile, "JMAP authentication", cwd);
|
|
45
|
+
if (secret === void 0) throw new Error("Missing JMAP credential.");
|
|
46
|
+
const user = bearer ? void 0 : raw.jmapUser?.value;
|
|
47
|
+
if (!bearer && (user === void 0 || user === "")) throw new Error("JMAP basic authentication requires a username.");
|
|
48
|
+
if (!bearer) validateJmapCredential("basic", "", user);
|
|
49
|
+
if (secret.type === "literal") validateJmapCredential(bearer ? "bearer" : "basic", secret.value, user);
|
|
50
|
+
return {
|
|
51
|
+
type: bearer ? "bearer" : "basic",
|
|
52
|
+
secret,
|
|
53
|
+
...user === void 0 ? {} : { user }
|
|
54
|
+
};
|
|
55
|
+
}
|
|
56
|
+
function authenticationSources(raw, auth) {
|
|
57
|
+
const literal = auth.secret.type === "literal";
|
|
58
|
+
return {
|
|
59
|
+
jmapUser: auth.type === "basic" ? raw.jmapUser : void 0,
|
|
60
|
+
jmapBearerToken: auth.type === "bearer" && literal ? raw.jmapBearerToken : void 0,
|
|
61
|
+
jmapBearerTokenFile: auth.type === "bearer" && !literal ? raw.jmapBearerTokenFile : void 0,
|
|
62
|
+
jmapPassword: auth.type === "basic" && literal ? raw.jmapPassword : void 0,
|
|
63
|
+
jmapPasswordFile: auth.type === "basic" && !literal ? raw.jmapPasswordFile : void 0
|
|
64
|
+
};
|
|
65
|
+
}
|
|
66
|
+
/** Resolve only the selected JMAP branch, retaining safe source metadata.
|
|
67
|
+
* @returns Provider settings and safe diagnostic values/source tags.
|
|
68
|
+
*/
|
|
69
|
+
function resolveJmapSettings(raw, cwd) {
|
|
70
|
+
const auth = authentication(raw, cwd);
|
|
71
|
+
for (const input of [raw.jmapAccountId, raw.jmapIdentityId]) if (input?.value === "" || input?.value !== void 0 && /\p{Cc}/u.test(input.value)) throw new Error("Invalid JMAP account or identity ID.");
|
|
72
|
+
const baseUrl = endpoint(raw.jmapBaseUrl, "base URL");
|
|
73
|
+
const connection = {
|
|
74
|
+
sessionUrl: endpoint(raw.jmapSessionUrl, "session URL", true),
|
|
75
|
+
...baseUrl === void 0 ? {} : { baseUrl },
|
|
76
|
+
...raw.jmapAccountId?.value === void 0 ? {} : { accountId: raw.jmapAccountId.value },
|
|
77
|
+
...raw.jmapIdentityId?.value === void 0 ? {} : { identityId: raw.jmapIdentityId.value },
|
|
78
|
+
timeout: number(raw.jmapTimeout, 3e4, 1, 2147483647, "timeout"),
|
|
79
|
+
retries: 0,
|
|
80
|
+
sessionCacheTtl: number(raw.jmapSessionCacheTtl, 3e5, 1, 2147483647, "session cache lifetime")
|
|
81
|
+
};
|
|
82
|
+
const values = {
|
|
83
|
+
jmapSessionUrl: connection.sessionUrl,
|
|
84
|
+
jmapBaseUrl: connection.baseUrl,
|
|
85
|
+
jmapAccountId: connection.accountId,
|
|
86
|
+
jmapIdentityId: connection.identityId,
|
|
87
|
+
jmapTimeout: connection.timeout,
|
|
88
|
+
jmapSessionCacheTtl: connection.sessionCacheTtl
|
|
89
|
+
};
|
|
90
|
+
const sources = authenticationSources(raw, auth);
|
|
91
|
+
return {
|
|
92
|
+
mail: {
|
|
93
|
+
transport: "jmap",
|
|
94
|
+
connection,
|
|
95
|
+
authentication: auth
|
|
96
|
+
},
|
|
97
|
+
values,
|
|
98
|
+
sources
|
|
99
|
+
};
|
|
100
|
+
}
|
|
101
|
+
//#endregion
|
|
102
|
+
export { resolveJmapSettings, validateJmapCredential };
|
|
103
|
+
|
|
104
|
+
//# sourceMappingURL=jmap-settings.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"jmap-settings.mjs","names":[],"sources":["../src/jmap-settings.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 type { JmapConfig } from \"@upyo/jmap\";\n\nimport type { Sourced } from \"./configuration.ts\";\nimport type { RawMailOptions } from \"./mail-parser.ts\";\nimport { type SecretSource, resolveSecretSource } from \"./secret-source.ts\";\n\n/** JMAP connection with selected but unopened credential files. */\nexport interface JmapSettings {\n readonly transport: \"jmap\";\n readonly connection: Omit<\n JmapConfig,\n \"bearerToken\" | \"basicAuth\" | \"headers\"\n >;\n readonly authentication: {\n readonly type: \"bearer\" | \"basic\";\n readonly secret: SecretSource;\n readonly user?: string;\n };\n}\n\ntype Input = Sourced<string | undefined> | undefined;\nconst priorities = { default: 0, config: 1, env: 2, cli: 3 } as const;\nconst rank = (input: Input) =>\n input?.value === undefined ? -1 : priorities[input.source];\n\nfunction endpoint(input: Input, field: string, required = false) {\n if (input?.value === undefined && !required) return undefined;\n try {\n const value = new URL(input?.value ?? \"\");\n const local = [\"localhost\", \"127.0.0.1\", \"[::1]\"].includes(value.hostname);\n if (\n (value.protocol !== \"https:\" && !(value.protocol === \"http:\" && local)) ||\n value.username !== \"\" ||\n value.password !== \"\" ||\n value.hash !== \"\"\n ) {\n throw new Error();\n }\n if (\n field === \"base URL\" &&\n (value.pathname !== \"/\" || value.search !== \"\")\n ) {\n throw new Error();\n }\n return field === \"base URL\" ? value.origin : value.href;\n } catch {\n throw new Error(\n `Invalid JMAP ${field}; use HTTPS or local loopback HTTP without credentials.`,\n );\n }\n}\n\nfunction number(\n input: Input,\n fallback: number,\n minimum: number,\n maximum: number,\n field: string,\n) {\n if (input?.value === undefined) return fallback;\n const value = Number(input.value);\n if (\n !/^\\d+$/u.test(input.value) ||\n !Number.isSafeInteger(value) ||\n value < minimum ||\n value > maximum\n ) {\n throw new Error(`Invalid JMAP ${field}.`);\n }\n return value;\n}\n\n/** Validate credentials without including their contents in error messages. */\nexport function validateJmapCredential(\n type: \"bearer\" | \"basic\",\n credential: string,\n user?: string,\n) {\n if (type === \"bearer\") {\n if (credential === \"\" || /[^\\x21-\\x7e]/u.test(credential)) {\n throw new Error(\"Invalid JMAP bearer authentication.\");\n }\n } else if (\n user === undefined ||\n user === \"\" ||\n user.includes(\":\") ||\n /[^\\x20-\\x7e]/u.test(user) ||\n /[^\\x20-\\x7e]/u.test(credential)\n ) {\n throw new Error(\n \"Invalid JMAP basic authentication; the pinned SDK requires printable ASCII credentials.\",\n );\n }\n}\n\nfunction authentication(raw: RawMailOptions, cwd: string) {\n const bearerRank = Math.max(\n rank(raw.jmapBearerToken),\n rank(raw.jmapBearerTokenFile),\n );\n const passwordRank = Math.max(\n rank(raw.jmapPassword),\n rank(raw.jmapPasswordFile),\n );\n if (bearerRank < 0 && passwordRank < 0) {\n throw new Error(\"JMAP requires a bearer token or basic authentication.\");\n }\n if (bearerRank === passwordRank) {\n throw new Error(\n \"JMAP authentication variants at the same source disagree.\",\n );\n }\n const bearer = bearerRank > passwordRank;\n const secret = resolveSecretSource(\n bearer ? raw.jmapBearerToken : raw.jmapPassword,\n bearer ? raw.jmapBearerTokenFile : raw.jmapPasswordFile,\n \"JMAP authentication\",\n cwd,\n );\n if (secret === undefined) throw new Error(\"Missing JMAP credential.\");\n const user = bearer ? undefined : raw.jmapUser?.value;\n if (!bearer && (user === undefined || user === \"\")) {\n throw new Error(\"JMAP basic authentication requires a username.\");\n }\n if (!bearer) validateJmapCredential(\"basic\", \"\", user);\n if (secret.type === \"literal\") {\n validateJmapCredential(bearer ? \"bearer\" : \"basic\", secret.value, user);\n }\n return {\n type: bearer ? (\"bearer\" as const) : (\"basic\" as const),\n secret,\n ...(user === undefined ? {} : { user }),\n };\n}\n\nfunction authenticationSources(\n raw: RawMailOptions,\n auth: JmapSettings[\"authentication\"],\n) {\n const literal = auth.secret.type === \"literal\";\n return {\n jmapUser: auth.type === \"basic\" ? raw.jmapUser : undefined,\n jmapBearerToken:\n auth.type === \"bearer\" && literal ? raw.jmapBearerToken : undefined,\n jmapBearerTokenFile:\n auth.type === \"bearer\" && !literal ? raw.jmapBearerTokenFile : undefined,\n jmapPassword:\n auth.type === \"basic\" && literal ? raw.jmapPassword : undefined,\n jmapPasswordFile:\n auth.type === \"basic\" && !literal ? raw.jmapPasswordFile : undefined,\n };\n}\n\n/** Resolve only the selected JMAP branch, retaining safe source metadata.\n * @returns Provider settings and safe diagnostic values/source tags.\n */\nexport function resolveJmapSettings(raw: RawMailOptions, cwd: string) {\n const auth = authentication(raw, cwd);\n for (const input of [raw.jmapAccountId, raw.jmapIdentityId]) {\n if (\n input?.value === \"\" ||\n (input?.value !== undefined && /\\p{Cc}/u.test(input.value))\n ) {\n throw new Error(\"Invalid JMAP account or identity ID.\");\n }\n }\n const baseUrl = endpoint(raw.jmapBaseUrl, \"base URL\");\n const connection = {\n sessionUrl: endpoint(raw.jmapSessionUrl, \"session URL\", true)!,\n ...(baseUrl === undefined ? {} : { baseUrl }),\n ...(raw.jmapAccountId?.value === undefined\n ? {}\n : { accountId: raw.jmapAccountId.value }),\n ...(raw.jmapIdentityId?.value === undefined\n ? {}\n : { identityId: raw.jmapIdentityId.value }),\n timeout: number(raw.jmapTimeout, 30_000, 1, 2_147_483_647, \"timeout\"),\n retries: 0,\n sessionCacheTtl: number(\n raw.jmapSessionCacheTtl,\n 300_000,\n 1,\n 2_147_483_647,\n \"session cache lifetime\",\n ),\n };\n const values = {\n jmapSessionUrl: connection.sessionUrl,\n jmapBaseUrl: connection.baseUrl,\n jmapAccountId: connection.accountId,\n jmapIdentityId: connection.identityId,\n jmapTimeout: connection.timeout,\n jmapSessionCacheTtl: connection.sessionCacheTtl,\n };\n const sources = authenticationSources(raw, auth);\n const mail: JmapSettings = {\n transport: \"jmap\",\n connection,\n authentication: auth,\n };\n return { mail, values, sources };\n}\n"],"mappings":";;AAqCA,MAAM,aAAa;CAAE,SAAS;CAAG,QAAQ;CAAG,KAAK;CAAG,KAAK;AAAE;AAC3D,MAAM,QAAQ,UACZ,OAAO,UAAU,KAAA,IAAY,KAAK,WAAW,MAAM;AAErD,SAAS,SAAS,OAAc,OAAe,WAAW,OAAO;CAC/D,IAAI,OAAO,UAAU,KAAA,KAAa,CAAC,UAAU,OAAO,KAAA;CACpD,IAAI;EACF,MAAM,QAAQ,IAAI,IAAI,OAAO,SAAS,EAAE;EACxC,MAAM,QAAQ;GAAC;GAAa;GAAa;EAAO,CAAC,CAAC,SAAS,MAAM,QAAQ;EACzE,IACG,MAAM,aAAa,YAAY,EAAE,MAAM,aAAa,WAAW,UAChE,MAAM,aAAa,MACnB,MAAM,aAAa,MACnB,MAAM,SAAS,IAEf,MAAM,IAAI,MAAM;EAElB,IACE,UAAU,eACT,MAAM,aAAa,OAAO,MAAM,WAAW,KAE5C,MAAM,IAAI,MAAM;EAElB,OAAO,UAAU,aAAa,MAAM,SAAS,MAAM;CACrD,QAAQ;EACN,MAAM,IAAI,MACR,gBAAgB,MAAM,wDACxB;CACF;AACF;AAEA,SAAS,OACP,OACA,UACA,SACA,SACA,OACA;CACA,IAAI,OAAO,UAAU,KAAA,GAAW,OAAO;CACvC,MAAM,QAAQ,OAAO,MAAM,KAAK;CAChC,IACE,CAAC,SAAS,KAAK,MAAM,KAAK,KAC1B,CAAC,OAAO,cAAc,KAAK,KAC3B,QAAQ,WACR,QAAQ,SAER,MAAM,IAAI,MAAM,gBAAgB,MAAM,EAAE;CAE1C,OAAO;AACT;;AAGA,SAAgB,uBACd,MACA,YACA,MACA;CACA,IAAI,SAAS,UACP;MAAA,eAAe,MAAM,gBAAgB,KAAK,UAAU,GACtD,MAAM,IAAI,MAAM,qCAAqC;CAAA,OAElD,IACL,SAAS,KAAA,KACT,SAAS,MACT,KAAK,SAAS,GAAG,KACjB,gBAAgB,KAAK,IAAI,KACzB,gBAAgB,KAAK,UAAU,GAE/B,MAAM,IAAI,MACR,yFACF;AAEJ;AAEA,SAAS,eAAe,KAAqB,KAAa;CACxD,MAAM,aAAa,KAAK,IACtB,KAAK,IAAI,eAAe,GACxB,KAAK,IAAI,mBAAmB,CAC9B;CACA,MAAM,eAAe,KAAK,IACxB,KAAK,IAAI,YAAY,GACrB,KAAK,IAAI,gBAAgB,CAC3B;CACA,IAAI,aAAa,KAAK,eAAe,GACnC,MAAM,IAAI,MAAM,uDAAuD;CAEzE,IAAI,eAAe,cACjB,MAAM,IAAI,MACR,2DACF;CAEF,MAAM,SAAS,aAAa;CAC5B,MAAM,SAAS,oBACb,SAAS,IAAI,kBAAkB,IAAI,cACnC,SAAS,IAAI,sBAAsB,IAAI,kBACvC,uBACA,GACF;CACA,IAAI,WAAW,KAAA,GAAW,MAAM,IAAI,MAAM,0BAA0B;CACpE,MAAM,OAAO,SAAS,KAAA,IAAY,IAAI,UAAU;CAChD,IAAI,CAAC,WAAW,SAAS,KAAA,KAAa,SAAS,KAC7C,MAAM,IAAI,MAAM,gDAAgD;CAElE,IAAI,CAAC,QAAQ,uBAAuB,SAAS,IAAI,IAAI;CACrD,IAAI,OAAO,SAAS,WAClB,uBAAuB,SAAS,WAAW,SAAS,OAAO,OAAO,IAAI;CAExE,OAAO;EACL,MAAM,SAAU,WAAsB;EACtC;EACA,GAAI,SAAS,KAAA,IAAY,CAAC,IAAI,EAAE,KAAK;CACvC;AACF;AAEA,SAAS,sBACP,KACA,MACA;CACA,MAAM,UAAU,KAAK,OAAO,SAAS;CACrC,OAAO;EACL,UAAU,KAAK,SAAS,UAAU,IAAI,WAAW,KAAA;EACjD,iBACE,KAAK,SAAS,YAAY,UAAU,IAAI,kBAAkB,KAAA;EAC5D,qBACE,KAAK,SAAS,YAAY,CAAC,UAAU,IAAI,sBAAsB,KAAA;EACjE,cACE,KAAK,SAAS,WAAW,UAAU,IAAI,eAAe,KAAA;EACxD,kBACE,KAAK,SAAS,WAAW,CAAC,UAAU,IAAI,mBAAmB,KAAA;CAC/D;AACF;;;;AAKA,SAAgB,oBAAoB,KAAqB,KAAa;CACpE,MAAM,OAAO,eAAe,KAAK,GAAG;CACpC,KAAK,MAAM,SAAS,CAAC,IAAI,eAAe,IAAI,cAAc,GACxD,IACE,OAAO,UAAU,MAChB,OAAO,UAAU,KAAA,KAAa,UAAU,KAAK,MAAM,KAAK,GAEzD,MAAM,IAAI,MAAM,sCAAsC;CAG1D,MAAM,UAAU,SAAS,IAAI,aAAa,UAAU;CACpD,MAAM,aAAa;EACjB,YAAY,SAAS,IAAI,gBAAgB,eAAe,IAAI;EAC5D,GAAI,YAAY,KAAA,IAAY,CAAC,IAAI,EAAE,QAAQ;EAC3C,GAAI,IAAI,eAAe,UAAU,KAAA,IAC7B,CAAC,IACD,EAAE,WAAW,IAAI,cAAc,MAAM;EACzC,GAAI,IAAI,gBAAgB,UAAU,KAAA,IAC9B,CAAC,IACD,EAAE,YAAY,IAAI,eAAe,MAAM;EAC3C,SAAS,OAAO,IAAI,aAAa,KAAQ,GAAG,YAAe,SAAS;EACpE,SAAS;EACT,iBAAiB,OACf,IAAI,qBACJ,KACA,GACA,YACA,wBACF;CACF;CACA,MAAM,SAAS;EACb,gBAAgB,WAAW;EAC3B,aAAa,WAAW;EACxB,eAAe,WAAW;EAC1B,gBAAgB,WAAW;EAC3B,aAAa,WAAW;EACxB,qBAAqB,WAAW;CAClC;CACA,MAAM,UAAU,sBAAsB,KAAK,IAAI;CAM/C,OAAO;EAAE,MAAA;GAJP,WAAW;GACX;GACA,gBAAgB;EAEN;EAAG;EAAQ;CAAQ;AACjC"}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { m as createConfigurationBindings, s as Sourced } from "./configuration-DVVF7xNv.mjs";
|
|
2
|
+
import { LogOutput } from "@optique/logtape";
|
|
3
|
+
import { InferValue } from "@optique/core/parser";
|
|
4
|
+
//#region src/logging.d.ts
|
|
5
|
+
/** Logging option spellings shared by server and web command metadata. */
|
|
6
|
+
declare const loggingValueOptionNames: {
|
|
7
|
+
readonly logLevel: readonly ["--log-level", "-L"];
|
|
8
|
+
readonly logFormat: readonly ["--log-format"];
|
|
9
|
+
readonly logOutput: readonly ["--log-output"];
|
|
10
|
+
};
|
|
11
|
+
/** Create the common server/web logging projection without opening outputs.
|
|
12
|
+
* @returns Source-aware logging parsers.
|
|
13
|
+
*/
|
|
14
|
+
declare function createLoggingParser(bindings: ReturnType<typeof createConfigurationBindings>): import("@optique/core/modifiers").FluentParser<"sync", {
|
|
15
|
+
readonly level: Sourced<"debug" | "error" | "fatal" | "info" | "trace" | "warning" | undefined> | undefined;
|
|
16
|
+
readonly format: Sourced<import("@logtape/logtape").TextFormatter | undefined> | undefined;
|
|
17
|
+
readonly output: Sourced<string | undefined> | undefined;
|
|
18
|
+
}, {
|
|
19
|
+
readonly level: import("@optique/core/valueparser").ValueParserResult<"debug" | "error" | "fatal" | "info" | "trace" | "warning"> | undefined;
|
|
20
|
+
readonly format: import("@optique/core/valueparser").ValueParserResult<import("@logtape/logtape").TextFormatter> | undefined;
|
|
21
|
+
readonly output: import("@optique/core/valueparser").ValueParserResult<string> | undefined;
|
|
22
|
+
}>;
|
|
23
|
+
type RawLoggingOptions = InferValue<ReturnType<typeof createLoggingParser>>;
|
|
24
|
+
/** Resolve log formatting and source-relative output paths without resources.
|
|
25
|
+
* @returns Configuration accepted by Optique's LogTape integration.
|
|
26
|
+
*/
|
|
27
|
+
declare function resolveLogging(raw: RawLoggingOptions, cwd?: string): {
|
|
28
|
+
logLevel: "debug" | "error" | "fatal" | "info" | "trace" | "warning";
|
|
29
|
+
logOutput: LogOutput;
|
|
30
|
+
};
|
|
31
|
+
//#endregion
|
|
32
|
+
export { createLoggingParser, loggingValueOptionNames, resolveLogging };
|
|
33
|
+
//# sourceMappingURL=logging.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"logging.d.mts","names":[],"sources":["../src/logging.ts"],"mappings":";;;;;cA+Ba;WACX;WACA;WACA;;;;;iBAMc,oBACd,UAAU,kBAAkB,iEAA4B;kBAA9C;;;;;;;;KAoCP,oBAAoB,WAAW,kBAAkB;;;;iBAKtC,eAAe,KAAK,mBAAmB;;aAAnB"}
|
package/dist/logging.mjs
ADDED
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import { configurationPath, configurationSettings } from "./configuration.mjs";
|
|
2
|
+
import { suggestedPath } from "./valueparser.mjs";
|
|
3
|
+
import { message } from "@optique/core/message";
|
|
4
|
+
import { logLevel, textFormatter } from "@optique/logtape";
|
|
5
|
+
import { string } from "@optique/core/valueparser";
|
|
6
|
+
import { object } from "@optique/core/constructs";
|
|
7
|
+
import { option } from "@optique/core/primitives";
|
|
8
|
+
//#region src/logging.ts
|
|
9
|
+
/** Logging option spellings shared by server and web command metadata. */
|
|
10
|
+
const loggingValueOptionNames = {
|
|
11
|
+
logLevel: ["--log-level", "-L"],
|
|
12
|
+
logFormat: ["--log-format"],
|
|
13
|
+
logOutput: ["--log-output"]
|
|
14
|
+
};
|
|
15
|
+
/** Create the common server/web logging projection without opening outputs.
|
|
16
|
+
* @returns Source-aware logging parsers.
|
|
17
|
+
*/
|
|
18
|
+
function createLoggingParser(bindings) {
|
|
19
|
+
const { bind } = bindings;
|
|
20
|
+
const identity = (value) => value;
|
|
21
|
+
const level = logLevel();
|
|
22
|
+
const formatter = textFormatter();
|
|
23
|
+
return object("Logging options", {
|
|
24
|
+
level: bind(option(...loggingValueOptionNames.logLevel, level, { description: message`The lowest log level to record.` }), configurationSettings.logLevel, level, identity, "info"),
|
|
25
|
+
format: bind(option(...loggingValueOptionNames.logFormat, formatter, { description: message`The log formatter.` }), configurationSettings.logFormat, formatter, identity),
|
|
26
|
+
output: bind(option(...loggingValueOptionNames.logOutput, suggestedPath(), { description: message`Log output file. Use - for the console.` }), configurationSettings.logOutput, string(), identity, "-")
|
|
27
|
+
});
|
|
28
|
+
}
|
|
29
|
+
/** Resolve log formatting and source-relative output paths without resources.
|
|
30
|
+
* @returns Configuration accepted by Optique's LogTape integration.
|
|
31
|
+
*/
|
|
32
|
+
function resolveLogging(raw, cwd = process.cwd()) {
|
|
33
|
+
const outputSetting = raw.output;
|
|
34
|
+
if (outputSetting?.value === void 0) throw new Error("Missing log output.");
|
|
35
|
+
const output = outputSetting.value;
|
|
36
|
+
if (output.trim() === "") throw new Error("Log output path cannot be empty.");
|
|
37
|
+
const formatter = raw.format?.value;
|
|
38
|
+
const logOutput = output === "-" ? {
|
|
39
|
+
type: "console",
|
|
40
|
+
...formatter === void 0 ? {} : { formatter }
|
|
41
|
+
} : {
|
|
42
|
+
type: "file",
|
|
43
|
+
path: configurationPath(outputSetting, cwd),
|
|
44
|
+
...formatter === void 0 ? {} : { formatter }
|
|
45
|
+
};
|
|
46
|
+
const level = raw.level?.value;
|
|
47
|
+
if (level === void 0) throw new Error("Missing log level.");
|
|
48
|
+
return {
|
|
49
|
+
logLevel: level,
|
|
50
|
+
logOutput
|
|
51
|
+
};
|
|
52
|
+
}
|
|
53
|
+
//#endregion
|
|
54
|
+
export { createLoggingParser, loggingValueOptionNames, resolveLogging };
|
|
55
|
+
|
|
56
|
+
//# sourceMappingURL=logging.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"logging.mjs","names":["settings"],"sources":["../src/logging.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 { object } from \"@optique/core/constructs\";\nimport { message } from \"@optique/core/message\";\nimport type { InferValue } from \"@optique/core/parser\";\nimport { option } from \"@optique/core/primitives\";\nimport { string } from \"@optique/core/valueparser\";\nimport { type LogOutput, logLevel, textFormatter } from \"@optique/logtape\";\n\nimport {\n configurationPath,\n type createConfigurationBindings,\n configurationSettings as settings,\n} from \"./configuration.ts\";\nimport { suggestedPath } from \"./valueparser.ts\";\n\n/** Logging option spellings shared by server and web command metadata. */\nexport const loggingValueOptionNames = {\n logLevel: [\"--log-level\", \"-L\"],\n logFormat: [\"--log-format\"],\n logOutput: [\"--log-output\"],\n} as const;\n\n/** Create the common server/web logging projection without opening outputs.\n * @returns Source-aware logging parsers.\n */\nexport function createLoggingParser(\n bindings: ReturnType<typeof createConfigurationBindings>,\n) {\n const { bind } = bindings;\n const identity = (value: string) => value;\n const level = logLevel();\n const formatter = textFormatter();\n return object(\"Logging options\", {\n level: bind(\n option(...loggingValueOptionNames.logLevel, level, {\n description: message`The lowest log level to record.`,\n }),\n settings.logLevel,\n level,\n identity,\n \"info\",\n ),\n format: bind(\n option(...loggingValueOptionNames.logFormat, formatter, {\n description: message`The log formatter.`,\n }),\n settings.logFormat,\n formatter,\n identity,\n ),\n output: bind(\n option(...loggingValueOptionNames.logOutput, suggestedPath(), {\n description: message`Log output file. Use - for the console.`,\n }),\n settings.logOutput,\n string(),\n identity,\n \"-\",\n ),\n });\n}\n\ntype RawLoggingOptions = InferValue<ReturnType<typeof createLoggingParser>>;\n\n/** Resolve log formatting and source-relative output paths without resources.\n * @returns Configuration accepted by Optique's LogTape integration.\n */\nexport function resolveLogging(raw: RawLoggingOptions, cwd = process.cwd()) {\n const outputSetting = raw.output;\n if (outputSetting?.value === undefined) {\n throw new Error(\"Missing log output.\");\n }\n const output = outputSetting.value;\n if (output.trim() === \"\") throw new Error(\"Log output path cannot be empty.\");\n const formatter = raw.format?.value;\n const logOutput: LogOutput =\n output === \"-\"\n ? { type: \"console\", ...(formatter === undefined ? {} : { formatter }) }\n : {\n type: \"file\",\n path: configurationPath(outputSetting, cwd),\n ...(formatter === undefined ? {} : { formatter }),\n };\n const level = raw.level?.value;\n if (level === undefined) throw new Error(\"Missing log level.\");\n return { logLevel: level, logOutput };\n}\n"],"mappings":";;;;;;;;;AA+BA,MAAa,0BAA0B;CACrC,UAAU,CAAC,eAAe,IAAI;CAC9B,WAAW,CAAC,cAAc;CAC1B,WAAW,CAAC,cAAc;AAC5B;;;;AAKA,SAAgB,oBACd,UACA;CACA,MAAM,EAAE,SAAS;CACjB,MAAM,YAAY,UAAkB;CACpC,MAAM,QAAQ,SAAS;CACvB,MAAM,YAAY,cAAc;CAChC,OAAO,OAAO,mBAAmB;EAC/B,OAAO,KACL,OAAO,GAAG,wBAAwB,UAAU,OAAO,EACjD,aAAa,OAAO,kCACtB,CAAC,GACDA,sBAAS,UACT,OACA,UACA,MACF;EACA,QAAQ,KACN,OAAO,GAAG,wBAAwB,WAAW,WAAW,EACtD,aAAa,OAAO,qBACtB,CAAC,GACDA,sBAAS,WACT,WACA,QACF;EACA,QAAQ,KACN,OAAO,GAAG,wBAAwB,WAAW,cAAc,GAAG,EAC5D,aAAa,OAAO,0CACtB,CAAC,GACDA,sBAAS,WACT,OAAO,GACP,UACA,GACF;CACF,CAAC;AACH;;;;AAOA,SAAgB,eAAe,KAAwB,MAAM,QAAQ,IAAI,GAAG;CAC1E,MAAM,gBAAgB,IAAI;CAC1B,IAAI,eAAe,UAAU,KAAA,GAC3B,MAAM,IAAI,MAAM,qBAAqB;CAEvC,MAAM,SAAS,cAAc;CAC7B,IAAI,OAAO,KAAK,MAAM,IAAI,MAAM,IAAI,MAAM,kCAAkC;CAC5E,MAAM,YAAY,IAAI,QAAQ;CAC9B,MAAM,YACJ,WAAW,MACP;EAAE,MAAM;EAAW,GAAI,cAAc,KAAA,IAAY,CAAC,IAAI,EAAE,UAAU;CAAG,IACrE;EACE,MAAM;EACN,MAAM,kBAAkB,eAAe,GAAG;EAC1C,GAAI,cAAc,KAAA,IAAY,CAAC,IAAI,EAAE,UAAU;CACjD;CACN,MAAM,QAAQ,IAAI,OAAO;CACzB,IAAI,UAAU,KAAA,GAAW,MAAM,IAAI,MAAM,oBAAoB;CAC7D,OAAO;EAAE,UAAU;EAAO;CAAU;AACtC"}
|
|
@@ -0,0 +1,246 @@
|
|
|
1
|
+
import { m as createConfigurationBindings, s as Sourced } from "./configuration-DVVF7xNv.mjs";
|
|
2
|
+
import { InferValue } from "@optique/core/parser";
|
|
3
|
+
//#region src/mail-parser.d.ts
|
|
4
|
+
/** Mail value-option spellings shared by parsing and metadata arity. */
|
|
5
|
+
declare const mailValueOptionNames: {
|
|
6
|
+
readonly mailApiKey: readonly ["--mail-api-key"];
|
|
7
|
+
readonly mailApiKeyFile: readonly ["--mail-api-key-file"];
|
|
8
|
+
readonly plunkApiKey: readonly ["--plunk-api-key"];
|
|
9
|
+
readonly plunkApiKeyFile: readonly ["--plunk-api-key-file"];
|
|
10
|
+
readonly plunkBaseUrl: readonly ["--plunk-base-url"];
|
|
11
|
+
readonly plunkTimeout: readonly ["--plunk-timeout"];
|
|
12
|
+
readonly resendApiKey: readonly ["--resend-api-key"];
|
|
13
|
+
readonly resendApiKeyFile: readonly ["--resend-api-key-file"];
|
|
14
|
+
readonly resendBaseUrl: readonly ["--resend-base-url"];
|
|
15
|
+
readonly resendTimeout: readonly ["--resend-timeout"];
|
|
16
|
+
readonly resendRetries: readonly ["--resend-retries"];
|
|
17
|
+
readonly sesAuth: readonly ["--ses-auth"];
|
|
18
|
+
readonly sesAccessKeyId: readonly ["--ses-access-key-id"];
|
|
19
|
+
readonly sesAccessKeyIdFile: readonly ["--ses-access-key-id-file"];
|
|
20
|
+
readonly sesSecretAccessKey: readonly ["--ses-secret-access-key"];
|
|
21
|
+
readonly sesSecretAccessKeyFile: readonly ["--ses-secret-access-key-file"];
|
|
22
|
+
readonly sesSessionToken: readonly ["--ses-session-token"];
|
|
23
|
+
readonly sesSessionTokenFile: readonly ["--ses-session-token-file"];
|
|
24
|
+
readonly sesRegion: readonly ["--ses-region"];
|
|
25
|
+
readonly sesTimeout: readonly ["--ses-timeout"];
|
|
26
|
+
readonly sendgridApiKey: readonly ["--sendgrid-api-key"];
|
|
27
|
+
readonly sendgridApiKeyFile: readonly ["--sendgrid-api-key-file"];
|
|
28
|
+
readonly sendgridBaseUrl: readonly ["--sendgrid-base-url"];
|
|
29
|
+
readonly sendgridTimeout: readonly ["--sendgrid-timeout"];
|
|
30
|
+
readonly mailgunApiKey: readonly ["--mailgun-api-key"];
|
|
31
|
+
readonly mailgunApiKeyFile: readonly ["--mailgun-api-key-file"];
|
|
32
|
+
readonly mailgunDomain: readonly ["--mailgun-domain"];
|
|
33
|
+
readonly mailgunRegion: readonly ["--mailgun-region"];
|
|
34
|
+
readonly mailgunBaseUrl: readonly ["--mailgun-base-url"];
|
|
35
|
+
readonly mailgunTimeout: readonly ["--mailgun-timeout"];
|
|
36
|
+
readonly mailtrapApiToken: readonly ["--mailtrap-api-token"];
|
|
37
|
+
readonly mailtrapApiTokenFile: readonly ["--mailtrap-api-token-file"];
|
|
38
|
+
readonly mailtrapInboxId: readonly ["--mailtrap-inbox-id"];
|
|
39
|
+
readonly mailtrapSendBaseUrl: readonly ["--mailtrap-send-base-url"];
|
|
40
|
+
readonly mailtrapSandboxBaseUrl: readonly ["--mailtrap-sandbox-base-url"];
|
|
41
|
+
readonly mailtrapTimeout: readonly ["--mailtrap-timeout"];
|
|
42
|
+
readonly mailerooApiKey: readonly ["--maileroo-api-key"];
|
|
43
|
+
readonly mailerooApiKeyFile: readonly ["--maileroo-api-key-file"];
|
|
44
|
+
readonly mailerooBaseUrl: readonly ["--maileroo-base-url"];
|
|
45
|
+
readonly mailerooTimeout: readonly ["--maileroo-timeout"];
|
|
46
|
+
readonly lettermintApiToken: readonly ["--lettermint-api-token"];
|
|
47
|
+
readonly lettermintApiTokenFile: readonly ["--lettermint-api-token-file"];
|
|
48
|
+
readonly lettermintBaseUrl: readonly ["--lettermint-base-url"];
|
|
49
|
+
readonly lettermintRoute: readonly ["--lettermint-route"];
|
|
50
|
+
readonly lettermintTimeout: readonly ["--lettermint-timeout"];
|
|
51
|
+
readonly lettermintRetries: readonly ["--lettermint-retries"];
|
|
52
|
+
readonly jmapSessionUrl: readonly ["--jmap-session-url"];
|
|
53
|
+
readonly jmapBearerToken: readonly ["--jmap-bearer-token"];
|
|
54
|
+
readonly jmapBearerTokenFile: readonly ["--jmap-bearer-token-file"];
|
|
55
|
+
readonly jmapUser: readonly ["--jmap-user"];
|
|
56
|
+
readonly jmapPassword: readonly ["--jmap-password"];
|
|
57
|
+
readonly jmapPasswordFile: readonly ["--jmap-password-file"];
|
|
58
|
+
readonly jmapAccountId: readonly ["--jmap-account-id"];
|
|
59
|
+
readonly jmapIdentityId: readonly ["--jmap-identity-id"];
|
|
60
|
+
readonly jmapBaseUrl: readonly ["--jmap-base-url"];
|
|
61
|
+
readonly jmapTimeout: readonly ["--jmap-timeout"];
|
|
62
|
+
readonly jmapSessionCacheTtl: readonly ["--jmap-session-cache-ttl"];
|
|
63
|
+
readonly mailTransport: readonly ["--mail-transport"];
|
|
64
|
+
readonly smtpUrl: readonly ["--smtp-url", "-s"];
|
|
65
|
+
readonly smtpHost: readonly ["--smtp-host"];
|
|
66
|
+
readonly smtpPort: readonly ["--smtp-port"];
|
|
67
|
+
readonly smtpTls: readonly ["--smtp-tls"];
|
|
68
|
+
readonly smtpUser: readonly ["--smtp-user"];
|
|
69
|
+
readonly smtpPassword: readonly ["--smtp-password"];
|
|
70
|
+
readonly smtpPasswordFile: readonly ["--smtp-password-file"];
|
|
71
|
+
readonly smtpAuthMethod: readonly ["--smtp-auth-method"];
|
|
72
|
+
readonly smtpAccessToken: readonly ["--smtp-access-token"];
|
|
73
|
+
readonly smtpAccessTokenFile: readonly ["--smtp-access-token-file"];
|
|
74
|
+
readonly smtpConnectionTimeout: readonly ["--smtp-connection-timeout"];
|
|
75
|
+
readonly smtpSocketTimeout: readonly ["--smtp-socket-timeout"];
|
|
76
|
+
readonly smtpPoolSize: readonly ["--smtp-pool-size"];
|
|
77
|
+
readonly smtpLocalName: readonly ["--smtp-local-name"];
|
|
78
|
+
readonly smtpCaFile: readonly ["--smtp-ca-file"];
|
|
79
|
+
readonly smtpCertFile: readonly ["--smtp-cert-file"];
|
|
80
|
+
readonly smtpKeyFile: readonly ["--smtp-key-file"];
|
|
81
|
+
};
|
|
82
|
+
/** Create source-aware mail options without transport construction or file reads.
|
|
83
|
+
* @returns The common mail parser projection.
|
|
84
|
+
*/
|
|
85
|
+
declare function createMailParser(bindings: ReturnType<typeof createConfigurationBindings>): import("@optique/core/modifiers").FluentParser<"sync", {
|
|
86
|
+
readonly mailApiKey: Sourced<string | undefined> | undefined;
|
|
87
|
+
readonly mailApiKeyFile: Sourced<string | undefined> | undefined;
|
|
88
|
+
readonly plunkApiKey: Sourced<string | undefined> | undefined;
|
|
89
|
+
readonly plunkApiKeyFile: Sourced<string | undefined> | undefined;
|
|
90
|
+
readonly plunkBaseUrl: Sourced<string | undefined> | undefined;
|
|
91
|
+
readonly plunkTimeout: Sourced<string | undefined> | undefined;
|
|
92
|
+
readonly resendApiKey: Sourced<string | undefined> | undefined;
|
|
93
|
+
readonly resendApiKeyFile: Sourced<string | undefined> | undefined;
|
|
94
|
+
readonly resendBaseUrl: Sourced<string | undefined> | undefined;
|
|
95
|
+
readonly resendTimeout: Sourced<string | undefined> | undefined;
|
|
96
|
+
readonly resendRetries: Sourced<string | undefined> | undefined;
|
|
97
|
+
readonly sesAuth: Sourced<string | undefined> | undefined;
|
|
98
|
+
readonly sesAccessKeyId: Sourced<string | undefined> | undefined;
|
|
99
|
+
readonly sesAccessKeyIdFile: Sourced<string | undefined> | undefined;
|
|
100
|
+
readonly sesSecretAccessKey: Sourced<string | undefined> | undefined;
|
|
101
|
+
readonly sesSecretAccessKeyFile: Sourced<string | undefined> | undefined;
|
|
102
|
+
readonly sesSessionToken: Sourced<string | undefined> | undefined;
|
|
103
|
+
readonly sesSessionTokenFile: Sourced<string | undefined> | undefined;
|
|
104
|
+
readonly sesRegion: Sourced<string | undefined> | undefined;
|
|
105
|
+
readonly sesTimeout: Sourced<string | undefined> | undefined;
|
|
106
|
+
readonly sendgridApiKey: Sourced<string | undefined> | undefined;
|
|
107
|
+
readonly sendgridApiKeyFile: Sourced<string | undefined> | undefined;
|
|
108
|
+
readonly sendgridBaseUrl: Sourced<string | undefined> | undefined;
|
|
109
|
+
readonly sendgridTimeout: Sourced<string | undefined> | undefined;
|
|
110
|
+
readonly mailgunApiKey: Sourced<string | undefined> | undefined;
|
|
111
|
+
readonly mailgunApiKeyFile: Sourced<string | undefined> | undefined;
|
|
112
|
+
readonly mailgunDomain: Sourced<string | undefined> | undefined;
|
|
113
|
+
readonly mailgunRegion: Sourced<string | undefined> | undefined;
|
|
114
|
+
readonly mailgunBaseUrl: Sourced<string | undefined> | undefined;
|
|
115
|
+
readonly mailgunTimeout: Sourced<string | undefined> | undefined;
|
|
116
|
+
readonly mailtrapApiToken: Sourced<string | undefined> | undefined;
|
|
117
|
+
readonly mailtrapApiTokenFile: Sourced<string | undefined> | undefined;
|
|
118
|
+
readonly mailtrapSandbox: Sourced<string | undefined> | undefined;
|
|
119
|
+
readonly mailtrapInboxId: Sourced<string | undefined> | undefined;
|
|
120
|
+
readonly mailtrapSendBaseUrl: Sourced<string | undefined> | undefined;
|
|
121
|
+
readonly mailtrapSandboxBaseUrl: Sourced<string | undefined> | undefined;
|
|
122
|
+
readonly mailtrapTimeout: Sourced<string | undefined> | undefined;
|
|
123
|
+
readonly mailerooApiKey: Sourced<string | undefined> | undefined;
|
|
124
|
+
readonly mailerooApiKeyFile: Sourced<string | undefined> | undefined;
|
|
125
|
+
readonly mailerooBaseUrl: Sourced<string | undefined> | undefined;
|
|
126
|
+
readonly mailerooTimeout: Sourced<string | undefined> | undefined;
|
|
127
|
+
readonly lettermintApiToken: Sourced<string | undefined> | undefined;
|
|
128
|
+
readonly lettermintApiTokenFile: Sourced<string | undefined> | undefined;
|
|
129
|
+
readonly lettermintBaseUrl: Sourced<string | undefined> | undefined;
|
|
130
|
+
readonly lettermintRoute: Sourced<string | undefined> | undefined;
|
|
131
|
+
readonly lettermintTimeout: Sourced<string | undefined> | undefined;
|
|
132
|
+
readonly lettermintRetries: Sourced<string | undefined> | undefined;
|
|
133
|
+
readonly jmapSessionUrl: Sourced<string | undefined> | undefined;
|
|
134
|
+
readonly jmapBearerToken: Sourced<string | undefined> | undefined;
|
|
135
|
+
readonly jmapBearerTokenFile: Sourced<string | undefined> | undefined;
|
|
136
|
+
readonly jmapUser: Sourced<string | undefined> | undefined;
|
|
137
|
+
readonly jmapPassword: Sourced<string | undefined> | undefined;
|
|
138
|
+
readonly jmapPasswordFile: Sourced<string | undefined> | undefined;
|
|
139
|
+
readonly jmapAccountId: Sourced<string | undefined> | undefined;
|
|
140
|
+
readonly jmapIdentityId: Sourced<string | undefined> | undefined;
|
|
141
|
+
readonly jmapBaseUrl: Sourced<string | undefined> | undefined;
|
|
142
|
+
readonly jmapTimeout: Sourced<string | undefined> | undefined;
|
|
143
|
+
readonly jmapSessionCacheTtl: Sourced<string | undefined> | undefined;
|
|
144
|
+
readonly mailTransport: Sourced<string | undefined> | undefined;
|
|
145
|
+
readonly smtpUrl: Sourced<string | undefined> | undefined;
|
|
146
|
+
readonly mailLogContent: Sourced<string | undefined> | undefined;
|
|
147
|
+
readonly smtpHost: Sourced<string | undefined> | undefined;
|
|
148
|
+
readonly smtpPort: Sourced<string | undefined> | undefined;
|
|
149
|
+
readonly smtpTls: Sourced<string | undefined> | undefined;
|
|
150
|
+
readonly smtpUser: Sourced<string | undefined> | undefined;
|
|
151
|
+
readonly smtpPassword: Sourced<string | undefined> | undefined;
|
|
152
|
+
readonly smtpPasswordFile: Sourced<string | undefined> | undefined;
|
|
153
|
+
readonly smtpAuthMethod: Sourced<string | undefined> | undefined;
|
|
154
|
+
readonly smtpAccessToken: Sourced<string | undefined> | undefined;
|
|
155
|
+
readonly smtpAccessTokenFile: Sourced<string | undefined> | undefined;
|
|
156
|
+
readonly smtpConnectionTimeout: Sourced<string | undefined> | undefined;
|
|
157
|
+
readonly smtpSocketTimeout: Sourced<string | undefined> | undefined;
|
|
158
|
+
readonly smtpPoolSize: Sourced<string | undefined> | undefined;
|
|
159
|
+
readonly smtpLocalName: Sourced<string | undefined> | undefined;
|
|
160
|
+
readonly smtpCaFile: Sourced<string | undefined> | undefined;
|
|
161
|
+
readonly smtpCertFile: Sourced<string | undefined> | undefined;
|
|
162
|
+
readonly smtpKeyFile: Sourced<string | undefined> | undefined;
|
|
163
|
+
}, {
|
|
164
|
+
readonly mailApiKey: import("@optique/core/valueparser").ValueParserResult<string> | undefined;
|
|
165
|
+
readonly mailApiKeyFile: import("@optique/core/valueparser").ValueParserResult<string> | undefined;
|
|
166
|
+
readonly plunkApiKey: import("@optique/core/valueparser").ValueParserResult<string> | undefined;
|
|
167
|
+
readonly plunkApiKeyFile: import("@optique/core/valueparser").ValueParserResult<string> | undefined;
|
|
168
|
+
readonly plunkBaseUrl: import("@optique/core/valueparser").ValueParserResult<string> | undefined;
|
|
169
|
+
readonly plunkTimeout: import("@optique/core/valueparser").ValueParserResult<number> | undefined;
|
|
170
|
+
readonly resendApiKey: import("@optique/core/valueparser").ValueParserResult<string> | undefined;
|
|
171
|
+
readonly resendApiKeyFile: import("@optique/core/valueparser").ValueParserResult<string> | undefined;
|
|
172
|
+
readonly resendBaseUrl: import("@optique/core/valueparser").ValueParserResult<string> | undefined;
|
|
173
|
+
readonly resendTimeout: import("@optique/core/valueparser").ValueParserResult<number> | undefined;
|
|
174
|
+
readonly resendRetries: import("@optique/core/valueparser").ValueParserResult<number> | undefined;
|
|
175
|
+
readonly sesAuth: import("@optique/core/valueparser").ValueParserResult<string> | undefined;
|
|
176
|
+
readonly sesAccessKeyId: import("@optique/core/valueparser").ValueParserResult<string> | undefined;
|
|
177
|
+
readonly sesAccessKeyIdFile: import("@optique/core/valueparser").ValueParserResult<string> | undefined;
|
|
178
|
+
readonly sesSecretAccessKey: import("@optique/core/valueparser").ValueParserResult<string> | undefined;
|
|
179
|
+
readonly sesSecretAccessKeyFile: import("@optique/core/valueparser").ValueParserResult<string> | undefined;
|
|
180
|
+
readonly sesSessionToken: import("@optique/core/valueparser").ValueParserResult<string> | undefined;
|
|
181
|
+
readonly sesSessionTokenFile: import("@optique/core/valueparser").ValueParserResult<string> | undefined;
|
|
182
|
+
readonly sesRegion: import("@optique/core/valueparser").ValueParserResult<string> | undefined;
|
|
183
|
+
readonly sesTimeout: import("@optique/core/valueparser").ValueParserResult<number> | undefined;
|
|
184
|
+
readonly sendgridApiKey: import("@optique/core/valueparser").ValueParserResult<string> | undefined;
|
|
185
|
+
readonly sendgridApiKeyFile: import("@optique/core/valueparser").ValueParserResult<string> | undefined;
|
|
186
|
+
readonly sendgridBaseUrl: import("@optique/core/valueparser").ValueParserResult<string> | undefined;
|
|
187
|
+
readonly sendgridTimeout: import("@optique/core/valueparser").ValueParserResult<number> | undefined;
|
|
188
|
+
readonly mailgunApiKey: import("@optique/core/valueparser").ValueParserResult<string> | undefined;
|
|
189
|
+
readonly mailgunApiKeyFile: import("@optique/core/valueparser").ValueParserResult<string> | undefined;
|
|
190
|
+
readonly mailgunDomain: import("@optique/core/valueparser").ValueParserResult<string> | undefined;
|
|
191
|
+
readonly mailgunRegion: import("@optique/core/valueparser").ValueParserResult<string> | undefined;
|
|
192
|
+
readonly mailgunBaseUrl: import("@optique/core/valueparser").ValueParserResult<string> | undefined;
|
|
193
|
+
readonly mailgunTimeout: import("@optique/core/valueparser").ValueParserResult<number> | undefined;
|
|
194
|
+
readonly mailtrapApiToken: import("@optique/core/valueparser").ValueParserResult<string> | undefined;
|
|
195
|
+
readonly mailtrapApiTokenFile: import("@optique/core/valueparser").ValueParserResult<string> | undefined;
|
|
196
|
+
readonly mailtrapSandbox: [0, import("@optique/core/parser").ParserResult<import("@optique/core/valueparser").ValueParserResult<true> | undefined>] | [1, import("@optique/core/parser").ParserResult<import("@optique/core/valueparser").ValueParserResult<true> | undefined>] | undefined;
|
|
197
|
+
readonly mailtrapInboxId: import("@optique/core/valueparser").ValueParserResult<string> | undefined;
|
|
198
|
+
readonly mailtrapSendBaseUrl: import("@optique/core/valueparser").ValueParserResult<string> | undefined;
|
|
199
|
+
readonly mailtrapSandboxBaseUrl: import("@optique/core/valueparser").ValueParserResult<string> | undefined;
|
|
200
|
+
readonly mailtrapTimeout: import("@optique/core/valueparser").ValueParserResult<number> | undefined;
|
|
201
|
+
readonly mailerooApiKey: import("@optique/core/valueparser").ValueParserResult<string> | undefined;
|
|
202
|
+
readonly mailerooApiKeyFile: import("@optique/core/valueparser").ValueParserResult<string> | undefined;
|
|
203
|
+
readonly mailerooBaseUrl: import("@optique/core/valueparser").ValueParserResult<string> | undefined;
|
|
204
|
+
readonly mailerooTimeout: import("@optique/core/valueparser").ValueParserResult<number> | undefined;
|
|
205
|
+
readonly lettermintApiToken: import("@optique/core/valueparser").ValueParserResult<string> | undefined;
|
|
206
|
+
readonly lettermintApiTokenFile: import("@optique/core/valueparser").ValueParserResult<string> | undefined;
|
|
207
|
+
readonly lettermintBaseUrl: import("@optique/core/valueparser").ValueParserResult<string> | undefined;
|
|
208
|
+
readonly lettermintRoute: import("@optique/core/valueparser").ValueParserResult<string> | undefined;
|
|
209
|
+
readonly lettermintTimeout: import("@optique/core/valueparser").ValueParserResult<number> | undefined;
|
|
210
|
+
readonly lettermintRetries: import("@optique/core/valueparser").ValueParserResult<number> | undefined;
|
|
211
|
+
readonly jmapSessionUrl: import("@optique/core/valueparser").ValueParserResult<string> | undefined;
|
|
212
|
+
readonly jmapBearerToken: import("@optique/core/valueparser").ValueParserResult<string> | undefined;
|
|
213
|
+
readonly jmapBearerTokenFile: import("@optique/core/valueparser").ValueParserResult<string> | undefined;
|
|
214
|
+
readonly jmapUser: import("@optique/core/valueparser").ValueParserResult<string> | undefined;
|
|
215
|
+
readonly jmapPassword: import("@optique/core/valueparser").ValueParserResult<string> | undefined;
|
|
216
|
+
readonly jmapPasswordFile: import("@optique/core/valueparser").ValueParserResult<string> | undefined;
|
|
217
|
+
readonly jmapAccountId: import("@optique/core/valueparser").ValueParserResult<string> | undefined;
|
|
218
|
+
readonly jmapIdentityId: import("@optique/core/valueparser").ValueParserResult<string> | undefined;
|
|
219
|
+
readonly jmapBaseUrl: import("@optique/core/valueparser").ValueParserResult<string> | undefined;
|
|
220
|
+
readonly jmapTimeout: import("@optique/core/valueparser").ValueParserResult<string> | undefined;
|
|
221
|
+
readonly jmapSessionCacheTtl: import("@optique/core/valueparser").ValueParserResult<string> | undefined;
|
|
222
|
+
readonly mailTransport: import("@optique/core/valueparser").ValueParserResult<string> | undefined;
|
|
223
|
+
readonly smtpUrl: import("@optique/core/valueparser").ValueParserResult<string> | undefined;
|
|
224
|
+
readonly mailLogContent: [0, import("@optique/core/parser").ParserResult<import("@optique/core/valueparser").ValueParserResult<true> | undefined>] | [1, import("@optique/core/parser").ParserResult<import("@optique/core/valueparser").ValueParserResult<true> | undefined>] | undefined;
|
|
225
|
+
readonly smtpHost: import("@optique/core/valueparser").ValueParserResult<string> | undefined;
|
|
226
|
+
readonly smtpPort: import("@optique/core/valueparser").ValueParserResult<number> | undefined;
|
|
227
|
+
readonly smtpTls: import("@optique/core/valueparser").ValueParserResult<string> | undefined;
|
|
228
|
+
readonly smtpUser: import("@optique/core/valueparser").ValueParserResult<string> | undefined;
|
|
229
|
+
readonly smtpPassword: import("@optique/core/valueparser").ValueParserResult<string> | undefined;
|
|
230
|
+
readonly smtpPasswordFile: import("@optique/core/valueparser").ValueParserResult<string> | undefined;
|
|
231
|
+
readonly smtpAuthMethod: import("@optique/core/valueparser").ValueParserResult<string> | undefined;
|
|
232
|
+
readonly smtpAccessToken: import("@optique/core/valueparser").ValueParserResult<string> | undefined;
|
|
233
|
+
readonly smtpAccessTokenFile: import("@optique/core/valueparser").ValueParserResult<string> | undefined;
|
|
234
|
+
readonly smtpConnectionTimeout: import("@optique/core/valueparser").ValueParserResult<number> | undefined;
|
|
235
|
+
readonly smtpSocketTimeout: import("@optique/core/valueparser").ValueParserResult<number> | undefined;
|
|
236
|
+
readonly smtpPoolSize: import("@optique/core/valueparser").ValueParserResult<number> | undefined;
|
|
237
|
+
readonly smtpLocalName: import("@optique/core/valueparser").ValueParserResult<string> | undefined;
|
|
238
|
+
readonly smtpCaFile: import("@optique/core/valueparser").ValueParserResult<string> | undefined;
|
|
239
|
+
readonly smtpCertFile: import("@optique/core/valueparser").ValueParserResult<string> | undefined;
|
|
240
|
+
readonly smtpKeyFile: import("@optique/core/valueparser").ValueParserResult<string> | undefined;
|
|
241
|
+
}>;
|
|
242
|
+
/** Parsed mail options retain source tags until variant selection. */
|
|
243
|
+
type RawMailOptions = InferValue<ReturnType<typeof createMailParser>>;
|
|
244
|
+
//#endregion
|
|
245
|
+
export { createMailParser as n, mailValueOptionNames as r, RawMailOptions as t };
|
|
246
|
+
//# sourceMappingURL=mail-parser-DyI4wuQp.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mail-parser-DyI4wuQp.d.mts","names":[],"sources":["../src/mail-parser.ts"],"mappings":";;;;cAmCa;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;WAGK;WACN;WACC;WACA;WACD;WACC;WACI;WACI;WACF;WACC;WACI;WACE;WACJ;WACL;WACC;WACH;WACE;WACD;;;;;iBAMA,iBACd,UAAU,kBAAkB,iEAA4B;uBAA9C;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;KAkOA,iBAAiB,WAAW,kBAAkB"}
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
import { configurationSettings } from "./configuration.mjs";
|
|
2
|
+
import { suggestedPath, suggestedString } from "./valueparser.mjs";
|
|
3
|
+
import { apiMailValueOptionNames, createApiMailFields } from "./api-mail-parser.mjs";
|
|
4
|
+
import { createJmapFields, jmapValueOptionNames } from "./jmap-parser.mjs";
|
|
5
|
+
import { message } from "@optique/core/message";
|
|
6
|
+
import { map } from "@optique/core/modifiers";
|
|
7
|
+
import { integer, string } from "@optique/core/valueparser";
|
|
8
|
+
import { object, or } from "@optique/core/constructs";
|
|
9
|
+
import { flag, option } from "@optique/core/primitives";
|
|
10
|
+
//#region src/mail-parser.ts
|
|
11
|
+
/** Mail value-option spellings shared by parsing and metadata arity. */
|
|
12
|
+
const mailValueOptionNames = {
|
|
13
|
+
...apiMailValueOptionNames,
|
|
14
|
+
...jmapValueOptionNames,
|
|
15
|
+
mailTransport: ["--mail-transport"],
|
|
16
|
+
smtpUrl: ["--smtp-url", "-s"],
|
|
17
|
+
smtpHost: ["--smtp-host"],
|
|
18
|
+
smtpPort: ["--smtp-port"],
|
|
19
|
+
smtpTls: ["--smtp-tls"],
|
|
20
|
+
smtpUser: ["--smtp-user"],
|
|
21
|
+
smtpPassword: ["--smtp-password"],
|
|
22
|
+
smtpPasswordFile: ["--smtp-password-file"],
|
|
23
|
+
smtpAuthMethod: ["--smtp-auth-method"],
|
|
24
|
+
smtpAccessToken: ["--smtp-access-token"],
|
|
25
|
+
smtpAccessTokenFile: ["--smtp-access-token-file"],
|
|
26
|
+
smtpConnectionTimeout: ["--smtp-connection-timeout"],
|
|
27
|
+
smtpSocketTimeout: ["--smtp-socket-timeout"],
|
|
28
|
+
smtpPoolSize: ["--smtp-pool-size"],
|
|
29
|
+
smtpLocalName: ["--smtp-local-name"],
|
|
30
|
+
smtpCaFile: ["--smtp-ca-file"],
|
|
31
|
+
smtpCertFile: ["--smtp-cert-file"],
|
|
32
|
+
smtpKeyFile: ["--smtp-key-file"]
|
|
33
|
+
};
|
|
34
|
+
/** Create source-aware mail options without transport construction or file reads.
|
|
35
|
+
* @returns The common mail parser projection.
|
|
36
|
+
*/
|
|
37
|
+
function createMailParser(bindings) {
|
|
38
|
+
const { bind } = bindings;
|
|
39
|
+
const identity = (value) => value;
|
|
40
|
+
return object("Mail delivery options", {
|
|
41
|
+
...createApiMailFields(bindings),
|
|
42
|
+
...createJmapFields(bindings),
|
|
43
|
+
mailTransport: bind(option(...mailValueOptionNames.mailTransport, suggestedString([
|
|
44
|
+
"logtape",
|
|
45
|
+
"smtp",
|
|
46
|
+
"jmap",
|
|
47
|
+
"lettermint",
|
|
48
|
+
"maileroo",
|
|
49
|
+
"mailtrap",
|
|
50
|
+
"mailgun",
|
|
51
|
+
"plunk",
|
|
52
|
+
"resend",
|
|
53
|
+
"sendgrid",
|
|
54
|
+
"ses"
|
|
55
|
+
], "TRANSPORT"), { description: message`Select logtape, smtp, jmap, lettermint, maileroo, mailtrap, mailgun, plunk, resend, sendgrid or ses. SMTP host/URL and JMAP session URL select their provider.` }), configurationSettings.mailTransport, string(), identity),
|
|
56
|
+
smtpUrl: bind(option(...mailValueOptionNames.smtpUrl, string({ metavar: "URL" }), { description: message`SMTP URL. Separate fields at a higher source override its components.` }), configurationSettings.smtpUrl, string(), identity),
|
|
57
|
+
mailLogContent: bind(map(or(flag("--mail-log-content", { description: message`Include subject and body in log-only mail output. Login codes become visible in the log.` }), map(flag("--no-mail-log-content", { description: message`Exclude mail subject and body from logs. This is the default.` }), () => false)), String), configurationSettings.mailLogContent, string(), String, "false"),
|
|
58
|
+
smtpHost: bind(option(...mailValueOptionNames.smtpHost, string({ metavar: "VALUE" }), { description: message`SMTP server hostname.` }), configurationSettings.smtpHost, string(), identity),
|
|
59
|
+
smtpPort: bind(map(option(...mailValueOptionNames.smtpPort, integer({
|
|
60
|
+
min: 1,
|
|
61
|
+
max: 65535
|
|
62
|
+
}), { description: message`SMTP server port.` }), String), configurationSettings.smtpPort, string(), String),
|
|
63
|
+
smtpTls: bind(option(...mailValueOptionNames.smtpTls, suggestedString([
|
|
64
|
+
"direct",
|
|
65
|
+
"starttls-required",
|
|
66
|
+
"opportunistic"
|
|
67
|
+
]), { description: message`SMTP TLS mode: direct, starttls-required or opportunistic.` }), configurationSettings.smtpTls, string(), identity),
|
|
68
|
+
smtpUser: bind(option(...mailValueOptionNames.smtpUser, string({ metavar: "VALUE" }), { description: message`SMTP authentication username.` }), configurationSettings.smtpUser, string(), identity),
|
|
69
|
+
smtpPassword: bind(option(...mailValueOptionNames.smtpPassword, string({ metavar: "VALUE" }), { description: message`SMTP authentication password.` }), configurationSettings.smtpPassword, string(), identity),
|
|
70
|
+
smtpPasswordFile: bind(option(...mailValueOptionNames.smtpPasswordFile, suggestedPath(), { description: message`File containing the SMTP password.` }), configurationSettings.smtpPasswordFile, string(), identity),
|
|
71
|
+
smtpAuthMethod: bind(option(...mailValueOptionNames.smtpAuthMethod, suggestedString([
|
|
72
|
+
"plain",
|
|
73
|
+
"login",
|
|
74
|
+
"xoauth2",
|
|
75
|
+
"oauthbearer"
|
|
76
|
+
]), { description: message`SMTP authentication method.` }), configurationSettings.smtpAuthMethod, string(), identity),
|
|
77
|
+
smtpAccessToken: bind(option(...mailValueOptionNames.smtpAccessToken, string({ metavar: "VALUE" }), { description: message`Static SMTP OAuth access token.` }), configurationSettings.smtpAccessToken, string(), identity),
|
|
78
|
+
smtpAccessTokenFile: bind(option(...mailValueOptionNames.smtpAccessTokenFile, suggestedPath(), { description: message`File containing the SMTP OAuth access token.` }), configurationSettings.smtpAccessTokenFile, string(), identity),
|
|
79
|
+
smtpConnectionTimeout: bind(map(option(...mailValueOptionNames.smtpConnectionTimeout, integer({
|
|
80
|
+
min: 1,
|
|
81
|
+
max: 2147483647
|
|
82
|
+
}), { description: message`SMTP connection timeout in milliseconds.` }), String), configurationSettings.smtpConnectionTimeout, string(), String),
|
|
83
|
+
smtpSocketTimeout: bind(map(option(...mailValueOptionNames.smtpSocketTimeout, integer({
|
|
84
|
+
min: 1,
|
|
85
|
+
max: 2147483647
|
|
86
|
+
}), { description: message`SMTP socket timeout in milliseconds.` }), String), configurationSettings.smtpSocketTimeout, string(), String),
|
|
87
|
+
smtpPoolSize: bind(map(option(...mailValueOptionNames.smtpPoolSize, integer({
|
|
88
|
+
min: 1,
|
|
89
|
+
max: 2147483647
|
|
90
|
+
}), { description: message`Maximum owned SMTP connections.` }), String), configurationSettings.smtpPoolSize, string(), String),
|
|
91
|
+
smtpLocalName: bind(option(...mailValueOptionNames.smtpLocalName, string({ metavar: "VALUE" }), { description: message`Local name for SMTP EHLO.` }), configurationSettings.smtpLocalName, string(), identity),
|
|
92
|
+
smtpCaFile: bind(option(...mailValueOptionNames.smtpCaFile, suggestedPath(), { description: message`File containing additional SMTP certificate authorities.` }), configurationSettings.smtpCaFile, string(), identity),
|
|
93
|
+
smtpCertFile: bind(option(...mailValueOptionNames.smtpCertFile, suggestedPath(), { description: message`File containing the SMTP client certificate.` }), configurationSettings.smtpCertFile, string(), identity),
|
|
94
|
+
smtpKeyFile: bind(option(...mailValueOptionNames.smtpKeyFile, suggestedPath(), { description: message`File containing the SMTP client private key.` }), configurationSettings.smtpKeyFile, string(), identity)
|
|
95
|
+
});
|
|
96
|
+
}
|
|
97
|
+
//#endregion
|
|
98
|
+
export { createMailParser, mailValueOptionNames };
|
|
99
|
+
|
|
100
|
+
//# sourceMappingURL=mail-parser.mjs.map
|