@go-to-k/cdkd 0.115.3 → 0.115.4

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,6 +1,6 @@
1
1
  #!/usr/bin/env node
2
2
  import { a as setAwsClients, i as resetAwsClients, r as getAwsClients, t as AwsClients } from "./aws-clients-CuHRHcyW.js";
3
- import { $ as StackHasActiveImportsError, A as Synthesizer, C as AssetPublisher, D as formatDockerLoginError, E as buildDockerImage, F as resolveSkipPrefix, I as resolveStateBucketWithDefault, J as PartialFailureError, K as LocalInvokeBuildError, L as resolveStateBucketWithDefaultAndSource, M as getLegacyStateBucketName, N as resolveApp, O as getDockerCmd, P as resolveCaptureObservedState, Q as RouteDiscoveryError, R as warnDeprecatedNoPrefixCliFlag, S as shouldRetainResource, T as WorkGraph, U as CdkdError, V as resolveBucketRegion, X as ResourceTimeoutError, Y as ProvisioningError, Z as ResourceUpdateNotSupportedError, _ as DiffCalculator, _t as withStackName, a as withRetry, at as normalizeAwsError, b as LockManager, c as collectInlinePolicyNamesManagedBySiblings, ct as getLogger, d as normalizeAwsTagsToCfn, dt as getLiveRenderer, et as StackTerminationProtectionError, f as resolveExplicitPhysicalId, ft as PATTERN_B_NAME_PROPERTIES, g as IntrinsicFunctionResolver, gt as withSkipPrefix, h as assertRegionMatch, ht as generateResourceNameWithFallback, i as withResourceDeadline, j as getDefaultStateBucketName, k as runDockerStreaming, l as CDK_PATH_TAG, m as CloudControlProvider, mt as generateResourceName, n as DEFAULT_RESOURCE_WARN_AFTER_MS, o as IMPLICIT_DELETE_DEPENDENCIES, ot as withErrorHandling, p as ProviderRegistry, pt as PATTERN_B_RESOURCE_TYPES, r as DeployEngine, s as IAMRoleProvider, t as DEFAULT_RESOURCE_TIMEOUT_MS, u as matchesCdkPath, ut as runStackBuffered, v as DagBuilder, w as stringifyValue, x as S3StateBackend, y as TemplateParser, z as AssemblyReader } from "./deploy-engine-VFIYh_NY.js";
3
+ import { $ as RouteDiscoveryError, A as runDockerStreaming, B as AssemblyReader, C as AssetPublisher, D as formatDockerLoginError, E as buildDockerImage, F as resolveCaptureObservedState, H as resolveBucketRegion, I as resolveSkipPrefix, L as resolveStateBucketWithDefault, M as getDefaultStateBucketName, N as getLegacyStateBucketName, O as getDockerCmd, P as resolveApp, Q as ResourceUpdateNotSupportedError, R as resolveStateBucketWithDefaultAndSource, S as shouldRetainResource, T as WorkGraph, W as CdkdError, X as ProvisioningError, Y as PartialFailureError, Z as ResourceTimeoutError, _ as DiffCalculator, _t as withSkipPrefix, a as withRetry, b as LockManager, c as collectInlinePolicyNamesManagedBySiblings, d as normalizeAwsTagsToCfn, dt as runStackBuffered, et as StackHasActiveImportsError, f as resolveExplicitPhysicalId, ft as getLiveRenderer, g as IntrinsicFunctionResolver, gt as generateResourceNameWithFallback, h as assertRegionMatch, ht as generateResourceName, i as withResourceDeadline, j as Synthesizer, k as runDockerForeground, l as CDK_PATH_TAG, lt as getLogger, m as CloudControlProvider, mt as PATTERN_B_RESOURCE_TYPES, n as DEFAULT_RESOURCE_WARN_AFTER_MS, o as IMPLICIT_DELETE_DEPENDENCIES, ot as normalizeAwsError, p as ProviderRegistry, pt as PATTERN_B_NAME_PROPERTIES, q as LocalInvokeBuildError, r as DeployEngine, s as IAMRoleProvider, st as withErrorHandling, t as DEFAULT_RESOURCE_TIMEOUT_MS, tt as StackTerminationProtectionError, u as matchesCdkPath, v as DagBuilder, vt as withStackName, w as stringifyValue, x as S3StateBackend, y as TemplateParser, z as warnDeprecatedNoPrefixCliFlag } from "./deploy-engine-Chzg_hDE.js";
4
4
  import { createHash, createPublicKey, createVerify, randomBytes, randomUUID } from "node:crypto";
5
5
  import { CopyObjectCommand, CreateBucketCommand, DeleteBucketAnalyticsConfigurationCommand, DeleteBucketCommand, DeleteBucketCorsCommand, DeleteBucketIntelligentTieringConfigurationCommand, DeleteBucketInventoryConfigurationCommand, DeleteBucketLifecycleCommand, DeleteBucketMetricsConfigurationCommand, DeleteBucketPolicyCommand, DeleteBucketReplicationCommand, DeleteBucketTaggingCommand, DeleteBucketWebsiteCommand, DeleteObjectCommand, DeleteObjectsCommand, GetBucketAccelerateConfigurationCommand, GetBucketCorsCommand, GetBucketEncryptionCommand, GetBucketLifecycleConfigurationCommand, GetBucketLocationCommand, GetBucketLoggingCommand, GetBucketNotificationConfigurationCommand, GetBucketPolicyCommand, GetBucketReplicationCommand, GetBucketTaggingCommand, GetBucketVersioningCommand, GetBucketWebsiteCommand, GetObjectCommand, GetObjectLockConfigurationCommand, GetPublicAccessBlockCommand, HeadBucketCommand, ListBucketAnalyticsConfigurationsCommand, ListBucketIntelligentTieringConfigurationsCommand, ListBucketInventoryConfigurationsCommand, ListBucketMetricsConfigurationsCommand, ListBucketsCommand, ListDirectoryBucketsCommand, ListObjectVersionsCommand, ListObjectsV2Command, NoSuchBucket, PutBucketAccelerateConfigurationCommand, PutBucketAnalyticsConfigurationCommand, PutBucketCorsCommand, PutBucketEncryptionCommand, PutBucketIntelligentTieringConfigurationCommand, PutBucketInventoryConfigurationCommand, PutBucketLifecycleConfigurationCommand, PutBucketLoggingCommand, PutBucketMetricsConfigurationCommand, PutBucketNotificationConfigurationCommand, PutBucketOwnershipControlsCommand, PutBucketPolicyCommand, PutBucketReplicationCommand, PutBucketTaggingCommand, PutBucketVersioningCommand, PutBucketWebsiteCommand, PutObjectCommand, PutObjectLockConfigurationCommand, PutPublicAccessBlockCommand, S3Client, S3ServiceException } from "@aws-sdk/client-s3";
6
6
  import { AddRoleToInstanceProfileCommand, AddUserToGroupCommand, AttachGroupPolicyCommand, AttachUserPolicyCommand, CreateGroupCommand, CreateInstanceProfileCommand, CreateLoginProfileCommand, CreateUserCommand, DeleteAccessKeyCommand, DeleteGroupCommand, DeleteGroupPolicyCommand, DeleteInstanceProfileCommand, DeleteLoginProfileCommand, DeleteRolePolicyCommand, DeleteUserCommand, DeleteUserPermissionsBoundaryCommand, DeleteUserPolicyCommand, DetachGroupPolicyCommand, DetachUserPolicyCommand, GetGroupCommand, GetGroupPolicyCommand, GetInstanceProfileCommand, GetRolePolicyCommand, GetUserCommand, GetUserPolicyCommand, IAMClient, ListAccessKeysCommand, ListAttachedGroupPoliciesCommand, ListAttachedUserPoliciesCommand, ListGroupPoliciesCommand, ListGroupsForUserCommand, ListInstanceProfilesCommand, ListUserPoliciesCommand, ListUserTagsCommand, ListUsersCommand, NoSuchEntityException, PutGroupPolicyCommand, PutRolePolicyCommand, PutUserPermissionsBoundaryCommand, PutUserPolicyCommand, RemoveRoleFromInstanceProfileCommand, RemoveUserFromGroupCommand, TagUserCommand, UntagUserCommand, UpdateLoginProfileCommand } from "@aws-sdk/client-iam";
@@ -37366,43 +37366,22 @@ async function pullImage(image, skipPull) {
37366
37366
  }
37367
37367
  if (getLogger().getLevel() === "debug") {
37368
37368
  logger.info(`Pulling ${image}...`);
37369
- await runForeground$1(getDockerCmd(), ["pull", image]);
37369
+ try {
37370
+ await runDockerForeground(["pull", image]);
37371
+ } catch (err) {
37372
+ throw new DockerRunnerError(`docker pull ${image} failed: ${err.message}`);
37373
+ }
37370
37374
  return;
37371
37375
  }
37372
37376
  logger.debug(`Pulling ${image} (silent — pass --verbose to stream progress)`);
37373
- await runCaptured(getDockerCmd(), ["pull", image], image);
37374
- }
37375
- /**
37376
- * Run a child process with stdout / stderr captured (not inherited).
37377
- * On success: discard the captured output (silent). On failure: fold
37378
- * the captured stderr (or stdout as a fallback) into the rejection so
37379
- * the error message names what actually went wrong instead of a bare
37380
- * "exit code N".
37381
- */
37382
- function runCaptured(cmd, args, image) {
37383
- return new Promise((resolveProc, rejectProc) => {
37384
- const proc = spawn(cmd, args, { stdio: [
37385
- "ignore",
37386
- "pipe",
37387
- "pipe"
37388
- ] });
37389
- let stdout = "";
37390
- let stderr = "";
37391
- proc.stdout?.on("data", (chunk) => {
37392
- stdout += chunk.toString("utf-8");
37393
- });
37394
- proc.stderr?.on("data", (chunk) => {
37395
- stderr += chunk.toString("utf-8");
37396
- });
37397
- proc.on("error", (err) => rejectProc(new DockerRunnerError(`${cmd} pull ${image} failed: ${err.message}`)));
37398
- proc.on("close", (code) => {
37399
- if (code === 0) {
37400
- resolveProc();
37401
- return;
37402
- }
37403
- rejectProc(new DockerRunnerError(`docker pull ${image} exited with code ${code}: ${stderr.trim() || stdout.trim() || "(no output)"}`));
37404
- });
37405
- });
37377
+ try {
37378
+ await runDockerStreaming(["pull", image], { streamLive: false });
37379
+ } catch (err) {
37380
+ const e = err;
37381
+ if (e.exitCode === void 0 || e.exitCode === null) throw new DockerRunnerError(`docker pull ${image} failed: ${e.message ?? String(err)}`);
37382
+ const detail = e.stderr?.trim() || e.stdout?.trim() || "(no output)";
37383
+ throw new DockerRunnerError(`docker pull ${image} exited with code ${e.exitCode}: ${detail}`);
37384
+ }
37406
37385
  }
37407
37386
  /**
37408
37387
  * Run the container detached. Returns the container ID.
@@ -37576,21 +37555,6 @@ function redactAwsCredentialsInArgs(args) {
37576
37555
  }
37577
37556
  return out;
37578
37557
  }
37579
- /**
37580
- * Run a child process attached to the parent's stdio (so users see
37581
- * progress lines as they happen). Resolves on exit code 0; rejects with
37582
- * the captured stderr otherwise. Used for `docker pull`.
37583
- */
37584
- function runForeground$1(cmd, args) {
37585
- return new Promise((resolveProc, rejectProc) => {
37586
- const proc = spawn(cmd, args, { stdio: "inherit" });
37587
- proc.on("error", (err) => rejectProc(new DockerRunnerError(`${cmd} failed: ${err.message}`)));
37588
- proc.on("close", (code) => {
37589
- if (code === 0) resolveProc();
37590
- else rejectProc(new DockerRunnerError(`${cmd} exited with code ${code}`));
37591
- });
37592
- });
37593
- }
37594
37558
 
37595
37559
  //#endregion
37596
37560
  //#region src/local/ecr-puller.ts
@@ -37665,7 +37629,11 @@ async function pullEcrImage(imageUri, options) {
37665
37629
  ecr.destroy();
37666
37630
  }
37667
37631
  logger.info(`Pulling ${imageUri}...`);
37668
- await runForeground(getDockerCmd(), ["pull", imageUri]);
37632
+ try {
37633
+ await runDockerForeground(["pull", imageUri]);
37634
+ } catch (err) {
37635
+ throw new LocalInvokeBuildError(`docker pull ${imageUri} failed: ${err.message}`);
37636
+ }
37669
37637
  return imageUri;
37670
37638
  }
37671
37639
  /**
@@ -37729,22 +37697,6 @@ async function isImageInLocalCache(imageRef) {
37729
37697
  return false;
37730
37698
  }
37731
37699
  }
37732
- /**
37733
- * `docker pull` plumbed to the parent's stdio so the user sees layer
37734
- * pull progress. Mirrors the runtime image's `pullImage` plumbing in
37735
- * `docker-runner.ts` but local to this module to avoid a circular
37736
- * dependency.
37737
- */
37738
- function runForeground(cmd, args) {
37739
- return new Promise((resolve, reject) => {
37740
- const proc = spawn(cmd, args, { stdio: "inherit" });
37741
- proc.on("error", (err) => reject(new LocalInvokeBuildError(`${cmd} failed: ${err.message}`)));
37742
- proc.on("close", (code) => {
37743
- if (code === 0) resolve();
37744
- else reject(new LocalInvokeBuildError(`${cmd} exited with code ${code}`));
37745
- });
37746
- });
37747
- }
37748
37700
 
37749
37701
  //#endregion
37750
37702
  //#region src/local/docker-image-builder.ts
@@ -38731,6 +38683,13 @@ function resolveLambdaArnOutcome(value) {
38731
38683
  return resolveLambdaArnIntrinsic(value);
38732
38684
  }
38733
38685
  /**
38686
+ * Marker prefix the HTTP API v2 Route `Target` field always starts with —
38687
+ * AWS documents this as `integrations/<IntegrationId>`. Load-bearing
38688
+ * signal that an `Fn::Sub` shape on this field is actually pointing at
38689
+ * a same-template Integration rather than something unrelated.
38690
+ */
38691
+ const TARGET_INTEGRATIONS_PREFIX = "integrations/";
38692
+ /**
38734
38693
  * Parse an HTTP API Route's `Target` into the integration's logical ID.
38735
38694
  *
38736
38695
  * CDK emits one of:
@@ -38739,9 +38698,14 @@ function resolveLambdaArnOutcome(value) {
38739
38698
  * (the shape `aws-cdk-lib/aws-apigatewayv2`'s `HttpApi.addRoutes`
38740
38699
  * actually emits — empty separator + `'integrations/'` literal
38741
38700
  * prefix in front of the Ref).
38701
+ * - `Fn::Sub: 'integrations/${MyIntegration}'` (1-arg form — AWS-docs
38702
+ * canonical; emitted by hand-rolled `CfnRoute` constructs).
38703
+ * - `Fn::Sub: ['integrations/${IntId}', { IntId: <Ref|GetAtt> }]`
38704
+ * (2-arg form — what `cdk.Fn.sub(template, vars)` synthesizes
38705
+ * when users build `target` programmatically).
38742
38706
  * - `'integrations/abc123'` (literal — rare).
38743
38707
  *
38744
- * All three forms are accepted; anything else throws.
38708
+ * All five forms are accepted; anything else throws.
38745
38709
  */
38746
38710
  function parseHttpApiTargetIntegration(target, location) {
38747
38711
  if (typeof target === "string") {
@@ -38750,7 +38714,8 @@ function parseHttpApiTargetIntegration(target, location) {
38750
38714
  throw new Error(`${location}: literal Target '${target}' must start with 'integrations/'`);
38751
38715
  }
38752
38716
  if (target && typeof target === "object" && !Array.isArray(target)) {
38753
- const join = target["Fn::Join"];
38717
+ const obj = target;
38718
+ const join = obj["Fn::Join"];
38754
38719
  if (Array.isArray(join) && join.length === 2 && Array.isArray(join[1])) {
38755
38720
  const sep = join[0];
38756
38721
  const parts = join[1];
@@ -38763,8 +38728,30 @@ function parseHttpApiTargetIntegration(target, location) {
38763
38728
  if (ref) return ref;
38764
38729
  }
38765
38730
  }
38731
+ if ("Fn::Sub" in obj) {
38732
+ const sub = obj["Fn::Sub"];
38733
+ if (typeof sub === "string") {
38734
+ const m = new RegExp(`^${TARGET_INTEGRATIONS_PREFIX}\\$\\{([^}]+)\\}$`).exec(sub);
38735
+ if (m) {
38736
+ const placeholder = m[1];
38737
+ if (!placeholder.includes(".")) return placeholder;
38738
+ }
38739
+ }
38740
+ if (Array.isArray(sub) && sub.length === 2 && typeof sub[0] === "string" && sub[1] !== null && typeof sub[1] === "object" && !Array.isArray(sub[1])) {
38741
+ const template = sub[0];
38742
+ const bindings = sub[1];
38743
+ const m = new RegExp(`^${TARGET_INTEGRATIONS_PREFIX}\\$\\{([^}]+)\\}$`).exec(template);
38744
+ if (m) {
38745
+ const bound = bindings[m[1]];
38746
+ if (bound !== void 0) {
38747
+ const ref = pickRefLogicalId$2(bound);
38748
+ if (ref) return ref;
38749
+ }
38750
+ }
38751
+ }
38752
+ }
38766
38753
  }
38767
- throw new Error(`${location}: Target must be 'integrations/<id>' or Fn::Join with one of the documented shapes (got ${shortJson$1(target)}).`);
38754
+ throw new Error(`${location}: Target must be 'integrations/<id>', Fn::Join with one of the documented shapes, or Fn::Sub with an 'integrations/\${...}' template (got ${shortJson$1(target)}).`);
38768
38755
  }
38769
38756
  /**
38770
38757
  * Parse an HTTP API RouteKey (`'<METHOD> <path>'` or `'$default'`) into
@@ -45594,7 +45581,7 @@ function reorderArgs(argv) {
45594
45581
  */
45595
45582
  async function main() {
45596
45583
  const program = new Command();
45597
- program.name("cdkd").description("CDK Direct - Deploy AWS CDK apps directly via SDK/Cloud Control API").version("0.115.3");
45584
+ program.name("cdkd").description("CDK Direct - Deploy AWS CDK apps directly via SDK/Cloud Control API").version("0.115.4");
45598
45585
  program.addCommand(createBootstrapCommand());
45599
45586
  program.addCommand(createSynthCommand());
45600
45587
  program.addCommand(createListCommand());