@go-to-k/cdkd 0.50.13 → 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 +90 -1
- 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.13.tgz +0 -0
package/dist/cli.js
CHANGED
|
@@ -38027,6 +38027,65 @@ var DeployEngine = class {
|
|
|
38027
38027
|
}
|
|
38028
38028
|
}
|
|
38029
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
|
+
}
|
|
38030
38089
|
async doDeploy(stackName, template) {
|
|
38031
38090
|
const startTime = Date.now();
|
|
38032
38091
|
this.logger.debug(`Starting deployment for stack: ${stackName}`);
|
|
@@ -38058,6 +38117,7 @@ var DeployEngine = class {
|
|
|
38058
38117
|
this.logger.debug(
|
|
38059
38118
|
`Loaded current state: ${Object.keys(currentState.resources).length} resources`
|
|
38060
38119
|
);
|
|
38120
|
+
this.kickOffAutoRefreshObservedProperties(currentState.resources);
|
|
38061
38121
|
this.logger.debug(`Template has ${Object.keys(template.Resources || {}).length} resources`);
|
|
38062
38122
|
const parameterValues = await this.resolver.resolveParameters(
|
|
38063
38123
|
template,
|
|
@@ -38102,6 +38162,35 @@ var DeployEngine = class {
|
|
|
38102
38162
|
const hasChanges = this.diffCalculator.hasChanges(changes);
|
|
38103
38163
|
if (!hasChanges) {
|
|
38104
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
|
+
}
|
|
38105
38194
|
return {
|
|
38106
38195
|
stackName,
|
|
38107
38196
|
created: 0,
|
|
@@ -43890,7 +43979,7 @@ function reorderArgs(argv) {
|
|
|
43890
43979
|
}
|
|
43891
43980
|
async function main() {
|
|
43892
43981
|
const program = new Command14();
|
|
43893
|
-
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");
|
|
43894
43983
|
program.addCommand(createBootstrapCommand());
|
|
43895
43984
|
program.addCommand(createSynthCommand());
|
|
43896
43985
|
program.addCommand(createListCommand());
|