@go-to-k/cdkd 0.50.12 → 0.51.0
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 +97 -7
- package/dist/cli.js.map +2 -2
- package/dist/go-to-k-cdkd-0.51.0.tgz +0 -0
- package/dist/index.js +89 -0
- package/dist/index.js.map +2 -2
- package/package.json +1 -1
- package/dist/go-to-k-cdkd-0.50.12.tgz +0 -0
package/dist/cli.js
CHANGED
|
@@ -12008,11 +12008,11 @@ var S3BucketProvider = class {
|
|
|
12008
12008
|
this.logger.debug(`Applied EventBridge notification to bucket ${bucketName}`);
|
|
12009
12009
|
}
|
|
12010
12010
|
const corsConfig = properties["CorsConfiguration"];
|
|
12011
|
-
if (corsConfig?.CorsRules) {
|
|
12011
|
+
if (corsConfig?.CorsRules && Array.isArray(corsConfig.CorsRules) && corsConfig.CorsRules.length > 0) {
|
|
12012
12012
|
await this.applyCorsConfiguration(bucketName, corsConfig);
|
|
12013
12013
|
}
|
|
12014
12014
|
const lifecycleConfig = properties["LifecycleConfiguration"];
|
|
12015
|
-
if (lifecycleConfig?.Rules) {
|
|
12015
|
+
if (lifecycleConfig?.Rules && Array.isArray(lifecycleConfig.Rules) && lifecycleConfig.Rules.length > 0) {
|
|
12016
12016
|
await this.applyLifecycleConfiguration(bucketName, lifecycleConfig);
|
|
12017
12017
|
}
|
|
12018
12018
|
const publicAccessBlock = properties["PublicAccessBlockConfiguration"];
|
|
@@ -12020,7 +12020,7 @@ var S3BucketProvider = class {
|
|
|
12020
12020
|
await this.applyPublicAccessBlockConfiguration(bucketName, publicAccessBlock);
|
|
12021
12021
|
}
|
|
12022
12022
|
const bucketEncryption = properties["BucketEncryption"];
|
|
12023
|
-
if (bucketEncryption?.ServerSideEncryptionConfiguration) {
|
|
12023
|
+
if (bucketEncryption?.ServerSideEncryptionConfiguration && Array.isArray(bucketEncryption.ServerSideEncryptionConfiguration) && bucketEncryption.ServerSideEncryptionConfiguration.length > 0) {
|
|
12024
12024
|
await this.applyBucketEncryption(bucketName, bucketEncryption);
|
|
12025
12025
|
}
|
|
12026
12026
|
const loggingConfig = properties["LoggingConfiguration"];
|
|
@@ -12281,11 +12281,12 @@ var S3BucketProvider = class {
|
|
|
12281
12281
|
}
|
|
12282
12282
|
try {
|
|
12283
12283
|
const resp = await this.s3Client.send(new GetBucketTaggingCommand({ Bucket: physicalId }));
|
|
12284
|
-
|
|
12285
|
-
result["Tags"] = tags;
|
|
12284
|
+
result["Tags"] = normalizeAwsTagsToCfn(resp.TagSet);
|
|
12286
12285
|
} catch (err) {
|
|
12287
12286
|
const e = err;
|
|
12288
|
-
if (e.name
|
|
12287
|
+
if (e.name === "NoSuchTagSet") {
|
|
12288
|
+
result["Tags"] = [];
|
|
12289
|
+
} else {
|
|
12289
12290
|
throw err;
|
|
12290
12291
|
}
|
|
12291
12292
|
}
|
|
@@ -38026,6 +38027,65 @@ var DeployEngine = class {
|
|
|
38026
38027
|
}
|
|
38027
38028
|
}
|
|
38028
38029
|
}
|
|
38030
|
+
/**
|
|
38031
|
+
* Kick off `provider.readCurrentState` for every resource in the
|
|
38032
|
+
* loaded state that lacks `observedProperties` (e.g. state written
|
|
38033
|
+
* by a pre-v3 binary, or a v3 record where a NO_CHANGE-skipped
|
|
38034
|
+
* resource's baseline never landed). Calls go through
|
|
38035
|
+
* `kickOffObservedCapture`, so they share the same fire-and-forget
|
|
38036
|
+
* pipeline, error swallowing, and final-drain wiring that the
|
|
38037
|
+
* post-CREATE / post-UPDATE captures use.
|
|
38038
|
+
*
|
|
38039
|
+
* The deploy critical path does NOT wait on these; the cost is
|
|
38040
|
+
* bounded by `max(per-resource readCurrentState latency)` (typically
|
|
38041
|
+
* ~200-300ms in practice) once at the end-of-deploy drain. Any
|
|
38042
|
+
* resource that subsequently goes through CREATE / UPDATE in the
|
|
38043
|
+
* same deploy will overwrite this entry via the `Map.set` keyed by
|
|
38044
|
+
* `logicalId` (latest-wins) — so there's no double-write to state,
|
|
38045
|
+
* just a wasted SDK call for the (rare) UPDATE / DELETE intersection.
|
|
38046
|
+
*
|
|
38047
|
+
* Resources whose provider lookup throws (e.g. unsupported type) or
|
|
38048
|
+
* lacks `readCurrentState` are silently skipped — same policy as the
|
|
38049
|
+
* manual `cdkd state refresh-observed` command.
|
|
38050
|
+
*/
|
|
38051
|
+
kickOffAutoRefreshObservedProperties(stateResources) {
|
|
38052
|
+
if (this.options.captureObservedState !== true)
|
|
38053
|
+
return;
|
|
38054
|
+
if (this.options.dryRun === true)
|
|
38055
|
+
return;
|
|
38056
|
+
let toRefresh = 0;
|
|
38057
|
+
const candidates = [];
|
|
38058
|
+
for (const [logicalId, resource] of Object.entries(stateResources)) {
|
|
38059
|
+
if (resource.observedProperties !== void 0)
|
|
38060
|
+
continue;
|
|
38061
|
+
candidates.push({ logicalId, resource });
|
|
38062
|
+
}
|
|
38063
|
+
if (candidates.length === 0)
|
|
38064
|
+
return;
|
|
38065
|
+
for (const { logicalId, resource } of candidates) {
|
|
38066
|
+
let provider;
|
|
38067
|
+
try {
|
|
38068
|
+
provider = this.providerRegistry.getProvider(resource.resourceType);
|
|
38069
|
+
} catch {
|
|
38070
|
+
continue;
|
|
38071
|
+
}
|
|
38072
|
+
if (!provider.readCurrentState)
|
|
38073
|
+
continue;
|
|
38074
|
+
this.kickOffObservedCapture(
|
|
38075
|
+
provider,
|
|
38076
|
+
logicalId,
|
|
38077
|
+
resource.physicalId,
|
|
38078
|
+
resource.resourceType,
|
|
38079
|
+
resource.properties ?? {}
|
|
38080
|
+
);
|
|
38081
|
+
toRefresh++;
|
|
38082
|
+
}
|
|
38083
|
+
if (toRefresh > 0) {
|
|
38084
|
+
this.logger.warn(
|
|
38085
|
+
`cdkd state schema upgrade detected \u2014 refreshing observed-properties baseline for ${toRefresh} resource(s) (one-time, runs in parallel with deploy)`
|
|
38086
|
+
);
|
|
38087
|
+
}
|
|
38088
|
+
}
|
|
38029
38089
|
async doDeploy(stackName, template) {
|
|
38030
38090
|
const startTime = Date.now();
|
|
38031
38091
|
this.logger.debug(`Starting deployment for stack: ${stackName}`);
|
|
@@ -38057,6 +38117,7 @@ var DeployEngine = class {
|
|
|
38057
38117
|
this.logger.debug(
|
|
38058
38118
|
`Loaded current state: ${Object.keys(currentState.resources).length} resources`
|
|
38059
38119
|
);
|
|
38120
|
+
this.kickOffAutoRefreshObservedProperties(currentState.resources);
|
|
38060
38121
|
this.logger.debug(`Template has ${Object.keys(template.Resources || {}).length} resources`);
|
|
38061
38122
|
const parameterValues = await this.resolver.resolveParameters(
|
|
38062
38123
|
template,
|
|
@@ -38101,6 +38162,35 @@ var DeployEngine = class {
|
|
|
38101
38162
|
const hasChanges = this.diffCalculator.hasChanges(changes);
|
|
38102
38163
|
if (!hasChanges) {
|
|
38103
38164
|
this.logger.info("No changes detected. Stack is up to date.");
|
|
38165
|
+
if (!this.options.dryRun && this.observedCaptureTasks.size > 0) {
|
|
38166
|
+
await this.drainObservedCaptures(currentState.resources);
|
|
38167
|
+
try {
|
|
38168
|
+
const refreshedState = {
|
|
38169
|
+
version: STATE_SCHEMA_VERSION_CURRENT,
|
|
38170
|
+
region: this.stackRegion,
|
|
38171
|
+
stackName: currentState.stackName,
|
|
38172
|
+
resources: currentState.resources,
|
|
38173
|
+
outputs: currentState.outputs,
|
|
38174
|
+
lastModified: Date.now()
|
|
38175
|
+
};
|
|
38176
|
+
const saveOptions = {};
|
|
38177
|
+
if (currentEtag !== void 0)
|
|
38178
|
+
saveOptions.expectedEtag = currentEtag;
|
|
38179
|
+
if (migrationPending)
|
|
38180
|
+
saveOptions.migrateLegacy = true;
|
|
38181
|
+
await this.stateBackend.saveState(
|
|
38182
|
+
stackName,
|
|
38183
|
+
this.stackRegion,
|
|
38184
|
+
refreshedState,
|
|
38185
|
+
saveOptions
|
|
38186
|
+
);
|
|
38187
|
+
this.logger.debug("Persisted refreshed observedProperties (no-change path)");
|
|
38188
|
+
} catch (saveError) {
|
|
38189
|
+
this.logger.warn(
|
|
38190
|
+
`Failed to persist refreshed observedProperties: ${saveError instanceof Error ? saveError.message : String(saveError)} \u2014 drift baseline will be re-fetched on next deploy.`
|
|
38191
|
+
);
|
|
38192
|
+
}
|
|
38193
|
+
}
|
|
38104
38194
|
return {
|
|
38105
38195
|
stackName,
|
|
38106
38196
|
created: 0,
|
|
@@ -43889,7 +43979,7 @@ function reorderArgs(argv) {
|
|
|
43889
43979
|
}
|
|
43890
43980
|
async function main() {
|
|
43891
43981
|
const program = new Command14();
|
|
43892
|
-
program.name("cdkd").description("CDK Direct - Deploy AWS CDK apps directly via SDK/Cloud Control API").version("0.
|
|
43982
|
+
program.name("cdkd").description("CDK Direct - Deploy AWS CDK apps directly via SDK/Cloud Control API").version("0.51.0");
|
|
43893
43983
|
program.addCommand(createBootstrapCommand());
|
|
43894
43984
|
program.addCommand(createSynthCommand());
|
|
43895
43985
|
program.addCommand(createListCommand());
|