@go-to-k/cdkd 0.230.19 → 0.230.21
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/README.md +21 -0
- package/dist/cli.js +9 -6
- package/dist/cli.js.map +1 -1
- package/dist/{deploy-engine-Bdy5xKSQ.js → deploy-engine-C92fYX-D.js} +69 -37
- package/dist/deploy-engine-C92fYX-D.js.map +1 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -1
- package/package.json +1 -1
- package/dist/deploy-engine-Bdy5xKSQ.js.map +0 -1
|
@@ -6048,6 +6048,43 @@ const REF_RETURNS_SEGMENT_AFTER_PIPE = new Set([
|
|
|
6048
6048
|
"AWS::AppConfig::Deployment"
|
|
6049
6049
|
]);
|
|
6050
6050
|
/**
|
|
6051
|
+
* SDK-provisioned types whose provider stores the resource ARN as the physical
|
|
6052
|
+
* id (their delete / update paths need the ARN), while CloudFormation's `Ref`
|
|
6053
|
+
* returns the CFn physical resource id — which for these types is NOT the ARN:
|
|
6054
|
+
* - `AWS::Events::Rule` → the rule name (`arn:…:rule/<name>`), or
|
|
6055
|
+
* `<busName>|<ruleName>` for a custom-bus rule
|
|
6056
|
+
* (`arn:…:rule/<busName>/<ruleName>`) — the physical id CloudFormation
|
|
6057
|
+
* reports for such rules. The ARN stays reachable via `Fn::GetAtt Arn`.
|
|
6058
|
+
* - `AWS::CloudTrail::Trail` → the trail name (`arn:…:trail/<name>`).
|
|
6059
|
+
* Value: the ARN resource-type marker after which the CFn `Ref` value starts.
|
|
6060
|
+
*/
|
|
6061
|
+
const REF_RETURNS_NAME_FROM_ARN = new Map([["AWS::Events::Rule", ":rule/"], ["AWS::CloudTrail::Trail", ":trail/"]]);
|
|
6062
|
+
/**
|
|
6063
|
+
* Resolve the value CloudFormation's `Ref` returns for a resource, given its
|
|
6064
|
+
* type and cdkd-stored physical id. Pure function shared by the deploy-time
|
|
6065
|
+
* resolver ({@link IntrinsicFunctionResolver.resolveRefValue}) and the
|
|
6066
|
+
* `cdkd orphan` rewriter's `{Ref: <orphan>}` substitution, so both derive
|
|
6067
|
+
* identical CFn `Ref` semantics (after-pipe compound-id extraction and
|
|
6068
|
+
* name-from-ARN extraction included).
|
|
6069
|
+
*/
|
|
6070
|
+
function cfnRefValueFromPhysicalId(resourceType, physicalId) {
|
|
6071
|
+
const nameMarker = REF_RETURNS_NAME_FROM_ARN.get(resourceType);
|
|
6072
|
+
if (nameMarker && physicalId.startsWith("arn:")) {
|
|
6073
|
+
const markerIdx = physicalId.indexOf(nameMarker);
|
|
6074
|
+
if (markerIdx >= 0) {
|
|
6075
|
+
const segment = physicalId.substring(markerIdx + nameMarker.length);
|
|
6076
|
+
const slashIdx = segment.lastIndexOf("/");
|
|
6077
|
+
if (slashIdx >= 0) return `${segment.substring(0, slashIdx)}|${segment.substring(slashIdx + 1)}`;
|
|
6078
|
+
return segment;
|
|
6079
|
+
}
|
|
6080
|
+
}
|
|
6081
|
+
if (REF_RETURNS_SEGMENT_AFTER_PIPE.has(resourceType)) {
|
|
6082
|
+
const pipeIdx = physicalId.lastIndexOf("|");
|
|
6083
|
+
if (pipeIdx >= 0) return physicalId.substring(pipeIdx + 1);
|
|
6084
|
+
}
|
|
6085
|
+
return physicalId;
|
|
6086
|
+
}
|
|
6087
|
+
/**
|
|
6051
6088
|
* Intrinsic-function keys the resolver knows how to handle.
|
|
6052
6089
|
*
|
|
6053
6090
|
* A CloudFormation intrinsic is ALWAYS a single-key object — `{ "Ref": ... }`
|
|
@@ -6374,14 +6411,17 @@ var IntrinsicFunctionResolver = class {
|
|
|
6374
6411
|
* compound id, which fails the `[\w+]+` client-id validation.
|
|
6375
6412
|
* In every case the `Ref` value is the segment after the pipe (the parent id
|
|
6376
6413
|
* is the first identifier component).
|
|
6414
|
+
*
|
|
6415
|
+
* The {@link REF_RETURNS_NAME_FROM_ARN} types are SDK-provisioned with the
|
|
6416
|
+
* resource ARN stored as the physical id, while CFn's `Ref` returns the
|
|
6417
|
+
* resource NAME (the CFn physical resource id) — e.g. `AWS::Events::Rule`
|
|
6418
|
+
* (`Ref` is the rule name such as `mystack-ScheduledRule-ABC`; a consumer
|
|
6419
|
+
* calling `events:*` APIs by name or composing the name into another string
|
|
6420
|
+
* would otherwise get the full ARN) and `AWS::CloudTrail::Trail` (`Ref` is
|
|
6421
|
+
* the trail name). The name is extracted from the stored ARN.
|
|
6377
6422
|
*/
|
|
6378
6423
|
resolveRefValue(resource) {
|
|
6379
|
-
|
|
6380
|
-
if (REF_RETURNS_SEGMENT_AFTER_PIPE.has(resource.resourceType)) {
|
|
6381
|
-
const pipeIdx = physicalId.lastIndexOf("|");
|
|
6382
|
-
if (pipeIdx >= 0) return physicalId.substring(pipeIdx + 1);
|
|
6383
|
-
}
|
|
6384
|
-
return physicalId;
|
|
6424
|
+
return cfnRefValueFromPhysicalId(resource.resourceType, resource.physicalId);
|
|
6385
6425
|
}
|
|
6386
6426
|
/**
|
|
6387
6427
|
* Resolve Fn::GetAtt intrinsic function
|
|
@@ -6514,6 +6554,7 @@ var IntrinsicFunctionResolver = class {
|
|
|
6514
6554
|
}
|
|
6515
6555
|
if (resourceType === "AWS::Events::Rule") switch (attributeName) {
|
|
6516
6556
|
case "Arn": {
|
|
6557
|
+
if (physicalId.startsWith("arn:")) return physicalId;
|
|
6517
6558
|
const busRaw = resource.properties?.["EventBusName"];
|
|
6518
6559
|
const bus = typeof busRaw === "string" && busRaw && busRaw !== "default" ? busRaw : "";
|
|
6519
6560
|
const busName = bus.startsWith("arn:") ? bus.split("/").pop() || "" : bus;
|
|
@@ -6540,7 +6581,9 @@ var IntrinsicFunctionResolver = class {
|
|
|
6540
6581
|
default: return physicalId;
|
|
6541
6582
|
}
|
|
6542
6583
|
if (resourceType === "AWS::CloudTrail::Trail") switch (attributeName) {
|
|
6543
|
-
case "Arn":
|
|
6584
|
+
case "Arn":
|
|
6585
|
+
if (physicalId.startsWith("arn:")) return physicalId;
|
|
6586
|
+
return `arn:${partition}:cloudtrail:${region}:${accountId}:trail/${physicalId}`;
|
|
6544
6587
|
default: return physicalId;
|
|
6545
6588
|
}
|
|
6546
6589
|
if (resourceType === "AWS::AppSync::GraphQLApi") switch (attributeName) {
|
|
@@ -12535,6 +12578,7 @@ const RETRYABLE_ERROR_MESSAGE_PATTERNS = [
|
|
|
12535
12578
|
"Invalid value for the parameter Policy",
|
|
12536
12579
|
"required permissions for: ENHANCED_MONITORING",
|
|
12537
12580
|
"Caught ServiceAccessDeniedException",
|
|
12581
|
+
"permissions required to assume the role",
|
|
12538
12582
|
"conflicting conditional operation",
|
|
12539
12583
|
"scheduled for deletion",
|
|
12540
12584
|
"Cannot access stream",
|
|
@@ -12742,32 +12786,9 @@ const DEFAULT_RESOURCE_WARN_AFTER_MS = 300 * 1e3;
|
|
|
12742
12786
|
* explicitly because the Custom Resource provider's polling cap is 1h.
|
|
12743
12787
|
*/
|
|
12744
12788
|
const DEFAULT_RESOURCE_TIMEOUT_MS = 1800 * 1e3;
|
|
12745
|
-
/**
|
|
12746
|
-
* Deploy engine orchestrates the entire deployment process
|
|
12747
|
-
*
|
|
12748
|
-
* Responsibilities:
|
|
12749
|
-
* 1. Acquire stack lock
|
|
12750
|
-
* 2. Load current state
|
|
12751
|
-
* 3. Calculate diff
|
|
12752
|
-
* 4. Validate resource types
|
|
12753
|
-
* 5. Execute deployment in DAG order
|
|
12754
|
-
* 6. Save new state
|
|
12755
|
-
* 7. Release lock
|
|
12756
|
-
*
|
|
12757
|
-
* Rollback mechanism:
|
|
12758
|
-
* - Tracks completed operations during deployment
|
|
12759
|
-
* - On failure, rolls back in reverse order (best-effort)
|
|
12760
|
-
* - Supports --no-rollback flag to skip rollback (saves partial state and fails)
|
|
12761
|
-
* - CREATE → delete the newly created resource
|
|
12762
|
-
* - UPDATE → restore previous properties
|
|
12763
|
-
* - DELETE → cannot rollback (log warning)
|
|
12764
|
-
*/
|
|
12765
|
-
/**
|
|
12766
|
-
* Error thrown when deployment is interrupted by SIGINT
|
|
12767
|
-
*/
|
|
12768
12789
|
var InterruptedError = class extends Error {
|
|
12769
|
-
constructor() {
|
|
12770
|
-
super("Deployment interrupted by user (Ctrl+C)");
|
|
12790
|
+
constructor(reason = "user") {
|
|
12791
|
+
super(reason === "user" ? "Deployment interrupted by user (Ctrl+C)" : "Deployment aborted after another resource failed");
|
|
12771
12792
|
this.name = "InterruptedError";
|
|
12772
12793
|
}
|
|
12773
12794
|
};
|
|
@@ -12836,6 +12857,13 @@ var DeployEngine = class {
|
|
|
12836
12857
|
resolver;
|
|
12837
12858
|
interrupted = false;
|
|
12838
12859
|
/**
|
|
12860
|
+
* Why `interrupted` was set — first cause wins. `'user'` = SIGINT;
|
|
12861
|
+
* `'sibling-failure'` = a resource failed and the remaining work is being
|
|
12862
|
+
* cancelled. Drives the {@link InterruptedError} message so cancelled
|
|
12863
|
+
* siblings don't misreport a Ctrl+C nobody pressed.
|
|
12864
|
+
*/
|
|
12865
|
+
interruptCause = null;
|
|
12866
|
+
/**
|
|
12839
12867
|
* In-flight `provider.readCurrentState` promises kicked off after a
|
|
12840
12868
|
* successful CREATE / UPDATE. The deploy critical path does NOT
|
|
12841
12869
|
* `await` these; instead they're drained at the end of `doDeploy`
|
|
@@ -13126,11 +13154,13 @@ var DeployEngine = class {
|
|
|
13126
13154
|
const renderer = getLiveRenderer();
|
|
13127
13155
|
renderer.start();
|
|
13128
13156
|
this.interrupted = false;
|
|
13157
|
+
this.interruptCause = null;
|
|
13129
13158
|
const sigintHandler = () => {
|
|
13130
13159
|
renderer.printAbove(() => {
|
|
13131
13160
|
process.stderr.write("\nInterrupted — saving partial state after current operations complete...\n");
|
|
13132
13161
|
});
|
|
13133
13162
|
this.interrupted = true;
|
|
13163
|
+
this.interruptCause ??= "user";
|
|
13134
13164
|
};
|
|
13135
13165
|
process.on("SIGINT", sigintHandler);
|
|
13136
13166
|
try {
|
|
@@ -13350,6 +13380,7 @@ var DeployEngine = class {
|
|
|
13350
13380
|
await this.provisionResource(logicalId, change, newResources, stackName, template, parameterValues, conditions, actualCounts, progress);
|
|
13351
13381
|
} catch (provisionError) {
|
|
13352
13382
|
this.interrupted = true;
|
|
13383
|
+
this.interruptCause ??= "sibling-failure";
|
|
13353
13384
|
throw provisionError;
|
|
13354
13385
|
}
|
|
13355
13386
|
completedOperations.push({
|
|
@@ -13366,7 +13397,7 @@ var DeployEngine = class {
|
|
|
13366
13397
|
} finally {
|
|
13367
13398
|
await saveChain;
|
|
13368
13399
|
}
|
|
13369
|
-
if (this.interrupted && this.hasPending(createUpdateExecutor)) throw new InterruptedError();
|
|
13400
|
+
if (this.interrupted && this.hasPending(createUpdateExecutor)) throw new InterruptedError(this.interruptCause ?? "user");
|
|
13370
13401
|
}
|
|
13371
13402
|
if (deleteChanges.size > 0) {
|
|
13372
13403
|
this.logger.info(`${red("Deleting")} ${red(deleteChanges.size)} resource(s)`);
|
|
@@ -13387,6 +13418,7 @@ var DeployEngine = class {
|
|
|
13387
13418
|
await this.provisionResource(logicalId, change, newResources, stackName, template, parameterValues, conditions, actualCounts, progress);
|
|
13388
13419
|
} catch (provisionError) {
|
|
13389
13420
|
this.interrupted = true;
|
|
13421
|
+
this.interruptCause ??= "sibling-failure";
|
|
13390
13422
|
throw provisionError;
|
|
13391
13423
|
}
|
|
13392
13424
|
completedOperations.push({
|
|
@@ -13401,7 +13433,7 @@ var DeployEngine = class {
|
|
|
13401
13433
|
} finally {
|
|
13402
13434
|
await saveChain;
|
|
13403
13435
|
}
|
|
13404
|
-
if (this.interrupted && this.hasPending(deleteExecutor)) throw new InterruptedError();
|
|
13436
|
+
if (this.interrupted && this.hasPending(deleteExecutor)) throw new InterruptedError(this.interruptCause ?? "user");
|
|
13405
13437
|
}
|
|
13406
13438
|
} catch (error) {
|
|
13407
13439
|
try {
|
|
@@ -14145,7 +14177,7 @@ var DeployEngine = class {
|
|
|
14145
14177
|
...initialDelayMs !== void 0 && { initialDelayMs },
|
|
14146
14178
|
logger: this.logger,
|
|
14147
14179
|
isInterrupted: () => this.interrupted,
|
|
14148
|
-
onInterrupted: () => new InterruptedError()
|
|
14180
|
+
onInterrupted: () => new InterruptedError(this.interruptCause ?? "user")
|
|
14149
14181
|
});
|
|
14150
14182
|
}
|
|
14151
14183
|
/**
|
|
@@ -14187,5 +14219,5 @@ var DeployEngine = class {
|
|
|
14187
14219
|
};
|
|
14188
14220
|
|
|
14189
14221
|
//#endregion
|
|
14190
|
-
export {
|
|
14191
|
-
//# sourceMappingURL=deploy-engine-
|
|
14222
|
+
export { resolveStateBucketWithDefaultAndSource as $, TemplateParser as A, getDockerCmd as B, findActionableSilentDrops as C, applyRoleArnIfSet as D, cfnRefValueFromPhysicalId as E, AssetPublisher as F, Synthesizer as G, runDockerStreaming as H, stringifyValue as I, getLegacyStateBucketName as J, synthesisStatusMessage as K, WorkGraph as L, S3StateBackend as M, rebuildClientForBucketRegion as N, DiffCalculator as O, shouldRetainResource as P, resolveStateBucketWithDefault as Q, buildDockerImage as R, ProviderRegistry as S, IntrinsicFunctionResolver as T, AssetManifestLoader as U, runDockerForeground as V, getDockerImageBySourceHash as W, resolveCaptureObservedState as X, resolveApp as Y, resolveSkipPrefix as Z, green as _, withRetry as a, uploadCfnTemplate as at, IAMRoleProvider as b, computeImplicitDeleteEdges as c, resolveBucketRegion as ct, isStatefulRecreateTargetSync as d, warnDeprecatedNoPrefixCliFlag as et, renderStatefulReason as f, gray as g, cyan as h, withResourceDeadline as i, findLargeInlineResources as it, LockManager as j, DagBuilder as k, extractDeploymentEventError as l, bold as m, DEFAULT_RESOURCE_WARN_AFTER_MS as n, CFN_TEMPLATE_URL_LIMIT as nt, isRetryableTransientError as o, AssemblyReader as ot, formatResourceLine as p, getDefaultStateBucketName as q, DeployEngine as r, MIGRATE_TMP_PREFIX as rt, IMPLICIT_DELETE_DEPENDENCIES as s, clearBucketRegionCache as st, DEFAULT_RESOURCE_TIMEOUT_MS as t, CFN_TEMPLATE_BODY_LIMIT as tt, MULTI_REGION_RECREATE_BLOCKED_TYPES as u, red as v, CloudControlProvider as w, collectInlinePolicyNamesManagedBySiblings as x, yellow as y, formatDockerLoginError as z };
|
|
14223
|
+
//# sourceMappingURL=deploy-engine-C92fYX-D.js.map
|