@go-to-k/cdkd 0.254.0 → 0.254.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
@@ -1888,7 +1888,7 @@ const FLUSH_INTERVAL_MS = 2e3;
1888
1888
  const FLUSH_EVENT_THRESHOLD = 50;
1889
1889
  /** Build-time cdkd version, with a dev fallback for non-built contexts. */
1890
1890
  function getCdkdVersion() {
1891
- return "0.254.0";
1891
+ return "0.254.1";
1892
1892
  }
1893
1893
  /**
1894
1894
  * Generate a time-sortable unique run id, e.g.
@@ -35042,7 +35042,10 @@ var FSxFileSystemProvider = class {
35042
35042
  diff: {},
35043
35043
  hasMutableDiff: false
35044
35044
  };
35045
- const storageCapacityChanged = changed("StorageCapacity");
35045
+ const resolvedStorageCapacity = toNumber$3(properties["StorageCapacity"]);
35046
+ const storageCapacityIsPlaceholder = resolvedStorageCapacity !== void 0 && resolvedStorageCapacity <= 0;
35047
+ if (storageCapacityIsPlaceholder && changed("StorageCapacity")) this.logger.debug(`Suppressing non-positive StorageCapacity (${resolvedStorageCapacity}) for FSx FileSystem ${logicalId}: this is the readCurrentState placeholder for a capacity-less file system (Lustre Intelligent-Tiering), not a desired value.`);
35048
+ const storageCapacityChanged = changed("StorageCapacity") && !storageCapacityIsPlaceholder;
35046
35049
  const storageTypeChanged = changed("StorageType");
35047
35050
  const typeVersionChanged = changed("FileSystemTypeVersion");
35048
35051
  const networkTypeChanged = changed("NetworkType");
@@ -35430,6 +35433,40 @@ var FSxFileSystemProvider = class {
35430
35433
  default: return;
35431
35434
  }
35432
35435
  }
35436
+ /** Map the read-side `LustreConfiguration` back to CFn input shape. */
35437
+ readLustreConfiguration(lustre) {
35438
+ const config = {};
35439
+ putIfDefined(config, "WeeklyMaintenanceStartTime", lustre.WeeklyMaintenanceStartTime);
35440
+ putIfDefined(config, "DeploymentType", lustre.DeploymentType);
35441
+ putIfDefined(config, "PerUnitStorageThroughput", lustre.PerUnitStorageThroughput);
35442
+ putIfDefined(config, "DailyAutomaticBackupStartTime", lustre.DailyAutomaticBackupStartTime);
35443
+ putIfDefined(config, "AutomaticBackupRetentionDays", lustre.AutomaticBackupRetentionDays);
35444
+ putIfDefined(config, "CopyTagsToBackups", lustre.CopyTagsToBackups);
35445
+ putIfDefined(config, "DriveCacheType", lustre.DriveCacheType);
35446
+ putIfDefined(config, "DataCompressionType", lustre.DataCompressionType);
35447
+ putIfDefined(config, "EfaEnabled", lustre.EfaEnabled);
35448
+ putIfDefined(config, "ThroughputCapacity", lustre.ThroughputCapacity);
35449
+ if (lustre.MetadataConfiguration) {
35450
+ const metadata = {};
35451
+ putIfDefined(metadata, "Mode", lustre.MetadataConfiguration.Mode);
35452
+ putIfDefined(metadata, "Iops", lustre.MetadataConfiguration.Iops);
35453
+ if (Object.keys(metadata).length > 0) config["MetadataConfiguration"] = metadata;
35454
+ }
35455
+ if (lustre.DataReadCacheConfiguration) {
35456
+ const readCache = {};
35457
+ putIfDefined(readCache, "SizingMode", lustre.DataReadCacheConfiguration.SizingMode);
35458
+ putIfDefined(readCache, "SizeGiB", lustre.DataReadCacheConfiguration.SizeGiB);
35459
+ if (Object.keys(readCache).length > 0) config["DataReadCacheConfiguration"] = readCache;
35460
+ }
35461
+ const dataRepo = lustre.DataRepositoryConfiguration;
35462
+ if (dataRepo) {
35463
+ putIfDefined(config, "ImportPath", dataRepo.ImportPath);
35464
+ putIfDefined(config, "ExportPath", dataRepo.ExportPath);
35465
+ putIfDefined(config, "AutoImportPolicy", dataRepo.AutoImportPolicy);
35466
+ putIfDefined(config, "ImportedFileChunkSize", dataRepo.ImportedFileChunkSize);
35467
+ }
35468
+ return config;
35469
+ }
35433
35470
  /** Map the read-side `WindowsConfiguration` back to CFn input shape. */
35434
35471
  readWindowsConfiguration(windows) {
35435
35472
  const config = {};
@@ -35587,8 +35624,14 @@ var FSxFileSystemProvider = class {
35587
35624
  * mapped back from the nested `DataRepositoryConfiguration` the API
35588
35625
  * returns. The Windows / ONTAP / OpenZFS variant blocks are reverse-mapped
35589
35626
  * by their respective `read*Configuration` helpers; the few inputs AWS
35590
- * never returns stay listed in {@link getDriftUnknownPaths}. At most one
35591
- * variant block is ever present (they key off `FileSystemType`).
35627
+ * never returns stay listed in {@link getDriftUnknownPaths}.
35628
+ *
35629
+ * Emission follows `docs/provider-development.md` §3b: every top-level
35630
+ * property `update()` can mutate is emitted unconditionally with a
35631
+ * placeholder, registry-createOnly properties keep their guard, and the
35632
+ * `<Variant>Configuration` blocks take the Class 1 type-discriminator
35633
+ * carve-out — exactly the ONE block matching `FileSystemType` is emitted
35634
+ * (at most one is ever legal on AWS), never the other three.
35592
35635
  * Returns `undefined` when the file system is gone.
35593
35636
  */
35594
35637
  async readCurrentState(physicalId, _logicalId, resourceType) {
@@ -35603,59 +35646,31 @@ var FSxFileSystemProvider = class {
35603
35646
  if (!fs) return void 0;
35604
35647
  const result = {};
35605
35648
  putIfDefined(result, "FileSystemType", fs.FileSystemType);
35606
- putIfDefined(result, "StorageCapacity", fs.StorageCapacity);
35607
- putIfDefined(result, "StorageType", fs.StorageType);
35608
35649
  putIfDefined(result, "SubnetIds", fs.SubnetIds ? [...fs.SubnetIds] : void 0);
35609
35650
  putIfDefined(result, "KmsKeyId", fs.KmsKeyId);
35610
- putIfDefined(result, "FileSystemTypeVersion", fs.FileSystemTypeVersion);
35611
- putIfDefined(result, "NetworkType", fs.NetworkType);
35612
- const lustre = fs.LustreConfiguration;
35613
- if (lustre) {
35614
- const config = {};
35615
- putIfDefined(config, "WeeklyMaintenanceStartTime", lustre.WeeklyMaintenanceStartTime);
35616
- putIfDefined(config, "DeploymentType", lustre.DeploymentType);
35617
- putIfDefined(config, "PerUnitStorageThroughput", lustre.PerUnitStorageThroughput);
35618
- putIfDefined(config, "DailyAutomaticBackupStartTime", lustre.DailyAutomaticBackupStartTime);
35619
- putIfDefined(config, "AutomaticBackupRetentionDays", lustre.AutomaticBackupRetentionDays);
35620
- putIfDefined(config, "CopyTagsToBackups", lustre.CopyTagsToBackups);
35621
- putIfDefined(config, "DriveCacheType", lustre.DriveCacheType);
35622
- putIfDefined(config, "DataCompressionType", lustre.DataCompressionType);
35623
- putIfDefined(config, "EfaEnabled", lustre.EfaEnabled);
35624
- putIfDefined(config, "ThroughputCapacity", lustre.ThroughputCapacity);
35625
- if (lustre.MetadataConfiguration) {
35626
- const metadata = {};
35627
- putIfDefined(metadata, "Mode", lustre.MetadataConfiguration.Mode);
35628
- putIfDefined(metadata, "Iops", lustre.MetadataConfiguration.Iops);
35629
- if (Object.keys(metadata).length > 0) config["MetadataConfiguration"] = metadata;
35630
- }
35631
- if (lustre.DataReadCacheConfiguration) {
35632
- const readCache = {};
35633
- putIfDefined(readCache, "SizingMode", lustre.DataReadCacheConfiguration.SizingMode);
35634
- putIfDefined(readCache, "SizeGiB", lustre.DataReadCacheConfiguration.SizeGiB);
35635
- if (Object.keys(readCache).length > 0) config["DataReadCacheConfiguration"] = readCache;
35636
- }
35637
- const dataRepo = lustre.DataRepositoryConfiguration;
35638
- if (dataRepo) {
35639
- putIfDefined(config, "ImportPath", dataRepo.ImportPath);
35640
- putIfDefined(config, "ExportPath", dataRepo.ExportPath);
35641
- putIfDefined(config, "AutoImportPolicy", dataRepo.AutoImportPolicy);
35642
- putIfDefined(config, "ImportedFileChunkSize", dataRepo.ImportedFileChunkSize);
35643
- }
35644
- if (Object.keys(config).length > 0) result["LustreConfiguration"] = config;
35645
- }
35646
- if (fs.WindowsConfiguration) {
35647
- const config = this.readWindowsConfiguration(fs.WindowsConfiguration);
35648
- if (Object.keys(config).length > 0) result["WindowsConfiguration"] = config;
35649
- }
35650
- if (fs.OntapConfiguration) {
35651
- const config = this.readOntapConfiguration(fs.OntapConfiguration);
35652
- if (Object.keys(config).length > 0) result["OntapConfiguration"] = config;
35653
- }
35654
- if (fs.OpenZFSConfiguration) {
35655
- const config = this.readOpenZFSConfiguration(fs.OpenZFSConfiguration);
35656
- if (Object.keys(config).length > 0) result["OpenZFSConfiguration"] = config;
35657
- }
35651
+ result["StorageCapacity"] = fs.StorageCapacity ?? 0;
35652
+ result["StorageType"] = fs.StorageType ?? "SSD";
35653
+ result["FileSystemTypeVersion"] = fs.FileSystemTypeVersion ?? "";
35654
+ result["NetworkType"] = fs.NetworkType ?? "IPV4";
35658
35655
  result["Tags"] = normalizeAwsTagsToCfn(fs.Tags);
35656
+ const variantKey = fs.FileSystemType ? VARIANT_CONFIG_KEY[fs.FileSystemType] : void 0;
35657
+ switch (variantKey) {
35658
+ case "LustreConfiguration":
35659
+ result[variantKey] = this.readLustreConfiguration(fs.LustreConfiguration ?? {});
35660
+ break;
35661
+ case "WindowsConfiguration":
35662
+ result[variantKey] = this.readWindowsConfiguration(fs.WindowsConfiguration ?? {});
35663
+ break;
35664
+ case "OntapConfiguration":
35665
+ result[variantKey] = this.readOntapConfiguration(fs.OntapConfiguration ?? {});
35666
+ break;
35667
+ case "OpenZFSConfiguration":
35668
+ result[variantKey] = this.readOpenZFSConfiguration(fs.OpenZFSConfiguration ?? {});
35669
+ break;
35670
+ default:
35671
+ this.logger.warn(`FSx FileSystem ${physicalId} has FileSystemType '${fs.FileSystemType ?? "(unset)"}', which cdkd does not recognize (expected one of ${Object.keys(VARIANT_CONFIG_KEY).join(" / ")}). Its variant configuration is NOT included in the drift snapshot, so drift in that block cannot be detected. Please report this at https://github.com/go-to-k/cdkd/issues`);
35672
+ break;
35673
+ }
35659
35674
  return result;
35660
35675
  }
35661
35676
  /**
@@ -62069,6 +62084,47 @@ function createMigrateCommand() {
62069
62084
  return new Command("migrate").description("Adopt a plain (non-CDK) CloudFormation stack into a cdkd-managed CDK app. Generates new CDK code via upstream `cdk migrate`, builds a logical-ID mapping between the source CFn template and the synth template, writes cdkd state, and (optionally) retires the source CFn stack. AWS resources are never modified.").argument("[stack]", "Source CFn stack name. Alias for --from-cfn-stack.").addOption(new Option("--from-cfn-stack <name>", "Source CloudFormation stack name to adopt. Required (or pass positionally).")).addOption(new Option("--output-dir <dir>", "Directory to write the generated CDK app to. Defaults to <cwd>/<CfnStackName>.")).addOption(new Option("--language <choice>", "Generated code language. v1: typescript only.").choices(["typescript"]).default("typescript")).addOption(new Option("--region <region>", "AWS region. Defaults to AWS_REGION env / profile.")).addOption(new Option("--account <id>", "AWS account ID. Auto-detected via STS when omitted.")).addOption(new Option("--retire-cfn-stack", "After cdkd state is written, inject DeletionPolicy=Retain on every resource in the source CFn stack and DeleteStack. AWS resources stay; the CFn stack record is gone. Off by default.").default(false)).addOption(new Option("--filter <key=value>", "Pass-through to `cdk migrate --filter` for resource subsetting. Repeatable.").argParser((value, previous) => [...previous ?? [], value]).default([])).addOption(new Option("--skip-install", "Skip `npm install` after codegen.").default(false)).addOption(new Option("--skip-synth", "Skip `cdk synth` (does NOT write cdkd state). Mutually exclusive with --retire-cfn-stack.").default(false)).addOption(new Option("--dry-run", "Print the import plan without writing state or retiring the CFn stack. Mutually exclusive with --retire-cfn-stack.").default(false)).addOption(new Option("-y, --yes", "Auto-confirm the import + retirement prompts.").default(false)).addOption(new Option("--cdk-bin <path>", "Override the `cdk` binary path.")).addOption(new Option("--resource-mapping <file>", `Path to a JSON file of {sourceLogicalId: synthLogicalId} overrides. Same shape as the auto-written ${RESOURCE_MAPPING_FILENAME}.`)).addOption(new Option("--state-bucket <name>", "cdkd state bucket. Defaults to cdkd-state-<accountId>.")).addOption(new Option("--state-prefix <prefix>", "cdkd state prefix inside the bucket.").default("cdkd")).addOption(new Option("--profile <name>", "AWS profile name.")).addOption(new Option("--role-arn <arn>", "IAM role to assume before any AWS call.")).addOption(new Option("--verbose", "Enable debug-level logging.").default(false)).action(withErrorHandling(migrateCommandAction));
62070
62085
  }
62071
62086
 
62087
+ //#endregion
62088
+ //#region src/cli/program.ts
62089
+ /**
62090
+ * Builds the full `cdkd` command tree.
62091
+ *
62092
+ * Lives in its own module rather than in `index.ts` because importing
62093
+ * `index.ts` runs `main()` as a side effect — the same reason
62094
+ * `pipe-close-handler.ts` was split out. Tooling can import this one safely.
62095
+ *
62096
+ * The consumer that motivated the split is
62097
+ * `scripts/check-integ-cli-flags.ts`, which validates every CLI invocation in
62098
+ * the integ fixtures against the option set of the subcommand that actually
62099
+ * declares the flag. Reading the real tree matters: `--help` omits hidden
62100
+ * options, and `src/cli/options.ts` is a flat global list with no command
62101
+ * attachment — so a flag declared there but never attached to a given
62102
+ * subcommand (the `cdkd import --region` case, which silently meant an entire
62103
+ * fixture's import round-trip never ran) is invisible to both.
62104
+ */
62105
+ function buildProgram() {
62106
+ const program = new Command();
62107
+ program.name("cdkd").description("CDK Direct - Deploy AWS CDK apps directly via SDK/Cloud Control API").version("0.254.1");
62108
+ program.addCommand(createBootstrapCommand());
62109
+ program.addCommand(createSynthCommand());
62110
+ program.addCommand(createListCommand());
62111
+ program.addCommand(createDeployCommand());
62112
+ program.addCommand(createDiffCommand());
62113
+ program.addCommand(createDriftCommand());
62114
+ program.addCommand(createDestroyCommand());
62115
+ program.addCommand(createEventsCommand());
62116
+ program.addCommand(createGcCommand());
62117
+ program.addCommand(createOrphanCommand());
62118
+ program.addCommand(createImportCommand());
62119
+ program.addCommand(createPublishAssetsCommand());
62120
+ program.addCommand(createForceUnlockCommand());
62121
+ program.addCommand(createStateCommand());
62122
+ program.addCommand(createLocalCommand());
62123
+ program.addCommand(createExportCommand());
62124
+ program.addCommand(createMigrateCommand());
62125
+ return program;
62126
+ }
62127
+
62072
62128
  //#endregion
62073
62129
  //#region src/cli/pipe-close-handler.ts
62074
62130
  /**
@@ -62137,25 +62193,7 @@ function reorderArgs(argv) {
62137
62193
  */
62138
62194
  async function main() {
62139
62195
  installPipeCloseHandler();
62140
- const program = new Command();
62141
- program.name("cdkd").description("CDK Direct - Deploy AWS CDK apps directly via SDK/Cloud Control API").version("0.254.0");
62142
- program.addCommand(createBootstrapCommand());
62143
- program.addCommand(createSynthCommand());
62144
- program.addCommand(createListCommand());
62145
- program.addCommand(createDeployCommand());
62146
- program.addCommand(createDiffCommand());
62147
- program.addCommand(createDriftCommand());
62148
- program.addCommand(createDestroyCommand());
62149
- program.addCommand(createEventsCommand());
62150
- program.addCommand(createGcCommand());
62151
- program.addCommand(createOrphanCommand());
62152
- program.addCommand(createImportCommand());
62153
- program.addCommand(createPublishAssetsCommand());
62154
- program.addCommand(createForceUnlockCommand());
62155
- program.addCommand(createStateCommand());
62156
- program.addCommand(createLocalCommand());
62157
- program.addCommand(createExportCommand());
62158
- program.addCommand(createMigrateCommand());
62196
+ const program = buildProgram();
62159
62197
  const args = reorderArgs(process.argv);
62160
62198
  await program.parseAsync(args);
62161
62199
  }