@go-to-k/cdkd 0.94.13 → 0.94.15

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/README.md CHANGED
@@ -160,12 +160,20 @@ cdkd has three command families:
160
160
  use them to inspect / clean up state when the source is gone or
161
161
  you don't want to synth. `cdkd state destroy` is the CDK-app-free
162
162
  counterpart of `cdkd destroy`.
163
- - **`cdkd local ...` subcommands** (`local invoke`, `local start-api`)
164
- run synthesized Lambda functions locally inside Docker containers that
165
- bundle the AWS Lambda Runtime Interface Emulator (RIE). `local invoke`
166
- runs a single Lambda once; `local start-api` stands up a long-running
167
- HTTP server that maps API Gateway / HTTP API / Function URL routes to
168
- local Lambda invocations. No AWS API calls, no state bucket needed.
163
+ - **`cdkd local ...` subcommands** (`local invoke`, `local start-api`,
164
+ `local run-task`) run synthesized workloads locally inside Docker
165
+ containers. The Lambda variants (`local invoke` / `local start-api`)
166
+ bundle the AWS Lambda Runtime Interface Emulator (RIE); `local invoke`
167
+ runs a single Lambda once, and `local start-api` stands up a
168
+ long-running HTTP server that maps API Gateway / HTTP API / Function
169
+ URL routes to local Lambda invocations. `local run-task` is the ECS
170
+ counterpart — it locates an `AWS::ECS::TaskDefinition` from the
171
+ synthesized template and stands up every container in `dependsOn`
172
+ order on a per-task docker network with the AWS-published metadata
173
+ endpoints sidecar, so containers see `ECS_CONTAINER_METADATA_URI_V4`
174
+ (and optionally task-role creds via `--assume-task-role`) just like
175
+ they would on Fargate / ECS. No AWS API calls beyond optional STS /
176
+ Secrets resolution, no state bucket needed.
169
177
 
170
178
  Options like `--app`, `--state-bucket`, and `--context` can be omitted if configured via `cdk.json` or environment variables (`CDKD_APP`, `CDKD_STATE_BUCKET`).
171
179
 
@@ -376,6 +384,69 @@ Lambda-ServiceToken Active wait).
376
384
  See [docs/cli-reference.md](docs/cli-reference.md) for the full
377
385
  type-pair allowlist and trade-off notes.
378
386
 
387
+ ## Local execution
388
+
389
+ The `cdkd local` family runs AWS workloads on the developer's machine
390
+ via Docker — Lambda functions, API Gateway routes, and ECS tasks —
391
+ without an AWS deploy. Modeled on `sam local *` but reuses cdkd's
392
+ synthesis / asset / construct-path plumbing — no `template.yaml` to
393
+ maintain, no `cdk synth | sam ...` round-trip.
394
+
395
+ | Subcommand | Emulates |
396
+ | --- | --- |
397
+ | `cdkd local invoke <target>` | One-shot Lambda invoke via the AWS Lambda Runtime Interface Emulator (RIE) |
398
+ | `cdkd local start-api` | Long-running HTTP server for REST v1 / HTTP API / Function URL routes |
399
+ | `cdkd local run-task <target>` | ECS RunTask — every container in a task definition started on a per-task docker network |
400
+
401
+ Requires Docker. Pass `--from-state` to substitute deployed physical
402
+ IDs into intrinsic-valued properties; without it, intrinsic values are
403
+ dropped with a per-key warning (matches `sam local *` semantics).
404
+
405
+ ### `local invoke`
406
+
407
+ ```bash
408
+ cdkd local invoke MyStack/MyApi/Handler # one-shot invoke
409
+ cdkd local invoke MyStack/Handler --event events/get.json
410
+ cdkd local invoke MyStack/Handler --from-state # recover deployed env vars
411
+ ```
412
+
413
+ Supports every current AWS Lambda runtime (Node.js / Python / Ruby /
414
+ Java / .NET / `provided.al2023`), container Lambdas
415
+ (`DockerImageFunction` / `Code.ImageUri`) via local-build or ECR pull,
416
+ and same-stack Lambda Layers bind-mounted at `/opt`.
417
+
418
+ ### `local start-api`
419
+
420
+ ```bash
421
+ cdkd local start-api # one HTTP server per discovered API
422
+ cdkd local start-api --port 3000 # pin the first server's port
423
+ cdkd local start-api --warm --watch # pre-start + hot reload
424
+ ```
425
+
426
+ One server per discovered API — authorizers, CORS configs, and stage
427
+ variables stay scoped to the owning API. Supports REST v1 + HTTP API +
428
+ Function URL with AWS_PROXY integrations; Lambda TOKEN / REQUEST,
429
+ Cognito User Pool, and HTTP v2 JWT authorizers (JWKS-verified); CORS
430
+ preflight; hot reload via `--watch`.
431
+
432
+ ### `local run-task`
433
+
434
+ ```bash
435
+ cdkd local run-task MyStack/MyService/TaskDef
436
+ cdkd local run-task MyTaskDef --from-state # resolve deployed secrets / env intrinsics
437
+ ```
438
+
439
+ Starts every container in the task definition on a per-task docker
440
+ network with the AWS-published ECS metadata sidecar
441
+ (`amazon/amazon-ecs-local-container-endpoints`). `DependsOn` /
442
+ `Secrets` / `Volumes` (Host / Docker) are honored; `Secrets[].ValueFrom`
443
+ is resolved from SecretsManager / SSM at startup.
444
+
445
+ See [docs/local-emulation.md](docs/local-emulation.md) for the full
446
+ reference — supported runtimes, target resolution, every flag, exit
447
+ codes, route precedence, container-pool semantics, networking model,
448
+ v1 scope notes.
449
+
379
450
  ## Importing existing resources
380
451
 
381
452
  `cdkd import` adopts AWS resources that are already deployed (via
@@ -456,85 +527,6 @@ Two `orphan` variants at different granularities:
456
527
  Both `cdkd destroy` (synth-driven) and `cdkd state destroy`
457
528
  (state-driven, no synth) delete AWS resources + state.
458
529
 
459
- ## Stack-name prefix on physical names
460
-
461
- By default cdkd creates AWS resources with the **exact name you
462
- declared** in CDK code: `new iam.Role(this, 'CRRole', { roleName:
463
- 'my-role' })` in stack `MyStack` produces an AWS resource named
464
- `my-role`. Consistent across every resource type. This is the
465
- default since **v0.94.0** (closes [#299](https://github.com/go-to-k/cdkd/issues/299)).
466
-
467
- Pre-v0.94.0 cdkd prepended the stack name to user-declared physical
468
- names on a subset of types only (Pattern B providers: IAM Role /
469
- User / Group / InstanceProfile / ELBv2 LoadBalancer / TargetGroup),
470
- while Pattern A providers (Lambda, S3, SNS, SQS, DynamoDB, etc.) used
471
- the user's name as-is. The inconsistency was opaque to users and
472
- surfaced as failures in `cdkd export` (CFn IMPORT identifier
473
- mismatch). Flipping the default brings every resource type into line
474
- out of the box.
475
-
476
- `cdkd deploy --prefix-user-supplied-names` opts BACK in to the
477
- legacy prefixing on Pattern B providers (matching pre-v0.94.0 cdkd).
478
- Useful when migrating an existing stack that was originally deployed
479
- under the legacy default and you don't want to take a one-time
480
- replacement on every Pattern B resource.
481
-
482
- | | Default (no flag) | `--prefix-user-supplied-names` |
483
- | --- | --- | --- |
484
- | `new iam.Role({ roleName: 'my-role' })` | `my-role` | `MyStack-my-role` (legacy) |
485
- | `new s3.Bucket({ bucketName: 'my-bucket' })` | `my-bucket` (always — Pattern A) | `my-bucket` (unchanged) |
486
- | `new iam.Role(...)` (no `roleName`) | `MyStack-CRRole-<hash>` (auto-generated; prefix kept for uniqueness) | `MyStack-CRRole-<hash>` (unchanged) |
487
-
488
- Resolution chain (highest wins): `--prefix-user-supplied-names`
489
- CLI flag → `CDKD_PREFIX_USER_SUPPLIED_NAMES=true` env var →
490
- `cdk.json` `context.cdkd.prefixUserSuppliedNames: true` → default
491
- `false` (skip prefix).
492
-
493
- The deprecated `--no-prefix-user-supplied-names` flag (plus the
494
- `CDKD_NO_PREFIX_USER_SUPPLIED_NAMES` env var and `cdk.json
495
- context.cdkd.noPrefixUserSuppliedNames`) is still accepted but now
496
- matches the default; setting it emits a deprecation warning and is a
497
- no-op. Remove it from your CLI invocations and config.
498
-
499
- ### Migration from pre-v0.94.0
500
-
501
- This is a **breaking change**: upgrading from a pre-v0.94.0 cdkd to
502
- v0.94.0+ flips the AWS-resource name cdkd produces on Pattern B
503
- providers (IAM Role / User / Group / InstanceProfile / ELBv2 LB / TG)
504
- with user-supplied physical names. The next `cdkd deploy` against an
505
- existing stack will propose REPLACEMENT on every such resource —
506
- the AWS resource has the prefixed name; the new template intent has
507
- the un-prefixed name.
508
-
509
- Pick one of:
510
-
511
- 1. **Accept the one-time replacement** (simplest; only safe when the
512
- types involved tolerate replacement — IAM Roles get fresh ARNs,
513
- ELBv2 LBs get fresh DNS names).
514
- 2. **Pin legacy prefixing**: pass `--prefix-user-supplied-names`,
515
- set `CDKD_PREFIX_USER_SUPPLIED_NAMES=true`, or add
516
- `"prefixUserSuppliedNames": true` under `cdk.json` `context.cdkd`.
517
- 3. **Drop the explicit physical name** in CDK code where you don't
518
- actually need a stable name — `new iam.Role(...)` without
519
- `roleName` always uses the auto-generated `MyStack-CRRole-<hash>`
520
- form regardless of this flag.
521
-
522
- A migration helper (`cdkd state rename-strip-prefix <stack>`) that
523
- would let an existing stack adopt the new default without replacement
524
- is tracked separately in [#300](https://github.com/go-to-k/cdkd/issues/300).
525
-
526
- ### Effect on `cdkd export`
527
-
528
- [PR #285 `cdkd export`](https://github.com/go-to-k/cdkd/pull/285)
529
- surfaced the pre-v0.94.0 inconsistency: the CFn IMPORT changeset's
530
- identifier check would fail on a synth `RoleName: 'my-role'` vs the
531
- AWS-deployed `MyStack-my-role`, so the export command overlays
532
- `ResourceIdentifier` onto `Properties` to bridge the gap. The
533
- overlay is still needed for stacks deployed under the legacy default
534
- (or with `--prefix-user-supplied-names`); a fresh stack deployed
535
- under the v0.94.0 default has matching names and the overlay is a
536
- no-op for it.
537
-
538
530
  ## `--remove-protection`: one-shot bypass for protected resources
539
531
 
540
532
  CDK's `new Stack(app, 'X', { terminationProtection: true })` is honored
@@ -594,182 +586,6 @@ cdkd publish-assets -a cdk.out # skip synth, use pre-synthesized assembly
594
586
  See [docs/cli-reference.md](docs/cli-reference.md#publish-assets-synth--build--publish-no-deploy)
595
587
  for stack-selection rules and concurrency knobs.
596
588
 
597
- ## `local invoke`: run Lambda functions locally
598
-
599
- `cdkd local invoke <target>` runs a Lambda function from a CDK app on the
600
- developer's machine, inside a Docker container that bundles the AWS
601
- Lambda Runtime Interface Emulator (RIE). Modeled on `sam local invoke`
602
- but reusing cdkd's synthesis / asset / construct-path plumbing — no
603
- `template.yaml` to maintain, no `cdk synth | sam ...` round-trip.
604
-
605
- Requires Docker. Supports every current AWS Lambda runtime
606
- (`nodejs18.x` / `nodejs20.x` / `nodejs22.x` / `nodejs24.x` / `python3.11` /
607
- `python3.12` / `python3.13` / `python3.14` / `ruby3.2` / `ruby3.3` /
608
- `java8.al2` / `java11` / `java17` / `java21` / `dotnet6` / `dotnet8` /
609
- `provided.al2` / `provided.al2023`). The deprecated `go1.x` runtime is
610
- rejected with a migration pointer to `provided.al2023`. Java, .NET, and
611
- `provided.*` Lambdas are **asset-backed only** — the Handler shape names
612
- a compiled artifact (`package.Class::method` for Java's JVM class;
613
- `Assembly::Namespace.Class::Method` for .NET's CLR assembly; an
614
- arbitrary `bootstrap` binary for the OS-only `provided.*` runtimes), so
615
- use `lambda.Code.fromAsset(<dir>)` with a directory containing the
616
- compiled output (`.class` hierarchy / `.jar` / `.dll` / native binary);
617
- inline `Code.ZipFile` is rejected with a clear routing message.
618
-
619
- **Container Lambdas** — `lambda.DockerImageFunction(...)` /
620
- `Code.ImageUri` is supported alongside ZIP Lambdas. cdkd reads the
621
- function's local `Dockerfile` from `cdk.out` and runs `docker build`
622
- locally before invoking. When no asset matches (typically: invoking a
623
- stack deployed elsewhere), cdkd falls back to `docker pull` from
624
- ECR — same-account / same-region only in v1; cross-account /
625
- cross-region is not yet supported. `Architectures: [x86_64]` /
626
- `[arm64]` are honored via `--platform` so an arm64 host running an
627
- x86_64 Lambda doesn't hit emulation.
628
-
629
- ```bash
630
- # Invoke by CDK display path (single-stack apps may omit the prefix)
631
- cdkd local invoke MyStack/MyApi/Handler
632
- cdkd local invoke MyStack:MyApiHandler1234ABCD # logical-id form
633
-
634
- # Pass an event payload
635
- cdkd local invoke MyStack/Handler --event events/get.json
636
- echo '{"path":"/"}' | cdkd local invoke MyStack/Handler --event-stdin
637
-
638
- # Override env vars (SAM-compatible shape: {"LogicalId":{"KEY":"VALUE"}}
639
- # plus an optional top-level "Parameters" block applied to every invoke)
640
- cdkd local invoke MyStack/Handler --env-vars env.json
641
-
642
- # Skip docker pull when iterating
643
- cdkd local invoke MyStack/Handler --no-pull
644
-
645
- # Skip the local docker build for container Lambdas (Code.ImageUri).
646
- # Reuses the deterministic cdkd-local-invoke-<hash> tag from a prior
647
- # build. Errors clearly when the tag is missing.
648
- cdkd local invoke MyStack/ContainerHandler --no-build
649
-
650
- # Run with the deployed function's narrow execution role (otherwise the
651
- # developer's shell credentials are forwarded — SAM-compatible default)
652
- cdkd local invoke MyStack/Handler --assume-role arn:aws:iam::123456789012:role/MyApi-handler-role
653
-
654
- # Attach a Node debugger
655
- cdkd local invoke MyStack/Handler --debug-port 9229
656
-
657
- # After `cdkd deploy`, recover intrinsic-valued env vars (Ref / Fn::GetAtt
658
- # / Fn::Sub) from cdkd's S3 state instead of dropping them. Off by default
659
- # — keeps the local-only / unscoped flow safe; opt in when you want the
660
- # handler to see the deployed physical IDs (S3 bucket names, DDB table
661
- # names, IAM role ARNs, ...). Disambiguate with `--stack-region <region>`
662
- # when the same stack name has state in multiple regions.
663
- cdkd local invoke MyStack/Handler --from-state
664
- ```
665
-
666
- **Lambda Layers** — same-stack
667
- `AWS::Lambda::LayerVersion` references in `Properties.Layers` are
668
- resolved automatically and bind-mounted at `/opt` (read-only) inside
669
- the container. Each layer's unzipped asset directory under `cdk.out/`
670
- becomes one `-v <layerAssetPath>:/opt:ro` mount; multiple layers
671
- stack via Docker overlay layering, and AWS's "last layer wins on
672
- file collision" rule is preserved by keeping the template's input
673
- order. Cross-stack / cross-account / cross-region layer ARNs (literal
674
- ARN strings in `Properties.Layers`) are out of scope for v1 — cdkd
675
- hard-errors with a clear pointer at the offending entry. Container
676
- Lambdas (`Code.ImageUri`) silently ignore `Layers` (matches AWS:
677
- container images bake layers at build time).
678
-
679
- See [docs/cli-reference.md](docs/cli-reference.md#local-invoke-run-lambda-functions-locally)
680
- for the full surface, target-resolution rules, and v1 scope notes.
681
-
682
- ## `local start-api`: long-running local API server
683
-
684
- `cdkd local start-api` stands up a long-running local HTTP server that
685
- maps the synthesized API Gateway routes (REST v1, HTTP API, Function
686
- URL) to local Lambda invocations against the same RIE-backed Docker
687
- containers `cdkd local invoke` uses. Modeled on `sam local start-api`
688
- but reusing cdkd's synthesis / route-discovery plumbing.
689
-
690
- ```bash
691
- # Auto-allocate one port PER discovered API (printed at startup)
692
- cdkd local start-api
693
-
694
- # Pin the FIRST server to port 3000; subsequent APIs get 3001, 3002, ...
695
- cdkd local start-api --port 3000
696
-
697
- # Restrict to a single API by its CDK logical id (HTTP API / REST API logical
698
- # id, or the backing Lambda's logical id for Function URLs)
699
- cdkd local start-api --api MyAdminApi
700
-
701
- # Pre-warm one container per Lambda at server boot — eliminates first-request cold start
702
- cdkd local start-api --warm
703
-
704
- # Override env vars per-Lambda (SAM-shape file)
705
- cdkd local start-api --env-vars env.json
706
-
707
- # Pin the deployed execution role per Lambda (or globally with a bare ARN)
708
- cdkd local start-api --assume-role MyApiHandler=arn:aws:iam::123:role/handler-role
709
-
710
- # Hot reload — re-synth + re-discover routes when cdk.out/ or asset dirs change
711
- cdkd local start-api --watch
712
-
713
- # Select a specific API Gateway Stage (default: the first attached)
714
- cdkd local start-api --stage prod
715
- ```
716
-
717
- **One server per API** (since v0.81): every discovered API surface gets its
718
- own HTTP server on its own port, so authorizers, CORS configs, and stage
719
- variables stay scoped to the owning API and never bleed across APIs that
720
- happen to share a path. `cdkd local start-api` prints one
721
- `Server listening on http://<host>:<port> (<API> (<kind>))` line per
722
- server at startup; pass `--api <id>` to launch only one of them.
723
-
724
- Scope: REST v1 + HTTP API + Function URL with AWS_PROXY integrations.
725
- Authorizers (Lambda TOKEN/REQUEST + Cognito User Pool + HTTP v2 JWT),
726
- VPC-config Lambda warnings, CORS preflight, hot reload, and stage
727
- variables are supported. WebSocket APIs are not.
728
-
729
- **Authorizers**: `Authorization: Bearer <token>`-protected
730
- routes are gated on the authorizer Lambda's response (TOKEN / REQUEST
731
- authorizers, IAM-policy or HTTP v2 simple shape) or on a JWKS-based JWT
732
- verification (Cognito User Pool authorizers, HTTP v2 JWT authorizers).
733
- When the JWKS endpoint is unreachable from the dev machine, cdkd falls
734
- back to **pass-through mode** (every JWT accepted, with a warn line at
735
- startup) — local-dev-only fallback so a corporate proxy doesn't block
736
- iteration. **Do NOT rely on this in any shared environment.**
737
-
738
- **VPC-config Lambdas**: handlers with `Properties.VpcConfig`
739
- still run locally, but the local container is NOT attached to the
740
- deployed VPC's subnets — calls to private RDS / ElastiCache will fail.
741
- cdkd warns at startup naming each affected Lambda; AWS SDK calls still
742
- reach public AWS endpoints via the dev's network as usual.
743
-
744
- **Hot reload (`--watch`)**: re-runs the synth → discover → spec-build
745
- pipeline whenever `cdk.out/` or any of the routed Lambdas' asset
746
- directories change. Routes added / removed / changed swap in
747
- atomically without restarting the HTTP server; in-flight requests
748
- complete against the old container pool while the new pool warms.
749
- Synth failures are non-fatal — the previous version keeps serving and
750
- a warn line names the failure. Off by default; pass `--watch` to
751
- enable.
752
-
753
- **CORS preflight**: HTTP API v2 OPTIONS preflight requests are
754
- intercepted when the API has a `CorsConfiguration` block. The server
755
- matches the request's `Origin` / `Access-Control-Request-Method` /
756
- `Access-Control-Request-Headers` against the configured allowlist and
757
- returns a `204 No Content` with the canonical `Access-Control-Allow-*`
758
- headers. Preflight handling is skipped when the user has registered
759
- an explicit OPTIONS method (their Lambda owns it). REST v1 CORS (Mock
760
- OPTIONS method) is not auto-handled and stays out of scope; use the
761
- deployed API for that case.
762
-
763
- **Stage variables**: `event.stageVariables` is populated from the
764
- selected Stage's `Variables` (REST v1) / `StageVariables` (HTTP API
765
- v2) map. Default selection is the first Stage attached to each API;
766
- pass `--stage <name>` to pick a Stage by `StageName`. Function URL
767
- routes don't have a Stage — `event.stageVariables` stays `null`.
768
-
769
- See [docs/cli-reference.md](docs/cli-reference.md#local-start-api-long-running-local-api-server)
770
- for the full route-discovery rules, container-pool semantics, exit
771
- codes, and per-authorizer-kind detection / response-shape details.
772
-
773
589
  ## State Management
774
590
 
775
591
  State is stored in S3 with optimistic locking via S3 Conditional Writes
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 { A as resolveCaptureObservedState, C as stringifyValue, D as getDefaultStateBucketName, E as Synthesizer, F as AssemblyReader, G as ProvisioningError, H as LocalInvokeBuildError, J as RouteDiscoveryError, K as ResourceTimeoutError, L as resolveBucketRegion, M as resolveStateBucketWithDefault, N as resolveStateBucketWithDefaultAndSource, O as getLegacyStateBucketName, P as warnDeprecatedNoPrefixCliFlag, S as AssetPublisher, T as buildDockerImage, W as PartialFailureError, Y as StackTerminationProtectionError, _ as DiffCalculator, a as withRetry, at as runStackBuffered, b as LockManager, c as collectInlinePolicyNamesManagedBySiblings, ct as PATTERN_B_RESOURCE_TYPES, d as normalizeAwsTagsToCfn, dt as withSkipPrefix, et as normalizeAwsError, f as resolveExplicitPhysicalId, ft as withStackName, g as IntrinsicFunctionResolver, h as assertRegionMatch, i as withResourceDeadline, j as resolveSkipPrefix, k as resolveApp, l as CDK_PATH_TAG, lt as generateResourceName, m as CloudControlProvider, n as DEFAULT_RESOURCE_WARN_AFTER_MS, o as IMPLICIT_DELETE_DEPENDENCIES, ot as getLiveRenderer, p as ProviderRegistry, q as ResourceUpdateNotSupportedError, r as DeployEngine, rt as getLogger, s as IAMRoleProvider, st as PATTERN_B_NAME_PROPERTIES, t as DEFAULT_RESOURCE_TIMEOUT_MS, tt as withErrorHandling, u as matchesCdkPath, ut as generateResourceNameWithFallback, v as DagBuilder, w as WorkGraph, x as S3StateBackend, y as TemplateParser, z as CdkdError } from "./deploy-engine-SarGY6-L.js";
3
+ import { A as resolveCaptureObservedState, C as stringifyValue, D as getDefaultStateBucketName, E as Synthesizer, F as AssemblyReader, G as ProvisioningError, H as LocalInvokeBuildError, J as RouteDiscoveryError, K as ResourceTimeoutError, L as resolveBucketRegion, M as resolveStateBucketWithDefault, N as resolveStateBucketWithDefaultAndSource, O as getLegacyStateBucketName, P as warnDeprecatedNoPrefixCliFlag, S as AssetPublisher, T as buildDockerImage, W as PartialFailureError, Y as StackTerminationProtectionError, _ as DiffCalculator, a as withRetry, at as runStackBuffered, b as LockManager, c as collectInlinePolicyNamesManagedBySiblings, ct as PATTERN_B_RESOURCE_TYPES, d as normalizeAwsTagsToCfn, dt as withSkipPrefix, et as normalizeAwsError, f as resolveExplicitPhysicalId, ft as withStackName, g as IntrinsicFunctionResolver, h as assertRegionMatch, i as withResourceDeadline, j as resolveSkipPrefix, k as resolveApp, l as CDK_PATH_TAG, lt as generateResourceName, m as CloudControlProvider, n as DEFAULT_RESOURCE_WARN_AFTER_MS, o as IMPLICIT_DELETE_DEPENDENCIES, ot as getLiveRenderer, p as ProviderRegistry, q as ResourceUpdateNotSupportedError, r as DeployEngine, rt as getLogger, s as IAMRoleProvider, st as PATTERN_B_NAME_PROPERTIES, t as DEFAULT_RESOURCE_TIMEOUT_MS, tt as withErrorHandling, u as matchesCdkPath, ut as generateResourceNameWithFallback, v as DagBuilder, w as WorkGraph, x as S3StateBackend, y as TemplateParser, z as CdkdError } from "./deploy-engine-Cl7v7Ml5.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 } 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";
@@ -41771,7 +41771,7 @@ function reorderArgs(argv) {
41771
41771
  */
41772
41772
  async function main() {
41773
41773
  const program = new Command();
41774
- program.name("cdkd").description("CDK Direct - Deploy AWS CDK apps directly via SDK/Cloud Control API").version("0.94.12");
41774
+ program.name("cdkd").description("CDK Direct - Deploy AWS CDK apps directly via SDK/Cloud Control API").version("0.94.14");
41775
41775
  program.addCommand(createBootstrapCommand());
41776
41776
  program.addCommand(createSynthCommand());
41777
41777
  program.addCommand(createListCommand());
@@ -6673,6 +6673,7 @@ var CustomResourceProvider = class CustomResourceProvider {
6673
6673
  this.logger.debug(`Creating custom resource ${logicalId} (${resourceType})`);
6674
6674
  const serviceToken = properties["ServiceToken"];
6675
6675
  if (!serviceToken) throw new ProvisioningError(`ServiceToken is required for custom resource ${logicalId}`, resourceType, logicalId);
6676
+ if (typeof serviceToken !== "string") throw new ProvisioningError(`Custom Resource ${logicalId}: ServiceToken is not a resolved string ARN (got ${typeof serviceToken}). This usually indicates state was written by a pre-fix cdkd import; re-run \`cdkd import\` or \`cdkd state orphan <stack>\` to recover.`, resourceType, logicalId);
6676
6677
  try {
6677
6678
  const invocation = await this.prepareInvocation();
6678
6679
  const request = {
@@ -6706,6 +6707,7 @@ var CustomResourceProvider = class CustomResourceProvider {
6706
6707
  this.logger.debug(`Updating custom resource ${logicalId}: ${physicalId} (${resourceType})`);
6707
6708
  const serviceToken = properties["ServiceToken"];
6708
6709
  if (!serviceToken) throw new ProvisioningError(`ServiceToken is required for custom resource ${logicalId}`, resourceType, logicalId, physicalId);
6710
+ if (typeof serviceToken !== "string") throw new ProvisioningError(`Custom Resource ${logicalId}: ServiceToken is not a resolved string ARN (got ${typeof serviceToken}). This usually indicates state was written by a pre-fix cdkd import; re-run \`cdkd import\` or \`cdkd state orphan <stack>\` to recover.`, resourceType, logicalId, physicalId);
6709
6711
  try {
6710
6712
  const invocation = await this.prepareInvocation();
6711
6713
  const request = {
@@ -6750,6 +6752,7 @@ var CustomResourceProvider = class CustomResourceProvider {
6750
6752
  this.logger.warn(`No ServiceToken found for custom resource ${logicalId}, skipping deletion`);
6751
6753
  return;
6752
6754
  }
6755
+ if (typeof serviceToken !== "string") throw new ProvisioningError(`Custom Resource ${logicalId}: ServiceToken is not a resolved string ARN (got ${typeof serviceToken}). This usually indicates state was written by a pre-fix cdkd import; re-run \`cdkd import\` or \`cdkd state orphan <stack>\` to recover.`, resourceType, logicalId, physicalId);
6753
6756
  try {
6754
6757
  const invocation = await this.prepareInvocation();
6755
6758
  const request = {
@@ -9237,4 +9240,4 @@ var DeployEngine = class {
9237
9240
 
9238
9241
  //#endregion
9239
9242
  export { isCdkdError as $, resolveCaptureObservedState as A, ConfigError as B, stringifyValue as C, getDefaultStateBucketName as D, Synthesizer as E, AssemblyReader as F, ProvisioningError as G, LocalInvokeBuildError as H, clearBucketRegionCache as I, RouteDiscoveryError as J, ResourceTimeoutError as K, resolveBucketRegion as L, resolveStateBucketWithDefault as M, resolveStateBucketWithDefaultAndSource as N, getLegacyStateBucketName as O, warnDeprecatedNoPrefixCliFlag as P, formatError as Q, AssetError as R, AssetPublisher as S, buildDockerImage as T, LockError as U, DependencyError as V, PartialFailureError as W, StateError as X, StackTerminationProtectionError as Y, SynthesisError as Z, DiffCalculator as _, withRetry as a, runStackBuffered as at, LockManager as b, collectInlinePolicyNamesManagedBySiblings as c, PATTERN_B_RESOURCE_TYPES as ct, normalizeAwsTagsToCfn as d, withSkipPrefix as dt, normalizeAwsError as et, resolveExplicitPhysicalId as f, withStackName as ft, IntrinsicFunctionResolver as g, assertRegionMatch as h, withResourceDeadline as i, setLogger as it, resolveSkipPrefix as j, resolveApp as k, CDK_PATH_TAG as l, generateResourceName as lt, CloudControlProvider as m, DEFAULT_RESOURCE_WARN_AFTER_MS as n, ConsoleLogger as nt, IMPLICIT_DELETE_DEPENDENCIES as o, getLiveRenderer as ot, ProviderRegistry as p, ResourceUpdateNotSupportedError as q, DeployEngine as r, getLogger as rt, IAMRoleProvider as s, PATTERN_B_NAME_PROPERTIES as st, DEFAULT_RESOURCE_TIMEOUT_MS as t, withErrorHandling as tt, matchesCdkPath as u, generateResourceNameWithFallback as ut, DagBuilder as v, WorkGraph as w, S3StateBackend as x, TemplateParser as y, CdkdError as z };
9240
- //# sourceMappingURL=deploy-engine-SarGY6-L.js.map
9243
+ //# sourceMappingURL=deploy-engine-Cl7v7Ml5.js.map