@go-to-k/cdkd 0.260.6 → 0.260.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 CHANGED
@@ -1901,7 +1901,7 @@ const FLUSH_INTERVAL_MS = 2e3;
1901
1901
  const FLUSH_EVENT_THRESHOLD = 50;
1902
1902
  /** Build-time cdkd version, with a dev fallback for non-built contexts. */
1903
1903
  function getCdkdVersion() {
1904
- return "0.260.6";
1904
+ return "0.260.8";
1905
1905
  }
1906
1906
  /**
1907
1907
  * Generate a time-sortable unique run id, e.g.
@@ -22376,7 +22376,19 @@ var ECSProvider = class {
22376
22376
  startTimeout: def["StartTimeout"],
22377
22377
  stopTimeout: def["StopTimeout"],
22378
22378
  interactive: def["Interactive"],
22379
- pseudoTerminal: def["PseudoTerminal"]
22379
+ pseudoTerminal: def["PseudoTerminal"],
22380
+ repositoryCredentials: def["RepositoryCredentials"] ? pascalToCamelCaseKeys(def["RepositoryCredentials"]) : void 0,
22381
+ firelensConfiguration: this.convertFirelensConfiguration(def["FirelensConfiguration"]),
22382
+ resourceRequirements: def["ResourceRequirements"] ? pascalToCamelCaseKeys(def["ResourceRequirements"]) : void 0,
22383
+ systemControls: def["SystemControls"] ? pascalToCamelCaseKeys(def["SystemControls"]) : void 0,
22384
+ extraHosts: def["ExtraHosts"] ? pascalToCamelCaseKeys(def["ExtraHosts"]) : void 0,
22385
+ restartPolicy: def["RestartPolicy"] ? pascalToCamelCaseKeys(def["RestartPolicy"]) : void 0,
22386
+ dnsServers: def["DnsServers"],
22387
+ dnsSearchDomains: def["DnsSearchDomains"],
22388
+ dockerSecurityOptions: def["DockerSecurityOptions"],
22389
+ credentialSpecs: def["CredentialSpecs"],
22390
+ hostname: def["Hostname"],
22391
+ versionConsistency: def["VersionConsistency"]
22380
22392
  }));
22381
22393
  }
22382
22394
  /**
@@ -22494,6 +22506,20 @@ var ECSProvider = class {
22494
22506
  };
22495
22507
  }
22496
22508
  /**
22509
+ * Convert CFn `ContainerDefinitions[].FirelensConfiguration` to the ECS SDK
22510
+ * shape (issue #1173). `Type` flips to `type`, but `Options` is a free-form
22511
+ * map of user-supplied FireLens options (e.g. `enable-ecs-log-metadata`,
22512
+ * `config-file-value`) whose keys are NOT CFn property names, so it is copied
22513
+ * verbatim rather than case-flipped.
22514
+ */
22515
+ convertFirelensConfiguration(config) {
22516
+ if (!config) return void 0;
22517
+ return {
22518
+ type: config["Type"],
22519
+ options: config["Options"]
22520
+ };
22521
+ }
22522
+ /**
22497
22523
  * Convert CFn HealthCheck to ECS SDK format
22498
22524
  */
22499
22525
  convertHealthCheck(check) {
@@ -22695,6 +22721,140 @@ var ECSProvider = class {
22695
22721
  return out;
22696
22722
  }
22697
22723
  /**
22724
+ * Reverse of `convertContainerDefinitions` for `readCurrentState` (issue
22725
+ * #1169). Emits CFn PascalCase so the drift baseline (state `properties`
22726
+ * PascalCase, or `observedProperties` captured via this same reader) compares
22727
+ * apples-to-apples instead of phantom-drifting on the whole array — the drift
22728
+ * comparator compares arrays wholesale via `deepEqual`, so the previous raw
22729
+ * SDK camelCase read (`result['ContainerDefinitions'] = td.containerDefinitions`)
22730
+ * never matched a PascalCase baseline.
22731
+ *
22732
+ * Two rules keep the read side matching a template that omits AWS's defaults:
22733
+ * 1. Only the fields `convertContainerDefinitions` can SET are emitted, so
22734
+ * the round-trip is symmetric — a field cdkd cannot set is never surfaced
22735
+ * as drift against a template that lacks it.
22736
+ * 2. AWS-defaulted-empty divergences are normalized away — `Cpu: 0`, empty
22737
+ * arrays (`PortMappings` / `Environment` / ...), and an empty
22738
+ * `LinuxParameters.Capabilities: {Add:[],Drop:[]}` are dropped so they
22739
+ * equal "absent" (what the template has). AWS returns these defaults on
22740
+ * EVERY read, so without this the `properties` fallback baseline
22741
+ * (pre-observedProperties state) would phantom-drift on every run; the
22742
+ * normalization trades that for a rare edge — a template that EXPLICITLY
22743
+ * sets one of these to its empty/zero default AND has no observed baseline
22744
+ * (CDK L2 never emits e.g. an explicit `Cpu: 0`). On the normal
22745
+ * `observedProperties` path both sides run through this reader, so the
22746
+ * snapshot is self-consistent regardless.
22747
+ *
22748
+ * Free-form maps (`DockerLabels`, `LogConfiguration.Options`) are copied
22749
+ * verbatim — their keys are user data (log-driver options / container labels),
22750
+ * NOT CFn property names, so they must not be case-flipped.
22751
+ */
22752
+ containerDefinitionsToCfn(defs) {
22753
+ if (!defs) return [];
22754
+ return defs.map((c) => {
22755
+ const out = {};
22756
+ if (c.name !== void 0) out["Name"] = c.name;
22757
+ if (c.image !== void 0) out["Image"] = c.image;
22758
+ if (c.cpu !== void 0 && c.cpu !== 0) out["Cpu"] = c.cpu;
22759
+ if (c.memory !== void 0) out["Memory"] = c.memory;
22760
+ if (c.memoryReservation !== void 0) out["MemoryReservation"] = c.memoryReservation;
22761
+ if (c.essential !== void 0) out["Essential"] = c.essential;
22762
+ if (c.command && c.command.length > 0) out["Command"] = [...c.command];
22763
+ if (c.entryPoint && c.entryPoint.length > 0) out["EntryPoint"] = [...c.entryPoint];
22764
+ if (c.environment && c.environment.length > 0) out["Environment"] = c.environment.map((e) => ({
22765
+ Name: e.name,
22766
+ Value: e.value
22767
+ }));
22768
+ if (c.environmentFiles && c.environmentFiles.length > 0) out["EnvironmentFiles"] = c.environmentFiles.map((e) => ({
22769
+ Type: e.type,
22770
+ Value: e.value
22771
+ }));
22772
+ if (c.secrets && c.secrets.length > 0) out["Secrets"] = c.secrets.map((s) => ({
22773
+ Name: s.name,
22774
+ ValueFrom: s.valueFrom
22775
+ }));
22776
+ if (c.portMappings && c.portMappings.length > 0) out["PortMappings"] = camelToPascalCaseKeys(c.portMappings);
22777
+ if (c.mountPoints && c.mountPoints.length > 0) out["MountPoints"] = camelToPascalCaseKeys(c.mountPoints);
22778
+ if (c.volumesFrom && c.volumesFrom.length > 0) out["VolumesFrom"] = camelToPascalCaseKeys(c.volumesFrom);
22779
+ if (c.dependsOn && c.dependsOn.length > 0) out["DependsOn"] = camelToPascalCaseKeys(c.dependsOn);
22780
+ if (c.links && c.links.length > 0) out["Links"] = [...c.links];
22781
+ if (c.workingDirectory !== void 0) out["WorkingDirectory"] = c.workingDirectory;
22782
+ if (c.disableNetworking !== void 0) out["DisableNetworking"] = c.disableNetworking;
22783
+ if (c.privileged !== void 0) out["Privileged"] = c.privileged;
22784
+ if (c.readonlyRootFilesystem !== void 0) out["ReadonlyRootFilesystem"] = c.readonlyRootFilesystem;
22785
+ if (c.user !== void 0) out["User"] = c.user;
22786
+ if (c.ulimits && c.ulimits.length > 0) out["Ulimits"] = camelToPascalCaseKeys(c.ulimits);
22787
+ if (c.logConfiguration) out["LogConfiguration"] = this.logConfigurationToCfn(c.logConfiguration);
22788
+ if (c.healthCheck) out["HealthCheck"] = camelToPascalCaseKeys(c.healthCheck);
22789
+ if (c.linuxParameters) {
22790
+ const lp = this.linuxParametersToCfn(c.linuxParameters);
22791
+ if (Object.keys(lp).length > 0) out["LinuxParameters"] = lp;
22792
+ }
22793
+ if (c.dockerLabels && Object.keys(c.dockerLabels).length > 0) out["DockerLabels"] = { ...c.dockerLabels };
22794
+ if (c.startTimeout !== void 0) out["StartTimeout"] = c.startTimeout;
22795
+ if (c.stopTimeout !== void 0) out["StopTimeout"] = c.stopTimeout;
22796
+ if (c.interactive !== void 0) out["Interactive"] = c.interactive;
22797
+ if (c.pseudoTerminal !== void 0) out["PseudoTerminal"] = c.pseudoTerminal;
22798
+ if (c.repositoryCredentials) out["RepositoryCredentials"] = camelToPascalCaseKeys(c.repositoryCredentials);
22799
+ if (c.firelensConfiguration) {
22800
+ const fc = {};
22801
+ if (c.firelensConfiguration.type !== void 0) fc["Type"] = c.firelensConfiguration.type;
22802
+ if (c.firelensConfiguration.options && Object.keys(c.firelensConfiguration.options).length > 0) fc["Options"] = { ...c.firelensConfiguration.options };
22803
+ if (Object.keys(fc).length > 0) out["FirelensConfiguration"] = fc;
22804
+ }
22805
+ if (c.resourceRequirements && c.resourceRequirements.length > 0) out["ResourceRequirements"] = camelToPascalCaseKeys(c.resourceRequirements);
22806
+ if (c.systemControls && c.systemControls.length > 0) out["SystemControls"] = camelToPascalCaseKeys(c.systemControls);
22807
+ if (c.extraHosts && c.extraHosts.length > 0) out["ExtraHosts"] = camelToPascalCaseKeys(c.extraHosts);
22808
+ if (c.restartPolicy) out["RestartPolicy"] = camelToPascalCaseKeys(c.restartPolicy);
22809
+ if (c.dnsServers && c.dnsServers.length > 0) out["DnsServers"] = [...c.dnsServers];
22810
+ if (c.dnsSearchDomains && c.dnsSearchDomains.length > 0) out["DnsSearchDomains"] = [...c.dnsSearchDomains];
22811
+ if (c.dockerSecurityOptions && c.dockerSecurityOptions.length > 0) out["DockerSecurityOptions"] = [...c.dockerSecurityOptions];
22812
+ if (c.credentialSpecs && c.credentialSpecs.length > 0) out["CredentialSpecs"] = [...c.credentialSpecs];
22813
+ if (c.hostname !== void 0) out["Hostname"] = c.hostname;
22814
+ if (c.versionConsistency !== void 0 && c.versionConsistency !== "enabled") out["VersionConsistency"] = c.versionConsistency;
22815
+ return out;
22816
+ });
22817
+ }
22818
+ /**
22819
+ * Reverse of `convertLogConfiguration` for `containerDefinitionsToCfn`.
22820
+ * `LogDriver` flips; `Options` is a free-form log-driver option map copied
22821
+ * verbatim (its keys, e.g. `awslogs-group`, are NOT CFn property names);
22822
+ * `SecretOptions` is a `{Name, ValueFrom}[]` list. Emit-when-present so an
22823
+ * absent / empty sub-field does not phantom-drift.
22824
+ */
22825
+ logConfigurationToCfn(lc) {
22826
+ const out = {};
22827
+ if (lc.logDriver !== void 0) out["LogDriver"] = lc.logDriver;
22828
+ if (lc.options && Object.keys(lc.options).length > 0) out["Options"] = { ...lc.options };
22829
+ if (lc.secretOptions && lc.secretOptions.length > 0) out["SecretOptions"] = lc.secretOptions.map((s) => ({
22830
+ Name: s.name,
22831
+ ValueFrom: s.valueFrom
22832
+ }));
22833
+ return out;
22834
+ }
22835
+ /**
22836
+ * Reverse of `convertLinuxParameters` for `containerDefinitionsToCfn`. The
22837
+ * SET side is a mechanical first-letter flip (`pascalToCamelCaseKeys`), so the
22838
+ * read side is the inverse `camelToPascalCaseKeys` — plus normalization of the
22839
+ * AWS-defaulted-empty `Capabilities` / `Devices` / `Tmpfs`: AWS returns
22840
+ * `capabilities: {add:[], drop:[]}` even when the template set neither, so the
22841
+ * empty `Add` / `Drop` (and an otherwise-empty `Capabilities`) and empty
22842
+ * `Devices` / `Tmpfs` arrays are dropped to equal a template that omits them.
22843
+ */
22844
+ linuxParametersToCfn(lp) {
22845
+ const out = camelToPascalCaseKeys(lp);
22846
+ const caps = out["Capabilities"];
22847
+ if (caps) {
22848
+ const normalized = {};
22849
+ if (Array.isArray(caps["Add"]) && caps["Add"].length > 0) normalized["Add"] = caps["Add"];
22850
+ if (Array.isArray(caps["Drop"]) && caps["Drop"].length > 0) normalized["Drop"] = caps["Drop"];
22851
+ if (Object.keys(normalized).length > 0) out["Capabilities"] = normalized;
22852
+ else delete out["Capabilities"];
22853
+ }
22854
+ for (const key of ["Devices", "Tmpfs"]) if (Array.isArray(out[key]) && out[key].length === 0) delete out[key];
22855
+ return out;
22856
+ }
22857
+ /**
22698
22858
  * Coerce a CFn boolean property to a real boolean at the wire boundary.
22699
22859
  * CFn templates can carry booleans as the strings "true" / "false"
22700
22860
  * (e.g. via Fn::Sub / parameter plumbing), so the SDK input must
@@ -23027,7 +23187,7 @@ var ECSProvider = class {
23027
23187
  if (td.ipcMode !== void 0) result["IpcMode"] = td.ipcMode;
23028
23188
  if (td.ephemeralStorage?.sizeInGiB !== void 0) result["EphemeralStorage"] = { SizeInGiB: td.ephemeralStorage.sizeInGiB };
23029
23189
  if (td.enableFaultInjection !== void 0) result["EnableFaultInjection"] = td.enableFaultInjection;
23030
- result["ContainerDefinitions"] = td.containerDefinitions ?? [];
23190
+ result["ContainerDefinitions"] = this.containerDefinitionsToCfn(td.containerDefinitions);
23031
23191
  result["Tags"] = normalizeAwsTagsToCfn(resp.tags);
23032
23192
  return result;
23033
23193
  }
@@ -61707,7 +61867,7 @@ function createMigrateCommand() {
61707
61867
  */
61708
61868
  function buildProgram() {
61709
61869
  const program = new Command();
61710
- program.name("cdkd").description("CDK Direct - Deploy AWS CDK apps directly via SDK/Cloud Control API").version("0.260.6");
61870
+ program.name("cdkd").description("CDK Direct - Deploy AWS CDK apps directly via SDK/Cloud Control API").version("0.260.8");
61711
61871
  program.addCommand(createBootstrapCommand());
61712
61872
  program.addCommand(createSynthCommand());
61713
61873
  program.addCommand(createListCommand());