@prisma/composer 0.39.0-dev.12 → 0.39.0-dev.14
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{app-config-DriAu5RU-C8hYpR38.d.mts → app-config-Dhypzb6a-C3Kb0XtS.d.mts} +35 -63
- package/dist/app-config-Dhypzb6a-C3Kb0XtS.d.mts.map +1 -0
- package/dist/{app-converge-DkTFs-ih-CAr2feEu.mjs → app-converge-DFWYhyDb-BFaMPem0.mjs} +5 -5
- package/dist/app-converge-DFWYhyDb-BFaMPem0.mjs.map +1 -0
- package/dist/config-D615fYD5.d.mts +1 -0
- package/dist/config.d.mts +3 -3
- package/dist/config.mjs +12 -2
- package/dist/config.mjs.map +1 -0
- package/dist/control.d.mts +236 -16
- package/dist/control.d.mts.map +1 -1
- package/dist/control.mjs +5 -5
- package/dist/control.mjs.map +1 -1
- package/dist/{converge-in-process-x89zb2MF-Dvj-J8xo.mjs → converge-in-process-CfeblFN9-B1KvX1Fa.mjs} +4 -4
- package/dist/{converge-in-process-x89zb2MF-Dvj-J8xo.mjs.map → converge-in-process-CfeblFN9-B1KvX1Fa.mjs.map} +1 -1
- package/dist/{converge-in-process-CTomEXaD-BnDylZP8.d.mts → converge-in-process-DZRf9uYm-Ohjvy0s_.d.mts} +6 -6
- package/dist/{converge-in-process-CTomEXaD-BnDylZP8.d.mts.map → converge-in-process-DZRf9uYm-Ohjvy0s_.d.mts.map} +1 -1
- package/dist/{deploy-DHgEJDpg.d.mts → deploy-CncPyRbo.d.mts} +4 -4
- package/dist/{deploy-DHgEJDpg.d.mts.map → deploy-CncPyRbo.d.mts.map} +1 -1
- package/dist/{deploy-CSU0kr4j.mjs → deploy-DPX4IXzF.mjs} +15 -43
- package/dist/deploy-DPX4IXzF.mjs.map +1 -0
- package/dist/deploy.d.mts +4 -4
- package/dist/deploy.mjs +3 -3
- package/dist/{dev-converge-messages-DML4rTz7-C_EAB5M_.mjs → dev-converge-messages-CElmPylA-BenEozC3.mjs} +7 -7
- package/dist/dev-converge-messages-CElmPylA-BenEozC3.mjs.map +1 -0
- package/dist/dev-converge-worker.mjs +3 -3
- package/dist/dev-converge-worker.mjs.map +1 -1
- package/dist/{dev-current-C7rT6Yxw-yJ1ORrSC.mjs → dev-current-DFRg3-my-qixpmg6C.mjs} +8 -19
- package/dist/dev-current-DFRg3-my-qixpmg6C.mjs.map +1 -0
- package/dist/{dist-Cf_mZHaH.mjs → dist-Bw5O9TDx.mjs} +2 -2
- package/dist/{dist-Cf_mZHaH.mjs.map → dist-Bw5O9TDx.mjs.map} +1 -1
- package/dist/execute-deploy-destroy-CC5eDvWh-bRklcWAk.mjs +476 -0
- package/dist/execute-deploy-destroy-CC5eDvWh-bRklcWAk.mjs.map +1 -0
- package/dist/{execute-dev-BtSLDMkv-DAXRcK9h.mjs → execute-dev-_8rBPdcp-BrGpYVIu.mjs} +11 -15
- package/dist/execute-dev-_8rBPdcp-BrGpYVIu.mjs.map +1 -0
- package/dist/{execute-dev-current-LEdiAZSw-CwM41ylY.mjs → execute-dev-current-DbcTJmtG-DEZK2Oqn.mjs} +4 -4
- package/dist/{execute-dev-current-LEdiAZSw-CwM41ylY.mjs.map → execute-dev-current-DbcTJmtG-DEZK2Oqn.mjs.map} +1 -1
- package/dist/{execute-log-CzzB35KD-BBHeeC1M.mjs → execute-log-CcNIxcQt-jpflVo9o.mjs} +4 -4
- package/dist/{execute-log-CzzB35KD-BBHeeC1M.mjs.map → execute-log-CcNIxcQt-jpflVo9o.mjs.map} +1 -1
- package/dist/{graph-D2WMLL43-CeiC5wdy.mjs → graph-BYo1OEqk-D5AtX8q4.mjs} +5 -5
- package/dist/graph-BYo1OEqk-D5AtX8q4.mjs.map +1 -0
- package/dist/{graph-CUYXjK8S-BzL-mhjq.d.mts → graph-CRFQxH8r-CI1p78T8.d.mts} +3 -3
- package/dist/graph-CRFQxH8r-CI1p78T8.d.mts.map +1 -0
- package/dist/{graph-types-D4PrtP-l-B0uuchTl.d.mts → graph-types-BeNeqIt4-LGyYX_Sm.d.mts} +9 -10
- package/dist/{graph-types-D4PrtP-l-B0uuchTl.d.mts.map → graph-types-BeNeqIt4-LGyYX_Sm.d.mts.map} +1 -1
- package/dist/http.d.mts +2 -2
- package/dist/http.mjs +2 -2
- package/dist/{index-D8chHe55.d.mts → index-DOJMK47O.d.mts} +3 -3
- package/dist/{index-D8chHe55.d.mts.map → index-DOJMK47O.d.mts.map} +1 -1
- package/dist/index.d.mts +3 -3
- package/dist/index.mjs +2 -2
- package/dist/internal-converge.d.mts +4 -4
- package/dist/internal-converge.mjs +2 -2
- package/dist/{load-entry-CEoVBdMj-CHOz7jKf.mjs → load-entry-CEoVBdMj-L1mXTtEO.mjs} +5 -5
- package/dist/load-entry-CEoVBdMj-L1mXTtEO.mjs.map +1 -0
- package/dist/{local-target-7KRsLMDO.d.mts → local-target-DZFvgvVK.d.mts} +2 -2
- package/dist/{local-target-7KRsLMDO.d.mts.map → local-target-DZFvgvVK.d.mts.map} +1 -1
- package/dist/local-target.d.mts +2 -2
- package/dist/{nextjs-DLyeRR7M-CzUbvPaJ.d.mts → nextjs-DLyeRR7M-C2z32CtL.d.mts} +3 -3
- package/dist/{nextjs-DLyeRR7M-CzUbvPaJ.d.mts.map → nextjs-DLyeRR7M-C2z32CtL.d.mts.map} +1 -1
- package/dist/nextjs-control.d.mts +4 -4
- package/dist/nextjs.d.mts +1 -1
- package/dist/node-control.d.mts +3 -3
- package/dist/node.d.mts +2 -2
- package/dist/{run-report-CmBz2-xc-Cc8rV1CX.mjs → run-report-HI2JqCSO-BWPG--nb.mjs} +5 -7
- package/dist/run-report-HI2JqCSO-BWPG--nb.mjs.map +1 -0
- package/dist/service-rpc.d.mts +2 -2
- package/dist/service-rpc.mjs +2 -2
- package/dist/steps-Det-FSAL-DRvo57Lf.mjs +174 -0
- package/dist/steps-Det-FSAL-DRvo57Lf.mjs.map +1 -0
- package/dist/testing.d.mts +1 -1
- package/dist/{validate-environment-DCZiNSlR-C7lv0cH1.mjs → validate-environment-BevPErw8-BDbXIt8U.mjs} +331 -9
- package/dist/validate-environment-BevPErw8-BDbXIt8U.mjs.map +1 -0
- package/package.json +11 -14
- package/skills/prisma-composer-core-concepts/SKILL.md +6 -23
- package/dist/app-config-DriAu5RU-C8hYpR38.d.mts.map +0 -1
- package/dist/app-configuration-file-D0rB5g65-CdMrjkCc.mjs +0 -186
- package/dist/app-configuration-file-D0rB5g65-CdMrjkCc.mjs.map +0 -1
- package/dist/app-converge-DkTFs-ih-CAr2feEu.mjs.map +0 -1
- package/dist/config-Bpi8QVLB.d.mts +0 -1
- package/dist/deploy-CSU0kr4j.mjs.map +0 -1
- package/dist/deployment-summary-6LgQDUuu-Cu_6UNhc.d.mts +0 -33
- package/dist/deployment-summary-6LgQDUuu-Cu_6UNhc.d.mts.map +0 -1
- package/dist/deployment-summary-CVJZn2v0-Dz-gX1rp.mjs +0 -153
- package/dist/deployment-summary-CVJZn2v0-Dz-gX1rp.mjs.map +0 -1
- package/dist/dev-converge-messages-DML4rTz7-C_EAB5M_.mjs.map +0 -1
- package/dist/dev-current-C7rT6Yxw-yJ1ORrSC.mjs.map +0 -1
- package/dist/execute-deploy-destroy-C-aK5jh--D-AjLWc2.mjs +0 -855
- package/dist/execute-deploy-destroy-C-aK5jh--D-AjLWc2.mjs.map +0 -1
- package/dist/execute-dev-BtSLDMkv-DAXRcK9h.mjs.map +0 -1
- package/dist/graph-CUYXjK8S-BzL-mhjq.d.mts.map +0 -1
- package/dist/graph-D2WMLL43-CeiC5wdy.mjs.map +0 -1
- package/dist/internal-app-configuration-file.d.mts +0 -16
- package/dist/internal-app-configuration-file.d.mts.map +0 -1
- package/dist/internal-app-configuration-file.mjs +0 -2
- package/dist/load-entry-CEoVBdMj-CHOz7jKf.mjs.map +0 -1
- package/dist/preflight-transport-2d6iIchu-B-v7Di6I.mjs +0 -90
- package/dist/preflight-transport-2d6iIchu-B-v7Di6I.mjs.map +0 -1
- package/dist/redaction-DY6eDC12-W-FzW7_r.mjs +0 -339
- package/dist/redaction-DY6eDC12-W-FzW7_r.mjs.map +0 -1
- package/dist/redaction-Dn7BRdaP-BcLSPhLV.d.mts +0 -232
- package/dist/redaction-Dn7BRdaP-BcLSPhLV.d.mts.map +0 -1
- package/dist/report.d.mts +0 -19
- package/dist/report.d.mts.map +0 -1
- package/dist/report.mjs +0 -97
- package/dist/report.mjs.map +0 -1
- package/dist/run-report-CmBz2-xc-Cc8rV1CX.mjs.map +0 -1
- package/dist/steps-BZXNqW6U-C_ME2VLd.mjs +0 -112
- package/dist/steps-BZXNqW6U-C_ME2VLd.mjs.map +0 -1
- package/dist/validate-environment-DCZiNSlR-C7lv0cH1.mjs.map +0 -1
- package/src/exports/internal-app-configuration-file.ts +0 -1
- package/src/exports/report.ts +0 -1
|
@@ -1,339 +0,0 @@
|
|
|
1
|
-
import { t as CliStructuredError } from "./errors-DI3TBXE-.mjs";
|
|
2
|
-
import { inspect } from "node:util";
|
|
3
|
-
//#region ../../0-framework/3-tooling/cli/dist/redaction-DY6eDC12.mjs
|
|
4
|
-
const REDACTED = "[redacted]";
|
|
5
|
-
/** Env var names whose values are credentials: the service token, preflight payloads, and the usual secret spellings. */
|
|
6
|
-
const SECRET_ENV_NAME = /TOKEN|SECRET|PASSWORD|PASSWD|PRIVATE|CREDENTIAL|AUTH|API_?KEY|ACCESS_?KEY|_KEY$|DATABASE_URL|_DSN$|^PRISMA_COMPOSER_PREFLIGHT_/i;
|
|
7
|
-
/**
|
|
8
|
-
* The credential-looking values in `variables`: text of eight characters or more under a name
|
|
9
|
-
* that looks like a credential's. The length limit keeps a one-letter placeholder from blanking
|
|
10
|
-
* every matching letter.
|
|
11
|
-
*/
|
|
12
|
-
function credentialLookingValues(variables) {
|
|
13
|
-
return Object.entries(variables).flatMap(([name, value]) => SECRET_ENV_NAME.test(name) && typeof value === "string" && value.length >= 8 ? [value] : []);
|
|
14
|
-
}
|
|
15
|
-
/** `value` as it appears inside a string that `JSON.stringify` or `util.inspect` printed, where a newline, quote or backslash is escaped. */
|
|
16
|
-
function escapedForms(value) {
|
|
17
|
-
return [
|
|
18
|
-
value,
|
|
19
|
-
JSON.stringify(value).slice(1, -1),
|
|
20
|
-
inspect(value).slice(1, -1)
|
|
21
|
-
];
|
|
22
|
-
}
|
|
23
|
-
/**
|
|
24
|
-
* Finds every secret in a text, as written or as `JSON.stringify` and `util.format` escape it:
|
|
25
|
-
* one regular expression for all of them, built once. A match is the span of the longest
|
|
26
|
-
* secret that starts at a position, and spans that overlap are merged, so two overlapping
|
|
27
|
-
* secrets are hidden whole.
|
|
28
|
-
*/
|
|
29
|
-
var SecretMatcher = class {
|
|
30
|
-
starts;
|
|
31
|
-
prefixes = /* @__PURE__ */ new Set();
|
|
32
|
-
longestPrefix;
|
|
33
|
-
constructor(values) {
|
|
34
|
-
const sorted = [...new Set([...values].flatMap(escapedForms))].filter((value) => value.length > 0).sort((a, b) => b.length - a.length);
|
|
35
|
-
this.starts = sorted.length === 0 ? void 0 : new RegExp(`(?=(${sorted.map((value) => value.replace(/[.*+?^${}()|[\]\\]/g, "\\$&")).join("|")}))`, "g");
|
|
36
|
-
for (const value of sorted) for (let length = 1; length < value.length; length++) this.prefixes.add(value.slice(0, length));
|
|
37
|
-
this.longestPrefix = Math.max(0, (sorted[0]?.length ?? 0) - 1);
|
|
38
|
-
}
|
|
39
|
-
/** The merged spans of every secret in `text`, in order, as `[start, end)`. */
|
|
40
|
-
spans(text) {
|
|
41
|
-
const spans = [];
|
|
42
|
-
if (this.starts === void 0) return spans;
|
|
43
|
-
for (const match of text.matchAll(this.starts)) {
|
|
44
|
-
const start = match.index;
|
|
45
|
-
const end = start + (match[1]?.length ?? 0);
|
|
46
|
-
const last = spans.at(-1);
|
|
47
|
-
if (last !== void 0 && start < last[1]) last[1] = Math.max(last[1], end);
|
|
48
|
-
else spans.push([start, end]);
|
|
49
|
-
}
|
|
50
|
-
return spans;
|
|
51
|
-
}
|
|
52
|
-
/** The length of the longest end of `text` that is the start, not the whole, of a secret. */
|
|
53
|
-
startOfSecretAtEnd(text) {
|
|
54
|
-
for (let length = Math.min(this.longestPrefix, text.length); length > 0; length--) if (this.prefixes.has(text.slice(text.length - length))) return length;
|
|
55
|
-
return 0;
|
|
56
|
-
}
|
|
57
|
-
/** `text` with each span replaced by `[redacted]`. */
|
|
58
|
-
redact(text) {
|
|
59
|
-
let out = "";
|
|
60
|
-
let from = 0;
|
|
61
|
-
for (const [start, end] of this.spans(text)) {
|
|
62
|
-
out += text.slice(from, start) + REDACTED;
|
|
63
|
-
from = end;
|
|
64
|
-
}
|
|
65
|
-
return from === 0 ? text : out + text.slice(from);
|
|
66
|
-
}
|
|
67
|
-
};
|
|
68
|
-
/** `text` with each value in `values` replaced by `[redacted]`, at any length; an empty one is skipped. Overlapping values are hidden whole. */
|
|
69
|
-
function redactValues(text, values) {
|
|
70
|
-
return new SecretMatcher(values).redact(text);
|
|
71
|
-
}
|
|
72
|
-
/** `text` with bearer and basic tokens, JWTs, the password in a URL, and `token=…`-style pairs replaced by `[redacted]`. The `<value>` placeholder in a printed command is kept. */
|
|
73
|
-
function redactShapes(text) {
|
|
74
|
-
return text.replace(/\b(Bearer|Basic)\s+[\w.~+/=-]+/gi, `$1 ${REDACTED}`).replace(/\beyJ[\w-]+\.[\w-]+\.[\w-]*/g, REDACTED).replace(/(\b[a-z][\w+.-]*:\/\/[^\s:/@]*:)[^\s/@]+@/gi, `$1${REDACTED}@`).replace(/\b((?:[\w-]*[_-])?(?:token|secret|password|passwd|api[_-]?key|access[_-]?key|private[_-]?key)["']?\s*[:=]\s*["']?)(?!<value>(?:[\s"',;&]|$))[^\s"',;&]+/gi, `$1${REDACTED}`);
|
|
75
|
-
}
|
|
76
|
-
/**
|
|
77
|
-
* `text` with the credential-looking values of `env` and the credential shapes replaced by
|
|
78
|
-
* `[redacted]`. For a process that has no `SecretRedaction`; `SecretRedaction.redact` hides
|
|
79
|
-
* the known secrets too.
|
|
80
|
-
*/
|
|
81
|
-
function redactCredentialLooking(text, env) {
|
|
82
|
-
return redactShapes(redactValues(text, credentialLookingValues(env)));
|
|
83
|
-
}
|
|
84
|
-
/**
|
|
85
|
-
* The known secrets of one command: the values under the secrets keys the graph names, in the app
|
|
86
|
-
* secrets and the app configuration (ADR-0062). The app configuration file must not hold any of them.
|
|
87
|
-
*/
|
|
88
|
-
var KnownSecrets = class {
|
|
89
|
-
#names = /* @__PURE__ */ new Map();
|
|
90
|
-
constructor(secrets = []) {
|
|
91
|
-
this.add(secrets);
|
|
92
|
-
}
|
|
93
|
-
/** Adds each secret whose value is not empty. A value already known keeps its first name. */
|
|
94
|
-
add(secrets) {
|
|
95
|
-
for (const { name, value } of secrets) if (value.length > 0 && !this.#names.has(value)) this.#names.set(value, name);
|
|
96
|
-
}
|
|
97
|
-
values() {
|
|
98
|
-
return new Set(this.#names.keys());
|
|
99
|
-
}
|
|
100
|
-
/**
|
|
101
|
-
* The name of a known secret `text` holds, or undefined. A secret of
|
|
102
|
-
* `MIN_SECRET_LENGTH_INSIDE_A_VALUE` characters or more is found anywhere in `text`; a shorter
|
|
103
|
-
* one only when it is all of `text`.
|
|
104
|
-
*/
|
|
105
|
-
nameIn(text) {
|
|
106
|
-
for (const [value, name] of this.#names) if (value.length >= 8 ? text.includes(value) : text === value) return name;
|
|
107
|
-
}
|
|
108
|
-
};
|
|
109
|
-
/**
|
|
110
|
-
* What one command hides from everything it prints, returns or reports (ADR-0062): its known
|
|
111
|
-
* secrets, and the credential-looking values, which only look like secrets by the name of the
|
|
112
|
-
* variable they are under. It starts with the credential-looking values of the process
|
|
113
|
-
* environment.
|
|
114
|
-
*/
|
|
115
|
-
var SecretRedaction = class {
|
|
116
|
-
knownSecrets = new KnownSecrets();
|
|
117
|
-
credentialLooking = /* @__PURE__ */ new Set();
|
|
118
|
-
matcher;
|
|
119
|
-
constructor(env) {
|
|
120
|
-
this.addCredentialLookingValues(credentialLookingValues(env));
|
|
121
|
-
}
|
|
122
|
-
addKnownSecrets(secrets) {
|
|
123
|
-
this.knownSecrets.add(secrets);
|
|
124
|
-
}
|
|
125
|
-
addCredentialLookingValues(values) {
|
|
126
|
-
for (const value of values) if (value.length > 0) this.credentialLooking.add(value);
|
|
127
|
-
}
|
|
128
|
-
/** The known secrets and the credential-looking values, longest first. */
|
|
129
|
-
allValues() {
|
|
130
|
-
return [.../* @__PURE__ */ new Set([...this.knownSecrets.values(), ...this.credentialLooking])].sort((a, b) => b.length - a.length);
|
|
131
|
-
}
|
|
132
|
-
/** `text` with every known secret and credential-looking value replaced by `[redacted]` at any length, then bearer tokens, JWTs, URL passwords and `token=…` pairs. */
|
|
133
|
-
redact(text) {
|
|
134
|
-
const size = this.knownSecrets.values().size + this.credentialLooking.size;
|
|
135
|
-
if (this.matcher?.size !== size) this.matcher = {
|
|
136
|
-
size,
|
|
137
|
-
matcher: new SecretMatcher(this.allValues())
|
|
138
|
-
};
|
|
139
|
-
return redactShapes(this.matcher.matcher.redact(text));
|
|
140
|
-
}
|
|
141
|
-
};
|
|
142
|
-
/** The text under each name in `secretsKeys`, in the app configuration and in the app secrets, at any length. */
|
|
143
|
-
function valuesUnderSecretsKeys(configuration, secrets, secretsKeys) {
|
|
144
|
-
return secretsKeys.flatMap((name) => [configuration[name], secrets[name]].flatMap((value) => typeof value === "string" ? [{
|
|
145
|
-
name,
|
|
146
|
-
value
|
|
147
|
-
}] : []));
|
|
148
|
-
}
|
|
149
|
-
function redactReader(reader, redaction) {
|
|
150
|
-
switch (reader.kind) {
|
|
151
|
-
case "field": return {
|
|
152
|
-
kind: "field",
|
|
153
|
-
service: redaction.redact(reader.service),
|
|
154
|
-
path: redaction.redact(reader.path)
|
|
155
|
-
};
|
|
156
|
-
case "unread": return {
|
|
157
|
-
kind: "unread",
|
|
158
|
-
node: redaction.redact(reader.node)
|
|
159
|
-
};
|
|
160
|
-
}
|
|
161
|
-
}
|
|
162
|
-
/** `variable` with every text in it redacted: its name, each reader's names and each command. */
|
|
163
|
-
function redactUnsetPlatformVariable(variable, redaction) {
|
|
164
|
-
return {
|
|
165
|
-
name: redaction.redact(variable.name),
|
|
166
|
-
readers: variable.readers.map((reader) => redactReader(reader, redaction)),
|
|
167
|
-
commands: variable.commands.map((command) => redaction.redact(command))
|
|
168
|
-
};
|
|
169
|
-
}
|
|
170
|
-
function redactData(value, redaction) {
|
|
171
|
-
if (typeof value === "string") return redaction.redact(value);
|
|
172
|
-
if (Array.isArray(value)) return value.map((member) => redactData(member, redaction));
|
|
173
|
-
if (typeof value === "object" && value !== null && Object.getPrototypeOf(value) === Object.prototype) return Object.fromEntries(Object.entries(value).map(([key, member]) => [key, redactData(member, redaction)]));
|
|
174
|
-
return value;
|
|
175
|
-
}
|
|
176
|
-
/**
|
|
177
|
-
* `error` with every value `redaction` hides removed from its summary, `why`, `fix` and every string in
|
|
178
|
-
* its `meta`. The code, severity, `where` and docs link are kept. The cause is dropped, because
|
|
179
|
-
* it holds the same text unredacted and a renderer may print it.
|
|
180
|
-
*/
|
|
181
|
-
function redactError(error, redaction) {
|
|
182
|
-
return new CliStructuredError(error.code, redaction.redact(error.message), {
|
|
183
|
-
severity: error.severity,
|
|
184
|
-
...error.why === void 0 ? {} : { why: redaction.redact(error.why) },
|
|
185
|
-
...error.fix === void 0 ? {} : { fix: redaction.redact(error.fix) },
|
|
186
|
-
...error.where === void 0 ? {} : { where: error.where },
|
|
187
|
-
...error.meta === void 0 ? {} : { meta: Object.fromEntries(Object.entries(error.meta).map(([key, value]) => [key, redactData(value, redaction)])) },
|
|
188
|
-
...error.docsUrl === void 0 ? {} : { docsUrl: error.docsUrl }
|
|
189
|
-
});
|
|
190
|
-
}
|
|
191
|
-
function setOwn(error, name, value) {
|
|
192
|
-
Object.defineProperty(error, name, {
|
|
193
|
-
value,
|
|
194
|
-
writable: true,
|
|
195
|
-
configurable: true
|
|
196
|
-
});
|
|
197
|
-
}
|
|
198
|
-
const UNPRINTABLE = "A value was thrown that cannot be turned into text.";
|
|
199
|
-
function safeString(value) {
|
|
200
|
-
try {
|
|
201
|
-
return String(value);
|
|
202
|
-
} catch {
|
|
203
|
-
try {
|
|
204
|
-
return Object.prototype.toString.call(value);
|
|
205
|
-
} catch {
|
|
206
|
-
return UNPRINTABLE;
|
|
207
|
-
}
|
|
208
|
-
}
|
|
209
|
-
}
|
|
210
|
-
/**
|
|
211
|
-
* The error to rethrow in place of a thrown defect, with every secret removed from its message
|
|
212
|
-
* and stack, and from those of each error in its `cause` chain and in an `AggregateError`'s
|
|
213
|
-
* `errors`. A cause that is text or plain data becomes a redacted copy. Each error is redacted
|
|
214
|
-
* in place where it can be. One whose properties cannot change, such as a frozen error, is
|
|
215
|
-
* replaced by a new error with the redacted message, stack and cause. A thrown value that is not
|
|
216
|
-
* an `Error` becomes an `Error` whose message is its redacted text. Never throws: when reading
|
|
217
|
-
* the error fails, the result is a new `Error` holding the redacted text of what was thrown.
|
|
218
|
-
*/
|
|
219
|
-
function redactThrown(thrown, redaction) {
|
|
220
|
-
try {
|
|
221
|
-
return thrown instanceof Error ? redactErrorChain(thrown, redaction, /* @__PURE__ */ new Map()) : new Error(redaction.redact(safeString(thrown)));
|
|
222
|
-
} catch {
|
|
223
|
-
return new Error(redaction.redact(safeString(thrown)));
|
|
224
|
-
}
|
|
225
|
-
}
|
|
226
|
-
function redactErrorChain(error, redaction, seen) {
|
|
227
|
-
const done = seen.get(error);
|
|
228
|
-
if (done !== void 0) return done;
|
|
229
|
-
seen.set(error, error);
|
|
230
|
-
const message = redaction.redact(typeof error.message === "string" ? error.message : safeString(error.message));
|
|
231
|
-
const stack = typeof error.stack === "string" ? redaction.redact(error.stack) : void 0;
|
|
232
|
-
const cause = error.cause instanceof Error ? redactErrorChain(error.cause, redaction, seen) : redactData(error.cause, redaction);
|
|
233
|
-
const members = error instanceof AggregateError ? error.errors.map((member) => member instanceof Error ? redactErrorChain(member, redaction, seen) : redactData(member, redaction)) : void 0;
|
|
234
|
-
try {
|
|
235
|
-
setOwn(error, "message", message);
|
|
236
|
-
if (stack !== void 0) setOwn(error, "stack", stack);
|
|
237
|
-
if (error.cause !== void 0) setOwn(error, "cause", cause);
|
|
238
|
-
if (members !== void 0) setOwn(error, "errors", members);
|
|
239
|
-
return error;
|
|
240
|
-
} catch {
|
|
241
|
-
const options = cause === void 0 ? void 0 : { cause };
|
|
242
|
-
const copy = members === void 0 ? new Error(message, options) : new AggregateError(members, message, options);
|
|
243
|
-
copy.name = error.name;
|
|
244
|
-
setOwn(copy, "stack", stack ?? `${error.name}: ${message}`);
|
|
245
|
-
seen.set(error, copy);
|
|
246
|
-
return copy;
|
|
247
|
-
}
|
|
248
|
-
}
|
|
249
|
-
/** `event` with every value `redaction` hides removed from the text it carries: a message, an Alchemy log line, a converge failure's reasons, or a dev server's output line. */
|
|
250
|
-
function redactDevEvent(event, redaction) {
|
|
251
|
-
switch (event.kind) {
|
|
252
|
-
case "target-warning":
|
|
253
|
-
case "rebuild-failed":
|
|
254
|
-
case "watch-error":
|
|
255
|
-
case "stop-error": return {
|
|
256
|
-
...event,
|
|
257
|
-
message: redaction.redact(event.message)
|
|
258
|
-
};
|
|
259
|
-
case "message": return {
|
|
260
|
-
...event,
|
|
261
|
-
text: redaction.redact(event.text)
|
|
262
|
-
};
|
|
263
|
-
case "converge-failed": return {
|
|
264
|
-
...event,
|
|
265
|
-
message: redaction.redact(event.message),
|
|
266
|
-
reasons: event.reasons.map(({ tag, message }) => ({
|
|
267
|
-
tag,
|
|
268
|
-
message: redaction.redact(message)
|
|
269
|
-
}))
|
|
270
|
-
};
|
|
271
|
-
case "dev-server-output": return {
|
|
272
|
-
...event,
|
|
273
|
-
line: redaction.redact(event.line)
|
|
274
|
-
};
|
|
275
|
-
default: return event;
|
|
276
|
-
}
|
|
277
|
-
}
|
|
278
|
-
/** `summary` with every value `redaction` hides removed from each entity's id, url and details. */
|
|
279
|
-
function redactSummary(summary, redaction) {
|
|
280
|
-
if (summary === void 0) return void 0;
|
|
281
|
-
return {
|
|
282
|
-
app: summary.app,
|
|
283
|
-
findings: { unset: summary.findings.unset.map((variable) => redactUnsetPlatformVariable(variable, redaction)) },
|
|
284
|
-
nodes: summary.nodes.map((node) => ({
|
|
285
|
-
address: node.address,
|
|
286
|
-
entities: node.entities.map((entity) => ({
|
|
287
|
-
...entity,
|
|
288
|
-
id: redaction.redact(entity.id),
|
|
289
|
-
...entity.url === void 0 ? {} : { url: redaction.redact(entity.url) },
|
|
290
|
-
...entity.details === void 0 ? {} : { details: Object.fromEntries(Object.entries(entity.details).map(([key, value]) => [key, redaction.redact(value)])) }
|
|
291
|
-
}))
|
|
292
|
-
}))
|
|
293
|
-
};
|
|
294
|
-
}
|
|
295
|
-
function isHighSurrogate(code) {
|
|
296
|
-
return code >= 55296 && code <= 56319;
|
|
297
|
-
}
|
|
298
|
-
/**
|
|
299
|
-
* Redacts a stream of text chunk by chunk: every value in `values` becomes `[redacted]`, and
|
|
300
|
-
* overlapping values are hidden whole. It holds back only the end of the text that could still
|
|
301
|
-
* be part of a value: the longest end that could start one, or a match that a later value could
|
|
302
|
-
* extend. So a value split across two chunks is still replaced, and text that cannot start one,
|
|
303
|
-
* such as a prompt, is returned at once. It never splits a surrogate pair. `push` returns the
|
|
304
|
-
* text that is ready; `end` returns the rest.
|
|
305
|
-
*/
|
|
306
|
-
var StreamRedactor = class {
|
|
307
|
-
held = "";
|
|
308
|
-
matcher;
|
|
309
|
-
constructor(values) {
|
|
310
|
-
this.matcher = new SecretMatcher(values);
|
|
311
|
-
}
|
|
312
|
-
push(chunk) {
|
|
313
|
-
const text = this.held + chunk;
|
|
314
|
-
const cut = text.length - this.matcher.startOfSecretAtEnd(text);
|
|
315
|
-
let out = "";
|
|
316
|
-
let from = 0;
|
|
317
|
-
let ready = cut;
|
|
318
|
-
for (const [start, end] of this.matcher.spans(text)) {
|
|
319
|
-
if (end > cut) {
|
|
320
|
-
ready = Math.min(cut, start);
|
|
321
|
-
break;
|
|
322
|
-
}
|
|
323
|
-
out += text.slice(from, start) + REDACTED;
|
|
324
|
-
from = end;
|
|
325
|
-
}
|
|
326
|
-
if (ready > from && ready < text.length && isHighSurrogate(text.charCodeAt(ready - 1))) ready -= 1;
|
|
327
|
-
this.held = text.slice(ready);
|
|
328
|
-
return out + text.slice(from, ready);
|
|
329
|
-
}
|
|
330
|
-
end() {
|
|
331
|
-
const text = this.held;
|
|
332
|
-
this.held = "";
|
|
333
|
-
return this.matcher.redact(text);
|
|
334
|
-
}
|
|
335
|
-
};
|
|
336
|
-
//#endregion
|
|
337
|
-
export { redactDevEvent as a, redactThrown as c, redactCredentialLooking as i, redactUnsetPlatformVariable as l, StreamRedactor as n, redactError as o, credentialLookingValues as r, redactSummary as s, SecretRedaction as t, valuesUnderSecretsKeys as u };
|
|
338
|
-
|
|
339
|
-
//# sourceMappingURL=redaction-DY6eDC12-W-FzW7_r.mjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"redaction-DY6eDC12-W-FzW7_r.mjs","names":["#names"],"sources":["../../../0-framework/3-tooling/cli/dist/redaction-DY6eDC12.mjs"],"sourcesContent":["import { CliStructuredError } from \"@internal/foundation/errors\";\nimport { inspect } from \"node:util\";\n//#region src/redaction.ts\nconst REDACTED = \"[redacted]\";\n/** Env var names whose values are credentials: the service token, preflight payloads, and the usual secret spellings. */\nconst SECRET_ENV_NAME = /TOKEN|SECRET|PASSWORD|PASSWD|PRIVATE|CREDENTIAL|AUTH|API_?KEY|ACCESS_?KEY|_KEY$|DATABASE_URL|_DSN$|^PRISMA_COMPOSER_PREFLIGHT_/i;\n/**\n* The credential-looking values in `variables`: text of eight characters or more under a name\n* that looks like a credential's. The length limit keeps a one-letter placeholder from blanking\n* every matching letter.\n*/\nfunction credentialLookingValues(variables) {\n\treturn Object.entries(variables).flatMap(([name, value]) => SECRET_ENV_NAME.test(name) && typeof value === \"string\" && value.length >= 8 ? [value] : []);\n}\n/** `value` as it appears inside a string that `JSON.stringify` or `util.inspect` printed, where a newline, quote or backslash is escaped. */\nfunction escapedForms(value) {\n\treturn [\n\t\tvalue,\n\t\tJSON.stringify(value).slice(1, -1),\n\t\tinspect(value).slice(1, -1)\n\t];\n}\n/**\n* Finds every secret in a text, as written or as `JSON.stringify` and `util.format` escape it:\n* one regular expression for all of them, built once. A match is the span of the longest\n* secret that starts at a position, and spans that overlap are merged, so two overlapping\n* secrets are hidden whole.\n*/\nvar SecretMatcher = class {\n\tstarts;\n\tprefixes = /* @__PURE__ */ new Set();\n\tlongestPrefix;\n\tconstructor(values) {\n\t\tconst sorted = [...new Set([...values].flatMap(escapedForms))].filter((value) => value.length > 0).sort((a, b) => b.length - a.length);\n\t\tthis.starts = sorted.length === 0 ? void 0 : new RegExp(`(?=(${sorted.map((value) => value.replace(/[.*+?^${}()|[\\]\\\\]/g, \"\\\\$&\")).join(\"|\")}))`, \"g\");\n\t\tfor (const value of sorted) for (let length = 1; length < value.length; length++) this.prefixes.add(value.slice(0, length));\n\t\tthis.longestPrefix = Math.max(0, (sorted[0]?.length ?? 0) - 1);\n\t}\n\t/** The merged spans of every secret in `text`, in order, as `[start, end)`. */\n\tspans(text) {\n\t\tconst spans = [];\n\t\tif (this.starts === void 0) return spans;\n\t\tfor (const match of text.matchAll(this.starts)) {\n\t\t\tconst start = match.index;\n\t\t\tconst end = start + (match[1]?.length ?? 0);\n\t\t\tconst last = spans.at(-1);\n\t\t\tif (last !== void 0 && start < last[1]) last[1] = Math.max(last[1], end);\n\t\t\telse spans.push([start, end]);\n\t\t}\n\t\treturn spans;\n\t}\n\t/** The length of the longest end of `text` that is the start, not the whole, of a secret. */\n\tstartOfSecretAtEnd(text) {\n\t\tfor (let length = Math.min(this.longestPrefix, text.length); length > 0; length--) if (this.prefixes.has(text.slice(text.length - length))) return length;\n\t\treturn 0;\n\t}\n\t/** `text` with each span replaced by `[redacted]`. */\n\tredact(text) {\n\t\tlet out = \"\";\n\t\tlet from = 0;\n\t\tfor (const [start, end] of this.spans(text)) {\n\t\t\tout += text.slice(from, start) + REDACTED;\n\t\t\tfrom = end;\n\t\t}\n\t\treturn from === 0 ? text : out + text.slice(from);\n\t}\n};\n/** `text` with each value in `values` replaced by `[redacted]`, at any length; an empty one is skipped. Overlapping values are hidden whole. */\nfunction redactValues(text, values) {\n\treturn new SecretMatcher(values).redact(text);\n}\n/** `text` with bearer and basic tokens, JWTs, the password in a URL, and `token=…`-style pairs replaced by `[redacted]`. The `<value>` placeholder in a printed command is kept. */\nfunction redactShapes(text) {\n\treturn text.replace(/\\b(Bearer|Basic)\\s+[\\w.~+/=-]+/gi, `$1 ${REDACTED}`).replace(/\\beyJ[\\w-]+\\.[\\w-]+\\.[\\w-]*/g, REDACTED).replace(/(\\b[a-z][\\w+.-]*:\\/\\/[^\\s:/@]*:)[^\\s/@]+@/gi, `$1${REDACTED}@`).replace(/\\b((?:[\\w-]*[_-])?(?:token|secret|password|passwd|api[_-]?key|access[_-]?key|private[_-]?key)[\"']?\\s*[:=]\\s*[\"']?)(?!<value>(?:[\\s\"',;&]|$))[^\\s\"',;&]+/gi, `$1${REDACTED}`);\n}\n/**\n* `text` with the credential-looking values of `env` and the credential shapes replaced by\n* `[redacted]`. For a process that has no `SecretRedaction`; `SecretRedaction.redact` hides\n* the known secrets too.\n*/\nfunction redactCredentialLooking(text, env) {\n\treturn redactShapes(redactValues(text, credentialLookingValues(env)));\n}\n/**\n* The known secrets of one command: the values under the secrets keys the graph names, in the app\n* secrets and the app configuration (ADR-0062). The app configuration file must not hold any of them.\n*/\nvar KnownSecrets = class {\n\t#names = /* @__PURE__ */ new Map();\n\tconstructor(secrets = []) {\n\t\tthis.add(secrets);\n\t}\n\t/** Adds each secret whose value is not empty. A value already known keeps its first name. */\n\tadd(secrets) {\n\t\tfor (const { name, value } of secrets) if (value.length > 0 && !this.#names.has(value)) this.#names.set(value, name);\n\t}\n\tvalues() {\n\t\treturn new Set(this.#names.keys());\n\t}\n\t/**\n\t* The name of a known secret `text` holds, or undefined. A secret of\n\t* `MIN_SECRET_LENGTH_INSIDE_A_VALUE` characters or more is found anywhere in `text`; a shorter\n\t* one only when it is all of `text`.\n\t*/\n\tnameIn(text) {\n\t\tfor (const [value, name] of this.#names) if (value.length >= 8 ? text.includes(value) : text === value) return name;\n\t}\n};\n/**\n* What one command hides from everything it prints, returns or reports (ADR-0062): its known\n* secrets, and the credential-looking values, which only look like secrets by the name of the\n* variable they are under. It starts with the credential-looking values of the process\n* environment.\n*/\nvar SecretRedaction = class {\n\tknownSecrets = new KnownSecrets();\n\tcredentialLooking = /* @__PURE__ */ new Set();\n\tmatcher;\n\tconstructor(env) {\n\t\tthis.addCredentialLookingValues(credentialLookingValues(env));\n\t}\n\taddKnownSecrets(secrets) {\n\t\tthis.knownSecrets.add(secrets);\n\t}\n\taddCredentialLookingValues(values) {\n\t\tfor (const value of values) if (value.length > 0) this.credentialLooking.add(value);\n\t}\n\t/** The known secrets and the credential-looking values, longest first. */\n\tallValues() {\n\t\treturn [.../* @__PURE__ */ new Set([...this.knownSecrets.values(), ...this.credentialLooking])].sort((a, b) => b.length - a.length);\n\t}\n\t/** `text` with every known secret and credential-looking value replaced by `[redacted]` at any length, then bearer tokens, JWTs, URL passwords and `token=…` pairs. */\n\tredact(text) {\n\t\tconst size = this.knownSecrets.values().size + this.credentialLooking.size;\n\t\tif (this.matcher?.size !== size) this.matcher = {\n\t\t\tsize,\n\t\t\tmatcher: new SecretMatcher(this.allValues())\n\t\t};\n\t\treturn redactShapes(this.matcher.matcher.redact(text));\n\t}\n};\n/** The text under each name in `secretsKeys`, in the app configuration and in the app secrets, at any length. */\nfunction valuesUnderSecretsKeys(configuration, secrets, secretsKeys) {\n\treturn secretsKeys.flatMap((name) => [configuration[name], secrets[name]].flatMap((value) => typeof value === \"string\" ? [{\n\t\tname,\n\t\tvalue\n\t}] : []));\n}\nfunction redactReader(reader, redaction) {\n\tswitch (reader.kind) {\n\t\tcase \"field\": return {\n\t\t\tkind: \"field\",\n\t\t\tservice: redaction.redact(reader.service),\n\t\t\tpath: redaction.redact(reader.path)\n\t\t};\n\t\tcase \"unread\": return {\n\t\t\tkind: \"unread\",\n\t\t\tnode: redaction.redact(reader.node)\n\t\t};\n\t}\n}\n/** `variable` with every text in it redacted: its name, each reader's names and each command. */\nfunction redactUnsetPlatformVariable(variable, redaction) {\n\treturn {\n\t\tname: redaction.redact(variable.name),\n\t\treaders: variable.readers.map((reader) => redactReader(reader, redaction)),\n\t\tcommands: variable.commands.map((command) => redaction.redact(command))\n\t};\n}\nfunction redactData(value, redaction) {\n\tif (typeof value === \"string\") return redaction.redact(value);\n\tif (Array.isArray(value)) return value.map((member) => redactData(member, redaction));\n\tif (typeof value === \"object\" && value !== null && Object.getPrototypeOf(value) === Object.prototype) return Object.fromEntries(Object.entries(value).map(([key, member]) => [key, redactData(member, redaction)]));\n\treturn value;\n}\n/**\n* `error` with every value `redaction` hides removed from its summary, `why`, `fix` and every string in\n* its `meta`. The code, severity, `where` and docs link are kept. The cause is dropped, because\n* it holds the same text unredacted and a renderer may print it.\n*/\nfunction redactError(error, redaction) {\n\treturn new CliStructuredError(error.code, redaction.redact(error.message), {\n\t\tseverity: error.severity,\n\t\t...error.why === void 0 ? {} : { why: redaction.redact(error.why) },\n\t\t...error.fix === void 0 ? {} : { fix: redaction.redact(error.fix) },\n\t\t...error.where === void 0 ? {} : { where: error.where },\n\t\t...error.meta === void 0 ? {} : { meta: Object.fromEntries(Object.entries(error.meta).map(([key, value]) => [key, redactData(value, redaction)])) },\n\t\t...error.docsUrl === void 0 ? {} : { docsUrl: error.docsUrl }\n\t});\n}\nfunction setOwn(error, name, value) {\n\tObject.defineProperty(error, name, {\n\t\tvalue,\n\t\twritable: true,\n\t\tconfigurable: true\n\t});\n}\nconst UNPRINTABLE = \"A value was thrown that cannot be turned into text.\";\nfunction safeString(value) {\n\ttry {\n\t\treturn String(value);\n\t} catch {\n\t\ttry {\n\t\t\treturn Object.prototype.toString.call(value);\n\t\t} catch {\n\t\t\treturn UNPRINTABLE;\n\t\t}\n\t}\n}\n/**\n* The error to rethrow in place of a thrown defect, with every secret removed from its message\n* and stack, and from those of each error in its `cause` chain and in an `AggregateError`'s\n* `errors`. A cause that is text or plain data becomes a redacted copy. Each error is redacted\n* in place where it can be. One whose properties cannot change, such as a frozen error, is\n* replaced by a new error with the redacted message, stack and cause. A thrown value that is not\n* an `Error` becomes an `Error` whose message is its redacted text. Never throws: when reading\n* the error fails, the result is a new `Error` holding the redacted text of what was thrown.\n*/\nfunction redactThrown(thrown, redaction) {\n\ttry {\n\t\treturn thrown instanceof Error ? redactErrorChain(thrown, redaction, /* @__PURE__ */ new Map()) : new Error(redaction.redact(safeString(thrown)));\n\t} catch {\n\t\treturn new Error(redaction.redact(safeString(thrown)));\n\t}\n}\nfunction redactErrorChain(error, redaction, seen) {\n\tconst done = seen.get(error);\n\tif (done !== void 0) return done;\n\tseen.set(error, error);\n\tconst message = redaction.redact(typeof error.message === \"string\" ? error.message : safeString(error.message));\n\tconst stack = typeof error.stack === \"string\" ? redaction.redact(error.stack) : void 0;\n\tconst cause = error.cause instanceof Error ? redactErrorChain(error.cause, redaction, seen) : redactData(error.cause, redaction);\n\tconst members = error instanceof AggregateError ? error.errors.map((member) => member instanceof Error ? redactErrorChain(member, redaction, seen) : redactData(member, redaction)) : void 0;\n\ttry {\n\t\tsetOwn(error, \"message\", message);\n\t\tif (stack !== void 0) setOwn(error, \"stack\", stack);\n\t\tif (error.cause !== void 0) setOwn(error, \"cause\", cause);\n\t\tif (members !== void 0) setOwn(error, \"errors\", members);\n\t\treturn error;\n\t} catch {\n\t\tconst options = cause === void 0 ? void 0 : { cause };\n\t\tconst copy = members === void 0 ? new Error(message, options) : new AggregateError(members, message, options);\n\t\tcopy.name = error.name;\n\t\tsetOwn(copy, \"stack\", stack ?? `${error.name}: ${message}`);\n\t\tseen.set(error, copy);\n\t\treturn copy;\n\t}\n}\n/** `event` with every value `redaction` hides removed from the text it carries: a message, an Alchemy log line, a converge failure's reasons, or a dev server's output line. */\nfunction redactDevEvent(event, redaction) {\n\tswitch (event.kind) {\n\t\tcase \"target-warning\":\n\t\tcase \"rebuild-failed\":\n\t\tcase \"watch-error\":\n\t\tcase \"stop-error\": return {\n\t\t\t...event,\n\t\t\tmessage: redaction.redact(event.message)\n\t\t};\n\t\tcase \"message\": return {\n\t\t\t...event,\n\t\t\ttext: redaction.redact(event.text)\n\t\t};\n\t\tcase \"converge-failed\": return {\n\t\t\t...event,\n\t\t\tmessage: redaction.redact(event.message),\n\t\t\treasons: event.reasons.map(({ tag, message }) => ({\n\t\t\t\ttag,\n\t\t\t\tmessage: redaction.redact(message)\n\t\t\t}))\n\t\t};\n\t\tcase \"dev-server-output\": return {\n\t\t\t...event,\n\t\t\tline: redaction.redact(event.line)\n\t\t};\n\t\tdefault: return event;\n\t}\n}\n/** `summary` with every value `redaction` hides removed from each entity's id, url and details. */\nfunction redactSummary(summary, redaction) {\n\tif (summary === void 0) return void 0;\n\treturn {\n\t\tapp: summary.app,\n\t\tfindings: { unset: summary.findings.unset.map((variable) => redactUnsetPlatformVariable(variable, redaction)) },\n\t\tnodes: summary.nodes.map((node) => ({\n\t\t\taddress: node.address,\n\t\t\tentities: node.entities.map((entity) => ({\n\t\t\t\t...entity,\n\t\t\t\tid: redaction.redact(entity.id),\n\t\t\t\t...entity.url === void 0 ? {} : { url: redaction.redact(entity.url) },\n\t\t\t\t...entity.details === void 0 ? {} : { details: Object.fromEntries(Object.entries(entity.details).map(([key, value]) => [key, redaction.redact(value)])) }\n\t\t\t}))\n\t\t}))\n\t};\n}\nfunction isHighSurrogate(code) {\n\treturn code >= 55296 && code <= 56319;\n}\n/**\n* Redacts a stream of text chunk by chunk: every value in `values` becomes `[redacted]`, and\n* overlapping values are hidden whole. It holds back only the end of the text that could still\n* be part of a value: the longest end that could start one, or a match that a later value could\n* extend. So a value split across two chunks is still replaced, and text that cannot start one,\n* such as a prompt, is returned at once. It never splits a surrogate pair. `push` returns the\n* text that is ready; `end` returns the rest.\n*/\nvar StreamRedactor = class {\n\theld = \"\";\n\tmatcher;\n\tconstructor(values) {\n\t\tthis.matcher = new SecretMatcher(values);\n\t}\n\tpush(chunk) {\n\t\tconst text = this.held + chunk;\n\t\tconst cut = text.length - this.matcher.startOfSecretAtEnd(text);\n\t\tlet out = \"\";\n\t\tlet from = 0;\n\t\tlet ready = cut;\n\t\tfor (const [start, end] of this.matcher.spans(text)) {\n\t\t\tif (end > cut) {\n\t\t\t\tready = Math.min(cut, start);\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tout += text.slice(from, start) + REDACTED;\n\t\t\tfrom = end;\n\t\t}\n\t\tif (ready > from && ready < text.length && isHighSurrogate(text.charCodeAt(ready - 1))) ready -= 1;\n\t\tthis.held = text.slice(ready);\n\t\treturn out + text.slice(from, ready);\n\t}\n\tend() {\n\t\tconst text = this.held;\n\t\tthis.held = \"\";\n\t\treturn this.matcher.redact(text);\n\t}\n};\n//#endregion\nexport { redactDevEvent as a, redactThrown as c, redactCredentialLooking as i, redactUnsetPlatformVariable as l, StreamRedactor as n, redactError as o, credentialLookingValues as r, redactSummary as s, SecretRedaction as t, valuesUnderSecretsKeys as u };\n\n//# sourceMappingURL=redaction-DY6eDC12.mjs.map"],"mappings":";;;AAGA,MAAM,WAAW;;AAEjB,MAAM,kBAAkB;;;;;;AAMxB,SAAS,wBAAwB,WAAW;CAC3C,OAAO,OAAO,QAAQ,SAAS,CAAC,CAAC,SAAS,CAAC,MAAM,WAAW,gBAAgB,KAAK,IAAI,KAAK,OAAO,UAAU,YAAY,MAAM,UAAU,IAAI,CAAC,KAAK,IAAI,CAAC,CAAC;AACxJ;;AAEA,SAAS,aAAa,OAAO;CAC5B,OAAO;EACN;EACA,KAAK,UAAU,KAAK,CAAC,CAAC,MAAM,GAAG,EAAE;EACjC,QAAQ,KAAK,CAAC,CAAC,MAAM,GAAG,EAAE;CAC3B;AACD;;;;;;;AAOA,IAAI,gBAAgB,MAAM;CACzB;CACA,2BAA2B,IAAI,IAAI;CACnC;CACA,YAAY,QAAQ;EACnB,MAAM,SAAS,CAAC,GAAG,IA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AY,OAAO,QAAQ,OAAO,OAAO,CAAC,CAAC,KAAK,CAAC,KAAK,WAAW,CAAC,KAAK,UAAU,OAAO,KAAK,CAAC,CAAC,CAAC,EAAE;GACzJ,EAAE;EACH,EAAE;CACH;AACD;AACA,SAAS,gBAAgB,MAAM;CAC9B,OAAO,QAAQ,SAAS,QAAQ;AACjC;;;;;;;;;AASA,IAAI,iBAAiB,MAAM;CAC1B,OAAO;CACP;CACA,YAAY,QAAQ;EACnB,KAAK,UAAU,IAAI,cAAc,MAAM;CACxC;CACA,KAAK,OAAO;EACX,MAAM,OAAO,KAAK,OAAO;EACzB,MAAM,MAAM,KAAK,SAAS,KAAK,QAAQ,mBAAmB,IAAI;EAC9D,IAAI,MAAM;EACV,IAAI,OAAO;EACX,IAAI,QAAQ;EACZ,KAAK,MAAM,CAAC,OAAO,QAAQ,KAAK,QAAQ,MAAM,IAAI,GAAG;GACpD,IAAI,MAAM,KAAK;IACd,QAAQ,KAAK,IAAI,KAAK,KAAK;IAC3B;GACD;GACA,OAAO,KAAK,MAAM,MAAM,KAAK,IAAI;GACjC,OAAO;EACR;EACA,IAAI,QAAQ,QAAQ,QAAQ,KAAK,UAAU,gBAAgB,KAAK,WAAW,QAAQ,CAAC,CAAC,GAAG,SAAS;EACjG,KAAK,OAAO,KAAK,MAAM,KAAK;EAC5B,OAAO,MAAM,KAAK,MAAM,MAAM,KAAK;CACpC;CACA,MAAM;EACL,MAAM,OAAO,KAAK;EAClB,KAAK,OAAO;EACZ,OAAO,KAAK,QAAQ,OAAO,IAAI;CAChC;AACD"}
|
|
@@ -1,232 +0,0 @@
|
|
|
1
|
-
import { Rt as CliStructuredError } from "./graph-types-D4PrtP-l-B0uuchTl.mjs";
|
|
2
|
-
import { J as PrismaAppConfig } from "./app-config-DriAu5RU-C8hYpR38.mjs";
|
|
3
|
-
import "./config-Bpi8QVLB.mjs";
|
|
4
|
-
import "./deploy-DHgEJDpg.mjs";
|
|
5
|
-
import "./deployment-summary-6LgQDUuu-Cu_6UNhc.mjs";
|
|
6
|
-
import "./converge-in-process-CTomEXaD-BnDylZP8.mjs";
|
|
7
|
-
import "./index-D8chHe55.mjs";
|
|
8
|
-
import "./local-target-7KRsLMDO.mjs";
|
|
9
|
-
//#region ../../0-framework/0-foundation/foundation/dist/result.d.mts
|
|
10
|
-
//#region src/result.d.ts
|
|
11
|
-
/**
|
|
12
|
-
* Represents a successful result containing a value.
|
|
13
|
-
*/
|
|
14
|
-
interface Ok<T> {
|
|
15
|
-
readonly ok: true;
|
|
16
|
-
readonly value: T;
|
|
17
|
-
assertOk(): T;
|
|
18
|
-
assertNotOk(): never;
|
|
19
|
-
}
|
|
20
|
-
/**
|
|
21
|
-
* Represents an unsuccessful result containing failure details.
|
|
22
|
-
*/
|
|
23
|
-
interface NotOk<F> {
|
|
24
|
-
readonly ok: false;
|
|
25
|
-
readonly failure: F;
|
|
26
|
-
assertOk(): never;
|
|
27
|
-
assertNotOk(): F;
|
|
28
|
-
}
|
|
29
|
-
/**
|
|
30
|
-
* A discriminated union representing either success (Ok) or failure (NotOk).
|
|
31
|
-
*
|
|
32
|
-
* @typeParam T - The success value type
|
|
33
|
-
* @typeParam F - The failure details type
|
|
34
|
-
*/
|
|
35
|
-
type Result<T, F> = Ok<T> | NotOk<F>;
|
|
36
|
-
//#endregion
|
|
37
|
-
//#region ../../0-framework/3-tooling/cli/dist/redaction-Dn7BRdaP.d.mts
|
|
38
|
-
//#region src/composer-config.d.ts
|
|
39
|
-
/** Composer's configuration and the `prisma.config.ts` that declares it. */
|
|
40
|
-
interface ComposerConfigSource {
|
|
41
|
-
/** The `composer` section: the `composer` property of that file's default export. */
|
|
42
|
-
readonly value: PrismaAppConfig;
|
|
43
|
-
/** The declaring `prisma.config.ts`. The deploy's generated stack file imports it. A relative path resolves against the operation's `cwd`. */
|
|
44
|
-
readonly file: string;
|
|
45
|
-
}
|
|
46
|
-
//#endregion
|
|
47
|
-
//#region src/operations/shared.d.ts
|
|
48
|
-
/** A running service's dotted address plus its local URL — what `dev` reports
|
|
49
|
-
* as the front door and `log` reports as the tailable services. */
|
|
50
|
-
interface ServiceEndpoint {
|
|
51
|
-
readonly address: string;
|
|
52
|
-
readonly url: string;
|
|
53
|
-
/** The dev server the service runs in place of its artifact, as its build adapter displays it (`next dev`) — absent for a service that runs its artifact (ADR-0056). */
|
|
54
|
-
readonly devServer?: string;
|
|
55
|
-
}
|
|
56
|
-
/**
|
|
57
|
-
* Where a failed execution left its artifacts — details of the CURRENT
|
|
58
|
-
* execution mechanism (a spawned deploy-engine child driving a generated
|
|
59
|
-
* stack file), for hosts that want to print a reproduce hint. The mechanism
|
|
60
|
-
* is not part of the surface's contract, so these fields may change or
|
|
61
|
-
* disappear if the mechanism does; branch on `code`/`message`/`cause` for
|
|
62
|
-
* anything durable.
|
|
63
|
-
*/
|
|
64
|
-
interface ExecutionDiagnostics {
|
|
65
|
-
/** The child's exit status; undefined means the spawn itself threw, or the
|
|
66
|
-
* child was killed by a signal (`signal` then names it). */
|
|
67
|
-
readonly exitCode: number | undefined;
|
|
68
|
-
/** The signal that killed the child, when one did. A signal-killed converge
|
|
69
|
-
* is an abort the user asked for, not a failure of the deploy — a host
|
|
70
|
-
* should report it as an interruption and print no reproduce hint. */
|
|
71
|
-
readonly signal?: string | undefined;
|
|
72
|
-
readonly stackFilePath: string;
|
|
73
|
-
readonly reproduceCommand: string;
|
|
74
|
-
readonly cwd: string;
|
|
75
|
-
}
|
|
76
|
-
/**
|
|
77
|
-
* Reads the execution diagnostics an engine-failure error carries in
|
|
78
|
-
* `meta.diagnostics`; undefined for every other failure.
|
|
79
|
-
*/
|
|
80
|
-
declare function executionDiagnostics(f: CliStructuredError): ExecutionDiagnostics | undefined;
|
|
81
|
-
//#endregion
|
|
82
|
-
//#region src/operations/steps.d.ts
|
|
83
|
-
/** A step event, over the operation's own step type. */
|
|
84
|
-
type StepEvent<Step> = {
|
|
85
|
-
readonly kind: 'step-started';
|
|
86
|
-
readonly step: Step;
|
|
87
|
-
} | {
|
|
88
|
-
readonly kind: 'message';
|
|
89
|
-
readonly severity: 'info' | 'warn' | 'verbose';
|
|
90
|
-
/** A line Alchemy logged while it planned or applied. */
|
|
91
|
-
readonly text: string;
|
|
92
|
-
} | {
|
|
93
|
-
readonly kind: 'step-finished';
|
|
94
|
-
readonly step: Step;
|
|
95
|
-
readonly outcome: 'ok' | 'failed';
|
|
96
|
-
readonly durationMs: number;
|
|
97
|
-
/** What the step measured, as its build adapter or deploy target reported it. The fields vary by adapter and target. */
|
|
98
|
-
readonly data?: Readonly<Record<string, string | number>> | undefined;
|
|
99
|
-
};
|
|
100
|
-
//#endregion
|
|
101
|
-
//#region src/operations/dev.d.ts
|
|
102
|
-
/** A step of a converge. Each converge is one `converge` step, `dev.converge` for the first and `dev.rebuild.<n>` for the n-th rebuild, and each resource Alchemy touches is an `apply-resource` step inside it. */
|
|
103
|
-
type DevStep = {
|
|
104
|
-
readonly name: 'converge';
|
|
105
|
-
readonly id: string;
|
|
106
|
-
} | {
|
|
107
|
-
readonly name: 'apply-resource';
|
|
108
|
-
/** The id of the converge step it belongs to. */
|
|
109
|
-
readonly converge: string;
|
|
110
|
-
/** The resource's ID (ADR-0057): its node's address, or the address and the resource's role in that node. */
|
|
111
|
-
readonly resourceId: string;
|
|
112
|
-
readonly resourceType: string;
|
|
113
|
-
/** Alchemy's status word for what is happening to it, such as `creating` or `created`. */
|
|
114
|
-
readonly status: string;
|
|
115
|
-
};
|
|
116
|
-
type DevEvent =
|
|
117
|
-
/** A converge's steps and Alchemy's log lines. Every step a converge opens is finished when it ends, as `failed` when it failed or was interrupted. */
|
|
118
|
-
StepEvent<DevStep> |
|
|
119
|
-
/** Initial front door + after each successful re-converge. */
|
|
120
|
-
{
|
|
121
|
-
readonly kind: 'ready';
|
|
122
|
-
readonly endpoints: readonly ServiceEndpoint[];
|
|
123
|
-
} | {
|
|
124
|
-
readonly kind: 'unwatchable';
|
|
125
|
-
readonly address: string;
|
|
126
|
-
} |
|
|
127
|
-
/** A target's preflight warned about the graph; the session still starts. */
|
|
128
|
-
{
|
|
129
|
-
readonly kind: 'target-warning';
|
|
130
|
-
readonly message: string;
|
|
131
|
-
} | {
|
|
132
|
-
readonly kind: 'rebuild-failed';
|
|
133
|
-
readonly message: string;
|
|
134
|
-
} |
|
|
135
|
-
/** The file watcher itself errored (EMFILE, a vanished directory); the session keeps running. */
|
|
136
|
-
{
|
|
137
|
-
readonly kind: 'watch-error';
|
|
138
|
-
readonly message: string;
|
|
139
|
-
} |
|
|
140
|
-
/** `prisma.config.ts` changed. The session keeps the config it started with and stops rebuilding until it is restarted. */
|
|
141
|
-
{
|
|
142
|
-
readonly kind: 'config-changed';
|
|
143
|
-
readonly file: string;
|
|
144
|
-
} |
|
|
145
|
-
/** What the `config` or `secrets` adapters return changed since the session started. The session keeps the values it started with and stops rebuilding until it is restarted. */
|
|
146
|
-
{
|
|
147
|
-
readonly kind: 'values-changed';
|
|
148
|
-
} |
|
|
149
|
-
/** The value resources the app reads changed since the session started. `added` holds the nodes whose reads were only added, `removed` those whose reads were only removed, and `changed` every other changed node, each by address. The session stops rebuilding until it is restarted. */
|
|
150
|
-
{
|
|
151
|
-
readonly kind: 'value-reads-changed';
|
|
152
|
-
readonly added: readonly string[];
|
|
153
|
-
readonly removed: readonly string[];
|
|
154
|
-
readonly changed: readonly string[];
|
|
155
|
-
} |
|
|
156
|
-
/** A rebuild's converge failed, or was refused: `DEV.CONVERGE_RUNNING` when another converge on this thread holds the process state, `DEV.WORKER_THREAD` when dev was called from a thread that cannot change the process's working directory. The app keeps running, still watching. */
|
|
157
|
-
{
|
|
158
|
-
readonly kind: 'converge-failed';
|
|
159
|
-
readonly code: 'DEV.CONVERGE_FAILED' | 'DEV.CONVERGE_RUNNING' | 'DEV.WORKER_THREAD';
|
|
160
|
-
readonly message: string;
|
|
161
|
-
readonly reasons: readonly {
|
|
162
|
-
readonly tag: string;
|
|
163
|
-
readonly message: string;
|
|
164
|
-
}[];
|
|
165
|
-
} |
|
|
166
|
-
/** Once per service that runs its build adapter's dev server, before the first converge (ADR-0056). `cwd` is absolute. */
|
|
167
|
-
{
|
|
168
|
-
readonly kind: 'dev-server';
|
|
169
|
-
readonly address: string;
|
|
170
|
-
readonly command: string;
|
|
171
|
-
readonly cwd: string;
|
|
172
|
-
} |
|
|
173
|
-
/** A reconverge changed a dev server's environment, so the emulator restarted it. */
|
|
174
|
-
{
|
|
175
|
-
readonly kind: 'dev-server-restarted';
|
|
176
|
-
readonly address: string;
|
|
177
|
-
readonly command: string;
|
|
178
|
-
} |
|
|
179
|
-
/** One line a dev server wrote, while the session runs. */
|
|
180
|
-
{
|
|
181
|
-
readonly kind: 'dev-server-output';
|
|
182
|
-
readonly address: string;
|
|
183
|
-
readonly line: string;
|
|
184
|
-
} | {
|
|
185
|
-
readonly kind: 'stopping';
|
|
186
|
-
} |
|
|
187
|
-
/** One service refused to stop during stop(); teardown continues and `stopped` still follows. */
|
|
188
|
-
{
|
|
189
|
-
readonly kind: 'stop-error';
|
|
190
|
-
readonly message: string;
|
|
191
|
-
} | {
|
|
192
|
-
readonly kind: 'stopped';
|
|
193
|
-
};
|
|
194
|
-
interface DevInput {
|
|
195
|
-
/**
|
|
196
|
-
* Composer's configuration: the `composer` section of `prisma.config.ts` and that file. The operation does not look for a config file; it refuses a section the CLI would refuse, before any work starts.
|
|
197
|
-
*/
|
|
198
|
-
readonly config: ComposerConfigSource;
|
|
199
|
-
/** The entry module, resolved against `cwd`. Overrides the `entry` in `config`; without either the operation fails with `CONFIG.ENTRY_MISSING`. */
|
|
200
|
-
readonly entry?: string | undefined;
|
|
201
|
-
readonly name?: string | undefined;
|
|
202
|
-
/** The environment to run as: a complete local copy of the app with its own services, databases and buckets. Defaults to `dev`. */
|
|
203
|
-
readonly environment?: string | undefined;
|
|
204
|
-
/** Deletes the environment's local copy of the app, and its data, before starting. Other environments are untouched. */
|
|
205
|
-
readonly fresh?: boolean | undefined;
|
|
206
|
-
/**
|
|
207
|
-
* Return once every service answers and leave the app running, with no
|
|
208
|
-
* watch loop: the session is already closed and stopping it stops nothing.
|
|
209
|
-
* `devStop` stops the app later.
|
|
210
|
-
*/
|
|
211
|
-
readonly detach?: boolean | undefined;
|
|
212
|
-
/** The app's directory, where `.prisma-composer/` and Alchemy's `.alchemy` live. Defaults to `process.cwd()`. For the length of each converge, the process's working directory is `cwd`; it is restored after. */
|
|
213
|
-
readonly cwd?: string | undefined;
|
|
214
|
-
readonly onEvent?: ((event: DevEvent) => void) | undefined;
|
|
215
|
-
/** Interrupts a running converge and stops dev. During the first converge, dev then fails with `DEV.INTERRUPTED`; once the session has started, it stops as `stop()` stops it. Only one converge runs at a time on the thread that called dev, which holds the converge flag while dev's converge worker runs: a `deploy` on that thread while dev converges is refused, and so is a dev converge while a deploy runs there. A converge on another thread of the process is not refused. */
|
|
216
|
-
readonly signal?: AbortSignal | undefined;
|
|
217
|
-
}
|
|
218
|
-
/** A running dev session. The operation NEVER touches process signal handlers: the host owns signals. */
|
|
219
|
-
interface DevSession {
|
|
220
|
-
/** The initial front door, already merged across attachments. */
|
|
221
|
-
readonly endpoints: readonly ServiceEndpoint[];
|
|
222
|
-
/** Stop the watch loop and the app's services (emulators and data stay up).
|
|
223
|
-
* A converge still running is interrupted, and its worker thread ends before the services stop.
|
|
224
|
-
* Idempotent; emits 'stopping'/'stopped'; resolves `closed`. A no-op for a detached session. */
|
|
225
|
-
stop(): Promise<void>;
|
|
226
|
-
/** Settles when the session has fully stopped (via stop()); already settled for a detached session. */
|
|
227
|
-
readonly closed: Promise<void>;
|
|
228
|
-
}
|
|
229
|
-
declare function dev(input: DevInput): Promise<Result<DevSession, CliStructuredError>>;
|
|
230
|
-
//#endregion
|
|
231
|
-
export { ExecutionDiagnostics as a, dev as c, Ok as d, Result as f, DevSession as i, executionDiagnostics as l, DevEvent as n, ServiceEndpoint as o, DevInput as r, StepEvent as s, ComposerConfigSource as t, NotOk as u };
|
|
232
|
-
//# sourceMappingURL=redaction-Dn7BRdaP-BcLSPhLV.d.mts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"redaction-Dn7BRdaP-BcLSPhLV.d.mts","names":[],"sources":["../../../0-framework/0-foundation/foundation/dist/result.d.mts","../../../0-framework/3-tooling/cli/dist/redaction-Dn7BRdaP.d.mts"],"mappings":";;;;;;;;;;;;;UAIU,GAAG;WACF;WACA,OAAO;EAChB,YAAY;EACZ;;;;;UAKQ,MAAM;WACL;WACA,SAAS;EAClB;EACA,eAAe;;;;;;;;KAQZ,OAAO,GAAG,KAAK,GAAG,KAAK,MAAM;;;;;UCdxB;;WAEC,OAAO;;WAEP;;;;;;UAiKD;WACC;WACA;;WAEA;;;;;;;;;;UA4CD;;;WAGC;;;;WAIA;WACA;WACA;WACA;;;;;;iBAMM,qBAAqB,GAAG,qBAAqB;;;;KAIzD,UAAU;WACJ;WACA,MAAM;;WAEN;WACA;;WAEA;;WAEA;WACA,MAAM;WACN;WACA;;WAEA,OAAO,SAAS;;;;;KAKtB;WACM;WACA;;WAEA;;WAEA;;WAEA;WACA;;WAEA;;KAEN;;AAEL,UAAU;;;WAGC;WACA,oBAAoB;;WAEpB;WACA;;;;WAIA;WACA;;WAEA;WACA;;;;WAIA;WACA;;;;WAIA;WACA;;;;WAIA;;;;WAIA;WACA;WACA;WACA;;;;WAIA;WACA;WACA;WACA;aACE;aACA;;;;;WAKF;WACA;WACA;WACA;;;;WAIA;WACA;WACA;;;;WAIA;WACA;WACA;;WAEA;;;;WAIA;WACA;;WAEA;;UAED;;;;WAIC,QAAQ;;WAER;WACA;;WAEA;;WAEA;;;;;;WAMA;;WAEA;WACA,YAAY,OAAO;;WAEnB,SAAS;;;UAGV;;WAEC,oBAAoB;;;;EAI7B,QAAQ;;WAEC,QAAQ;;iBAEF,IAAI,OAAO,WAAW,QAAQ,OAAO,YAAY"}
|
package/dist/report.d.mts
DELETED
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import { v as DeploymentResult } from "./app-config-DriAu5RU-C8hYpR38.mjs";
|
|
2
|
-
import "./deploy-DHgEJDpg.mjs";
|
|
3
|
-
import { r as captureEngineFailure } from "./deployment-summary-6LgQDUuu-Cu_6UNhc.mjs";
|
|
4
|
-
//#region ../../0-framework/3-tooling/cli/dist/report.d.mts
|
|
5
|
-
//#region src/render-deployment.d.ts
|
|
6
|
-
/**
|
|
7
|
-
* Renders a deploy's result as the app's own topology. Pure — returns the
|
|
8
|
-
* string; the caller prints.
|
|
9
|
-
*/
|
|
10
|
-
declare function renderDeployment(result: DeploymentResult): string;
|
|
11
|
-
/**
|
|
12
|
-
* The report hook the generated stack file wires into `LowerOptions`. Prints a
|
|
13
|
-
* leading blank line so the summary separates from alchemy's own apply output,
|
|
14
|
-
* then hands the result to the cross-process writer (deployment-summary.ts).
|
|
15
|
-
*/
|
|
16
|
-
declare function deploymentReport(result: DeploymentResult): void;
|
|
17
|
-
//#endregion
|
|
18
|
-
export { captureEngineFailure, deploymentReport, renderDeployment };
|
|
19
|
-
//# sourceMappingURL=report.d.mts.map
|
package/dist/report.d.mts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"report.d.mts","names":[],"sources":["../../../0-framework/3-tooling/cli/dist/report.d.mts"],"mappings":";;;;;;;;;iBAOiB,iBAAiB,QAAQ;;;;;;iBAMzB,iBAAiB,QAAQ"}
|