@go-to-k/cdkd 0.278.6 → 0.278.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.
@@ -9222,6 +9222,182 @@ function sanitizeDescription(value) {
9222
9222
  if (typeof value === "string" && value.length === 0) return void 0;
9223
9223
  return value;
9224
9224
  }
9225
+ function isPlainObject(value) {
9226
+ return typeof value === "object" && value !== null && !Array.isArray(value);
9227
+ }
9228
+ /**
9229
+ * CFn `Rules` members that have NO counterpart in the installed
9230
+ * `@aws-sdk/client-wafv2` model (verified: zero hits in
9231
+ * `dist-types/models/models_0.d.ts`).
9232
+ *
9233
+ * The AWS SDK v3 serializer drops unknown members, so these silently do
9234
+ * not reach AWS no matter what cdkd forwards. There is no mapping cdkd
9235
+ * can invent — the fix is an SDK bump, after which the spellings already
9236
+ * match and no code here has to change. Until then the drop is made LOUD
9237
+ * (`warnOnSdkUnsupportedRuleKeys`) instead of silent.
9238
+ *
9239
+ * They cannot be declared in `unhandledByDesign` either: that map is
9240
+ * TOP-LEVEL CFn property granularity, and all three are nested inside
9241
+ * `Rules`, which the provider genuinely handles.
9242
+ */
9243
+ const SDK_UNSUPPORTED_RULE_KEYS = [
9244
+ "PreParseTextTransformations",
9245
+ "Monetize",
9246
+ "PriceMultiplier"
9247
+ ];
9248
+ /**
9249
+ * Convert a CFn `ByteMatchStatement` into the SDK shape.
9250
+ *
9251
+ * `SearchStringBase64` exists ONLY in CloudFormation — the SDK models
9252
+ * carry a single `SearchString: Uint8Array | undefined` blob member
9253
+ * (`@aws-sdk/client-wafv2/dist-types/models/models_0.d.ts:1034`).
9254
+ * Forwarding the CFn blob raw made the serializer drop the unknown key
9255
+ * and `CreateWebACL` then failed validation on the missing required
9256
+ * `SearchString` (issue #1389).
9257
+ *
9258
+ * The decoded bytes are passed as a `Uint8Array`, matching the declared
9259
+ * member type: the JSON serializer base64-encodes a blob member on the
9260
+ * wire, so decoding here reproduces byte-for-byte what CloudFormation
9261
+ * sends. Plain `SearchString` values are deliberately left untouched —
9262
+ * the same serializer accepts a string at a blob member and UTF-8 +
9263
+ * base64 encodes it, which is exactly the existing (working) behavior.
9264
+ *
9265
+ * Precedence when a template carries BOTH keys: `SearchStringBase64`
9266
+ * wins. CloudFormation treats them as mutually exclusive and rejects
9267
+ * such a template, so any choice is arbitrary; the explicit-encoding
9268
+ * form is preferred because it is the only one that can express
9269
+ * non-UTF-8 bytes, so honoring it never loses information.
9270
+ */
9271
+ function toSdkByteMatchStatement(byteMatchStatement) {
9272
+ const encoded = byteMatchStatement["SearchStringBase64"];
9273
+ if (typeof encoded !== "string") return byteMatchStatement;
9274
+ const converted = { ...byteMatchStatement };
9275
+ delete converted["SearchStringBase64"];
9276
+ converted["SearchString"] = Uint8Array.from(Buffer.from(encoded, "base64"));
9277
+ return converted;
9278
+ }
9279
+ /**
9280
+ * CFn `Statement` members that carry a reference ARN.
9281
+ *
9282
+ * CloudFormation spells the member `Arn`; every one of these SDK types
9283
+ * declares it `ARN` (and marks it REQUIRED) — verified against
9284
+ * `@aws-sdk/client-wafv2` `models_0.d.ts` (`IPSetReferenceStatement` /
9285
+ * `RegexPatternSetReferenceStatement` / `RuleGroupReferenceStatement`),
9286
+ * whose schema serde carries a single `_ARN = "ARN"` alias and no `Arn`.
9287
+ * The serializer drops the CFn spelling, so `CreateWebACL` fails
9288
+ * validation on the missing required `ARN` — the same silent-drop class
9289
+ * as `SearchStringBase64`, and the only other one in the whole `Rules`
9290
+ * tree (all 154 CFn keys were diffed against the SDK member set).
9291
+ */
9292
+ const ARN_REFERENCE_STATEMENT_KEYS = [
9293
+ "IPSetReferenceStatement",
9294
+ "RegexPatternSetReferenceStatement",
9295
+ "RuleGroupReferenceStatement"
9296
+ ];
9297
+ /**
9298
+ * Recursively convert a CFn `Statement` tree into the SDK shape.
9299
+ *
9300
+ * Two conversions ride this walk: the `ByteMatchStatement`
9301
+ * `SearchStringBase64` decode and the reference-statement `Arn` -> `ARN`
9302
+ * rename (see {@link ARN_REFERENCE_STATEMENT_KEYS}). Both leaves are
9303
+ * nestable, so the walk has to cover every recursion point the SDK
9304
+ * `Statement` union declares:
9305
+ * - `NotStatement.Statement` (single nested Statement)
9306
+ * - `AndStatement.Statements[]` (Statement array)
9307
+ * - `OrStatement.Statements[]` (Statement array)
9308
+ * - `RateBasedStatement.ScopeDownStatement`
9309
+ * - `ManagedRuleGroupStatement.ScopeDownStatement`
9310
+ *
9311
+ * That list mirrors the SDK model exactly — those are the only members
9312
+ * typed `Statement` / `Statement[]`. `RuleGroupReferenceStatement` is
9313
+ * NOT a recursion point (it declares no nested statement member, only
9314
+ * `ARN` / `ExcludedRules` / `RuleActionOverrides`); it appears in the
9315
+ * ARN list above for the rename alone. Extend either list if AWS adds a
9316
+ * member.
9317
+ *
9318
+ * The caller's object is never mutated — every level is rebuilt.
9319
+ */
9320
+ function toSdkStatement(statement) {
9321
+ const converted = { ...statement };
9322
+ const byteMatchStatement = converted["ByteMatchStatement"];
9323
+ if (isPlainObject(byteMatchStatement)) converted["ByteMatchStatement"] = toSdkByteMatchStatement(byteMatchStatement);
9324
+ for (const key of ARN_REFERENCE_STATEMENT_KEYS) {
9325
+ const reference = converted[key];
9326
+ if (!isPlainObject(reference) || !("Arn" in reference)) continue;
9327
+ const { Arn: arn, ...rest } = reference;
9328
+ converted[key] = {
9329
+ ...rest,
9330
+ ARN: arn
9331
+ };
9332
+ }
9333
+ const notStatement = converted["NotStatement"];
9334
+ if (isPlainObject(notStatement)) {
9335
+ const nested = notStatement["Statement"];
9336
+ if (isPlainObject(nested)) converted["NotStatement"] = {
9337
+ ...notStatement,
9338
+ Statement: toSdkStatement(nested)
9339
+ };
9340
+ }
9341
+ for (const key of ["AndStatement", "OrStatement"]) {
9342
+ const combined = converted[key];
9343
+ if (!isPlainObject(combined)) continue;
9344
+ const nested = combined["Statements"];
9345
+ if (!Array.isArray(nested)) continue;
9346
+ converted[key] = {
9347
+ ...combined,
9348
+ Statements: nested.map((item) => isPlainObject(item) ? toSdkStatement(item) : item)
9349
+ };
9350
+ }
9351
+ for (const key of ["RateBasedStatement", "ManagedRuleGroupStatement"]) {
9352
+ const scoping = converted[key];
9353
+ if (!isPlainObject(scoping)) continue;
9354
+ const nested = scoping["ScopeDownStatement"];
9355
+ if (!isPlainObject(nested)) continue;
9356
+ converted[key] = {
9357
+ ...scoping,
9358
+ ScopeDownStatement: toSdkStatement(nested)
9359
+ };
9360
+ }
9361
+ return converted;
9362
+ }
9363
+ /**
9364
+ * Convert the CFn `Rules` blob into the SDK `Rule[]` shape.
9365
+ *
9366
+ * Falsy input degrades to `[]`, matching the previous
9367
+ * `(properties['Rules'] as Rule[]) || []` behavior exactly. A truthy NON-array
9368
+ * (an unresolved intrinsic) is deliberately passed through instead:
9369
+ * defaulting it to `[]` would make `update()` a silent `UpdateWebACL`
9370
+ * that wipes every rule and still reports success, where the old code
9371
+ * handed the value to the SDK and failed loudly.
9372
+ */
9373
+ function toSdkRules(rules) {
9374
+ if (!rules) return [];
9375
+ if (!Array.isArray(rules)) return rules;
9376
+ return rules.map((rule) => {
9377
+ if (!isPlainObject(rule)) return rule;
9378
+ const statement = rule["Statement"];
9379
+ if (!isPlainObject(statement)) return rule;
9380
+ return {
9381
+ ...rule,
9382
+ Statement: toSdkStatement(statement)
9383
+ };
9384
+ });
9385
+ }
9386
+ /**
9387
+ * Collect every {@link SDK_UNSUPPORTED_RULE_KEYS} member present anywhere
9388
+ * in the CFn `Rules` blob, so the caller can report the silent drop.
9389
+ */
9390
+ function collectSdkUnsupportedRuleKeys(value, found) {
9391
+ if (Array.isArray(value)) {
9392
+ for (const item of value) collectSdkUnsupportedRuleKeys(item, found);
9393
+ return;
9394
+ }
9395
+ if (!isPlainObject(value)) return;
9396
+ for (const [key, nested] of Object.entries(value)) {
9397
+ if (SDK_UNSUPPORTED_RULE_KEYS.includes(key)) found.add(key);
9398
+ collectSdkUnsupportedRuleKeys(nested, found);
9399
+ }
9400
+ }
9225
9401
  /**
9226
9402
  * Parse WAFv2 WebACL ARN to extract Id, Name, and Scope.
9227
9403
  *
@@ -9280,6 +9456,7 @@ var WAFv2WebACLProvider = class {
9280
9456
  this.logger.debug(`Creating WAFv2 WebACL ${logicalId}`);
9281
9457
  const name = properties["Name"] || generateResourceName(logicalId, { maxLength: 128 });
9282
9458
  const scope = properties["Scope"] || "REGIONAL";
9459
+ this.warnOnSdkUnsupportedRuleKeys(logicalId, properties["Rules"]);
9283
9460
  try {
9284
9461
  const tags = [];
9285
9462
  if (properties["Tags"]) {
@@ -9294,7 +9471,7 @@ var WAFv2WebACLProvider = class {
9294
9471
  Scope: scope,
9295
9472
  DefaultAction: properties["DefaultAction"],
9296
9473
  Description: sanitizeDescription(properties["Description"]),
9297
- Rules: properties["Rules"] || [],
9474
+ Rules: toSdkRules(properties["Rules"]),
9298
9475
  VisibilityConfig: properties["VisibilityConfig"],
9299
9476
  ...tags.length > 0 && { Tags: tags },
9300
9477
  CustomResponseBodies: properties["CustomResponseBodies"],
@@ -9327,6 +9504,7 @@ var WAFv2WebACLProvider = class {
9327
9504
  */
9328
9505
  async update(logicalId, physicalId, resourceType, properties, previousProperties) {
9329
9506
  this.logger.debug(`Updating WAFv2 WebACL ${logicalId}: ${physicalId}`);
9507
+ this.warnOnSdkUnsupportedRuleKeys(logicalId, properties["Rules"]);
9330
9508
  try {
9331
9509
  const { id, name, scope } = parseWebACLArn(physicalId);
9332
9510
  const getResponse = await this.getClient().send(new GetWebACLCommand({
@@ -9343,7 +9521,7 @@ var WAFv2WebACLProvider = class {
9343
9521
  LockToken: lockToken,
9344
9522
  DefaultAction: properties["DefaultAction"],
9345
9523
  Description: sanitizeDescription(properties["Description"]),
9346
- Rules: properties["Rules"] || [],
9524
+ Rules: toSdkRules(properties["Rules"]),
9347
9525
  VisibilityConfig: properties["VisibilityConfig"],
9348
9526
  CustomResponseBodies: properties["CustomResponseBodies"],
9349
9527
  CaptchaConfig: properties["CaptchaConfig"],
@@ -9402,6 +9580,22 @@ var WAFv2WebACLProvider = class {
9402
9580
  }
9403
9581
  }
9404
9582
  /**
9583
+ * Report every CFn `Rules` member the installed `@aws-sdk/client-wafv2`
9584
+ * model has no counterpart for, so the drop is visible instead of
9585
+ * silent. See {@link SDK_UNSUPPORTED_RULE_KEYS} for why cdkd cannot map
9586
+ * them and what makes them work (an SDK bump).
9587
+ */
9588
+ warnOnSdkUnsupportedRuleKeys(logicalId, rules) {
9589
+ const found = /* @__PURE__ */ new Set();
9590
+ collectSdkUnsupportedRuleKeys(rules, found);
9591
+ if (found.size === 0) return;
9592
+ const sorted = [...found].sort();
9593
+ const names = sorted.join(", ");
9594
+ const subject = sorted.length === 1 ? "property" : "properties";
9595
+ const verb = sorted.length === 1 ? "has" : "have";
9596
+ this.logger.warn(`WAFv2 WebACL ${logicalId}: rule ${subject} ${names} ${verb} no member in the installed AWS SDK WAFv2 model and will NOT be sent to AWS. Upgrade cdkd once its @aws-sdk/client-wafv2 dependency carries the ${subject}.`);
9597
+ }
9598
+ /**
9405
9599
  * Apply a diff between old and new CFn-shape Tags arrays via WAFv2's
9406
9600
  * `TagResource` / `UntagResource` APIs (keyed by `ResourceARN`).
9407
9601
  */
@@ -12090,7 +12284,7 @@ var CloudControlProvider = class {
12090
12284
  if (context?.finalSnapshotIdentifier !== void 0) throw new ProvisioningError(`${logicalId} (${resourceType}) requires a final snapshot (DeletionPolicy: Snapshot), but the Cloud Control API delete route has no final-snapshot parameter. Re-run with --skip-final-snapshot after snapshotting manually, or retain the resource.`, resourceType, logicalId, physicalId);
12091
12285
  if (context?.removeProtection === true && resourceType === "AWS::AutoScaling::AutoScalingGroup") {
12092
12286
  this.logger.debug(`Delegating protected AutoScalingGroup ${logicalId} delete to the SDK ASGProvider (Cloud Control cannot force-delete a protected ASG)`);
12093
- const { ASGProvider } = await import("./asg-provider-CTMEDbqF.js").then((n) => n.n);
12287
+ const { ASGProvider } = await import("./asg-provider-Cqw9Gzck.js").then((n) => n.n);
12094
12288
  await new ASGProvider().delete(logicalId, physicalId, resourceType, _properties, context);
12095
12289
  return;
12096
12290
  }
@@ -18513,7 +18707,7 @@ const FLUSH_INTERVAL_MS = 2e3;
18513
18707
  const FLUSH_EVENT_THRESHOLD = 50;
18514
18708
  /** Build-time cdkd version, with a dev fallback for non-built contexts. */
18515
18709
  function getCdkdVersion() {
18516
- return "0.278.6";
18710
+ return "0.278.7";
18517
18711
  }
18518
18712
  /**
18519
18713
  * Generate a time-sortable unique run id, e.g.
@@ -20625,4 +20819,4 @@ var DeployEngine = class {
20625
20819
 
20626
20820
  //#endregion
20627
20821
  export { DagBuilder as $, AssetError as $t, red as A, resolveApp as At, isTerminationProtectionPropagationError as B, CFN_TEMPLATE_URL_LIMIT as Bt, isStatefulRecreateTargetSync as C, runDockerStreaming as Ct, cyan as D, synthesisStatusMessage as Dt, bold as E, Synthesizer as Et, ProviderRegistry as F, resolveStateBucketWithDefaultAndSource as Ft, normalizeAwsTagsToCfn as G, AssemblyReader as Gt, cfnRefValueFromPhysicalId as H, findLargeInlineResources as Ht, findActionableSilentDrops as I, resolveUseCdkBootstrapAssets as It, applyRoleArnIfSet as J, resolveBucketRegion as Jt, resolveExplicitPhysicalId as K, processStackMessages as Kt, CloudControlProvider as L, stateBucketExistenceConfirmed as Lt, IAMRoleProvider as M, resolveCaptureObservedState as Mt, collectInlinePolicyNamesManagedBySiblings as N, resolveSkipPrefix as Nt, gray as O, getDefaultStateBucketName as Ot, clearOnUpdateRemoval as P, resolveStateBucketWithDefault as Pt, isRetryableTransientError as Q, setAwsClients as Qt, slowCcOperationTimeoutMs as R, warnDeprecatedNoPrefixCliFlag as Rt, MULTI_REGION_RECREATE_BLOCKED_TYPES as S, __exportAll as Sn, runDockerForeground as St, formatResourceLine as T, getDockerImageBySourceHash as Tt, refStateLookupFromResource as U, uploadCfnTemplate as Ut, IntrinsicFunctionResolver as V, MIGRATE_TMP_PREFIX as Vt, WAFv2WebACLProvider as W, expectedOwnerParam as Wt, describeTypeWithThrottleRetry as X, getAwsClients as Xt, DiffCalculator as Y, AwsClients as Yt, withRetry as Z, resetAwsClients as Zt, createPreDeleteFinalSnapshot as _, SynthesisError as _n, validateAssetBucketName as _t, DeploymentEventsStore as a, LocalMigrateError as an, AssetPublisher as at, unsupportedFinalSnapshotError as b, normalizeAwsError as bn, formatDockerLoginError as bt, replayFailedOperations as c, MissingCdkCliError as cn, buildAssetRedirectMap as ct, IMPLICIT_DELETE_DEPENDENCIES as d, ProvisioningError as dn, rewriteTemplateAssetReferences as dt, CdkdError as en, TemplateParser as et, computeImplicitDeleteEdges as f, ResourceTimeoutError as fn, AssetModeResolver as ft, ccRoutedFinalSnapshotError as g, StateError as gn, parseBootstrapMarker as gt, buildFinalSnapshotIdentifier as h, StackTerminationProtectionError as hn, getBootstrapMarkerKey as ht, DeploymentEventsReader as i, LocalInvokeBuildError as in, shouldRetainResource as it, yellow as j, resolveAutoAssetStorage as jt, green as k, getLegacyStateBucketName as kt, replayRollback as l, NestedStackChildDirectDestroyError as ln, createAssetRedirectResolver as lt, PRE_DELETE_SNAPSHOT_TYPES as m, StackHasActiveImportsError as mn, ensureAssetStorage as mt, DEFAULT_RESOURCE_WARN_AFTER_MS as n, DependencyError as nn, S3StateBackend as nt, planFailedOps as o, LocalStartServiceError as on, stringifyValue as ot, ATOMIC_FINAL_SNAPSHOT_TYPES as p, ResourceUpdateNotSupportedError as pn, BOOTSTRAP_MARKER_PREFIX as pt, assertRegionMatch as q, clearBucketRegionCache as qt, DeployEngine as r, DeployCancelledError as rn, rebuildClientForBucketRegion as rt, planRollback as s, LockError as sn, WorkGraph as st, DEFAULT_RESOURCE_TIMEOUT_MS as t, ConfigError as tn, LockManager as tt, withResourceDeadline as u, PartialFailureError as un, loadPublishableAssetManifest as ut, isFinalSnapshotError as v, formatError as vn, validateContainerRepoName as vt, renderStatefulReason as w, AssetManifestLoader as wt, extractDeploymentEventError as x, withErrorHandling as xn, getDockerCmd as xt, refusesFinalSnapshot as y, isCdkdError as yn, buildDockerImage as yt, disableInstanceApiTermination as z, CFN_TEMPLATE_BODY_LIMIT as zt };
20628
- //# sourceMappingURL=deploy-engine-BKRlw9Hx.js.map
20822
+ //# sourceMappingURL=deploy-engine-DQxqNiZR.js.map