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

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 (142) 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/_templates/extensions/TenantStorages/ddb/api/graphql/src/index.ts +25 -0
  9. package/_templates/extensions/TenantStorages/ddb/api/graphql/src/web.ts +17 -0
  10. package/_templates/extensions/TenantStorages/ddb-os/api/graphql/src/index.ts +25 -0
  11. package/_templates/extensions/TenantStorages/ddb-os/api/graphql/src/web.ts +17 -0
  12. package/_templates/extensions/TenantStorages/pg/api/graphql/src/index.ts +25 -0
  13. package/_templates/extensions/TenantStorages/pg/api/graphql/src/web.ts +16 -0
  14. package/api.d.ts +6 -6
  15. package/api.js +3 -2
  16. package/api.js.map +1 -1
  17. package/decorators/GetPulumiServiceWithDownloadInfo.d.ts +1 -3
  18. package/decorators/GetPulumiServiceWithDownloadInfo.js +15 -11
  19. package/decorators/GetPulumiServiceWithDownloadInfo.js.map +1 -1
  20. package/extensions/AuroraPostgresCluster.d.ts +12 -0
  21. package/extensions/{Postgres.js → AuroraPostgresCluster.js} +7 -7
  22. package/extensions/AuroraPostgresCluster.js.map +1 -0
  23. package/extensions/OpenSearch/ReplaceApiLambdaFnHandlers.d.ts +3 -2
  24. package/extensions/OpenSearch/ReplaceApiLambdaFnHandlers.js +7 -3
  25. package/extensions/OpenSearch/ReplaceApiLambdaFnHandlers.js.map +1 -1
  26. package/extensions/Postgres/AddCorePostgres.d.ts +1 -1
  27. package/extensions/Postgres/AddCorePostgres.js +0 -2
  28. package/extensions/Postgres/AddCorePostgres.js.map +1 -1
  29. package/extensions/Postgres/CopyPgModulesAfterApiBuild.d.ts +4 -3
  30. package/extensions/Postgres/CopyPgModulesAfterApiBuild.js.map +1 -1
  31. package/extensions/Postgres/ReplaceApiLambdaFnHandlers.d.ts +6 -5
  32. package/extensions/Postgres/ReplaceApiLambdaFnHandlers.js +6 -2
  33. package/extensions/Postgres/ReplaceApiLambdaFnHandlers.js.map +1 -1
  34. package/extensions/Postgres/ValidatePostgresBeforeCoreDeploy.d.ts +1 -1
  35. package/extensions/Postgres/ValidatePostgresBeforeCoreDeploy.js +8 -10
  36. package/extensions/Postgres/ValidatePostgresBeforeCoreDeploy.js.map +1 -1
  37. package/extensions/Postgres/assertPostgresNetwork.d.ts +19 -0
  38. package/extensions/Postgres/assertPostgresNetwork.js +16 -0
  39. package/extensions/Postgres/assertPostgresNetwork.js.map +1 -0
  40. package/extensions/Postgres/copyPgRuntimeModules.d.ts +1 -1
  41. package/extensions/Postgres/copyPgRuntimeModules.js +2 -2
  42. package/extensions/Postgres/copyPgRuntimeModules.js.map +1 -1
  43. package/extensions/ProjectAws/AutoInstall/AutoInstallAfterApiDeploy.d.ts +17 -2
  44. package/extensions/ProjectAws/AutoInstall/AutoInstallAfterApiDeploy.js +26 -19
  45. package/extensions/ProjectAws/AutoInstall/AutoInstallAfterApiDeploy.js.map +1 -1
  46. package/extensions/ProjectAws/EnsurePostgresSetupUnchanged.d.ts +2 -2
  47. package/extensions/ProjectAws/EnsurePostgresSetupUnchanged.js +1 -1
  48. package/extensions/ProjectAws/EnsurePostgresSetupUnchanged.js.map +1 -1
  49. package/extensions/ProjectAws/RefuseApiWatchWithPostgres.d.ts +3 -3
  50. package/extensions/ProjectAws/RefuseApiWatchWithPostgres.js +1 -1
  51. package/extensions/ProjectAws/RefuseApiWatchWithPostgres.js.map +1 -1
  52. package/extensions/ProjectAws/TenantStorages/AddTenantStorages.d.ts +34 -0
  53. package/extensions/ProjectAws/TenantStorages/AddTenantStorages.js +55 -0
  54. package/extensions/ProjectAws/TenantStorages/AddTenantStorages.js.map +1 -0
  55. package/extensions/ProjectAws/TenantStorages/ApplyTenantStoragesApiEntry.d.ts +26 -0
  56. package/extensions/ProjectAws/TenantStorages/ApplyTenantStoragesApiEntry.js +49 -0
  57. package/extensions/ProjectAws/TenantStorages/ApplyTenantStoragesApiEntry.js.map +1 -0
  58. package/extensions/ProjectAws/TenantStorages/CopyPgModulesForTenantStorages.d.ts +17 -0
  59. package/extensions/ProjectAws/TenantStorages/CopyPgModulesForTenantStorages.js +26 -0
  60. package/extensions/ProjectAws/TenantStorages/CopyPgModulesForTenantStorages.js.map +1 -0
  61. package/extensions/ProjectAws/TenantStorages/EnsureStoragesNotRemoved.d.ts +41 -0
  62. package/extensions/ProjectAws/TenantStorages/EnsureStoragesNotRemoved.js +55 -0
  63. package/extensions/ProjectAws/TenantStorages/EnsureStoragesNotRemoved.js.map +1 -0
  64. package/extensions/ProjectAws/TenantStorages/ValidateTenantStoragesBeforeCoreDeploy.d.ts +48 -0
  65. package/extensions/ProjectAws/TenantStorages/ValidateTenantStoragesBeforeCoreDeploy.js +78 -0
  66. package/extensions/ProjectAws/TenantStorages/ValidateTenantStoragesBeforeCoreDeploy.js.map +1 -0
  67. package/extensions/ProjectAws.js +11 -1
  68. package/extensions/ProjectAws.js.map +1 -1
  69. package/extensions/definitions.js +2 -4
  70. package/extensions/definitions.js.map +1 -1
  71. package/extensions/index.d.ts +3 -3
  72. package/extensions/index.js +3 -4
  73. package/extensions/registerExtensionImplementations.js +3 -5
  74. package/extensions/registerExtensionImplementations.js.map +1 -1
  75. package/infra.d.ts +13 -8
  76. package/infra.js +9 -10
  77. package/infra.js.map +1 -1
  78. package/package.json +19 -18
  79. package/project.d.ts +4 -2
  80. package/pulumi/apps/admin/createAdminPulumiApp.js.map +1 -1
  81. package/pulumi/apps/api/ApiGraphql.js.map +1 -1
  82. package/pulumi/apps/api/ApiGraphqlWeb.js.map +1 -1
  83. package/pulumi/apps/api/ApiOutput.js.map +1 -1
  84. package/pulumi/apps/api/ApiSchemaSetup.d.ts +35 -13
  85. package/pulumi/apps/api/ApiSchemaSetup.js +31 -8
  86. package/pulumi/apps/api/ApiSchemaSetup.js.map +1 -1
  87. package/pulumi/apps/api/apiDynamoDb.js.map +1 -1
  88. package/pulumi/apps/api/backgroundTask/types.js.map +1 -1
  89. package/pulumi/apps/api/createApiPulumiApp.js +14 -7
  90. package/pulumi/apps/api/createApiPulumiApp.js.map +1 -1
  91. package/pulumi/apps/common/CoreOutput.d.ts +11 -0
  92. package/pulumi/apps/common/CoreOutput.js +2 -1
  93. package/pulumi/apps/common/CoreOutput.js.map +1 -1
  94. package/pulumi/apps/core/CoreCognito.d.ts +14 -0
  95. package/pulumi/apps/core/CoreCognito.js +34 -1
  96. package/pulumi/apps/core/CoreCognito.js.map +1 -1
  97. package/pulumi/apps/core/CorePostgres.d.ts +6 -4
  98. package/pulumi/apps/core/CorePostgres.js +26 -20
  99. package/pulumi/apps/core/CorePostgres.js.map +1 -1
  100. package/pulumi/apps/core/cognitoIdentityProviders/configure.js +11 -0
  101. package/pulumi/apps/core/cognitoIdentityProviders/configure.js.map +1 -1
  102. package/pulumi/apps/core/coreDynamoDb.d.ts +2 -2
  103. package/pulumi/apps/core/coreDynamoDb.js.map +1 -1
  104. package/pulumi/apps/core/coreServiceManifests.d.ts +6 -4
  105. package/pulumi/apps/core/coreServiceManifests.js.map +1 -1
  106. package/pulumi/apps/core/coreVpcEndpoints.d.ts +9 -2
  107. package/pulumi/apps/core/coreVpcEndpoints.js +15 -11
  108. package/pulumi/apps/core/coreVpcEndpoints.js.map +1 -1
  109. package/pulumi/apps/core/createCorePulumiApp.js +8 -1
  110. package/pulumi/apps/core/createCorePulumiApp.js.map +1 -1
  111. package/pulumi/apps/extensions/getPostgresConfigFromExtension.d.ts +4 -2
  112. package/pulumi/apps/extensions/getPostgresConfigFromExtension.js +4 -3
  113. package/pulumi/apps/extensions/getPostgresConfigFromExtension.js.map +1 -1
  114. package/pulumi/apps/extensions/getTenantStoragesFromExtension.d.ts +19 -0
  115. package/pulumi/apps/extensions/getTenantStoragesFromExtension.js +32 -0
  116. package/pulumi/apps/extensions/getTenantStoragesFromExtension.js.map +1 -0
  117. package/pulumi/apps/extensions/projectUsesPostgres.d.ts +1 -1
  118. package/pulumi/apps/extensions/projectUsesPostgres.js.map +1 -1
  119. package/pulumi/apps/react/adminSettingsItem.d.ts +1 -1
  120. package/pulumi/apps/react/adminSettingsItem.js.map +1 -1
  121. package/pulumi/apps/react/createReactPulumiApp.js.map +1 -1
  122. package/pulumi/extensions/index.d.ts +8 -0
  123. package/pulumi/extensions/index.js +2 -1
  124. package/pulumi/extensions/index.js.map +1 -1
  125. package/pulumi/types.d.ts +2 -2
  126. package/pulumi/utils/lambdaEnvVariables.js +2 -2
  127. package/pulumi/utils/lambdaEnvVariables.js.map +1 -1
  128. package/pulumi/utils/withServiceManifest.d.ts +2 -2
  129. package/pulumi/utils/withServiceManifest.js.map +1 -1
  130. package/services/PulumiGetStackOutputService/mapStackOutput.js +1 -1
  131. package/services/PulumiGetStackOutputService/mapStackOutput.js.map +1 -1
  132. package/extensions/Postgres.d.ts +0 -11
  133. package/extensions/Postgres.js.map +0 -1
  134. package/extensions/RdsProxy/EnsurePostgresWithRdsProxy.d.ts +0 -14
  135. package/extensions/RdsProxy/EnsurePostgresWithRdsProxy.js +0 -23
  136. package/extensions/RdsProxy/EnsurePostgresWithRdsProxy.js.map +0 -1
  137. package/extensions/RdsProxy.d.ts +0 -9
  138. package/extensions/RdsProxy.js +0 -31
  139. package/extensions/RdsProxy.js.map +0 -1
  140. package/pulumi/apps/extensions/getRdsProxyConfigFromExtension.d.ts +0 -5
  141. package/pulumi/apps/extensions/getRdsProxyConfigFromExtension.js +0 -8
  142. 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 => {
@@ -0,0 +1,25 @@
1
+ /**
2
+ * DI-native API GraphQL handler — DynamoDB default storage, with the Postgres storages tenants can
3
+ * be placed on (`<Infra.TenantStorage.AuroraPostgres>`).
4
+ *
5
+ * `ApplyTenantStoragesApiEntry` copies this file over the api workspace when the project declares a
6
+ * storage. Root and every tenant without `settings.storage` run on the default storage; a tenant
7
+ * whose `settings.storage` names a declared storage runs on its cluster. The storages' connections
8
+ * come from `WEBINY_TENANT_STORAGES`, which the deploy sets on every API function. The same bundle
9
+ * answers the `WebinySqlSchemaSetup` event, which the api deploy sends to set every storage up.
10
+ *
11
+ * Exports both the buffered (API Gateway) and the response-streaming (Function URL) handler; see the
12
+ * DynamoDB variant of this file for why streaming needs its own Lambda function.
13
+ */
14
+ import {
15
+ createAwsDdbApiHandler,
16
+ createAwsDdbStreamApiHandler
17
+ } from "@webiny/api-composition-aws-ddb";
18
+ import { createAwsPgTenantStorages } from "@webiny/api-composition-aws-pg";
19
+ import { extensions } from "./extensions";
20
+
21
+ const tenantStorages = createAwsPgTenantStorages();
22
+
23
+ export const handler = createAwsDdbApiHandler({ extensions, tenantStorages });
24
+
25
+ export const streamHandler = createAwsDdbStreamApiHandler({ extensions, tenantStorages });
@@ -0,0 +1,17 @@
1
+ /**
2
+ * Entry of the Lambda web function, built unless the project sets
3
+ * `<Infra.Api.WebFunction enabled={false} />`: the DynamoDB default storage, with the Postgres
4
+ * storages tenants can be placed on (`<Infra.TenantStorage.AuroraPostgres>`).
5
+ *
6
+ * Unlike `index.ts`, importing this module starts an HTTP server, so it is a separate entry and a
7
+ * separate bundle (`build-web/`), never part of `handler.mjs`. The web function serves the HTTP routes;
8
+ * every other invocation still goes to the regular `graphql` Lambda built from `index.ts`.
9
+ */
10
+ import { startAwsDdbWebApi } from "@webiny/api-composition-aws-ddb";
11
+ import { createAwsPgTenantStorages } from "@webiny/api-composition-aws-pg";
12
+ import { extensions } from "./extensions";
13
+
14
+ startAwsDdbWebApi({ extensions, tenantStorages: createAwsPgTenantStorages() }).catch(err => {
15
+ console.error("Failed to start the web API server.", err);
16
+ process.exit(1);
17
+ });
@@ -0,0 +1,25 @@
1
+ /**
2
+ * DI-native API GraphQL handler — DynamoDB + OpenSearch default storage, with the Postgres storages tenants can
3
+ * be placed on (`<Infra.TenantStorage.AuroraPostgres>`).
4
+ *
5
+ * `ApplyTenantStoragesApiEntry` copies this file over the api workspace when the project declares a
6
+ * storage. Root and every tenant without `settings.storage` run on the default storage; a tenant
7
+ * whose `settings.storage` names a declared storage runs on its cluster. The storages' connections
8
+ * come from `WEBINY_TENANT_STORAGES`, which the deploy sets on every API function. The same bundle
9
+ * answers the `WebinySqlSchemaSetup` event, which the api deploy sends to set every storage up.
10
+ *
11
+ * Exports both the buffered (API Gateway) and the response-streaming (Function URL) handler; see the
12
+ * DynamoDB variant of this file for why streaming needs its own Lambda function.
13
+ */
14
+ import {
15
+ createAwsDdbOsApiHandler,
16
+ createAwsDdbOsStreamApiHandler
17
+ } from "@webiny/api-composition-aws-ddb-os";
18
+ import { createAwsPgTenantStorages } from "@webiny/api-composition-aws-pg";
19
+ import { extensions } from "./extensions";
20
+
21
+ const tenantStorages = createAwsPgTenantStorages();
22
+
23
+ export const handler = createAwsDdbOsApiHandler({ extensions, tenantStorages });
24
+
25
+ export const streamHandler = createAwsDdbOsStreamApiHandler({ extensions, tenantStorages });
@@ -0,0 +1,17 @@
1
+ /**
2
+ * Entry of the Lambda web function, built unless the project sets
3
+ * `<Infra.Api.WebFunction enabled={false} />`: the DynamoDB + OpenSearch default storage, with the Postgres
4
+ * storages tenants can be placed on (`<Infra.TenantStorage.AuroraPostgres>`).
5
+ *
6
+ * Unlike `index.ts`, importing this module starts an HTTP server, so it is a separate entry and a
7
+ * separate bundle (`build-web/`), never part of `handler.mjs`. The web function serves the HTTP routes;
8
+ * every other invocation still goes to the regular `graphql` Lambda built from `index.ts`.
9
+ */
10
+ import { startAwsDdbOsWebApi } from "@webiny/api-composition-aws-ddb-os";
11
+ import { createAwsPgTenantStorages } from "@webiny/api-composition-aws-pg";
12
+ import { extensions } from "./extensions";
13
+
14
+ startAwsDdbOsWebApi({ extensions, tenantStorages: createAwsPgTenantStorages() }).catch(err => {
15
+ console.error("Failed to start the web API server.", err);
16
+ process.exit(1);
17
+ });
@@ -0,0 +1,25 @@
1
+ /**
2
+ * DI-native API GraphQL handler — Postgres default storage, with the Postgres storages tenants can
3
+ * be placed on (`<Infra.TenantStorage.AuroraPostgres>`).
4
+ *
5
+ * `ApplyTenantStoragesApiEntry` copies this file over the api workspace when the project declares a
6
+ * storage. Root and every tenant without `settings.storage` run on the default storage; a tenant
7
+ * whose `settings.storage` names a declared storage runs on its cluster. The storages' connections
8
+ * come from `WEBINY_TENANT_STORAGES`, which the deploy sets on every API function. The same bundle
9
+ * answers the `WebinySqlSchemaSetup` event, which the api deploy sends to set every storage up.
10
+ *
11
+ * Exports both the buffered (API Gateway) and the response-streaming (Function URL) handler; see the
12
+ * DynamoDB variant of this file for why streaming needs its own Lambda function.
13
+ */
14
+ import {
15
+ createAwsPgApiHandler,
16
+ createAwsPgStreamApiHandler,
17
+ createAwsPgTenantStorages
18
+ } from "@webiny/api-composition-aws-pg";
19
+ import { extensions } from "./extensions";
20
+
21
+ const tenantStorages = createAwsPgTenantStorages();
22
+
23
+ export const handler = createAwsPgApiHandler({ extensions, tenantStorages });
24
+
25
+ export const streamHandler = createAwsPgStreamApiHandler({ extensions, tenantStorages });
@@ -0,0 +1,16 @@
1
+ /**
2
+ * Entry of the Lambda web function, built unless the project sets
3
+ * `<Infra.Api.WebFunction enabled={false} />`: the Postgres default storage, with the Postgres
4
+ * storages tenants can be placed on (`<Infra.TenantStorage.AuroraPostgres>`).
5
+ *
6
+ * Unlike `index.ts`, importing this module starts an HTTP server, so it is a separate entry and a
7
+ * separate bundle (`build-web/`), never part of `handler.mjs`. The web function serves the HTTP routes;
8
+ * every other invocation still goes to the regular `graphql` Lambda built from `index.ts`.
9
+ */
10
+ import { startAwsPgWebApi, createAwsPgTenantStorages } from "@webiny/api-composition-aws-pg";
11
+ import { extensions } from "./extensions";
12
+
13
+ startAwsPgWebApi({ extensions, tenantStorages: createAwsPgTenantStorages() }).catch(err => {
14
+ console.error("Failed to start the web API server.", err);
15
+ process.exit(1);
16
+ });
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"}
@@ -1,9 +1,10 @@
1
- import { BuildAppWorkspaceService, GetApp, LoggerService } from "@webiny/project/abstractions/index.js";
1
+ import { BuildAppWorkspaceService, GetApp, GetProjectConfigService, LoggerService } from "@webiny/project/abstractions/index.js";
2
2
  declare class ReplaceApiLambdaFnHandlerDecorator implements BuildAppWorkspaceService.Interface {
3
3
  private getApp;
4
+ private getProjectConfigService;
4
5
  private logger;
5
6
  private decoratee;
6
- constructor(getApp: GetApp.Interface, logger: LoggerService.Interface, decoratee: BuildAppWorkspaceService.Interface);
7
+ constructor(getApp: GetApp.Interface, getProjectConfigService: GetProjectConfigService.Interface, logger: LoggerService.Interface, decoratee: BuildAppWorkspaceService.Interface);
7
8
  execute(appName: GetApp.AppName, options?: BuildAppWorkspaceService.Options): Promise<void>;
8
9
  }
9
10
  export declare const ReplaceApiLambdaFnHandlers: typeof ReplaceApiLambdaFnHandlerDecorator & {
@@ -1,16 +1,19 @@
1
1
  import path from "path";
2
2
  import fs from "fs";
3
- import { BuildAppWorkspaceService, GetApp, LoggerService } from "@webiny/project/abstractions/index.js";
3
+ import { BuildAppWorkspaceService, GetApp, GetProjectConfigService, LoggerService } from "@webiny/project/abstractions/index.js";
4
4
  import { getTemplatesFolderPath } from "../../utils/index.js";
5
+ import { hasTenantStorages } from "../ProjectAws/TenantStorages/ApplyTenantStoragesApiEntry.js";
5
6
  class ReplaceApiLambdaFnHandlerDecorator {
6
- constructor(getApp, logger, decoratee){
7
+ constructor(getApp, getProjectConfigService, logger, decoratee){
7
8
  this.getApp = getApp;
9
+ this.getProjectConfigService = getProjectConfigService;
8
10
  this.logger = logger;
9
11
  this.decoratee = decoratee;
10
12
  }
11
13
  async execute(appName, options = {}) {
12
14
  const result = await this.decoratee.execute(appName, options);
13
- if ("api" === appName) {
15
+ const projectConfig = await this.getProjectConfigService.execute();
16
+ if ("api" === appName && !hasTenantStorages(projectConfig)) {
14
17
  const templatesFolderPath = getTemplatesFolderPath();
15
18
  const app = this.getApp.execute("api");
16
19
  const appWorkspaceFolderPath = app.paths.workspaceFolder.toString();
@@ -28,6 +31,7 @@ const ReplaceApiLambdaFnHandlers = BuildAppWorkspaceService.createDecorator({
28
31
  decorator: ReplaceApiLambdaFnHandlerDecorator,
29
32
  dependencies: [
30
33
  GetApp,
34
+ GetProjectConfigService,
31
35
  LoggerService
32
36
  ]
33
37
  });
@@ -1 +1 @@
1
- {"version":3,"file":"extensions/OpenSearch/ReplaceApiLambdaFnHandlers.js","sources":["../../../src/extensions/OpenSearch/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\nclass ReplaceApiLambdaFnHandlerDecorator 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 const templatesFolderPath = getTemplatesFolderPath();\n\n const app = this.getApp.execute(\"api\");\n\n const appWorkspaceFolderPath = app.paths.workspaceFolder.toString();\n const apiLambdaFnHandlersFolderPath = path.join(\n templatesFolderPath,\n \"extensions\",\n \"OpenSearch\",\n \"api\"\n );\n\n fs.cpSync(apiLambdaFnHandlersFolderPath, appWorkspaceFolderPath, {\n recursive: true,\n force: true\n });\n\n this.logger.debug(\"Replaced API Lambda function handlers with OpenSearch versions.\");\n }\n\n return result;\n }\n}\n\nexport const ReplaceApiLambdaFnHandlers = BuildAppWorkspaceService.createDecorator({\n decorator: ReplaceApiLambdaFnHandlerDecorator,\n dependencies: [GetApp, LoggerService]\n});\n"],"names":["ReplaceApiLambdaFnHandlerDecorator","getApp","logger","decoratee","appName","options","result","templatesFolderPath","getTemplatesFolderPath","app","appWorkspaceFolderPath","apiLambdaFnHandlersFolderPath","path","fs","ReplaceApiLambdaFnHandlers","BuildAppWorkspaceService","GetApp","LoggerService"],"mappings":";;;;AASA,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,SAAmB;YACnB,MAAMG,sBAAsBC;YAE5B,MAAMC,MAAM,IAAI,CAAC,MAAM,CAAC,OAAO,CAAC;YAEhC,MAAMC,yBAAyBD,IAAI,KAAK,CAAC,eAAe,CAAC,QAAQ;YACjE,MAAME,gCAAgCC,KAAK,IAAI,CAC3CL,qBACA,cACA,cACA;YAGJM,GAAG,MAAM,CAACF,+BAA+BD,wBAAwB;gBAC7D,WAAW;gBACX,OAAO;YACX;YAEA,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC;QACtB;QAEA,OAAOJ;IACX;AACJ;AAEO,MAAMQ,6BAA6BC,yBAAyB,eAAe,CAAC;IAC/E,WAAWf;IACX,cAAc;QAACgB;QAAQC;KAAc;AACzC"}
1
+ {"version":3,"file":"extensions/OpenSearch/ReplaceApiLambdaFnHandlers.js","sources":["../../../src/extensions/OpenSearch/ReplaceApiLambdaFnHandlers.ts"],"sourcesContent":["import path from \"path\";\nimport fs from \"fs\";\nimport {\n BuildAppWorkspaceService,\n GetApp,\n GetProjectConfigService,\n LoggerService\n} from \"@webiny/project/abstractions/index.js\";\nimport { getTemplatesFolderPath } from \"~/utils/index.js\";\nimport { hasTenantStorages } from \"~/extensions/ProjectAws/TenantStorages/ApplyTenantStoragesApiEntry.js\";\n\nclass ReplaceApiLambdaFnHandlerDecorator implements BuildAppWorkspaceService.Interface {\n constructor(\n private getApp: GetApp.Interface,\n private getProjectConfigService: GetProjectConfigService.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 // With tenant storages, `ApplyTenantStoragesApiEntry` puts the entry with them in place.\n const projectConfig = await this.getProjectConfigService.execute();\n if (appName === \"api\" && !hasTenantStorages(projectConfig)) {\n const templatesFolderPath = getTemplatesFolderPath();\n\n const app = this.getApp.execute(\"api\");\n\n const appWorkspaceFolderPath = app.paths.workspaceFolder.toString();\n const apiLambdaFnHandlersFolderPath = path.join(\n templatesFolderPath,\n \"extensions\",\n \"OpenSearch\",\n \"api\"\n );\n\n fs.cpSync(apiLambdaFnHandlersFolderPath, appWorkspaceFolderPath, {\n recursive: true,\n force: true\n });\n\n this.logger.debug(\"Replaced API Lambda function handlers with OpenSearch versions.\");\n }\n\n return result;\n }\n}\n\nexport const ReplaceApiLambdaFnHandlers = BuildAppWorkspaceService.createDecorator({\n decorator: ReplaceApiLambdaFnHandlerDecorator,\n dependencies: [GetApp, GetProjectConfigService, LoggerService]\n});\n"],"names":["ReplaceApiLambdaFnHandlerDecorator","getApp","getProjectConfigService","logger","decoratee","appName","options","result","projectConfig","hasTenantStorages","templatesFolderPath","getTemplatesFolderPath","app","appWorkspaceFolderPath","apiLambdaFnHandlersFolderPath","path","fs","ReplaceApiLambdaFnHandlers","BuildAppWorkspaceService","GetApp","GetProjectConfigService","LoggerService"],"mappings":";;;;;AAWA,MAAMA;IACF,YACYC,MAAwB,EACxBC,uBAA0D,EAC1DC,MAA+B,EAC/BC,SAA6C,CACvD;aAJUH,MAAM,GAANA;aACAC,uBAAuB,GAAvBA;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;QAErD,MAAME,gBAAgB,MAAM,IAAI,CAAC,uBAAuB,CAAC,OAAO;QAChE,IAAIH,AAAY,UAAZA,WAAqB,CAACI,kBAAkBD,gBAAgB;YACxD,MAAME,sBAAsBC;YAE5B,MAAMC,MAAM,IAAI,CAAC,MAAM,CAAC,OAAO,CAAC;YAEhC,MAAMC,yBAAyBD,IAAI,KAAK,CAAC,eAAe,CAAC,QAAQ;YACjE,MAAME,gCAAgCC,KAAK,IAAI,CAC3CL,qBACA,cACA,cACA;YAGJM,GAAG,MAAM,CAACF,+BAA+BD,wBAAwB;gBAC7D,WAAW;gBACX,OAAO;YACX;YAEA,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC;QACtB;QAEA,OAAON;IACX;AACJ;AAEO,MAAMU,6BAA6BC,yBAAyB,eAAe,CAAC;IAC/E,WAAWlB;IACX,cAAc;QAACmB;QAAQC;QAAyBC;KAAc;AAClE"}
@@ -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,14 +1,15 @@
1
- import { BuildAppWorkspaceService, GetApp, LoggerService } from "@webiny/project/abstractions/index.js";
1
+ import { BuildAppWorkspaceService, GetApp, GetProjectConfigService, 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;
9
+ private getProjectConfigService;
9
10
  private logger;
10
11
  private decoratee;
11
- constructor(getApp: GetApp.Interface, logger: LoggerService.Interface, decoratee: BuildAppWorkspaceService.Interface);
12
+ constructor(getApp: GetApp.Interface, getProjectConfigService: GetProjectConfigService.Interface, logger: LoggerService.Interface, decoratee: BuildAppWorkspaceService.Interface);
12
13
  execute(appName: GetApp.AppName, options?: BuildAppWorkspaceService.Options): Promise<void>;
13
14
  }
14
15
  export declare const ReplaceApiLambdaFnHandlers: typeof ReplaceApiLambdaFnHandlersDecorator & {