@go-to-k/cdkd 0.219.6 → 0.219.7

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 generateResourceNameWithFallback, C as StackHasActiveImportsError, F as getLiveRenderer, H as withStackName, I as PATTERN_B_NAME_PROPERTIES, L as PATTERN_B_RESOURCE_TYPES, M as getLogger, P as runStackBuffered, S as ResourceUpdateNotSupportedError, V as withSkipPrefix, _ 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, z as generateResourceName } from "./import-helpers-wLipXr5g.js";
3
3
  import { a as setAwsClients, i as resetAwsClients, r as getAwsClients, t as AwsClients } from "./aws-clients-pjPwZz1r.js";
4
- import { A as WorkGraph, B as resolveCaptureObservedState, C as DagBuilder, D as shouldRetainResource, E as S3StateBackend, F as runDockerStreaming, G as CFN_TEMPLATE_BODY_LIMIT, H as resolveStateBucketWithDefault, I as Synthesizer, J as findLargeInlineResources, K as CFN_TEMPLATE_URL_LIMIT, L as getDefaultStateBucketName, M as formatDockerLoginError, N as getDockerCmd, O as AssetPublisher, P as runDockerForeground, Q as resolveBucketRegion, R as getLegacyStateBucketName, S as DiffCalculator, T as LockManager, U as resolveStateBucketWithDefaultAndSource, V as resolveSkipPrefix, W as warnDeprecatedNoPrefixCliFlag, X as AssemblyReader, Y as uploadCfnTemplate, _ as ProviderRegistry, a as withRetry, b as IntrinsicFunctionResolver, c as formatResourceLine, d as gray, f as green, g as collectInlinePolicyNamesManagedBySiblings, h as IAMRoleProvider, i as withResourceDeadline, j as buildDockerImage, k as stringifyValue, l as bold, m as yellow, n as DEFAULT_RESOURCE_WARN_AFTER_MS, o as isRetryableTransientError, p as red, q as MIGRATE_TMP_PREFIX, r as DeployEngine, s as IMPLICIT_DELETE_DEPENDENCIES, t as DEFAULT_RESOURCE_TIMEOUT_MS, u as cyan, v as findActionableSilentDrops, w as TemplateParser, x as applyRoleArnIfSet, y as CloudControlProvider, z as resolveApp } from "./deploy-engine-CwB8POpC.js";
4
+ import { A as WorkGraph, B as resolveCaptureObservedState, C as DagBuilder, D as shouldRetainResource, E as S3StateBackend, F as runDockerStreaming, G as CFN_TEMPLATE_BODY_LIMIT, H as resolveStateBucketWithDefault, I as Synthesizer, J as findLargeInlineResources, K as CFN_TEMPLATE_URL_LIMIT, L as getDefaultStateBucketName, M as formatDockerLoginError, N as getDockerCmd, O as AssetPublisher, P as runDockerForeground, Q as resolveBucketRegion, R as getLegacyStateBucketName, S as DiffCalculator, T as LockManager, U as resolveStateBucketWithDefaultAndSource, V as resolveSkipPrefix, W as warnDeprecatedNoPrefixCliFlag, X as AssemblyReader, Y as uploadCfnTemplate, _ as ProviderRegistry, a as withRetry, b as IntrinsicFunctionResolver, c as formatResourceLine, d as gray, f as green, g as collectInlinePolicyNamesManagedBySiblings, h as IAMRoleProvider, i as withResourceDeadline, j as buildDockerImage, k as stringifyValue, l as bold, m as yellow, n as DEFAULT_RESOURCE_WARN_AFTER_MS, o as isRetryableTransientError, p as red, q as MIGRATE_TMP_PREFIX, r as DeployEngine, s as IMPLICIT_DELETE_DEPENDENCIES, t as DEFAULT_RESOURCE_TIMEOUT_MS, u as cyan, v as findActionableSilentDrops, w as TemplateParser, x as applyRoleArnIfSet, y as CloudControlProvider, z as resolveApp } from "./deploy-engine-BWfGeCMs.js";
5
5
  import { t as ASGProvider } from "./asg-provider-B_hrCxRx.js";
6
6
  import { AsyncLocalStorage } from "node:async_hooks";
7
7
  import { randomBytes, randomUUID } from "node:crypto";
@@ -52867,7 +52867,7 @@ function reorderArgs(argv) {
52867
52867
  async function main() {
52868
52868
  installPipeCloseHandler();
52869
52869
  const program = new Command();
52870
- program.name("cdkd").description("CDK Direct - Deploy AWS CDK apps directly via SDK/Cloud Control API").version("0.219.6");
52870
+ program.name("cdkd").description("CDK Direct - Deploy AWS CDK apps directly via SDK/Cloud Control API").version("0.219.7");
52871
52871
  program.addCommand(createBootstrapCommand());
52872
52872
  program.addCommand(createSynthCommand());
52873
52873
  program.addCommand(createListCommand());
@@ -9,7 +9,7 @@ import { GetFunctionUrlConfigCommand, InvokeCommand, LambdaClient, UpdateFunctio
9
9
  import { AssumeRoleCommand, GetCallerIdentityCommand, STSClient } from "@aws-sdk/client-sts";
10
10
  import { DescribeAvailabilityZonesCommand, DescribeImagesCommand, DescribeLaunchTemplatesCommand, DescribeRouteTablesCommand, DescribeSecurityGroupsCommand, DescribeSubnetsCommand, DescribeVpcsCommand, DescribeVpnGatewaysCommand, EC2Client } from "@aws-sdk/client-ec2";
11
11
  import { DescribeTableCommand } from "@aws-sdk/client-dynamodb";
12
- import { CloudFormationClient, CreateChangeSetCommand, DeleteStackCommand, DescribeChangeSetCommand, GetTemplateCommand, waitUntilChangeSetCreateComplete } from "@aws-sdk/client-cloudformation";
12
+ import { CloudFormationClient, CreateChangeSetCommand, DeleteStackCommand, DescribeChangeSetCommand, DescribeTypeCommand, GetTemplateCommand, waitUntilChangeSetCreateComplete } from "@aws-sdk/client-cloudformation";
13
13
  import { GetRestApiCommand } from "@aws-sdk/client-api-gateway";
14
14
  import { GetSecretValueCommand } from "@aws-sdk/client-secrets-manager";
15
15
  import { GetParameterCommand, SSMClient } from "@aws-sdk/client-ssm";
@@ -6388,6 +6388,100 @@ var JsonPatchGenerator = class {
6388
6388
  }
6389
6389
  };
6390
6390
 
6391
+ //#endregion
6392
+ //#region src/provisioning/write-only-properties.ts
6393
+ /**
6394
+ * Write-only property resolution for Cloud Control API updates (issue #809).
6395
+ *
6396
+ * Cloud Control API applies UPDATE patch documents with read-modify-write
6397
+ * semantics: the type's read handler returns the current model, the patch is
6398
+ * applied on top, and the result becomes the desired state handed to the
6399
+ * update handler. Read handlers cannot return write-only properties, so any
6400
+ * write-only property that is not explicitly present in the patch document
6401
+ * vanishes from the desired state on every CC-routed UPDATE (e.g.
6402
+ * `AWS::ECS::Service` loses `VolumeConfigurations` and the update hard-fails;
6403
+ * for other types the loss is silent).
6404
+ *
6405
+ * This module resolves each resource type's `writeOnlyProperties` from the
6406
+ * CloudFormation registry schema via `cloudformation:DescribeType`, reduced
6407
+ * to the TOP-LEVEL containing property names (a nested path like
6408
+ * `/properties/Foo/Bar` strips to `Foo` — re-adding the whole containing
6409
+ * property is sufficient and matches terraform-provider-awscc's approach of
6410
+ * clearing write-only attribute paths in the prior state so the patch
6411
+ * generator always emits `add` ops for them).
6412
+ *
6413
+ * Only SUCCESSFUL lookups are cached per resource type for the process
6414
+ * (deploy) lifetime — `cloudformation:DescribeType` is throttled per-account,
6415
+ * and the schema cannot change mid-deploy. A FAILED lookup (missing IAM
6416
+ * permission, transient throttle / 5xx) is logged as a warning and resolves
6417
+ * to an empty set WITHOUT poisoning the cache, so the caller gracefully falls
6418
+ * back to the minimal patch for THIS update while a later update of the same
6419
+ * type retries `DescribeType`. Caching failures would let a single transient
6420
+ * throttle on the first CC-routed UPDATE silently disable write-only
6421
+ * re-inclusion for every CC-routed type for the rest of the deploy —
6422
+ * reintroducing the exact hard-fail this module fixes. No regression for
6423
+ * callers permanently without the `cloudformation:DescribeType` permission:
6424
+ * each update simply re-warns and re-falls-back.
6425
+ */
6426
+ /**
6427
+ * Per-type cache of SUCCESSFUL lookups only. The value is the in-flight (or
6428
+ * settled) promise so that concurrent updates of the same resource type share
6429
+ * a single DescribeType call. A failed lookup removes its own entry so a
6430
+ * later call retries instead of being permanently poisoned by a transient
6431
+ * throttle / 5xx.
6432
+ */
6433
+ const writeOnlyPropertiesCache = /* @__PURE__ */ new Map();
6434
+ /**
6435
+ * Resolve the TOP-LEVEL write-only property names for a resource type.
6436
+ *
6437
+ * Never throws: a DescribeType failure logs a warning and resolves to an
6438
+ * empty set (graceful fallback to the minimal patch). Only SUCCESSFUL
6439
+ * lookups are cached per resource type for the process lifetime; a failed
6440
+ * lookup is NOT cached, so a later call for the same type retries
6441
+ * DescribeType (a transient throttle must not poison the deploy).
6442
+ */
6443
+ function getTopLevelWriteOnlyProperties(resourceType) {
6444
+ const cached = writeOnlyPropertiesCache.get(resourceType);
6445
+ if (cached) return cached;
6446
+ const entry = fetchTopLevelWriteOnlyProperties(resourceType).catch((error) => {
6447
+ writeOnlyPropertiesCache.delete(resourceType);
6448
+ const message = error instanceof Error ? error.message : String(error);
6449
+ getLogger().child("WriteOnlyProperties").warn(`Failed to resolve write-only properties for ${resourceType} via cloudformation:DescribeType (${message}). Falling back to a minimal update patch — write-only properties (if any) may be dropped by the Cloud Control read-modify-write update. Grant cloudformation:DescribeType to enable write-only property re-inclusion.`);
6450
+ return /* @__PURE__ */ new Set();
6451
+ });
6452
+ writeOnlyPropertiesCache.set(resourceType, entry);
6453
+ return entry;
6454
+ }
6455
+ /**
6456
+ * Fetch + parse the type's write-only properties. THROWS on a DescribeType
6457
+ * failure — the caller (`getTopLevelWriteOnlyProperties`) catches, warns, and
6458
+ * declines to cache so the lookup can be retried later.
6459
+ */
6460
+ async function fetchTopLevelWriteOnlyProperties(resourceType) {
6461
+ const logger = getLogger().child("WriteOnlyProperties");
6462
+ const response = await getAwsClients().cloudFormation.send(new DescribeTypeCommand({
6463
+ Type: "RESOURCE",
6464
+ TypeName: resourceType
6465
+ }));
6466
+ const result = /* @__PURE__ */ new Set();
6467
+ if (response.Schema) {
6468
+ const writeOnly = JSON.parse(response.Schema).writeOnlyProperties;
6469
+ if (Array.isArray(writeOnly)) for (const path of writeOnly) {
6470
+ if (typeof path !== "string") continue;
6471
+ const match = /^\/properties\/([^/]+)/.exec(path);
6472
+ if (match?.[1]) result.add(unescapeJsonPointerSegment(match[1]));
6473
+ }
6474
+ }
6475
+ logger.debug(`Resolved ${result.size} top-level write-only properties for ${resourceType}` + (result.size > 0 ? `: ${[...result].join(", ")}` : ""));
6476
+ return result;
6477
+ }
6478
+ /**
6479
+ * Unescape an RFC 6901 JSON Pointer segment (`~1` -> `/`, `~0` -> `~`).
6480
+ */
6481
+ function unescapeJsonPointerSegment(segment) {
6482
+ return segment.replace(/~1/g, "/").replace(/~0/g, "~");
6483
+ }
6484
+
6391
6485
  //#endregion
6392
6486
  //#region src/provisioning/unsupported-types.generated.ts
6393
6487
  /**
@@ -6700,7 +6794,7 @@ var CloudControlProvider = class {
6700
6794
  try {
6701
6795
  const cleanPreviousProperties = stringifyJsonProperties(resourceType, stripNullValues(previousProperties));
6702
6796
  const cleanProperties = stringifyJsonProperties(resourceType, stripNullValues(properties));
6703
- const patch = this.patchGenerator.generatePatch(cleanPreviousProperties, cleanProperties);
6797
+ let patch = this.patchGenerator.generatePatch(cleanPreviousProperties, cleanProperties);
6704
6798
  if (patch.length === 0) {
6705
6799
  this.logger.debug(`No property changes detected for ${logicalId}, skipping update`);
6706
6800
  return {
@@ -6708,6 +6802,19 @@ var CloudControlProvider = class {
6708
6802
  wasReplaced: false
6709
6803
  };
6710
6804
  }
6805
+ const writeOnlyProperties = await getTopLevelWriteOnlyProperties(resourceType);
6806
+ if (writeOnlyProperties.size > 0) {
6807
+ const previousWithoutWriteOnly = { ...cleanPreviousProperties };
6808
+ for (const propertyName of writeOnlyProperties) delete previousWithoutWriteOnly[propertyName];
6809
+ patch = this.patchGenerator.generatePatch(previousWithoutWriteOnly, cleanProperties);
6810
+ if (patch.length === 0) {
6811
+ this.logger.debug(`Only removed write-only properties detected for ${logicalId}, skipping update`);
6812
+ return {
6813
+ physicalId,
6814
+ wasReplaced: false
6815
+ };
6816
+ }
6817
+ }
6711
6818
  this.logger.debug(`Generated ${patch.length} patch operations for ${logicalId}: ${JSON.stringify(patch)}`);
6712
6819
  const updateResponse = await this.cloudControlClient.send(new UpdateResourceCommand({
6713
6820
  TypeName: resourceType,
@@ -12272,4 +12379,4 @@ var DeployEngine = class {
12272
12379
 
12273
12380
  //#endregion
12274
12381
  export { WorkGraph as A, resolveCaptureObservedState as B, DagBuilder as C, shouldRetainResource as D, S3StateBackend as E, runDockerStreaming as F, CFN_TEMPLATE_BODY_LIMIT as G, resolveStateBucketWithDefault as H, Synthesizer as I, findLargeInlineResources as J, CFN_TEMPLATE_URL_LIMIT as K, getDefaultStateBucketName as L, formatDockerLoginError as M, getDockerCmd as N, AssetPublisher as O, runDockerForeground as P, resolveBucketRegion as Q, getLegacyStateBucketName as R, DiffCalculator as S, LockManager as T, resolveStateBucketWithDefaultAndSource as U, resolveSkipPrefix as V, warnDeprecatedNoPrefixCliFlag as W, AssemblyReader as X, uploadCfnTemplate as Y, clearBucketRegionCache as Z, ProviderRegistry as _, withRetry as a, IntrinsicFunctionResolver as b, formatResourceLine as c, gray as d, green as f, collectInlinePolicyNamesManagedBySiblings as g, IAMRoleProvider as h, withResourceDeadline as i, buildDockerImage as j, stringifyValue as k, bold as l, yellow as m, DEFAULT_RESOURCE_WARN_AFTER_MS as n, isRetryableTransientError as o, red as p, MIGRATE_TMP_PREFIX as q, DeployEngine as r, IMPLICIT_DELETE_DEPENDENCIES as s, DEFAULT_RESOURCE_TIMEOUT_MS as t, cyan as u, findActionableSilentDrops as v, TemplateParser as w, applyRoleArnIfSet as x, CloudControlProvider as y, resolveApp as z };
12275
- //# sourceMappingURL=deploy-engine-CwB8POpC.js.map
12382
+ //# sourceMappingURL=deploy-engine-BWfGeCMs.js.map