@go-to-k/cdkd 0.99.1 → 0.99.2
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 +51 -4
- package/dist/cli.js.map +1 -1
- package/dist/go-to-k-cdkd-0.99.2.tgz +0 -0
- package/package.json +1 -1
- package/dist/go-to-k-cdkd-0.99.1.tgz +0 -0
package/dist/cli.js
CHANGED
|
@@ -32122,7 +32122,8 @@ async function importCommand(stackArg, options) {
|
|
|
32122
32122
|
stackName: stackInfo.stackName,
|
|
32123
32123
|
region: targetRegion,
|
|
32124
32124
|
providerRegistry,
|
|
32125
|
-
override: overrides.get(logicalId)
|
|
32125
|
+
override: overrides.get(logicalId),
|
|
32126
|
+
overrides
|
|
32126
32127
|
});
|
|
32127
32128
|
rows.push(outcome);
|
|
32128
32129
|
}
|
|
@@ -32176,9 +32177,54 @@ async function importCommand(stackArg, options) {
|
|
|
32176
32177
|
awsClients.destroy();
|
|
32177
32178
|
}
|
|
32178
32179
|
}
|
|
32180
|
+
/**
|
|
32181
|
+
* Recursively substitute `{Ref: <LogicalId>}` shapes in an arbitrary value
|
|
32182
|
+
* tree with the matching entry from `overrides`. Used to bridge the gap
|
|
32183
|
+
* between CDK synth's template (which carries raw intrinsics) and what a
|
|
32184
|
+
* provider's `import()` needs to see at the time it's called — specifically
|
|
32185
|
+
* for sub-resource providers like `SQSQueuePolicyProvider` whose fallback
|
|
32186
|
+
* path reads `properties.<ParentKey>` as a literal operational identifier
|
|
32187
|
+
* (queue URL / topic ARN / bucket name) rather than the unresolved intrinsic.
|
|
32188
|
+
*
|
|
32189
|
+
* Scope is intentionally narrow:
|
|
32190
|
+
* - Only `{Ref: <X>}` shapes are substituted. `Fn::GetAtt` is NOT handled
|
|
32191
|
+
* here — the overrides map carries physical IDs only, not the
|
|
32192
|
+
* per-resource attributes a GetAtt resolution needs. Full GetAtt /
|
|
32193
|
+
* Fn::Sub / Fn::Join handling happens later in
|
|
32194
|
+
* `resolveImportedProperties` against the populated `stackState.resources`.
|
|
32195
|
+
* - Pseudo-parameter refs (`AWS::Region` / `AWS::AccountId` / etc.) are
|
|
32196
|
+
* left untouched — those are handled by the full resolver post-import.
|
|
32197
|
+
* - When the `Ref` target is NOT in the overrides map, the intrinsic is
|
|
32198
|
+
* left in place (the post-import resolver may resolve it from the
|
|
32199
|
+
* `stackState.resources` built by other imports).
|
|
32200
|
+
*
|
|
32201
|
+
* Closes issue #361 — `AWS::SQS::QueuePolicy` under
|
|
32202
|
+
* `--migrate-from-cloudformation` previously hard-errored because
|
|
32203
|
+
* `properties.Queues[0]` arrived at `provider.import()` as
|
|
32204
|
+
* `{Ref: <Queue>}` and the queue URL needed for the fallback identification
|
|
32205
|
+
* branch was never substituted in.
|
|
32206
|
+
*
|
|
32207
|
+
* Pure-functional — does not mutate `value`.
|
|
32208
|
+
*/
|
|
32209
|
+
function substituteOverrideRefs(value, overrides) {
|
|
32210
|
+
if (value === null || value === void 0) return value;
|
|
32211
|
+
if (typeof value !== "object") return value;
|
|
32212
|
+
if (Array.isArray(value)) return value.map((v) => substituteOverrideRefs(v, overrides));
|
|
32213
|
+
const obj = value;
|
|
32214
|
+
const keys = Object.keys(obj);
|
|
32215
|
+
if (keys.length === 1 && keys[0] === "Ref" && typeof obj["Ref"] === "string") {
|
|
32216
|
+
const refTarget = obj["Ref"];
|
|
32217
|
+
const resolved = overrides.get(refTarget);
|
|
32218
|
+
if (resolved !== void 0) return resolved;
|
|
32219
|
+
return value;
|
|
32220
|
+
}
|
|
32221
|
+
const result = {};
|
|
32222
|
+
for (const [k, v] of Object.entries(obj)) result[k] = substituteOverrideRefs(v, overrides);
|
|
32223
|
+
return result;
|
|
32224
|
+
}
|
|
32179
32225
|
async function importOne(task) {
|
|
32180
32226
|
const logger = getLogger();
|
|
32181
|
-
const { logicalId, resource, stackName, region, providerRegistry, override } = task;
|
|
32227
|
+
const { logicalId, resource, stackName, region, providerRegistry, override, overrides } = task;
|
|
32182
32228
|
if (!providerRegistry.hasProvider(resource.Type)) return {
|
|
32183
32229
|
logicalId,
|
|
32184
32230
|
resourceType: resource.Type,
|
|
@@ -32193,13 +32239,14 @@ async function importOne(task) {
|
|
|
32193
32239
|
reason: `provider does not implement import (yet)`
|
|
32194
32240
|
};
|
|
32195
32241
|
const cdkPath = readCdkPath(resource);
|
|
32242
|
+
const properties = substituteOverrideRefs(resource.Properties ?? {}, overrides);
|
|
32196
32243
|
const input = {
|
|
32197
32244
|
logicalId,
|
|
32198
32245
|
resourceType: resource.Type,
|
|
32199
32246
|
cdkPath,
|
|
32200
32247
|
stackName,
|
|
32201
32248
|
region,
|
|
32202
|
-
properties
|
|
32249
|
+
properties,
|
|
32203
32250
|
...override !== void 0 && { knownPhysicalId: override }
|
|
32204
32251
|
};
|
|
32205
32252
|
try {
|
|
@@ -42547,7 +42594,7 @@ function reorderArgs(argv) {
|
|
|
42547
42594
|
*/
|
|
42548
42595
|
async function main() {
|
|
42549
42596
|
const program = new Command();
|
|
42550
|
-
program.name("cdkd").description("CDK Direct - Deploy AWS CDK apps directly via SDK/Cloud Control API").version("0.99.
|
|
42597
|
+
program.name("cdkd").description("CDK Direct - Deploy AWS CDK apps directly via SDK/Cloud Control API").version("0.99.1");
|
|
42551
42598
|
program.addCommand(createBootstrapCommand());
|
|
42552
42599
|
program.addCommand(createSynthCommand());
|
|
42553
42600
|
program.addCommand(createListCommand());
|