@go-to-k/cdkd 0.210.0 → 0.210.1

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
@@ -43823,6 +43823,7 @@ function extractLambdaProperties(stack, logicalId, resource, resources) {
43823
43823
  handler,
43824
43824
  memoryMb,
43825
43825
  timeoutSec,
43826
+ architecture: extractArchitecture(props, logicalId),
43826
43827
  codePath,
43827
43828
  layers,
43828
43829
  ...ephemeralStorageMb !== void 0 && { ephemeralStorageMb },
@@ -43910,6 +43911,24 @@ function extractImageUri$1(value, logicalId, stackName, resources, region) {
43910
43911
  }
43911
43912
  }
43912
43913
  /**
43914
+ * Parse `Properties.Architectures` into the single arch cdkd threads to
43915
+ * `--platform`. CFn types it as an array, but CDK / Lambda allow exactly
43916
+ * one entry; default `x86_64` matches the AWS-side default when the
43917
+ * property is absent. Shared by BOTH the ZIP and IMAGE variants (issue
43918
+ * #768) so the ZIP container run pins `--platform` the same way the IMAGE
43919
+ * path always has.
43920
+ */
43921
+ function extractArchitecture(props, logicalId) {
43922
+ const arches = props["Architectures"];
43923
+ if (Array.isArray(arches) && arches.length > 0) {
43924
+ const first = arches[0];
43925
+ if (first === "arm64") return "arm64";
43926
+ if (first === "x86_64") return "x86_64";
43927
+ throw new LocalInvokeResolutionError(`Lambda '${logicalId}' has unsupported Architectures value '${String(first)}'. cdkd local invoke supports x86_64 and arm64.`);
43928
+ }
43929
+ return "x86_64";
43930
+ }
43931
+ /**
43913
43932
  * Build the IMAGE-variant `ResolvedLambda` from a Lambda template entry
43914
43933
  * with `Code.ImageUri`. `ImageConfig` and `Architectures` are both
43915
43934
  * optional in CFn — the defaults match the AWS-side defaults.
@@ -43921,14 +43940,6 @@ function extractImageLambdaProperties(args) {
43921
43940
  if (Array.isArray(rawImageConfig["Command"])) imageConfig.command = rawImageConfig["Command"].filter((s) => typeof s === "string");
43922
43941
  if (Array.isArray(rawImageConfig["EntryPoint"])) imageConfig.entryPoint = rawImageConfig["EntryPoint"].filter((s) => typeof s === "string");
43923
43942
  if (typeof rawImageConfig["WorkingDirectory"] === "string") imageConfig.workingDirectory = rawImageConfig["WorkingDirectory"];
43924
- const arches = props["Architectures"];
43925
- let architecture = "x86_64";
43926
- if (Array.isArray(arches) && arches.length > 0) {
43927
- const first = arches[0];
43928
- if (first === "arm64") architecture = "arm64";
43929
- else if (first === "x86_64") architecture = "x86_64";
43930
- else throw new LocalInvokeResolutionError(`Lambda '${logicalId}' has unsupported Architectures value '${String(first)}'. cdkd local invoke supports x86_64 and arm64.`);
43931
- }
43932
43943
  return {
43933
43944
  kind: "image",
43934
43945
  stack,
@@ -43938,7 +43949,7 @@ function extractImageLambdaProperties(args) {
43938
43949
  timeoutSec,
43939
43950
  imageUri,
43940
43951
  imageConfig,
43941
- architecture,
43952
+ architecture: extractArchitecture(props, logicalId),
43942
43953
  layers: [],
43943
43954
  ...ephemeralStorageMb !== void 0 && { ephemeralStorageMb }
43944
43955
  };
@@ -46532,6 +46543,7 @@ function createContainerPool(specs, options) {
46532
46543
  hostPort,
46533
46544
  host: spec.containerHost,
46534
46545
  name,
46546
+ platform: spec.platform,
46535
46547
  ...spec.debugPort !== void 0 && { debugPort: spec.debugPort },
46536
46548
  ...spec.tmpfs !== void 0 && { tmpfs: spec.tmpfs },
46537
46549
  ...spec.extraHosts !== void 0 && { extraHosts: spec.extraHosts }
@@ -47464,6 +47476,7 @@ async function buildContainerSpec(args) {
47464
47476
  if (lambda.kind === "zip") {
47465
47477
  codeDir = lambda.codePath ?? materializeInlineCode$1(lambda.handler, lambda.inlineCode ?? "", resolveRuntimeFileExtension(lambda.runtime), inlineTmpDirs);
47466
47478
  optDir = await materializeLambdaLayers$1(lambda.layers, layerTmpDirs, layerRoleArn);
47479
+ platform = architectureToPlatform(lambda.architecture);
47467
47480
  } else {
47468
47481
  imageRef = (await resolveContainerImageForStartApi(lambda, skipPull)).imageRef;
47469
47482
  platform = architectureToPlatform(lambda.architecture);
@@ -47530,6 +47543,7 @@ async function buildContainerSpec(args) {
47530
47543
  kind: "zip",
47531
47544
  lambda,
47532
47545
  codeDir,
47546
+ platform,
47533
47547
  env: dockerEnv,
47534
47548
  containerHost,
47535
47549
  ...optDir !== void 0 && { optDir },
@@ -47681,6 +47695,7 @@ function resolveLambdaByLogicalId(logicalId, stacks) {
47681
47695
  if (!inlineCode) codePath = resolveAssetCodePath(stack, logicalId, resource);
47682
47696
  const layers = resolveLambdaLayers(stack, logicalId, props);
47683
47697
  const ephemeralStorageMb = extractEphemeralStorageMb(props, logicalId);
47698
+ const architecture = extractStartApiArchitecture(props, logicalId);
47684
47699
  return {
47685
47700
  kind: "zip",
47686
47701
  stack,
@@ -47692,6 +47707,7 @@ function resolveLambdaByLogicalId(logicalId, stacks) {
47692
47707
  timeoutSec,
47693
47708
  codePath,
47694
47709
  layers,
47710
+ architecture,
47695
47711
  ...inlineCode !== void 0 && { inlineCode },
47696
47712
  ...ephemeralStorageMb !== void 0 && { ephemeralStorageMb }
47697
47713
  };
@@ -47741,6 +47757,23 @@ function extractImageUri(value, logicalId, stackName, resources, region) {
47741
47757
  }
47742
47758
  }
47743
47759
  /**
47760
+ * Parse `Properties.Architectures` into the single arch cdkd threads to
47761
+ * `--platform`. Defaults to `x86_64` (the AWS default) when absent; CDK
47762
+ * only ever sets one entry. Shared by BOTH the ZIP and IMAGE start-api
47763
+ * resolvers (issue #768) so the ZIP container run pins `--platform` the
47764
+ * same way the IMAGE path always has.
47765
+ */
47766
+ function extractStartApiArchitecture(props, logicalId) {
47767
+ const arches = props["Architectures"];
47768
+ if (Array.isArray(arches) && arches.length > 0) {
47769
+ const first = arches[0];
47770
+ if (first === "arm64") return "arm64";
47771
+ if (first === "x86_64") return "x86_64";
47772
+ throw new Error(`Lambda '${logicalId}' has unsupported Architectures value '${String(first)}'. cdkd local start-api supports x86_64 and arm64.`);
47773
+ }
47774
+ return "x86_64";
47775
+ }
47776
+ /**
47744
47777
  * Build the IMAGE-variant `ResolvedStartApiLambda` from a Lambda
47745
47778
  * template entry with `Code.ImageUri`. Mirrors
47746
47779
  * `lambda-resolver.ts:extractImageLambdaProperties` but trimmed to the
@@ -47753,14 +47786,7 @@ function resolveImageLambda(args) {
47753
47786
  if (Array.isArray(rawImageConfig["Command"])) imageConfig.command = rawImageConfig["Command"].filter((s) => typeof s === "string");
47754
47787
  if (Array.isArray(rawImageConfig["EntryPoint"])) imageConfig.entryPoint = rawImageConfig["EntryPoint"].filter((s) => typeof s === "string");
47755
47788
  if (typeof rawImageConfig["WorkingDirectory"] === "string") imageConfig.workingDirectory = rawImageConfig["WorkingDirectory"];
47756
- const arches = props["Architectures"];
47757
- let architecture = "x86_64";
47758
- if (Array.isArray(arches) && arches.length > 0) {
47759
- const first = arches[0];
47760
- if (first === "arm64") architecture = "arm64";
47761
- else if (first === "x86_64") architecture = "x86_64";
47762
- else throw new Error(`Lambda '${logicalId}' has unsupported Architectures value '${String(first)}'. cdkd local start-api supports x86_64 and arm64.`);
47763
- }
47789
+ const architecture = extractStartApiArchitecture(props, logicalId);
47764
47790
  const ephemeralStorageMb = extractEphemeralStorageMb(props, logicalId);
47765
47791
  return {
47766
47792
  kind: "image",
@@ -51203,6 +51229,7 @@ async function resolveZipImagePlan(lambda, options) {
51203
51229
  }],
51204
51230
  extraMounts: layerPlan.mount ? [layerPlan.mount] : [],
51205
51231
  cmd: [lambda.handler],
51232
+ platform: architectureToPlatform(lambda.architecture),
51206
51233
  ...inlineTmpDir !== void 0 && { inlineTmpDir },
51207
51234
  ...layerPlan.tmpDir !== void 0 && { layersTmpDir: layerPlan.tmpDir },
51208
51235
  ...layerPlan.extraTmpDirs.length > 0 && { layerArnTmpDirs: layerPlan.extraTmpDirs },
@@ -52847,7 +52874,7 @@ function reorderArgs(argv) {
52847
52874
  async function main() {
52848
52875
  installPipeCloseHandler();
52849
52876
  const program = new Command();
52850
- program.name("cdkd").description("CDK Direct - Deploy AWS CDK apps directly via SDK/Cloud Control API").version("0.210.0");
52877
+ program.name("cdkd").description("CDK Direct - Deploy AWS CDK apps directly via SDK/Cloud Control API").version("0.210.1");
52851
52878
  program.addCommand(createBootstrapCommand());
52852
52879
  program.addCommand(createSynthCommand());
52853
52880
  program.addCommand(createListCommand());