cdk-real-drift 0.4.22 → 0.4.24
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/cli.js +66 -11
- package/dist/cli.js.map +1 -1
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -573,11 +573,17 @@ async function loadConfig() {
|
|
|
573
573
|
}
|
|
574
574
|
let parsed;
|
|
575
575
|
const doc = parseDocument(raw, { prettyErrors: true });
|
|
576
|
-
|
|
576
|
+
const [firstError] = doc.errors;
|
|
577
|
+
if (firstError !== void 0) {
|
|
578
|
+
const more = doc.errors.length > 1 ? ` (+${doc.errors.length - 1} more)` : "";
|
|
579
|
+
throw new Error(`${CONFIG_PATH} is not valid YAML: ${firstError.message}${more}`);
|
|
580
|
+
}
|
|
577
581
|
try {
|
|
578
582
|
parsed = doc.toJS();
|
|
579
|
-
} catch {
|
|
580
|
-
|
|
583
|
+
} catch (e) {
|
|
584
|
+
const msg = e.message;
|
|
585
|
+
const hint = /alias|anchor/i.test(msg) ? " — a glob path starting with \"*\" or \"?\" must be quoted (e.g. `path: \"*.DesiredCount\"`) so it is read as a literal, not YAML alias/anchor syntax" : "";
|
|
586
|
+
throw new Error(`${CONFIG_PATH} is not valid YAML: ${msg}${hint}`);
|
|
581
587
|
}
|
|
582
588
|
if (parsed === null || parsed === void 0) return { ignore: [] };
|
|
583
589
|
if (typeof parsed !== "object" || Array.isArray(parsed)) throw new Error(`${CONFIG_PATH} must be a YAML mapping`);
|
|
@@ -3788,6 +3794,16 @@ const TRUE_BOOL_TEST = /^(?:[Yy]es|YES|[Tt]rue|TRUE|[Oo]n|ON)$/;
|
|
|
3788
3794
|
const FALSE_BOOL_TEST = /^(?:[Nn]o|NO|[Ff]alse|FALSE|[Oo]ff|OFF)$/;
|
|
3789
3795
|
const BOOL_TAG = "tag:yaml.org,2002:bool";
|
|
3790
3796
|
const TIMESTAMP_TAG = "tag:yaml.org,2002:timestamp";
|
|
3797
|
+
const INT_TAG = "tag:yaml.org,2002:int";
|
|
3798
|
+
const FLOAT_TAG = "tag:yaml.org,2002:float";
|
|
3799
|
+
const EXOTIC_NUMBER_FORMATS = new Set([
|
|
3800
|
+
"OCT",
|
|
3801
|
+
"HEX",
|
|
3802
|
+
"BIN",
|
|
3803
|
+
"TIME"
|
|
3804
|
+
]);
|
|
3805
|
+
const CFN_INT_TEST = /^[-+]?(?:0|[1-9][0-9]*)$/;
|
|
3806
|
+
const CFN_FLOAT_TEST = /^[-+]?(?:(?:0|[1-9][0-9]*)(?:\.[0-9]*)?|\.[0-9]+)(?:[eE][-+]?[0-9]+)?$/;
|
|
3791
3807
|
function restrictYaml11Tags(baseTags) {
|
|
3792
3808
|
const restricted = [];
|
|
3793
3809
|
for (const tag of baseTags) {
|
|
@@ -3803,6 +3819,25 @@ function restrictYaml11Tags(baseTags) {
|
|
|
3803
3819
|
});
|
|
3804
3820
|
continue;
|
|
3805
3821
|
}
|
|
3822
|
+
if (tag.tag === INT_TAG) {
|
|
3823
|
+
const scalar = tag;
|
|
3824
|
+
if (scalar.format && EXOTIC_NUMBER_FORMATS.has(scalar.format)) continue;
|
|
3825
|
+
restricted.push({
|
|
3826
|
+
...scalar,
|
|
3827
|
+
test: CFN_INT_TEST
|
|
3828
|
+
});
|
|
3829
|
+
continue;
|
|
3830
|
+
}
|
|
3831
|
+
if (tag.tag === FLOAT_TAG) {
|
|
3832
|
+
const scalar = tag;
|
|
3833
|
+
const isNaNTag = scalar.test instanceof RegExp && scalar.test.test(".inf");
|
|
3834
|
+
if (scalar.format && EXOTIC_NUMBER_FORMATS.has(scalar.format) || isNaNTag) continue;
|
|
3835
|
+
restricted.push({
|
|
3836
|
+
...scalar,
|
|
3837
|
+
test: CFN_FLOAT_TEST
|
|
3838
|
+
});
|
|
3839
|
+
continue;
|
|
3840
|
+
}
|
|
3806
3841
|
if (tag.tag === BOOL_TAG) {
|
|
3807
3842
|
const scalar = tag;
|
|
3808
3843
|
const isTrueTag = scalar.identify?.(true) === true;
|
|
@@ -9616,7 +9651,10 @@ const CC_IDENTIFIER_ADAPTERS = {
|
|
|
9616
9651
|
const ruleName = pid.slice(bar + 1);
|
|
9617
9652
|
const busArn = declared.EventBusName;
|
|
9618
9653
|
if (typeof busArn === "string" && busArn.includes(":event-bus/")) return `${busArn.replace(":event-bus/", ":rule/")}/${ruleName}`;
|
|
9619
|
-
if (region && account)
|
|
9654
|
+
if (region && account) {
|
|
9655
|
+
const { partition } = partitionForRegion(region);
|
|
9656
|
+
return `arn:${partition}:events:${region}:${account}:rule/${busName}/${ruleName}`;
|
|
9657
|
+
}
|
|
9620
9658
|
}
|
|
9621
9659
|
};
|
|
9622
9660
|
function scalingPolicyComposite(pid, declared) {
|
|
@@ -13082,6 +13120,7 @@ function toPatchDocument(item) {
|
|
|
13082
13120
|
//#region src/revert/apply.ts
|
|
13083
13121
|
const POLL_INTERVAL_MS = 2e3;
|
|
13084
13122
|
const TIMEOUT_MS = 900 * 1e3;
|
|
13123
|
+
const MAX_POLL_READ_FAILURES = 10;
|
|
13085
13124
|
function isAlreadyGone(e) {
|
|
13086
13125
|
const o = e ?? {};
|
|
13087
13126
|
const name = typeof o.name === "string" ? o.name : "";
|
|
@@ -13090,15 +13129,18 @@ function isAlreadyGone(e) {
|
|
|
13090
13129
|
return m.includes("not found") || m.includes("does not exist") || m.includes("notfound");
|
|
13091
13130
|
}
|
|
13092
13131
|
const sleep$1 = (ms) => new Promise((r) => setTimeout(r, ms));
|
|
13093
|
-
async function pollToCompletion(cc, first) {
|
|
13132
|
+
async function pollToCompletion(cc, first, poll = {}) {
|
|
13133
|
+
const doSleep = poll.sleep ?? sleep$1;
|
|
13134
|
+
const clock = poll.now ?? Date.now;
|
|
13094
13135
|
let event = first;
|
|
13095
13136
|
const token = event?.RequestToken;
|
|
13096
13137
|
if (!token) return {
|
|
13097
13138
|
ok: false,
|
|
13098
13139
|
error: "no request token returned"
|
|
13099
13140
|
};
|
|
13100
|
-
const deadline =
|
|
13101
|
-
|
|
13141
|
+
const deadline = clock() + TIMEOUT_MS;
|
|
13142
|
+
let pollFailures = 0;
|
|
13143
|
+
while (clock() < deadline) {
|
|
13102
13144
|
const status = event?.OperationStatus;
|
|
13103
13145
|
if (status === "SUCCESS") return { ok: true };
|
|
13104
13146
|
if (status === "FAILED" || status === "CANCEL_COMPLETE") {
|
|
@@ -13109,8 +13151,21 @@ async function pollToCompletion(cc, first) {
|
|
|
13109
13151
|
error: code && !msg.includes(code) ? `${code}: ${msg}` : msg
|
|
13110
13152
|
};
|
|
13111
13153
|
}
|
|
13112
|
-
await
|
|
13113
|
-
|
|
13154
|
+
await doSleep(POLL_INTERVAL_MS);
|
|
13155
|
+
try {
|
|
13156
|
+
event = (await cc.send(new GetResourceRequestStatusCommand({ RequestToken: token }))).ProgressEvent;
|
|
13157
|
+
pollFailures = 0;
|
|
13158
|
+
} catch (e) {
|
|
13159
|
+
const text = errorText(e);
|
|
13160
|
+
if (!classifyTransient(text).transient) return {
|
|
13161
|
+
ok: false,
|
|
13162
|
+
error: text
|
|
13163
|
+
};
|
|
13164
|
+
if (++pollFailures >= MAX_POLL_READ_FAILURES) return {
|
|
13165
|
+
ok: false,
|
|
13166
|
+
error: `unable to confirm Cloud Control request status after ${MAX_POLL_READ_FAILURES} poll attempts (mutation NOT resent, to avoid a duplicate write)`
|
|
13167
|
+
};
|
|
13168
|
+
}
|
|
13114
13169
|
}
|
|
13115
13170
|
return {
|
|
13116
13171
|
ok: false,
|
|
@@ -13124,7 +13179,7 @@ async function applyRevertItem(cc, item, identifier = item.physicalId, retry = {
|
|
|
13124
13179
|
TypeName: item.resourceType,
|
|
13125
13180
|
Identifier: identifier,
|
|
13126
13181
|
PatchDocument: toPatchDocument(item)
|
|
13127
|
-
}))).ProgressEvent);
|
|
13182
|
+
}))).ProgressEvent, retry);
|
|
13128
13183
|
} catch (e) {
|
|
13129
13184
|
return {
|
|
13130
13185
|
ok: false,
|
|
@@ -13164,7 +13219,7 @@ async function applyRevertDelete(cc, item, identifier = item.physicalId, retry =
|
|
|
13164
13219
|
const result = await pollToCompletion(cc, (await cc.send(new DeleteResourceCommand({
|
|
13165
13220
|
TypeName: item.resourceType,
|
|
13166
13221
|
Identifier: identifier
|
|
13167
|
-
}))).ProgressEvent);
|
|
13222
|
+
}))).ProgressEvent, retry);
|
|
13168
13223
|
if (!result.ok && isAlreadyGone({ message: result.error })) return { ok: true };
|
|
13169
13224
|
return result;
|
|
13170
13225
|
} catch (e) {
|