@cdkd/cli 0.334.3 → 0.335.0
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/ambient-client-defaults-B9bnuob2.js +960 -0
- package/dist/ambient-client-defaults-B9bnuob2.js.map +1 -0
- package/dist/{asg-provider-Gu-qQLG9.js → asg-provider-pl5tnbiA.js} +4 -3
- package/dist/asg-provider-pl5tnbiA.js.map +1 -0
- package/dist/cli.js +2 -2
- package/dist/{db-instance-modify-retry-AJiRFAXa.js → db-instance-modify-retry-CD7NSyq4.js} +10 -9
- package/dist/{db-instance-modify-retry-AJiRFAXa.js.map → db-instance-modify-retry-CD7NSyq4.js.map} +1 -1
- package/dist/{deploy-engine-BktCSZdi.js → deploy-engine-iQpILlcZ.js} +2130 -1951
- package/dist/deploy-engine-iQpILlcZ.js.map +1 -0
- package/dist/{iam-role-provider-BJ5XgxFH.js → iam-role-provider-jC3_bsf-.js} +4 -3
- package/dist/iam-role-provider-jC3_bsf-.js.map +1 -0
- package/dist/index.d.ts +34 -42
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +3 -3
- package/dist/{neptune-provider-6SGPWYUE.js → neptune-provider-CNEMvt4t.js} +5 -4
- package/dist/neptune-provider-CNEMvt4t.js.map +1 -0
- package/dist/{program-Dm0zFrcG.js → program-DaGdaozO.js} +21 -9
- package/dist/program-DaGdaozO.js.map +1 -0
- package/dist/{provider-classes-BDPm7luc.js → provider-classes-ZpRORGt2.js} +10 -9
- package/dist/provider-classes-ZpRORGt2.js.map +1 -0
- package/dist/{rds-provider--9aIoAY-.js → rds-provider-Ce7ua-ww.js} +289 -30
- package/dist/rds-provider-Ce7ua-ww.js.map +1 -0
- package/dist/read-replica-BJAUZwWe.js +201 -0
- package/dist/read-replica-BJAUZwWe.js.map +1 -0
- package/dist/{update-removal-73OUGFVU.js → update-removal-Dh6W86TO.js} +148 -1098
- package/dist/update-removal-Dh6W86TO.js.map +1 -0
- package/dist/{version-CO5muce9.js → version-BxcTCG5i.js} +2 -2
- package/dist/{version-CO5muce9.js.map → version-BxcTCG5i.js.map} +1 -1
- package/package.json +1 -1
- package/dist/asg-provider-Gu-qQLG9.js.map +0 -1
- package/dist/deploy-engine-BktCSZdi.js.map +0 -1
- package/dist/iam-role-provider-BJ5XgxFH.js.map +0 -1
- package/dist/neptune-provider-6SGPWYUE.js.map +0 -1
- package/dist/program-Dm0zFrcG.js.map +0 -1
- package/dist/provider-classes-BDPm7luc.js.map +0 -1
- package/dist/rds-provider--9aIoAY-.js.map +0 -1
- package/dist/update-removal-73OUGFVU.js.map +0 -1
|
@@ -0,0 +1,960 @@
|
|
|
1
|
+
import { r as getAwsClients } from "./aws-clients-ez_oXu6x.js";
|
|
2
|
+
import { $ as safeMsg, H as STACK_REF_MAX_CODE_POINTS, J as displaySafe, K as displayAwsMessage, Q as plainIdentOr, U as UNRENDERABLE, X as isPasteableIdent, a as safeStringify, i as isAwsAuthoredFailure, n as describeAwsFailure, nt as truncateCodePoints, q as displayIdent, s as getLogger, t as VERBOSE_POINTER } from "./aws-failure-text-CoS1huLy.js";
|
|
3
|
+
import { n as awsClientDefaults } from "./aws-client-defaults-BLXFsfMa.js";
|
|
4
|
+
|
|
5
|
+
// src/utils/pasteable-run-context.ts
|
|
6
|
+
let runFlags = {};
|
|
7
|
+
let verbFlags;
|
|
8
|
+
function setPasteableRunFlags(flags) {
|
|
9
|
+
runFlags = { ...flags };
|
|
10
|
+
}
|
|
11
|
+
function pasteableRunFlags() {
|
|
12
|
+
return runFlags;
|
|
13
|
+
}
|
|
14
|
+
function setPasteableVerbFlags(map) {
|
|
15
|
+
verbFlags = map;
|
|
16
|
+
}
|
|
17
|
+
function pasteableVerbFlags(verb) {
|
|
18
|
+
return verbFlags?.get(verb);
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
// src/utils/pasteable-command.ts
|
|
22
|
+
const SHELL_ACTIVE = /[\s'"`$;&|<>()*?[\]{}!#~\\^=%,]/;
|
|
23
|
+
const PASTE_ARG_UNSAFE = /[\s'"`$;&|<>()\\*?[\]{}!]|^[#=]|(?:^|[=:])~/;
|
|
24
|
+
function shellQuote(value) {
|
|
25
|
+
return /^[A-Za-z0-9._/@:+-]+$/.test(value) ? value : `'${value.replace(/'/g, `'\\''`)}'`;
|
|
26
|
+
}
|
|
27
|
+
const CLAUSE_BREAK = /: | -- | — |[.!?]\s/;
|
|
28
|
+
function hasClauseBreak(text) {
|
|
29
|
+
return CLAUSE_BREAK.test(text);
|
|
30
|
+
}
|
|
31
|
+
const UNSHOWABLE_VALUE = "a value that cannot be shown safely here";
|
|
32
|
+
function shellBoundedDisplay(shown) {
|
|
33
|
+
if (hasClauseBreak(shown)) return UNSHOWABLE_VALUE;
|
|
34
|
+
return shown.startsWith("\"") || shown === "<unrenderable>" ? shellQuote(shown) : shown;
|
|
35
|
+
}
|
|
36
|
+
function commandHole(name) {
|
|
37
|
+
return `'<${name}>'`;
|
|
38
|
+
}
|
|
39
|
+
const SHELL_ACTIVE_WHY = "holds whitespace or a character a shell treats specially, and only a value that stays inert without its quotes is named in a command here, since text pasted before the command can undo the quotes and leave it to run as shell";
|
|
40
|
+
function plainOrDescribed(value, what) {
|
|
41
|
+
return isPasteableIdent(value) ? value : `a ${what} that is not a plain identifier`;
|
|
42
|
+
}
|
|
43
|
+
function quotedOrDescribed(value, what) {
|
|
44
|
+
return isPasteableIdent(value) ? `'${value}'` : plainOrDescribed(value, what);
|
|
45
|
+
}
|
|
46
|
+
function physicalIdShownBesideCommand(value, opts) {
|
|
47
|
+
if (typeof value !== "string" || value.startsWith("-")) return void 0;
|
|
48
|
+
const plain = (text) => isInertUnquoted(text) && displayIdent(text, { maxCodePoints: 613 }) === text;
|
|
49
|
+
if (plain(value)) return value;
|
|
50
|
+
const token = opts?.maskToken;
|
|
51
|
+
if (token === void 0 || token === "" || !value.includes(token)) return void 0;
|
|
52
|
+
const rendered = displayIdent(value, { maxCodePoints: 613 });
|
|
53
|
+
return value.split(token).every((part) => part === "" || plain(part)) && rendered === JSON.stringify(value) ? rendered : void 0;
|
|
54
|
+
}
|
|
55
|
+
function isInertUnquoted(value) {
|
|
56
|
+
return !PASTE_ARG_UNSAFE.test(value);
|
|
57
|
+
}
|
|
58
|
+
function withholdReason(value, opts) {
|
|
59
|
+
if (value === "") return "empty";
|
|
60
|
+
const safe = displaySafe(value, { asciiOnly: true });
|
|
61
|
+
if (safe !== value) return "altered";
|
|
62
|
+
const cap = opts?.maxCodePoints !== void 0 && Number.isFinite(opts.maxCodePoints) ? Math.max(1, opts.maxCodePoints) : STACK_REF_MAX_CODE_POINTS;
|
|
63
|
+
if (truncateCodePoints(safe, cap).truncated) return "too-long";
|
|
64
|
+
if (value.startsWith("-")) return "option-shaped";
|
|
65
|
+
if (opts?.patternMatched === true && (value.includes("*") || value.includes("/"))) return "pattern-shaped";
|
|
66
|
+
if (opts?.plainIdent === true) return isPasteableIdent(value) ? void 0 : "not-plain";
|
|
67
|
+
if (!isInertUnquoted(value)) return "shell-active";
|
|
68
|
+
}
|
|
69
|
+
function pasteableCommand(verb, args = [], extraFlags = []) {
|
|
70
|
+
let exact = true;
|
|
71
|
+
const withheld = [];
|
|
72
|
+
const parts = [verb];
|
|
73
|
+
for (const arg of args) {
|
|
74
|
+
if ("literal" in arg) {
|
|
75
|
+
parts.push(arg.literal);
|
|
76
|
+
continue;
|
|
77
|
+
}
|
|
78
|
+
if (!("value" in arg)) {
|
|
79
|
+
if ("flag" in arg) parts.push(arg.flag);
|
|
80
|
+
parts.push(commandHole(arg.hole));
|
|
81
|
+
exact = false;
|
|
82
|
+
continue;
|
|
83
|
+
}
|
|
84
|
+
const reason = withholdReason(arg.value, arg.opts);
|
|
85
|
+
let rendered;
|
|
86
|
+
if (reason === void 0) rendered = shellQuote(arg.value);
|
|
87
|
+
else {
|
|
88
|
+
rendered = commandHole(arg.hole);
|
|
89
|
+
exact = false;
|
|
90
|
+
withheld.push({
|
|
91
|
+
hole: arg.hole,
|
|
92
|
+
reason
|
|
93
|
+
});
|
|
94
|
+
}
|
|
95
|
+
if ("flag" in arg) parts.push(arg.flag);
|
|
96
|
+
parts.push(rendered);
|
|
97
|
+
}
|
|
98
|
+
parts.push(...extraFlags);
|
|
99
|
+
parts.push(...runFlagWords(verb, args, extraFlags));
|
|
100
|
+
return {
|
|
101
|
+
command: parts.join(" "),
|
|
102
|
+
exact,
|
|
103
|
+
withheld
|
|
104
|
+
};
|
|
105
|
+
}
|
|
106
|
+
function runFlagWords(verb, args, extraFlags) {
|
|
107
|
+
const accepted = pasteableVerbFlags(verb);
|
|
108
|
+
if (accepted === void 0) return [];
|
|
109
|
+
const present = /* @__PURE__ */ new Set();
|
|
110
|
+
for (const arg of args) if ("flag" in arg) present.add(arg.flag);
|
|
111
|
+
else if ("literal" in arg) present.add(arg.literal.split(" ")[0]);
|
|
112
|
+
for (const f of extraFlags) present.add(f.split(" ")[0]);
|
|
113
|
+
const run = pasteableRunFlags();
|
|
114
|
+
const out = [];
|
|
115
|
+
const add = (flag, value, hole, allowEmpty) => {
|
|
116
|
+
if (value === void 0 || value === "" && !allowEmpty) return;
|
|
117
|
+
if (!accepted.has(flag) || present.has(flag)) return;
|
|
118
|
+
const inert = displaySafe(value) === value && !value.startsWith("-") && !SHELL_ACTIVE.test(value) && !/\p{Cf}/u.test(value) && !truncateCodePoints(value, 1152).truncated;
|
|
119
|
+
out.push(`${flag} ${value === "" || inert ? shellQuote(value) : commandHole(hole)}`);
|
|
120
|
+
};
|
|
121
|
+
add("--profile", run.profile, "profile", false);
|
|
122
|
+
add("--state-bucket", run.stateBucket, "bucket", false);
|
|
123
|
+
add("--state-prefix", run.statePrefix, "prefix", true);
|
|
124
|
+
if (run.roleArn === true && accepted.has("--role-arn") && !present.has("--role-arn")) out.push(`--role-arn ${commandHole("role-arn")}`);
|
|
125
|
+
return out;
|
|
126
|
+
}
|
|
127
|
+
function withheldTargetClause(built, hole, verb, subject = "This record's name") {
|
|
128
|
+
const reason = built.withheld.find((w) => w.hole === hole)?.reason;
|
|
129
|
+
if (reason === void 0) return "";
|
|
130
|
+
let why;
|
|
131
|
+
switch (reason) {
|
|
132
|
+
case "altered":
|
|
133
|
+
why = `does NOT render exactly, so another record may render identically`;
|
|
134
|
+
break;
|
|
135
|
+
case "empty":
|
|
136
|
+
why = `is empty`;
|
|
137
|
+
break;
|
|
138
|
+
case "too-long":
|
|
139
|
+
why = `is too long to print`;
|
|
140
|
+
break;
|
|
141
|
+
case "option-shaped":
|
|
142
|
+
why = `begins with a '-', so it is not safe to print as an argument to '${verb}' — a name like '--all' is parsed as the FLAG and targets every stack`;
|
|
143
|
+
break;
|
|
144
|
+
case "pattern-shaped":
|
|
145
|
+
why = `would be read as a PATTERN by '${verb}', which can match other stacks`;
|
|
146
|
+
break;
|
|
147
|
+
case "shell-active":
|
|
148
|
+
why = SHELL_ACTIVE_WHY;
|
|
149
|
+
break;
|
|
150
|
+
case "not-plain":
|
|
151
|
+
why = "is not a plain identifier (a letter or digit, then letters, digits, '~', '_', '.' or '-'), the only shape named in a command here, since a name outside it can run as shell or read as a line of this message once the terminal wraps";
|
|
152
|
+
break;
|
|
153
|
+
default: throw new Error(`withheldTargetClause: unhandled WithholdReason ${String(reason)}`);
|
|
154
|
+
}
|
|
155
|
+
return ` ${subject} ${why} — so it is not named in the command below; list the records as stored with 'cdkd state list --long' and act on the one whose key matches.`;
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
// src/utils/resource-type-shape.ts
|
|
159
|
+
const TIMEOUT_FLAG_RESOURCE_TYPE = /^[A-Z][A-Za-z0-9]+::[A-Z][A-Za-z0-9]+::[A-Z][A-Za-z0-9]+$/;
|
|
160
|
+
const RESOURCE_TYPE_MAX_LENGTH = 204;
|
|
161
|
+
const RESOURCE_TYPE_SHAPE = /^(?:[A-Z][A-Za-z0-9]+(?:::[A-Z][A-Za-z0-9]+)+|Custom::[A-Za-z0-9_@-]+)$/;
|
|
162
|
+
function hasResourceTypeShape(value) {
|
|
163
|
+
return value.length <= 204 && RESOURCE_TYPE_SHAPE.test(value);
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
// src/utils/error-handler/base-errors.ts
|
|
167
|
+
var CdkdError = class CdkdError extends Error {
|
|
168
|
+
code;
|
|
169
|
+
cause;
|
|
170
|
+
constructor(message, code, cause) {
|
|
171
|
+
super(message);
|
|
172
|
+
this.code = code;
|
|
173
|
+
this.cause = cause;
|
|
174
|
+
this.name = "CdkdError";
|
|
175
|
+
Object.setPrototypeOf(this, CdkdError.prototype);
|
|
176
|
+
}
|
|
177
|
+
};
|
|
178
|
+
var AccountIdUnavailableError = class AccountIdUnavailableError extends CdkdError {
|
|
179
|
+
constructor(message) {
|
|
180
|
+
super(message, "ACCOUNT_ID_UNAVAILABLE");
|
|
181
|
+
this.name = "AccountIdUnavailableError";
|
|
182
|
+
Object.setPrototypeOf(this, AccountIdUnavailableError.prototype);
|
|
183
|
+
}
|
|
184
|
+
};
|
|
185
|
+
var StateError = class StateError extends CdkdError {
|
|
186
|
+
constructor(message, cause) {
|
|
187
|
+
super(message, "STATE_ERROR", cause);
|
|
188
|
+
this.name = "StateError";
|
|
189
|
+
Object.setPrototypeOf(this, StateError.prototype);
|
|
190
|
+
}
|
|
191
|
+
};
|
|
192
|
+
var LockError = class LockError extends CdkdError {
|
|
193
|
+
constructor(message, cause) {
|
|
194
|
+
super(message, "LOCK_ERROR", cause);
|
|
195
|
+
this.name = "LockError";
|
|
196
|
+
Object.setPrototypeOf(this, LockError.prototype);
|
|
197
|
+
}
|
|
198
|
+
};
|
|
199
|
+
var SynthesisError = class SynthesisError extends CdkdError {
|
|
200
|
+
constructor(message, cause) {
|
|
201
|
+
super(message, "SYNTHESIS_ERROR", cause);
|
|
202
|
+
this.name = "SynthesisError";
|
|
203
|
+
Object.setPrototypeOf(this, SynthesisError.prototype);
|
|
204
|
+
}
|
|
205
|
+
};
|
|
206
|
+
var DeployCancelledError = class DeployCancelledError extends CdkdError {
|
|
207
|
+
constructor(message = "Deployment cancelled by user") {
|
|
208
|
+
super(message, "DEPLOY_CANCELLED");
|
|
209
|
+
this.name = "DeployCancelledError";
|
|
210
|
+
Object.setPrototypeOf(this, DeployCancelledError.prototype);
|
|
211
|
+
}
|
|
212
|
+
};
|
|
213
|
+
var DeploymentNotApprovedError = class DeploymentNotApprovedError extends CdkdError {
|
|
214
|
+
softAbort = true;
|
|
215
|
+
constructor(message) {
|
|
216
|
+
super(message, "DEPLOY_NOT_APPROVED");
|
|
217
|
+
this.name = "DeploymentNotApprovedError";
|
|
218
|
+
Object.setPrototypeOf(this, DeploymentNotApprovedError.prototype);
|
|
219
|
+
}
|
|
220
|
+
};
|
|
221
|
+
function isSoftAbort(error) {
|
|
222
|
+
return error instanceof Error && error.softAbort === true;
|
|
223
|
+
}
|
|
224
|
+
var AssetError = class AssetError extends CdkdError {
|
|
225
|
+
constructor(message, cause) {
|
|
226
|
+
super(message, "ASSET_ERROR", cause);
|
|
227
|
+
this.name = "AssetError";
|
|
228
|
+
Object.setPrototypeOf(this, AssetError.prototype);
|
|
229
|
+
}
|
|
230
|
+
};
|
|
231
|
+
var LocalInvokeBuildError = class LocalInvokeBuildError extends CdkdError {
|
|
232
|
+
constructor(message, cause) {
|
|
233
|
+
super(message, "LOCAL_INVOKE_BUILD_ERROR", cause);
|
|
234
|
+
this.name = "LocalInvokeBuildError";
|
|
235
|
+
Object.setPrototypeOf(this, LocalInvokeBuildError.prototype);
|
|
236
|
+
}
|
|
237
|
+
};
|
|
238
|
+
var ProvisioningError = class ProvisioningError extends CdkdError {
|
|
239
|
+
resourceType;
|
|
240
|
+
logicalId;
|
|
241
|
+
physicalId;
|
|
242
|
+
constructor(message, resourceType, logicalId, physicalId, cause) {
|
|
243
|
+
super(message, "PROVISIONING_ERROR", cause);
|
|
244
|
+
this.resourceType = resourceType;
|
|
245
|
+
this.logicalId = logicalId;
|
|
246
|
+
this.physicalId = physicalId;
|
|
247
|
+
this.name = "ProvisioningError";
|
|
248
|
+
Object.setPrototypeOf(this, ProvisioningError.prototype);
|
|
249
|
+
}
|
|
250
|
+
};
|
|
251
|
+
var ResourceTimeoutError = class ResourceTimeoutError extends CdkdError {
|
|
252
|
+
logicalId;
|
|
253
|
+
resourceType;
|
|
254
|
+
region;
|
|
255
|
+
elapsedMs;
|
|
256
|
+
operation;
|
|
257
|
+
timeoutMs;
|
|
258
|
+
constructor(logicalId, resourceType, region, elapsedMs, operation, timeoutMs) {
|
|
259
|
+
const elapsedLabel = formatDuration(elapsedMs);
|
|
260
|
+
const timeoutLabel = formatDuration(timeoutMs);
|
|
261
|
+
const shownId = plainOrDescribed(logicalId, "logical id");
|
|
262
|
+
const shownType = hasResourceTypeShape(resourceType) ? resourceType : "a resource type that is not printable as typed";
|
|
263
|
+
const remedy = hasResourceTypeShape(resourceType) && TIMEOUT_FLAG_RESOURCE_TYPE.test(resourceType) ? safeMsg`slow ENI provisioning. Re-run with --resource-timeout ${resourceType}='<DURATION>'\n` + "to bump the budget for this resource type only, or --verbose to see the\n" : "slow ENI provisioning. Re-run with a larger --resource-timeout '<DURATION>',\nor --verbose to see the\n";
|
|
264
|
+
super(safeMsg`Resource ${shownId} (${shownType}) in ${region} timed out after ${timeoutLabel} during ${operation} (elapsed ${elapsedLabel}).\n` + "This may indicate a stuck Cloud Control polling loop, hung Custom Resource, or\n" + remedy + "underlying provider activity.", "RESOURCE_TIMEOUT");
|
|
265
|
+
this.logicalId = logicalId;
|
|
266
|
+
this.resourceType = resourceType;
|
|
267
|
+
this.region = region;
|
|
268
|
+
this.elapsedMs = elapsedMs;
|
|
269
|
+
this.operation = operation;
|
|
270
|
+
this.timeoutMs = timeoutMs;
|
|
271
|
+
this.name = "ResourceTimeoutError";
|
|
272
|
+
Object.setPrototypeOf(this, ResourceTimeoutError.prototype);
|
|
273
|
+
}
|
|
274
|
+
};
|
|
275
|
+
function formatDuration(ms) {
|
|
276
|
+
if (ms < 6e4) return `${Math.round(ms / 1e3)}s`;
|
|
277
|
+
const totalMinutes = Math.round(ms / 6e4);
|
|
278
|
+
if (totalMinutes < 60) return `${totalMinutes}m`;
|
|
279
|
+
const hours = Math.floor(totalMinutes / 60);
|
|
280
|
+
const minutes = totalMinutes % 60;
|
|
281
|
+
return minutes === 0 ? `${hours}h` : `${hours}h${minutes}m`;
|
|
282
|
+
}
|
|
283
|
+
|
|
284
|
+
// src/utils/error-handler/refusal-errors.ts
|
|
285
|
+
var IntrinsicResolutionRefusalError = class IntrinsicResolutionRefusalError extends CdkdError {
|
|
286
|
+
constructor(message, cause, code = "INTRINSIC_RESOLUTION_REFUSAL") {
|
|
287
|
+
super(message, code, cause);
|
|
288
|
+
this.name = "IntrinsicResolutionRefusalError";
|
|
289
|
+
Object.setPrototypeOf(this, IntrinsicResolutionRefusalError.prototype);
|
|
290
|
+
}
|
|
291
|
+
};
|
|
292
|
+
var CrossAccountSecretRefusalError = class CrossAccountSecretRefusalError extends IntrinsicResolutionRefusalError {
|
|
293
|
+
constructor(message, cause) {
|
|
294
|
+
super(message, cause, "INTRINSIC_RESOLUTION_REFUSAL_CROSS_ACCOUNT_SECRET");
|
|
295
|
+
this.name = "CrossAccountSecretRefusalError";
|
|
296
|
+
Object.setPrototypeOf(this, CrossAccountSecretRefusalError.prototype);
|
|
297
|
+
}
|
|
298
|
+
};
|
|
299
|
+
var MalformedProducerRecordRefusalError = class MalformedProducerRecordRefusalError extends IntrinsicResolutionRefusalError {
|
|
300
|
+
constructor(message, cause) {
|
|
301
|
+
super(message, cause, "INTRINSIC_RESOLUTION_REFUSAL_MALFORMED_PRODUCER_RECORD");
|
|
302
|
+
this.name = "MalformedProducerRecordRefusalError";
|
|
303
|
+
Object.setPrototypeOf(this, MalformedProducerRecordRefusalError.prototype);
|
|
304
|
+
}
|
|
305
|
+
};
|
|
306
|
+
var DynamicReferenceRegionAmbiguousError = class DynamicReferenceRegionAmbiguousError extends IntrinsicResolutionRefusalError {
|
|
307
|
+
constructor(message, cause) {
|
|
308
|
+
super(message, cause, "DYNAMIC_REFERENCE_REGION_AMBIGUOUS");
|
|
309
|
+
this.name = "DynamicReferenceRegionAmbiguousError";
|
|
310
|
+
Object.setPrototypeOf(this, DynamicReferenceRegionAmbiguousError.prototype);
|
|
311
|
+
}
|
|
312
|
+
};
|
|
313
|
+
|
|
314
|
+
// src/deployment/retryable-errors/patterns.ts
|
|
315
|
+
const IAM_PROPAGATION_ERROR_MESSAGE_PATTERNS = [
|
|
316
|
+
"cannot be assumed",
|
|
317
|
+
"Firehose is unable to assume role",
|
|
318
|
+
"is unable to assume provided role",
|
|
319
|
+
"is unable to assume the role",
|
|
320
|
+
"security token included in the request is invalid. (Service:",
|
|
321
|
+
"Received Exception while reading from provided stream. The security token included in the request is invalid",
|
|
322
|
+
"role defined for the function",
|
|
323
|
+
"not authorized to perform",
|
|
324
|
+
"execution role",
|
|
325
|
+
"trust policy",
|
|
326
|
+
"Role validation failed",
|
|
327
|
+
"does not have required permissions",
|
|
328
|
+
"Trusted Entity",
|
|
329
|
+
"Invalid principal in policy",
|
|
330
|
+
"Verify in IAM that the role has adequate trust relationships",
|
|
331
|
+
"The user with name",
|
|
332
|
+
"Policy Error: PrincipalNotFound",
|
|
333
|
+
"Invalid value for the parameter Policy",
|
|
334
|
+
"required permissions for: ENHANCED_MONITORING",
|
|
335
|
+
"Caught ServiceAccessDeniedException",
|
|
336
|
+
"The operator role is invalid or doesn't have sufficient permissions",
|
|
337
|
+
"doesn't have permission to perform ec2:DescribeSecurityGroups",
|
|
338
|
+
"One or more security group IDs are invalid",
|
|
339
|
+
"permissions required to assume the role",
|
|
340
|
+
"does not have a trust relationship allowing",
|
|
341
|
+
"does not have permission to publish with SNS",
|
|
342
|
+
"authorized to assume the provided role",
|
|
343
|
+
"not authorized to access the Log Destination",
|
|
344
|
+
"Cannot access stream",
|
|
345
|
+
"Please ensure the role can perform",
|
|
346
|
+
"KMS key is invalid for CreateGrant",
|
|
347
|
+
"Policy contains a statement with one or more invalid principals",
|
|
348
|
+
"Invalid IAM Instance Profile",
|
|
349
|
+
"Invalid InstanceProfile",
|
|
350
|
+
"Failed to authorize instance profile",
|
|
351
|
+
"is not a valid role to allow SNS",
|
|
352
|
+
"Could not assume the infrastructure role",
|
|
353
|
+
"AWS was not able to validate the provided access credentials (Service: Ecs,"
|
|
354
|
+
];
|
|
355
|
+
const OTHER_TRANSIENT_ERROR_MESSAGE_PATTERNS = [
|
|
356
|
+
"currently in the following state: Pending",
|
|
357
|
+
"has dependencies and cannot be deleted",
|
|
358
|
+
"can't be deleted since it has",
|
|
359
|
+
"DependencyViolation",
|
|
360
|
+
"does not exist",
|
|
361
|
+
"Schema is currently being altered",
|
|
362
|
+
"scheduled for deletion",
|
|
363
|
+
"Could not deliver test message",
|
|
364
|
+
"concurrent update operation",
|
|
365
|
+
"because it is in use",
|
|
366
|
+
"Rate exceeded",
|
|
367
|
+
"is marked disabled for mutation",
|
|
368
|
+
"There is an operation running on the Cluster",
|
|
369
|
+
"Unable to complete operation due to concurrent modification"
|
|
370
|
+
];
|
|
371
|
+
const NAME_COOLDOWN_ERROR_MESSAGE_PATTERNS = [
|
|
372
|
+
"QueueDeletedRecently",
|
|
373
|
+
"wait 60 seconds",
|
|
374
|
+
"StateMachineDeleting",
|
|
375
|
+
"State Machine is being deleted",
|
|
376
|
+
"conflicting conditional operation"
|
|
377
|
+
];
|
|
378
|
+
const RETRYABLE_ERROR_MESSAGE_PATTERNS = [
|
|
379
|
+
...IAM_PROPAGATION_ERROR_MESSAGE_PATTERNS,
|
|
380
|
+
...OTHER_TRANSIENT_ERROR_MESSAGE_PATTERNS,
|
|
381
|
+
...NAME_COOLDOWN_ERROR_MESSAGE_PATTERNS
|
|
382
|
+
];
|
|
383
|
+
const RETRYABLE_HTTP_STATUS_CODES = /* @__PURE__ */ new Set([429, 503]);
|
|
384
|
+
|
|
385
|
+
// src/deployment/retryable-errors/marks.ts
|
|
386
|
+
const THROTTLING_ERROR_NAMES = /* @__PURE__ */ new Set([
|
|
387
|
+
"BandwidthLimitExceeded",
|
|
388
|
+
"EC2ThrottledException",
|
|
389
|
+
"LimitExceededException",
|
|
390
|
+
"PriorRequestNotComplete",
|
|
391
|
+
"ProvisionedThroughputExceededException",
|
|
392
|
+
"RequestLimitExceeded",
|
|
393
|
+
"RequestThrottled",
|
|
394
|
+
"RequestThrottledException",
|
|
395
|
+
"SlowDown",
|
|
396
|
+
"ThrottledException",
|
|
397
|
+
"Throttling",
|
|
398
|
+
"ThrottlingException",
|
|
399
|
+
"TooManyRequestsException",
|
|
400
|
+
"TransactionInProgressException"
|
|
401
|
+
]);
|
|
402
|
+
const NON_RETRYABLE_MARKER = Symbol.for("cdkd.nonRetryable");
|
|
403
|
+
const MAX_CAUSE_CHAIN_DEPTH = 5;
|
|
404
|
+
const REDACTED_CAUSE_MARKER = Symbol.for("cdkd.redactedCause");
|
|
405
|
+
function markRedactedCause(error) {
|
|
406
|
+
if (!Object.isExtensible(error)) return error;
|
|
407
|
+
Object.defineProperty(error, REDACTED_CAUSE_MARKER, {
|
|
408
|
+
value: true,
|
|
409
|
+
enumerable: false,
|
|
410
|
+
configurable: true,
|
|
411
|
+
writable: false
|
|
412
|
+
});
|
|
413
|
+
return error;
|
|
414
|
+
}
|
|
415
|
+
function wrapMaskedAwsError(mask, error, build) {
|
|
416
|
+
const raw = describeAwsFailure(error).detail;
|
|
417
|
+
const masked = mask(raw);
|
|
418
|
+
const wrapped = build(masked);
|
|
419
|
+
return masked === raw ? wrapped : markRedactedCause(wrapped);
|
|
420
|
+
}
|
|
421
|
+
function hasRedactedCause(error) {
|
|
422
|
+
let current = error;
|
|
423
|
+
for (let depth = 0; depth < 5 && current != null; depth++) {
|
|
424
|
+
if (typeof current === "object" || typeof current === "function") {
|
|
425
|
+
if (current[REDACTED_CAUSE_MARKER] === true) return true;
|
|
426
|
+
}
|
|
427
|
+
current = current.cause;
|
|
428
|
+
}
|
|
429
|
+
return false;
|
|
430
|
+
}
|
|
431
|
+
function markNonRetryable(error) {
|
|
432
|
+
if (!Object.isExtensible(error)) return error;
|
|
433
|
+
Object.defineProperty(error, NON_RETRYABLE_MARKER, {
|
|
434
|
+
value: true,
|
|
435
|
+
enumerable: false,
|
|
436
|
+
configurable: true,
|
|
437
|
+
writable: false
|
|
438
|
+
});
|
|
439
|
+
return error;
|
|
440
|
+
}
|
|
441
|
+
function isMarkedNonRetryable(error) {
|
|
442
|
+
let current = error;
|
|
443
|
+
for (let depth = 0; depth < 5 && current != null; depth++) {
|
|
444
|
+
if (typeof current === "object" || typeof current === "function") {
|
|
445
|
+
if (current[NON_RETRYABLE_MARKER] === true) return true;
|
|
446
|
+
}
|
|
447
|
+
current = current.cause;
|
|
448
|
+
}
|
|
449
|
+
return false;
|
|
450
|
+
}
|
|
451
|
+
function isThrottlingError(error) {
|
|
452
|
+
let current = error;
|
|
453
|
+
for (let depth = 0; depth < 5 && current != null; depth++) {
|
|
454
|
+
const name = current.name;
|
|
455
|
+
if (typeof name === "string" && THROTTLING_ERROR_NAMES.has(name)) return true;
|
|
456
|
+
const status = current.$metadata?.httpStatusCode;
|
|
457
|
+
if (status !== void 0 && RETRYABLE_HTTP_STATUS_CODES.has(status)) return true;
|
|
458
|
+
current = current.cause;
|
|
459
|
+
}
|
|
460
|
+
return false;
|
|
461
|
+
}
|
|
462
|
+
|
|
463
|
+
// src/deployment/retryable-errors/transient.ts
|
|
464
|
+
const TRANSIENT_SERVER_ERROR_STATUS_CODES = /* @__PURE__ */ new Set([
|
|
465
|
+
500,
|
|
466
|
+
502,
|
|
467
|
+
503,
|
|
468
|
+
504
|
|
469
|
+
]);
|
|
470
|
+
function isTransientServerError(error) {
|
|
471
|
+
let current = error;
|
|
472
|
+
for (let depth = 0; depth < 5 && current != null; depth++) {
|
|
473
|
+
const status = current.$metadata?.httpStatusCode;
|
|
474
|
+
if (status !== void 0 && TRANSIENT_SERVER_ERROR_STATUS_CODES.has(status)) return true;
|
|
475
|
+
current = current.cause;
|
|
476
|
+
}
|
|
477
|
+
return false;
|
|
478
|
+
}
|
|
479
|
+
const AMBIGUOUS_SOCKET_ERROR_CODES = /* @__PURE__ */ new Set([
|
|
480
|
+
"ECONNRESET",
|
|
481
|
+
"EPIPE",
|
|
482
|
+
"ETIMEDOUT",
|
|
483
|
+
"EADDRNOTAVAIL"
|
|
484
|
+
]);
|
|
485
|
+
const AMBIGUOUS_CC_HANDLER_ERROR_CODES = /* @__PURE__ */ new Set([
|
|
486
|
+
"InternalFailure",
|
|
487
|
+
"HandlerInternalFailure",
|
|
488
|
+
"ServiceInternalError",
|
|
489
|
+
"NetworkFailure",
|
|
490
|
+
"NotStabilized",
|
|
491
|
+
"ServiceTimeout",
|
|
492
|
+
"GeneralServiceException",
|
|
493
|
+
"Throttling"
|
|
494
|
+
]);
|
|
495
|
+
function isAmbiguousCcHandlerErrorCode(code) {
|
|
496
|
+
return code !== void 0 && AMBIGUOUS_CC_HANDLER_ERROR_CODES.has(code);
|
|
497
|
+
}
|
|
498
|
+
function isAmbiguousOutcomeError(error) {
|
|
499
|
+
try {
|
|
500
|
+
let current = error;
|
|
501
|
+
for (let depth = 0; depth < 5 && typeof current === "object" && current !== null; depth++) {
|
|
502
|
+
const link = current;
|
|
503
|
+
if (typeof link.name === "string" && THROTTLING_ERROR_NAMES.has(link.name)) return false;
|
|
504
|
+
if (link.$retryable?.throttling === true) return false;
|
|
505
|
+
const status = link.$metadata?.httpStatusCode;
|
|
506
|
+
if (typeof status === "number" && TRANSIENT_SERVER_ERROR_STATUS_CODES.has(status)) return true;
|
|
507
|
+
if (typeof link.code === "string" && AMBIGUOUS_SOCKET_ERROR_CODES.has(link.code)) return true;
|
|
508
|
+
if (link.name === "TimeoutError") return true;
|
|
509
|
+
if (typeof link.ccErrorCode === "string" && AMBIGUOUS_CC_HANDLER_ERROR_CODES.has(link.ccErrorCode)) return true;
|
|
510
|
+
current = link.cause;
|
|
511
|
+
}
|
|
512
|
+
} catch {}
|
|
513
|
+
return false;
|
|
514
|
+
}
|
|
515
|
+
function describeRetryClassificationSignals(error) {
|
|
516
|
+
let current = error;
|
|
517
|
+
let deepestName;
|
|
518
|
+
let sawMetadata = false;
|
|
519
|
+
let metadataName;
|
|
520
|
+
let metadataRequestId;
|
|
521
|
+
for (let depth = 0; depth < 5 && current != null; depth++) {
|
|
522
|
+
const name = current.name;
|
|
523
|
+
if (depth > 0 && typeof name === "string" && name !== "") deepestName = name;
|
|
524
|
+
const metadata = current.$metadata;
|
|
525
|
+
if (metadata != null && typeof metadata === "object" && !Array.isArray(metadata)) {
|
|
526
|
+
const { httpStatusCode, requestId } = metadata;
|
|
527
|
+
const linkName = typeof name === "string" && name !== "" ? name : void 0;
|
|
528
|
+
if (!sawMetadata) {
|
|
529
|
+
sawMetadata = true;
|
|
530
|
+
metadataName = linkName;
|
|
531
|
+
metadataRequestId = typeof requestId === "string" && requestId !== "" ? requestId : void 0;
|
|
532
|
+
}
|
|
533
|
+
if (typeof httpStatusCode === "number") return {
|
|
534
|
+
name: linkName ?? deepestName,
|
|
535
|
+
httpStatusCode,
|
|
536
|
+
requestId: (typeof requestId === "string" && requestId !== "" ? requestId : void 0) ?? metadataRequestId,
|
|
537
|
+
noMetadata: false
|
|
538
|
+
};
|
|
539
|
+
}
|
|
540
|
+
current = current.cause;
|
|
541
|
+
}
|
|
542
|
+
return {
|
|
543
|
+
name: metadataName ?? deepestName,
|
|
544
|
+
requestId: metadataRequestId,
|
|
545
|
+
noMetadata: !sawMetadata
|
|
546
|
+
};
|
|
547
|
+
}
|
|
548
|
+
function formatRetryClassificationSignals(error) {
|
|
549
|
+
const signals = describeRetryClassificationSignals(error);
|
|
550
|
+
if (signals.name === void 0 && signals.httpStatusCode === void 0 && signals.requestId === void 0) return "";
|
|
551
|
+
const parts = [];
|
|
552
|
+
if (signals.name !== void 0) parts.push(`name=${signals.name}`);
|
|
553
|
+
if (signals.httpStatusCode !== void 0) parts.push(`http=${signals.httpStatusCode}`);
|
|
554
|
+
if (signals.requestId !== void 0) parts.push(`requestId=${signals.requestId}`);
|
|
555
|
+
if (signals.noMetadata) parts.push("no-$metadata");
|
|
556
|
+
return ` [${parts.join(" ")}]`;
|
|
557
|
+
}
|
|
558
|
+
function isRetryableTransientError(error, message) {
|
|
559
|
+
if (isMarkedNonRetryable(error)) return false;
|
|
560
|
+
if (isExplicitDenyError(message)) return false;
|
|
561
|
+
if (isThrottlingError(error)) return true;
|
|
562
|
+
if (isTransientServerError(error)) return true;
|
|
563
|
+
return RETRYABLE_ERROR_MESSAGE_PATTERNS.some((p) => message.includes(p));
|
|
564
|
+
}
|
|
565
|
+
function retryClassificationText(error) {
|
|
566
|
+
const top = describeAwsFailure(error).detail;
|
|
567
|
+
if (!hasRedactedCause(error)) return top;
|
|
568
|
+
const parts = [];
|
|
569
|
+
const seen = /* @__PURE__ */ new Set();
|
|
570
|
+
let current = error;
|
|
571
|
+
for (let depth = 0; depth < 5 && current != null && !seen.has(current); depth++) {
|
|
572
|
+
seen.add(current);
|
|
573
|
+
if (current instanceof Error) {
|
|
574
|
+
if (current.message) parts.push(current.message);
|
|
575
|
+
} else try {
|
|
576
|
+
parts.push(String(current));
|
|
577
|
+
} catch {}
|
|
578
|
+
current = current?.cause;
|
|
579
|
+
}
|
|
580
|
+
return parts.join("\n");
|
|
581
|
+
}
|
|
582
|
+
function isIamPropagationError(message) {
|
|
583
|
+
if (isExplicitDenyError(message)) return false;
|
|
584
|
+
return IAM_PROPAGATION_ERROR_MESSAGE_PATTERNS.some((p) => message.includes(p));
|
|
585
|
+
}
|
|
586
|
+
const EXPLICIT_DENY_PHRASE = "with an explicit deny";
|
|
587
|
+
const EXPLICIT_DENY_POLICY_KINDS = [
|
|
588
|
+
"service control policy",
|
|
589
|
+
"resource control policy",
|
|
590
|
+
"identity-based policy",
|
|
591
|
+
"resource-based policy",
|
|
592
|
+
"permissions boundary",
|
|
593
|
+
"session policy",
|
|
594
|
+
"VPC endpoint policy",
|
|
595
|
+
"role trust policy"
|
|
596
|
+
];
|
|
597
|
+
function isExplicitDenyError(message) {
|
|
598
|
+
return message.includes(EXPLICIT_DENY_PHRASE);
|
|
599
|
+
}
|
|
600
|
+
function explicitDenyPolicyKind(message) {
|
|
601
|
+
const at = message.indexOf(EXPLICIT_DENY_PHRASE);
|
|
602
|
+
if (at < 0) return void 0;
|
|
603
|
+
const rest = message.slice(at + 21);
|
|
604
|
+
const article = /^ in (?:a|an|the) /.exec(rest);
|
|
605
|
+
if (article === null) return void 0;
|
|
606
|
+
const tail = rest.slice(article[0].length);
|
|
607
|
+
return EXPLICIT_DENY_POLICY_KINDS.find((kind) => tail.startsWith(kind));
|
|
608
|
+
}
|
|
609
|
+
|
|
610
|
+
// src/utils/regexp.ts
|
|
611
|
+
function escapeRegExp(value) {
|
|
612
|
+
return value.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
613
|
+
}
|
|
614
|
+
function stripControlChars(value) {
|
|
615
|
+
return value.replace(/[\u0000-\u001f\u007f-\u009f\u200e\u200f\u202a-\u202e\u2066-\u2069]/g, "");
|
|
616
|
+
}
|
|
617
|
+
function stripForDisplay(value) {
|
|
618
|
+
return displaySafe(stripControlChars(value));
|
|
619
|
+
}
|
|
620
|
+
|
|
621
|
+
// src/deployment/retryable-errors/name-collision.ts
|
|
622
|
+
const ALREADY_EXISTS_CODE = /(?<![-:/])\b[A-Za-z0-9]*AlreadyExists(?:Exception|Fault)?\b(?!-)/;
|
|
623
|
+
function isNameCollisionError(message) {
|
|
624
|
+
return /(?<!\b(?:must|not|should|may|cannot)\s)already exists?\b/i.test(message) || ALREADY_EXISTS_CODE.test(message);
|
|
625
|
+
}
|
|
626
|
+
function relayedNameCollision(withheldText) {
|
|
627
|
+
return isNameCollisionError(withheldText) ? " AWS reports that it already exists." : "";
|
|
628
|
+
}
|
|
629
|
+
const NAME_COLLISION_ERROR_NAMES = /* @__PURE__ */ new Set([
|
|
630
|
+
"DuplicateTargetGroupNameException",
|
|
631
|
+
"DuplicateLoadBalancerNameException",
|
|
632
|
+
"DuplicateTrustStoreNameException"
|
|
633
|
+
]);
|
|
634
|
+
const NAME_COLLISION_MARKER = Symbol.for("cdkd.nameCollision");
|
|
635
|
+
function markNameCollision(error) {
|
|
636
|
+
if (!Object.isExtensible(error)) return error;
|
|
637
|
+
Object.defineProperty(error, NAME_COLLISION_MARKER, {
|
|
638
|
+
value: true,
|
|
639
|
+
enumerable: false,
|
|
640
|
+
configurable: true
|
|
641
|
+
});
|
|
642
|
+
return error;
|
|
643
|
+
}
|
|
644
|
+
const REPLAY_MAY_COLLIDE_MARKER = Symbol.for("cdkd.replayMayCollide");
|
|
645
|
+
function markReplayMayCollide(error) {
|
|
646
|
+
try {
|
|
647
|
+
if (typeof error !== "object" && typeof error !== "function" || error === null || !Object.isExtensible(error)) return error;
|
|
648
|
+
Object.defineProperty(error, REPLAY_MAY_COLLIDE_MARKER, {
|
|
649
|
+
value: true,
|
|
650
|
+
enumerable: false,
|
|
651
|
+
configurable: true,
|
|
652
|
+
writable: false
|
|
653
|
+
});
|
|
654
|
+
} catch {}
|
|
655
|
+
return error;
|
|
656
|
+
}
|
|
657
|
+
function hasReplayMayCollide(error) {
|
|
658
|
+
try {
|
|
659
|
+
let current = error;
|
|
660
|
+
for (let depth = 0; depth < 5 && (typeof current === "object" || typeof current === "function") && current !== null; depth++) {
|
|
661
|
+
if (Object.getOwnPropertyDescriptor(current, REPLAY_MAY_COLLIDE_MARKER)?.value === true) return true;
|
|
662
|
+
current = current.cause;
|
|
663
|
+
}
|
|
664
|
+
} catch {}
|
|
665
|
+
return false;
|
|
666
|
+
}
|
|
667
|
+
function isNameCollisionErrorFrom(error, logicalId) {
|
|
668
|
+
if (hasReplayMayCollide(error)) return false;
|
|
669
|
+
return relaysNameCollision(error, logicalId, () => false);
|
|
670
|
+
}
|
|
671
|
+
function isReplayedNameCollisionFrom(error, logicalId, isRetryAnchor) {
|
|
672
|
+
if (!hasReplayMayCollide(error)) return false;
|
|
673
|
+
return relaysNameCollision(error, logicalId, isRetryAnchor);
|
|
674
|
+
}
|
|
675
|
+
function relaysNameCollision(error, logicalId, isRetryAnchor) {
|
|
676
|
+
const topRelaysIt = error instanceof Error && typeof error.message === "string" && isNameCollisionError(error.message);
|
|
677
|
+
let current = error;
|
|
678
|
+
for (let depth = 0; depth < 5 && current != null; depth++) {
|
|
679
|
+
const link = current;
|
|
680
|
+
if (typeof link.logicalId === "string" && link.logicalId !== logicalId && !isRetryAnchor(current)) return false;
|
|
681
|
+
if (typeof link.name === "string" && NAME_COLLISION_ERROR_NAMES.has(link.name)) return true;
|
|
682
|
+
if (link.ccErrorCode === "AlreadyExists") return true;
|
|
683
|
+
if (link[NAME_COLLISION_MARKER] === true) return true;
|
|
684
|
+
if (topRelaysIt && current instanceof Error && isAwsAuthoredFailure(current) && typeof link.message === "string" && isNameCollisionError(link.message)) return true;
|
|
685
|
+
current = link.cause;
|
|
686
|
+
}
|
|
687
|
+
return false;
|
|
688
|
+
}
|
|
689
|
+
function isNameCooldownError(message) {
|
|
690
|
+
return NAME_COOLDOWN_ERROR_MESSAGE_PATTERNS.some((p) => message.includes(p));
|
|
691
|
+
}
|
|
692
|
+
const REDACTED_ALREADY_EXISTS_CLASS = new RegExp(`\\b[A-Za-z0-9]*AlreadyExists(?:Exception|Fault)?(?=\\. ${escapeRegExp(VERBOSE_POINTER)})`, "g");
|
|
693
|
+
function isRecreateRetryableError(message, error) {
|
|
694
|
+
return isNameCollisionError(error !== void 0 && hasRedactedCause(error) ? message.replace(REDACTED_ALREADY_EXISTS_CLASS, "") : message) || isNameCooldownError(message);
|
|
695
|
+
}
|
|
696
|
+
|
|
697
|
+
// src/deployment/retryable-errors/update-unsupported.ts
|
|
698
|
+
const CC_UNSUPPORTED_ACTION_ERROR_NAME = "UnsupportedActionException";
|
|
699
|
+
function isUpdateUnsupportedError(error, logicalId) {
|
|
700
|
+
if (error?.name === "ResourceUpdateNotSupportedError") return false;
|
|
701
|
+
let current = error;
|
|
702
|
+
for (let depth = 0; current !== null && current !== void 0 && depth < 5; depth++) {
|
|
703
|
+
const link = current;
|
|
704
|
+
if (typeof link.logicalId === "string" && link.logicalId !== logicalId) return false;
|
|
705
|
+
if (link.name === "UnsupportedActionException") return true;
|
|
706
|
+
if (link.ccErrorCode === "UnsupportedActionException" && link.ccOperation === "UPDATE") return true;
|
|
707
|
+
current = link.cause;
|
|
708
|
+
}
|
|
709
|
+
return false;
|
|
710
|
+
}
|
|
711
|
+
|
|
712
|
+
// src/utils/error-handler/deploy-errors.ts
|
|
713
|
+
var DependencyError = class DependencyError extends CdkdError {
|
|
714
|
+
constructor(message, cause) {
|
|
715
|
+
super(message, "DEPENDENCY_ERROR", cause);
|
|
716
|
+
this.name = "DependencyError";
|
|
717
|
+
Object.setPrototypeOf(this, DependencyError.prototype);
|
|
718
|
+
}
|
|
719
|
+
};
|
|
720
|
+
var ConfigError = class ConfigError extends CdkdError {
|
|
721
|
+
constructor(message, cause) {
|
|
722
|
+
super(message, "CONFIG_ERROR", cause);
|
|
723
|
+
this.name = "ConfigError";
|
|
724
|
+
Object.setPrototypeOf(this, ConfigError.prototype);
|
|
725
|
+
}
|
|
726
|
+
};
|
|
727
|
+
var PartialFailureError = class PartialFailureError extends CdkdError {
|
|
728
|
+
exitCode = 2;
|
|
729
|
+
constructor(message, cause) {
|
|
730
|
+
super(message, "PARTIAL_FAILURE", cause);
|
|
731
|
+
this.name = "PartialFailureError";
|
|
732
|
+
Object.setPrototypeOf(this, PartialFailureError.prototype);
|
|
733
|
+
}
|
|
734
|
+
};
|
|
735
|
+
var ResourceUpdateNotSupportedError = class ResourceUpdateNotSupportedError extends CdkdError {
|
|
736
|
+
exitCode = 2;
|
|
737
|
+
resourceType;
|
|
738
|
+
logicalId;
|
|
739
|
+
suggestion;
|
|
740
|
+
constructor(resourceType, logicalId, suggestion, cause) {
|
|
741
|
+
super(`${resourceType} (${logicalId}) cannot be updated in place: ${suggestion ? suggestion : "use cdkd deploy with --replace, or change the resource definition to create a new version"}.`, "RESOURCE_UPDATE_NOT_SUPPORTED", cause);
|
|
742
|
+
this.resourceType = resourceType;
|
|
743
|
+
this.logicalId = logicalId;
|
|
744
|
+
this.suggestion = suggestion;
|
|
745
|
+
this.name = "ResourceUpdateNotSupportedError";
|
|
746
|
+
Object.setPrototypeOf(this, ResourceUpdateNotSupportedError.prototype);
|
|
747
|
+
markNonRetryable(this);
|
|
748
|
+
}
|
|
749
|
+
};
|
|
750
|
+
var StackTerminationProtectionError = class StackTerminationProtectionError extends CdkdError {
|
|
751
|
+
stackName;
|
|
752
|
+
constructor(stackName, cause, account, recorded) {
|
|
753
|
+
if (recorded !== void 0) {
|
|
754
|
+
const { command, root, stackRegion } = recorded;
|
|
755
|
+
const bypass = pasteableCommand(command, [
|
|
756
|
+
{
|
|
757
|
+
value: stackName,
|
|
758
|
+
hole: "stack",
|
|
759
|
+
opts: {
|
|
760
|
+
plainIdent: true,
|
|
761
|
+
...command === "cdkd destroy" && { patternMatched: true }
|
|
762
|
+
}
|
|
763
|
+
},
|
|
764
|
+
...stackRegion !== void 0 && command === "cdkd state destroy" ? [{
|
|
765
|
+
flag: "--stack-region",
|
|
766
|
+
value: stackRegion,
|
|
767
|
+
hole: "region",
|
|
768
|
+
opts: { plainIdent: true }
|
|
769
|
+
}] : [],
|
|
770
|
+
{ literal: "--remove-protection" },
|
|
771
|
+
...account?.args ?? []
|
|
772
|
+
]);
|
|
773
|
+
super((root === void 0 ? `Stack ${quotedOrDescribed(stackName, "stack name")} was last deployed with terminationProtection: true and cannot be destroyed.` : `Stack ${quotedOrDescribed(stackName, "stack name")} is nested under ${quotedOrDescribed(root, "stack name")}, which was last deployed with terminationProtection: true, so it cannot be destroyed.`) + (command === "cdkd destroy" ? ` Redeploy it with the protection off, or pass --remove-protection to destroy it anyway;` : ` To destroy it anyway, pass --remove-protection;`) + ` the flag also turns off the deletion protection of each resource it deletes.` + withheldTargetClause(bypass, "stack", command, "This stack's name") + (account?.clause ? ` ${account.clause.trimEnd()}` : "") + `\nDestroy it with: ${bypass.command}`, "STACK_TERMINATION_PROTECTION", cause);
|
|
774
|
+
this.stackName = stackName;
|
|
775
|
+
this.name = "StackTerminationProtectionError";
|
|
776
|
+
Object.setPrototypeOf(this, StackTerminationProtectionError.prototype);
|
|
777
|
+
return;
|
|
778
|
+
}
|
|
779
|
+
const retry = pasteableCommand("cdkd destroy", [{
|
|
780
|
+
value: stackName,
|
|
781
|
+
hole: "stack",
|
|
782
|
+
opts: {
|
|
783
|
+
patternMatched: true,
|
|
784
|
+
plainIdent: true
|
|
785
|
+
}
|
|
786
|
+
}, ...account?.args ?? []]);
|
|
787
|
+
super(`Stack ${quotedOrDescribed(stackName, "stack name")} has terminationProtection: true and cannot be destroyed. Set terminationProtection: false in the CDK code, redeploy, then retry the destroy.` + withheldTargetClause(retry, "stack", "cdkd destroy", "This stack's name") + (account?.clause ? ` ${account.clause.trimEnd()}` : "") + `\nRetry with: ${retry.command}`, "STACK_TERMINATION_PROTECTION", cause);
|
|
788
|
+
this.stackName = stackName;
|
|
789
|
+
this.name = "StackTerminationProtectionError";
|
|
790
|
+
Object.setPrototypeOf(this, StackTerminationProtectionError.prototype);
|
|
791
|
+
}
|
|
792
|
+
};
|
|
793
|
+
var NestedStackChildDirectDestroyError = class NestedStackChildDirectDestroyError extends CdkdError {
|
|
794
|
+
stackName;
|
|
795
|
+
parentStack;
|
|
796
|
+
parentLogicalId;
|
|
797
|
+
constructor(stackName, parentStack, parentLogicalId, cause, account) {
|
|
798
|
+
const accountArgs = account?.args ?? [];
|
|
799
|
+
const logicalIdSuffix = parentLogicalId ? ` (parent's logical id: ${plainOrDescribed(parentLogicalId, "logical id")})` : "";
|
|
800
|
+
const cascade = pasteableCommand("cdkd destroy", [{
|
|
801
|
+
value: parentStack,
|
|
802
|
+
hole: "parent",
|
|
803
|
+
opts: {
|
|
804
|
+
patternMatched: true,
|
|
805
|
+
plainIdent: true
|
|
806
|
+
}
|
|
807
|
+
}, ...accountArgs]);
|
|
808
|
+
const childDestroy = pasteableCommand("cdkd state destroy", [{
|
|
809
|
+
value: stackName,
|
|
810
|
+
hole: "stack",
|
|
811
|
+
opts: { plainIdent: true }
|
|
812
|
+
}, ...accountArgs]);
|
|
813
|
+
const withheld = withheldTargetClause(cascade, "parent", "cdkd destroy", "The parent stack's name") + withheldTargetClause(childDestroy, "stack", "cdkd state destroy", "The child stack's name") + (account?.clause ? ` ${account.clause.trimEnd()}` : "");
|
|
814
|
+
const child = quotedOrDescribed(stackName, "stack name");
|
|
815
|
+
const parent = quotedOrDescribed(parentStack, "stack name");
|
|
816
|
+
super(`Stack ${child} is a nested child of ${parent}${logicalIdSuffix}; directly destroying a nested stack is not supported. Either cascade-delete this child along with its parent, or destroy the child on its own — which deletes its AWS resources and its record, and leaves the parent's reference dangling (the synth-free escape hatch).${withheld}\nCascade-delete with: ${cascade.command}\nDestroy the child alone with: ${childDestroy.command}`, "NESTED_STACK_CHILD_DIRECT_DESTROY", cause);
|
|
817
|
+
this.stackName = stackName;
|
|
818
|
+
this.parentStack = parentStack;
|
|
819
|
+
if (parentLogicalId !== void 0) this.parentLogicalId = parentLogicalId;
|
|
820
|
+
this.name = "NestedStackChildDirectDestroyError";
|
|
821
|
+
Object.setPrototypeOf(this, NestedStackChildDirectDestroyError.prototype);
|
|
822
|
+
}
|
|
823
|
+
};
|
|
824
|
+
function exportNamePhrase(exportName) {
|
|
825
|
+
const shown = plainIdentOr(exportName, "");
|
|
826
|
+
return shown ? `export '${shown}'` : "an export whose name is not a plain identifier";
|
|
827
|
+
}
|
|
828
|
+
var StackHasActiveImportsError = class StackHasActiveImportsError extends CdkdError {
|
|
829
|
+
exitCode = 2;
|
|
830
|
+
producerStack;
|
|
831
|
+
producerRegion;
|
|
832
|
+
consumers;
|
|
833
|
+
constructor(producerStack, producerRegion, consumers, cause) {
|
|
834
|
+
const lines = consumers.map((c) => ` - ${plainOrDescribed(c.consumerStack, "stack name")} (${plainOrDescribed(c.consumerRegion, "region")}): imports ${exportNamePhrase(c.exportName)}`);
|
|
835
|
+
super(`Cannot destroy stack ${quotedOrDescribed(producerStack, "stack name")} (${plainOrDescribed(producerRegion, "region")}): the following stacks still import its outputs via Fn::ImportValue:\n${lines.join("\n")}\n\nThis matches CloudFormation's strong-reference semantics — exports are\nprotected as long as a consumer references them.\n\nTo proceed:\n 1. Destroy the consumer first: cdkd destroy <consumer-stack>\n 2. Or remove the Fn::ImportValue from the consumer's template\n (e.g. inline the value, or refactor) and re-deploy the consumer,\n then retry this destroy.\n\nNote: cdkd's Fn::GetStackOutput intrinsic is a weak alternative that\ndoes NOT protect the producer — use it when you intentionally want\nthe producer to be deletable independently of consumers.`, "STACK_HAS_ACTIVE_IMPORTS", cause);
|
|
836
|
+
this.producerStack = producerStack;
|
|
837
|
+
this.producerRegion = producerRegion;
|
|
838
|
+
this.consumers = consumers;
|
|
839
|
+
this.name = "StackHasActiveImportsError";
|
|
840
|
+
Object.setPrototypeOf(this, StackHasActiveImportsError.prototype);
|
|
841
|
+
}
|
|
842
|
+
};
|
|
843
|
+
|
|
844
|
+
// src/utils/error-handler/command-errors.ts
|
|
845
|
+
var LocalStartServiceError = class LocalStartServiceError extends CdkdError {
|
|
846
|
+
constructor(message, cause) {
|
|
847
|
+
super(message, "LOCAL_START_SERVICE_ERROR", cause);
|
|
848
|
+
this.name = "LocalStartServiceError";
|
|
849
|
+
Object.setPrototypeOf(this, LocalStartServiceError.prototype);
|
|
850
|
+
}
|
|
851
|
+
};
|
|
852
|
+
var MacroExpansionError = class MacroExpansionError extends CdkdError {
|
|
853
|
+
exitCode = 2;
|
|
854
|
+
constructor(message, cause) {
|
|
855
|
+
super(message, "MACRO_EXPANSION_ERROR", cause);
|
|
856
|
+
this.name = "MacroExpansionError";
|
|
857
|
+
Object.setPrototypeOf(this, MacroExpansionError.prototype);
|
|
858
|
+
}
|
|
859
|
+
};
|
|
860
|
+
|
|
861
|
+
// src/utils/error-handler/format.ts
|
|
862
|
+
function isCdkdError(error) {
|
|
863
|
+
return error instanceof CdkdError;
|
|
864
|
+
}
|
|
865
|
+
function formatError(error) {
|
|
866
|
+
if (isCdkdError(error)) {
|
|
867
|
+
let message = `${error.name}: ${error.message}`;
|
|
868
|
+
if (error.cause) {
|
|
869
|
+
const cause = displayAwsMessage(error.cause.message);
|
|
870
|
+
if (cause) message += `\nCaused by: ${cause}`;
|
|
871
|
+
}
|
|
872
|
+
return message;
|
|
873
|
+
}
|
|
874
|
+
if (error instanceof Error) return `${error.name}: ${error.message}`;
|
|
875
|
+
return safeStringify(error);
|
|
876
|
+
}
|
|
877
|
+
function handleError(error) {
|
|
878
|
+
const logger = getLogger();
|
|
879
|
+
const silent = error instanceof CdkdError && error.silent;
|
|
880
|
+
if (isSoftAbort(error)) logger.warn(error.message);
|
|
881
|
+
else if (!silent) logger.error(formatError(error));
|
|
882
|
+
if (error instanceof Error && error.stack) logger.debug("Stack trace:", error.stack);
|
|
883
|
+
const customExitCode = error instanceof CdkdError ? error.exitCode : void 0;
|
|
884
|
+
const exitCode = typeof customExitCode === "number" ? customExitCode : 1;
|
|
885
|
+
process.exit(exitCode);
|
|
886
|
+
}
|
|
887
|
+
function withErrorHandling(fn) {
|
|
888
|
+
return async (...args) => {
|
|
889
|
+
try {
|
|
890
|
+
await fn(...args);
|
|
891
|
+
} catch (error) {
|
|
892
|
+
handleError(error);
|
|
893
|
+
}
|
|
894
|
+
};
|
|
895
|
+
}
|
|
896
|
+
|
|
897
|
+
// src/utils/error-handler/normalize-aws.ts
|
|
898
|
+
function bucketNames(bucket) {
|
|
899
|
+
if (bucket === void 0) return {
|
|
900
|
+
subject: "Bucket '<unknown bucket>'",
|
|
901
|
+
object: "bucket '<unknown bucket>'",
|
|
902
|
+
quoted: "'<unknown bucket>'"
|
|
903
|
+
};
|
|
904
|
+
if (isPasteableIdent(bucket)) return {
|
|
905
|
+
subject: `Bucket '${bucket}'`,
|
|
906
|
+
object: `bucket '${bucket}'`,
|
|
907
|
+
quoted: `'${bucket}'`
|
|
908
|
+
};
|
|
909
|
+
const described = "a bucket whose name is not a plain identifier";
|
|
910
|
+
return {
|
|
911
|
+
subject: "A bucket whose name is not a plain identifier",
|
|
912
|
+
object: described,
|
|
913
|
+
quoted: described
|
|
914
|
+
};
|
|
915
|
+
}
|
|
916
|
+
function normalizeAwsError(err, context = {}) {
|
|
917
|
+
if (!(err instanceof Error)) return new Error(safeStringify(err), { cause: err });
|
|
918
|
+
if (!(err.name === "Unknown" || err.message === "UnknownError")) return err;
|
|
919
|
+
const status = err.$metadata?.httpStatusCode;
|
|
920
|
+
const bucket = bucketNames(context.bucket);
|
|
921
|
+
const operation = context.operation ?? "operation";
|
|
922
|
+
switch (status) {
|
|
923
|
+
case 301: {
|
|
924
|
+
const responseHeaders = err.$response?.headers;
|
|
925
|
+
const region = responseHeaders?.["x-amz-bucket-region"] ?? responseHeaders?.["X-Amz-Bucket-Region"];
|
|
926
|
+
const where = region ? ` (in ${region})` : "";
|
|
927
|
+
return new Error(`${bucket.subject}${where} is in a different region than the client. cdkd resolves this automatically; if you see this message, please report it.`, { cause: err });
|
|
928
|
+
}
|
|
929
|
+
case 403: return new Error(`Access denied to ${bucket.object}. Verify credentials and bucket policy.`, { cause: err });
|
|
930
|
+
case 404: return new Error(`${bucket.subject} does not exist.`, { cause: err });
|
|
931
|
+
default: {
|
|
932
|
+
const statusStr = status !== void 0 ? `HTTP ${status}` : "unknown HTTP status";
|
|
933
|
+
return new Error(`S3 error during ${operation} on ${bucket.quoted} (${statusStr}). See CloudTrail for details.`, { cause: err });
|
|
934
|
+
}
|
|
935
|
+
}
|
|
936
|
+
}
|
|
937
|
+
|
|
938
|
+
// src/utils/ambient-client-defaults.ts
|
|
939
|
+
function ambientCredentialConfig() {
|
|
940
|
+
return getAwsClients()?.credentialConfig ?? {};
|
|
941
|
+
}
|
|
942
|
+
function clientDefaultsFor(credentialConfig, ignoreAssumedRole) {
|
|
943
|
+
return {
|
|
944
|
+
...awsClientDefaults({
|
|
945
|
+
profile: credentialConfig.profile,
|
|
946
|
+
...ignoreAssumedRole !== void 0 && { ignoreAssumedRole }
|
|
947
|
+
}),
|
|
948
|
+
...credentialConfig.profile && { profile: credentialConfig.profile },
|
|
949
|
+
...credentialConfig.credentials && { credentials: { ...credentialConfig.credentials } }
|
|
950
|
+
};
|
|
951
|
+
}
|
|
952
|
+
function ambientClientDefaults() {
|
|
953
|
+
return clientDefaultsFor(ambientCredentialConfig());
|
|
954
|
+
}
|
|
955
|
+
function credentialFingerprint(credentialConfig) {
|
|
956
|
+
return JSON.stringify([credentialConfig.profile ?? null, credentialConfig.credentials?.accessKeyId ?? null]);
|
|
957
|
+
}
|
|
958
|
+
|
|
959
|
+
export { DeploymentNotApprovedError as $, explicitDenyPolicyKind as A, isMarkedNonRetryable as B, isReplayedNameCollisionFrom as C, escapeRegExp as D, relayedNameCollision as E, isIamPropagationError as F, CrossAccountSecretRefusalError as G, markNonRetryable as H, isRetryableTransientError as I, MalformedProducerRecordRefusalError as J, DynamicReferenceRegionAmbiguousError as K, isTransientServerError as L, isAmbiguousCcHandlerErrorCode as M, isAmbiguousOutcomeError as N, stripControlChars as O, isExplicitDenyError as P, DeployCancelledError as Q, retryClassificationText as R, isRecreateRetryableError as S, setPasteableVerbFlags as St, markReplayMayCollide as T, markRedactedCause as U, isThrottlingError as V, wrapMaskedAwsError as W, AssetError as X, AccountIdUnavailableError as Y, CdkdError as Z, StackTerminationProtectionError as _, quotedOrDescribed as _t, normalizeAwsError as a, SynthesisError as at, isNameCollisionErrorFrom as b, withheldTargetClause as bt, withErrorHandling as c, SHELL_ACTIVE as ct, ConfigError as d, commandHole as dt, LocalInvokeBuildError as et, DependencyError as f, hasClauseBreak as ft, StackHasActiveImportsError as g, plainOrDescribed as gt, ResourceUpdateNotSupportedError as h, physicalIdShownBesideCommand as ht, credentialFingerprint as i, StateError as it, formatRetryClassificationSignals as j, stripForDisplay as k, LocalStartServiceError as l, SHELL_ACTIVE_WHY as lt, PartialFailureError as m, pasteableCommand as mt, ambientCredentialConfig as n, ProvisioningError as nt, formatError as o, isSoftAbort as ot, NestedStackChildDirectDestroyError as p, isInertUnquoted as pt, IntrinsicResolutionRefusalError as q, clientDefaultsFor as r, ResourceTimeoutError as rt, isCdkdError as s, TIMEOUT_FLAG_RESOURCE_TYPE as st, ambientClientDefaults as t, LockError as tt, MacroExpansionError as u, UNSHOWABLE_VALUE as ut, isUpdateUnsupportedError as v, shellBoundedDisplay as vt, markNameCollision as w, isNameCooldownError as x, setPasteableRunFlags as xt, hasReplayMayCollide as y, shellQuote as yt, THROTTLING_ERROR_NAMES as z };
|
|
960
|
+
//# sourceMappingURL=ambient-client-defaults-B9bnuob2.js.map
|