@webiny/project-aws 6.6.0-alpha.0 → 6.6.0-alpha.2

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.
Files changed (40) hide show
  1. package/_templates/appTemplates/api/graphql/src/index.ts +12 -1
  2. package/_templates/extensions/OpenSearch/api/graphql/src/index.ts +9 -1
  3. package/apps/createApiApp.d.ts +8 -0
  4. package/extensions/ApiRoute.d.ts +1 -1
  5. package/extensions/ApiRoute.js +14 -1
  6. package/extensions/ApiRoute.js.map +1 -1
  7. package/extensions/ProjectAws/AutoInstall/AutoInstallAfterApiDeploy.d.ts +1 -1
  8. package/extensions/ProjectAws/AutoInstall/AutoInstallAfterApiDeploy.js +1 -2
  9. package/extensions/ProjectAws/AutoInstall/AutoInstallAfterApiDeploy.js.map +1 -1
  10. package/extensions/ProjectAws/EnsureAwsCredentialsBeforeDeploy.js +1 -1
  11. package/extensions/ProjectAws/EnsureAwsCredentialsBeforeDeploy.js.map +1 -1
  12. package/extensions/RegisterRoutesPulumi.js +2 -5
  13. package/extensions/RegisterRoutesPulumi.js.map +1 -1
  14. package/extensions/routePath.d.ts +20 -0
  15. package/extensions/routePath.js +13 -0
  16. package/extensions/routePath.js.map +1 -0
  17. package/package.json +15 -15
  18. package/project.d.ts +16 -11
  19. package/pulumi/apps/api/ApiCloudfront.js +103 -1
  20. package/pulumi/apps/api/ApiCloudfront.js.map +1 -1
  21. package/pulumi/apps/api/ApiGraphqlStream.d.ts +29 -0
  22. package/pulumi/apps/api/ApiGraphqlStream.js +58 -0
  23. package/pulumi/apps/api/ApiGraphqlStream.js.map +1 -0
  24. package/pulumi/apps/api/createApiPulumiApp.d.ts +8 -0
  25. package/pulumi/apps/api/createApiPulumiApp.js +24 -17
  26. package/pulumi/apps/api/createApiPulumiApp.js.map +1 -1
  27. package/pulumi/apps/api/index.d.ts +1 -0
  28. package/pulumi/apps/api/index.js +1 -0
  29. package/pulumi/apps/awsUtils.d.ts +1 -1
  30. package/pulumi/apps/core/CoreCognito.d.ts +1 -0
  31. package/pulumi/apps/core/CoreCognito.js +4 -1
  32. package/pulumi/apps/core/CoreCognito.js.map +1 -1
  33. package/pulumi/apps/core/cognitoIdentityProviders/configure.js +9 -1
  34. package/pulumi/apps/core/cognitoIdentityProviders/configure.js.map +1 -1
  35. package/pulumi/apps/core/createCorePulumiApp.js +18 -2
  36. package/pulumi/apps/core/createCorePulumiApp.js.map +1 -1
  37. package/pulumi/apps/syncSystem/SyncSystemLambda.d.ts +1 -1
  38. package/pulumi/apps/syncSystem/SyncSystemLambda.js +1 -1
  39. package/pulumi/apps/syncSystem/SyncSystemLambda.js.map +1 -1
  40. package/pulumi/extensions/index.d.ts +16 -16
@@ -4,8 +4,19 @@
4
4
  * The composition root lives in @webiny/api-event-handler-aws-ddb (`createAwsDdbApiHandler`) so the wiring
5
5
  * is a real, testable package rather than template code. This file only supplies project-specific
6
6
  * extensions.
7
+ *
8
+ * Two handlers are exported from this one bundle and deployed as two Lambda functions:
9
+ * - `handler` — behind API Gateway, buffered responses. Everything except streaming routes.
10
+ * - `streamHandler` — behind a Lambda Function URL with `InvokeMode: RESPONSE_STREAM`, for routes that
11
+ * stream (e.g. `/stream/*`). A separate function is required because a Lambda's handler entry is
12
+ * fixed per function, and API Gateway buffers the whole response so it cannot stream at all.
7
13
  */
8
- import { createAwsDdbApiHandler } from "@webiny/api-event-handler-aws-ddb";
14
+ import {
15
+ createAwsDdbApiHandler,
16
+ createAwsDdbStreamApiHandler
17
+ } from "@webiny/api-event-handler-aws-ddb";
9
18
  import { extensions } from "./extensions";
10
19
 
11
20
  export const handler = createAwsDdbApiHandler({ extensions });
21
+
22
+ export const streamHandler = createAwsDdbStreamApiHandler({ extensions });
@@ -5,8 +5,16 @@
5
5
  * wiring is a real, testable package rather than template code. The OpenSearch extension's
6
6
  * ReplaceApiLambdaFnHandlers copies this file over the api workspace when OpenSearch is enabled.
7
7
  * This file only supplies project-specific extensions.
8
+ *
9
+ * Exports both the buffered (API Gateway) and the response-streaming (Function URL) handler; see the
10
+ * DynamoDB variant of this file for why streaming needs its own Lambda function.
8
11
  */
9
- import { createAwsDdbOsApiHandler } from "@webiny/api-event-handler-aws-ddb-os";
12
+ import {
13
+ createAwsDdbOsApiHandler,
14
+ createAwsDdbOsStreamApiHandler
15
+ } from "@webiny/api-event-handler-aws-ddb-os";
10
16
  import { extensions } from "./extensions";
11
17
 
12
18
  export const handler = createAwsDdbOsApiHandler({ extensions });
19
+
20
+ export const streamHandler = createAwsDdbOsStreamApiHandler({ extensions });
@@ -22,6 +22,14 @@ export declare function createApiApp(): {
22
22
  };
23
23
  addRoute: (routeParams: import("~/pulumi/index.js").AddRouteParams) => any;
24
24
  };
25
+ graphqlStream: {
26
+ role: import("@webiny/pulumi/PulumiAppResource").PulumiAppResource<typeof import("@pulumi/aws/iam/role").Role>;
27
+ functions: {
28
+ graphqlStream: import("@webiny/pulumi/PulumiAppResource").PulumiAppResource<typeof import("@pulumi/aws/lambda/function").Function>;
29
+ };
30
+ functionUrl: import("@webiny/pulumi/PulumiAppResource").PulumiAppResource<typeof import("@pulumi/aws/lambda/functionUrl").FunctionUrl>;
31
+ functionUrlDomain: import("@pulumi/pulumi").Output<string>;
32
+ };
25
33
  apiGateway: {
26
34
  api: import("@webiny/pulumi/PulumiAppResource").PulumiAppResource<typeof import("@pulumi/aws/apigatewayv2/api").Api>;
27
35
  stage: import("@webiny/pulumi/PulumiAppResource").PulumiAppResource<typeof import("@pulumi/aws/apigatewayv2/stage").Stage>;
@@ -1,5 +1,5 @@
1
1
  import { z } from "zod";
2
- export declare const ApiRoute: import("@webiny/project/extensions").ExtensionComponent<z.ZodObject<{
2
+ export declare const ApiRoute: import("@webiny/project/defineExtension/defineExtension.js").ExtensionComponent<z.ZodObject<{
3
3
  path: z.ZodString;
4
4
  method: z.ZodEnum<{
5
5
  ANY: "ANY";
@@ -8,6 +8,7 @@ import { zodSrcPath } from "@webiny/project/defineExtension/zodTypes/zodSrcPath.
8
8
  import { ExtensionSrcResolver } from "@webiny/project/utils/index.js";
9
9
  import { ApiPulumi } from "../pulumi/extensions/ApiPulumi.js";
10
10
  import { createPathResolver } from "@webiny/project";
11
+ import { deriveRouteName, toRouterPath } from "./routePath.js";
11
12
  const p = createPathResolver(import.meta.dirname);
12
13
  const HTTP_METHODS = [
13
14
  "DELETE",
@@ -62,8 +63,20 @@ const ApiRoute = defineExtension({
62
63
  moduleSpecifier: registerExtensionPluginPath
63
64
  });
64
65
  }
66
+ const eventHandlerCorePath = "@webiny/event-handler-core";
67
+ if (!source.getImportDeclaration(eventHandlerCorePath)) {
68
+ const lastIdx = source.getImportDeclarations()[source.getImportDeclarations().length - 1].getChildIndex() + 1;
69
+ source.insertImportDeclaration(lastIdx, {
70
+ namedImports: [
71
+ "createHttpRouteDefinition"
72
+ ],
73
+ moduleSpecifier: eventHandlerCorePath
74
+ });
75
+ }
65
76
  const pluginsArray = source.getFirstDescendant((node)=>Node.isArrayLiteralExpression(node));
66
- pluginsArray.addElement(`\ncreateRegisterExtensionPlugin(ctx => {\n\tregisterExtension(ctx.container, ${alias});\n})`);
77
+ const routerPath = toRouterPath(params.path);
78
+ const routeName = params.routeName ?? deriveRouteName(params.path, params.method);
79
+ pluginsArray.addElement(`\ncreateRegisterExtensionPlugin(ctx => {\n\tctx.container.register(\n\t\tcreateHttpRouteDefinition({\n\t\t\tname: "${routeName}",\n\t\t\tmethod: "${params.method}",\n\t\t\tpath: "${routerPath}",\n\t\t\thandler: ${alias}\n\t\t})\n\t);\n})`);
67
80
  await source.save();
68
81
  },
69
82
  render () {
@@ -1 +1 @@
1
- {"version":3,"file":"extensions/ApiRoute.js","sources":["../../src/extensions/ApiRoute.tsx"],"sourcesContent":["import React from \"react\";\nimport path from \"path\";\nimport crypto from \"crypto\";\nimport { z } from \"zod\";\nimport { Node, Project, ArrayLiteralExpression } from \"ts-morph\";\nimport { defineExtension } from \"@webiny/project/defineExtension/index.js\";\nimport { zodSrcPath } from \"@webiny/project/defineExtension/zodTypes/zodSrcPath.js\";\nimport { ExtensionSrcResolver } from \"@webiny/project/utils/index.js\";\nimport { ApiPulumi } from \"~/pulumi/extensions/ApiPulumi.js\";\nimport { createPathResolver } from \"@webiny/project\";\n\nconst p = createPathResolver(import.meta.dirname);\n\nconst HTTP_METHODS = [\"DELETE\", \"GET\", \"HEAD\", \"PATCH\", \"POST\", \"PUT\", \"OPTIONS\", \"ANY\"] as const;\n\nexport const ApiRoute = defineExtension({\n type: \"Api/Route\",\n tags: { runtimeContext: \"app-build\", appName: \"api\" },\n description: \"Register a custom REST route on the API Gateway + GraphQL Lambda.\",\n multiple: true,\n paramsSchema: ({ project }) => {\n return z.object({\n path: z.string().startsWith(\"/\"),\n method: z.enum(HTTP_METHODS),\n // The `src` file must default-export an HttpRoute implementation\n // (HttpRoute.createImplementation from @webiny/event-handler-core), the same shape as\n // the framework's own routes (e.g. createCmsRoute). Its `method`/`path` must match the\n // `method`/`path` params here (used to configure the API Gateway route).\n src: zodSrcPath({ project }),\n routeName: z.string().optional()\n });\n },\n async build(params, ctx) {\n const extensionsTsFilePath = ctx.project.paths.workspaceFolder\n .join(\"apps\", \"api\", \"graphql\", \"src\", \"extensions.ts\")\n .toString();\n\n const absoluteSrcFilePath = ExtensionSrcResolver.resolvePath(params.src, ctx.project);\n\n // Stable alias to avoid naming conflicts across multiple routes.\n const hash = crypto.createHash(\"sha256\").update(params.src).digest(\"hex\");\n const alias = `ApiRoute_${hash.slice(-10)}`;\n\n const importPath = path\n .relative(path.dirname(extensionsTsFilePath), absoluteSrcFilePath)\n .replace(/\\.tsx?$/, \".js\");\n\n const tsProject = new Project();\n tsProject.addSourceFileAtPath(extensionsTsFilePath);\n const source = tsProject.getSourceFileOrThrow(extensionsTsFilePath);\n\n // Skip if the route handler is already registered.\n if (source.getImportDeclaration(importPath)) {\n return;\n }\n\n // Insert handler import after the last existing import.\n let insertIndex = 1;\n const importDeclarations = source.getImportDeclarations();\n if (importDeclarations.length) {\n insertIndex = importDeclarations[importDeclarations.length - 1].getChildIndex() + 1;\n }\n\n source.insertImportDeclaration(insertIndex, {\n defaultImport: alias,\n moduleSpecifier: importPath\n });\n\n // Ensure createRegisterExtensionPlugin import exists.\n const registerExtensionPluginPath = \"@webiny/handler/plugins/RegisterExtensionPlugin.js\";\n if (!source.getImportDeclaration(registerExtensionPluginPath)) {\n const lastIdx =\n source\n .getImportDeclarations()\n [source.getImportDeclarations().length - 1].getChildIndex() + 1;\n source.insertImportDeclaration(lastIdx, {\n namedImports: [\"createRegisterExtensionPlugin\"],\n moduleSpecifier: registerExtensionPluginPath\n });\n }\n\n const pluginsArray = source.getFirstDescendant(node =>\n Node.isArrayLiteralExpression(node)\n ) as ArrayLiteralExpression;\n\n // Register the route's HttpRoute implementation in the DI container. The DI HttpRouter\n // resolves every registered HttpRoute and dispatches by matching the request method/path\n // against each route's own `method`/`path` — no explicit route wiring needed.\n pluginsArray.addElement(\n `\\ncreateRegisterExtensionPlugin(ctx => {\\n\\tregisterExtension(ctx.container, ${alias});\\n})`\n );\n\n await source.save();\n },\n render() {\n return <ApiPulumi src={p(\"RegisterRoutesPulumi.js\")} />;\n }\n});\n"],"names":["p","createPathResolver","HTTP_METHODS","ApiRoute","defineExtension","project","z","zodSrcPath","params","ctx","extensionsTsFilePath","absoluteSrcFilePath","ExtensionSrcResolver","hash","crypto","alias","importPath","path","tsProject","Project","source","insertIndex","importDeclarations","registerExtensionPluginPath","lastIdx","pluginsArray","node","Node","ApiPulumi"],"mappings":";;;;;;;;;;AAWA,MAAMA,IAAIC,mBAAmB,YAAY,OAAO;AAEhD,MAAMC,eAAe;IAAC;IAAU;IAAO;IAAQ;IAAS;IAAQ;IAAO;IAAW;CAAM;AAEjF,MAAMC,WAAWC,gBAAgB;IACpC,MAAM;IACN,MAAM;QAAE,gBAAgB;QAAa,SAAS;IAAM;IACpD,aAAa;IACb,UAAU;IACV,cAAc,CAAC,EAAEC,OAAO,EAAE,GACfC,EAAE,MAAM,CAAC;YAC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BAAgC;gBAC/C,iBAAiBD;YACrB;QACJ;QAEA,MAAME,eAAeL,OAAO,kBAAkB,CAACM,CAAAA,OAC3CC,KAAK,wBAAwB,CAACD;QAMlCD,aAAa,UAAU,CACnB,CAAC,6EAA6E,EAAEV,MAAM,MAAM,CAAC;QAGjG,MAAMK,OAAO,IAAI;IACrB;IACA;QACI,OAAO,WAAP,GAAO,oBAACQ,WAASA;YAAC,KAAK5B,EAAE;;IAC7B;AACJ"}
1
+ {"version":3,"file":"extensions/ApiRoute.js","sources":["../../src/extensions/ApiRoute.tsx"],"sourcesContent":["import React from \"react\";\nimport path from \"path\";\nimport crypto from \"crypto\";\nimport { z } from \"zod\";\nimport { Node, Project, ArrayLiteralExpression } from \"ts-morph\";\nimport { defineExtension } from \"@webiny/project/defineExtension/index.js\";\nimport { zodSrcPath } from \"@webiny/project/defineExtension/zodTypes/zodSrcPath.js\";\nimport { ExtensionSrcResolver } from \"@webiny/project/utils/index.js\";\nimport { ApiPulumi } from \"~/pulumi/extensions/ApiPulumi.js\";\nimport { createPathResolver } from \"@webiny/project\";\nimport { deriveRouteName, toRouterPath } from \"./routePath.js\";\n\nconst p = createPathResolver(import.meta.dirname);\n\nconst HTTP_METHODS = [\"DELETE\", \"GET\", \"HEAD\", \"PATCH\", \"POST\", \"PUT\", \"OPTIONS\", \"ANY\"] as const;\n\nexport const ApiRoute = defineExtension({\n type: \"Api/Route\",\n tags: { runtimeContext: \"app-build\", appName: \"api\" },\n description: \"Register a custom REST route on the API Gateway + GraphQL Lambda.\",\n multiple: true,\n paramsSchema: ({ project }) => {\n return z.object({\n // Path parameters may be written `{orderId}` (API Gateway) or `:orderId` (the DI\n // router). Both are accepted and converted per consumer — see `routePath.ts`.\n path: z.string().startsWith(\"/\"),\n method: z.enum(HTTP_METHODS),\n // The `src` file must default-export a route HANDLER — the result of\n // `HttpRouteHandler.createImplementation` from `@webiny/event-handler-core`. It does\n // NOT declare its own method/path: the `HttpRouteDefinition` the router matches on is\n // generated below from the props here, so the route the gateway forwards to and the\n // route the router matches cannot drift apart.\n src: zodSrcPath({ project }),\n // Doubles as the route's DI name, so a decorator on HttpRouteDefinition can pick this\n // route out by it. Derived from path + method when omitted, same as the Pulumi name.\n routeName: z.string().optional()\n });\n },\n async build(params, ctx) {\n const extensionsTsFilePath = ctx.project.paths.workspaceFolder\n .join(\"apps\", \"api\", \"graphql\", \"src\", \"extensions.ts\")\n .toString();\n\n const absoluteSrcFilePath = ExtensionSrcResolver.resolvePath(params.src, ctx.project);\n\n // Stable alias to avoid naming conflicts across multiple routes.\n const hash = crypto.createHash(\"sha256\").update(params.src).digest(\"hex\");\n const alias = `ApiRoute_${hash.slice(-10)}`;\n\n const importPath = path\n .relative(path.dirname(extensionsTsFilePath), absoluteSrcFilePath)\n .replace(/\\.tsx?$/, \".js\");\n\n const tsProject = new Project();\n tsProject.addSourceFileAtPath(extensionsTsFilePath);\n const source = tsProject.getSourceFileOrThrow(extensionsTsFilePath);\n\n // Skip if the route handler is already registered.\n if (source.getImportDeclaration(importPath)) {\n return;\n }\n\n // Insert handler import after the last existing import.\n let insertIndex = 1;\n const importDeclarations = source.getImportDeclarations();\n if (importDeclarations.length) {\n insertIndex = importDeclarations[importDeclarations.length - 1].getChildIndex() + 1;\n }\n\n source.insertImportDeclaration(insertIndex, {\n defaultImport: alias,\n moduleSpecifier: importPath\n });\n\n // Ensure createRegisterExtensionPlugin import exists.\n const registerExtensionPluginPath = \"@webiny/handler/plugins/RegisterExtensionPlugin.js\";\n if (!source.getImportDeclaration(registerExtensionPluginPath)) {\n const lastIdx =\n source\n .getImportDeclarations()\n [source.getImportDeclarations().length - 1].getChildIndex() + 1;\n source.insertImportDeclaration(lastIdx, {\n namedImports: [\"createRegisterExtensionPlugin\"],\n moduleSpecifier: registerExtensionPluginPath\n });\n }\n\n // Ensure createHttpRouteDefinition import exists.\n const eventHandlerCorePath = \"@webiny/event-handler-core\";\n if (!source.getImportDeclaration(eventHandlerCorePath)) {\n const lastIdx =\n source\n .getImportDeclarations()\n [source.getImportDeclarations().length - 1].getChildIndex() + 1;\n source.insertImportDeclaration(lastIdx, {\n namedImports: [\"createHttpRouteDefinition\"],\n moduleSpecifier: eventHandlerCorePath\n });\n }\n\n const pluginsArray = source.getFirstDescendant(node =>\n Node.isArrayLiteralExpression(node)\n ) as ArrayLiteralExpression;\n\n // Register an HttpRouteDefinition built from the props above. The router matches on\n // definitions and only then builds the handler, so registering the handler alone would\n // leave the route unreachable: it deploys, API Gateway forwards to the Lambda, and dispatch\n // finds nothing. The path is converted to the router's `:param` syntax.\n const routerPath = toRouterPath(params.path);\n const routeName = params.routeName ?? deriveRouteName(params.path, params.method);\n\n pluginsArray.addElement(\n `\\ncreateRegisterExtensionPlugin(ctx => {\\n\\tctx.container.register(\\n\\t\\tcreateHttpRouteDefinition({\\n\\t\\t\\tname: \"${routeName}\",\\n\\t\\t\\tmethod: \"${params.method}\",\\n\\t\\t\\tpath: \"${routerPath}\",\\n\\t\\t\\thandler: ${alias}\\n\\t\\t})\\n\\t);\\n})`\n );\n\n await source.save();\n },\n render() {\n return <ApiPulumi src={p(\"RegisterRoutesPulumi.js\")} />;\n }\n});\n"],"names":["p","createPathResolver","HTTP_METHODS","ApiRoute","defineExtension","project","z","zodSrcPath","params","ctx","extensionsTsFilePath","absoluteSrcFilePath","ExtensionSrcResolver","hash","crypto","alias","importPath","path","tsProject","Project","source","insertIndex","importDeclarations","registerExtensionPluginPath","lastIdx","eventHandlerCorePath","pluginsArray","node","Node","routerPath","toRouterPath","routeName","deriveRouteName","ApiPulumi"],"mappings":";;;;;;;;;;;AAYA,MAAMA,IAAIC,mBAAmB,YAAY,OAAO;AAEhD,MAAMC,eAAe;IAAC;IAAU;IAAO;IAAQ;IAAS;IAAQ;IAAO;IAAW;CAAM;AAEjF,MAAMC,WAAWC,gBAAgB;IACpC,MAAM;IACN,MAAM;QAAE,gBAAgB;QAAa,SAAS;IAAM;IACpD,aAAa;IACb,UAAU;IACV,cAAc,CAAC,EAA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,uBAAuB,CAACI,SAAS;gBACpC,cAAc;oBAAC;iBAAgC;gBAC/C,iBAAiBD;YACrB;QACJ;QAGA,MAAME,uBAAuB;QAC7B,IAAI,CAACL,OAAO,oBAAoB,CAACK,uBAAuB;YACpD,MAAMD,UACFJ,OACK,qBAAqB,EACtB,CAACA,OAAO,qBAAqB,GAAG,MAAM,GAAG,EAAE,CAAC,aAAa,KAAK;YACtEA,OAAO,uBAAuB,CAACI,SAAS;gBACpC,cAAc;oBAAC;iBAA4B;gBAC3C,iBAAiBC;YACrB;QACJ;QAEA,MAAMC,eAAeN,OAAO,kBAAkB,CAACO,CAAAA,OAC3CC,KAAK,wBAAwB,CAACD;QAOlC,MAAME,aAAaC,aAAatB,OAAO,IAAI;QAC3C,MAAMuB,YAAYvB,OAAO,SAAS,IAAIwB,gBAAgBxB,OAAO,IAAI,EAAEA,OAAO,MAAM;QAEhFkB,aAAa,UAAU,CACnB,CAAC,mHAAmH,EAAEK,UAAU,mBAAmB,EAAEvB,OAAO,MAAM,CAAC,iBAAiB,EAAEqB,WAAW,mBAAmB,EAAEd,MAAM,kBAAkB,CAAC;QAGnP,MAAMK,OAAO,IAAI;IACrB;IACA;QACI,OAAO,WAAP,GAAO,oBAACa,WAASA;YAAC,KAAKjC,EAAE;;IAC7B;AACJ"}
@@ -1,7 +1,7 @@
1
1
  import { ApiAfterDeploy } from "@webiny/project/abstractions/index.js";
2
2
  import { UiService } from "@webiny/project/abstractions/services/UiService.js";
3
3
  import { LoggerService } from "@webiny/project/abstractions/services/LoggerService.js";
4
- import { GetProjectConfigService } from "@webiny/project/abstractions";
4
+ import { GetProjectConfigService } from "@webiny/project/abstractions/index.js";
5
5
  import { ApiGqlClient } from "../../../abstractions/ApiGqlClient.js";
6
6
  declare class AutoInstallAfterApiDeployImpl implements ApiAfterDeploy.Interface {
7
7
  private apiGqlClient;
@@ -1,7 +1,6 @@
1
- import { ApiAfterDeploy } from "@webiny/project/abstractions/index.js";
1
+ import { ApiAfterDeploy, GetProjectConfigService } from "@webiny/project/abstractions/index.js";
2
2
  import { UiService } from "@webiny/project/abstractions/services/UiService.js";
3
3
  import { LoggerService } from "@webiny/project/abstractions/services/LoggerService.js";
4
- import { GetProjectConfigService } from "@webiny/project/abstractions";
5
4
  import { ApiGqlClient } from "../../../abstractions/ApiGqlClient.js";
6
5
  const IS_INSTALLED_QUERY = `
7
6
  query IsSystemInstalled {
@@ -1 +1 @@
1
- {"version":3,"file":"extensions/ProjectAws/AutoInstall/AutoInstallAfterApiDeploy.js","sources":["../../../../src/extensions/ProjectAws/AutoInstall/AutoInstallAfterApiDeploy.ts"],"sourcesContent":["import { ApiAfterDeploy } from \"@webiny/project/abstractions/index.js\";\nimport { UiService } from \"@webiny/project/abstractions/services/UiService.js\";\nimport { LoggerService } from \"@webiny/project/abstractions/services/LoggerService.js\";\nimport { GetProjectConfigService } from \"@webiny/project/abstractions\";\nimport { ApiGqlClient } from \"~/abstractions/ApiGqlClient.js\";\n\nconst IS_INSTALLED_QUERY = `\n query IsSystemInstalled {\n system {\n isSystemInstalled {\n data\n error {\n message\n code\n }\n }\n }\n }\n`;\n\nconst INSTALL_MUTATION = `\n mutation InstallSystem($installationInput: JSON!) {\n system {\n installSystem(installationInput: $installationInput) {\n data\n error {\n message\n code\n }\n }\n }\n }\n`;\n\ninterface IsInstalledResponse {\n system: {\n isSystemInstalled: {\n data: boolean;\n error?: {\n message: string;\n code: string;\n };\n };\n };\n}\n\ninterface InstallResponse {\n system: {\n installSystem: {\n data: boolean;\n error?: {\n message: string;\n code: string;\n };\n };\n };\n}\n\nclass AutoInstallAfterApiDeployImpl implements ApiAfterDeploy.Interface {\n constructor(\n private apiGqlClient: ApiGqlClient.Interface,\n private ui: UiService.Interface,\n private getProjectConfig: GetProjectConfigService.Interface,\n private logger: LoggerService.Interface\n ) {}\n\n async execute(params: ApiAfterDeploy.Params): Promise<void> {\n if (params.preview) {\n // Skip auto-install on preview deployments\n return;\n }\n\n const projectConfig = await this.getProjectConfig.execute();\n const adminAutoInstallExtensions = projectConfig.extensionsByType(\"Project/AutoInstall\");\n\n if (adminAutoInstallExtensions.length === 0) {\n return;\n }\n\n const config = adminAutoInstallExtensions[0].params;\n\n // Check if system is already installed\n this.ui.info(\"Checking if system is already installed...\");\n\n try {\n const isInstalledResponse = await this.apiGqlClient.query<IsInstalledResponse>({\n query: IS_INSTALLED_QUERY\n });\n\n if (isInstalledResponse.data?.system.isSystemInstalled.data === true) {\n this.ui.info(\"System is already installed, skipping auto-install.\");\n return;\n }\n } catch (error: any) {\n this.logger.error(\"Failed to check installation status\", { error });\n this.ui.warning(`Could not check installation status: ${error.message}`);\n return;\n }\n\n this.ui.info(\"Auto-installing...\");\n /**\n * Type Error introduced with Zod v4. V3 had any type.\n */\n // @ts-expect-error\n const adminUser = config.adminUser || {\n firstName: \"John\",\n lastName: \"Smith\",\n email: \"admin@webiny.com\",\n password: \"12345678\"\n };\n\n const variables = {\n installationInput: [\n {\n app: \"Cognito\",\n data: adminUser\n }\n ]\n };\n\n const installResponse = await this.apiGqlClient.mutation<InstallResponse>({\n mutation: INSTALL_MUTATION,\n variables\n });\n\n if (installResponse.data?.system.installSystem.error) {\n const { message, code } = installResponse.data.system.installSystem.error;\n this.logger.error(\"Installation failed\", { message, code });\n this.ui.error(`Installation failed: ${message} (${code})`);\n throw new Error(message);\n }\n\n this.ui.success(\"System installed successfully!\");\n this.ui.info(\"Admin credentials:\");\n this.ui.info(` Email: ${adminUser.email}`);\n this.ui.info(` Password: ${adminUser.password}`);\n }\n}\n\nexport const AutoInstallAfterApiDeploy = ApiAfterDeploy.createImplementation({\n implementation: AutoInstallAfterApiDeployImpl,\n dependencies: [ApiGqlClient, UiService, GetProjectConfigService, LoggerService]\n});\n"],"names":["IS_INSTALLED_QUERY","INSTALL_MUTATION","AutoInstallAfterApiDeployImpl","apiGqlClient","ui","getProjectConfig","logger","params","projectConfig","adminAutoInstallExtensions","config","isInstalledResponse","error","adminUser","variables","installResponse","message","code","Error","AutoInst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L,MAAMD;gBACV;aACH;QACL;QAEA,MAAME,kBAAkB,MAAM,IAAI,CAAC,YAAY,CAAC,QAAQ,CAAkB;YACtE,UAAUd;YACVa;QACJ;QAEA,IAAIC,gBAAgB,IAAI,EAAE,OAAO,cAAc,OAAO;YAClD,MAAM,EAAEC,OAAO,EAAEC,IAAI,EAAE,GAAGF,gBAAgB,IAAI,CAAC,MAAM,CAAC,aAAa,CAAC,KAAK;YACzE,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,uBAAuB;gBAAEC;gBAASC;YAAK;YACzD,IAAI,CAAC,EAAE,CAAC,KAAK,CAAC,CAAC,qBAAqB,EAAED,QAAQ,EAAE,EAAEC,KAAK,CAAC,CAAC;YACzD,MAAM,IAAIC,MAAMF;QACpB;QAEA,IAAI,CAAC,EAAE,CAAC,OAAO,CAAC;QAChB,IAAI,CAAC,EAAE,CAAC,IAAI,CAAC;QACb,IAAI,CAAC,EAAE,CAAC,IAAI,CAAC,CAAC,QAAQ,EAAEH,UAAU,KAAK,EAAE;QACzC,IAAI,CAAC,EAAE,CAAC,IAAI,CAAC,CAAC,WAAW,EAAEA,UAAU,QAAQ,EAAE;IACnD;AACJ;AAEO,MAAMM,4BAA4BC,eAAe,oBAAoB,CAAC;IACzE,gBAAgBlB;IAChB,cAAc;QAACmB;QAAcC;QAAWC;QAAyBC;KAAc;AACnF"}
1
+ {"version":3,"file":"extensions/ProjectAws/AutoInstall/AutoInstallAfterApiDeploy.js","sources":["../../../../src/extensions/ProjectAws/AutoInstall/AutoInstallAfterApiDeploy.ts"],"sourcesContent":["import { ApiAfterDeploy } from \"@webiny/project/abstractions/index.js\";\nimport { UiService } from \"@webiny/project/abstractions/services/UiService.js\";\nimport { LoggerService } from \"@webiny/project/abstractions/services/LoggerService.js\";\nimport { GetProjectConfigService } from \"@webiny/project/abstractions/index.js\";\nimport { ApiGqlClient } from \"~/abstractions/ApiGqlClient.js\";\n\nconst IS_INSTALLED_QUERY = `\n query IsSystemInstalled {\n system {\n isSystemInstalled {\n data\n error {\n message\n code\n }\n }\n }\n }\n`;\n\nconst INSTALL_MUTATION = `\n mutation InstallSystem($installationInput: JSON!) {\n system {\n installSystem(installationInput: $installationInput) {\n data\n error {\n message\n code\n }\n }\n }\n }\n`;\n\ninterface IsInstalledResponse {\n system: {\n isSystemInstalled: {\n data: boolean;\n error?: {\n message: string;\n code: string;\n };\n };\n };\n}\n\ninterface InstallResponse {\n system: {\n installSystem: {\n data: boolean;\n error?: {\n message: string;\n code: string;\n };\n };\n };\n}\n\nclass AutoInstallAfterApiDeployImpl implements ApiAfterDeploy.Interface {\n constructor(\n private apiGqlClient: ApiGqlClient.Interface,\n private ui: UiService.Interface,\n private getProjectConfig: GetProjectConfigService.Interface,\n private logger: LoggerService.Interface\n ) {}\n\n async execute(params: ApiAfterDeploy.Params): Promise<void> {\n if (params.preview) {\n // Skip auto-install on preview deployments\n return;\n }\n\n const projectConfig = await this.getProjectConfig.execute();\n const adminAutoInstallExtensions = projectConfig.extensionsByType(\"Project/AutoInstall\");\n\n if (adminAutoInstallExtensions.length === 0) {\n return;\n }\n\n const config = adminAutoInstallExtensions[0].params;\n\n // Check if system is already installed\n this.ui.info(\"Checking if system is already installed...\");\n\n try {\n const isInstalledResponse = await this.apiGqlClient.query<IsInstalledResponse>({\n query: IS_INSTALLED_QUERY\n });\n\n if (isInstalledResponse.data?.system.isSystemInstalled.data === true) {\n this.ui.info(\"System is already installed, skipping auto-install.\");\n return;\n }\n } catch (error: any) {\n this.logger.error(\"Failed to check installation status\", { error });\n this.ui.warning(`Could not check installation status: ${error.message}`);\n return;\n }\n\n this.ui.info(\"Auto-installing...\");\n /**\n * Type Error introduced with Zod v4. V3 had any type.\n */\n // @ts-expect-error\n const adminUser = config.adminUser || {\n firstName: \"John\",\n lastName: \"Smith\",\n email: \"admin@webiny.com\",\n password: \"12345678\"\n };\n\n const variables = {\n installationInput: [\n {\n app: \"Cognito\",\n data: adminUser\n }\n ]\n };\n\n const installResponse = await this.apiGqlClient.mutation<InstallResponse>({\n mutation: INSTALL_MUTATION,\n variables\n });\n\n if (installResponse.data?.system.installSystem.error) {\n const { message, code } = installResponse.data.system.installSystem.error;\n this.logger.error(\"Installation failed\", { message, code });\n this.ui.error(`Installation failed: ${message} (${code})`);\n throw new Error(message);\n }\n\n this.ui.success(\"System installed successfully!\");\n this.ui.info(\"Admin credentials:\");\n this.ui.info(` Email: ${adminUser.email}`);\n this.ui.info(` Password: ${adminUser.password}`);\n }\n}\n\nexport const AutoInstallAfterApiDeploy = ApiAfterDeploy.createImplementation({\n implementation: AutoInstallAfterApiDeployImpl,\n dependencies: [ApiGqlClient, UiService, GetProjectConfigService, LoggerService]\n});\n"],"names":["IS_INSTALLED_QUERY","INSTALL_MUTATION","AutoInstallAfterApiDeployImpl","apiGqlClient","ui","getProjectConfig","logger","params","projectConfig","adminAutoInstallExtensions","config","isInstalledResponse","error","adminUser","variables","installResponse","message","code","Error","AutoInstallAfterApiDeploy","ApiAfterDeploy","ApiGqlClient","UiService","GetProjectConfigService","LoggerService"],"mappings":";;;;AAMA,MAAMA,qBAAqB,CAAC;;;;;;;;;;;;AAY5B,CAAC;AAED,MAAMC,mBAAmB,CAAC;;;;;;;;;;;;AAY1B,CAAC;AA0BD,MAAMC;IACF,YACYC,YAAoC,EACpCC,EAAuB,EACvBC,gBAAmD,EACnDC,MAA+B,CACzC;aAJUH,YAAY,GAAZA;aACAC,EAAE,GAAFA;aACAC,gBAAgB,GAAhBA;aACAC,MAAM,GAANA;IACT;IAEH,MAAM,QAAQC,MAA6B,EAAiB;QACxD,IAAIA,OAAO,OAAO,EAEd;QAGJ,MAAMC,gBAAgB,MAAM,IAAI,CAAC,gBAAgB,CAAC,OAAO;QACzD,MAAMC,6BAA6BD,cAAc,gBAAgB,CAAC;QAElE,IAAIC,AAAsC,MAAtCA,2BAA2B,MAAM,EACjC;QAGJ,MAAMC,SAASD,0BAA0B,CAAC,EAAE,CAAC,MAAM;QAGnD,IAAI,CAAC,EAAE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AAI,CAAC,EAAE,CAAC,IAAI,CAAC,CAAC,WAAW,EAAEA,UAAU,QAAQ,EAAE;IACnD;AACJ;AAEO,MAAMM,4BAA4BC,eAAe,oBAAoB,CAAC;IACzE,gBAAgBlB;IAChB,cAAc;QAACmB;QAAcC;QAAWC;QAAyBC;KAAc;AACnF"}
@@ -1,6 +1,6 @@
1
1
  import { BeforeDeploy, LoggerService } from "@webiny/project/abstractions/index.js";
2
2
  import { GracefulError } from "@webiny/project";
3
- import { STS } from "@webiny/aws-sdk/client-sts";
3
+ import { STS } from "@webiny/aws-sdk/client-sts/index.js";
4
4
  class EnsureAwsCredentialsBeforeDeployImpl {
5
5
  constructor(loggerService){
6
6
  this.loggerService = loggerService;
@@ -1 +1 @@
1
- {"version":3,"file":"extensions/ProjectAws/EnsureAwsCredentialsBeforeDeploy.js","sources":["../../../src/extensions/ProjectAws/EnsureAwsCredentialsBeforeDeploy.ts"],"sourcesContent":["import { BeforeDeploy, LoggerService } from \"@webiny/project/abstractions/index.js\";\nimport { GracefulError } from \"@webiny/project\";\nimport { STS } from \"@webiny/aws-sdk/client-sts\";\n\nclass EnsureAwsCredentialsBeforeDeployImpl implements BeforeDeploy.Interface {\n constructor(private loggerService: LoggerService.Interface) {}\n\n async execute() {\n process.env.AWS_SDK_LOAD_CONFIG = \"true\";\n const sts = new STS({});\n\n try {\n await sts.getCallerIdentity({});\n } catch (err) {\n this.loggerService.debug({ err }, \"AWS credentials error.\");\n throw GracefulError.from(\n new Error(\"AWS credentials are not configured correctly.\"),\n 'No valid AWS credentials were found. Run \"aws configure\" or set the AWS_ACCESS_KEY_ID and AWS_SECRET_ACCESS_KEY environment variables before deploying. Learn more: https://webiny.link/aws-credentials'\n );\n }\n\n const region = await sts.config.region();\n if (!region) {\n throw GracefulError.from(\n new Error(\"AWS region is not defined.\"),\n \"No AWS region is set. Define the AWS_REGION environment variable or set a default region in your AWS profile. Learn more: https://webiny.link/aws-region\"\n );\n }\n\n process.env.AWS_REGION = region;\n\n const { accessKeyId } = await sts.config.credentials();\n const profile = process.env.AWS_PROFILE;\n\n if (profile) {\n this.loggerService.info(`Using profile \"${profile}\" in \"${region}\" region.`);\n } else {\n this.loggerService.info(`Using access key ID \"${accessKeyId}\" in \"${region}\" region.`);\n }\n }\n}\n\nexport const EnsureAwsCredentialsBeforeDeploy = BeforeDeploy.createImplementation({\n implementation: EnsureAwsCredentialsBeforeDeployImpl,\n dependencies: [LoggerService]\n});\n"],"names":["EnsureAwsCredentialsBeforeDeployImpl","loggerService","process","sts","STS","err","GracefulError","Error","region","accessKeyId","profile","EnsureAwsCredentialsBeforeDeploy","BeforeDeploy","LoggerService"],"mappings":";;;AAIA,MAAMA;IACF,YAAoBC,aAAsC,CAAE;aAAxCA,aAAa,GAAbA;IAAyC;IAE7D,MAAM,UAAU;QACZC,QAAQ,GAAG,CAAC,mBAAmB,GAAG;QAClC,MAAMC,MAAM,IAAIC,IAAI,CAAC;QAErB,IAAI;YACA,MAAMD,IAAI,iBAAiB,CAAC,CAAC;QACjC,EAAE,OAAOE,KAAK;YACV,IAAI,CAAC,aAAa,CAAC,KAAK,CAAC;gBAAEA;YAAI,GAAG;YAClC,MAAMC,cAAc,IAAI,CACpB,IAAIC,MAAM,kDACV;QAER;QAEA,MAAMC,SAAS,MAAML,IAAI,MAAM,CAAC,MAAM;QACtC,IAAI,CAACK,QACD,MAAMF,cAAc,IAAI,CACpB,IAAIC,MAAM,+BACV;QAIRL,QAAQ,GAAG,CAAC,UAAU,GAAGM;QAEzB,MAAM,EAAEC,WAAW,EAAE,GAAG,MAAMN,IAAI,MAAM,CAAC,WAAW;QACpD,MAAMO,UAAUR,QAAQ,GAAG,CAAC,WAAW;QAEvC,IAAIQ,SACA,IAAI,CAAC,aAAa,CAAC,IAAI,CAAC,CAAC,eAAe,EAAEA,QAAQ,MAAM,EAAEF,OAAO,SAAS,CAAC;aAE3E,IAAI,CAAC,aAAa,CAAC,IAAI,CAAC,CAAC,qBAAqB,EAAEC,YAAY,MAAM,EAAED,OAAO,SAAS,CAAC;IAE7F;AACJ;AAEO,MAAMG,mCAAmCC,aAAa,oBAAoB,CAAC;IAC9E,gBAAgBZ;IAChB,cAAc;QAACa;KAAc;AACjC"}
1
+ {"version":3,"file":"extensions/ProjectAws/EnsureAwsCredentialsBeforeDeploy.js","sources":["../../../src/extensions/ProjectAws/EnsureAwsCredentialsBeforeDeploy.ts"],"sourcesContent":["import { BeforeDeploy, LoggerService } from \"@webiny/project/abstractions/index.js\";\nimport { GracefulError } from \"@webiny/project\";\nimport { STS } from \"@webiny/aws-sdk/client-sts/index.js\";\n\nclass EnsureAwsCredentialsBeforeDeployImpl implements BeforeDeploy.Interface {\n constructor(private loggerService: LoggerService.Interface) {}\n\n async execute() {\n process.env.AWS_SDK_LOAD_CONFIG = \"true\";\n const sts = new STS({});\n\n try {\n await sts.getCallerIdentity({});\n } catch (err) {\n this.loggerService.debug({ err }, \"AWS credentials error.\");\n throw GracefulError.from(\n new Error(\"AWS credentials are not configured correctly.\"),\n 'No valid AWS credentials were found. Run \"aws configure\" or set the AWS_ACCESS_KEY_ID and AWS_SECRET_ACCESS_KEY environment variables before deploying. Learn more: https://webiny.link/aws-credentials'\n );\n }\n\n const region = await sts.config.region();\n if (!region) {\n throw GracefulError.from(\n new Error(\"AWS region is not defined.\"),\n \"No AWS region is set. Define the AWS_REGION environment variable or set a default region in your AWS profile. Learn more: https://webiny.link/aws-region\"\n );\n }\n\n process.env.AWS_REGION = region;\n\n const { accessKeyId } = await sts.config.credentials();\n const profile = process.env.AWS_PROFILE;\n\n if (profile) {\n this.loggerService.info(`Using profile \"${profile}\" in \"${region}\" region.`);\n } else {\n this.loggerService.info(`Using access key ID \"${accessKeyId}\" in \"${region}\" region.`);\n }\n }\n}\n\nexport const EnsureAwsCredentialsBeforeDeploy = BeforeDeploy.createImplementation({\n implementation: EnsureAwsCredentialsBeforeDeployImpl,\n dependencies: [LoggerService]\n});\n"],"names":["EnsureAwsCredentialsBeforeDeployImpl","loggerService","process","sts","STS","err","GracefulError","Error","region","accessKeyId","profile","EnsureAwsCredentialsBeforeDeploy","BeforeDeploy","LoggerService"],"mappings":";;;AAIA,MAAMA;IACF,YAAoBC,aAAsC,CAAE;aAAxCA,aAAa,GAAbA;IAAyC;IAE7D,MAAM,UAAU;QACZC,QAAQ,GAAG,CAAC,mBAAmB,GAAG;QAClC,MAAMC,MAAM,IAAIC,IAAI,CAAC;QAErB,IAAI;YACA,MAAMD,IAAI,iBAAiB,CAAC,CAAC;QACjC,EAAE,OAAOE,KAAK;YACV,IAAI,CAAC,aAAa,CAAC,KAAK,CAAC;gBAAEA;YAAI,GAAG;YAClC,MAAMC,cAAc,IAAI,CACpB,IAAIC,MAAM,kDACV;QAER;QAEA,MAAMC,SAAS,MAAML,IAAI,MAAM,CAAC,MAAM;QACtC,IAAI,CAACK,QACD,MAAMF,cAAc,IAAI,CACpB,IAAIC,MAAM,+BACV;QAIRL,QAAQ,GAAG,CAAC,UAAU,GAAGM;QAEzB,MAAM,EAAEC,WAAW,EAAE,GAAG,MAAMN,IAAI,MAAM,CAAC,WAAW;QACpD,MAAMO,UAAUR,QAAQ,GAAG,CAAC,WAAW;QAEvC,IAAIQ,SACA,IAAI,CAAC,aAAa,CAAC,IAAI,CAAC,CAAC,eAAe,EAAEA,QAAQ,MAAM,EAAEF,OAAO,SAAS,CAAC;aAE3E,IAAI,CAAC,aAAa,CAAC,IAAI,CAAC,CAAC,qBAAqB,EAAEC,YAAY,MAAM,EAAED,OAAO,SAAS,CAAC;IAE7F;AACJ;AAEO,MAAMG,mCAAmCC,aAAa,oBAAoB,CAAC;IAC9E,gBAAgBZ;IAChB,cAAc;QAACa;KAAc;AACjC"}
@@ -2,10 +2,7 @@ import { GetProjectConfigService } from "@webiny/project/abstractions/index.js";
2
2
  import { ApiPulumi } from "../abstractions/features/pulumi/index.js";
3
3
  import { ApiRoute } from "./ApiRoute.js";
4
4
  import { ApiGraphql } from "../pulumi/apps/api/ApiGraphql.js";
5
- function deriveRouteName(routePath, method) {
6
- const pathPart = routePath.replace(/^\//, "").replace(/\{[^}]*\}/g, "").replace(/\/+/g, "-").replace(/^-+|-+$/g, "").toLowerCase();
7
- return `${pathPart}-${method.toLowerCase()}`;
8
- }
5
+ import { deriveRouteName, toApiGatewayPath } from "./routePath.js";
9
6
  class RegisterRoutesPulumiImpl {
10
7
  constructor(getProjectConfigService){
11
8
  this.getProjectConfigService = getProjectConfigService;
@@ -20,7 +17,7 @@ class RegisterRoutesPulumiImpl {
20
17
  const name = routeName ?? deriveRouteName(routePath, method);
21
18
  graphqlModule.addRoute({
22
19
  name,
23
- path: routePath,
20
+ path: toApiGatewayPath(routePath),
24
21
  method
25
22
  });
26
23
  }
@@ -1 +1 @@
1
- {"version":3,"file":"extensions/RegisterRoutesPulumi.js","sources":["../../src/extensions/RegisterRoutesPulumi.ts"],"sourcesContent":["import { GetProjectConfigService } from \"@webiny/project/abstractions/index.js\";\nimport { ApiPulumi } from \"~/abstractions/features/pulumi/index.js\";\nimport type { ApiPulumiApp } from \"~/pulumi/apps/api/createApiPulumiApp.js\";\nimport { ApiRoute } from \"./ApiRoute.js\";\nimport { ApiGraphql } from \"~/pulumi/apps/api/ApiGraphql.js\";\n\nfunction deriveRouteName(routePath: string, method: string): string {\n // /asd/{id}/xs + POST → asd-xs-post\n const pathPart = routePath\n .replace(/^\\//, \"\")\n .replace(/\\{[^}]*\\}/g, \"\")\n .replace(/\\/+/g, \"-\")\n .replace(/^-+|-+$/g, \"\")\n .toLowerCase();\n\n return `${pathPart}-${method.toLowerCase()}`;\n}\n\nclass RegisterRoutesPulumiImpl implements ApiPulumi.Interface {\n constructor(private getProjectConfigService: GetProjectConfigService.Interface) {}\n\n async execute(app: ApiPulumiApp): Promise<void> {\n // No tags filter — finds ApiRestRoute extensions regardless of their runtimeContext.\n const projectConfig = await this.getProjectConfigService.execute();\n const routeExtensions = projectConfig.extensionsByType(ApiRoute);\n\n if (!routeExtensions.length) {\n return;\n }\n\n const graphqlModule = app.getModule(ApiGraphql);\n\n for (const ext of routeExtensions) {\n const { path: routePath, method, routeName } = ext.params;\n const name = routeName ?? deriveRouteName(routePath, method);\n graphqlModule.addRoute({\n name,\n path: routePath as `/${string}`,\n method\n });\n }\n }\n}\n\nexport const RegisterRoutesPulumi = ApiPulumi.createImplementation({\n implementation: RegisterRoutesPulumiImpl,\n dependencies: [GetProjectConfigService]\n});\n"],"names":["deriveRouteName","routePath","method","pathPart","RegisterRoutesPulumiImpl","getProjectConfigService","app","projectConfig","routeExtensions","ApiRoute","graphqlModule","ApiGraphql","ext","routeName","name","RegisterRoutesPulumi","ApiPulumi","GetProjectConfigService"],"mappings":";;;;AAMA,SAASA,gBAAgBC,SAAiB,EAAEC,MAAc;IAEtD,MAAMC,WAAWF,UACZ,OAAO,CAAC,OAAO,IACf,OAAO,CAAC,cAAc,IACtB,OAAO,CAAC,QAAQ,KAChB,OAAO,CAAC,YAAY,IACpB,WAAW;IAEhB,OAAO,GAAGE,SAAS,CAAC,EAAED,OAAO,WAAW,IAAI;AAChD;AAEA,MAAME;IACF,YAAoBC,uBAA0D,CAAE;aAA5DA,uBAAuB,GAAvBA;IAA6D;IAEjF,MAAM,QAAQC,GAAiB,EAAiB;QAE5C,MAAMC,gBAAgB,MAAM,IAAI,CAAC,uBAAuB,CAAC,OAAO;QAChE,MAAMC,kBAAkBD,cAAc,gBAAgB,CAACE;QAEvD,IAAI,CAACD,gBAAgB,MAAM,EACvB;QAGJ,MAAME,gBAAgBJ,IAAI,SAAS,CAACK;QAEpC,KAAK,MAAMC,OAAOJ,gBAAiB;YAC/B,MAAM,EAAE,MAAMP,SAAS,EAAEC,MAAM,EAAEW,SAAS,EAAE,GAAGD,IAAI,MAAM;YACzD,MAAME,OAAOD,aAAab,gBAAgBC,WAAWC;YACrDQ,cAAc,QAAQ,CAAC;gBACnBI;gBACA,MAAMb;gBACNC;YACJ;QACJ;IACJ;AACJ;AAEO,MAAMa,uBAAuBC,UAAU,oBAAoB,CAAC;IAC/D,gBAAgBZ;IAChB,cAAc;QAACa;KAAwB;AAC3C"}
1
+ {"version":3,"file":"extensions/RegisterRoutesPulumi.js","sources":["../../src/extensions/RegisterRoutesPulumi.ts"],"sourcesContent":["import { GetProjectConfigService } from \"@webiny/project/abstractions/index.js\";\nimport { ApiPulumi } from \"~/abstractions/features/pulumi/index.js\";\nimport type { ApiPulumiApp } from \"~/pulumi/apps/api/createApiPulumiApp.js\";\nimport { ApiRoute } from \"./ApiRoute.js\";\nimport { ApiGraphql } from \"~/pulumi/apps/api/ApiGraphql.js\";\nimport { deriveRouteName, toApiGatewayPath } from \"./routePath.js\";\n\nclass RegisterRoutesPulumiImpl implements ApiPulumi.Interface {\n constructor(private getProjectConfigService: GetProjectConfigService.Interface) {}\n\n async execute(app: ApiPulumiApp): Promise<void> {\n // No tags filter — finds ApiRestRoute extensions regardless of their runtimeContext.\n const projectConfig = await this.getProjectConfigService.execute();\n const routeExtensions = projectConfig.extensionsByType(ApiRoute);\n\n if (!routeExtensions.length) {\n return;\n }\n\n const graphqlModule = app.getModule(ApiGraphql);\n\n for (const ext of routeExtensions) {\n const { path: routePath, method, routeName } = ext.params;\n const name = routeName ?? deriveRouteName(routePath, method);\n graphqlModule.addRoute({\n name,\n // The prop accepts `:id` too; API Gateway only understands `{id}`.\n path: toApiGatewayPath(routePath) as `/${string}`,\n method\n });\n }\n }\n}\n\nexport const RegisterRoutesPulumi = ApiPulumi.createImplementation({\n implementation: RegisterRoutesPulumiImpl,\n dependencies: [GetProjectConfigService]\n});\n"],"names":["RegisterRoutesPulumiImpl","getProjectConfigService","app","projectConfig","routeExtensions","ApiRoute","graphqlModule","ApiGraphql","ext","routePath","method","routeName","name","deriveRouteName","toApiGatewayPath","RegisterRoutesPulumi","ApiPulumi","GetProjectConfigService"],"mappings":";;;;;AAOA,MAAMA;IACF,YAAoBC,uBAA0D,CAAE;aAA5DA,uBAAuB,GAAvBA;IAA6D;IAEjF,MAAM,QAAQC,GAAiB,EAAiB;QAE5C,MAAMC,gBAAgB,MAAM,IAAI,CAAC,uBAAuB,CAAC,OAAO;QAChE,MAAMC,kBAAkBD,cAAc,gBAAgB,CAACE;QAEvD,IAAI,CAACD,gBAAgB,MAAM,EACvB;QAGJ,MAAME,gBAAgBJ,IAAI,SAAS,CAACK;QAEpC,KAAK,MAAMC,OAAOJ,gBAAiB;YAC/B,MAAM,EAAE,MAAMK,SAAS,EAAEC,MAAM,EAAEC,SAAS,EAAE,GAAGH,IAAI,MAAM;YACzD,MAAMI,OAAOD,aAAaE,gBAAgBJ,WAAWC;YACrDJ,cAAc,QAAQ,CAAC;gBACnBM;gBAEA,MAAME,iBAAiBL;gBACvBC;YACJ;QACJ;IACJ;AACJ;AAEO,MAAMK,uBAAuBC,UAAU,oBAAoB,CAAC;IAC/D,gBAAgBhB;IAChB,cAAc;QAACiB;KAAwB;AAC3C"}
@@ -0,0 +1,20 @@
1
+ /**
2
+ * The `path` prop on `<Api.Route>` feeds two consumers that spell path parameters differently:
3
+ * API Gateway wants `{orderId}`, the DI `HttpRouter` wants `:orderId`. Rather than pick a winner and
4
+ * break whichever projects already used the other, accept both and convert per consumer.
5
+ *
6
+ * Wildcards are left alone. `HttpRouter` matches a trailing `/*`, API Gateway spells the same thing
7
+ * `{proxy+}`, and translating between them changes what the route captures — so a wildcard route
8
+ * has to be written for the target it's aimed at.
9
+ */
10
+ /** `/orders/:orderId` → `/orders/{orderId}`. Already-braced segments pass through. */
11
+ export declare function toApiGatewayPath(path: string): string;
12
+ /** `/orders/{orderId}` → `/orders/:orderId`. Already-colon segments pass through. */
13
+ export declare function toRouterPath(path: string): string;
14
+ /**
15
+ * `/asd/{id}/xs` + POST → `asd-xs-post`. Handles either parameter syntax.
16
+ *
17
+ * Used for BOTH the Pulumi resource name and the route's DI name, so the name a decorator matches
18
+ * on is the same one that shows up in infrastructure.
19
+ */
20
+ export declare function deriveRouteName(routePath: string, method: string): string;
@@ -0,0 +1,13 @@
1
+ function toApiGatewayPath(path) {
2
+ return path.replace(/(^|\/):([^/]+)/g, (_match, prefix, name)=>`${prefix}{${name}}`);
3
+ }
4
+ function toRouterPath(path) {
5
+ return path.replace(/\{([^}]+)\}/g, (_match, name)=>`:${name}`);
6
+ }
7
+ function deriveRouteName(routePath, method) {
8
+ const pathPart = routePath.replace(/^\//, "").replace(/\{[^}]*\}/g, "").replace(/(^|\/):[^/]+/g, "$1").replace(/\/+/g, "-").replace(/^-+|-+$/g, "").toLowerCase();
9
+ return `${pathPart}-${method.toLowerCase()}`;
10
+ }
11
+ export { deriveRouteName, toApiGatewayPath, toRouterPath };
12
+
13
+ //# sourceMappingURL=routePath.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"extensions/routePath.js","sources":["../../src/extensions/routePath.ts"],"sourcesContent":["/**\n * The `path` prop on `<Api.Route>` feeds two consumers that spell path parameters differently:\n * API Gateway wants `{orderId}`, the DI `HttpRouter` wants `:orderId`. Rather than pick a winner and\n * break whichever projects already used the other, accept both and convert per consumer.\n *\n * Wildcards are left alone. `HttpRouter` matches a trailing `/*`, API Gateway spells the same thing\n * `{proxy+}`, and translating between them changes what the route captures — so a wildcard route\n * has to be written for the target it's aimed at.\n */\n\n/** `/orders/:orderId` → `/orders/{orderId}`. Already-braced segments pass through. */\nexport function toApiGatewayPath(path: string): string {\n return path.replace(/(^|\\/):([^/]+)/g, (_match, prefix: string, name: string) => {\n return `${prefix}{${name}}`;\n });\n}\n\n/** `/orders/{orderId}` → `/orders/:orderId`. Already-colon segments pass through. */\nexport function toRouterPath(path: string): string {\n return path.replace(/\\{([^}]+)\\}/g, (_match, name: string) => {\n return `:${name}`;\n });\n}\n\n/**\n * `/asd/{id}/xs` + POST → `asd-xs-post`. Handles either parameter syntax.\n *\n * Used for BOTH the Pulumi resource name and the route's DI name, so the name a decorator matches\n * on is the same one that shows up in infrastructure.\n */\nexport function deriveRouteName(routePath: string, method: string): string {\n // /asd/{id}/xs + POST → asd-xs-post. Strips parameters in either syntax.\n const pathPart = routePath\n .replace(/^\\//, \"\")\n .replace(/\\{[^}]*\\}/g, \"\")\n .replace(/(^|\\/):[^/]+/g, \"$1\")\n .replace(/\\/+/g, \"-\")\n .replace(/^-+|-+$/g, \"\")\n .toLowerCase();\n\n return `${pathPart}-${method.toLowerCase()}`;\n}\n"],"names":["toApiGatewayPath","path","_match","prefix","name","toRouterPath","deriveRouteName","routePath","method","pathPart"],"mappings":"AAWO,SAASA,iBAAiBC,IAAY;IACzC,OAAOA,KAAK,OAAO,CAAC,mBAAmB,CAACC,QAAQC,QAAgBC,OACrD,GAAGD,OAAO,CAAC,EAAEC,KAAK,CAAC,CAAC;AAEnC;AAGO,SAASC,aAAaJ,IAAY;IACrC,OAAOA,KAAK,OAAO,CAAC,gBAAgB,CAACC,QAAQE,OAClC,CAAC,CAAC,EAAEA,MAAM;AAEzB;AAQO,SAASE,gBAAgBC,SAAiB,EAAEC,MAAc;IAE7D,MAAMC,WAAWF,UACZ,OAAO,CAAC,OAAO,IACf,OAAO,CAAC,cAAc,IACtB,OAAO,CAAC,iBAAiB,MACzB,OAAO,CAAC,QAAQ,KAChB,OAAO,CAAC,YAAY,IACpB,WAAW;IAEhB,OAAO,GAAGE,SAAS,CAAC,EAAED,OAAO,WAAW,IAAI;AAChD"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@webiny/project-aws",
3
- "version": "6.6.0-alpha.0",
3
+ "version": "6.6.0-alpha.2",
4
4
  "type": "module",
5
5
  "exports": {
6
6
  ".": "./index.js",
@@ -17,18 +17,18 @@
17
17
  "access": "public"
18
18
  },
19
19
  "dependencies": {
20
- "@pulumi/aws": "^7.39.0",
21
- "@pulumi/pulumi": "^3.254.0",
20
+ "@pulumi/aws": "^7.43.0",
21
+ "@pulumi/pulumi": "^3.259.0",
22
22
  "@pulumi/random": "4.21.1",
23
- "@webiny/aws-layers": "6.6.0-alpha.0",
24
- "@webiny/aws-sdk": "6.6.0-alpha.0",
25
- "@webiny/cli-core": "6.6.0-alpha.0",
26
- "@webiny/di": "1.0.2",
27
- "@webiny/global-config": "6.6.0-alpha.0",
28
- "@webiny/project": "6.6.0-alpha.0",
29
- "@webiny/pulumi": "6.6.0-alpha.0",
30
- "@webiny/pulumi-sdk": "6.6.0-alpha.0",
31
- "@webiny/utils": "6.6.0-alpha.0",
23
+ "@webiny/aws-layers": "6.6.0-alpha.2",
24
+ "@webiny/aws-sdk": "6.6.0-alpha.2",
25
+ "@webiny/cli-core": "6.6.0-alpha.2",
26
+ "@webiny/di": "1.1.0",
27
+ "@webiny/global-config": "6.6.0-alpha.2",
28
+ "@webiny/project": "6.6.0-alpha.2",
29
+ "@webiny/pulumi": "6.6.0-alpha.2",
30
+ "@webiny/pulumi-sdk": "6.6.0-alpha.2",
31
+ "@webiny/utils": "6.6.0-alpha.2",
32
32
  "chalk": "6.0.0",
33
33
  "email-addresses": "5.0.0",
34
34
  "exit-hook": "5.1.0",
@@ -43,11 +43,11 @@
43
43
  "zod": "4.4.3"
44
44
  },
45
45
  "devDependencies": {
46
- "@types/lodash": "4.17.24",
46
+ "@types/lodash": "4.17.25",
47
47
  "@types/ncp": "2.0.8",
48
- "@webiny/build-tools": "6.6.0-alpha.0",
48
+ "@webiny/build-tools": "6.6.0-alpha.2",
49
49
  "typescript": "7.0.2",
50
- "vitest": "4.1.10"
50
+ "vitest": "4.1.11"
51
51
  },
52
52
  "adio": {
53
53
  "ignoreDirs": [
package/project.d.ts CHANGED
@@ -28,18 +28,23 @@ export declare const Project: {
28
28
  fileManager: import("zod").ZodOptional<import("zod").ZodObject<{
29
29
  threatDetection: import("zod").ZodOptional<import("zod").ZodBoolean>;
30
30
  }, import("zod/v4/core").$strip>>;
31
- aiPowerups: import("zod").ZodOptional<import("zod").ZodObject<{
32
- enabled: import("zod").ZodOptional<import("zod").ZodBoolean>;
33
- options: import("zod").ZodOptional<import("zod").ZodObject<{
34
- websiteBuilder: import("zod").ZodOptional<import("zod").ZodObject<{
35
- pageGeneration: import("zod").ZodOptional<import("zod").ZodBoolean>;
36
- }, import("zod/v4/core").$strip>>;
37
- fileManager: import("zod").ZodOptional<import("zod").ZodObject<{
38
- imageEnrichment: import("zod").ZodOptional<import("zod").ZodBoolean>;
39
- }, import("zod/v4/core").$strip>>;
40
- lexicalGeneration: import("zod").ZodOptional<import("zod").ZodBoolean>;
31
+ aiPowerups: import("zod").ZodOptional<import("zod").ZodUnion<readonly [import("zod").ZodBoolean, import("zod").ZodObject<{
32
+ websiteBuilder: import("zod").ZodOptional<import("zod").ZodObject<{
33
+ pageGeneration: import("zod").ZodOptional<import("zod").ZodBoolean>;
34
+ pageTranslation: import("zod").ZodOptional<import("zod").ZodBoolean>;
41
35
  }, import("zod/v4/core").$strip>>;
42
- }, import("zod/v4/core").$strip>>;
36
+ fileManager: import("zod").ZodOptional<import("zod").ZodObject<{
37
+ imageEnrichment: import("zod").ZodOptional<import("zod").ZodBoolean>;
38
+ }, import("zod/v4/core").$strip>>;
39
+ lexicalGeneration: import("zod").ZodOptional<import("zod").ZodBoolean>;
40
+ cms: import("zod").ZodOptional<import("zod").ZodObject<{
41
+ entryGeneration: import("zod").ZodOptional<import("zod").ZodBoolean>;
42
+ entryComparison: import("zod").ZodOptional<import("zod").ZodBoolean>;
43
+ entryTranslation: import("zod").ZodOptional<import("zod").ZodBoolean>;
44
+ }, import("zod/v4/core").$strip>>;
45
+ }, import("zod/v4/core").$strip>]>>;
46
+ abTesting: import("zod").ZodOptional<import("zod").ZodBoolean>;
47
+ remoteComponents: import("zod").ZodOptional<import("zod").ZodBoolean>;
43
48
  }, import("zod/v4/core").$strip>;
44
49
  }, import("zod/v4/core").$strip>>;
45
50
  };
@@ -1,10 +1,14 @@
1
1
  import { createAppModule } from "@webiny/pulumi";
2
2
  import { ApiGateway } from "./ApiGateway.js";
3
+ import { ApiGraphqlStream } from "./ApiGraphqlStream.js";
3
4
  import * as __rspack_external__pulumi_aws_9e2bee2d from "@pulumi/aws";
5
+ const STREAM_ORIGIN_ID = "graphql-stream-function-url";
6
+ const MANAGED_CACHING_DISABLED_POLICY_ID = "4135ea2d-6df8-44a3-9df3-4b5a84be39ad";
4
7
  const ApiCloudfront = createAppModule({
5
8
  name: "ApiCloudfront",
6
9
  config (app) {
7
10
  const gateway = app.getModule(ApiGateway);
11
+ const graphqlStream = app.getModule(ApiGraphqlStream);
8
12
  const cookies = {
9
13
  forward: "whitelist",
10
14
  whitelistedNames: [
@@ -19,7 +23,48 @@ const ApiCloudfront = createAppModule({
19
23
  "X-Tenant",
20
24
  "X-Webiny-Sdk"
21
25
  ];
22
- return app.addResource(__rspack_external__pulumi_aws_9e2bee2d.cloudfront.Distribution, {
26
+ const streamOac = app.addResource(__rspack_external__pulumi_aws_9e2bee2d.cloudfront.OriginAccessControl, {
27
+ name: "api-stream-oac",
28
+ config: {
29
+ description: "Signs CloudFront requests to the streaming Lambda Function URL",
30
+ originAccessControlOriginType: "lambda",
31
+ signingBehavior: "always",
32
+ signingProtocol: "sigv4"
33
+ }
34
+ });
35
+ const streamOriginRequestPolicy = app.addResource(__rspack_external__pulumi_aws_9e2bee2d.cloudfront.OriginRequestPolicy, {
36
+ name: "api-stream-origin-request-policy",
37
+ config: {
38
+ comment: "Headers/cookies forwarded to the streaming Lambda Function URL origin",
39
+ headersConfig: {
40
+ headerBehavior: "whitelist",
41
+ headers: {
42
+ items: [
43
+ "Origin",
44
+ "Accept",
45
+ "Accept-Language",
46
+ "Access-Control-Request-Method",
47
+ "Access-Control-Request-Headers",
48
+ "X-Tenant",
49
+ "X-Webiny-Sdk",
50
+ "X-Webiny-Authorization"
51
+ ]
52
+ }
53
+ },
54
+ cookiesConfig: {
55
+ cookieBehavior: "whitelist",
56
+ cookies: {
57
+ items: [
58
+ "wby-id-token"
59
+ ]
60
+ }
61
+ },
62
+ queryStringsConfig: {
63
+ queryStringBehavior: "all"
64
+ }
65
+ }
66
+ });
67
+ const distribution = app.addResource(__rspack_external__pulumi_aws_9e2bee2d.cloudfront.Distribution, {
23
68
  name: "api-cloudfront",
24
69
  config: {
25
70
  httpVersion: "http2and3",
@@ -54,6 +99,27 @@ const ApiCloudfront = createAppModule({
54
99
  viewerProtocolPolicy: "allow-all"
55
100
  },
56
101
  orderedCacheBehaviors: [
102
+ {
103
+ compress: false,
104
+ allowedMethods: [
105
+ "GET",
106
+ "HEAD",
107
+ "OPTIONS",
108
+ "PUT",
109
+ "POST",
110
+ "PATCH",
111
+ "DELETE"
112
+ ],
113
+ cachedMethods: [
114
+ "GET",
115
+ "HEAD"
116
+ ],
117
+ cachePolicyId: MANAGED_CACHING_DISABLED_POLICY_ID,
118
+ originRequestPolicyId: streamOriginRequestPolicy.output.id,
119
+ pathPattern: "/stream/*",
120
+ viewerProtocolPolicy: "https-only",
121
+ targetOriginId: STREAM_ORIGIN_ID
122
+ },
57
123
  {
58
124
  compress: true,
59
125
  allowedMethods: [
@@ -170,6 +236,20 @@ const ApiCloudfront = createAppModule({
170
236
  "TLSv1.2"
171
237
  ]
172
238
  }
239
+ },
240
+ {
241
+ domainName: graphqlStream.functionUrlDomain,
242
+ originId: STREAM_ORIGIN_ID,
243
+ originAccessControlId: streamOac.output.id,
244
+ customOriginConfig: {
245
+ httpPort: 80,
246
+ httpsPort: 443,
247
+ originProtocolPolicy: "https-only",
248
+ originSslProtocols: [
249
+ "TLSv1.2"
250
+ ],
251
+ originReadTimeout: 60
252
+ }
173
253
  }
174
254
  ],
175
255
  restrictions: {
@@ -187,6 +267,28 @@ const ApiCloudfront = createAppModule({
187
267
  ]
188
268
  }
189
269
  });
270
+ app.addResource(__rspack_external__pulumi_aws_9e2bee2d.lambda.Permission, {
271
+ name: "graphql-stream-url-cloudfront-invoke",
272
+ config: {
273
+ action: "lambda:InvokeFunctionUrl",
274
+ function: graphqlStream.functions.graphqlStream.output.name,
275
+ principal: "cloudfront.amazonaws.com",
276
+ sourceArn: distribution.output.arn,
277
+ functionUrlAuthType: "AWS_IAM",
278
+ statementId: "allow-cloudfront-invoke-function-url"
279
+ }
280
+ });
281
+ app.addResource(__rspack_external__pulumi_aws_9e2bee2d.lambda.Permission, {
282
+ name: "graphql-stream-cloudfront-invoke-function",
283
+ config: {
284
+ action: "lambda:InvokeFunction",
285
+ function: graphqlStream.functions.graphqlStream.output.name,
286
+ principal: "cloudfront.amazonaws.com",
287
+ sourceArn: distribution.output.arn,
288
+ statementId: "allow-cloudfront-invoke-function"
289
+ }
290
+ });
291
+ return distribution;
190
292
  }
191
293
  });
192
294
  export { ApiCloudfront };