cdk-real-drift 0.4.26 → 0.4.28
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 -10
- package/dist/cli.js.map +1 -1
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -5934,14 +5934,17 @@ async function enumerateRestApiChildren(ctx) {
|
|
|
5934
5934
|
const declaredModelNames = [];
|
|
5935
5935
|
const declaredValidatorIds = [];
|
|
5936
5936
|
const declaredResponseTypes = [];
|
|
5937
|
+
let gatewayResponseTypeUnresolved = false;
|
|
5937
5938
|
const declaredStageNames = [];
|
|
5938
5939
|
for (const r of desired.resources) if (r.resourceType === "AWS::ApiGateway::Authorizer" && parentRefMatches(r.declared.RestApiId, apiId) && r.physicalId) declaredAuthorizerIds.push(r.physicalId);
|
|
5939
5940
|
else if (r.resourceType === "AWS::ApiGateway::Model" && parentRefMatches(r.declared.RestApiId, apiId)) {
|
|
5940
5941
|
const name = typeof r.declared.Name === "string" ? r.declared.Name : r.physicalId;
|
|
5941
5942
|
if (name) declaredModelNames.push(name);
|
|
5942
5943
|
} else if (r.resourceType === "AWS::ApiGateway::RequestValidator" && parentRefMatches(r.declared.RestApiId, apiId) && r.physicalId) declaredValidatorIds.push(r.physicalId);
|
|
5943
|
-
else if (r.resourceType === "AWS::ApiGateway::GatewayResponse" && parentRefMatches(r.declared.RestApiId, apiId)
|
|
5944
|
-
|
|
5944
|
+
else if (r.resourceType === "AWS::ApiGateway::GatewayResponse" && parentRefMatches(r.declared.RestApiId, apiId)) {
|
|
5945
|
+
if (r.declared.ResponseType === UNRESOLVED || hasUnresolved(r.declared.ResponseType)) gatewayResponseTypeUnresolved = true;
|
|
5946
|
+
else if (typeof r.declared.ResponseType === "string") declaredResponseTypes.push(r.declared.ResponseType);
|
|
5947
|
+
} else if (r.resourceType === "AWS::ApiGateway::Stage" && parentRefMatches(r.declared.RestApiId, apiId)) {
|
|
5945
5948
|
const name = typeof r.declared.StageName === "string" ? r.declared.StageName : r.physicalId;
|
|
5946
5949
|
if (name) declaredStageNames.push(name);
|
|
5947
5950
|
}
|
|
@@ -6009,7 +6012,8 @@ async function enumerateRestApiChildren(ctx) {
|
|
|
6009
6012
|
liveResponseTypes: (await getAllGatewayResponses(client, apiId)).filter((g) => typeof g.responseType === "string").map((g) => ({
|
|
6010
6013
|
type: g.responseType,
|
|
6011
6014
|
label: g.responseType
|
|
6012
|
-
}))
|
|
6015
|
+
})),
|
|
6016
|
+
hasUnresolvedDeclaredResponseType: gatewayResponseTypeUnresolved
|
|
6013
6017
|
});
|
|
6014
6018
|
const stageAdded = diffApiGatewayStages({
|
|
6015
6019
|
apiId,
|
|
@@ -6148,6 +6152,7 @@ async function getAllRequestValidators(client, apiId) {
|
|
|
6148
6152
|
return out;
|
|
6149
6153
|
}
|
|
6150
6154
|
function diffApiGatewayGatewayResponses(input) {
|
|
6155
|
+
if (input.hasUnresolvedDeclaredResponseType) return [];
|
|
6151
6156
|
const { apiId, declaredResponseTypes, liveResponseTypes } = input;
|
|
6152
6157
|
const declared = new Set(declaredResponseTypes);
|
|
6153
6158
|
const added = [];
|
|
@@ -6780,6 +6785,7 @@ async function enumerateUserPoolChildren(ctx) {
|
|
|
6780
6785
|
];
|
|
6781
6786
|
}
|
|
6782
6787
|
function diffGraphQLApiChildren(input) {
|
|
6788
|
+
if (input.hasUnresolvedDeclaredDataSource) return [];
|
|
6783
6789
|
const declared = new Set(input.declaredDataSourceNames);
|
|
6784
6790
|
const added = [];
|
|
6785
6791
|
for (const ds of input.liveDataSources) {
|
|
@@ -6810,6 +6816,7 @@ async function pageDataSources(client, apiId) {
|
|
|
6810
6816
|
return out;
|
|
6811
6817
|
}
|
|
6812
6818
|
function diffGraphQLApiResolvers(input) {
|
|
6819
|
+
if (input.hasUnresolvedDeclaredResolver) return [];
|
|
6813
6820
|
const declared = new Set(input.declaredResolverKeys);
|
|
6814
6821
|
const added = [];
|
|
6815
6822
|
for (const r of input.liveResolvers) {
|
|
@@ -6886,15 +6893,22 @@ async function enumerateGraphQLApiChildren(ctx) {
|
|
|
6886
6893
|
if (!parent.physicalId) return [];
|
|
6887
6894
|
const apiId = bareApiId(parent.physicalId);
|
|
6888
6895
|
const declaredDataSourceNames = [];
|
|
6896
|
+
let datasourceNameUnresolved = false;
|
|
6889
6897
|
for (const r of desired.resources) {
|
|
6890
|
-
if (r.resourceType !== "AWS::AppSync::DataSource"
|
|
6898
|
+
if (r.resourceType !== "AWS::AppSync::DataSource") continue;
|
|
6891
6899
|
const declaredApiId = r.declared.ApiId;
|
|
6892
6900
|
if (declaredApiId !== UNRESOLVED && !hasUnresolved(declaredApiId)) {
|
|
6893
6901
|
if (typeof declaredApiId !== "string" || bareApiId(declaredApiId) !== apiId) continue;
|
|
6894
6902
|
}
|
|
6903
|
+
if (r.declared.Name === UNRESOLVED || hasUnresolved(r.declared.Name)) {
|
|
6904
|
+
datasourceNameUnresolved = true;
|
|
6905
|
+
continue;
|
|
6906
|
+
}
|
|
6907
|
+
if (typeof r.declared.Name !== "string") continue;
|
|
6895
6908
|
declaredDataSourceNames.push(r.declared.Name);
|
|
6896
6909
|
}
|
|
6897
6910
|
const declaredResolverKeys = [];
|
|
6911
|
+
let resolverKeyUnresolved = false;
|
|
6898
6912
|
for (const r of desired.resources) {
|
|
6899
6913
|
if (r.resourceType !== "AWS::AppSync::Resolver") continue;
|
|
6900
6914
|
const declaredApiId = r.declared.ApiId;
|
|
@@ -6902,6 +6916,10 @@ async function enumerateGraphQLApiChildren(ctx) {
|
|
|
6902
6916
|
if (typeof declaredApiId !== "string" || bareApiId(declaredApiId) !== apiId) continue;
|
|
6903
6917
|
}
|
|
6904
6918
|
const { TypeName, FieldName } = r.declared;
|
|
6919
|
+
if (TypeName === UNRESOLVED || hasUnresolved(TypeName) || FieldName === UNRESOLVED || hasUnresolved(FieldName)) {
|
|
6920
|
+
resolverKeyUnresolved = true;
|
|
6921
|
+
continue;
|
|
6922
|
+
}
|
|
6905
6923
|
if (typeof TypeName !== "string" || typeof FieldName !== "string") continue;
|
|
6906
6924
|
declaredResolverKeys.push(`${TypeName}|${FieldName}`);
|
|
6907
6925
|
}
|
|
@@ -6924,7 +6942,8 @@ async function enumerateGraphQLApiChildren(ctx) {
|
|
|
6924
6942
|
name: ds.name,
|
|
6925
6943
|
arn: ds.dataSourceArn,
|
|
6926
6944
|
label: ds.type ? `${ds.type} ${ds.name}` : ds.name
|
|
6927
|
-
}))
|
|
6945
|
+
})),
|
|
6946
|
+
hasUnresolvedDeclaredDataSource: datasourceNameUnresolved
|
|
6928
6947
|
});
|
|
6929
6948
|
const types = await pageTypes(client, apiId);
|
|
6930
6949
|
const liveResolvers = [];
|
|
@@ -6939,7 +6958,8 @@ async function enumerateGraphQLApiChildren(ctx) {
|
|
|
6939
6958
|
}
|
|
6940
6959
|
const resolverAdded = diffGraphQLApiResolvers({
|
|
6941
6960
|
declaredResolverKeys,
|
|
6942
|
-
liveResolvers
|
|
6961
|
+
liveResolvers,
|
|
6962
|
+
hasUnresolvedDeclaredResolver: resolverKeyUnresolved
|
|
6943
6963
|
});
|
|
6944
6964
|
const functionAdded = diffGraphQLApiFunctions({
|
|
6945
6965
|
declaredFunctionArns,
|
|
@@ -10093,6 +10113,23 @@ function stackCountAnnouncement(stackNames) {
|
|
|
10093
10113
|
|
|
10094
10114
|
//#endregion
|
|
10095
10115
|
//#region src/baseline/baseline-file.ts
|
|
10116
|
+
const KNOWN_BASELINE_KEYS = new Set([
|
|
10117
|
+
"schemaVersion",
|
|
10118
|
+
"stackName",
|
|
10119
|
+
"region",
|
|
10120
|
+
"accountId",
|
|
10121
|
+
"capturedAt",
|
|
10122
|
+
"templateHash",
|
|
10123
|
+
"recorded",
|
|
10124
|
+
"completeResources",
|
|
10125
|
+
"recordedPhysicalIds"
|
|
10126
|
+
]);
|
|
10127
|
+
const KNOWN_RECORDED_ENTRY_KEYS = new Set([
|
|
10128
|
+
"logicalId",
|
|
10129
|
+
"resourceType",
|
|
10130
|
+
"path",
|
|
10131
|
+
"value"
|
|
10132
|
+
]);
|
|
10096
10133
|
function baselinePath(stackName, accountId, region) {
|
|
10097
10134
|
return `.cdkrd/baselines/${stackName}.${accountId}.${region}.json`;
|
|
10098
10135
|
}
|
|
@@ -10122,6 +10159,8 @@ async function loadBaseline(stackName, accountId, region) {
|
|
|
10122
10159
|
if (parsed.schemaVersion !== void 0 && typeof parsed.schemaVersion !== "number") throw new Error(`baseline file ${path} has a non-numeric schemaVersion (${JSON.stringify(parsed.schemaVersion)}); it is malformed (corrupt or hand-edited)`);
|
|
10123
10160
|
if (typeof parsed.schemaVersion === "number" && parsed.schemaVersion > 2) throw new Error(`baseline file ${path} was written by a newer cdkrd (schemaVersion ${parsed.schemaVersion}); upgrade cdkrd`);
|
|
10124
10161
|
if (!Array.isArray(parsed.recorded)) throw new Error(`baseline file ${path} is malformed: \`recorded\` is missing or not an array`);
|
|
10162
|
+
const unknownTop = Object.keys(parsed).filter((k) => !KNOWN_BASELINE_KEYS.has(k));
|
|
10163
|
+
if (unknownTop.length > 0) throw new Error(`baseline file ${path}: unknown key(s) ${unknownTop.map((k) => `"${k}"`).join(", ")} — known keys: ${[...KNOWN_BASELINE_KEYS].map((k) => `"${k}"`).join(", ")} (a typo silently disables detection; correct or remove it)`);
|
|
10125
10164
|
parsed.recorded.forEach((entry, i) => validateRecordedEntry(entry, i, path));
|
|
10126
10165
|
validateRecordedUniqueness(parsed.recorded, path);
|
|
10127
10166
|
validateCompleteResources(parsed.completeResources, path);
|
|
@@ -10146,6 +10185,9 @@ function validateRecordedEntry(entry, index, path) {
|
|
|
10146
10185
|
"resourceType",
|
|
10147
10186
|
"path"
|
|
10148
10187
|
]) if (typeof obj[k] !== "string") throw new Error(`${at}: "${k}" is required and must be a string`);
|
|
10188
|
+
const unknown = Object.keys(obj).filter((k) => !KNOWN_RECORDED_ENTRY_KEYS.has(k));
|
|
10189
|
+
if (unknown.length > 0) throw new Error(`${at}: unknown key(s) ${unknown.map((k) => `"${k}"`).join(", ")} — known keys: "logicalId", "resourceType", "path", "value" (a typo'd "value" false-flags confirmed drift)`);
|
|
10190
|
+
if (!("value" in obj)) throw new Error(`${at}: "value" is required (use null for an empty value)`);
|
|
10149
10191
|
}
|
|
10150
10192
|
/**
|
|
10151
10193
|
* #1047: reject duplicate `recorded` identity keys at load. The baseline is git-committed,
|
|
@@ -11761,26 +11803,37 @@ const writeDaxCluster = async (ctx, ops) => {
|
|
|
11761
11803
|
const writeDaxParameterGroup = async (ctx, ops) => {
|
|
11762
11804
|
const name = str(ctx.physicalId) ?? str(ctx.declared["ParameterGroupName"]);
|
|
11763
11805
|
if (!name) throw new Error("cannot resolve DAX parameter-group name for revert");
|
|
11764
|
-
const
|
|
11806
|
+
const reader = SDK_OVERRIDES["AWS::DAX::ParameterGroup"];
|
|
11807
|
+
const live = (reader && await reader(ctx)) ?? {};
|
|
11808
|
+
const liveValues = live.ParameterNameValues ?? {};
|
|
11809
|
+
const desiredValues = applyOps(live, ops).ParameterNameValues ?? {};
|
|
11765
11810
|
const keys = /* @__PURE__ */ new Set();
|
|
11811
|
+
const unExpressible = /* @__PURE__ */ new Set();
|
|
11766
11812
|
for (const op of ops) {
|
|
11767
11813
|
const segs = op.path.replace(/^\//, "").split("/");
|
|
11768
11814
|
if (segs[0] !== "ParameterNameValues") continue;
|
|
11769
|
-
if (segs[1] !== void 0)
|
|
11815
|
+
if (segs[1] !== void 0) {
|
|
11816
|
+
const key = segs[1].replace(/~1/g, "/").replace(/~0/g, "~");
|
|
11817
|
+
if (op.op === "remove") unExpressible.add(key);
|
|
11818
|
+
else keys.add(key);
|
|
11819
|
+
} else if (op.op === "remove") for (const k of Object.keys(liveValues)) unExpressible.add(k);
|
|
11770
11820
|
else for (const k of Object.keys(desiredValues)) keys.add(k);
|
|
11771
11821
|
}
|
|
11772
11822
|
const values = [...keys].filter((k) => typeof desiredValues[k] === "string").map((k) => ({
|
|
11773
11823
|
ParameterName: k,
|
|
11774
11824
|
ParameterValue: desiredValues[k]
|
|
11775
11825
|
}));
|
|
11776
|
-
if (values.length
|
|
11777
|
-
await new DAXClient({
|
|
11826
|
+
if (values.length > 0) await new DAXClient({
|
|
11778
11827
|
region: ctx.region,
|
|
11779
11828
|
...CLIENT_TIMEOUTS
|
|
11780
11829
|
}).send(new UpdateParameterGroupCommand({
|
|
11781
11830
|
ParameterGroupName: name,
|
|
11782
11831
|
ParameterNameValues: values
|
|
11783
11832
|
}));
|
|
11833
|
+
if (unExpressible.size > 0) {
|
|
11834
|
+
const names = [...unExpressible].join(", ");
|
|
11835
|
+
throw new Error(`DAX ParameterGroup parameter ${names} cannot be cleared via UpdateParameterGroup (DAX has no ResetParameterGroup API, so an out-of-band-added parameter's unset state is not expressible)${values.length > 0 ? "; the other revert op(s) were applied" : ""}; update ${unExpressible.size > 1 ? "them" : "it"} manually`);
|
|
11836
|
+
}
|
|
11784
11837
|
};
|
|
11785
11838
|
const writeElastiCacheParameterGroup = async (ctx, ops) => {
|
|
11786
11839
|
const name = str(ctx.physicalId) ?? str(ctx.declared["CacheParameterGroupName"]);
|
|
@@ -12577,13 +12630,19 @@ const SYNTHETIC_READ_SIGNAL_PATHS = { "AWS::ElasticLoadBalancingV2::TrustStore":
|
|
|
12577
12630
|
const CC_REVERTABLE_DESPITE_READ_OVERRIDE = new Set(["AWS::Scheduler::Schedule", "AWS::Cognito::IdentityPool"]);
|
|
12578
12631
|
const REVERT_SET_DEFAULT_PATHS = new Set([
|
|
12579
12632
|
"AWS::IAM::Role\0MaxSessionDuration",
|
|
12633
|
+
"AWS::IAM::Role\0Description",
|
|
12580
12634
|
"AWS::Lambda::Alias\0Description",
|
|
12581
12635
|
"AWS::Cognito::IdentityPool\0AllowClassicFlow",
|
|
12582
12636
|
"AWS::Transfer::Server\0SecurityPolicyName",
|
|
12637
|
+
"AWS::Transfer::Server\0IpAddressType",
|
|
12638
|
+
"AWS::Transfer::Server\0ProtocolDetails",
|
|
12639
|
+
"AWS::Transfer::Server\0S3StorageOptions",
|
|
12583
12640
|
"AWS::AppRunner::Service\0HealthCheckConfiguration",
|
|
12584
12641
|
"AWS::AppRunner::Service\0NetworkConfiguration",
|
|
12585
12642
|
"AWS::Location::Tracker\0PositionFiltering",
|
|
12643
|
+
"AWS::Location::Tracker\0PricingPlan",
|
|
12586
12644
|
"AWS::Location::PlaceIndex\0DataSourceConfiguration",
|
|
12645
|
+
"AWS::Location::PlaceIndex\0PricingPlan",
|
|
12587
12646
|
"AWS::Events::ApiDestination\0InvocationRateLimitPerSecond",
|
|
12588
12647
|
"AWS::Cognito::UserPool\0DeletionProtection",
|
|
12589
12648
|
"AWS::Cognito::UserPool\0MfaConfiguration",
|