@go-to-k/cdkd 0.161.3 → 0.162.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.
@@ -12215,32 +12215,51 @@ var DeployEngine = class {
12215
12215
  if (counts) counts.skipped++;
12216
12216
  break;
12217
12217
  }
12218
- const needsReplacement = change.propertyChanges?.some((pc) => pc.requiresReplacement);
12218
+ const propertyDrivenReplacement = change.propertyChanges?.some((pc) => pc.requiresReplacement);
12219
+ const recreateViaCcApi = this.options.recreateViaCcApiTargets?.has(logicalId) ?? false;
12220
+ const needsReplacement = propertyDrivenReplacement || recreateViaCcApi;
12219
12221
  const dependencies = this.extractAllDependencies(template, logicalId);
12220
12222
  if (needsReplacement) {
12221
- const replacedProps = change.propertyChanges?.filter((pc) => pc.requiresReplacement).map((pc) => pc.path).join(", ");
12222
- this.logger.info(`Replacing ${logicalId} (${resourceType}) - immutable properties changed: ${replacedProps}`);
12223
+ const replacementReason = recreateViaCcApi ? "--recreate-via-cc-api flag (mid-life SDK→CC migration)" : `immutable properties changed: ${change.propertyChanges?.filter((pc) => pc.requiresReplacement).map((pc) => pc.path).join(", ")}`;
12224
+ this.logger.info(`Replacing ${logicalId} (${resourceType}) - ${replacementReason}`);
12223
12225
  const replaceDecision = this.providerRegistry.getProviderFor({
12224
12226
  resourceType,
12225
- properties: resolvedProps
12227
+ properties: resolvedProps,
12228
+ ...recreateViaCcApi && { provisionedBy: "cc-api" }
12226
12229
  });
12227
12230
  const replaceProvider = replaceDecision.provider;
12228
12231
  const replaceProps = replaceDecision.provisionedBy === "cc-api" ? this.preparePropertiesForCcApi(resourceType, resolvedProps, logicalId) : resolvedProps;
12229
- this.logger.info(` Creating new ${logicalId}...`);
12230
- const createResult = await this.withRetry(() => replaceProvider.create(logicalId, resourceType, replaceProps), logicalId, void 0, void 0, replaceProvider);
12231
12232
  const updateReplacePolicy = template?.Resources?.[logicalId]?.UpdateReplacePolicy;
12232
12233
  const oldDeleteProvider = this.providerRegistry.getProviderFor({
12233
12234
  resourceType,
12234
12235
  provisionedBy: currentResource.provisionedBy
12235
12236
  }).provider;
12236
- if (updateReplacePolicy === "Retain") this.logger.info(` Retaining old ${logicalId} (${currentResource.physicalId}) - UpdateReplacePolicy: Retain`);
12237
- else {
12238
- this.logger.info(` Deleting old ${logicalId} (${currentResource.physicalId})...`);
12239
- try {
12240
- await oldDeleteProvider.delete(logicalId, currentResource.physicalId, resourceType, currentResource.properties, { expectedRegion: this.stackRegion });
12241
- this.logger.info(` ${green("✓")} Old resource deleted`);
12242
- } catch (deleteError) {
12243
- this.logger.warn(` ⚠ Failed to delete old resource ${logicalId} (${currentResource.physicalId}): ${deleteError instanceof Error ? deleteError.message : String(deleteError)}`);
12237
+ let createResult;
12238
+ if (recreateViaCcApi) {
12239
+ if (updateReplacePolicy === "Retain") this.logger.warn(` ${logicalId} has UpdateReplacePolicy: Retain — recreate-via-cc-api will leak the old physical resource (${currentResource.physicalId}). The new CC-managed resource shares the same name where applicable; if the type has user-supplied names (e.g. functionName, bucketName), the create will deterministically collide with the retained orphan.`);
12240
+ else {
12241
+ this.logger.info(` Destroying old ${logicalId} (${currentResource.physicalId}) before recreate...`);
12242
+ try {
12243
+ await oldDeleteProvider.delete(logicalId, currentResource.physicalId, resourceType, currentResource.properties, { expectedRegion: this.stackRegion });
12244
+ this.logger.info(` ${green("✓")} Old resource deleted`);
12245
+ } catch (deleteError) {
12246
+ throw new Error(`Failed to destroy old resource ${logicalId} (${currentResource.physicalId}) during --recreate-via-cc-api: ${deleteError instanceof Error ? deleteError.message : String(deleteError)}`);
12247
+ }
12248
+ }
12249
+ this.logger.info(` Creating new ${logicalId}...`);
12250
+ createResult = await this.withRetry(() => replaceProvider.create(logicalId, resourceType, replaceProps), logicalId, void 0, void 0, replaceProvider);
12251
+ } else {
12252
+ this.logger.info(` Creating new ${logicalId}...`);
12253
+ createResult = await this.withRetry(() => replaceProvider.create(logicalId, resourceType, replaceProps), logicalId, void 0, void 0, replaceProvider);
12254
+ if (updateReplacePolicy === "Retain") this.logger.info(` Retaining old ${logicalId} (${currentResource.physicalId}) - UpdateReplacePolicy: Retain`);
12255
+ else {
12256
+ this.logger.info(` Deleting old ${logicalId} (${currentResource.physicalId})...`);
12257
+ try {
12258
+ await oldDeleteProvider.delete(logicalId, currentResource.physicalId, resourceType, currentResource.properties, { expectedRegion: this.stackRegion });
12259
+ this.logger.info(` ${green("✓")} Old resource deleted`);
12260
+ } catch (deleteError) {
12261
+ this.logger.warn(` ⚠ Failed to delete old resource ${logicalId} (${currentResource.physicalId}): ${deleteError instanceof Error ? deleteError.message : String(deleteError)}`);
12262
+ }
12244
12263
  }
12245
12264
  }
12246
12265
  stateResources[logicalId] = {
@@ -12537,4 +12556,4 @@ var DeployEngine = class {
12537
12556
 
12538
12557
  //#endregion
12539
12558
  export { AssetError as $, S3StateBackend as A, resolveCaptureObservedState as B, assertRegionMatch as C, DagBuilder as D, DiffCalculator as E, buildDockerImage 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, AssetPublisher as M, stringifyValue as N, TemplateParser as O, WorkGraph as P, resolveBucketRegion as Q, getLegacyStateBucketName as R, CloudControlProvider as S, applyRoleArnIfSet as T, resolveStateBucketWithDefaultAndSource as U, resolveSkipPrefix as V, warnDeprecatedNoPrefixCliFlag as W, AssemblyReader as X, uploadCfnTemplate as Y, clearBucketRegionCache as Z, matchesCdkPath as _, SynthesisError as _t, withRetry as a, LocalStartServiceError as at, ProviderRegistry as b, normalizeAwsError as bt, bold as c, NestedStackChildDirectDestroyError as ct, green as d, ResourceTimeoutError as dt, CdkdError as et, red as f, ResourceUpdateNotSupportedError as ft, CDK_PATH_TAG as g, StateError as gt, collectInlinePolicyNamesManagedBySiblings as h, StackTerminationProtectionError as ht, withResourceDeadline as i, LocalMigrateError as it, shouldRetainResource as j, LockManager as k, cyan as l, PartialFailureError as lt, IAMRoleProvider as m, StackHasActiveImportsError as mt, DEFAULT_RESOURCE_WARN_AFTER_MS as n, DependencyError as nt, IMPLICIT_DELETE_DEPENDENCIES as o, LockError as ot, yellow as p, RouteDiscoveryError as pt, MIGRATE_TMP_PREFIX as q, DeployEngine as r, LocalInvokeBuildError as rt, formatResourceLine as s, MissingCdkCliError as st, DEFAULT_RESOURCE_TIMEOUT_MS as t, ConfigError as tt, gray as u, ProvisioningError as ut, normalizeAwsTagsToCfn as v, formatError as vt, IntrinsicFunctionResolver as w, findActionableSilentDrops as x, withErrorHandling as xt, resolveExplicitPhysicalId as y, isCdkdError as yt, resolveApp as z };
12540
- //# sourceMappingURL=deploy-engine-D4iGkZAC.js.map
12559
+ //# sourceMappingURL=deploy-engine-DEbogepd.js.map