cdk-real-drift 0.12.33 → 0.12.35
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 +69 -11
- package/dist/cli.js.map +1 -1
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -1823,8 +1823,8 @@ const TAG_PROPERTY_NAMES = new Set([
|
|
|
1823
1823
|
"TestBotAliasTags",
|
|
1824
1824
|
"TestAliasTags"
|
|
1825
1825
|
]);
|
|
1826
|
-
function stripCcApiAwsManagedFields(awsProps) {
|
|
1827
|
-
return stripWalk(awsProps,
|
|
1826
|
+
function stripCcApiAwsManagedFields(awsProps, freeFormSeed = false) {
|
|
1827
|
+
return stripWalk(awsProps, freeFormSeed);
|
|
1828
1828
|
}
|
|
1829
1829
|
const MANAGED_TIMESTAMP_NAME = /^(creation|created|create|lastmodified|lastupdated|lastupdate|modification|modified|updated|update)(date|time|timestamp|at)$/;
|
|
1830
1830
|
function isManagedTimestampName(key) {
|
|
@@ -5091,8 +5091,12 @@ function sortObjectArraysDeep(v) {
|
|
|
5091
5091
|
}
|
|
5092
5092
|
return v;
|
|
5093
5093
|
}
|
|
5094
|
-
function
|
|
5095
|
-
|
|
5094
|
+
function seedFreeFormFromPath(path) {
|
|
5095
|
+
if (!path) return false;
|
|
5096
|
+
return path.replace(/\[([^\]]*)\]/g, ".$1").split(".").filter((s) => s.length > 0).some((s) => FREE_FORM_MAP_PARENTS.has(s));
|
|
5097
|
+
}
|
|
5098
|
+
function canonicalizeBaselineForCompare(v, resourceType, path) {
|
|
5099
|
+
return sortObjectArraysDeep(canonicalizeForCompare(stripAwsTagsDeep(stripCcApiAwsManagedFields(v, seedFreeFormFromPath(path))), resourceType));
|
|
5096
5100
|
}
|
|
5097
5101
|
|
|
5098
5102
|
//#endregion
|
|
@@ -7929,6 +7933,37 @@ async function pageAppSyncFunctions(client, apiId) {
|
|
|
7929
7933
|
} while (next);
|
|
7930
7934
|
return out;
|
|
7931
7935
|
}
|
|
7936
|
+
function bareApiKeyId(physicalId) {
|
|
7937
|
+
return physicalId.includes("/") ? physicalId.slice(physicalId.lastIndexOf("/") + 1) : physicalId;
|
|
7938
|
+
}
|
|
7939
|
+
function diffGraphQLApiApiKeys(input) {
|
|
7940
|
+
if (input.hasUnresolvedDeclaredApiKey) return [];
|
|
7941
|
+
const declared = new Set(input.declaredApiKeyIds);
|
|
7942
|
+
const added = [];
|
|
7943
|
+
for (const k of input.liveApiKeys) {
|
|
7944
|
+
if (declared.has(k.id)) continue;
|
|
7945
|
+
added.push({
|
|
7946
|
+
resourceType: "AWS::AppSync::ApiKey",
|
|
7947
|
+
identifier: k.id,
|
|
7948
|
+
label: k.label ?? k.id,
|
|
7949
|
+
live: { ApiKeyId: k.id }
|
|
7950
|
+
});
|
|
7951
|
+
}
|
|
7952
|
+
return added;
|
|
7953
|
+
}
|
|
7954
|
+
async function pageApiKeys(client, apiId) {
|
|
7955
|
+
const out = [];
|
|
7956
|
+
let next;
|
|
7957
|
+
do {
|
|
7958
|
+
const res = await client.send(new ListApiKeysCommand({
|
|
7959
|
+
apiId,
|
|
7960
|
+
nextToken: next
|
|
7961
|
+
}));
|
|
7962
|
+
out.push(...res.apiKeys ?? []);
|
|
7963
|
+
next = res.nextToken;
|
|
7964
|
+
} while (next);
|
|
7965
|
+
return out;
|
|
7966
|
+
}
|
|
7932
7967
|
function bareApiId(physicalId) {
|
|
7933
7968
|
return physicalId.includes("/") ? physicalId.slice(physicalId.lastIndexOf("/") + 1) : physicalId;
|
|
7934
7969
|
}
|
|
@@ -7976,6 +8011,20 @@ async function enumerateGraphQLApiChildren(ctx) {
|
|
|
7976
8011
|
}
|
|
7977
8012
|
declaredFunctionArns.push(r.physicalId);
|
|
7978
8013
|
}
|
|
8014
|
+
const declaredApiKeyIds = [];
|
|
8015
|
+
let apiKeyIdUnresolved = false;
|
|
8016
|
+
for (const r of desired.resources) {
|
|
8017
|
+
if (r.resourceType !== "AWS::AppSync::ApiKey") continue;
|
|
8018
|
+
const declaredApiId = r.declared.ApiId;
|
|
8019
|
+
if (declaredApiId !== UNRESOLVED && !hasUnresolved(declaredApiId)) {
|
|
8020
|
+
if (typeof declaredApiId !== "string" || bareApiId(declaredApiId) !== apiId) continue;
|
|
8021
|
+
}
|
|
8022
|
+
if (!r.physicalId) {
|
|
8023
|
+
apiKeyIdUnresolved = true;
|
|
8024
|
+
continue;
|
|
8025
|
+
}
|
|
8026
|
+
declaredApiKeyIds.push(bareApiKeyId(r.physicalId));
|
|
8027
|
+
}
|
|
7979
8028
|
const client = new AppSyncClient({
|
|
7980
8029
|
region,
|
|
7981
8030
|
...READ_RETRY
|
|
@@ -8012,10 +8061,19 @@ async function enumerateGraphQLApiChildren(ctx) {
|
|
|
8012
8061
|
label: f.name ?? f.functionArn
|
|
8013
8062
|
}))
|
|
8014
8063
|
});
|
|
8064
|
+
const apiKeyAdded = diffGraphQLApiApiKeys({
|
|
8065
|
+
declaredApiKeyIds,
|
|
8066
|
+
liveApiKeys: (await pageApiKeys(client, apiId)).filter((k) => typeof k.id === "string").map((k) => ({
|
|
8067
|
+
id: k.id,
|
|
8068
|
+
label: k.description ? `${k.id} (${k.description})` : k.id
|
|
8069
|
+
})),
|
|
8070
|
+
hasUnresolvedDeclaredApiKey: apiKeyIdUnresolved
|
|
8071
|
+
});
|
|
8015
8072
|
return [
|
|
8016
8073
|
...datasourceAdded,
|
|
8017
8074
|
...resolverAdded,
|
|
8018
|
-
...functionAdded
|
|
8075
|
+
...functionAdded,
|
|
8076
|
+
...apiKeyAdded
|
|
8019
8077
|
];
|
|
8020
8078
|
}
|
|
8021
8079
|
function diffLogGroupFilters(logGroupName, resourceType, declaredFilterNames, liveFilters, identifierOf) {
|
|
@@ -12731,12 +12789,12 @@ function carryForwardIgnored(recorded, existing, findings) {
|
|
|
12731
12789
|
* type-agnostic over UNDECLARED snapshot fragments, which never carry an
|
|
12732
12790
|
* order-significant declared array, so an order-insensitive sort is safe here.
|
|
12733
12791
|
*/
|
|
12734
|
-
function baselineValueMatches(baselineValue, currentCanonicalValue, resourceType) {
|
|
12792
|
+
function baselineValueMatches(baselineValue, currentCanonicalValue, resourceType, path) {
|
|
12735
12793
|
if (isRedactedHashSentinel(baselineValue) || isRedactedHashSentinel(currentCanonicalValue)) {
|
|
12736
|
-
const asHash = (v) => redactedHashOf(isRedactedHashSentinel(v) ? v : canonicalizeBaselineForCompare(v, resourceType));
|
|
12794
|
+
const asHash = (v) => redactedHashOf(isRedactedHashSentinel(v) ? v : canonicalizeBaselineForCompare(v, resourceType, path));
|
|
12737
12795
|
return asHash(baselineValue) === asHash(currentCanonicalValue);
|
|
12738
12796
|
}
|
|
12739
|
-
return deepEqual(canonicalizeBaselineForCompare(baselineValue, resourceType), canonicalizeBaselineForCompare(currentCanonicalValue, resourceType));
|
|
12797
|
+
return deepEqual(canonicalizeBaselineForCompare(baselineValue, resourceType, path), canonicalizeBaselineForCompare(currentCanonicalValue, resourceType, path));
|
|
12740
12798
|
}
|
|
12741
12799
|
const DELTA_IDENTITY_FIELDS = [
|
|
12742
12800
|
"Key",
|
|
@@ -12818,7 +12876,7 @@ function splitRecordedByBaseline(recorded, baseline) {
|
|
|
12818
12876
|
const changed = [];
|
|
12819
12877
|
for (const entry of recorded) {
|
|
12820
12878
|
const baselineEntry = baseline.recorded.find((a) => a.logicalId === entry.logicalId && a.path === entry.path && a.resourceType === entry.resourceType);
|
|
12821
|
-
if (baselineEntry && baselineValueMatches(baselineEntry.value, entry.value, entry.resourceType)) unchanged.push(entry);
|
|
12879
|
+
if (baselineEntry && baselineValueMatches(baselineEntry.value, entry.value, entry.resourceType, entry.path)) unchanged.push(entry);
|
|
12822
12880
|
else changed.push(entry);
|
|
12823
12881
|
}
|
|
12824
12882
|
return {
|
|
@@ -12979,7 +13037,7 @@ function applyBaseline(findings, baseline, opts = {}) {
|
|
|
12979
13037
|
});
|
|
12980
13038
|
continue;
|
|
12981
13039
|
}
|
|
12982
|
-
if (entry && baselineValueMatches(entry.value, f.actual, f.resourceType)) continue;
|
|
13040
|
+
if (entry && baselineValueMatches(entry.value, f.actual, f.resourceType, f.path)) continue;
|
|
12983
13041
|
if (entry) {
|
|
12984
13042
|
kept.push({
|
|
12985
13043
|
...f,
|
|
@@ -12999,7 +13057,7 @@ function applyBaseline(findings, baseline, opts = {}) {
|
|
|
12999
13057
|
continue;
|
|
13000
13058
|
}
|
|
13001
13059
|
const entry = replacedLogical.has(f.logicalId) ? void 0 : recorded.find((a) => entryMatches(a, f));
|
|
13002
|
-
if (entry && baselineValueMatches(entry.value, f.actual, f.resourceType)) continue;
|
|
13060
|
+
if (entry && baselineValueMatches(entry.value, f.actual, f.resourceType, f.path)) continue;
|
|
13003
13061
|
if (entry) {
|
|
13004
13062
|
const delta = identityArrayDelta(canonicalizeForCompare(entry.value, f.resourceType), f.actual);
|
|
13005
13063
|
kept.push({
|