@go-to-k/cdkd 0.31.1 → 0.31.2

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 CHANGED
@@ -13036,6 +13036,11 @@ import {
13036
13036
  DeleteNetworkInterfaceCommand
13037
13037
  } from "@aws-sdk/client-ec2";
13038
13038
  init_aws_clients();
13039
+ function inlineCodeFileNameForRuntime(runtime) {
13040
+ if (runtime?.startsWith("python"))
13041
+ return "index.py";
13042
+ return "index.js";
13043
+ }
13039
13044
  var LambdaFunctionProvider = class {
13040
13045
  lambdaClient;
13041
13046
  ec2Client;
@@ -13138,7 +13143,7 @@ var LambdaFunctionProvider = class {
13138
13143
  const createParams = {
13139
13144
  FunctionName: functionName,
13140
13145
  Role: role,
13141
- Code: this.buildCode(code),
13146
+ Code: this.buildCode(code, properties["Runtime"]),
13142
13147
  Handler: properties["Handler"],
13143
13148
  Runtime: properties["Runtime"],
13144
13149
  Timeout: properties["Timeout"],
@@ -13224,7 +13229,7 @@ var LambdaFunctionProvider = class {
13224
13229
  const newCode = properties["Code"];
13225
13230
  const oldCode = previousProperties["Code"];
13226
13231
  if (newCode && JSON.stringify(newCode) !== JSON.stringify(oldCode)) {
13227
- const builtCode = this.buildCode(newCode);
13232
+ const builtCode = this.buildCode(newCode, properties["Runtime"]);
13228
13233
  const codeParams = {
13229
13234
  FunctionName: physicalId,
13230
13235
  S3Bucket: builtCode.S3Bucket,
@@ -13592,7 +13597,7 @@ var LambdaFunctionProvider = class {
13592
13597
  /**
13593
13598
  * Build Lambda Code parameter from CDK properties
13594
13599
  */
13595
- buildCode(code) {
13600
+ buildCode(code, runtime) {
13596
13601
  const result = {};
13597
13602
  if (code["S3Bucket"]) {
13598
13603
  result.S3Bucket = code["S3Bucket"];
@@ -13604,7 +13609,7 @@ var LambdaFunctionProvider = class {
13604
13609
  result.S3ObjectVersion = code["S3ObjectVersion"];
13605
13610
  }
13606
13611
  if (code["ZipFile"]) {
13607
- result.ZipFile = this.createZipFromInlineCode(code["ZipFile"]);
13612
+ result.ZipFile = this.createZipFromInlineCode(code["ZipFile"], runtime);
13608
13613
  }
13609
13614
  if (code["ImageUri"]) {
13610
13615
  result.ImageUri = code["ImageUri"];
@@ -13616,13 +13621,14 @@ var LambdaFunctionProvider = class {
13616
13621
  *
13617
13622
  * CloudFormation's ZipFile property automatically wraps inline code in a zip,
13618
13623
  * but the Lambda SDK expects actual zip binary. This creates a minimal zip
13619
- * containing the code as index.* (matching the Handler).
13624
+ * containing the code as index.* (extension derived from runtime — nodejs
13625
+ * runtimes use index.js, python runtimes use index.py; see CFn ZipFile docs).
13620
13626
  */
13621
- createZipFromInlineCode(code) {
13627
+ createZipFromInlineCode(code, runtime) {
13622
13628
  const fileData = Buffer.from(code, "utf-8");
13623
13629
  const crc32 = this.crc32(fileData);
13624
13630
  const compressedData = zlib.deflateRawSync(fileData);
13625
- const fileName = Buffer.from("index.py");
13631
+ const fileName = Buffer.from(inlineCodeFileNameForRuntime(runtime));
13626
13632
  const now = /* @__PURE__ */ new Date();
13627
13633
  const modTime = (now.getHours() << 11 | now.getMinutes() << 5 | now.getSeconds() >> 1) & 65535;
13628
13634
  const modDate = (now.getFullYear() - 1980 << 9 | now.getMonth() + 1 << 5 | now.getDate()) & 65535;
@@ -36353,7 +36359,7 @@ function reorderArgs(argv) {
36353
36359
  }
36354
36360
  async function main() {
36355
36361
  const program = new Command13();
36356
- program.name("cdkd").description("CDK Direct - Deploy AWS CDK apps directly via SDK/Cloud Control API").version("0.31.1");
36362
+ program.name("cdkd").description("CDK Direct - Deploy AWS CDK apps directly via SDK/Cloud Control API").version("0.31.2");
36357
36363
  program.addCommand(createBootstrapCommand());
36358
36364
  program.addCommand(createSynthCommand());
36359
36365
  program.addCommand(createListCommand());