@go-to-k/cdkd 0.50.7 → 0.50.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/dist/cli.js +135 -38
- package/dist/cli.js.map +2 -2
- package/dist/go-to-k-cdkd-0.50.8.tgz +0 -0
- package/package.json +1 -1
- package/dist/go-to-k-cdkd-0.50.7.tgz +0 -0
package/dist/cli.js
CHANGED
|
@@ -15477,18 +15477,36 @@ var LambdaUrlProvider = class {
|
|
|
15477
15477
|
/**
|
|
15478
15478
|
* Update a Lambda Function URL
|
|
15479
15479
|
*/
|
|
15480
|
-
async update(logicalId, physicalId, _resourceType, properties,
|
|
15480
|
+
async update(logicalId, physicalId, _resourceType, properties, previousProperties) {
|
|
15481
15481
|
this.logger.debug(`Updating Lambda URL ${logicalId}: ${physicalId}`);
|
|
15482
|
+
const handled = this.handledProperties.get("AWS::Lambda::Url") ?? /* @__PURE__ */ new Set();
|
|
15483
|
+
let changed = false;
|
|
15484
|
+
for (const key of handled) {
|
|
15485
|
+
if (JSON.stringify(properties[key] ?? null) !== JSON.stringify(previousProperties[key] ?? null)) {
|
|
15486
|
+
changed = true;
|
|
15487
|
+
break;
|
|
15488
|
+
}
|
|
15489
|
+
}
|
|
15490
|
+
if (!changed) {
|
|
15491
|
+
return {
|
|
15492
|
+
physicalId,
|
|
15493
|
+
wasReplaced: false,
|
|
15494
|
+
attributes: {}
|
|
15495
|
+
};
|
|
15496
|
+
}
|
|
15482
15497
|
const authType = properties["AuthType"] || "NONE";
|
|
15483
15498
|
const cors = properties["Cors"];
|
|
15484
15499
|
const updateParams = {
|
|
15485
15500
|
FunctionName: physicalId,
|
|
15486
15501
|
AuthType: authType
|
|
15487
15502
|
};
|
|
15488
|
-
if (properties["InvokeMode"])
|
|
15503
|
+
if (properties["InvokeMode"] !== void 0)
|
|
15489
15504
|
updateParams.InvokeMode = properties["InvokeMode"];
|
|
15490
15505
|
if (cors) {
|
|
15491
|
-
|
|
15506
|
+
const builtCors = this.buildCorsConfig(cors);
|
|
15507
|
+
if (Object.keys(builtCors).length > 0) {
|
|
15508
|
+
updateParams.Cors = builtCors;
|
|
15509
|
+
}
|
|
15492
15510
|
}
|
|
15493
15511
|
const response = await this.lambdaClient.send(new UpdateFunctionUrlConfigCommand(updateParams));
|
|
15494
15512
|
return {
|
|
@@ -15638,19 +15656,36 @@ var LambdaUrlProvider = class {
|
|
|
15638
15656
|
return null;
|
|
15639
15657
|
}
|
|
15640
15658
|
/**
|
|
15641
|
-
* Build CORS configuration from CDK properties
|
|
15659
|
+
* Build CORS configuration from CDK properties.
|
|
15660
|
+
*
|
|
15661
|
+
* Empty arrays from `readCurrentState`'s always-emit placeholder
|
|
15662
|
+
* (`AllowOrigins: []`, `AllowMethods: []`, `AllowHeaders: []`,
|
|
15663
|
+
* `ExposeHeaders: []`) are intentionally dropped here — emitting them
|
|
15664
|
+
* to AWS would configure CORS with empty allowlists instead of
|
|
15665
|
+
* leaving CORS unset. The caller (`update()` / `create()`) treats an
|
|
15666
|
+
* empty `Cors` object as "no CORS configured" and omits it from the
|
|
15667
|
+
* SDK input. `MaxAge` uses `!== undefined` so the valid AWS input
|
|
15668
|
+
* `MaxAge: 0` (= "do not cache preflight responses") is preserved.
|
|
15642
15669
|
*/
|
|
15643
15670
|
buildCorsConfig(cors) {
|
|
15644
15671
|
const config = {};
|
|
15645
|
-
|
|
15646
|
-
|
|
15647
|
-
|
|
15648
|
-
|
|
15649
|
-
|
|
15650
|
-
|
|
15651
|
-
|
|
15652
|
-
|
|
15653
|
-
|
|
15672
|
+
const allowOrigins = cors["AllowOrigins"];
|
|
15673
|
+
if (Array.isArray(allowOrigins) && allowOrigins.length > 0) {
|
|
15674
|
+
config.AllowOrigins = allowOrigins;
|
|
15675
|
+
}
|
|
15676
|
+
const allowMethods = cors["AllowMethods"];
|
|
15677
|
+
if (Array.isArray(allowMethods) && allowMethods.length > 0) {
|
|
15678
|
+
config.AllowMethods = allowMethods;
|
|
15679
|
+
}
|
|
15680
|
+
const allowHeaders = cors["AllowHeaders"];
|
|
15681
|
+
if (Array.isArray(allowHeaders) && allowHeaders.length > 0) {
|
|
15682
|
+
config.AllowHeaders = allowHeaders;
|
|
15683
|
+
}
|
|
15684
|
+
const exposeHeaders = cors["ExposeHeaders"];
|
|
15685
|
+
if (Array.isArray(exposeHeaders) && exposeHeaders.length > 0) {
|
|
15686
|
+
config.ExposeHeaders = exposeHeaders;
|
|
15687
|
+
}
|
|
15688
|
+
if (cors["MaxAge"] !== void 0)
|
|
15654
15689
|
config.MaxAge = cors["MaxAge"];
|
|
15655
15690
|
if (cors["AllowCredentials"] !== void 0)
|
|
15656
15691
|
config.AllowCredentials = cors["AllowCredentials"];
|
|
@@ -15669,6 +15704,43 @@ import {
|
|
|
15669
15704
|
ResourceNotFoundException as ResourceNotFoundException4
|
|
15670
15705
|
} from "@aws-sdk/client-lambda";
|
|
15671
15706
|
init_aws_clients();
|
|
15707
|
+
function classifyEventSource(resp) {
|
|
15708
|
+
if (resp.SelfManagedEventSource !== void 0)
|
|
15709
|
+
return "kafka";
|
|
15710
|
+
if (resp.SelfManagedKafkaEventSourceConfig !== void 0)
|
|
15711
|
+
return "kafka";
|
|
15712
|
+
if (resp.AmazonManagedKafkaEventSourceConfig !== void 0)
|
|
15713
|
+
return "kafka";
|
|
15714
|
+
if (resp.DocumentDBEventSourceConfig !== void 0)
|
|
15715
|
+
return "documentdb";
|
|
15716
|
+
const arn = resp.EventSourceArn;
|
|
15717
|
+
if (!arn)
|
|
15718
|
+
return "unknown";
|
|
15719
|
+
if (arn.startsWith("arn:aws:sqs:") || arn.startsWith("arn:aws-cn:sqs:"))
|
|
15720
|
+
return "sqs";
|
|
15721
|
+
if (arn.startsWith("arn:aws:kinesis:") || arn.startsWith("arn:aws-cn:kinesis:"))
|
|
15722
|
+
return "kinesis";
|
|
15723
|
+
if (arn.startsWith("arn:aws:dynamodb:") || arn.startsWith("arn:aws-cn:dynamodb:"))
|
|
15724
|
+
return "dynamodb";
|
|
15725
|
+
if (arn.startsWith("arn:aws:kafka:") || arn.startsWith("arn:aws-cn:kafka:"))
|
|
15726
|
+
return "kafka";
|
|
15727
|
+
if (arn.startsWith("arn:aws:mq:") || arn.startsWith("arn:aws-cn:mq:"))
|
|
15728
|
+
return "mq";
|
|
15729
|
+
if (arn.startsWith("arn:aws:rds:") || arn.startsWith("arn:aws-cn:rds:")) {
|
|
15730
|
+
return "documentdb";
|
|
15731
|
+
}
|
|
15732
|
+
return "unknown";
|
|
15733
|
+
}
|
|
15734
|
+
var KINDS_WITH_FUNCTION_RESPONSE_TYPES = /* @__PURE__ */ new Set([
|
|
15735
|
+
"sqs",
|
|
15736
|
+
"kinesis",
|
|
15737
|
+
"dynamodb"
|
|
15738
|
+
]);
|
|
15739
|
+
var KINDS_WITH_SOURCE_ACCESS_CONFIGURATIONS = /* @__PURE__ */ new Set([
|
|
15740
|
+
"kafka",
|
|
15741
|
+
"mq",
|
|
15742
|
+
"documentdb"
|
|
15743
|
+
]);
|
|
15672
15744
|
var LambdaEventSourceMappingProvider = class {
|
|
15673
15745
|
lambdaClient;
|
|
15674
15746
|
logger = getLogger().child("LambdaEventSourceMappingProvider");
|
|
@@ -15795,33 +15867,33 @@ var LambdaEventSourceMappingProvider = class {
|
|
|
15795
15867
|
UUID: physicalId,
|
|
15796
15868
|
FunctionName: properties["FunctionName"]
|
|
15797
15869
|
};
|
|
15798
|
-
if (properties["BatchSize"])
|
|
15870
|
+
if (properties["BatchSize"] !== void 0)
|
|
15799
15871
|
updateParams.BatchSize = properties["BatchSize"];
|
|
15800
15872
|
if (properties["Enabled"] !== void 0)
|
|
15801
15873
|
updateParams.Enabled = properties["Enabled"];
|
|
15802
|
-
if (properties["MaximumBatchingWindowInSeconds"])
|
|
15874
|
+
if (properties["MaximumBatchingWindowInSeconds"] !== void 0)
|
|
15803
15875
|
updateParams.MaximumBatchingWindowInSeconds = properties["MaximumBatchingWindowInSeconds"];
|
|
15804
15876
|
if (properties["MaximumRetryAttempts"] !== void 0)
|
|
15805
15877
|
updateParams.MaximumRetryAttempts = properties["MaximumRetryAttempts"];
|
|
15806
15878
|
if (properties["BisectBatchOnFunctionError"] !== void 0)
|
|
15807
15879
|
updateParams.BisectBatchOnFunctionError = properties["BisectBatchOnFunctionError"];
|
|
15808
|
-
if (properties["MaximumRecordAgeInSeconds"])
|
|
15880
|
+
if (properties["MaximumRecordAgeInSeconds"] !== void 0)
|
|
15809
15881
|
updateParams.MaximumRecordAgeInSeconds = properties["MaximumRecordAgeInSeconds"];
|
|
15810
|
-
if (properties["ParallelizationFactor"])
|
|
15882
|
+
if (properties["ParallelizationFactor"] !== void 0)
|
|
15811
15883
|
updateParams.ParallelizationFactor = properties["ParallelizationFactor"];
|
|
15812
|
-
if (properties["FilterCriteria"])
|
|
15884
|
+
if (properties["FilterCriteria"] !== void 0)
|
|
15813
15885
|
updateParams.FilterCriteria = properties["FilterCriteria"];
|
|
15814
|
-
if (properties["DestinationConfig"])
|
|
15886
|
+
if (properties["DestinationConfig"] !== void 0)
|
|
15815
15887
|
updateParams.DestinationConfig = properties["DestinationConfig"];
|
|
15816
|
-
if (properties["TumblingWindowInSeconds"])
|
|
15888
|
+
if (properties["TumblingWindowInSeconds"] !== void 0)
|
|
15817
15889
|
updateParams.TumblingWindowInSeconds = properties["TumblingWindowInSeconds"];
|
|
15818
|
-
if (properties["FunctionResponseTypes"])
|
|
15890
|
+
if (properties["FunctionResponseTypes"] !== void 0)
|
|
15819
15891
|
updateParams.FunctionResponseTypes = properties["FunctionResponseTypes"];
|
|
15820
|
-
if (properties["SourceAccessConfigurations"])
|
|
15892
|
+
if (properties["SourceAccessConfigurations"] !== void 0)
|
|
15821
15893
|
updateParams.SourceAccessConfigurations = properties["SourceAccessConfigurations"];
|
|
15822
|
-
if (properties["ScalingConfig"])
|
|
15894
|
+
if (properties["ScalingConfig"] !== void 0)
|
|
15823
15895
|
updateParams.ScalingConfig = properties["ScalingConfig"];
|
|
15824
|
-
if (properties["DocumentDBEventSourceConfig"])
|
|
15896
|
+
if (properties["DocumentDBEventSourceConfig"] !== void 0)
|
|
15825
15897
|
updateParams.DocumentDBEventSourceConfig = properties["DocumentDBEventSourceConfig"];
|
|
15826
15898
|
const updateResp = await this.lambdaClient.send(
|
|
15827
15899
|
new UpdateEventSourceMappingCommand(updateParams)
|
|
@@ -15995,8 +16067,17 @@ var LambdaEventSourceMappingProvider = class {
|
|
|
15995
16067
|
if (resp.TumblingWindowInSeconds !== void 0) {
|
|
15996
16068
|
result["TumblingWindowInSeconds"] = resp.TumblingWindowInSeconds;
|
|
15997
16069
|
}
|
|
15998
|
-
|
|
15999
|
-
|
|
16070
|
+
const kind = classifyEventSource(resp);
|
|
16071
|
+
if (KINDS_WITH_FUNCTION_RESPONSE_TYPES.has(kind)) {
|
|
16072
|
+
result["FunctionResponseTypes"] = resp.FunctionResponseTypes ? [...resp.FunctionResponseTypes] : [];
|
|
16073
|
+
} else if (resp.FunctionResponseTypes !== void 0) {
|
|
16074
|
+
result["FunctionResponseTypes"] = [...resp.FunctionResponseTypes];
|
|
16075
|
+
}
|
|
16076
|
+
if (KINDS_WITH_SOURCE_ACCESS_CONFIGURATIONS.has(kind)) {
|
|
16077
|
+
result["SourceAccessConfigurations"] = resp.SourceAccessConfigurations ?? [];
|
|
16078
|
+
} else if (resp.SourceAccessConfigurations !== void 0) {
|
|
16079
|
+
result["SourceAccessConfigurations"] = resp.SourceAccessConfigurations;
|
|
16080
|
+
}
|
|
16000
16081
|
if (resp.SelfManagedEventSource !== void 0) {
|
|
16001
16082
|
result["SelfManagedEventSource"] = resp.SelfManagedEventSource;
|
|
16002
16083
|
}
|
|
@@ -16124,19 +16205,35 @@ var LambdaLayerVersionProvider = class {
|
|
|
16124
16205
|
}
|
|
16125
16206
|
}
|
|
16126
16207
|
/**
|
|
16127
|
-
* Update a Lambda layer version
|
|
16208
|
+
* Update a Lambda layer version.
|
|
16209
|
+
*
|
|
16210
|
+
* Lambda layer versions are immutable on AWS — there is no API to mutate
|
|
16211
|
+
* `Content` / `CompatibleRuntimes` / `CompatibleArchitectures` /
|
|
16212
|
+
* `Description` / `LicenseInfo` of an existing version. The only path to
|
|
16213
|
+
* a "new value" is publishing a new version (new LayerVersionArn).
|
|
16214
|
+
*
|
|
16215
|
+
* Why this rejects with `ResourceUpdateNotSupportedError` instead of
|
|
16216
|
+
* silently publishing a new version:
|
|
16128
16217
|
*
|
|
16129
|
-
*
|
|
16130
|
-
*
|
|
16218
|
+
* - `cdkd drift --revert` calls `update(observed, observed)` to push
|
|
16219
|
+
* state values back into AWS. For an immutable resource that cannot
|
|
16220
|
+
* have its in-place value changed, the only AWS-side effect of an
|
|
16221
|
+
* "update" is leaking a duplicate version of the same content,
|
|
16222
|
+
* which is never what `--revert` should do.
|
|
16223
|
+
* - On the deploy path, content / runtime / arch changes flow
|
|
16224
|
+
* through CDK's hash-based logical naming, which produces a fresh
|
|
16225
|
+
* logical ID and a CREATE+DELETE in cdkd's diff — `update()` is
|
|
16226
|
+
* not the path taken in practice. Users who hit this on a non-CDK
|
|
16227
|
+
* template should re-deploy with `--replace`.
|
|
16131
16228
|
*/
|
|
16132
|
-
async update(logicalId,
|
|
16133
|
-
|
|
16134
|
-
|
|
16135
|
-
|
|
16136
|
-
|
|
16137
|
-
|
|
16138
|
-
|
|
16139
|
-
|
|
16229
|
+
async update(logicalId, _physicalId, resourceType, _properties, _previousProperties) {
|
|
16230
|
+
return Promise.reject(
|
|
16231
|
+
new ResourceUpdateNotSupportedError(
|
|
16232
|
+
resourceType,
|
|
16233
|
+
logicalId,
|
|
16234
|
+
"Lambda layer versions are immutable on AWS; re-deploy with cdkd deploy --replace, or change the resource definition to publish a new version"
|
|
16235
|
+
)
|
|
16236
|
+
);
|
|
16140
16237
|
}
|
|
16141
16238
|
/**
|
|
16142
16239
|
* Delete a Lambda layer version
|
|
@@ -43531,7 +43628,7 @@ function reorderArgs(argv) {
|
|
|
43531
43628
|
}
|
|
43532
43629
|
async function main() {
|
|
43533
43630
|
const program = new Command14();
|
|
43534
|
-
program.name("cdkd").description("CDK Direct - Deploy AWS CDK apps directly via SDK/Cloud Control API").version("0.50.
|
|
43631
|
+
program.name("cdkd").description("CDK Direct - Deploy AWS CDK apps directly via SDK/Cloud Control API").version("0.50.8");
|
|
43535
43632
|
program.addCommand(createBootstrapCommand());
|
|
43536
43633
|
program.addCommand(createSynthCommand());
|
|
43537
43634
|
program.addCommand(createListCommand());
|