cdk-real-drift 0.4.6 → 0.4.8
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/README.md +1 -1
- package/dist/cli.js +34 -4
- package/dist/cli.js.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -358,7 +358,7 @@ CI (with `--yes`).
|
|
|
358
358
|
| option | meaning |
|
|
359
359
|
| -------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
360
360
|
| `--region <r>` | a stack's own `env.region` ALWAYS wins; for an env-AGNOSTIC stack (no `env`) it falls back to `--region` (or `$AWS_REGION` / `$AWS_DEFAULT_REGION`), else the AWS-CLI/cdk region chain — the active profile's region, then the `[default]` profile's region, then EC2 IMDS |
|
|
361
|
-
| `--profile <p>` | AWS profile (
|
|
361
|
+
| `--profile <p>` | AWS profile (else `$AWS_PROFILE`, else `$AWS_DEFAULT_PROFILE` — same order `aws` and `cdk` use) |
|
|
362
362
|
| `-a, --app <cmd\|cdk.out>` | CDK app command or pre-synthesized assembly dir (or `$CDKRD_APP` / cdk.json `"app"`); stack auto-discovery + construct paths |
|
|
363
363
|
| `-c, --context key=value` | context for synth (repeatable; cdk.json is the base layer) |
|
|
364
364
|
| `--all` | target every stack the app defines (the default when no `<stack>` is named; overrides any positional names) |
|
package/dist/cli.js
CHANGED
|
@@ -11,7 +11,7 @@ import { KMSClient, ListAliasesCommand } from "@aws-sdk/client-kms";
|
|
|
11
11
|
import { APIGatewayClient, GetAuthorizersCommand, GetGatewayResponsesCommand, GetModelsCommand, GetRequestValidatorsCommand, GetResourcesCommand, UpdateIntegrationCommand, UpdateIntegrationResponseCommand, UpdateMethodResponseCommand, UpdateRestApiCommand } from "@aws-sdk/client-api-gateway";
|
|
12
12
|
import { AppConfigClient, ListConfigurationProfilesCommand, ListEnvironmentsCommand } from "@aws-sdk/client-appconfig";
|
|
13
13
|
import { AppSyncClient, ListApiKeysCommand, ListDataSourcesCommand, ListFunctionsCommand, ListResolversCommand, ListTypesCommand } from "@aws-sdk/client-appsync";
|
|
14
|
-
import { ApiGatewayV2Client, GetAuthorizersCommand as GetAuthorizersCommand$1, GetIntegrationsCommand, GetRoutesCommand, GetStagesCommand, UpdateStageCommand } from "@aws-sdk/client-apigatewayv2";
|
|
14
|
+
import { ApiGatewayV2Client, DeleteAccessLogSettingsCommand, DeleteRouteSettingsCommand, GetAuthorizersCommand as GetAuthorizersCommand$1, GetIntegrationsCommand, GetRoutesCommand, GetStagesCommand, UpdateStageCommand } from "@aws-sdk/client-apigatewayv2";
|
|
15
15
|
import { CloudWatchLogsClient, DescribeMetricFiltersCommand, DescribeSubscriptionFiltersCommand, PutBearerTokenAuthenticationCommand, PutMetricFilterCommand } from "@aws-sdk/client-cloudwatch-logs";
|
|
16
16
|
import { CognitoIdentityProviderClient, ListGroupsCommand, ListResourceServersCommand, ListUserPoolClientsCommand } from "@aws-sdk/client-cognito-identity-provider";
|
|
17
17
|
import { DescribeAddressesCommand, DescribeClientVpnAuthorizationRulesCommand, DescribeClientVpnEndpointsCommand, DescribeClientVpnTargetNetworksCommand, DescribeLaunchTemplateVersionsCommand, DescribeNetworkAclsCommand, DescribeRouteTablesCommand, DescribeSubnetsCommand, EC2Client, ModifyClientVpnEndpointCommand } from "@aws-sdk/client-ec2";
|
|
@@ -403,7 +403,7 @@ function parseCommonArgs(args, verb) {
|
|
|
403
403
|
all: has("--all"),
|
|
404
404
|
context,
|
|
405
405
|
region: values["--region"] ?? process.env.AWS_REGION ?? process.env.AWS_DEFAULT_REGION,
|
|
406
|
-
profile: values["--profile"] ?? process.env.AWS_PROFILE,
|
|
406
|
+
profile: values["--profile"] ?? process.env.AWS_PROFILE ?? process.env.AWS_DEFAULT_PROFILE,
|
|
407
407
|
app: values["--app"] ?? process.env.CDKRD_APP,
|
|
408
408
|
json: has("--json"),
|
|
409
409
|
fail: has("--fail"),
|
|
@@ -11808,16 +11808,46 @@ const writeApiGatewayV2Stage = async (ctx, ops) => {
|
|
|
11808
11808
|
if (!apiId || !stageName) throw new Error("cannot resolve ApiId|StageName for ApiGatewayV2 Stage revert");
|
|
11809
11809
|
const desired = applyOps({ ...ctx.declared }, ops);
|
|
11810
11810
|
const touched = new Set(ops.map((o) => o.path.replace(/^\//, "").split("/")[0]).filter((p) => !!p));
|
|
11811
|
+
const isCleared = (field) => desired[field] === void 0 && ops.some((o) => o.op === "remove" && o.path.replace(/^\//, "").split("/")[0] === field);
|
|
11812
|
+
const clearedSubKeys = (field) => {
|
|
11813
|
+
const keys = /* @__PURE__ */ new Set();
|
|
11814
|
+
for (const o of ops) {
|
|
11815
|
+
if (o.op !== "remove") continue;
|
|
11816
|
+
const segs = o.path.replace(/^\//, "").split("/");
|
|
11817
|
+
if (segs[0] !== field) continue;
|
|
11818
|
+
if (segs.length >= 2 && segs[1]) keys.add(segs[1]);
|
|
11819
|
+
else for (const k of Object.keys(asRecord(o.prior))) keys.add(k);
|
|
11820
|
+
}
|
|
11821
|
+
return [...keys];
|
|
11822
|
+
};
|
|
11823
|
+
const client = new ApiGatewayV2Client({ region: ctx.region });
|
|
11824
|
+
if (touched.has("AccessLogSettings") && isCleared("AccessLogSettings")) await client.send(new DeleteAccessLogSettingsCommand({
|
|
11825
|
+
ApiId: apiId,
|
|
11826
|
+
StageName: stageName
|
|
11827
|
+
}));
|
|
11828
|
+
if (touched.has("RouteSettings") && isCleared("RouteSettings")) for (const routeKey of clearedSubKeys("RouteSettings")) await client.send(new DeleteRouteSettingsCommand({
|
|
11829
|
+
ApiId: apiId,
|
|
11830
|
+
StageName: stageName,
|
|
11831
|
+
RouteKey: routeKey
|
|
11832
|
+
}));
|
|
11811
11833
|
const input = {
|
|
11812
11834
|
ApiId: apiId,
|
|
11813
11835
|
StageName: stageName
|
|
11814
11836
|
};
|
|
11815
11837
|
for (const p of touched) {
|
|
11816
11838
|
if (!APIGWV2_STAGE_UPDATE_FIELDS.has(p)) continue;
|
|
11839
|
+
if (p === "AccessLogSettings" && isCleared("AccessLogSettings")) continue;
|
|
11840
|
+
if (p === "RouteSettings" && isCleared("RouteSettings")) continue;
|
|
11841
|
+
if (p === "StageVariables" && isCleared("StageVariables")) {
|
|
11842
|
+
const tombstones = {};
|
|
11843
|
+
for (const k of clearedSubKeys("StageVariables")) tombstones[k] = "";
|
|
11844
|
+
if (Object.keys(tombstones).length > 0) input.StageVariables = tombstones;
|
|
11845
|
+
continue;
|
|
11846
|
+
}
|
|
11847
|
+
if (isCleared(p)) continue;
|
|
11817
11848
|
input[p] = desired[p];
|
|
11818
11849
|
}
|
|
11819
|
-
if (Object.keys(input).length
|
|
11820
|
-
await new ApiGatewayV2Client({ region: ctx.region }).send(new UpdateStageCommand(input));
|
|
11850
|
+
if (Object.keys(input).length > 2) await client.send(new UpdateStageCommand(input));
|
|
11821
11851
|
};
|
|
11822
11852
|
const writeApiGatewayRestApiPolicy = async (ctx) => {
|
|
11823
11853
|
const restApiId = str(ctx.physicalId) ?? str(ctx.declared["RestApiId"]);
|