@go-to-k/cdkd 0.161.3 → 0.161.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
@@ -47040,6 +47040,7 @@ function discoverFunctionUrl(logicalId, resource, template, stackName) {
47040
47040
  apiVersion: "v2",
47041
47041
  stage: "$default",
47042
47042
  apiStackName: stackName,
47043
+ apiLogicalId: logicalId,
47043
47044
  ...lambdaCdkPath !== void 0 && { apiCdkPath: lambdaCdkPath },
47044
47045
  declaredAt: `${stackName}/${logicalId}`
47045
47046
  };
@@ -50800,17 +50801,32 @@ function isPlaceholder(segment) {
50800
50801
  //#endregion
50801
50802
  //#region src/local/cors-handler.ts
50802
50803
  /**
50803
- * Build a `apiLogicalId → CorsConfig | undefined` map. Walks the
50804
- * template once, picks every `AWS::ApiGatewayV2::Api`, and extracts its
50805
- * `Properties.CorsConfiguration` if any. APIs without CorsConfiguration
50806
- * (or whose CorsConfiguration is malformed) are NOT entered into the map.
50804
+ * Build a `logicalId → CorsConfig | undefined` map. Walks the template
50805
+ * once and picks two CORS-bearing resource types:
50806
+ *
50807
+ * - `AWS::ApiGatewayV2::Api` `Properties.CorsConfiguration`
50808
+ * (HTTP API v2; the original PR 8c surface)
50809
+ * - `AWS::Lambda::Url` → `Properties.Cors` (Function URL; issue #644)
50810
+ *
50811
+ * Both blocks are field-for-field identical in CFn schema (same
50812
+ * `AllowOrigins` / `AllowMethods` / `AllowHeaders` / `ExposeHeaders` /
50813
+ * `MaxAge` / `AllowCredentials`), so a single parser handles both. The
50814
+ * map key is the resource's own logical ID — that ID is later looked up
50815
+ * against `DiscoveredRoute.apiLogicalId` (set to the surface-bearing
50816
+ * resource at route-discovery time) so the preflight interceptor finds
50817
+ * the right config.
50818
+ *
50819
+ * Resources without a CORS block (or whose block is malformed) are NOT
50820
+ * entered into the map.
50807
50821
  */
50808
50822
  function buildCorsConfigByApiId(template) {
50809
50823
  const out = /* @__PURE__ */ new Map();
50810
50824
  const resources = template.Resources ?? {};
50811
50825
  for (const [logicalId, resource] of Object.entries(resources)) {
50812
- if (resource.Type !== "AWS::ApiGatewayV2::Api") continue;
50813
- const raw = (resource.Properties ?? {})["CorsConfiguration"];
50826
+ let raw;
50827
+ if (resource.Type === "AWS::ApiGatewayV2::Api") raw = (resource.Properties ?? {})["CorsConfiguration"];
50828
+ else if (resource.Type === "AWS::Lambda::Url") raw = (resource.Properties ?? {})["Cors"];
50829
+ else continue;
50814
50830
  if (!raw || typeof raw !== "object" || Array.isArray(raw)) continue;
50815
50831
  const parsed = parseCorsConfiguration(raw);
50816
50832
  if (parsed) out.set(logicalId, parsed);
@@ -59764,7 +59780,7 @@ function reorderArgs(argv) {
59764
59780
  */
59765
59781
  async function main() {
59766
59782
  const program = new Command();
59767
- program.name("cdkd").description("CDK Direct - Deploy AWS CDK apps directly via SDK/Cloud Control API").version("0.161.3");
59783
+ program.name("cdkd").description("CDK Direct - Deploy AWS CDK apps directly via SDK/Cloud Control API").version("0.161.4");
59768
59784
  program.addCommand(createBootstrapCommand());
59769
59785
  program.addCommand(createSynthCommand());
59770
59786
  program.addCommand(createListCommand());