@go-to-k/cdkd 0.73.0 → 0.75.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.
package/README.md CHANGED
@@ -634,6 +634,19 @@ cdkd local invoke MyStack/Handler --debug-port 9229
634
634
  cdkd local invoke MyStack/Handler --from-state
635
635
  ```
636
636
 
637
+ **Lambda Layers (PR 6 of #224, issue #232)** — same-stack
638
+ `AWS::Lambda::LayerVersion` references in `Properties.Layers` are
639
+ resolved automatically and bind-mounted at `/opt` (read-only) inside
640
+ the container. Each layer's unzipped asset directory under `cdk.out/`
641
+ becomes one `-v <layerAssetPath>:/opt:ro` mount; multiple layers
642
+ stack via Docker overlay layering, and AWS's "last layer wins on
643
+ file collision" rule is preserved by keeping the template's input
644
+ order. Cross-stack / cross-account / cross-region layer ARNs (literal
645
+ ARN strings in `Properties.Layers`) are out of scope for v1 — cdkd
646
+ hard-errors with a clear pointer at the offending entry. Container
647
+ Lambdas (`Code.ImageUri`) silently ignore `Layers` (matches AWS:
648
+ container images bake layers at build time).
649
+
637
650
  See [docs/cli-reference.md](docs/cli-reference.md#local-invoke-run-lambda-functions-locally)
638
651
  for the full surface, target-resolution rules, and v1 scope notes.
639
652
 
@@ -660,13 +673,19 @@ cdkd local start-api --env-vars env.json
660
673
 
661
674
  # Pin the deployed execution role per Lambda (or globally with a bare ARN)
662
675
  cdkd local start-api --assume-role MyApiHandler=arn:aws:iam::123:role/handler-role
676
+
677
+ # Hot reload — re-synth + re-discover routes when cdk.out/ or asset dirs change
678
+ cdkd local start-api --watch
679
+
680
+ # Select a specific API Gateway Stage (default: the first attached)
681
+ cdkd local start-api --stage prod
663
682
  ```
664
683
 
665
- v1 scope: REST v1 + HTTP API + Function URL with AWS_PROXY integrations.
684
+ Scope: REST v1 + HTTP API + Function URL with AWS_PROXY integrations.
666
685
  Authorizers (PR 8b — Lambda TOKEN/REQUEST + Cognito User Pool + HTTP v2
667
- JWT) and VPC-config Lambda warnings (PR 8b) are supported. CORS
668
- preflight, hot reload, stage variables, and WebSocket APIs are still
669
- deferred to follow-up PRs.
686
+ JWT), VPC-config Lambda warnings (PR 8b), CORS preflight (PR 8c), hot
687
+ reload (PR 8c), and stage variables (PR 8c) are supported. WebSocket
688
+ APIs are deferred to a follow-up PR.
670
689
 
671
690
  **Authorizers (PR 8b)**: `Authorization: Bearer <token>`-protected
672
691
  routes are gated on the authorizer Lambda's response (TOKEN / REQUEST
@@ -683,6 +702,31 @@ deployed VPC's subnets — calls to private RDS / ElastiCache will fail.
683
702
  cdkd warns at startup naming each affected Lambda; AWS SDK calls still
684
703
  reach public AWS endpoints via the dev's network as usual.
685
704
 
705
+ **Hot reload (`--watch`)**: re-runs the synth → discover → spec-build
706
+ pipeline whenever `cdk.out/` or any of the routed Lambdas' asset
707
+ directories change. Routes added / removed / changed swap in
708
+ atomically without restarting the HTTP server; in-flight requests
709
+ complete against the old container pool while the new pool warms.
710
+ Synth failures are non-fatal — the previous version keeps serving and
711
+ a warn line names the failure. Off by default; pass `--watch` to
712
+ enable.
713
+
714
+ **CORS preflight**: HTTP API v2 OPTIONS preflight requests are
715
+ intercepted when the API has a `CorsConfiguration` block. The server
716
+ matches the request's `Origin` / `Access-Control-Request-Method` /
717
+ `Access-Control-Request-Headers` against the configured allowlist and
718
+ returns a `204 No Content` with the canonical `Access-Control-Allow-*`
719
+ headers. Preflight handling is skipped when the user has registered
720
+ an explicit OPTIONS method (their Lambda owns it). REST v1 CORS (Mock
721
+ OPTIONS method) is not auto-handled and stays out of scope; use the
722
+ deployed API for that case.
723
+
724
+ **Stage variables**: `event.stageVariables` is populated from the
725
+ selected Stage's `Variables` (REST v1) / `StageVariables` (HTTP API
726
+ v2) map. Default selection is the first Stage attached to each API;
727
+ pass `--stage <name>` to pick a Stage by `StageName`. Function URL
728
+ routes don't have a Stage — `event.stageVariables` stays `null`.
729
+
686
730
  See [docs/cli-reference.md](docs/cli-reference.md#local-start-api-long-running-local-api-server)
687
731
  for the full route-discovery rules, container-pool semantics, exit
688
732
  codes, and per-authorizer-kind detection / response-shape details.