@go-to-k/cdkd 0.230.28 → 0.230.30

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.
@@ -5203,48 +5203,126 @@ var ReplacementRulesRegistry = class {
5203
5203
  */
5204
5204
  const createOnlyPropertiesCache = /* @__PURE__ */ new Map();
5205
5205
  /**
5206
- * Resolve the TOP-LEVEL create-only (immutable) property names for a resource
5207
- * type.
5206
+ * Resolve the create-only (immutable) property PATHS for a resource type,
5207
+ * each as the segment array after `/properties/` (e.g.
5208
+ * `['Name']`, `['SourceParameters', 'KinesisStreamParameters',
5209
+ * 'StartingPosition']`).
5210
+ *
5211
+ * Full paths — not top-level reductions — because reducing a NESTED
5212
+ * createOnly entry to its top-level container over-approximates: for
5213
+ * `AWS::Pipes::Pipe`, `SourceParameters` itself is mutable and only
5214
+ * stream-source sub-paths under it are createOnly, so an SQS pipe's
5215
+ * `SourceParameters.SqsQueueParameters.BatchSize` change (CFn: "No
5216
+ * interruption") was mis-classified as a replacement (issue #960). The diff
5217
+ * consults {@link createOnlyChangeRequiresReplacement} to compare at the
5218
+ * schema's actual path granularity.
5208
5219
  *
5209
5220
  * Never throws: a DescribeType failure logs a warning and resolves to an empty
5210
- * set (graceful fallback to the registry-only classification). Only SUCCESSFUL
5221
+ * list (graceful fallback to the registry-only classification). Only SUCCESSFUL
5211
5222
  * lookups are cached per resource type for the process lifetime; a failed
5212
5223
  * lookup is NOT cached, so a later call for the same type retries DescribeType
5213
5224
  * (a transient throttle must not poison the deploy's replacement detection).
5214
5225
  */
5215
- function getTopLevelCreateOnlyProperties(resourceType) {
5226
+ function getCreateOnlyPropertyPaths(resourceType) {
5216
5227
  const cached = createOnlyPropertiesCache.get(resourceType);
5217
5228
  if (cached) return cached;
5218
- const entry = fetchTopLevelCreateOnlyProperties(resourceType).catch((error) => {
5229
+ const entry = fetchCreateOnlyPropertyPaths(resourceType).catch((error) => {
5219
5230
  createOnlyPropertiesCache.delete(resourceType);
5220
5231
  const message = error instanceof Error ? error.message : String(error);
5221
5232
  getLogger().child("CreateOnlyProperties").warn(`Failed to resolve create-only properties for ${resourceType} via cloudformation:DescribeType (${message}). Falling back to the registry-only replacement classification for this resource — an immutable-property change may be mis-classified as an in-place update. Grant cloudformation:DescribeType to enable schema-driven replacement detection.`);
5222
- return /* @__PURE__ */ new Set();
5233
+ return [];
5223
5234
  });
5224
5235
  createOnlyPropertiesCache.set(resourceType, entry);
5225
5236
  return entry;
5226
5237
  }
5227
5238
  /**
5228
- * Fetch + parse the type's create-only properties. THROWS on a DescribeType
5229
- * failure the caller ({@link getTopLevelCreateOnlyProperties}) catches,
5230
- * warns, and declines to cache so the lookup can be retried later.
5239
+ * Decide whether a change to top-level property `topLevelKey` requires
5240
+ * replacement per the schema's createOnly paths.
5241
+ *
5242
+ * - A length-1 path (`['Name']`) marks the whole property createOnly — any
5243
+ * change replaces (the pre-#960 behavior).
5244
+ * - A nested path (`['SourceParameters', ..., 'StartingPosition']`) replaces
5245
+ * ONLY when the value AT that nested path differs between old and new —
5246
+ * sibling sub-properties stay in-place-updatable, matching CloudFormation's
5247
+ * per-path "Update requires: Replacement" annotations.
5248
+ * - A path that cannot be resolved against the values (an array or scalar
5249
+ * where an object was expected, or a `*` wildcard segment) is treated
5250
+ * conservatively as changed — replacement — since we cannot prove the
5251
+ * immutable part stayed equal.
5252
+ *
5253
+ * Pure and synchronous so it is unit-testable without the DescribeType
5254
+ * plumbing; `valuesEqual` is injected by the diff calculator so nested
5255
+ * comparisons use the same equality as the top-level diff.
5256
+ */
5257
+ function createOnlyChangeRequiresReplacement(createOnlyPaths, topLevelKey, oldValue, newValue, valuesEqual) {
5258
+ for (const path of createOnlyPaths) {
5259
+ if (path[0] !== topLevelKey) continue;
5260
+ if (path.length === 1) return true;
5261
+ const oldSub = valueAtPath(oldValue, path.slice(1));
5262
+ const newSub = valueAtPath(newValue, path.slice(1));
5263
+ if (!oldSub.resolved || !newSub.resolved) return true;
5264
+ if (!valuesEqual(oldSub.value, newSub.value)) return true;
5265
+ }
5266
+ return false;
5267
+ }
5268
+ /**
5269
+ * Walk `value` along `segments` of plain-object keys.
5270
+ *
5271
+ * An absent container (`undefined` / `null`) RESOLVES to `undefined` — that
5272
+ * is the load-bearing case: an SQS pipe has no `DynamoDBStreamParameters`
5273
+ * subtree on either side, so its stream-source createOnly paths compare
5274
+ * `undefined === undefined` and do not force a replacement. Only shapes we
5275
+ * cannot meaningfully traverse (arrays / scalars where an object is
5276
+ * expected, `*` wildcard segments) report unresolved, which the caller
5277
+ * treats conservatively.
5278
+ */
5279
+ function valueAtPath(value, segments) {
5280
+ let current = value;
5281
+ for (const segment of segments) {
5282
+ if (segment === "*") return { resolved: false };
5283
+ if (current === void 0 || current === null) return {
5284
+ resolved: true,
5285
+ value: void 0
5286
+ };
5287
+ if (typeof current !== "object" || Array.isArray(current)) return { resolved: false };
5288
+ if (isIntrinsicShaped(current)) return { resolved: false };
5289
+ current = current[segment];
5290
+ }
5291
+ return {
5292
+ resolved: true,
5293
+ value: current
5294
+ };
5295
+ }
5296
+ /**
5297
+ * True for a single-key object whose key is `Ref` or `Fn::*` — the shape of
5298
+ * an unresolved CloudFormation intrinsic.
5299
+ */
5300
+ function isIntrinsicShaped(value) {
5301
+ const keys = Object.keys(value);
5302
+ return keys.length === 1 && (keys[0] === "Ref" || keys[0].startsWith("Fn::"));
5303
+ }
5304
+ /**
5305
+ * Fetch + parse the type's create-only property paths. THROWS on a
5306
+ * DescribeType failure — the caller ({@link getCreateOnlyPropertyPaths})
5307
+ * catches, warns, and declines to cache so the lookup can be retried later.
5231
5308
  */
5232
- async function fetchTopLevelCreateOnlyProperties(resourceType) {
5309
+ async function fetchCreateOnlyPropertyPaths(resourceType) {
5233
5310
  const logger = getLogger().child("CreateOnlyProperties");
5234
5311
  const response = await getAwsClients().cloudFormation.send(new DescribeTypeCommand({
5235
5312
  Type: "RESOURCE",
5236
5313
  TypeName: resourceType
5237
5314
  }));
5238
- const result = /* @__PURE__ */ new Set();
5315
+ const result = [];
5239
5316
  if (response.Schema) {
5240
5317
  const createOnly = JSON.parse(response.Schema).createOnlyProperties;
5241
5318
  if (Array.isArray(createOnly)) for (const path of createOnly) {
5242
5319
  if (typeof path !== "string") continue;
5243
- const match = /^\/properties\/([^/]+)/.exec(path);
5244
- if (match?.[1]) result.add(unescapeJsonPointerSegment$1(match[1]));
5320
+ if (!path.startsWith("/properties/")) continue;
5321
+ const segments = path.slice(12).split("/").map(unescapeJsonPointerSegment$1).filter((segment) => segment.length > 0);
5322
+ if (segments.length > 0) result.push(segments);
5245
5323
  }
5246
5324
  }
5247
- logger.debug(`Resolved ${result.size} top-level create-only properties for ${resourceType}` + (result.size > 0 ? `: ${[...result].join(", ")}` : ""));
5325
+ logger.debug(`Resolved ${result.length} create-only property paths for ${resourceType}` + (result.length > 0 ? `: ${result.map((p) => p.join(".")).join(", ")}` : ""));
5248
5326
  return result;
5249
5327
  }
5250
5328
  /**
@@ -5639,7 +5717,7 @@ var DiffCalculator = class DiffCalculator {
5639
5717
  const allKeys = new Set([...Object.keys(currentProperties), ...Object.keys(desiredProperties)]);
5640
5718
  const ignoredProperties = /* @__PURE__ */ new Set();
5641
5719
  if (resourceType === "AWS::CloudFormation::CustomResource" || resourceType.startsWith("Custom::")) ignoredProperties.add("Timestamp");
5642
- let createOnlyProps;
5720
+ let createOnlyPaths;
5643
5721
  for (const key of allKeys) {
5644
5722
  if (ignoredProperties.has(key)) continue;
5645
5723
  const oldValue = currentProperties[key];
@@ -5647,10 +5725,10 @@ var DiffCalculator = class DiffCalculator {
5647
5725
  if (!this.valuesEqual(oldValue, newValue)) {
5648
5726
  let requiresReplacement = this.replacementRules.requiresReplacement(resourceType, key, oldValue, newValue);
5649
5727
  if (!requiresReplacement && !this.replacementRules.isClassified(resourceType, key)) {
5650
- if (createOnlyProps === void 0) createOnlyProps = await getTopLevelCreateOnlyProperties(resourceType);
5651
- if (createOnlyProps.has(key)) {
5728
+ if (createOnlyPaths === void 0) createOnlyPaths = await getCreateOnlyPropertyPaths(resourceType);
5729
+ if (createOnlyChangeRequiresReplacement(createOnlyPaths, key, oldValue, newValue, (a, b) => this.valuesEqual(a, b))) {
5652
5730
  requiresReplacement = true;
5653
- this.logger.debug(`Property ${key} of ${resourceType} is createOnly per the CFn schema — requires replacement`);
5731
+ this.logger.debug(`Property ${key} of ${resourceType} changed a createOnly path per the CFn schema — requires replacement`);
5654
5732
  }
5655
5733
  }
5656
5734
  changes.push({
@@ -7729,7 +7807,6 @@ const NON_PROVISIONABLE_TYPES = new Set([
7729
7807
  "AWS::CloudFormation::WaitConditionHandle",
7730
7808
  "AWS::CloudFront::StreamingDistribution",
7731
7809
  "AWS::CloudWatch::AnomalyDetector",
7732
- "AWS::CloudWatch::InsightRule",
7733
7810
  "AWS::CodeBuild::ReportGroup",
7734
7811
  "AWS::CodeBuild::SourceCredential",
7735
7812
  "AWS::CodeCommit::Repository",
@@ -7737,7 +7814,6 @@ const NON_PROVISIONABLE_TYPES = new Set([
7737
7814
  "AWS::Config::ConfigurationRecorder",
7738
7815
  "AWS::Config::DeliveryChannel",
7739
7816
  "AWS::Config::OrganizationConfigRule",
7740
- "AWS::Config::RemediationConfiguration",
7741
7817
  "AWS::DAX::Cluster",
7742
7818
  "AWS::DAX::ParameterGroup",
7743
7819
  "AWS::DAX::SubnetGroup",
@@ -7770,7 +7846,6 @@ const NON_PROVISIONABLE_TYPES = new Set([
7770
7846
  "AWS::FSx::Volume",
7771
7847
  "AWS::Glue::Classifier",
7772
7848
  "AWS::Glue::CustomEntityType",
7773
- "AWS::Glue::DataCatalogEncryptionSettings",
7774
7849
  "AWS::Glue::DataQualityRuleset",
7775
7850
  "AWS::Glue::DevEndpoint",
7776
7851
  "AWS::Glue::MLTransform",
@@ -7792,7 +7867,6 @@ const NON_PROVISIONABLE_TYPES = new Set([
7792
7867
  "AWS::Greengrass::ResourceDefinitionVersion",
7793
7868
  "AWS::Greengrass::SubscriptionDefinition",
7794
7869
  "AWS::Greengrass::SubscriptionDefinitionVersion",
7795
- "AWS::GuardDuty::ThreatEntitySet",
7796
7870
  "AWS::IAM::AccessKey",
7797
7871
  "AWS::IoT::PolicyPrincipalAttachment",
7798
7872
  "AWS::IoT::ThingPrincipalAttachment",
@@ -7852,6 +7926,7 @@ const NON_PROVISIONABLE_TYPES = new Set([
7852
7926
  "AWS::Route53::RecordSetGroup",
7853
7927
  "AWS::SageMaker::CodeRepository",
7854
7928
  "AWS::SageMaker::EndpointConfig",
7929
+ "AWS::SageMaker::ModelCardExportJob",
7855
7930
  "AWS::SageMaker::NotebookInstance",
7856
7931
  "AWS::SageMaker::NotebookInstanceLifecycleConfig",
7857
7932
  "AWS::SageMaker::Workteam",
@@ -10997,6 +11072,22 @@ const PROPERTY_COVERAGE_BY_TYPE = new Map([
10997
11072
  ]),
10998
11073
  silentDrop: /* @__PURE__ */ new Map()
10999
11074
  }],
11075
+ ["AWS::Scheduler::Schedule", {
11076
+ handled: new Set([
11077
+ "Description",
11078
+ "EndDate",
11079
+ "FlexibleTimeWindow",
11080
+ "GroupName",
11081
+ "KmsKeyArn",
11082
+ "Name",
11083
+ "ScheduleExpression",
11084
+ "ScheduleExpressionTimezone",
11085
+ "StartDate",
11086
+ "State",
11087
+ "Target"
11088
+ ]),
11089
+ silentDrop: /* @__PURE__ */ new Map()
11090
+ }],
11000
11091
  ["AWS::SecretsManager::Secret", {
11001
11092
  handled: new Set([
11002
11093
  "Description",
@@ -11250,6 +11341,28 @@ function findActionableSilentDrops(resourceType, templateProperties, allowedKeys
11250
11341
  * Tier 1 types whose SDK Provider declares `handledProperties` and where
11251
11342
  * Cloud Control is guaranteed to be a viable alternative.
11252
11343
  */
11344
+ /**
11345
+ * Types exempt from the sticky `provisionedBy: 'cc-api'` routing rule.
11346
+ *
11347
+ * The sticky rule exists to avoid physical-ID churn when an SDK provider is
11348
+ * backfilled for a type Cloud Control was already managing fine. These types
11349
+ * are different: their CLOUD CONTROL ROUTING IS BROKEN, so keeping existing
11350
+ * state pinned to cc-api would keep the bug alive for every pre-existing
11351
+ * resource. Only add a type here when BOTH hold:
11352
+ *
11353
+ * 1. the CC handler cannot correctly manage the resource (not a perf choice),
11354
+ * 2. the SDK provider uses the SAME physicalId the CC path stored, so the
11355
+ * re-route is churn-free and the record flips to `provisionedBy: 'sdk'`
11356
+ * transparently on its next state write.
11357
+ *
11358
+ * - AWS::Scheduler::Schedule (issue #961): a schedule in a custom
11359
+ * ScheduleGroup is unaddressable via CC (the handlers resolve the bare-Name
11360
+ * identifier against the DEFAULT group) — CC UPDATE fails NotFound and CC
11361
+ * DELETE silently no-ops, orphaning a live schedule. Both paths stored the
11362
+ * bare schedule name as physicalId, and the state properties carry
11363
+ * GroupName, so the SDK provider addresses existing records correctly.
11364
+ */
11365
+ const STICKY_CC_MIGRATION_EXEMPT = new Set(["AWS::Scheduler::Schedule"]);
11253
11366
  var ProviderRegistry = class {
11254
11367
  logger = getLogger().child("ProviderRegistry");
11255
11368
  providers = /* @__PURE__ */ new Map();
@@ -11344,7 +11457,7 @@ var ProviderRegistry = class {
11344
11457
  provisionedBy: "sdk"
11345
11458
  };
11346
11459
  }
11347
- if (provisionedBy === "cc-api") {
11460
+ if (provisionedBy === "cc-api" && !STICKY_CC_MIGRATION_EXEMPT.has(resourceType)) {
11348
11461
  this.logger.debug(`Routing ${resourceType} via Cloud Control (state-recorded provisionedBy=cc-api)`);
11349
11462
  return {
11350
11463
  provider: this.cloudControlProvider,
@@ -14287,4 +14400,4 @@ var DeployEngine = class {
14287
14400
 
14288
14401
  //#endregion
14289
14402
  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 };
14290
- //# sourceMappingURL=deploy-engine-DhL8rX8u.js.map
14403
+ //# sourceMappingURL=deploy-engine-ByCHAN3p.js.map