@go-to-k/cdkd 0.252.2 → 0.253.0

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.
@@ -10766,7 +10766,8 @@ var CloudControlProvider = class {
10766
10766
  this.logger.debug(`Created resource ${logicalId}, physical ID: ${progressEvent.Identifier}`);
10767
10767
  const result = { physicalId: progressEvent.Identifier };
10768
10768
  if (progressEvent.ResourceModel) result.attributes = this.parseResourceModel(progressEvent.ResourceModel);
10769
- result.attributes = await this.enrichResourceAttributes(resourceType, progressEvent.Identifier, result.attributes || {});
10769
+ result.attributes = await this.mergeSparseModelReadback(resourceType, progressEvent.Identifier, result.attributes || {});
10770
+ result.attributes = await this.enrichResourceAttributes(resourceType, progressEvent.Identifier, result.attributes);
10770
10771
  return result;
10771
10772
  } catch (error) {
10772
10773
  await this.cleanupFailedCreateRemnant(error, resourceType, logicalId);
@@ -10860,7 +10861,8 @@ var CloudControlProvider = class {
10860
10861
  wasReplaced: false
10861
10862
  };
10862
10863
  if (progressEvent.ResourceModel) result.attributes = this.parseResourceModel(progressEvent.ResourceModel);
10863
- result.attributes = await this.enrichResourceAttributes(resourceType, physicalId, result.attributes || {});
10864
+ result.attributes = await this.mergeSparseModelReadback(resourceType, physicalId, result.attributes || {});
10865
+ result.attributes = await this.enrichResourceAttributes(resourceType, physicalId, result.attributes);
10864
10866
  return result;
10865
10867
  } catch (error) {
10866
10868
  this.handleError(error, "UPDATE", resourceType, logicalId, physicalId);
@@ -10873,7 +10875,7 @@ var CloudControlProvider = class {
10873
10875
  this.logger.debug(`Deleting resource ${logicalId} (${resourceType}), physical ID: ${physicalId}`);
10874
10876
  if (context?.removeProtection === true && resourceType === "AWS::AutoScaling::AutoScalingGroup") {
10875
10877
  this.logger.debug(`Delegating protected AutoScalingGroup ${logicalId} delete to the SDK ASGProvider (Cloud Control cannot force-delete a protected ASG)`);
10876
- const { ASGProvider } = await import("./asg-provider-BzBdoSYp.js").then((n) => n.n);
10878
+ const { ASGProvider } = await import("./asg-provider-75LZGhBd.js").then((n) => n.n);
10877
10879
  await new ASGProvider().delete(logicalId, physicalId, resourceType, _properties, context);
10878
10880
  return;
10879
10881
  }
@@ -11190,7 +11192,7 @@ var CloudControlProvider = class {
11190
11192
  break;
11191
11193
  case "AWS::Backup::BackupVault":
11192
11194
  if (!enriched["BackupVaultArn"]) {
11193
- const model = await this.readBackupResourceModel(resourceType, physicalId);
11195
+ const model = await this.readCcResourceModel(resourceType, physicalId);
11194
11196
  if (model) {
11195
11197
  if (typeof model["BackupVaultArn"] === "string") enriched["BackupVaultArn"] = model["BackupVaultArn"];
11196
11198
  if (!enriched["BackupVaultName"] && typeof model["BackupVaultName"] === "string") enriched["BackupVaultName"] = model["BackupVaultName"];
@@ -11201,7 +11203,7 @@ var CloudControlProvider = class {
11201
11203
  break;
11202
11204
  case "AWS::Backup::BackupPlan":
11203
11205
  if (!enriched["BackupPlanArn"] || !enriched["VersionId"]) {
11204
- const model = await this.readBackupResourceModel(resourceType, physicalId);
11206
+ const model = await this.readCcResourceModel(resourceType, physicalId);
11205
11207
  if (model) {
11206
11208
  if (!enriched["BackupPlanArn"] && typeof model["BackupPlanArn"] === "string") enriched["BackupPlanArn"] = model["BackupPlanArn"];
11207
11209
  if (!enriched["VersionId"] && typeof model["VersionId"] === "string") enriched["VersionId"] = model["VersionId"];
@@ -11218,7 +11220,7 @@ var CloudControlProvider = class {
11218
11220
  if (!enriched["SelectionId"]) enriched["SelectionId"] = physicalId.substring(0, firstUnderscore);
11219
11221
  if (!enriched["BackupPlanId"]) enriched["BackupPlanId"] = physicalId.substring(firstUnderscore + 1);
11220
11222
  }
11221
- const model = await this.readBackupResourceModel(resourceType, physicalId);
11223
+ const model = await this.readCcResourceModel(resourceType, physicalId);
11222
11224
  if (model) {
11223
11225
  if (typeof model["SelectionId"] === "string") enriched["SelectionId"] = model["SelectionId"];
11224
11226
  if (typeof model["BackupPlanId"] === "string") enriched["BackupPlanId"] = model["BackupPlanId"];
@@ -11226,18 +11228,98 @@ var CloudControlProvider = class {
11226
11228
  }
11227
11229
  }
11228
11230
  break;
11231
+ case "AWS::Pipes::Pipe":
11232
+ if (!enriched["Arn"]) {
11233
+ const model = await this.readCcResourceModel(resourceType, physicalId);
11234
+ if (model) {
11235
+ if (typeof model["Arn"] === "string") enriched["Arn"] = model["Arn"];
11236
+ if (!enriched["CurrentState"] && typeof model["CurrentState"] === "string") enriched["CurrentState"] = model["CurrentState"];
11237
+ if (!enriched["StateReason"] && typeof model["StateReason"] === "string") enriched["StateReason"] = model["StateReason"];
11238
+ if (!enriched["CreationTime"] && typeof model["CreationTime"] === "string") enriched["CreationTime"] = model["CreationTime"];
11239
+ if (!enriched["LastModifiedTime"] && typeof model["LastModifiedTime"] === "string") enriched["LastModifiedTime"] = model["LastModifiedTime"];
11240
+ this.logger.debug(`Enriched Pipes Pipe ${physicalId} with Arn from CC GetResource`);
11241
+ }
11242
+ }
11243
+ break;
11244
+ case "AWS::S3::AccessPoint":
11245
+ if (!enriched["Arn"] || !enriched["Alias"]) {
11246
+ const model = await this.readCcResourceModel(resourceType, physicalId);
11247
+ if (model) {
11248
+ if (!enriched["Arn"] && typeof model["Arn"] === "string") enriched["Arn"] = model["Arn"];
11249
+ if (!enriched["Alias"] && typeof model["Alias"] === "string") enriched["Alias"] = model["Alias"];
11250
+ if (!enriched["NetworkOrigin"] && typeof model["NetworkOrigin"] === "string") enriched["NetworkOrigin"] = model["NetworkOrigin"];
11251
+ this.logger.debug(`Enriched S3 AccessPoint ${physicalId} with Arn/Alias from CC GetResource`);
11252
+ }
11253
+ }
11254
+ break;
11255
+ case "AWS::ResourceGroups::Group":
11256
+ if (!enriched["Arn"]) {
11257
+ const model = await this.readCcResourceModel(resourceType, physicalId);
11258
+ if (model) {
11259
+ if (typeof model["Arn"] === "string") enriched["Arn"] = model["Arn"];
11260
+ this.logger.debug(`Enriched ResourceGroups Group ${physicalId} with Arn from CC GetResource`);
11261
+ }
11262
+ }
11263
+ break;
11229
11264
  default: break;
11230
11265
  }
11231
11266
  return enriched;
11232
11267
  }
11233
11268
  /**
11234
- * Read the Cloud Control GetResource model for a pure-CC Backup resource and
11235
- * return its parsed property map, or `undefined` on any failure. Backup types
11236
- * have no SDK provider, so this generic CC read-back is the cleanest source
11237
- * of their readOnly attributes (ARNs, VersionId, SelectionId) that the sparse
11238
- * CREATE ResourceModel does not reliably surface. Best-effort: never throws.
11239
- */
11240
- async readBackupResourceModel(resourceType, physicalId) {
11269
+ * Generic sparse-model read-back (issue #1105). When the CREATE / UPDATE
11270
+ * `ProgressEvent.ResourceModel` yielded a sparse attribute map, issue ONE
11271
+ * best-effort `GetResource` read-back and merge the returned model over the
11272
+ * parsed attributes. Closes the "pure-CC type with a sparse CREATE model →
11273
+ * empty state attributes `Fn::GetAtt` silently resolves to the bare
11274
+ * physicalId" class generically instead of per-type (previously fixed
11275
+ * type-by-type in #984 / #1103). Runs BEFORE `enrichResourceAttributes` so
11276
+ * the per-type overlays' `if (!enriched['X'])` gating composes naturally
11277
+ * (no second GetResource for a type the read-back already filled).
11278
+ * Best-effort: a failed read-back leaves the attributes as-is and never
11279
+ * fails the deploy (same never-throw contract as `readCcResourceModel`).
11280
+ */
11281
+ async mergeSparseModelReadback(resourceType, physicalId, attributes) {
11282
+ if (!this.isSparseAttributeMap(attributes, physicalId)) return attributes;
11283
+ const model = await this.readCcResourceModel(resourceType, physicalId);
11284
+ if (!model) return attributes;
11285
+ this.logger.debug(`Merged CC GetResource read-back over sparse ${resourceType} attributes for ${physicalId}`);
11286
+ return {
11287
+ ...attributes,
11288
+ ...model
11289
+ };
11290
+ }
11291
+ /**
11292
+ * Conservative sparseness predicate for `mergeSparseModelReadback`. A map
11293
+ * is sparse when it is empty or carries nothing beyond an echo of the
11294
+ * identifier — every value is a string equal to the physicalId or to one
11295
+ * segment of a compound `|`-joined CC primaryIdentifier. Sparseness is
11296
+ * empirically per-type: `AWS::ApiGatewayV2::Api` returns `ApiEndpoint` in
11297
+ * its CREATE model (NOT sparse — no extra GetResource), while Pipes /
11298
+ * S3 AccessPoint / ResourceGroups / Backup return nothing usable (sparse —
11299
+ * read-back fires). Any non-identifier value (a URL, an ARN, an echoed
11300
+ * input property, a nested object) means the model carried real
11301
+ * information, so we skip the extra API call.
11302
+ */
11303
+ isSparseAttributeMap(attributes, physicalId) {
11304
+ const values = Object.values(attributes);
11305
+ if (values.length === 0) return true;
11306
+ const identifierEchoes = new Set(physicalId.split("|"));
11307
+ identifierEchoes.add(physicalId);
11308
+ return values.every((value) => typeof value === "string" && identifierEchoes.has(value));
11309
+ }
11310
+ /**
11311
+ * Read the Cloud Control GetResource model for a pure-CC resource and
11312
+ * return its parsed property map, or `undefined` on any failure. Types with
11313
+ * no SDK provider always route through Cloud Control, whose async CREATE
11314
+ * ResourceModel is sparse for several types, so this generic CC read-back is
11315
+ * the cleanest source of their readOnly attributes (ARNs, aliases,
11316
+ * VersionId, SelectionId) — the type's registry schema lists them under
11317
+ * readOnlyProperties, which the CC read handler does return. Originally
11318
+ * Backup-scoped (issue #984); generalized for Pipes / S3 AccessPoint /
11319
+ * ResourceGroups in issue #1103, and reused by the generic sparse-model
11320
+ * read-back (issue #1105). Best-effort: never throws.
11321
+ */
11322
+ async readCcResourceModel(resourceType, physicalId) {
11241
11323
  try {
11242
11324
  const raw = (await this.cloudControlClient.send(new GetResourceCommand({
11243
11325
  TypeName: resourceType,
@@ -17402,4 +17484,4 @@ var DeployEngine = class {
17402
17484
 
17403
17485
  //#endregion
17404
17486
  export { BOOTSTRAP_MARKER_PREFIX as $, StateError as $t, refStateLookupFromResource as A, AssemblyReader as At, TemplateParser as B, DependencyError as Bt, ProviderRegistry as C, warnDeprecatedNoPrefixCliFlag as Ct, isTerminationProtectionPropagationError as D, findLargeInlineResources as Dt, disableInstanceApiTermination as E, MIGRATE_TMP_PREFIX as Et, resolveExplicitPhysicalId as F, resetAwsClients as Ft, AssetPublisher as G, MissingCdkCliError as Gt, S3StateBackend as H, LocalMigrateError as Ht, assertRegionMatch as I, setAwsClients as It, buildAssetRedirectMap as J, ProvisioningError as Jt, stringifyValue as K, NestedStackChildDirectDestroyError as Kt, applyRoleArnIfSet as L, AssetError as Lt, CDK_PATH_TAG as M, resolveBucketRegion as Mt, matchesCdkPath as N, AwsClients as Nt, IntrinsicFunctionResolver as O, uploadCfnTemplate as Ot, normalizeAwsTagsToCfn as P, getAwsClients as Pt, AssetModeResolver as Q, StackTerminationProtectionError as Qt, DiffCalculator as R, CdkdError as Rt, collectInlinePolicyNamesManagedBySiblings as S, resolveUseCdkBootstrapAssets as St, CloudControlProvider as T, CFN_TEMPLATE_URL_LIMIT as Tt, rebuildClientForBucketRegion as U, LocalStartServiceError as Ut, LockManager as V, LocalInvokeBuildError as Vt, shouldRetainResource as W, LockError as Wt, loadPublishableAssetManifest as X, ResourceUpdateNotSupportedError as Xt, createAssetRedirectResolver as Y, ResourceTimeoutError as Yt, rewriteTemplateAssetReferences as Z, StackHasActiveImportsError as Zt, gray as _, resolveAutoAssetStorage as _t, withRetry as a, __exportAll as an, buildDockerImage as at, yellow as b, resolveStateBucketWithDefault as bt, IMPLICIT_DELETE_DEPENDENCIES as c, runDockerForeground as ct, MULTI_REGION_RECREATE_BLOCKED_TYPES as d, getDockerImageBySourceHash as dt, SynthesisError as en, ensureAssetStorage as et, isStatefulRecreateTargetSync as f, Synthesizer as ft, cyan as g, resolveApp as gt, bold as h, getLegacyStateBucketName as ht, withResourceDeadline as i, withErrorHandling as in, validateContainerRepoName as it, WAFv2WebACLProvider as j, clearBucketRegionCache as jt, cfnRefValueFromPhysicalId as k, expectedOwnerParam as kt, computeImplicitDeleteEdges as l, runDockerStreaming as lt, formatResourceLine as m, getDefaultStateBucketName as mt, DEFAULT_RESOURCE_WARN_AFTER_MS as n, isCdkdError as nn, parseBootstrapMarker as nt, isRetryableTransientError as o, formatDockerLoginError as ot, renderStatefulReason as p, synthesisStatusMessage as pt, WorkGraph as q, PartialFailureError as qt, DeployEngine as r, normalizeAwsError as rn, validateAssetBucketName as rt, isThrottlingError as s, getDockerCmd as st, DEFAULT_RESOURCE_TIMEOUT_MS as t, formatError as tn, getBootstrapMarkerKey as tt, extractDeploymentEventError as u, AssetManifestLoader as ut, green as v, resolveCaptureObservedState as vt, findActionableSilentDrops as w, CFN_TEMPLATE_BODY_LIMIT as wt, IAMRoleProvider as x, resolveStateBucketWithDefaultAndSource as xt, red as y, resolveSkipPrefix as yt, DagBuilder as z, ConfigError as zt };
17405
- //# sourceMappingURL=deploy-engine-IkhnJXWR.js.map
17487
+ //# sourceMappingURL=deploy-engine-CMSknHV7.js.map