@webiny/project-aws 6.6.0-alpha.12 → 6.6.0-alpha.13

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 (98) hide show
  1. package/_templates/appTemplates/api/graphql/package.json +2 -2
  2. package/_templates/appTemplates/api/graphql/src/index.ts +2 -2
  3. package/_templates/appTemplates/api/graphql/src/web.ts +1 -1
  4. package/_templates/extensions/OpenSearch/api/graphql/src/index.ts +2 -2
  5. package/_templates/extensions/OpenSearch/api/graphql/src/web.ts +1 -1
  6. package/_templates/extensions/Postgres/api/graphql/src/index.ts +3 -6
  7. package/_templates/extensions/Postgres/api/graphql/src/web.ts +1 -1
  8. package/api.d.ts +6 -6
  9. package/api.js +3 -2
  10. package/api.js.map +1 -1
  11. package/decorators/GetPulumiServiceWithDownloadInfo.d.ts +1 -3
  12. package/decorators/GetPulumiServiceWithDownloadInfo.js +15 -11
  13. package/decorators/GetPulumiServiceWithDownloadInfo.js.map +1 -1
  14. package/extensions/AuroraPostgresCluster.d.ts +12 -0
  15. package/extensions/{Postgres.js → AuroraPostgresCluster.js} +7 -7
  16. package/extensions/AuroraPostgresCluster.js.map +1 -0
  17. package/extensions/Postgres/AddCorePostgres.d.ts +1 -1
  18. package/extensions/Postgres/AddCorePostgres.js +0 -2
  19. package/extensions/Postgres/AddCorePostgres.js.map +1 -1
  20. package/extensions/Postgres/CopyPgModulesAfterApiBuild.d.ts +4 -3
  21. package/extensions/Postgres/CopyPgModulesAfterApiBuild.js.map +1 -1
  22. package/extensions/Postgres/ReplaceApiLambdaFnHandlers.d.ts +3 -3
  23. package/extensions/Postgres/ReplaceApiLambdaFnHandlers.js.map +1 -1
  24. package/extensions/Postgres/ValidatePostgresBeforeCoreDeploy.d.ts +1 -1
  25. package/extensions/Postgres/ValidatePostgresBeforeCoreDeploy.js +3 -3
  26. package/extensions/Postgres/ValidatePostgresBeforeCoreDeploy.js.map +1 -1
  27. package/extensions/Postgres/copyPgRuntimeModules.d.ts +1 -1
  28. package/extensions/Postgres/copyPgRuntimeModules.js +2 -2
  29. package/extensions/Postgres/copyPgRuntimeModules.js.map +1 -1
  30. package/extensions/ProjectAws/EnsurePostgresSetupUnchanged.d.ts +2 -2
  31. package/extensions/ProjectAws/EnsurePostgresSetupUnchanged.js +1 -1
  32. package/extensions/ProjectAws/EnsurePostgresSetupUnchanged.js.map +1 -1
  33. package/extensions/ProjectAws/RefuseApiWatchWithPostgres.d.ts +3 -3
  34. package/extensions/ProjectAws/RefuseApiWatchWithPostgres.js +1 -1
  35. package/extensions/ProjectAws/RefuseApiWatchWithPostgres.js.map +1 -1
  36. package/extensions/definitions.js +2 -4
  37. package/extensions/definitions.js.map +1 -1
  38. package/extensions/index.d.ts +3 -3
  39. package/extensions/index.js +3 -4
  40. package/extensions/registerExtensionImplementations.js +3 -5
  41. package/extensions/registerExtensionImplementations.js.map +1 -1
  42. package/infra.d.ts +2 -8
  43. package/infra.js +6 -10
  44. package/infra.js.map +1 -1
  45. package/package.json +19 -18
  46. package/project.d.ts +1 -0
  47. package/pulumi/apps/admin/createAdminPulumiApp.js.map +1 -1
  48. package/pulumi/apps/api/ApiGraphql.js.map +1 -1
  49. package/pulumi/apps/api/ApiGraphqlWeb.js.map +1 -1
  50. package/pulumi/apps/api/ApiOutput.js.map +1 -1
  51. package/pulumi/apps/api/ApiSchemaSetup.d.ts +2 -2
  52. package/pulumi/apps/api/ApiSchemaSetup.js +1 -1
  53. package/pulumi/apps/api/ApiSchemaSetup.js.map +1 -1
  54. package/pulumi/apps/api/apiDynamoDb.js.map +1 -1
  55. package/pulumi/apps/api/backgroundTask/types.js.map +1 -1
  56. package/pulumi/apps/api/createApiPulumiApp.js.map +1 -1
  57. package/pulumi/apps/common/CoreOutput.js.map +1 -1
  58. package/pulumi/apps/core/CoreCognito.d.ts +14 -0
  59. package/pulumi/apps/core/CoreCognito.js +34 -1
  60. package/pulumi/apps/core/CoreCognito.js.map +1 -1
  61. package/pulumi/apps/core/CorePostgres.d.ts +4 -4
  62. package/pulumi/apps/core/CorePostgres.js +2 -1
  63. package/pulumi/apps/core/CorePostgres.js.map +1 -1
  64. package/pulumi/apps/core/cognitoIdentityProviders/configure.js +11 -0
  65. package/pulumi/apps/core/cognitoIdentityProviders/configure.js.map +1 -1
  66. package/pulumi/apps/core/coreDynamoDb.d.ts +2 -2
  67. package/pulumi/apps/core/coreDynamoDb.js.map +1 -1
  68. package/pulumi/apps/core/coreServiceManifests.d.ts +6 -4
  69. package/pulumi/apps/core/coreServiceManifests.js.map +1 -1
  70. package/pulumi/apps/core/coreVpcEndpoints.d.ts +2 -2
  71. package/pulumi/apps/core/coreVpcEndpoints.js.map +1 -1
  72. package/pulumi/apps/core/createCorePulumiApp.js.map +1 -1
  73. package/pulumi/apps/extensions/getPostgresConfigFromExtension.d.ts +4 -2
  74. package/pulumi/apps/extensions/getPostgresConfigFromExtension.js +4 -3
  75. package/pulumi/apps/extensions/getPostgresConfigFromExtension.js.map +1 -1
  76. package/pulumi/apps/extensions/projectUsesPostgres.d.ts +1 -1
  77. package/pulumi/apps/extensions/projectUsesPostgres.js.map +1 -1
  78. package/pulumi/apps/react/adminSettingsItem.d.ts +1 -1
  79. package/pulumi/apps/react/adminSettingsItem.js.map +1 -1
  80. package/pulumi/apps/react/createReactPulumiApp.js.map +1 -1
  81. package/pulumi/types.d.ts +2 -2
  82. package/pulumi/utils/lambdaEnvVariables.js +2 -2
  83. package/pulumi/utils/lambdaEnvVariables.js.map +1 -1
  84. package/pulumi/utils/withServiceManifest.d.ts +2 -2
  85. package/pulumi/utils/withServiceManifest.js.map +1 -1
  86. package/services/PulumiGetStackOutputService/mapStackOutput.js +1 -1
  87. package/services/PulumiGetStackOutputService/mapStackOutput.js.map +1 -1
  88. package/extensions/Postgres.d.ts +0 -11
  89. package/extensions/Postgres.js.map +0 -1
  90. package/extensions/RdsProxy/EnsurePostgresWithRdsProxy.d.ts +0 -14
  91. package/extensions/RdsProxy/EnsurePostgresWithRdsProxy.js +0 -23
  92. package/extensions/RdsProxy/EnsurePostgresWithRdsProxy.js.map +0 -1
  93. package/extensions/RdsProxy.d.ts +0 -9
  94. package/extensions/RdsProxy.js +0 -31
  95. package/extensions/RdsProxy.js.map +0 -1
  96. package/pulumi/apps/extensions/getRdsProxyConfigFromExtension.d.ts +0 -5
  97. package/pulumi/apps/extensions/getRdsProxyConfigFromExtension.js +0 -8
  98. package/pulumi/apps/extensions/getRdsProxyConfigFromExtension.js.map +0 -1
@@ -4,8 +4,8 @@
4
4
  "type": "module",
5
5
  "scripts": {},
6
6
  "dependencies": {
7
- "@webiny/api-event-handler-aws-ddb": "latest",
8
- "@webiny/api-event-handler-aws-ddb-os": "latest",
7
+ "@webiny/api-composition-aws-ddb": "latest",
8
+ "@webiny/api-composition-aws-ddb-os": "latest",
9
9
  "@webiny/api-aco": "latest",
10
10
  "@webiny/api-audit-logs": "latest",
11
11
  "@webiny/api-core": "latest",
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  * DI-native API GraphQL handler (DynamoDB storage).
3
3
  *
4
- * The composition root lives in @webiny/api-event-handler-aws-ddb (`createAwsDdbApiHandler`) so the wiring
4
+ * The composition root lives in @webiny/api-composition-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
7
  *
@@ -14,7 +14,7 @@
14
14
  import {
15
15
  createAwsDdbApiHandler,
16
16
  createAwsDdbStreamApiHandler
17
- } from "@webiny/api-event-handler-aws-ddb";
17
+ } from "@webiny/api-composition-aws-ddb";
18
18
  import { extensions } from "./extensions";
19
19
 
20
20
  export const handler = createAwsDdbApiHandler({ extensions });
@@ -6,7 +6,7 @@
6
6
  * separate bundle (`build-web/`), never part of `handler.mjs`. The web function serves the HTTP routes;
7
7
  * every other invocation still goes to the regular `graphql` Lambda built from `index.ts`.
8
8
  */
9
- import { startAwsDdbWebApi } from "@webiny/api-event-handler-aws-ddb";
9
+ import { startAwsDdbWebApi } from "@webiny/api-composition-aws-ddb";
10
10
  import { extensions } from "./extensions";
11
11
 
12
12
  startAwsDdbWebApi({ extensions }).catch(err => {
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  * DI-native API GraphQL handler — OpenSearch (DDB+ES) variant.
3
3
  *
4
- * The composition root lives in @webiny/api-event-handler-aws-ddb-os (`createAwsDdbOsApiHandler`) so the
4
+ * The composition root lives in @webiny/api-composition-aws-ddb-os (`createAwsDdbOsApiHandler`) so the
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.
@@ -12,7 +12,7 @@
12
12
  import {
13
13
  createAwsDdbOsApiHandler,
14
14
  createAwsDdbOsStreamApiHandler
15
- } from "@webiny/api-event-handler-aws-ddb-os";
15
+ } from "@webiny/api-composition-aws-ddb-os";
16
16
  import { extensions } from "./extensions";
17
17
 
18
18
  export const handler = createAwsDdbOsApiHandler({ extensions });
@@ -6,7 +6,7 @@
6
6
  * separate bundle (`build-web/`), never part of `handler.mjs`. The web function serves the HTTP routes;
7
7
  * every other invocation still goes to the regular `graphql` Lambda built from `index.ts`.
8
8
  */
9
- import { startAwsDdbOsWebApi } from "@webiny/api-event-handler-aws-ddb-os";
9
+ import { startAwsDdbOsWebApi } from "@webiny/api-composition-aws-ddb-os";
10
10
  import { extensions } from "./extensions";
11
11
 
12
12
  startAwsDdbOsWebApi({ extensions }).catch(err => {
@@ -1,18 +1,15 @@
1
1
  /**
2
2
  * DI-native API GraphQL handler — Postgres variant.
3
3
  *
4
- * The composition root lives in @webiny/api-event-handler-aws-pg (`createAwsPgApiHandler`). The
4
+ * The composition root lives in @webiny/api-composition-aws-pg (`createAwsPgApiHandler`). The
5
5
  * Postgres extension's ReplaceApiLambdaFnHandlers copies this file over the api workspace when
6
- * `<Infra.Postgres />` is rendered. This file only supplies project-specific extensions.
6
+ * `<Infra.AuroraPostgres />` is rendered. This file only supplies project-specific extensions.
7
7
  *
8
8
  * Exports both the buffered (API Gateway) and the response-streaming (Function URL) handler; see the
9
9
  * DynamoDB variant of this file for why streaming needs its own Lambda function. The same bundle also
10
10
  * answers the `WebinySqlSchemaSetup` event, which the api deploy sends to set the database schema up.
11
11
  */
12
- import {
13
- createAwsPgApiHandler,
14
- createAwsPgStreamApiHandler
15
- } from "@webiny/api-event-handler-aws-pg";
12
+ import { createAwsPgApiHandler, createAwsPgStreamApiHandler } from "@webiny/api-composition-aws-pg";
16
13
  import { extensions } from "./extensions";
17
14
 
18
15
  export const handler = createAwsPgApiHandler({ extensions });
@@ -6,7 +6,7 @@
6
6
  * separate bundle (`build-web/`), never part of `handler.mjs`. The web function serves the HTTP routes;
7
7
  * every other invocation still goes to the regular `graphql` Lambda built from `index.ts`.
8
8
  */
9
- import { startAwsPgWebApi } from "@webiny/api-event-handler-aws-pg";
9
+ import { startAwsPgWebApi } from "@webiny/api-composition-aws-pg";
10
10
  import { extensions } from "./extensions";
11
11
 
12
12
  startAwsPgWebApi({ extensions }).catch(err => {
package/api.d.ts CHANGED
@@ -9,12 +9,12 @@ export declare const Api: {
9
9
  }, import("zod/v4/core").$strip>>;
10
10
  Mailer: {
11
11
  Smtp: import("@webiny/project/defineExtension/defineExtension.js").ExtensionComponent<import("zod").ZodObject<{
12
- host: import("zod").ZodString;
13
- port: import("zod").ZodNumber;
14
- user: import("zod").ZodString;
15
- password: import("zod").ZodString;
16
- from: import("zod").ZodString;
17
- replyTo: import("zod").ZodOptional<import("zod").ZodString>;
12
+ host: import("zod").ZodOptional<import("zod").ZodString>;
13
+ port: import("zod").ZodOptional<import("zod").ZodNumber>;
14
+ user: import("zod").ZodOptional<import("zod").ZodString>;
15
+ password: import("zod").ZodOptional<import("zod").ZodString>;
16
+ from: import("zod").ZodOptional<import("zod").ZodString>;
17
+ replyTo: import("zod").ZodOptional<import("zod").ZodOptional<import("zod").ZodString>>;
18
18
  }, import("zod/v4/core").$strip>>;
19
19
  };
20
20
  Cms: {
package/api.js CHANGED
@@ -1,12 +1,13 @@
1
1
  import { ApiExtension, BuildParam } from "@webiny/project/extensions/index.js";
2
2
  import { ApiRoute } from "./extensions/ApiRoute.js";
3
- import { BackgroundTasks, ModelFieldCompression, Smtp } from "@webiny/project/extensions/api/index.js";
3
+ import { BackgroundTasks, ModelFieldCompression } from "@webiny/project/extensions/api/index.js";
4
+ import { MailerSmtp } from "@webiny/mailer-smtp";
4
5
  const Api = {
5
6
  Extension: ApiExtension,
6
7
  Route: ApiRoute,
7
8
  BackgroundTasks: BackgroundTasks,
8
9
  Mailer: {
9
- Smtp: Smtp
10
+ Smtp: MailerSmtp
10
11
  },
11
12
  Cms: {
12
13
  ModelFieldCompression: ModelFieldCompression
package/api.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"api.js","sources":["../src/api.ts"],"sourcesContent":["import { ApiExtension, BuildParam } from \"@webiny/project/extensions/index.js\";\nimport { ApiRoute } from \"./extensions/ApiRoute.js\";\nimport { BackgroundTasks } from \"@webiny/project/extensions/api/index.js\";\nimport { ModelFieldCompression as CmsModelFieldCompression } from \"@webiny/project/extensions/api/index.js\";\nimport { Smtp as MailerSmtp } from \"@webiny/project/extensions/api/index.js\";\n\nexport const Api = {\n Extension: ApiExtension,\n Route: ApiRoute,\n BackgroundTasks: BackgroundTasks,\n Mailer: {\n Smtp: MailerSmtp\n },\n Cms: {\n ModelFieldCompression: CmsModelFieldCompression\n },\n BuildParam: BuildParam\n};\n"],"names":["Api","ApiExtension","ApiRoute","BackgroundTasks","MailerSmtp","CmsModelFieldCompression","BuildParam"],"mappings":";;;AAMO,MAAMA,MAAM;IACf,WAAWC;IACX,OAAOC;IACP,iBAAiBC;IACjB,QAAQ;QACJ,MAAMC;IACV;IACA,KAAK;QACD,uBAAuBC;IAC3B;IACA,YAAYC;AAChB"}
1
+ {"version":3,"file":"api.js","sources":["../src/api.ts"],"sourcesContent":["import { ApiExtension, BuildParam } from \"@webiny/project/extensions/index.js\";\nimport { ApiRoute } from \"./extensions/ApiRoute.js\";\nimport { BackgroundTasks } from \"@webiny/project/extensions/api/index.js\";\nimport { ModelFieldCompression as CmsModelFieldCompression } from \"@webiny/project/extensions/api/index.js\";\nimport { MailerSmtp } from \"@webiny/mailer-smtp\";\n\nexport const Api = {\n Extension: ApiExtension,\n Route: ApiRoute,\n BackgroundTasks: BackgroundTasks,\n Mailer: {\n Smtp: MailerSmtp\n },\n Cms: {\n ModelFieldCompression: CmsModelFieldCompression\n },\n BuildParam: BuildParam\n};\n"],"names":["Api","ApiExtension","ApiRoute","BackgroundTasks","MailerSmtp","CmsModelFieldCompression","BuildParam"],"mappings":";;;;AAMO,MAAMA,MAAM;IACf,WAAWC;IACX,OAAOC;IACP,iBAAiBC;IACjB,QAAQ;QACJ,MAAMC;IACV;IACA,KAAK;QACD,uBAAuBC;IAC3B;IACA,YAAYC;AAChB"}
@@ -1,11 +1,9 @@
1
- import { GetProjectService } from "@webiny/project/abstractions/index.js";
2
1
  import { UiService } from "@webiny/project/abstractions/index.js";
3
2
  import { GetPulumiService } from "../abstractions/services/GetPulumiService.js";
4
3
  export declare class GetPulumiServiceWithDownloadInfo implements GetPulumiService.Interface {
5
- private getProjectService;
6
4
  private ui;
7
5
  private decoratee;
8
- constructor(getProjectService: GetProjectService.Interface, ui: UiService.Interface, decoratee: GetPulumiService.Interface);
6
+ constructor(ui: UiService.Interface, decoratee: GetPulumiService.Interface);
9
7
  execute(params?: GetPulumiService.Params): Promise<import("@webiny/pulumi-sdk/Pulumi").Pulumi>;
10
8
  }
11
9
  export declare const getPulumiServiceWithDownloadInfo: typeof GetPulumiServiceWithDownloadInfo & {
@@ -1,25 +1,29 @@
1
- import { GetProjectService, UiService } from "@webiny/project/abstractions/index.js";
1
+ import { UiService } from "@webiny/project/abstractions/index.js";
2
2
  import { GetPulumiService } from "../abstractions/services/GetPulumiService.js";
3
3
  class GetPulumiServiceWithDownloadInfo {
4
- constructor(getProjectService, ui, decoratee){
5
- this.getProjectService = getProjectService;
4
+ constructor(ui, decoratee){
6
5
  this.ui = ui;
7
6
  this.decoratee = decoratee;
8
7
  }
9
8
  async execute(params = {}) {
10
- const project = this.getProjectService.execute();
11
- const pulumiCliPath = project.paths.dotWebinyFolder.join("pulumi-cli");
12
- if (!pulumiCliPath.existsSync()) {
13
- this.ui.info("Looks like this is your first time using Pulumi CLI. Downloading...");
14
- this.ui.emptyLine();
15
- }
16
- return this.decoratee.execute(params);
9
+ const pulumiOptions = params.pulumiOptions || {};
10
+ const beforePulumiInstall = pulumiOptions.beforePulumiInstall;
11
+ return this.decoratee.execute({
12
+ ...params,
13
+ pulumiOptions: {
14
+ ...pulumiOptions,
15
+ beforePulumiInstall: async ()=>{
16
+ this.ui.info("Downloading Pulumi CLI...");
17
+ this.ui.emptyLine();
18
+ await beforePulumiInstall?.();
19
+ }
20
+ }
21
+ });
17
22
  }
18
23
  }
19
24
  const getPulumiServiceWithDownloadInfo = GetPulumiService.createDecorator({
20
25
  decorator: GetPulumiServiceWithDownloadInfo,
21
26
  dependencies: [
22
- GetProjectService,
23
27
  UiService
24
28
  ]
25
29
  });
@@ -1 +1 @@
1
- {"version":3,"file":"decorators/GetPulumiServiceWithDownloadInfo.js","sources":["../../src/decorators/GetPulumiServiceWithDownloadInfo.ts"],"sourcesContent":["import { GetProjectService } from \"@webiny/project/abstractions/index.js\";\nimport { UiService } from \"@webiny/project/abstractions/index.js\";\nimport { GetPulumiService } from \"~/abstractions/services/GetPulumiService.js\";\n\nexport class GetPulumiServiceWithDownloadInfo implements GetPulumiService.Interface {\n constructor(\n private getProjectService: GetProjectService.Interface,\n private ui: UiService.Interface,\n private decoratee: GetPulumiService.Interface\n ) {}\n\n async execute(params: GetPulumiService.Params = {}) {\n const project = this.getProjectService.execute();\n const pulumiCliPath = project.paths.dotWebinyFolder.join(\"pulumi-cli\");\n\n if (!pulumiCliPath.existsSync()) {\n this.ui.info(\"Looks like this is your first time using Pulumi CLI. Downloading...\");\n\n // New line b/c after the Pulumi CLI download, plugins are next.\n this.ui.emptyLine();\n }\n\n return this.decoratee.execute(params);\n }\n}\n\nexport const getPulumiServiceWithDownloadInfo = GetPulumiService.createDecorator({\n decorator: GetPulumiServiceWithDownloadInfo,\n dependencies: [GetProjectService, UiService]\n});\n"],"names":["GetPulumiServiceWithDownloadInfo","getProjectService","ui","decoratee","params","project","pulumiCliPath","getPulumiServiceWithDownloadInfo","GetPulumiService","GetProjectService","UiService"],"mappings":";;AAIO,MAAMA;IACT,YACYC,iBAA8C,EAC9CC,EAAuB,EACvBC,SAAqC,CAC/C;aAHUF,iBAAiB,GAAjBA;aACAC,EAAE,GAAFA;aACAC,SAAS,GAATA;IACT;IAEH,MAAM,QAAQC,SAAkC,CAAC,CAAC,EAAE;QAChD,MAAMC,UAAU,IAAI,CAAC,iBAAiB,CAAC,OAAO;QAC9C,MAAMC,gBAAgBD,QAAQ,KAAK,CAAC,eAAe,CAAC,IAAI,CAAC;QAEzD,IAAI,CAACC,cAAc,UAAU,IAAI;YAC7B,IAAI,CAAC,EAAE,CAAC,IAAI,CAAC;YAGb,IAAI,CAAC,EAAE,CAAC,SAAS;QACrB;QAEA,OAAO,IAAI,CAAC,SAAS,CAAC,OAAO,CAACF;IAClC;AACJ;AAEO,MAAMG,mCAAmCC,iBAAiB,eAAe,CAAC;IAC7E,WAAWR;IACX,cAAc;QAACS;QAAmBC;KAAU;AAChD"}
1
+ {"version":3,"file":"decorators/GetPulumiServiceWithDownloadInfo.js","sources":["../../src/decorators/GetPulumiServiceWithDownloadInfo.ts"],"sourcesContent":["import { UiService } from \"@webiny/project/abstractions/index.js\";\nimport { GetPulumiService } from \"~/abstractions/services/GetPulumiService.js\";\n\nexport class GetPulumiServiceWithDownloadInfo implements GetPulumiService.Interface {\n constructor(\n private ui: UiService.Interface,\n private decoratee: GetPulumiService.Interface\n ) {}\n\n async execute(params: GetPulumiService.Params = {}) {\n const pulumiOptions = params.pulumiOptions || {};\n const beforePulumiInstall = pulumiOptions.beforePulumiInstall;\n\n return this.decoratee.execute({\n ...params,\n pulumiOptions: {\n ...pulumiOptions,\n beforePulumiInstall: async () => {\n this.ui.info(\"Downloading Pulumi CLI...\");\n\n // New line b/c after the Pulumi CLI download, plugins are next.\n this.ui.emptyLine();\n\n await beforePulumiInstall?.();\n }\n }\n });\n }\n}\n\nexport const getPulumiServiceWithDownloadInfo = GetPulumiService.createDecorator({\n decorator: GetPulumiServiceWithDownloadInfo,\n dependencies: [UiService]\n});\n"],"names":["GetPulumiServiceWithDownloadInfo","ui","decoratee","params","pulumiOptions","beforePulumiInstall","getPulumiServiceWithDownloadInfo","GetPulumiService","UiService"],"mappings":";;AAGO,MAAMA;IACT,YACYC,EAAuB,EACvBC,SAAqC,CAC/C;aAFUD,EAAE,GAAFA;aACAC,SAAS,GAATA;IACT;IAEH,MAAM,QAAQC,SAAkC,CAAC,CAAC,EAAE;QAChD,MAAMC,gBAAgBD,OAAO,aAAa,IAAI,CAAC;QAC/C,MAAME,sBAAsBD,cAAc,mBAAmB;QAE7D,OAAO,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC;YAC1B,GAAGD,MAAM;YACT,eAAe;gBACX,GAAGC,aAAa;gBAChB,qBAAqB;oBACjB,IAAI,CAAC,EAAE,CAAC,IAAI,CAAC;oBAGb,IAAI,CAAC,EAAE,CAAC,SAAS;oBAEjB,MAAMC;gBACV;YACJ;QACJ;IACJ;AACJ;AAEO,MAAMC,mCAAmCC,iBAAiB,eAAe,CAAC;IAC7E,WAAWP;IACX,cAAc;QAACQ;KAAU;AAC7B"}
@@ -0,0 +1,12 @@
1
+ /**
2
+ * The internal `AuroraPostgresCluster` that `<Infra.AuroraPostgres />` renders: the API runs on an
3
+ * Aurora PostgreSQL Serverless v2 database the core app creates (`AddCorePostgres`), which reads
4
+ * these params through `getPostgresConfigFromExtension`.
5
+ */
6
+ export declare const AuroraPostgresCluster: import("@webiny/project/defineExtension/defineExtension").ExtensionComponent<import("zod").ZodObject<{
7
+ minCapacity: import("zod").ZodOptional<import("zod").ZodNumber>;
8
+ maxCapacity: import("zod").ZodOptional<import("zod").ZodNumber>;
9
+ readers: import("zod").ZodOptional<import("zod").ZodNumber>;
10
+ rdsProxy: import("zod").ZodOptional<import("zod").ZodBoolean>;
11
+ poolSize: import("zod").ZodOptional<import("zod").ZodNumber>;
12
+ }, import("zod/v4/core").$strip>>;
@@ -1,18 +1,18 @@
1
1
  import react from "react";
2
2
  import { defineExtension } from "@webiny/project/defineExtension/index.js";
3
- import { CoreBeforeDeploy, postgresParamsSchema } from "@webiny/project-extensions-aws/extensions/index.js";
3
+ import { CoreBeforeDeploy, auroraPostgresClusterParamsSchema } from "@webiny/project-extensions-aws/extensions/index.js";
4
4
  import { createPathResolver } from "@webiny/project";
5
5
  import { ApiAfterBuild, DatabaseSetup, ProjectDecorator } from "@webiny/project/extensions/index.js";
6
6
  import { CorePulumi } from "../pulumi/extensions/CorePulumi.js";
7
7
  const p = createPathResolver(import.meta.dirname, "Postgres");
8
- const Postgres = defineExtension({
9
- type: "Infra/Postgres",
8
+ const AuroraPostgresCluster = defineExtension({
9
+ type: "Infra/AuroraPostgresCluster",
10
10
  tags: {
11
11
  runtimeContext: "project",
12
12
  hosting: "aws"
13
13
  },
14
- description: "Run the API on an Aurora PostgreSQL Serverless v2 database the core app creates.",
15
- paramsSchema: postgresParamsSchema,
14
+ description: "The Aurora PostgreSQL Serverless v2 cluster the core app creates (internal).",
15
+ paramsSchema: auroraPostgresClusterParamsSchema,
16
16
  render: ()=>/*#__PURE__*/ react.createElement(react.Fragment, null, /*#__PURE__*/ react.createElement(DatabaseSetup, {
17
17
  setupName: "pg"
18
18
  }), /*#__PURE__*/ react.createElement(CoreBeforeDeploy, {
@@ -25,6 +25,6 @@ const Postgres = defineExtension({
25
25
  src: p("CopyPgModulesAfterApiBuild.js")
26
26
  }))
27
27
  });
28
- export { Postgres };
28
+ export { AuroraPostgresCluster };
29
29
 
30
- //# sourceMappingURL=Postgres.js.map
30
+ //# sourceMappingURL=AuroraPostgresCluster.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"extensions/AuroraPostgresCluster.js","sources":["../../src/extensions/AuroraPostgresCluster.tsx"],"sourcesContent":["import React from \"react\";\nimport { defineExtension } from \"@webiny/project/defineExtension/index.js\";\nimport { auroraPostgresClusterParamsSchema } from \"@webiny/project-extensions-aws/extensions/index.js\";\nimport { CoreBeforeDeploy } from \"@webiny/project-extensions-aws/extensions/index.js\";\nimport { createPathResolver } from \"@webiny/project\";\nimport {\n ApiAfterBuild,\n DatabaseSetup,\n ProjectDecorator\n} from \"@webiny/project/extensions/index.js\";\nimport { CorePulumi } from \"~/pulumi/extensions/CorePulumi.js\";\n\nconst p = createPathResolver(import.meta.dirname, \"Postgres\");\n\n/**\n * The internal `AuroraPostgresCluster` that `<Infra.AuroraPostgres />` renders: the API runs on an\n * Aurora PostgreSQL Serverless v2 database the core app creates (`AddCorePostgres`), which reads\n * these params through `getPostgresConfigFromExtension`.\n */\nexport const AuroraPostgresCluster = defineExtension({\n type: \"Infra/AuroraPostgresCluster\",\n tags: { runtimeContext: \"project\", hosting: \"aws\" },\n description: \"The Aurora PostgreSQL Serverless v2 cluster the core app creates (internal).\",\n paramsSchema: auroraPostgresClusterParamsSchema,\n render: () => {\n return (\n <>\n <DatabaseSetup setupName=\"pg\" />\n <CoreBeforeDeploy src={p(\"ValidatePostgresBeforeCoreDeploy.js\")} />\n <CorePulumi src={p(\"AddCorePostgres.js\")} />\n {/* Every API function runs the one api bundle: its Postgres entry, with knex + pg. */}\n <ProjectDecorator src={p(\"ReplaceApiLambdaFnHandlers.js\")} />\n <ApiAfterBuild src={p(\"CopyPgModulesAfterApiBuild.js\")} />\n </>\n );\n }\n});\n"],"names":["p","createPathResolver","AuroraPostgresCluster","defineExtension","auroraPostgresClusterParamsSchema","DatabaseSetup","CoreBeforeDeploy","CorePulumi","ProjectDecorator","ApiAfterBuild"],"mappings":";;;;;;AAYA,MAAMA,IAAIC,mBAAmB,YAAY,OAAO,EAAE;AAO3C,MAAMC,wBAAwBC,gBAAgB;IACjD,MAAM;IACN,MAAM;QAAE,gBAAgB;QAAW,SAAS;IAAM;IAClD,aAAa;IACb,cAAcC;IACd,QAAQ,IACG,WAAP,GACI,wDACI,oBAACC,eAAaA;YAAC,WAAU;0BACzB,oBAACC,kBAAgBA;YAAC,KAAKN,EAAE;0BACzB,oBAACO,YAAUA;YAAC,KAAKP,EAAE;0BAEnB,oBAACQ,kBAAgBA;YAAC,KAAKR,EAAE;0BACzB,oBAACS,eAAaA;YAAC,KAAKT,EAAE;;AAItC"}
@@ -15,7 +15,7 @@ import type { VpcExtensionConfig } from "../../pulumi/apps/extensions/isVpcEnabl
15
15
  export declare const getPostgresNetwork: (app: Pick<CorePulumiApp, "getModule">, vpcConfig: VpcExtensionConfig) => PostgresNetwork;
16
16
  /**
17
17
  * Adds the Postgres database (`CorePostgres`) to the core app, and the outputs the API app
18
- * connects with. Rendered by `<Infra.Postgres />`.
18
+ * connects with. Rendered by `<Infra.AuroraPostgres />`.
19
19
  */
20
20
  export declare class AddCorePostgresImpl implements CorePulumi.Interface {
21
21
  private getProjectConfigService;
@@ -3,7 +3,6 @@ import { CorePulumi } from "@webiny/project-extensions-aws/abstractions/features
3
3
  import { CoreVpc } from "../../pulumi/apps/core/CoreVpc.js";
4
4
  import { CorePostgres } from "../../pulumi/apps/core/CorePostgres.js";
5
5
  import { getPostgresConfigFromExtension } from "../../pulumi/apps/extensions/getPostgresConfigFromExtension.js";
6
- import { getRdsProxyConfigFromExtension } from "../../pulumi/apps/extensions/getRdsProxyConfigFromExtension.js";
7
6
  import { getVpcConfigFromExtension } from "../../pulumi/apps/extensions/getVpcConfigFromExtension.js";
8
7
  const getPostgresNetwork = (app, vpcConfig)=>{
9
8
  if ("object" == typeof vpcConfig && vpcConfig.useExistingVpc) {
@@ -36,7 +35,6 @@ class AddCorePostgresImpl {
36
35
  const network = getPostgresNetwork(app, getVpcConfigFromExtension(projectConfig));
37
36
  const { outputs } = app.addModule(CorePostgres, {
38
37
  ...postgres,
39
- rdsProxy: getRdsProxyConfigFromExtension(projectConfig),
40
38
  network,
41
39
  protect: app.env.isProduction
42
40
  });
@@ -1 +1 @@
1
- {"version":3,"file":"extensions/Postgres/AddCorePostgres.js","sources":["../../../src/extensions/Postgres/AddCorePostgres.ts"],"sourcesContent":["import { GetProjectConfigService } from \"@webiny/project/abstractions/index.js\";\nimport { CorePulumi } from \"@webiny/project-extensions-aws/abstractions/features/pulumi/index.js\";\nimport type { CorePulumiApp } from \"~/pulumi/apps/core/createCorePulumiApp.js\";\nimport { CoreVpc } from \"~/pulumi/apps/core/CoreVpc.js\";\nimport { CorePostgres, type PostgresNetwork } from \"~/pulumi/apps/core/CorePostgres.js\";\nimport { getPostgresConfigFromExtension } from \"~/pulumi/apps/extensions/getPostgresConfigFromExtension.js\";\nimport { getRdsProxyConfigFromExtension } from \"~/pulumi/apps/extensions/getRdsProxyConfigFromExtension.js\";\nimport { getVpcConfigFromExtension } from \"~/pulumi/apps/extensions/getVpcConfigFromExtension.js\";\nimport type { VpcExtensionConfig } from \"~/pulumi/apps/extensions/isVpcEnabled.js\";\n\n/**\n * Where the database goes. With an existing VPC: the subnets and security groups of its\n * `postgresVpcConfig`. Otherwise: the private subnets of the VPC the core app creates, and its\n * default security group, which the API functions use too, so they reach the database without\n * extra rules.\n *\n * `ValidatePostgresBeforeCoreDeploy` already stopped the deploy if neither exists; this throws\n * for a Pulumi run that skipped the deploy hooks.\n */\nexport const getPostgresNetwork = (\n app: Pick<CorePulumiApp, \"getModule\">,\n vpcConfig: VpcExtensionConfig\n): PostgresNetwork => {\n if (typeof vpcConfig === \"object\" && vpcConfig.useExistingVpc) {\n const postgresVpcConfig = vpcConfig.useExistingVpc.postgresVpcConfig;\n if (!postgresVpcConfig) {\n throw new Error(\n \"Cannot deploy Postgres into an existing VPC: `useExistingVpc` has no `postgresVpcConfig`.\"\n );\n }\n return {\n subnetIds: postgresVpcConfig.subnetIds,\n securityGroupIds: postgresVpcConfig.securityGroupIds\n };\n }\n\n const vpc = app.getModule(CoreVpc, { optional: true });\n if (!vpc) {\n throw new Error(\"Cannot deploy Postgres without a VPC: add <Infra.Vpc enabled />.\");\n }\n\n return {\n subnetIds: vpc.subnets.private.map(subnet => subnet.output.id),\n securityGroupIds: [vpc.vpc.output.defaultSecurityGroupId]\n };\n};\n\n/**\n * Adds the Postgres database (`CorePostgres`) to the core app, and the outputs the API app\n * connects with. Rendered by `<Infra.Postgres />`.\n */\nexport class AddCorePostgresImpl implements CorePulumi.Interface {\n constructor(private getProjectConfigService: GetProjectConfigService.Interface) {}\n\n async execute(app: CorePulumiApp) {\n const projectConfig = await this.getProjectConfigService.execute();\n const postgres = getPostgresConfigFromExtension(projectConfig);\n if (!postgres) {\n return;\n }\n\n const network = getPostgresNetwork(app, getVpcConfigFromExtension(projectConfig));\n\n const { outputs } = app.addModule(CorePostgres, {\n ...postgres,\n rdsProxy: getRdsProxyConfigFromExtension(projectConfig),\n network,\n protect: app.env.isProduction\n });\n\n app.addOutputs(outputs);\n }\n}\n\nexport const AddCorePostgres = CorePulumi.createImplementation({\n implementation: AddCorePostgresImpl,\n dependencies: [GetProjectConfigService]\n});\n"],"names":["getPostgresNetwork","app","vpcConfig","postgresVpcConfig","Error","vpc","CoreVpc","subnet","AddCorePostgresImpl","getProjectConfigService","projectConfig","postgres","getPostgresConfigFromExtension","network","getVpcConfigFromExtension","outputs","CorePostgres","getRdsProxyConfigFromExtension","AddCorePostgres","CorePulumi","GetProjectConfigService"],"mappings":";;;;;;;AAmBO,MAAMA,qBAAqB,CAC9BC,KACAC;IAEA,IAAI,AAAqB,YAArB,OAAOA,aAA0BA,UAAU,cAAc,EAAE;QAC3D,MAAMC,oBAAoBD,UAAU,cAAc,CAAC,iBAAiB;QACpE,IAAI,CAACC,mBACD,MAAM,IAAIC,MACN;QAGR,OAAO;YACH,WAAWD,kBAAkB,SAAS;YACtC,kBAAkBA,kBAAkB,gBAAgB;QACxD;IACJ;IAEA,MAAME,MAAMJ,IAAI,SAAS,CAACK,SAAS;QAAE,UAAU;IAAK;IACpD,IAAI,CAACD,KACD,MAAM,IAAID,MAAM;IAGpB,OAAO;QACH,WAAWC,IAAI,OAAO,CAAC,OAAO,CAAC,GAAG,CAACE,CAAAA,SAAUA,OAAO,MAAM,CAAC,EAAE;QAC7D,kBAAkB;YAACF,IAAI,GAAG,CAAC,MAAM,CAAC,sBAAsB;SAAC;IAC7D;AACJ;AAMO,MAAMG;IACT,YAAoBC,uBAA0D,CAAE;aAA5DA,uBAAuB,GAAvBA;IAA6D;IAEjF,MAAM,QAAQR,GAAkB,EAAE;QAC9B,MAAMS,gBAAgB,MAAM,IAAI,CAAC,uBAAuB,CAAC,OAAO;QAChE,MAAMC,WAAWC,+BAA+BF;QAChD,IAAI,CAACC,UACD;QAGJ,MAAME,UAAUb,mBAAmBC,KAAKa,0BAA0BJ;QAElE,MAAM,EAAEK,OAAO,EAAE,GAAGd,IAAI,SAAS,CAACe,cAAc;YAC5C,GAAGL,QAAQ;YACX,UAAUM,+BAA+BP;YACzCG;YACA,SAASZ,IAAI,GAAG,CAAC,YAAY;QACjC;QAEAA,IAAI,UAAU,CAACc;IACnB;AACJ;AAEO,MAAMG,kBAAkBC,WAAW,oBAAoB,CAAC;IAC3D,gBAAgBX;IAChB,cAAc;QAACY;KAAwB;AAC3C"}
1
+ {"version":3,"file":"extensions/Postgres/AddCorePostgres.js","sources":["../../../src/extensions/Postgres/AddCorePostgres.ts"],"sourcesContent":["import { GetProjectConfigService } from \"@webiny/project/abstractions/index.js\";\nimport { CorePulumi } from \"@webiny/project-extensions-aws/abstractions/features/pulumi/index.js\";\nimport type { CorePulumiApp } from \"~/pulumi/apps/core/createCorePulumiApp.js\";\nimport { CoreVpc } from \"~/pulumi/apps/core/CoreVpc.js\";\nimport { CorePostgres, type PostgresNetwork } from \"~/pulumi/apps/core/CorePostgres.js\";\nimport { getPostgresConfigFromExtension } from \"~/pulumi/apps/extensions/getPostgresConfigFromExtension.js\";\nimport { getVpcConfigFromExtension } from \"~/pulumi/apps/extensions/getVpcConfigFromExtension.js\";\nimport type { VpcExtensionConfig } from \"~/pulumi/apps/extensions/isVpcEnabled.js\";\n\n/**\n * Where the database goes. With an existing VPC: the subnets and security groups of its\n * `postgresVpcConfig`. Otherwise: the private subnets of the VPC the core app creates, and its\n * default security group, which the API functions use too, so they reach the database without\n * extra rules.\n *\n * `ValidatePostgresBeforeCoreDeploy` already stopped the deploy if neither exists; this throws\n * for a Pulumi run that skipped the deploy hooks.\n */\nexport const getPostgresNetwork = (\n app: Pick<CorePulumiApp, \"getModule\">,\n vpcConfig: VpcExtensionConfig\n): PostgresNetwork => {\n if (typeof vpcConfig === \"object\" && vpcConfig.useExistingVpc) {\n const postgresVpcConfig = vpcConfig.useExistingVpc.postgresVpcConfig;\n if (!postgresVpcConfig) {\n throw new Error(\n \"Cannot deploy Postgres into an existing VPC: `useExistingVpc` has no `postgresVpcConfig`.\"\n );\n }\n return {\n subnetIds: postgresVpcConfig.subnetIds,\n securityGroupIds: postgresVpcConfig.securityGroupIds\n };\n }\n\n const vpc = app.getModule(CoreVpc, { optional: true });\n if (!vpc) {\n throw new Error(\"Cannot deploy Postgres without a VPC: add <Infra.Vpc enabled />.\");\n }\n\n return {\n subnetIds: vpc.subnets.private.map(subnet => subnet.output.id),\n securityGroupIds: [vpc.vpc.output.defaultSecurityGroupId]\n };\n};\n\n/**\n * Adds the Postgres database (`CorePostgres`) to the core app, and the outputs the API app\n * connects with. Rendered by `<Infra.AuroraPostgres />`.\n */\nexport class AddCorePostgresImpl implements CorePulumi.Interface {\n constructor(private getProjectConfigService: GetProjectConfigService.Interface) {}\n\n async execute(app: CorePulumiApp) {\n const projectConfig = await this.getProjectConfigService.execute();\n const postgres = getPostgresConfigFromExtension(projectConfig);\n if (!postgres) {\n return;\n }\n\n const network = getPostgresNetwork(app, getVpcConfigFromExtension(projectConfig));\n\n const { outputs } = app.addModule(CorePostgres, {\n ...postgres,\n network,\n protect: app.env.isProduction\n });\n\n app.addOutputs(outputs);\n }\n}\n\nexport const AddCorePostgres = CorePulumi.createImplementation({\n implementation: AddCorePostgresImpl,\n dependencies: [GetProjectConfigService]\n});\n"],"names":["getPostgresNetwork","app","vpcConfig","postgresVpcConfig","Error","vpc","CoreVpc","subnet","AddCorePostgresImpl","getProjectConfigService","projectConfig","postgres","getPostgresConfigFromExtension","network","getVpcConfigFromExtension","outputs","CorePostgres","AddCorePostgres","CorePulumi","GetProjectConfigService"],"mappings":";;;;;;AAkBO,MAAMA,qBAAqB,CAC9BC,KACAC;IAEA,IAAI,AAAqB,YAArB,OAAOA,aAA0BA,UAAU,cAAc,EAAE;QAC3D,MAAMC,oBAAoBD,UAAU,cAAc,CAAC,iBAAiB;QACpE,IAAI,CAACC,mBACD,MAAM,IAAIC,MACN;QAGR,OAAO;YACH,WAAWD,kBAAkB,SAAS;YACtC,kBAAkBA,kBAAkB,gBAAgB;QACxD;IACJ;IAEA,MAAME,MAAMJ,IAAI,SAAS,CAACK,SAAS;QAAE,UAAU;IAAK;IACpD,IAAI,CAACD,KACD,MAAM,IAAID,MAAM;IAGpB,OAAO;QACH,WAAWC,IAAI,OAAO,CAAC,OAAO,CAAC,GAAG,CAACE,CAAAA,SAAUA,OAAO,MAAM,CAAC,EAAE;QAC7D,kBAAkB;YAACF,IAAI,GAAG,CAAC,MAAM,CAAC,sBAAsB;SAAC;IAC7D;AACJ;AAMO,MAAMG;IACT,YAAoBC,uBAA0D,CAAE;aAA5DA,uBAAuB,GAAvBA;IAA6D;IAEjF,MAAM,QAAQR,GAAkB,EAAE;QAC9B,MAAMS,gBAAgB,MAAM,IAAI,CAAC,uBAAuB,CAAC,OAAO;QAChE,MAAMC,WAAWC,+BAA+BF;QAChD,IAAI,CAACC,UACD;QAGJ,MAAME,UAAUb,mBAAmBC,KAAKa,0BAA0BJ;QAElE,MAAM,EAAEK,OAAO,EAAE,GAAGd,IAAI,SAAS,CAACe,cAAc;YAC5C,GAAGL,QAAQ;YACXE;YACA,SAASZ,IAAI,GAAG,CAAC,YAAY;QACjC;QAEAA,IAAI,UAAU,CAACc;IACnB;AACJ;AAEO,MAAME,kBAAkBC,WAAW,oBAAoB,CAAC;IAC3D,gBAAgBV;IAChB,cAAc;QAACW;KAAwB;AAC3C"}
@@ -1,8 +1,9 @@
1
1
  import { ApiAfterBuild, GetApp, UiService } from "@webiny/project/abstractions/index.js";
2
2
  /**
3
- * After `build api` with `<Infra.Postgres />`: put knex and pg into each bundle's `node_modules`, so
4
- * the functions that run it can load them, and the RDS CA bundle into `build-web`, so the web
5
- * function can verify the database's certificate. The api deploy uploads those folders as they are.
3
+ * After `build api` with `<Infra.AuroraPostgres />`: put knex and pg into each bundle's
4
+ * `node_modules`, so the functions that run it can load them, and the RDS CA bundle into
5
+ * `build-web`, so the web function can verify the database's certificate. The api deploy uploads
6
+ * those folders as they are.
6
7
  */
7
8
  export declare class CopyPgModulesAfterApiBuildImpl implements ApiAfterBuild.Interface {
8
9
  private getApp;
@@ -1 +1 @@
1
- {"version":3,"file":"extensions/Postgres/CopyPgModulesAfterApiBuild.js","sources":["../../../src/extensions/Postgres/CopyPgModulesAfterApiBuild.ts"],"sourcesContent":["import fs from \"fs\";\nimport path from \"path\";\nimport { ApiAfterBuild, GetApp, UiService } from \"@webiny/project/abstractions/index.js\";\nimport { copyPgRuntimeModules } from \"./copyPgRuntimeModules.js\";\nimport { RDS_CA_BUNDLE_FILE, RDS_CA_BUNDLE_SOURCE } from \"./rdsCaBundle.js\";\n\n/**\n * The api bundles that load knex and pg at runtime: `build` for the Lambda functions and `build-web`\n * for the Lambda web function. `build-web` exists only when the web function is on.\n */\nconst BUILD_FOLDERS = [\"build\", \"build-web\"];\n\n/** The bundle whose function needs the RDS CA bundle shipped with its code (see `rdsCaBundle.ts`). */\nconst WEB_BUILD_FOLDER = \"build-web\";\n\n/**\n * After `build api` with `<Infra.Postgres />`: put knex and pg into each bundle's `node_modules`, so\n * the functions that run it can load them, and the RDS CA bundle into `build-web`, so the web\n * function can verify the database's certificate. The api deploy uploads those folders as they are.\n */\nexport class CopyPgModulesAfterApiBuildImpl implements ApiAfterBuild.Interface {\n constructor(\n private getApp: GetApp.Interface,\n private ui: UiService.Interface\n ) {}\n\n async execute() {\n const graphqlFolder = this.getApp.execute(\"api\").paths.workspaceFolder.join(\"graphql\");\n\n for (const buildFolder of BUILD_FOLDERS) {\n const buildDir = graphqlFolder.join(buildFolder).toString();\n if (!fs.existsSync(buildDir)) {\n continue;\n }\n\n const { packages, files } = await copyPgRuntimeModules({\n resolveFrom: graphqlFolder.toString(),\n buildDir\n });\n\n this.ui.info(\n \"Copied knex and pg into the API's %s (%s package(s), %s file(s)).\",\n buildFolder,\n packages.length,\n files\n );\n\n if (buildFolder === WEB_BUILD_FOLDER) {\n fs.copyFileSync(RDS_CA_BUNDLE_SOURCE, path.join(buildDir, RDS_CA_BUNDLE_FILE));\n this.ui.info(\"Copied the RDS CA bundle into the API's %s.\", buildFolder);\n }\n }\n }\n}\n\nexport const CopyPgModulesAfterApiBuild = ApiAfterBuild.createImplementation({\n implementation: CopyPgModulesAfterApiBuildImpl,\n dependencies: [GetApp, UiService]\n});\n"],"names":["BUILD_FOLDERS","WEB_BUILD_FOLDER","CopyPgModulesAfterApiBuildImpl","getApp","ui","graphqlFolder","buildFolder","buildDir","fs","packages","files","copyPgRuntimeModules","RDS_CA_BUNDLE_SOURCE","path","RDS_CA_BUNDLE_FILE","CopyPgModulesAfterApiBuild","ApiAfterBuild","GetApp","UiService"],"mappings":";;;;;AAUA,MAAMA,gBAAgB;IAAC;IAAS;CAAY;AAG5C,MAAMC,mBAAmB;AAOlB,MAAMC;IACT,YACYC,MAAwB,EACxBC,EAAuB,CACjC;aAFUD,MAAM,GAANA;aACAC,EAAE,GAAFA;IACT;IAEH,MAAM,UAAU;QACZ,MAAMC,gBAAgB,IAAI,CAAC,MAAM,CAAC,OAAO,CAAC,OAAO,KAAK,CAAC,eAAe,CAAC,IAAI,CAAC;QAE5E,KAAK,MAAMC,eAAeN,cAAe;YACrC,MAAMO,WAAWF,cAAc,IAAI,CAACC,aAAa,QAAQ;YACzD,IAAI,CAACE,GAAG,UAAU,CAACD,WACf;YAGJ,MAAM,EAAEE,QAAQ,EAAEC,KAAK,EAAE,GAAG,MAAMC,qBAAqB;gBACnD,aAAaN,cAAc,QAAQ;gBACnCE;YACJ;YAEA,IAAI,CAAC,EAAE,CAAC,IAAI,CACR,qEACAD,aACAG,SAAS,MAAM,EACfC;YAGJ,IAAIJ,gBAAgBL,kBAAkB;gBAClCO,GAAG,YAAY,CAACI,sBAAsBC,KAAK,IAAI,CAACN,UAAUO;gBAC1D,IAAI,CAAC,EAAE,CAAC,IAAI,CAAC,+CAA+CR;YAChE;QACJ;IACJ;AACJ;AAEO,MAAMS,6BAA6BC,cAAc,oBAAoB,CAAC;IACzE,gBAAgBd;IAChB,cAAc;QAACe;QAAQC;KAAU;AACrC"}
1
+ {"version":3,"file":"extensions/Postgres/CopyPgModulesAfterApiBuild.js","sources":["../../../src/extensions/Postgres/CopyPgModulesAfterApiBuild.ts"],"sourcesContent":["import fs from \"fs\";\nimport path from \"path\";\nimport { ApiAfterBuild, GetApp, UiService } from \"@webiny/project/abstractions/index.js\";\nimport { copyPgRuntimeModules } from \"./copyPgRuntimeModules.js\";\nimport { RDS_CA_BUNDLE_FILE, RDS_CA_BUNDLE_SOURCE } from \"./rdsCaBundle.js\";\n\n/**\n * The api bundles that load knex and pg at runtime: `build` for the Lambda functions and `build-web`\n * for the Lambda web function. `build-web` exists only when the web function is on.\n */\nconst BUILD_FOLDERS = [\"build\", \"build-web\"];\n\n/** The bundle whose function needs the RDS CA bundle shipped with its code (see `rdsCaBundle.ts`). */\nconst WEB_BUILD_FOLDER = \"build-web\";\n\n/**\n * After `build api` with `<Infra.AuroraPostgres />`: put knex and pg into each bundle's\n * `node_modules`, so the functions that run it can load them, and the RDS CA bundle into\n * `build-web`, so the web function can verify the database's certificate. The api deploy uploads\n * those folders as they are.\n */\nexport class CopyPgModulesAfterApiBuildImpl implements ApiAfterBuild.Interface {\n constructor(\n private getApp: GetApp.Interface,\n private ui: UiService.Interface\n ) {}\n\n async execute() {\n const graphqlFolder = this.getApp.execute(\"api\").paths.workspaceFolder.join(\"graphql\");\n\n for (const buildFolder of BUILD_FOLDERS) {\n const buildDir = graphqlFolder.join(buildFolder).toString();\n if (!fs.existsSync(buildDir)) {\n continue;\n }\n\n const { packages, files } = await copyPgRuntimeModules({\n resolveFrom: graphqlFolder.toString(),\n buildDir\n });\n\n this.ui.info(\n \"Copied knex and pg into the API's %s (%s package(s), %s file(s)).\",\n buildFolder,\n packages.length,\n files\n );\n\n if (buildFolder === WEB_BUILD_FOLDER) {\n fs.copyFileSync(RDS_CA_BUNDLE_SOURCE, path.join(buildDir, RDS_CA_BUNDLE_FILE));\n this.ui.info(\"Copied the RDS CA bundle into the API's %s.\", buildFolder);\n }\n }\n }\n}\n\nexport const CopyPgModulesAfterApiBuild = ApiAfterBuild.createImplementation({\n implementation: CopyPgModulesAfterApiBuildImpl,\n dependencies: [GetApp, UiService]\n});\n"],"names":["BUILD_FOLDERS","WEB_BUILD_FOLDER","CopyPgModulesAfterApiBuildImpl","getApp","ui","graphqlFolder","buildFolder","buildDir","fs","packages","files","copyPgRuntimeModules","RDS_CA_BUNDLE_SOURCE","path","RDS_CA_BUNDLE_FILE","CopyPgModulesAfterApiBuild","ApiAfterBuild","GetApp","UiService"],"mappings":";;;;;AAUA,MAAMA,gBAAgB;IAAC;IAAS;CAAY;AAG5C,MAAMC,mBAAmB;AAQlB,MAAMC;IACT,YACYC,MAAwB,EACxBC,EAAuB,CACjC;aAFUD,MAAM,GAANA;aACAC,EAAE,GAAFA;IACT;IAEH,MAAM,UAAU;QACZ,MAAMC,gBAAgB,IAAI,CAAC,MAAM,CAAC,OAAO,CAAC,OAAO,KAAK,CAAC,eAAe,CAAC,IAAI,CAAC;QAE5E,KAAK,MAAMC,eAAeN,cAAe;YACrC,MAAMO,WAAWF,cAAc,IAAI,CAACC,aAAa,QAAQ;YACzD,IAAI,CAACE,GAAG,UAAU,CAACD,WACf;YAGJ,MAAM,EAAEE,QAAQ,EAAEC,KAAK,EAAE,GAAG,MAAMC,qBAAqB;gBACnD,aAAaN,cAAc,QAAQ;gBACnCE;YACJ;YAEA,IAAI,CAAC,EAAE,CAAC,IAAI,CACR,qEACAD,aACAG,SAAS,MAAM,EACfC;YAGJ,IAAIJ,gBAAgBL,kBAAkB;gBAClCO,GAAG,YAAY,CAACI,sBAAsBC,KAAK,IAAI,CAACN,UAAUO;gBAC1D,IAAI,CAAC,EAAE,CAAC,IAAI,CAAC,+CAA+CR;YAChE;QACJ;IACJ;AACJ;AAEO,MAAMS,6BAA6BC,cAAc,oBAAoB,CAAC;IACzE,gBAAgBd;IAChB,cAAc;QAACe;QAAQC;KAAU;AACrC"}
@@ -1,8 +1,8 @@
1
1
  import { BuildAppWorkspaceService, GetApp, LoggerService } from "@webiny/project/abstractions/index.js";
2
2
  /**
3
- * With `<Infra.Postgres />`, the api workspace gets the Postgres entry file: it exports the handlers
4
- * from `@webiny/api-event-handler-aws-pg` instead of the DynamoDB ones. Every API function runs this
5
- * one bundle, so this puts all of them on Postgres.
3
+ * With `<Infra.AuroraPostgres />`, the api workspace gets the Postgres entry file: it exports the
4
+ * handlers from `@webiny/api-composition-aws-pg` instead of the DynamoDB ones. Every API function
5
+ * runs this one bundle, so this puts all of them on Postgres.
6
6
  */
7
7
  declare class ReplaceApiLambdaFnHandlersDecorator implements BuildAppWorkspaceService.Interface {
8
8
  private getApp;
@@ -1 +1 @@
1
- {"version":3,"file":"extensions/Postgres/ReplaceApiLambdaFnHandlers.js","sources":["../../../src/extensions/Postgres/ReplaceApiLambdaFnHandlers.ts"],"sourcesContent":["import path from \"path\";\nimport fs from \"fs\";\nimport {\n BuildAppWorkspaceService,\n GetApp,\n LoggerService\n} from \"@webiny/project/abstractions/index.js\";\nimport { getTemplatesFolderPath } from \"~/utils/index.js\";\n\n/**\n * With `<Infra.Postgres />`, the api workspace gets the Postgres entry file: it exports the handlers\n * from `@webiny/api-event-handler-aws-pg` instead of the DynamoDB ones. Every API function runs this\n * one bundle, so this puts all of them on Postgres.\n */\nclass ReplaceApiLambdaFnHandlersDecorator implements BuildAppWorkspaceService.Interface {\n constructor(\n private getApp: GetApp.Interface,\n private logger: LoggerService.Interface,\n private decoratee: BuildAppWorkspaceService.Interface\n ) {}\n\n async execute(appName: GetApp.AppName, options: BuildAppWorkspaceService.Options = {}) {\n const result = await this.decoratee.execute(appName, options);\n if (appName !== \"api\") {\n return result;\n }\n\n const app = this.getApp.execute(\"api\");\n const handlersFolderPath = path.join(\n getTemplatesFolderPath(),\n \"extensions\",\n \"Postgres\",\n \"api\"\n );\n\n fs.cpSync(handlersFolderPath, app.paths.workspaceFolder.toString(), {\n recursive: true,\n force: true\n });\n\n this.logger.debug(\"Replaced API Lambda function handlers with Postgres versions.\");\n\n return result;\n }\n}\n\nexport const ReplaceApiLambdaFnHandlers = BuildAppWorkspaceService.createDecorator({\n decorator: ReplaceApiLambdaFnHandlersDecorator,\n dependencies: [GetApp, LoggerService]\n});\n"],"names":["ReplaceApiLambdaFnHandlersDecorator","getApp","logger","decoratee","appName","options","result","app","handlersFolderPath","path","getTemplatesFolderPath","fs","ReplaceApiLambdaFnHandlers","BuildAppWorkspaceService","GetApp","LoggerService"],"mappings":";;;;AAcA,MAAMA;IACF,YACYC,MAAwB,EACxBC,MAA+B,EAC/BC,SAA6C,CACvD;aAHUF,MAAM,GAANA;aACAC,MAAM,GAANA;aACAC,SAAS,GAATA;IACT;IAEH,MAAM,QAAQC,OAAuB,EAAEC,UAA4C,CAAC,CAAC,EAAE;QACnF,MAAMC,SAAS,MAAM,IAAI,CAAC,SAAS,CAAC,OAAO,CAACF,SAASC;QACrD,IAAID,AAAY,UAAZA,SACA,OAAOE;QAGX,MAAMC,MAAM,IAAI,CAAC,MAAM,CAAC,OAAO,CAAC;QAChC,MAAMC,qBAAqBC,KAAK,IAAI,CAChCC,0BACA,cACA,YACA;QAGJC,GAAG,MAAM,CAACH,oBAAoBD,IAAI,KAAK,CAAC,eAAe,CAAC,QAAQ,IAAI;YAChE,WAAW;YACX,OAAO;QACX;QAEA,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC;QAElB,OAAOD;IACX;AACJ;AAEO,MAAMM,6BAA6BC,yBAAyB,eAAe,CAAC;IAC/E,WAAWb;IACX,cAAc;QAACc;QAAQC;KAAc;AACzC"}
1
+ {"version":3,"file":"extensions/Postgres/ReplaceApiLambdaFnHandlers.js","sources":["../../../src/extensions/Postgres/ReplaceApiLambdaFnHandlers.ts"],"sourcesContent":["import path from \"path\";\nimport fs from \"fs\";\nimport {\n BuildAppWorkspaceService,\n GetApp,\n LoggerService\n} from \"@webiny/project/abstractions/index.js\";\nimport { getTemplatesFolderPath } from \"~/utils/index.js\";\n\n/**\n * With `<Infra.AuroraPostgres />`, the api workspace gets the Postgres entry file: it exports the\n * handlers from `@webiny/api-composition-aws-pg` instead of the DynamoDB ones. Every API function\n * runs this one bundle, so this puts all of them on Postgres.\n */\nclass ReplaceApiLambdaFnHandlersDecorator implements BuildAppWorkspaceService.Interface {\n constructor(\n private getApp: GetApp.Interface,\n private logger: LoggerService.Interface,\n private decoratee: BuildAppWorkspaceService.Interface\n ) {}\n\n async execute(appName: GetApp.AppName, options: BuildAppWorkspaceService.Options = {}) {\n const result = await this.decoratee.execute(appName, options);\n if (appName !== \"api\") {\n return result;\n }\n\n const app = this.getApp.execute(\"api\");\n const handlersFolderPath = path.join(\n getTemplatesFolderPath(),\n \"extensions\",\n \"Postgres\",\n \"api\"\n );\n\n fs.cpSync(handlersFolderPath, app.paths.workspaceFolder.toString(), {\n recursive: true,\n force: true\n });\n\n this.logger.debug(\"Replaced API Lambda function handlers with Postgres versions.\");\n\n return result;\n }\n}\n\nexport const ReplaceApiLambdaFnHandlers = BuildAppWorkspaceService.createDecorator({\n decorator: ReplaceApiLambdaFnHandlersDecorator,\n dependencies: [GetApp, LoggerService]\n});\n"],"names":["ReplaceApiLambdaFnHandlersDecorator","getApp","logger","decoratee","appName","options","result","app","handlersFolderPath","path","getTemplatesFolderPath","fs","ReplaceApiLambdaFnHandlers","BuildAppWorkspaceService","GetApp","LoggerService"],"mappings":";;;;AAcA,MAAMA;IACF,YACYC,MAAwB,EACxBC,MAA+B,EAC/BC,SAA6C,CACvD;aAHUF,MAAM,GAANA;aACAC,MAAM,GAANA;aACAC,SAAS,GAATA;IACT;IAEH,MAAM,QAAQC,OAAuB,EAAEC,UAA4C,CAAC,CAAC,EAAE;QACnF,MAAMC,SAAS,MAAM,IAAI,CAAC,SAAS,CAAC,OAAO,CAACF,SAASC;QACrD,IAAID,AAAY,UAAZA,SACA,OAAOE;QAGX,MAAMC,MAAM,IAAI,CAAC,MAAM,CAAC,OAAO,CAAC;QAChC,MAAMC,qBAAqBC,KAAK,IAAI,CAChCC,0BACA,cACA,YACA;QAGJC,GAAG,MAAM,CAACH,oBAAoBD,IAAI,KAAK,CAAC,eAAe,CAAC,QAAQ,IAAI;YAChE,WAAW;YACX,OAAO;QACX;QAEA,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC;QAElB,OAAOD;IACX;AACJ;AAEO,MAAMM,6BAA6BC,yBAAyB,eAAe,CAAC;IAC/E,WAAWb;IACX,cAAc;QAACc;QAAQC;KAAc;AACzC"}
@@ -1,7 +1,7 @@
1
1
  import { CoreBeforeDeploy } from "@webiny/project-extensions-aws/abstractions/index.js";
2
2
  import { GetProductionEnvironments, GetProjectConfigService, ProjectSdkParamsService } from "@webiny/project/abstractions/index.js";
3
3
  /**
4
- * Stops `deploy core` when `<Infra.Postgres />` is combined with settings it can't run with:
4
+ * Stops `deploy core` when `<Infra.AuroraPostgres />` is combined with settings it can't run with:
5
5
  *
6
6
  * - no VPC: the database sits in private subnets, and the functions reach Secrets Manager through
7
7
  * the VPC's NAT gateway. Production environments get a VPC by default, so this only asks for
@@ -18,14 +18,14 @@ class ValidatePostgresBeforeCoreDeployImpl {
18
18
  const productionEnvironments = await this.getProductionEnvironments.execute();
19
19
  const isProduction = productionEnvironments.includes(env);
20
20
  const vpcConfig = getVpcConfigFromExtension(projectConfig);
21
- if (!isVpcEnabled(vpcConfig, isProduction)) throw GracefulError.from(new Error("Cannot deploy Postgres without a VPC."), "The Postgres database runs in the VPC's private subnets, and the API functions reach it, and Secrets Manager, from inside the VPC.\n\nAdd %s to your %s config file. The VPC adds a NAT gateway, which has its own cost.\nProduction environments use a VPC by default, unless %s turns it off.", "<Infra.Vpc enabled />", CONFIG_FILE, "<Infra.Vpc enabled={false} />");
21
+ if (!isVpcEnabled(vpcConfig, isProduction)) throw GracefulError.from(new Error("Cannot deploy Postgres without a VPC."), "The database of %s runs in the VPC's private subnets, and the API functions reach it, and Secrets Manager, from inside the VPC.\n\nAdd %s to your %s config file. The VPC adds a NAT gateway, which has its own cost.\nProduction environments use a VPC by default, unless %s turns it off.", "<Infra.AuroraPostgres />", "<Infra.Vpc enabled />", CONFIG_FILE, "<Infra.Vpc enabled={false} />");
22
22
  if ("object" == typeof vpcConfig && vpcConfig.useExistingVpc) {
23
23
  const postgresVpcConfig = vpcConfig.useExistingVpc.postgresVpcConfig;
24
24
  if (!postgresVpcConfig?.subnetIds?.length) throw GracefulError.from(new Error("Cannot deploy Postgres into an existing VPC without `postgresVpcConfig`."), "With %s, Webiny doesn't know which subnets and security groups the database should use.\n\nAdd %s to %s in your %s config file.\nThe security groups must accept port 5432 from the Lambda functions' security groups.", "useExistingVpc", "postgresVpcConfig: { subnetIds, securityGroupIds }", "<Infra.Vpc useExistingVpc={...} />", CONFIG_FILE);
25
25
  }
26
- if (getOsConfigFromExtension(projectConfig)) throw GracefulError.from(new Error("Cannot deploy Postgres with OpenSearch enabled."), "OpenSearch only works with the DynamoDB database setup.\n\nRemove %s, or remove %s, from your %s config file.", "<Infra.OpenSearch enabled />", "<Infra.Postgres />", CONFIG_FILE);
26
+ if (getOsConfigFromExtension(projectConfig)) throw GracefulError.from(new Error("Cannot deploy Postgres with OpenSearch enabled."), "OpenSearch only works with the DynamoDB database setup.\n\nRemove %s, or remove %s, from your %s config file.", "<Infra.OpenSearch enabled />", "<Infra.AuroraPostgres />", CONFIG_FILE);
27
27
  const bgDeploymentsConfig = getBgDeploymentsConfigFromExtension(projectConfig);
28
- if (bgDeploymentsConfig && bgDeploymentsConfig.enabled) throw GracefulError.from(new Error("Cannot deploy Postgres with blue-green deployments."), "Blue-green deployments and the Sync System only work with the DynamoDB database setup.\n\nRemove %s, or remove %s, from your %s config file.", "<Infra.BlueGreenDeployments enabled />", "<Infra.Postgres />", CONFIG_FILE);
28
+ if (bgDeploymentsConfig && bgDeploymentsConfig.enabled) throw GracefulError.from(new Error("Cannot deploy Postgres with blue-green deployments."), "Blue-green deployments and the Sync System only work with the DynamoDB database setup.\n\nRemove %s, or remove %s, from your %s config file.", "<Infra.BlueGreenDeployments enabled />", "<Infra.AuroraPostgres />", CONFIG_FILE);
29
29
  }
30
30
  }
31
31
  const ValidatePostgresBeforeCoreDeploy = CoreBeforeDeploy.createImplementation({
@@ -1 +1 @@
1
- {"version":3,"file":"extensions/Postgres/ValidatePostgresBeforeCoreDeploy.js","sources":["../../../src/extensions/Postgres/ValidatePostgresBeforeCoreDeploy.ts"],"sourcesContent":["import { CoreBeforeDeploy } from \"@webiny/project-extensions-aws/abstractions/index.js\";\nimport {\n GetProductionEnvironments,\n GetProjectConfigService,\n ProjectSdkParamsService\n} from \"@webiny/project/abstractions/index.js\";\nimport { GracefulError } from \"@webiny/project\";\nimport { getVpcConfigFromExtension } from \"~/pulumi/apps/extensions/getVpcConfigFromExtension.js\";\nimport { isVpcEnabled } from \"~/pulumi/apps/extensions/isVpcEnabled.js\";\nimport { getOsConfigFromExtension } from \"~/pulumi/apps/extensions/getOsConfigFromExtension.js\";\nimport { getBgDeploymentsConfigFromExtension } from \"~/pulumi/apps/extensions/getBgDeploymentsConfigFromExtension.js\";\n\nconst CONFIG_FILE = \"webiny.config.tsx\";\n\n/**\n * Stops `deploy core` when `<Infra.Postgres />` is combined with settings it can't run with:\n *\n * - no VPC: the database sits in private subnets, and the functions reach Secrets Manager through\n * the VPC's NAT gateway. Production environments get a VPC by default, so this only asks for\n * `<Infra.Vpc enabled />` elsewhere. Postgres never turns the VPC on by itself, because the NAT\n * gateway costs money.\n * - an existing VPC without `postgresVpcConfig`: there's no subnet or security group to put the\n * database in.\n * - OpenSearch, and blue-green deployments (which bring the Sync System): both are DynamoDB-only.\n */\nexport class ValidatePostgresBeforeCoreDeployImpl implements CoreBeforeDeploy.Interface {\n constructor(\n private getProjectConfigService: GetProjectConfigService.Interface,\n private projectSdkParamsService: ProjectSdkParamsService.Interface,\n private getProductionEnvironments: GetProductionEnvironments.Interface\n ) {}\n\n async execute() {\n const projectConfig = await this.getProjectConfigService.execute();\n const { env } = this.projectSdkParamsService.get();\n const productionEnvironments = await this.getProductionEnvironments.execute();\n const isProduction = productionEnvironments.includes(env);\n\n const vpcConfig = getVpcConfigFromExtension(projectConfig);\n if (!isVpcEnabled(vpcConfig, isProduction)) {\n throw GracefulError.from(\n new Error(\"Cannot deploy Postgres without a VPC.\"),\n [\n \"The Postgres database runs in the VPC's private subnets, and the API functions reach it, and Secrets Manager, from inside the VPC.\",\n \"\",\n \"Add %s to your %s config file. The VPC adds a NAT gateway, which has its own cost.\",\n \"Production environments use a VPC by default, unless %s turns it off.\"\n ].join(\"\\n\"),\n \"<Infra.Vpc enabled />\",\n CONFIG_FILE,\n \"<Infra.Vpc enabled={false} />\"\n );\n }\n\n if (typeof vpcConfig === \"object\" && vpcConfig.useExistingVpc) {\n const postgresVpcConfig = vpcConfig.useExistingVpc.postgresVpcConfig;\n if (!postgresVpcConfig?.subnetIds?.length) {\n throw GracefulError.from(\n new Error(\n \"Cannot deploy Postgres into an existing VPC without `postgresVpcConfig`.\"\n ),\n [\n \"With %s, Webiny doesn't know which subnets and security groups the database should use.\",\n \"\",\n \"Add %s to %s in your %s config file.\",\n \"The security groups must accept port 5432 from the Lambda functions' security groups.\"\n ].join(\"\\n\"),\n \"useExistingVpc\",\n \"postgresVpcConfig: { subnetIds, securityGroupIds }\",\n \"<Infra.Vpc useExistingVpc={...} />\",\n CONFIG_FILE\n );\n }\n }\n\n if (getOsConfigFromExtension(projectConfig)) {\n throw GracefulError.from(\n new Error(\"Cannot deploy Postgres with OpenSearch enabled.\"),\n [\n \"OpenSearch only works with the DynamoDB database setup.\",\n \"\",\n \"Remove %s, or remove %s, from your %s config file.\"\n ].join(\"\\n\"),\n \"<Infra.OpenSearch enabled />\",\n \"<Infra.Postgres />\",\n CONFIG_FILE\n );\n }\n\n const bgDeploymentsConfig = getBgDeploymentsConfigFromExtension(projectConfig);\n if (bgDeploymentsConfig && bgDeploymentsConfig.enabled) {\n throw GracefulError.from(\n new Error(\"Cannot deploy Postgres with blue-green deployments.\"),\n [\n \"Blue-green deployments and the Sync System only work with the DynamoDB database setup.\",\n \"\",\n \"Remove %s, or remove %s, from your %s config file.\"\n ].join(\"\\n\"),\n \"<Infra.BlueGreenDeployments enabled />\",\n \"<Infra.Postgres />\",\n CONFIG_FILE\n );\n }\n }\n}\n\nexport const ValidatePostgresBeforeCoreDeploy = CoreBeforeDeploy.createImplementation({\n implementation: ValidatePostgresBeforeCoreDeployImpl,\n dependencies: [GetProjectConfigService, ProjectSdkParamsService, GetProductionEnvironments]\n});\n"],"names":["CONFIG_FILE","ValidatePostgresBeforeCoreDeployImpl","getProjectConfigService","projectSdkParamsService","getProductionEnvironments","projectConfig","env","productionEnvironments","isProduction","vpcConfig","getVpcConfigFromExtension","isVpcEnabled","GracefulError","Error","postgresVpcConfig","getOsConfigFromExtension","bgDeploymentsConfig","getBgDeploymentsConfigFromExtension","ValidatePostgresBeforeCoreDeploy","CoreBeforeDeploy","GetProjectConfigService","ProjectSdkParamsService","GetProductionEnvironments"],"mappings":";;;;;;;AAYA,MAAMA,cAAc;AAab,MAAMC;IACT,YACYC,uBAA0D,EAC1DC,uBAA0D,EAC1DC,yBAA8D,CACxE;aAHUF,uBAAuB,GAAvBA;aACAC,uBAAuB,GAAvBA;aACAC,yBAAyB,GAAzBA;IACT;IAEH,MAAM,UAAU;QACZ,MAAMC,gBAAgB,MAAM,IAAI,CAAC,uBAAuB,CAAC,OAAO;QAChE,MAAM,EAAEC,GAAG,EAAE,GAAG,IAAI,CAAC,uBAAuB,CAAC,GAAG;QAChD,MAAMC,yBAAyB,MAAM,IAAI,CAAC,yBAAyB,CAAC,OAAO;QAC3E,MAAMC,eAAeD,uBAAuB,QAAQ,CAACD;QAErD,MAAMG,YAAYC,0BAA0BL;QAC5C,IAAI,CAACM,aAAaF,WAAWD,eACzB,MAAMI,cAAc,IAAI,CACpB,IAAIC,MAAM,0CACV,mSAMA,yBACAb,aACA;QAIR,IAAI,AAAqB,YAArB,OAAOS,aAA0BA,UAAU,cAAc,EAAE;YAC3D,MAAMK,oBAAoBL,UAAU,cAAc,CAAC,iBAAiB;YACpE,IAAI,CAACK,mBAAmB,WAAW,QAC/B,MAAMF,cAAc,IAAI,CACpB,IAAIC,MACA,6EAEJ,0NAMA,kBACA,sDACA,sCACAb;QAGZ;QAEA,IAAIe,yBAAyBV,gBACzB,MAAMO,cAAc,IAAI,CACpB,IAAIC,MAAM,oDACV,iHAKA,gCACA,sBACAb;QAIR,MAAMgB,sBAAsBC,oCAAoCZ;QAChE,IAAIW,uBAAuBA,oBAAoB,OAAO,EAClD,MAAMJ,cAAc,IAAI,CACpB,IAAIC,MAAM,wDACV,gJAKA,0CACA,sBACAb;IAGZ;AACJ;AAEO,MAAMkB,mCAAmCC,iBAAiB,oBAAoB,CAAC;IAClF,gBAAgBlB;IAChB,cAAc;QAACmB;QAAyBC;QAAyBC;KAA0B;AAC/F"}
1
+ {"version":3,"file":"extensions/Postgres/ValidatePostgresBeforeCoreDeploy.js","sources":["../../../src/extensions/Postgres/ValidatePostgresBeforeCoreDeploy.ts"],"sourcesContent":["import { CoreBeforeDeploy } from \"@webiny/project-extensions-aws/abstractions/index.js\";\nimport {\n GetProductionEnvironments,\n GetProjectConfigService,\n ProjectSdkParamsService\n} from \"@webiny/project/abstractions/index.js\";\nimport { GracefulError } from \"@webiny/project\";\nimport { getVpcConfigFromExtension } from \"~/pulumi/apps/extensions/getVpcConfigFromExtension.js\";\nimport { isVpcEnabled } from \"~/pulumi/apps/extensions/isVpcEnabled.js\";\nimport { getOsConfigFromExtension } from \"~/pulumi/apps/extensions/getOsConfigFromExtension.js\";\nimport { getBgDeploymentsConfigFromExtension } from \"~/pulumi/apps/extensions/getBgDeploymentsConfigFromExtension.js\";\n\nconst CONFIG_FILE = \"webiny.config.tsx\";\n\n/**\n * Stops `deploy core` when `<Infra.AuroraPostgres />` is combined with settings it can't run with:\n *\n * - no VPC: the database sits in private subnets, and the functions reach Secrets Manager through\n * the VPC's NAT gateway. Production environments get a VPC by default, so this only asks for\n * `<Infra.Vpc enabled />` elsewhere. Postgres never turns the VPC on by itself, because the NAT\n * gateway costs money.\n * - an existing VPC without `postgresVpcConfig`: there's no subnet or security group to put the\n * database in.\n * - OpenSearch, and blue-green deployments (which bring the Sync System): both are DynamoDB-only.\n */\nexport class ValidatePostgresBeforeCoreDeployImpl implements CoreBeforeDeploy.Interface {\n constructor(\n private getProjectConfigService: GetProjectConfigService.Interface,\n private projectSdkParamsService: ProjectSdkParamsService.Interface,\n private getProductionEnvironments: GetProductionEnvironments.Interface\n ) {}\n\n async execute() {\n const projectConfig = await this.getProjectConfigService.execute();\n const { env } = this.projectSdkParamsService.get();\n const productionEnvironments = await this.getProductionEnvironments.execute();\n const isProduction = productionEnvironments.includes(env);\n\n const vpcConfig = getVpcConfigFromExtension(projectConfig);\n if (!isVpcEnabled(vpcConfig, isProduction)) {\n throw GracefulError.from(\n new Error(\"Cannot deploy Postgres without a VPC.\"),\n [\n \"The database of %s runs in the VPC's private subnets, and the API functions reach it, and Secrets Manager, from inside the VPC.\",\n \"\",\n \"Add %s to your %s config file. The VPC adds a NAT gateway, which has its own cost.\",\n \"Production environments use a VPC by default, unless %s turns it off.\"\n ].join(\"\\n\"),\n \"<Infra.AuroraPostgres />\",\n \"<Infra.Vpc enabled />\",\n CONFIG_FILE,\n \"<Infra.Vpc enabled={false} />\"\n );\n }\n\n if (typeof vpcConfig === \"object\" && vpcConfig.useExistingVpc) {\n const postgresVpcConfig = vpcConfig.useExistingVpc.postgresVpcConfig;\n if (!postgresVpcConfig?.subnetIds?.length) {\n throw GracefulError.from(\n new Error(\n \"Cannot deploy Postgres into an existing VPC without `postgresVpcConfig`.\"\n ),\n [\n \"With %s, Webiny doesn't know which subnets and security groups the database should use.\",\n \"\",\n \"Add %s to %s in your %s config file.\",\n \"The security groups must accept port 5432 from the Lambda functions' security groups.\"\n ].join(\"\\n\"),\n \"useExistingVpc\",\n \"postgresVpcConfig: { subnetIds, securityGroupIds }\",\n \"<Infra.Vpc useExistingVpc={...} />\",\n CONFIG_FILE\n );\n }\n }\n\n if (getOsConfigFromExtension(projectConfig)) {\n throw GracefulError.from(\n new Error(\"Cannot deploy Postgres with OpenSearch enabled.\"),\n [\n \"OpenSearch only works with the DynamoDB database setup.\",\n \"\",\n \"Remove %s, or remove %s, from your %s config file.\"\n ].join(\"\\n\"),\n \"<Infra.OpenSearch enabled />\",\n \"<Infra.AuroraPostgres />\",\n CONFIG_FILE\n );\n }\n\n const bgDeploymentsConfig = getBgDeploymentsConfigFromExtension(projectConfig);\n if (bgDeploymentsConfig && bgDeploymentsConfig.enabled) {\n throw GracefulError.from(\n new Error(\"Cannot deploy Postgres with blue-green deployments.\"),\n [\n \"Blue-green deployments and the Sync System only work with the DynamoDB database setup.\",\n \"\",\n \"Remove %s, or remove %s, from your %s config file.\"\n ].join(\"\\n\"),\n \"<Infra.BlueGreenDeployments enabled />\",\n \"<Infra.AuroraPostgres />\",\n CONFIG_FILE\n );\n }\n }\n}\n\nexport const ValidatePostgresBeforeCoreDeploy = CoreBeforeDeploy.createImplementation({\n implementation: ValidatePostgresBeforeCoreDeployImpl,\n dependencies: [GetProjectConfigService, ProjectSdkParamsService, GetProductionEnvironments]\n});\n"],"names":["CONFIG_FILE","ValidatePostgresBeforeCoreDeployImpl","getProjectConfigService","projectSdkParamsService","getProductionEnvironments","projectConfig","env","productionEnvironments","isProduction","vpcConfig","getVpcConfigFromExtension","isVpcEnabled","GracefulError","Error","postgresVpcConfig","getOsConfigFromExtension","bgDeploymentsConfig","getBgDeploymentsConfigFromExtension","ValidatePostgresBeforeCoreDeploy","CoreBeforeDeploy","GetProjectConfigService","ProjectSdkParamsService","GetProductionEnvironments"],"mappings":";;;;;;;AAYA,MAAMA,cAAc;AAab,MAAMC;IACT,YACYC,uBAA0D,EAC1DC,uBAA0D,EAC1DC,yBAA8D,CACxE;aAHUF,uBAAuB,GAAvBA;aACAC,uBAAuB,GAAvBA;aACAC,yBAAyB,GAAzBA;IACT;IAEH,MAAM,UAAU;QACZ,MAAMC,gBAAgB,MAAM,IAAI,CAAC,uBAAuB,CAAC,OAAO;QAChE,MAAM,EAAEC,GAAG,EAAE,GAAG,IAAI,CAAC,uBAAuB,CAAC,GAAG;QAChD,MAAMC,yBAAyB,MAAM,IAAI,CAAC,yBAAyB,CAAC,OAAO;QAC3E,MAAMC,eAAeD,uBAAuB,QAAQ,CAACD;QAErD,MAAMG,YAAYC,0BAA0BL;QAC5C,IAAI,CAACM,aAAaF,WAAWD,eACzB,MAAMI,cAAc,IAAI,CACpB,IAAIC,MAAM,0CACV,gSAMA,4BACA,yBACAb,aACA;QAIR,IAAI,AAAqB,YAArB,OAAOS,aAA0BA,UAAU,cAAc,EAAE;YAC3D,MAAMK,oBAAoBL,UAAU,cAAc,CAAC,iBAAiB;YACpE,IAAI,CAACK,mBAAmB,WAAW,QAC/B,MAAMF,cAAc,IAAI,CACpB,IAAIC,MACA,6EAEJ,0NAMA,kBACA,sDACA,sCACAb;QAGZ;QAEA,IAAIe,yBAAyBV,gBACzB,MAAMO,cAAc,IAAI,CACpB,IAAIC,MAAM,oDACV,iHAKA,gCACA,4BACAb;QAIR,MAAMgB,sBAAsBC,oCAAoCZ;QAChE,IAAIW,uBAAuBA,oBAAoB,OAAO,EAClD,MAAMJ,cAAc,IAAI,CACpB,IAAIC,MAAM,wDACV,gJAKA,0CACA,4BACAb;IAGZ;AACJ;AAEO,MAAMkB,mCAAmCC,iBAAiB,oBAAoB,CAAC;IAClF,gBAAgBlB;IAChB,cAAc;QAACmB;QAAyBC;QAAyBC;KAA0B;AAC/F"}
@@ -1,5 +1,5 @@
1
1
  /** The package whose handlers the Postgres api bundle exports; knex and pg are resolved from it. */
2
- export declare const PG_HANDLER_PACKAGE = "@webiny/api-event-handler-aws-pg";
2
+ export declare const PG_HANDLER_PACKAGE = "@webiny/api-composition-aws-pg";
3
3
  /**
4
4
  * What the Postgres bundle loads from `node_modules` at runtime. The bundler keeps knex external
5
5
  * (it statically requires a driver for every SQL dialect), and knex loads `pg` by name.
@@ -1,7 +1,7 @@
1
1
  import path from "path";
2
2
  import fs from "fs";
3
3
  import { createRequire } from "module";
4
- const PG_HANDLER_PACKAGE = "@webiny/api-event-handler-aws-pg";
4
+ const PG_HANDLER_PACKAGE = "@webiny/api-composition-aws-pg";
5
5
  const PG_RUNTIME_PACKAGES = [
6
6
  "knex",
7
7
  "pg"
@@ -78,7 +78,7 @@ const placePackages = (handlerDir, nodeModulesDir)=>{
78
78
  const copyPgRuntimeModules = async (params)=>{
79
79
  const { resolveFrom, buildDir } = params;
80
80
  const handlerDir = findPackageDir(PG_HANDLER_PACKAGE, resolveFrom);
81
- if (!handlerDir) throw new Error(`<Infra.Postgres /> needs ${PG_HANDLER_PACKAGE} in the project. Add it to package.json and install it.`);
81
+ if (!handlerDir) throw new Error(`<Infra.AuroraPostgres /> needs ${PG_HANDLER_PACKAGE} in the project. Add it to package.json and install it.`);
82
82
  const nodeModulesDir = path.join(buildDir, "node_modules");
83
83
  const packages = placePackages(handlerDir, nodeModulesDir);
84
84
  const byRealDir = new Map();
@@ -1 +1 @@
1
- {"version":3,"file":"extensions/Postgres/copyPgRuntimeModules.js","sources":["../../../src/extensions/Postgres/copyPgRuntimeModules.ts"],"sourcesContent":["import path from \"path\";\nimport fs from \"fs\";\nimport { createRequire } from \"module\";\n\n/** The package whose handlers the Postgres api bundle exports; knex and pg are resolved from it. */\nexport const PG_HANDLER_PACKAGE = \"@webiny/api-event-handler-aws-pg\";\n\n/**\n * What the Postgres bundle loads from `node_modules` at runtime. The bundler keeps knex external\n * (it statically requires a driver for every SQL dialect), and knex loads `pg` by name.\n */\nexport const PG_RUNTIME_PACKAGES = [\"knex\", \"pg\"] as const;\n\nexport interface CopyPgRuntimeModulesParams {\n /** Where module resolution starts: the api app's source folder, as the bundler resolves it. */\n resolveFrom: string;\n /** The api bundle's output folder. The modules go into its `node_modules`. */\n buildDir: string;\n}\n\nexport interface CopyPgRuntimeModulesResult {\n /** Every package copied, as `name@version`, sorted. */\n packages: string[];\n /** How many files were copied. */\n files: number;\n}\n\ninterface PackageJson {\n name: string;\n version: string;\n dependencies?: Record<string, string>;\n optionalDependencies?: Record<string, string>;\n}\n\ninterface PlacedPackage {\n name: string;\n version: string;\n /** The package's real folder on disk (symlinks resolved). */\n realDir: string;\n /** Where it goes in the build. */\n destDir: string;\n}\n\nconst readPackageJson = (dir: string): PackageJson => {\n return JSON.parse(fs.readFileSync(path.join(dir, \"package.json\"), \"utf8\"));\n};\n\n/** Finds a package the way Node does from `fromDir`: in each ancestor's `node_modules`. */\nconst findPackageDir = (name: string, fromDir: string): string | null => {\n let dir = path.resolve(fromDir);\n while (true) {\n if (path.basename(dir) !== \"node_modules\") {\n const candidate = path.join(dir, \"node_modules\", name);\n if (fs.existsSync(path.join(candidate, \"package.json\"))) {\n return fs.realpathSync(candidate);\n }\n }\n const parent = path.dirname(dir);\n if (parent === dir) {\n return null;\n }\n dir = parent;\n }\n};\n\n/**\n * Lays out knex, pg and their dependency closure (`dependencies` and installed\n * `optionalDependencies`, never peers) the way an install would: each package at the top of\n * `build/node_modules`, unless a different version of it is already there, in which case it nests\n * under the package that needs it. So `sharp`, `@aws-sdk/*` and the drivers knex can load but the\n * project doesn't use (better-sqlite3, mysql, ...) never get in.\n */\nconst placePackages = (handlerDir: string, nodeModulesDir: string): PlacedPackage[] => {\n // destDir -> placed package\n const placed = new Map<string, PlacedPackage>();\n const queue: PlacedPackage[] = [];\n\n const place = (name: string, realDir: string, destDir: string) => {\n const pkg: PlacedPackage = {\n name,\n version: readPackageJson(realDir).version,\n realDir,\n destDir\n };\n placed.set(destDir, pkg);\n queue.push(pkg);\n };\n\n /* What Node would load for `name` from inside `fromDestDir`, given what is placed so far. */\n const resolvePlaced = (name: string, fromDestDir: string): PlacedPackage | undefined => {\n let dir = fromDestDir;\n while (true) {\n if (path.basename(dir) !== \"node_modules\") {\n const found = placed.get(path.join(dir, \"node_modules\", name));\n if (found) {\n return found;\n }\n }\n if (dir === path.dirname(nodeModulesDir)) {\n return undefined;\n }\n dir = path.dirname(dir);\n }\n };\n\n for (const name of PG_RUNTIME_PACKAGES) {\n const realDir = findPackageDir(name, handlerDir);\n if (!realDir) {\n throw new Error(\n `Could not find \"${name}\", which ${PG_HANDLER_PACKAGE} needs. Reinstall the project's dependencies.`\n );\n }\n place(name, realDir, path.join(nodeModulesDir, name));\n }\n\n while (queue.length) {\n const parent = queue.shift()!;\n const pkgJson = readPackageJson(parent.realDir);\n const deps = [\n ...Object.keys(pkgJson.dependencies || {}).map(name => ({ name, optional: false })),\n ...Object.keys(pkgJson.optionalDependencies || {}).map(name => ({\n name,\n optional: true\n }))\n ];\n\n for (const dep of deps) {\n const realDir = findPackageDir(dep.name, parent.realDir);\n if (!realDir) {\n if (dep.optional) {\n continue;\n }\n throw new Error(\n `Could not find \"${dep.name}\", which \"${parent.name}\" needs. Reinstall the project's dependencies.`\n );\n }\n\n const resolved = resolvePlaced(dep.name, parent.destDir);\n if (resolved?.realDir === realDir) {\n continue;\n }\n // Nothing by that name is reachable: it goes to the top. Otherwise a different version\n // is, so this one nests under the package that needs it.\n const destDir = resolved\n ? path.join(parent.destDir, \"node_modules\", dep.name)\n : path.join(nodeModulesDir, dep.name);\n place(dep.name, realDir, destDir);\n }\n }\n\n return Array.from(placed.values());\n};\n\n/**\n * Copies knex, pg and the files they need into `<buildDir>/node_modules`, so the uploaded api\n * bundle can load them on Lambda. `@vercel/nft` traces the file closure from each package's entry\n * (only the files that can be loaded, no docs, types or CLI), and the closure is limited to the\n * packages `placePackages` chose. pg is plain JavaScript, so a build on any OS runs on Lambda.\n * Nothing is downloaded: the files come from the project's own install.\n */\nexport const copyPgRuntimeModules = async (\n params: CopyPgRuntimeModulesParams\n): Promise<CopyPgRuntimeModulesResult> => {\n const { resolveFrom, buildDir } = params;\n\n const handlerDir = findPackageDir(PG_HANDLER_PACKAGE, resolveFrom);\n if (!handlerDir) {\n throw new Error(\n `<Infra.Postgres /> needs ${PG_HANDLER_PACKAGE} in the project. Add it to package.json and install it.`\n );\n }\n\n const nodeModulesDir = path.join(buildDir, \"node_modules\");\n const packages = placePackages(handlerDir, nodeModulesDir);\n\n // realDir -> every place that package goes (one, unless a version is needed in two places).\n const byRealDir = new Map<string, PlacedPackage[]>();\n for (const pkg of packages) {\n byRealDir.set(pkg.realDir, [...(byRealDir.get(pkg.realDir) || []), pkg]);\n }\n // Longest first, so a file inside a nested node_modules belongs to the inner package.\n const realDirs = Array.from(byRealDir.keys()).sort((a, b) => b.length - a.length);\n\n const entries = PG_RUNTIME_PACKAGES.map(name => {\n const pkg = packages.find(p => p.destDir === path.join(nodeModulesDir, name))!;\n // The CommonJS entry (by `main`), which is what knex loads `pg` through.\n return createRequire(path.join(pkg.realDir, \"package.json\")).resolve(pkg.realDir);\n });\n\n // Loaded only for a Postgres build: every CLI command registers the hook.\n const { nodeFileTrace } = await import(\"@vercel/nft\");\n const base = path.parse(handlerDir).root;\n const { fileList } = await nodeFileTrace(entries, { base });\n\n // Each package.json, always: Node reads it to resolve the package.\n const files = new Set<string>(packages.map(pkg => path.join(pkg.realDir, \"package.json\")));\n for (const relPath of fileList) {\n files.add(path.join(base, relPath));\n }\n\n let copied = 0;\n for (const file of files) {\n const realDir = realDirs.find(dir => file.startsWith(dir + path.sep));\n if (!realDir || !fs.statSync(file, { throwIfNoEntry: false })?.isFile()) {\n continue;\n }\n const relPath = path.relative(realDir, file);\n for (const pkg of byRealDir.get(realDir)!) {\n const dest = path.join(pkg.destDir, relPath);\n fs.mkdirSync(path.dirname(dest), { recursive: true });\n fs.copyFileSync(file, dest);\n copied++;\n }\n }\n\n return {\n packages: Array.from(new Set(packages.map(pkg => `${pkg.name}@${pkg.version}`))).sort(),\n files: copied\n };\n};\n"],"names":["PG_HANDLER_PACKAGE","PG_RUNTIME_PACKAGES","readPackageJson","dir","JSON","fs","path","findPackageDir","name","fromDir","candidate","parent","placePackages","handlerDir","nodeModulesDir","placed","Map","queue","place","realDir","destDir","pkg","resolvePlaced","fromDestDir","found","Error","pkgJson","deps","Object","dep","resolved","Array","copyPgRuntimeModules","params","resolveFrom","buildDir","packages","byRealDir","realDirs","a","b","entries","p","createRequire","nodeFileTrace","base","fileList","files","Set","relPath","copied","file","dest"],"mappings":";;;AAKO,MAAMA,qBAAqB;AAM3B,MAAMC,sBAAsB;IAAC;IAAQ;CAAK;AAgCjD,MAAMC,kBAAkB,CAACC,MACdC,KAAK,KAAK,CAACC,GAAG,YAAY,CAACC,KAAK,IAAI,CAACH,KAAK,iBAAiB;AAItE,MAAMI,iBAAiB,CAACC,MAAcC;IAClC,IAAIN,MAAMG,KAAK,OAAO,CAACG;IACvB,MAAO,KAAM;QACT,IAAIH,AAAuB,mBAAvBA,KAAK,QAAQ,CAACH,MAAyB;YACvC,MAAMO,YAAYJ,KAAK,IAAI,CAACH,KAAK,gBAAgBK;YACjD,IAAIH,GAAG,UAAU,CAACC,KAAK,IAAI,CAACI,WAAW,kBACnC,OAAOL,GAAG,YAAY,CAACK;QAE/B;QACA,MAAMC,SAASL,KAAK,OAAO,CAACH;QAC5B,IAAIQ,WAAWR,KACX,OAAO;QAEXA,MAAMQ;I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,EAAE,IAAI,IAAI;QACrF,OAAO6B;IACX;AACJ"}
1
+ {"version":3,"file":"extensions/Postgres/copyPgRuntimeModules.js","sources":["../../../src/extensions/Postgres/copyPgRuntimeModules.ts"],"sourcesContent":["import path from \"path\";\nimport fs from \"fs\";\nimport { createRequire } from \"module\";\n\n/** The package whose handlers the Postgres api bundle exports; knex and pg are resolved from it. */\nexport const PG_HANDLER_PACKAGE = \"@webiny/api-composition-aws-pg\";\n\n/**\n * What the Postgres bundle loads from `node_modules` at runtime. The bundler keeps knex external\n * (it statically requires a driver for every SQL dialect), and knex loads `pg` by name.\n */\nexport const PG_RUNTIME_PACKAGES = [\"knex\", \"pg\"] as const;\n\nexport interface CopyPgRuntimeModulesParams {\n /** Where module resolution starts: the api app's source folder, as the bundler resolves it. */\n resolveFrom: string;\n /** The api bundle's output folder. The modules go into its `node_modules`. */\n buildDir: string;\n}\n\nexport interface CopyPgRuntimeModulesResult {\n /** Every package copied, as `name@version`, sorted. */\n packages: string[];\n /** How many files were copied. */\n files: number;\n}\n\ninterface PackageJson {\n name: string;\n version: string;\n dependencies?: Record<string, string>;\n optionalDependencies?: Record<string, string>;\n}\n\ninterface PlacedPackage {\n name: string;\n version: string;\n /** The package's real folder on disk (symlinks resolved). */\n realDir: string;\n /** Where it goes in the build. */\n destDir: string;\n}\n\nconst readPackageJson = (dir: string): PackageJson => {\n return JSON.parse(fs.readFileSync(path.join(dir, \"package.json\"), \"utf8\"));\n};\n\n/** Finds a package the way Node does from `fromDir`: in each ancestor's `node_modules`. */\nconst findPackageDir = (name: string, fromDir: string): string | null => {\n let dir = path.resolve(fromDir);\n while (true) {\n if (path.basename(dir) !== \"node_modules\") {\n const candidate = path.join(dir, \"node_modules\", name);\n if (fs.existsSync(path.join(candidate, \"package.json\"))) {\n return fs.realpathSync(candidate);\n }\n }\n const parent = path.dirname(dir);\n if (parent === dir) {\n return null;\n }\n dir = parent;\n }\n};\n\n/**\n * Lays out knex, pg and their dependency closure (`dependencies` and installed\n * `optionalDependencies`, never peers) the way an install would: each package at the top of\n * `build/node_modules`, unless a different version of it is already there, in which case it nests\n * under the package that needs it. So `sharp`, `@aws-sdk/*` and the drivers knex can load but the\n * project doesn't use (better-sqlite3, mysql, ...) never get in.\n */\nconst placePackages = (handlerDir: string, nodeModulesDir: string): PlacedPackage[] => {\n // destDir -> placed package\n const placed = new Map<string, PlacedPackage>();\n const queue: PlacedPackage[] = [];\n\n const place = (name: string, realDir: string, destDir: string) => {\n const pkg: PlacedPackage = {\n name,\n version: readPackageJson(realDir).version,\n realDir,\n destDir\n };\n placed.set(destDir, pkg);\n queue.push(pkg);\n };\n\n /* What Node would load for `name` from inside `fromDestDir`, given what is placed so far. */\n const resolvePlaced = (name: string, fromDestDir: string): PlacedPackage | undefined => {\n let dir = fromDestDir;\n while (true) {\n if (path.basename(dir) !== \"node_modules\") {\n const found = placed.get(path.join(dir, \"node_modules\", name));\n if (found) {\n return found;\n }\n }\n if (dir === path.dirname(nodeModulesDir)) {\n return undefined;\n }\n dir = path.dirname(dir);\n }\n };\n\n for (const name of PG_RUNTIME_PACKAGES) {\n const realDir = findPackageDir(name, handlerDir);\n if (!realDir) {\n throw new Error(\n `Could not find \"${name}\", which ${PG_HANDLER_PACKAGE} needs. Reinstall the project's dependencies.`\n );\n }\n place(name, realDir, path.join(nodeModulesDir, name));\n }\n\n while (queue.length) {\n const parent = queue.shift()!;\n const pkgJson = readPackageJson(parent.realDir);\n const deps = [\n ...Object.keys(pkgJson.dependencies || {}).map(name => ({ name, optional: false })),\n ...Object.keys(pkgJson.optionalDependencies || {}).map(name => ({\n name,\n optional: true\n }))\n ];\n\n for (const dep of deps) {\n const realDir = findPackageDir(dep.name, parent.realDir);\n if (!realDir) {\n if (dep.optional) {\n continue;\n }\n throw new Error(\n `Could not find \"${dep.name}\", which \"${parent.name}\" needs. Reinstall the project's dependencies.`\n );\n }\n\n const resolved = resolvePlaced(dep.name, parent.destDir);\n if (resolved?.realDir === realDir) {\n continue;\n }\n // Nothing by that name is reachable: it goes to the top. Otherwise a different version\n // is, so this one nests under the package that needs it.\n const destDir = resolved\n ? path.join(parent.destDir, \"node_modules\", dep.name)\n : path.join(nodeModulesDir, dep.name);\n place(dep.name, realDir, destDir);\n }\n }\n\n return Array.from(placed.values());\n};\n\n/**\n * Copies knex, pg and the files they need into `<buildDir>/node_modules`, so the uploaded api\n * bundle can load them on Lambda. `@vercel/nft` traces the file closure from each package's entry\n * (only the files that can be loaded, no docs, types or CLI), and the closure is limited to the\n * packages `placePackages` chose. pg is plain JavaScript, so a build on any OS runs on Lambda.\n * Nothing is downloaded: the files come from the project's own install.\n */\nexport const copyPgRuntimeModules = async (\n params: CopyPgRuntimeModulesParams\n): Promise<CopyPgRuntimeModulesResult> => {\n const { resolveFrom, buildDir } = params;\n\n const handlerDir = findPackageDir(PG_HANDLER_PACKAGE, resolveFrom);\n if (!handlerDir) {\n throw new Error(\n `<Infra.AuroraPostgres /> needs ${PG_HANDLER_PACKAGE} in the project. Add it to package.json and install it.`\n );\n }\n\n const nodeModulesDir = path.join(buildDir, \"node_modules\");\n const packages = placePackages(handlerDir, nodeModulesDir);\n\n // realDir -> every place that package goes (one, unless a version is needed in two places).\n const byRealDir = new Map<string, PlacedPackage[]>();\n for (const pkg of packages) {\n byRealDir.set(pkg.realDir, [...(byRealDir.get(pkg.realDir) || []), pkg]);\n }\n // Longest first, so a file inside a nested node_modules belongs to the inner package.\n const realDirs = Array.from(byRealDir.keys()).sort((a, b) => b.length - a.length);\n\n const entries = PG_RUNTIME_PACKAGES.map(name => {\n const pkg = packages.find(p => p.destDir === path.join(nodeModulesDir, name))!;\n // The CommonJS entry (by `main`), which is what knex loads `pg` through.\n return createRequire(path.join(pkg.realDir, \"package.json\")).resolve(pkg.realDir);\n });\n\n // Loaded only for a Postgres build: every CLI command registers the hook.\n const { nodeFileTrace } = await import(\"@vercel/nft\");\n const base = path.parse(handlerDir).root;\n const { fileList } = await nodeFileTrace(entries, { base });\n\n // Each package.json, always: Node reads it to resolve the package.\n const files = new Set<string>(packages.map(pkg => path.join(pkg.realDir, \"package.json\")));\n for (const relPath of fileList) {\n files.add(path.join(base, relPath));\n }\n\n let copied = 0;\n for (const file of files) {\n const realDir = realDirs.find(dir => file.startsWith(dir + path.sep));\n if (!realDir || !fs.statSync(file, { throwIfNoEntry: false })?.isFile()) {\n continue;\n }\n const relPath = path.relative(realDir, file);\n for (const pkg of byRealDir.get(realDir)!) {\n const dest = path.join(pkg.destDir, relPath);\n fs.mkdirSync(path.dirname(dest), { recursive: true });\n fs.copyFileSync(file, dest);\n copied++;\n }\n }\n\n return {\n packages: Array.from(new Set(packages.map(pkg => `${pkg.name}@${pkg.version}`))).sort(),\n files: copied\n };\n};\n"],"names":["PG_HANDLER_PACKAGE","PG_RUNTIME_PACKAGES","readPackageJson","dir","JSON","fs","path","findPackageDir","name","fromDir","candidate","parent","placePackages","handlerDir","nodeModulesDir","placed","Map","queue","place","realDir","destDir","pkg","resolvePlaced","fromDestDir","found","Error","pkgJson","deps","Object","dep","resolved","Array","copyPgRuntimeModules","params","resolveFrom","buildDir","packages","byRealDir","realDirs","a","b","entries","p","createRequire","nodeFileTrace","base","fileList","files","Set","relPath","copied","file","dest"],"mappings":";;;AAKO,MAAMA,qBAAqB;AAM3B,MAAMC,sBAAsB;IAAC;IAAQ;CAAK;AAgCjD,MAAMC,kBAAkB,CAACC,MACdC,KAAK,KAAK,CAACC,GAAG,YAAY,CAACC,KAAK,IAAI,CAACH,KAAK,iBAAiB;AAItE,MAAMI,iBAAiB,CAACC,MAAcC;IAClC,IAAIN,MAAMG,KAAK,OAAO,CAACG;IACvB,MAAO,KAAM;QACT,IAAIH,AAAuB,mBAAvBA,KAAK,QAAQ,CAACH,MAAyB;YACvC,MAAMO,YAAYJ,KAAK,IAAI,CAACH,KAAK,gBAAgBK;YACjD,IAAIH,GAAG,UAAU,CAACC,KAAK,IAAI,CAACI,WAAW,kBACnC,OAAOL,GAAG,YAAY,CAACK;QAE/B;QACA,MA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AAS,GAAG,CAACf,CAAAA,MAAO,GAAGA,IAAI,IAAI,CAAC,CAAC,EAAEA,IAAI,OAAO,EAAE,IAAI,IAAI;QACrF,OAAO6B;IACX;AACJ"}
@@ -6,8 +6,8 @@ import { GetProjectConfigService } from "@webiny/project/abstractions/index.js";
6
6
  * lives in a different database. Compares the database setup the core was deployed with (its stack
7
7
  * output) with the one the project config now asks for. A first deploy has nothing to compare.
8
8
  *
9
- * Rendered by `ProjectAws`, not by `<Infra.Postgres />`, so it also runs when `<Infra.Postgres />`
10
- * is removed from a project that was deployed with it.
9
+ * Rendered by `ProjectAws`, not by `<Infra.AuroraPostgres />`, so it also runs when
10
+ * `<Infra.AuroraPostgres />` is removed from a project that was deployed with it.
11
11
  */
12
12
  export declare class EnsurePostgresSetupUnchangedImpl implements CoreBeforeDeploy.Interface {
13
13
  private coreStackOutputService;
@@ -19,7 +19,7 @@ class EnsurePostgresSetupUnchangedImpl {
19
19
  const isPostgres = configuredSetup === POSTGRES;
20
20
  if (wasPostgres === isPostgres) return;
21
21
  const error = isPostgres ? new Error(`Cannot deploy with Postgres. The Core application was deployed with the "${deployedSetup}" database setup.`) : new Error(`Cannot deploy without Postgres. The Core application was deployed with the "${POSTGRES}" database setup.`);
22
- throw GracefulError.from(error, "Once a project is deployed, it can't switch between %s and %s.\n\nYour options:\n• To switch, destroy the project and deploy it again from scratch.\n• To keep the current database, change your %s config file back (%s).", "DynamoDB", "Postgres", "webiny.config.tsx", isPostgres ? "remove <Infra.Postgres />" : "add <Infra.Postgres />");
22
+ throw GracefulError.from(error, "Once a project is deployed, it can't switch between %s and %s.\n\nYour options:\n• To switch, destroy the project and deploy it again from scratch.\n• To keep the current database, change your %s config file back (%s).", "DynamoDB", "Postgres", "webiny.config.tsx", isPostgres ? "remove <Infra.AuroraPostgres />" : "add <Infra.AuroraPostgres />");
23
23
  }
24
24
  }
25
25
  const EnsurePostgresSetupUnchanged = CoreBeforeDeploy.createImplementation({