@go-to-k/cdkd 0.230.31 → 0.230.33

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
@@ -1,7 +1,7 @@
1
1
  #!/usr/bin/env node
2
2
  import { A as withErrorHandling, B as generateResourceName, C as StackHasActiveImportsError, F as getLiveRenderer, H as withSkipPrefix, I as PATTERN_B_NAME_OPTIONS, L as PATTERN_B_NAME_PROPERTIES, M as getLogger, P as runStackBuffered, R as PATTERN_B_RESOURCE_TYPES, S as ResourceUpdateNotSupportedError, U as withStackName, V as generateResourceNameWithFallback, _ as MissingCdkCliError, a as assertRegionMatch, b as ProvisioningError, f as LocalInvokeBuildError$1, i as resolveExplicitPhysicalId, k as normalizeAwsError, l as CdkdError, m as LocalStartServiceError, n as matchesCdkPath, o as disableInstanceApiTermination, p as LocalMigrateError, r as normalizeAwsTagsToCfn, s as isTerminationProtectionPropagationError, t as CDK_PATH_TAG, v as NestedStackChildDirectDestroyError, w as StackTerminationProtectionError, x as ResourceTimeoutError, y as PartialFailureError } from "./import-helpers-DayvBD4T.js";
3
3
  import { a as setAwsClients, i as resetAwsClients, r as getAwsClients, t as AwsClients } from "./aws-clients-pjPwZz1r.js";
4
- import { $ as resolveStateBucketWithDefaultAndSource, A as TemplateParser, B as getDockerCmd, C as findActionableSilentDrops, D as applyRoleArnIfSet, E as cfnRefValueFromPhysicalId, F as AssetPublisher, G as Synthesizer, H as runDockerStreaming, I as stringifyValue, J as getLegacyStateBucketName, K as synthesisStatusMessage, L as WorkGraph, M as S3StateBackend, N as rebuildClientForBucketRegion, O as DiffCalculator, P as shouldRetainResource, Q as resolveStateBucketWithDefault, R as buildDockerImage, S as ProviderRegistry, T as IntrinsicFunctionResolver, U as AssetManifestLoader, V as runDockerForeground, W as getDockerImageBySourceHash, X as resolveCaptureObservedState, Y as resolveApp, Z as resolveSkipPrefix, _ as green, a as withRetry, at as uploadCfnTemplate, b as IAMRoleProvider, c as computeImplicitDeleteEdges, ct as resolveBucketRegion, d as isStatefulRecreateTargetSync, et as warnDeprecatedNoPrefixCliFlag, f as renderStatefulReason, g as gray, h as cyan, i as withResourceDeadline, it as findLargeInlineResources, j as LockManager, k as DagBuilder, l as extractDeploymentEventError, m as bold, n as DEFAULT_RESOURCE_WARN_AFTER_MS, nt as CFN_TEMPLATE_URL_LIMIT, o as isRetryableTransientError, ot as AssemblyReader, p as formatResourceLine, q as getDefaultStateBucketName, r as DeployEngine, rt as MIGRATE_TMP_PREFIX, s as IMPLICIT_DELETE_DEPENDENCIES, t as DEFAULT_RESOURCE_TIMEOUT_MS, tt as CFN_TEMPLATE_BODY_LIMIT, u as MULTI_REGION_RECREATE_BLOCKED_TYPES, v as red, w as CloudControlProvider, x as collectInlinePolicyNamesManagedBySiblings, y as yellow, z as formatDockerLoginError } from "./deploy-engine-DpUNxTCs.js";
4
+ import { $ as resolveStateBucketWithDefaultAndSource, A as TemplateParser, B as getDockerCmd, C as findActionableSilentDrops, D as applyRoleArnIfSet, E as cfnRefValueFromPhysicalId, F as AssetPublisher, G as Synthesizer, H as runDockerStreaming, I as stringifyValue, J as getLegacyStateBucketName, K as synthesisStatusMessage, L as WorkGraph, M as S3StateBackend, N as rebuildClientForBucketRegion, O as DiffCalculator, P as shouldRetainResource, Q as resolveStateBucketWithDefault, R as buildDockerImage, S as ProviderRegistry, T as IntrinsicFunctionResolver, U as AssetManifestLoader, V as runDockerForeground, W as getDockerImageBySourceHash, X as resolveCaptureObservedState, Y as resolveApp, Z as resolveSkipPrefix, _ as green, a as withRetry, at as uploadCfnTemplate, b as IAMRoleProvider, c as computeImplicitDeleteEdges, ct as resolveBucketRegion, d as isStatefulRecreateTargetSync, et as warnDeprecatedNoPrefixCliFlag, f as renderStatefulReason, g as gray, h as cyan, i as withResourceDeadline, it as findLargeInlineResources, j as LockManager, k as DagBuilder, l as extractDeploymentEventError, m as bold, n as DEFAULT_RESOURCE_WARN_AFTER_MS, nt as CFN_TEMPLATE_URL_LIMIT, o as isRetryableTransientError, ot as AssemblyReader, p as formatResourceLine, q as getDefaultStateBucketName, r as DeployEngine, rt as MIGRATE_TMP_PREFIX, s as IMPLICIT_DELETE_DEPENDENCIES, t as DEFAULT_RESOURCE_TIMEOUT_MS, tt as CFN_TEMPLATE_BODY_LIMIT, u as MULTI_REGION_RECREATE_BLOCKED_TYPES, v as red, w as CloudControlProvider, x as collectInlinePolicyNamesManagedBySiblings, y as yellow, z as formatDockerLoginError } from "./deploy-engine-BEZF8ku-.js";
5
5
  import { t as ASGProvider } from "./asg-provider-Dgj3loIG.js";
6
6
  import { AsyncLocalStorage } from "node:async_hooks";
7
7
  import { createHash, randomBytes, randomUUID } from "node:crypto";
@@ -1446,7 +1446,7 @@ const FLUSH_INTERVAL_MS = 2e3;
1446
1446
  const FLUSH_EVENT_THRESHOLD = 50;
1447
1447
  /** Build-time cdkd version, with a dev fallback for non-built contexts. */
1448
1448
  function getCdkdVersion() {
1449
- return "0.230.31";
1449
+ return "0.230.33";
1450
1450
  }
1451
1451
  /**
1452
1452
  * Generate a time-sortable unique run id, e.g.
@@ -55650,7 +55650,7 @@ function reorderArgs(argv) {
55650
55650
  async function main() {
55651
55651
  installPipeCloseHandler();
55652
55652
  const program = new Command();
55653
- program.name("cdkd").description("CDK Direct - Deploy AWS CDK apps directly via SDK/Cloud Control API").version("0.230.31");
55653
+ program.name("cdkd").description("CDK Direct - Deploy AWS CDK apps directly via SDK/Cloud Control API").version("0.230.33");
55654
55654
  program.addCommand(createBootstrapCommand());
55655
55655
  program.addCommand(createSynthCommand());
55656
55656
  program.addCommand(createListCommand());
@@ -6086,6 +6086,13 @@ const AWS_NO_VALUE = Symbol("AWS::NoValue");
6086
6086
  * - AWS::ApiGateway::Stage `<restApiId>|<stageName>` -> stage name
6087
6087
  * - AWS::ApiGateway::Resource `<restApiId>|<resourceId>` -> resource id
6088
6088
  * - AWS::ApiGateway::Authorizer `<restApiId>|<authorizerId>` -> authorizer id
6089
+ * - AWS::ApiGatewayV2::Stage `<apiId>|<stageName>` -> stage name
6090
+ * - AWS::ApiGatewayV2::Route `<apiId>|<routeId>` -> route id
6091
+ * - AWS::ApiGatewayV2::Integration `<apiId>|<integrationId>` -> integration id
6092
+ * - AWS::ApiGatewayV2::Model `<apiId>|<modelId>` -> model id
6093
+ * - AWS::ApiGatewayV2::Deployment `<apiId>|<deploymentId>` -> deployment id
6094
+ * - AWS::ApiGatewayV2::RouteResponse `<apiId>|<routeId>|<respId>` -> route response id
6095
+ * - AWS::ApiGatewayV2::IntegrationResponse `<apiId>|<intId>|<respId>` -> integration response id
6089
6096
  * - AWS::Cognito::UserPoolClient `<userPoolId>|<clientId>` -> client id
6090
6097
  * - AWS::Cognito::UserPoolResourceServer `<userPoolId>|<identifier>` -> resource-server identifier
6091
6098
  * - AWS::Cognito::UserPoolGroup `<userPoolId>|<groupName>` -> group name
@@ -6135,6 +6142,13 @@ const REF_RETURNS_SEGMENT_AFTER_PIPE = new Set([
6135
6142
  "AWS::ApiGateway::Stage",
6136
6143
  "AWS::ApiGateway::Resource",
6137
6144
  "AWS::ApiGateway::Authorizer",
6145
+ "AWS::ApiGatewayV2::Stage",
6146
+ "AWS::ApiGatewayV2::Route",
6147
+ "AWS::ApiGatewayV2::Integration",
6148
+ "AWS::ApiGatewayV2::Model",
6149
+ "AWS::ApiGatewayV2::Deployment",
6150
+ "AWS::ApiGatewayV2::RouteResponse",
6151
+ "AWS::ApiGatewayV2::IntegrationResponse",
6138
6152
  "AWS::Cognito::UserPoolClient",
6139
6153
  "AWS::Cognito::UserPoolResourceServer",
6140
6154
  "AWS::Cognito::UserPoolGroup",
@@ -6155,14 +6169,30 @@ const REF_RETURNS_SEGMENT_AFTER_PIPE = new Set([
6155
6169
  * section):
6156
6170
  * - AWS::ApiGateway::Deployment `<deploymentId>|<restApiId>` -> deployment id
6157
6171
  * - AWS::ApiGateway::DocumentationPart `<docPartId>|<restApiId>` -> documentation part id
6172
+ * - AWS::ApiGatewayV2::Authorizer `<authorizerId>|<apiId>` -> authorizer id
6173
+ * - AWS::ApiGatewayV2::ApiMapping `<apiMappingId>|<domainName>` -> api mapping id
6158
6174
  *
6159
6175
  * Deployment matters in practice: every CDK-generated template wires the
6160
6176
  * Stage's `DeploymentId` as `{ Ref: <Deployment> }`, so a CC-routed
6161
- * Deployment would otherwise hand the Stage a compound id AWS rejects. Same
6162
- * maintenance rules as the after-pipe Set (docs-verified Ref semantics +
6177
+ * Deployment would otherwise hand the Stage a compound id AWS rejects; the V2
6178
+ * Authorizer matters the same way (a Route's `AuthorizerId` is
6179
+ * `{ Ref: <Authorizer> }` in every CDK HTTP-API-with-authorizer template).
6180
+ * Same maintenance rules as the after-pipe Set (docs-verified Ref semantics +
6163
6181
  * a pinning unit test per entry).
6164
- */
6165
- const REF_RETURNS_SEGMENT_BEFORE_FIRST_PIPE = new Set(["AWS::ApiGateway::Deployment", "AWS::ApiGateway::DocumentationPart"]);
6182
+ *
6183
+ * WARNING the V1 and V2 families are CROSS-WIRED, do not pattern-match one
6184
+ * from the other: V1 Authorizer is `[RestApiId, AuthorizerId]` (after-pipe)
6185
+ * while V2 Authorizer is `[AuthorizerId, ApiId]` (before-first-pipe), and V1
6186
+ * Deployment is `[DeploymentId, RestApiId]` (before-first-pipe) while V2
6187
+ * Deployment is `[ApiId, DeploymentId]` (after-pipe). Always re-check the
6188
+ * type's own `describe-type` primaryIdentifier.
6189
+ */
6190
+ const REF_RETURNS_SEGMENT_BEFORE_FIRST_PIPE = new Set([
6191
+ "AWS::ApiGateway::Deployment",
6192
+ "AWS::ApiGateway::DocumentationPart",
6193
+ "AWS::ApiGatewayV2::Authorizer",
6194
+ "AWS::ApiGatewayV2::ApiMapping"
6195
+ ]);
6166
6196
  /**
6167
6197
  * SDK-provisioned types whose provider stores the resource ARN as the physical
6168
6198
  * id (their delete / update paths need the ARN), while CloudFormation's `Ref`
@@ -12918,7 +12948,7 @@ async function withRetry(operation, logicalId, opts = {}) {
12918
12948
  } catch (error) {
12919
12949
  lastError = error;
12920
12950
  const message = error instanceof Error ? error.message : String(error);
12921
- if (!isRetryableTransientError(error, message) || attempt >= maxRetries) throw error;
12951
+ if (!(opts.isRetryable ? opts.isRetryable(message, error) : isRetryableTransientError(error, message)) || attempt >= maxRetries) throw error;
12922
12952
  const delay = Math.min(initialDelayMs * Math.pow(2, attempt), maxDelayMs);
12923
12953
  opts.logger?.debug(` ⏳ Retrying ${logicalId} in ${delay / 1e3}s (attempt ${attempt + 1}/${maxRetries}) - ${message}`);
12924
12954
  for (let waited = 0; waited < delay; waited += 1e3) {
@@ -14123,8 +14153,38 @@ var DeployEngine = class {
14123
14153
  createResult = await this.withRetry(() => replaceProvider.create(logicalId, resourceType, replaceProps), logicalId, void 0, void 0, replaceProvider);
14124
14154
  } else {
14125
14155
  this.logger.info(` Creating new ${logicalId}...`);
14126
- createResult = await this.withRetry(() => replaceProvider.create(logicalId, resourceType, replaceProps), logicalId, void 0, void 0, replaceProvider);
14127
- if (updateReplacePolicy === "Retain") this.logger.info(` Retaining old ${logicalId} (${currentResource.physicalId}) - UpdateReplacePolicy: Retain`);
14156
+ let deletedOldFirst = false;
14157
+ try {
14158
+ createResult = await this.withRetry(() => replaceProvider.create(logicalId, resourceType, replaceProps), logicalId, void 0, void 0, replaceProvider);
14159
+ } catch (createError) {
14160
+ const createMsg = createError instanceof Error ? createError.message : String(createError);
14161
+ if (!(/already exists/i.test(createMsg) || createMsg.includes("AlreadyExists"))) throw createError;
14162
+ if (updateReplacePolicy === "Retain") throw new CdkdError(`${logicalId} (${resourceType}) requires replacement, but its user-supplied physical name is still held by the existing resource AND UpdateReplacePolicy: Retain pins that resource in place. Rename the resource in your CDK code — with Retain, the old resource keeps the name, so a same-name replacement can never proceed.`, "NAMED_REPLACEMENT_COLLISION");
14163
+ if (this.options.replace !== true) throw new CdkdError(`${logicalId} (${resourceType}) requires replacement, but the create-first attempt collided with the existing resource: ${createMsg}. The resource has a user-supplied physical name, so the CloudFormation-style safe replacement order (create the new resource before deleting the old) cannot reuse the occupied name — CloudFormation refuses this shape with "cannot update a stack when a custom-named resource requires replacing". Either rename the resource in your CDK code (a fresh name lets the safe create-first order proceed), or re-run with \`cdkd deploy --replace\` to delete the old resource FIRST and recreate it under the same name (the resource is briefly unavailable while it is recreated).`, "NAMED_REPLACEMENT_COLLISION");
14164
+ this.logger.info(` Create-first collided with the custom-named resource and --replace is set — deleting old ${logicalId} (${currentResource.physicalId}) first...`);
14165
+ try {
14166
+ await oldDeleteProvider.delete(logicalId, currentResource.physicalId, resourceType, currentResource.properties, { expectedRegion: this.stackRegion });
14167
+ } catch (deleteError) {
14168
+ throw new Error(`Failed to delete old resource ${logicalId} (${currentResource.physicalId}) during the --replace delete-first fallback: ${deleteError instanceof Error ? deleteError.message : String(deleteError)}`);
14169
+ }
14170
+ this.logger.info(` ${green("✓")} Old resource deleted`);
14171
+ deletedOldFirst = true;
14172
+ this.logger.info(` Re-creating ${logicalId}...`);
14173
+ try {
14174
+ createResult = await withRetry(() => this.withRetry(() => replaceProvider.create(logicalId, resourceType, replaceProps), logicalId, void 0, void 0, replaceProvider), logicalId, {
14175
+ maxRetries: 5,
14176
+ initialDelayMs: 2e3,
14177
+ maxDelayMs: 1e4,
14178
+ logger: this.logger,
14179
+ isInterrupted: () => this.interrupted,
14180
+ onInterrupted: () => new InterruptedError(this.interruptCause ?? "user"),
14181
+ isRetryable: (message) => /already exists/i.test(message) || message.includes("AlreadyExists")
14182
+ });
14183
+ } catch (recreateError) {
14184
+ throw new Error(`Failed to re-create ${logicalId} after the --replace delete-first fallback already deleted the old resource (${currentResource.physicalId}): ${recreateError instanceof Error ? recreateError.message : String(recreateError)}. Re-run the deploy to create it fresh.`);
14185
+ }
14186
+ }
14187
+ if (deletedOldFirst) {} else if (updateReplacePolicy === "Retain") this.logger.info(` Retaining old ${logicalId} (${currentResource.physicalId}) - UpdateReplacePolicy: Retain`);
14128
14188
  else {
14129
14189
  this.logger.info(` Deleting old ${logicalId} (${currentResource.physicalId})...`);
14130
14190
  try {
@@ -14448,4 +14508,4 @@ var DeployEngine = class {
14448
14508
 
14449
14509
  //#endregion
14450
14510
  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 };
14451
- //# sourceMappingURL=deploy-engine-DpUNxTCs.js.map
14511
+ //# sourceMappingURL=deploy-engine-BEZF8ku-.js.map