@webiny/project-aws 6.6.0-alpha.11 → 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.
- package/_templates/appTemplates/api/graphql/package.json +2 -2
- package/_templates/appTemplates/api/graphql/src/index.ts +2 -2
- package/_templates/appTemplates/api/graphql/src/web.ts +15 -0
- package/_templates/appTemplates/api/graphql/webiny.config.ts +6 -1
- package/_templates/extensions/OpenSearch/api/graphql/src/index.ts +2 -2
- package/_templates/extensions/OpenSearch/api/graphql/src/web.ts +15 -0
- package/_templates/extensions/Postgres/api/graphql/src/index.ts +17 -0
- package/_templates/extensions/Postgres/api/graphql/src/web.ts +15 -0
- package/api.d.ts +6 -6
- package/api.js +3 -2
- package/api.js.map +1 -1
- package/apps/createApiApp.d.ts +18 -1
- package/apps/createCoreApp.d.ts +1 -1
- package/decorators/GetPulumiServiceWithDownloadInfo.d.ts +1 -3
- package/decorators/GetPulumiServiceWithDownloadInfo.js +15 -11
- package/decorators/GetPulumiServiceWithDownloadInfo.js.map +1 -1
- package/extensions/ApiRoute.d.ts +2 -1
- package/extensions/ApiRoute.js.map +1 -1
- package/extensions/AuroraPostgresCluster.d.ts +12 -0
- package/extensions/AuroraPostgresCluster.js +30 -0
- package/extensions/AuroraPostgresCluster.js.map +1 -0
- package/extensions/Postgres/AddCorePostgres.d.ts +27 -0
- package/extensions/Postgres/AddCorePostgres.js +52 -0
- package/extensions/Postgres/AddCorePostgres.js.map +1 -0
- package/extensions/Postgres/CopyPgModulesAfterApiBuild.d.ts +16 -0
- package/extensions/Postgres/CopyPgModulesAfterApiBuild.js +42 -0
- package/extensions/Postgres/CopyPgModulesAfterApiBuild.js.map +1 -0
- package/extensions/Postgres/ReplaceApiLambdaFnHandlers.d.ts +17 -0
- package/extensions/Postgres/ReplaceApiLambdaFnHandlers.js +33 -0
- package/extensions/Postgres/ReplaceApiLambdaFnHandlers.js.map +1 -0
- package/extensions/Postgres/ValidatePostgresBeforeCoreDeploy.d.ts +23 -0
- package/extensions/Postgres/ValidatePostgresBeforeCoreDeploy.js +41 -0
- package/extensions/Postgres/ValidatePostgresBeforeCoreDeploy.js.map +1 -0
- package/extensions/Postgres/copyPgRuntimeModules.d.ts +27 -0
- package/extensions/Postgres/copyPgRuntimeModules.js +124 -0
- package/extensions/Postgres/copyPgRuntimeModules.js.map +1 -0
- package/extensions/Postgres/rds-ca-bundle.pem +2888 -0
- package/extensions/Postgres/rdsCaBundle.d.ts +13 -0
- package/extensions/Postgres/rdsCaBundle.js +7 -0
- package/extensions/Postgres/rdsCaBundle.js.map +1 -0
- package/extensions/ProjectAws/EnsurePostgresSetupUnchanged.d.ts +20 -0
- package/extensions/ProjectAws/EnsurePostgresSetupUnchanged.js +34 -0
- package/extensions/ProjectAws/EnsurePostgresSetupUnchanged.js.map +1 -0
- package/extensions/ProjectAws/RefuseApiWatchWithPostgres.d.ts +20 -0
- package/extensions/ProjectAws/RefuseApiWatchWithPostgres.js +27 -0
- package/extensions/ProjectAws/RefuseApiWatchWithPostgres.js.map +1 -0
- package/extensions/ProjectAws.js +4 -0
- package/extensions/ProjectAws.js.map +1 -1
- package/extensions/definitions.js +3 -1
- package/extensions/definitions.js.map +1 -1
- package/extensions/index.d.ts +4 -1
- package/extensions/index.js +3 -2
- package/extensions/registerExtensionImplementations.js +3 -1
- package/extensions/registerExtensionImplementations.js.map +1 -1
- package/extensions/toCloudFrontPathPattern.d.ts +5 -0
- package/extensions/toCloudFrontPathPattern.js +8 -0
- package/extensions/toCloudFrontPathPattern.js.map +1 -0
- package/features/Watch/AwsWatch.js +1 -0
- package/features/Watch/AwsWatch.js.map +1 -1
- package/features/Watch/forwarder/createForwarderZip.d.ts +8 -0
- package/features/Watch/forwarder/createForwarderZip.js +19 -0
- package/features/Watch/forwarder/createForwarderZip.js.map +1 -0
- package/features/Watch/forwarder/lambdaHandler.cjs +124 -0
- package/features/Watch/forwarder/lambdaHandler.d.cts +1 -0
- package/features/Watch/forwarder/mqtt.cjs +4 -0
- package/features/Watch/forwarder/mqtt.d.cts +1 -0
- package/features/Watch/forwarder/webHandler.d.mts +1 -0
- package/features/Watch/forwarder/webHandler.mjs +298 -0
- package/features/Watch/replaceLambdaFunctions.d.ts +2 -0
- package/features/Watch/replaceLambdaFunctions.js +44 -3
- package/features/Watch/replaceLambdaFunctions.js.map +1 -1
- package/features/Watch/replaceWebFunction.d.ts +44 -0
- package/features/Watch/replaceWebFunction.js +119 -0
- package/features/Watch/replaceWebFunction.js.map +1 -0
- package/infra.d.ts +13 -0
- package/infra.js +8 -6
- package/infra.js.map +1 -1
- package/package.json +21 -17
- package/project.d.ts +1 -0
- package/pulumi/apps/admin/createAdminPulumiApp.js +1 -2
- package/pulumi/apps/admin/createAdminPulumiApp.js.map +1 -1
- package/pulumi/apps/api/ApiCloudfront.d.ts +5 -0
- package/pulumi/apps/api/ApiCloudfront.js +71 -198
- package/pulumi/apps/api/ApiCloudfront.js.map +1 -1
- package/pulumi/apps/api/ApiFileManager.d.ts +8 -1
- package/pulumi/apps/api/ApiFileManager.js +11 -1
- package/pulumi/apps/api/ApiFileManager.js.map +1 -1
- package/pulumi/apps/api/ApiGraphql.d.ts +1 -1
- package/pulumi/apps/api/ApiGraphql.js +78 -69
- package/pulumi/apps/api/ApiGraphql.js.map +1 -1
- package/pulumi/apps/api/ApiGraphqlWeb.d.ts +45 -0
- package/pulumi/apps/api/ApiGraphqlWeb.js +280 -0
- package/pulumi/apps/api/ApiGraphqlWeb.js.map +1 -0
- package/pulumi/apps/api/ApiOutput.d.ts +1 -0
- package/pulumi/apps/api/ApiOutput.js +2 -1
- package/pulumi/apps/api/ApiOutput.js.map +1 -1
- package/pulumi/apps/api/ApiSchemaSetup.d.ts +86 -0
- package/pulumi/apps/api/ApiSchemaSetup.js +139 -0
- package/pulumi/apps/api/ApiSchemaSetup.js.map +1 -0
- package/pulumi/apps/api/apiDynamoDb.d.ts +6 -0
- package/pulumi/apps/api/apiDynamoDb.js +20 -0
- package/pulumi/apps/api/apiDynamoDb.js.map +1 -0
- package/pulumi/apps/api/apiServiceManifests.d.ts +24 -0
- package/pulumi/apps/api/apiServiceManifests.js +27 -0
- package/pulumi/apps/api/apiServiceManifests.js.map +1 -0
- package/pulumi/apps/api/backgroundTask/types.js.map +1 -1
- package/pulumi/apps/api/cloudfront/addWebRouteBehavior.d.ts +8 -0
- package/pulumi/apps/api/cloudfront/addWebRouteBehavior.js +26 -0
- package/pulumi/apps/api/cloudfront/addWebRouteBehavior.js.map +1 -0
- package/pulumi/apps/api/cloudfront/allowFunctionUrlInvoke.d.ts +17 -0
- package/pulumi/apps/api/cloudfront/allowFunctionUrlInvoke.js +27 -0
- package/pulumi/apps/api/cloudfront/allowFunctionUrlInvoke.js.map +1 -0
- package/pulumi/apps/api/cloudfront/allowWebFunctionInvoke.d.ts +8 -0
- package/pulumi/apps/api/cloudfront/allowWebFunctionInvoke.js +31 -0
- package/pulumi/apps/api/cloudfront/allowWebFunctionInvoke.js.map +1 -0
- package/pulumi/apps/api/cloudfront/constants.d.ts +24 -0
- package/pulumi/apps/api/cloudfront/constants.js +43 -0
- package/pulumi/apps/api/cloudfront/constants.js.map +1 -0
- package/pulumi/apps/api/cloudfront/createFilesRouting.d.ts +10 -0
- package/pulumi/apps/api/cloudfront/createFilesRouting.js +35 -0
- package/pulumi/apps/api/cloudfront/createFilesRouting.js.map +1 -0
- package/pulumi/apps/api/cloudfront/createGatewayRouting.d.ts +10 -0
- package/pulumi/apps/api/cloudfront/createGatewayRouting.js +48 -0
- package/pulumi/apps/api/cloudfront/createGatewayRouting.js.map +1 -0
- package/pulumi/apps/api/cloudfront/createStreamRouting.d.ts +10 -0
- package/pulumi/apps/api/cloudfront/createStreamRouting.js +87 -0
- package/pulumi/apps/api/cloudfront/createStreamRouting.js.map +1 -0
- package/pulumi/apps/api/cloudfront/createWebRouting.d.ts +13 -0
- package/pulumi/apps/api/cloudfront/createWebRouting.js +140 -0
- package/pulumi/apps/api/cloudfront/createWebRouting.js.map +1 -0
- package/pulumi/apps/api/createApiPulumiApp.d.ts +22 -4
- package/pulumi/apps/api/createApiPulumiApp.js +122 -81
- package/pulumi/apps/api/createApiPulumiApp.js.map +1 -1
- package/pulumi/apps/api/index.d.ts +2 -0
- package/pulumi/apps/api/index.js +2 -0
- package/pulumi/apps/api/isRouteNameAllowed.d.ts +7 -0
- package/pulumi/apps/api/isRouteNameAllowed.js +6 -0
- package/pulumi/apps/api/isRouteNameAllowed.js.map +1 -0
- package/pulumi/apps/common/CoreOutput.d.ts +13 -0
- package/pulumi/apps/common/CoreOutput.js +17 -2
- package/pulumi/apps/common/CoreOutput.js.map +1 -1
- package/pulumi/apps/core/CoreCognito.d.ts +14 -0
- package/pulumi/apps/core/CoreCognito.js +34 -1
- package/pulumi/apps/core/CoreCognito.js.map +1 -1
- package/pulumi/apps/core/CoreOpenSearch.js +12 -6
- package/pulumi/apps/core/CoreOpenSearch.js.map +1 -1
- package/pulumi/apps/core/CorePostgres.d.ts +48 -0
- package/pulumi/apps/core/CorePostgres.js +262 -0
- package/pulumi/apps/core/CorePostgres.js.map +1 -0
- package/pulumi/apps/core/cognitoIdentityProviders/configure.js +11 -0
- package/pulumi/apps/core/cognitoIdentityProviders/configure.js.map +1 -1
- package/pulumi/apps/core/coreDynamoDb.d.ts +19 -0
- package/pulumi/apps/core/coreDynamoDb.js +34 -0
- package/pulumi/apps/core/coreDynamoDb.js.map +1 -0
- package/pulumi/apps/core/coreServiceManifests.d.ts +31 -0
- package/pulumi/apps/core/coreServiceManifests.js +31 -0
- package/pulumi/apps/core/coreServiceManifests.js.map +1 -0
- package/pulumi/apps/core/coreVpcEndpoints.d.ts +14 -0
- package/pulumi/apps/core/coreVpcEndpoints.js +55 -0
- package/pulumi/apps/core/coreVpcEndpoints.js.map +1 -0
- package/pulumi/apps/core/createCorePulumiApp.d.ts +1 -1
- package/pulumi/apps/core/createCorePulumiApp.js +18 -78
- package/pulumi/apps/core/createCorePulumiApp.js.map +1 -1
- package/pulumi/apps/core/index.d.ts +1 -0
- package/pulumi/apps/core/index.js +1 -0
- package/pulumi/apps/extensions/getPostgresConfigFromExtension.d.ts +15 -0
- package/pulumi/apps/extensions/getPostgresConfigFromExtension.js +16 -0
- package/pulumi/apps/extensions/getPostgresConfigFromExtension.js.map +1 -0
- package/pulumi/apps/extensions/getVpcConfigFromExtension.d.ts +4 -0
- package/pulumi/apps/extensions/isWebFunctionEnabled.d.ts +5 -0
- package/pulumi/apps/extensions/isWebFunctionEnabled.js +9 -0
- package/pulumi/apps/extensions/isWebFunctionEnabled.js.map +1 -0
- package/pulumi/apps/extensions/projectUsesPostgres.d.ts +2 -0
- package/pulumi/apps/extensions/projectUsesPostgres.js +10 -0
- package/pulumi/apps/extensions/projectUsesPostgres.js.map +1 -0
- package/pulumi/apps/react/adminSettingsItem.d.ts +17 -0
- package/pulumi/apps/react/adminSettingsItem.js +28 -0
- package/pulumi/apps/react/adminSettingsItem.js.map +1 -0
- package/pulumi/apps/react/createReactPulumiApp.js +6 -19
- package/pulumi/apps/react/createReactPulumiApp.js.map +1 -1
- package/pulumi/extensions/index.d.ts +12 -45
- package/pulumi/extensions/index.js +2 -1
- package/pulumi/extensions/index.js.map +1 -1
- package/pulumi/types.d.ts +5 -0
- package/pulumi/utils/lambdaEnvVariables.js +2 -2
- package/pulumi/utils/lambdaEnvVariables.js.map +1 -1
- package/pulumi/utils/tagResources.js +2 -0
- package/pulumi/utils/tagResources.js.map +1 -1
- package/pulumi/utils/withServiceManifest.d.ts +35 -1
- package/pulumi/utils/withServiceManifest.js +53 -9
- package/pulumi/utils/withServiceManifest.js.map +1 -1
- package/services/PulumiGetStackOutputService/mapStackOutput.js +1 -1
- package/services/PulumiGetStackOutputService/mapStackOutput.js.map +1 -1
- package/features/Watch/handler/handler.zip +0 -0
|
@@ -4,8 +4,8 @@
|
|
|
4
4
|
"type": "module",
|
|
5
5
|
"scripts": {},
|
|
6
6
|
"dependencies": {
|
|
7
|
-
"@webiny/api-
|
|
8
|
-
"@webiny/api-
|
|
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-
|
|
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-
|
|
17
|
+
} from "@webiny/api-composition-aws-ddb";
|
|
18
18
|
import { extensions } from "./extensions";
|
|
19
19
|
|
|
20
20
|
export const handler = createAwsDdbApiHandler({ extensions });
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Entry of the Lambda web function, built unless the project sets
|
|
3
|
+
* `<Infra.Api.WebFunction enabled={false} />`.
|
|
4
|
+
*
|
|
5
|
+
* Unlike `index.ts`, importing this module starts an HTTP server, so it is a separate entry and a
|
|
6
|
+
* separate bundle (`build-web/`), never part of `handler.mjs`. The web function serves the HTTP routes;
|
|
7
|
+
* every other invocation still goes to the regular `graphql` Lambda built from `index.ts`.
|
|
8
|
+
*/
|
|
9
|
+
import { startAwsDdbWebApi } from "@webiny/api-composition-aws-ddb";
|
|
10
|
+
import { extensions } from "./extensions";
|
|
11
|
+
|
|
12
|
+
startAwsDdbWebApi({ extensions }).catch(err => {
|
|
13
|
+
console.error("Failed to start the web API server.", err);
|
|
14
|
+
process.exit(1);
|
|
15
|
+
});
|
|
@@ -2,7 +2,12 @@ import { createBuildFunction, createWatchFunction } from "@webiny/build-tools";
|
|
|
2
2
|
|
|
3
3
|
export default {
|
|
4
4
|
commands: {
|
|
5
|
-
build: createBuildFunction({
|
|
5
|
+
build: createBuildFunction({
|
|
6
|
+
cwd: import.meta.dirname,
|
|
7
|
+
// Also build `src/web.ts` for the web function, unless the project sets
|
|
8
|
+
// `<Infra.Api.WebFunction enabled={false} />`.
|
|
9
|
+
web: process.env.WEBINY_API_WEB_FUNCTION !== "false"
|
|
10
|
+
}),
|
|
6
11
|
watch: createWatchFunction({ cwd: import.meta.dirname })
|
|
7
12
|
}
|
|
8
13
|
};
|
|
@@ -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-
|
|
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-
|
|
15
|
+
} from "@webiny/api-composition-aws-ddb-os";
|
|
16
16
|
import { extensions } from "./extensions";
|
|
17
17
|
|
|
18
18
|
export const handler = createAwsDdbOsApiHandler({ extensions });
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Entry of the Lambda web function, built unless the project sets
|
|
3
|
+
* `<Infra.Api.WebFunction enabled={false} />`.
|
|
4
|
+
*
|
|
5
|
+
* Unlike `index.ts`, importing this module starts an HTTP server, so it is a separate entry and a
|
|
6
|
+
* separate bundle (`build-web/`), never part of `handler.mjs`. The web function serves the HTTP routes;
|
|
7
|
+
* every other invocation still goes to the regular `graphql` Lambda built from `index.ts`.
|
|
8
|
+
*/
|
|
9
|
+
import { startAwsDdbOsWebApi } from "@webiny/api-composition-aws-ddb-os";
|
|
10
|
+
import { extensions } from "./extensions";
|
|
11
|
+
|
|
12
|
+
startAwsDdbOsWebApi({ extensions }).catch(err => {
|
|
13
|
+
console.error("Failed to start the web API server.", err);
|
|
14
|
+
process.exit(1);
|
|
15
|
+
});
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* DI-native API GraphQL handler — Postgres variant.
|
|
3
|
+
*
|
|
4
|
+
* The composition root lives in @webiny/api-composition-aws-pg (`createAwsPgApiHandler`). The
|
|
5
|
+
* Postgres extension's ReplaceApiLambdaFnHandlers copies this file over the api workspace when
|
|
6
|
+
* `<Infra.AuroraPostgres />` is rendered. This file only supplies project-specific extensions.
|
|
7
|
+
*
|
|
8
|
+
* Exports both the buffered (API Gateway) and the response-streaming (Function URL) handler; see the
|
|
9
|
+
* DynamoDB variant of this file for why streaming needs its own Lambda function. The same bundle also
|
|
10
|
+
* answers the `WebinySqlSchemaSetup` event, which the api deploy sends to set the database schema up.
|
|
11
|
+
*/
|
|
12
|
+
import { createAwsPgApiHandler, createAwsPgStreamApiHandler } from "@webiny/api-composition-aws-pg";
|
|
13
|
+
import { extensions } from "./extensions";
|
|
14
|
+
|
|
15
|
+
export const handler = createAwsPgApiHandler({ extensions });
|
|
16
|
+
|
|
17
|
+
export const streamHandler = createAwsPgStreamApiHandler({ extensions });
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Entry of the Lambda web function, built unless the project sets
|
|
3
|
+
* `<Infra.Api.WebFunction enabled={false} />`.
|
|
4
|
+
*
|
|
5
|
+
* Unlike `index.ts`, importing this module starts an HTTP server, so it is a separate entry and a
|
|
6
|
+
* separate bundle (`build-web/`), never part of `handler.mjs`. The web function serves the HTTP routes;
|
|
7
|
+
* every other invocation still goes to the regular `graphql` Lambda built from `index.ts`.
|
|
8
|
+
*/
|
|
9
|
+
import { startAwsPgWebApi } from "@webiny/api-composition-aws-pg";
|
|
10
|
+
import { extensions } from "./extensions";
|
|
11
|
+
|
|
12
|
+
startAwsPgWebApi({ extensions }).catch(err => {
|
|
13
|
+
console.error("Failed to start the web API server.", err);
|
|
14
|
+
process.exit(1);
|
|
15
|
+
});
|
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
|
|
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:
|
|
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 {
|
|
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"}
|
package/apps/createApiApp.d.ts
CHANGED
|
@@ -13,6 +13,7 @@ export declare function createApiApp(): {
|
|
|
13
13
|
functions: {
|
|
14
14
|
download: import("@webiny/pulumi/PulumiAppResource").PulumiAppResource<typeof import("@pulumi/aws/lambda/function").Function>;
|
|
15
15
|
};
|
|
16
|
+
functionUrl: import("@webiny/pulumi/PulumiAppResource").PulumiAppResource<typeof import("@pulumi/aws/lambda/functionUrl").FunctionUrl> | null;
|
|
16
17
|
};
|
|
17
18
|
graphql: {
|
|
18
19
|
role: import("@webiny/pulumi/PulumiAppResource").PulumiAppResource<typeof import("@pulumi/aws/iam/role").Role>;
|
|
@@ -30,6 +31,15 @@ export declare function createApiApp(): {
|
|
|
30
31
|
functionUrl: import("@webiny/pulumi/PulumiAppResource").PulumiAppResource<typeof import("@pulumi/aws/lambda/functionUrl").FunctionUrl>;
|
|
31
32
|
functionUrlDomain: import("@pulumi/pulumi").Output<string>;
|
|
32
33
|
};
|
|
34
|
+
graphqlWeb: {
|
|
35
|
+
fn: import("@webiny/pulumi/PulumiAppResource").PulumiAppResource<typeof import("@pulumi/aws/lambdaweb/function").Function>;
|
|
36
|
+
revision: import("@webiny/pulumi/PulumiAppResource").PulumiAppResource<typeof import("@pulumi/aws/lambdaweb/functionRevision").FunctionRevision>;
|
|
37
|
+
endpoint: import("@webiny/pulumi/PulumiAppResource").PulumiAppResource<typeof import("@pulumi/aws/lambdaweb/functionEndpoint").FunctionEndpoint>;
|
|
38
|
+
codeBucket: import("@webiny/pulumi/PulumiAppResource").PulumiAppResource<typeof import("@pulumi/aws/s3/bucket").Bucket>;
|
|
39
|
+
logGroup: import("@webiny/pulumi/PulumiAppResource").PulumiAppResource<typeof import("@pulumi/aws/cloudwatch/logGroup").LogGroup>;
|
|
40
|
+
addRoute(routePath: string): void;
|
|
41
|
+
onRoute(listener: (routePath: string) => void): void;
|
|
42
|
+
} | undefined;
|
|
33
43
|
apiGateway: {
|
|
34
44
|
api: import("@webiny/pulumi/PulumiAppResource").PulumiAppResource<typeof import("@pulumi/aws/apigatewayv2/api").Api>;
|
|
35
45
|
stage: import("@webiny/pulumi/PulumiAppResource").PulumiAppResource<typeof import("@pulumi/aws/apigatewayv2/stage").Stage>;
|
|
@@ -39,7 +49,7 @@ export declare function createApiApp(): {
|
|
|
39
49
|
permission: import("@webiny/pulumi/PulumiAppResource").PulumiAppResource<typeof import("@pulumi/aws/lambda/permission").Permission>;
|
|
40
50
|
}>;
|
|
41
51
|
addRoute: (name: string, params: import("~/pulumi/index.js").ApiRouteParams) => void;
|
|
42
|
-
};
|
|
52
|
+
} | undefined;
|
|
43
53
|
websocket: {
|
|
44
54
|
websocketApi: import("@webiny/pulumi/PulumiAppResource").PulumiAppResource<typeof import("@pulumi/aws/apigatewayv2/api").Api>;
|
|
45
55
|
websocketApiStage: import("@webiny/pulumi/PulumiAppResource").PulumiAppResource<typeof import("@pulumi/aws/apigatewayv2/stage").Stage>;
|
|
@@ -66,5 +76,12 @@ export declare function createApiApp(): {
|
|
|
66
76
|
invokePolicy: import("@webiny/pulumi/PulumiAppResource").PulumiAppResource<typeof import("@pulumi/aws/iam/rolePolicy").RolePolicy>;
|
|
67
77
|
policyAttachment: import("@webiny/pulumi/PulumiAppResource").PulumiAppResource<typeof import("@pulumi/aws/iam/rolePolicyAttachment").RolePolicyAttachment>;
|
|
68
78
|
};
|
|
79
|
+
schemaSetup: {
|
|
80
|
+
secretPolicy: import("@webiny/pulumi/PulumiAppResource").PulumiAppResource<typeof import("@pulumi/aws/iam/rolePolicy").RolePolicy>;
|
|
81
|
+
functions: {
|
|
82
|
+
schemaSetup: import("@webiny/pulumi/PulumiAppResource").PulumiAppResource<typeof import("@pulumi/aws/lambda/function").Function>;
|
|
83
|
+
};
|
|
84
|
+
invocation: import("@webiny/pulumi/PulumiAppResource").PulumiAppResource<typeof import("@pulumi/aws/lambda/invocation").Invocation>;
|
|
85
|
+
} | null;
|
|
69
86
|
}> & import("../pulumi/utils/lambdaEnvVariables").WithCommonLambdaEnvVariables & import("../pulumi/utils/withServiceManifest").WithServiceManifest>;
|
|
70
87
|
};
|
package/apps/createCoreApp.d.ts
CHANGED
|
@@ -6,7 +6,7 @@ export declare function createCoreApp(): {
|
|
|
6
6
|
getPulumi(): Promise<import("@webiny/pulumi/types").PulumiApp<{
|
|
7
7
|
userPool: import("@webiny/pulumi/PulumiAppResource").PulumiAppResource<typeof import("@pulumi/aws/cognito/userPool").UserPool>;
|
|
8
8
|
userPoolClient: import("@webiny/pulumi/PulumiAppResource").PulumiAppResource<typeof import("@pulumi/aws/cognito/userPoolClient").UserPoolClient>;
|
|
9
|
-
dynamoDbTable: import("@webiny/pulumi/PulumiAppResource").PulumiAppResource<typeof import("@pulumi/aws/dynamodb/table").Table
|
|
9
|
+
dynamoDbTable: import("@webiny/pulumi/PulumiAppResource").PulumiAppResource<typeof import("@pulumi/aws/dynamodb/table").Table> | undefined;
|
|
10
10
|
vpc: {
|
|
11
11
|
vpc: import("@webiny/pulumi/PulumiAppResource").PulumiAppResource<typeof import("@pulumi/aws/ec2/vpc").Vpc>;
|
|
12
12
|
subnets: {
|
|
@@ -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(
|
|
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 {
|
|
1
|
+
import { UiService } from "@webiny/project/abstractions/index.js";
|
|
2
2
|
import { GetPulumiService } from "../abstractions/services/GetPulumiService.js";
|
|
3
3
|
class GetPulumiServiceWithDownloadInfo {
|
|
4
|
-
constructor(
|
|
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
|
|
11
|
-
const
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
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 {
|
|
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"}
|
package/extensions/ApiRoute.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* What `Api.Route` renders in an AWS project, registered in `registerExtensionImplementations.ts`.
|
|
3
|
-
* It only adds the
|
|
3
|
+
* It only adds the route to the infrastructure (`RegisterRoutesPulumi`): a CloudFront behavior to
|
|
4
|
+
* the web function, or an API Gateway route when the web function is off. Validating the props and writing the
|
|
4
5
|
* route into `extensions.ts` stay with the shared definition in `@webiny/project`, which is the one
|
|
5
6
|
* the project config resolves `Api/Route` to, so there is no schema or build step here.
|
|
6
7
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"extensions/ApiRoute.js","sources":["../../src/extensions/ApiRoute.tsx"],"sourcesContent":["import React from \"react\";\nimport { defineExtension } from \"@webiny/project/defineExtension/index.js\";\nimport { ApiRoute as SharedApiRoute } from \"@webiny/project/extensions/api/index.js\";\nimport { ApiPulumi } from \"~/pulumi/extensions/ApiPulumi.js\";\nimport { createPathResolver } from \"@webiny/project\";\n\nconst p = createPathResolver(import.meta.dirname);\n\n/**\n * What `Api.Route` renders in an AWS project, registered in `registerExtensionImplementations.ts`.\n * It only adds the
|
|
1
|
+
{"version":3,"file":"extensions/ApiRoute.js","sources":["../../src/extensions/ApiRoute.tsx"],"sourcesContent":["import React from \"react\";\nimport { defineExtension } from \"@webiny/project/defineExtension/index.js\";\nimport { ApiRoute as SharedApiRoute } from \"@webiny/project/extensions/api/index.js\";\nimport { ApiPulumi } from \"~/pulumi/extensions/ApiPulumi.js\";\nimport { createPathResolver } from \"@webiny/project\";\n\nconst p = createPathResolver(import.meta.dirname);\n\n/**\n * What `Api.Route` renders in an AWS project, registered in `registerExtensionImplementations.ts`.\n * It only adds the route to the infrastructure (`RegisterRoutesPulumi`): a CloudFront behavior to\n * the web function, or an API Gateway route when the web function is off. Validating the props and writing the\n * route into `extensions.ts` stay with the shared definition in `@webiny/project`, which is the one\n * the project config resolves `Api/Route` to, so there is no schema or build step here.\n */\nexport const ApiRoute = defineExtension({\n type: SharedApiRoute.def.type,\n tags: { runtimeContext: \"app-build\", hosting: \"aws\" },\n multiple: true,\n render() {\n return <ApiPulumi src={p(\"RegisterRoutesPulumi.js\")} />;\n }\n});\n"],"names":["p","createPathResolver","ApiRoute","defineExtension","SharedApiRoute","ApiPulumi"],"mappings":";;;;;AAMA,MAAMA,IAAIC,mBAAmB,YAAY,OAAO;AASzC,MAAMC,oBAAWC,gBAAgB;IACpC,MAAMC,SAAAA,GAAAA,CAAAA,IAAuB;IAC7B,MAAM;QAAE,gBAAgB;QAAa,SAAS;IAAM;IACpD,UAAU;IACV;QACI,OAAO,WAAP,GAAO,oBAACC,WAASA;YAAC,KAAKL,EAAE;;IAC7B;AACJ"}
|
|
@@ -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>>;
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import react from "react";
|
|
2
|
+
import { defineExtension } from "@webiny/project/defineExtension/index.js";
|
|
3
|
+
import { CoreBeforeDeploy, auroraPostgresClusterParamsSchema } from "@webiny/project-extensions-aws/extensions/index.js";
|
|
4
|
+
import { createPathResolver } from "@webiny/project";
|
|
5
|
+
import { ApiAfterBuild, DatabaseSetup, ProjectDecorator } from "@webiny/project/extensions/index.js";
|
|
6
|
+
import { CorePulumi } from "../pulumi/extensions/CorePulumi.js";
|
|
7
|
+
const p = createPathResolver(import.meta.dirname, "Postgres");
|
|
8
|
+
const AuroraPostgresCluster = defineExtension({
|
|
9
|
+
type: "Infra/AuroraPostgresCluster",
|
|
10
|
+
tags: {
|
|
11
|
+
runtimeContext: "project",
|
|
12
|
+
hosting: "aws"
|
|
13
|
+
},
|
|
14
|
+
description: "The Aurora PostgreSQL Serverless v2 cluster the core app creates (internal).",
|
|
15
|
+
paramsSchema: auroraPostgresClusterParamsSchema,
|
|
16
|
+
render: ()=>/*#__PURE__*/ react.createElement(react.Fragment, null, /*#__PURE__*/ react.createElement(DatabaseSetup, {
|
|
17
|
+
setupName: "pg"
|
|
18
|
+
}), /*#__PURE__*/ react.createElement(CoreBeforeDeploy, {
|
|
19
|
+
src: p("ValidatePostgresBeforeCoreDeploy.js")
|
|
20
|
+
}), /*#__PURE__*/ react.createElement(CorePulumi, {
|
|
21
|
+
src: p("AddCorePostgres.js")
|
|
22
|
+
}), /*#__PURE__*/ react.createElement(ProjectDecorator, {
|
|
23
|
+
src: p("ReplaceApiLambdaFnHandlers.js")
|
|
24
|
+
}), /*#__PURE__*/ react.createElement(ApiAfterBuild, {
|
|
25
|
+
src: p("CopyPgModulesAfterApiBuild.js")
|
|
26
|
+
}))
|
|
27
|
+
});
|
|
28
|
+
export { AuroraPostgresCluster };
|
|
29
|
+
|
|
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"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { GetProjectConfigService } from "@webiny/project/abstractions/index.js";
|
|
2
|
+
import { CorePulumi } from "@webiny/project-extensions-aws/abstractions/features/pulumi/index.js";
|
|
3
|
+
import type { CorePulumiApp } from "../../pulumi/apps/core/createCorePulumiApp.js";
|
|
4
|
+
import { type PostgresNetwork } from "../../pulumi/apps/core/CorePostgres.js";
|
|
5
|
+
import type { VpcExtensionConfig } from "../../pulumi/apps/extensions/isVpcEnabled.js";
|
|
6
|
+
/**
|
|
7
|
+
* Where the database goes. With an existing VPC: the subnets and security groups of its
|
|
8
|
+
* `postgresVpcConfig`. Otherwise: the private subnets of the VPC the core app creates, and its
|
|
9
|
+
* default security group, which the API functions use too, so they reach the database without
|
|
10
|
+
* extra rules.
|
|
11
|
+
*
|
|
12
|
+
* `ValidatePostgresBeforeCoreDeploy` already stopped the deploy if neither exists; this throws
|
|
13
|
+
* for a Pulumi run that skipped the deploy hooks.
|
|
14
|
+
*/
|
|
15
|
+
export declare const getPostgresNetwork: (app: Pick<CorePulumiApp, "getModule">, vpcConfig: VpcExtensionConfig) => PostgresNetwork;
|
|
16
|
+
/**
|
|
17
|
+
* Adds the Postgres database (`CorePostgres`) to the core app, and the outputs the API app
|
|
18
|
+
* connects with. Rendered by `<Infra.AuroraPostgres />`.
|
|
19
|
+
*/
|
|
20
|
+
export declare class AddCorePostgresImpl implements CorePulumi.Interface {
|
|
21
|
+
private getProjectConfigService;
|
|
22
|
+
constructor(getProjectConfigService: GetProjectConfigService.Interface);
|
|
23
|
+
execute(app: CorePulumiApp): Promise<void>;
|
|
24
|
+
}
|
|
25
|
+
export declare const AddCorePostgres: typeof AddCorePostgresImpl & {
|
|
26
|
+
__abstraction: import("@webiny/di").Abstraction<import("@webiny/project-extensions-aws/abstractions").ICorePulumi>;
|
|
27
|
+
};
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import { GetProjectConfigService } from "@webiny/project/abstractions/index.js";
|
|
2
|
+
import { CorePulumi } from "@webiny/project-extensions-aws/abstractions/features/pulumi/index.js";
|
|
3
|
+
import { CoreVpc } from "../../pulumi/apps/core/CoreVpc.js";
|
|
4
|
+
import { CorePostgres } from "../../pulumi/apps/core/CorePostgres.js";
|
|
5
|
+
import { getPostgresConfigFromExtension } from "../../pulumi/apps/extensions/getPostgresConfigFromExtension.js";
|
|
6
|
+
import { getVpcConfigFromExtension } from "../../pulumi/apps/extensions/getVpcConfigFromExtension.js";
|
|
7
|
+
const getPostgresNetwork = (app, vpcConfig)=>{
|
|
8
|
+
if ("object" == typeof vpcConfig && vpcConfig.useExistingVpc) {
|
|
9
|
+
const postgresVpcConfig = vpcConfig.useExistingVpc.postgresVpcConfig;
|
|
10
|
+
if (!postgresVpcConfig) throw new Error("Cannot deploy Postgres into an existing VPC: `useExistingVpc` has no `postgresVpcConfig`.");
|
|
11
|
+
return {
|
|
12
|
+
subnetIds: postgresVpcConfig.subnetIds,
|
|
13
|
+
securityGroupIds: postgresVpcConfig.securityGroupIds
|
|
14
|
+
};
|
|
15
|
+
}
|
|
16
|
+
const vpc = app.getModule(CoreVpc, {
|
|
17
|
+
optional: true
|
|
18
|
+
});
|
|
19
|
+
if (!vpc) throw new Error("Cannot deploy Postgres without a VPC: add <Infra.Vpc enabled />.");
|
|
20
|
+
return {
|
|
21
|
+
subnetIds: vpc.subnets.private.map((subnet)=>subnet.output.id),
|
|
22
|
+
securityGroupIds: [
|
|
23
|
+
vpc.vpc.output.defaultSecurityGroupId
|
|
24
|
+
]
|
|
25
|
+
};
|
|
26
|
+
};
|
|
27
|
+
class AddCorePostgresImpl {
|
|
28
|
+
constructor(getProjectConfigService){
|
|
29
|
+
this.getProjectConfigService = getProjectConfigService;
|
|
30
|
+
}
|
|
31
|
+
async execute(app) {
|
|
32
|
+
const projectConfig = await this.getProjectConfigService.execute();
|
|
33
|
+
const postgres = getPostgresConfigFromExtension(projectConfig);
|
|
34
|
+
if (!postgres) return;
|
|
35
|
+
const network = getPostgresNetwork(app, getVpcConfigFromExtension(projectConfig));
|
|
36
|
+
const { outputs } = app.addModule(CorePostgres, {
|
|
37
|
+
...postgres,
|
|
38
|
+
network,
|
|
39
|
+
protect: app.env.isProduction
|
|
40
|
+
});
|
|
41
|
+
app.addOutputs(outputs);
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
const AddCorePostgres = CorePulumi.createImplementation({
|
|
45
|
+
implementation: AddCorePostgresImpl,
|
|
46
|
+
dependencies: [
|
|
47
|
+
GetProjectConfigService
|
|
48
|
+
]
|
|
49
|
+
});
|
|
50
|
+
export { AddCorePostgres, AddCorePostgresImpl, getPostgresNetwork };
|
|
51
|
+
|
|
52
|
+
//# sourceMappingURL=AddCorePostgres.js.map
|
|
@@ -0,0 +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 { 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"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { ApiAfterBuild, GetApp, UiService } from "@webiny/project/abstractions/index.js";
|
|
2
|
+
/**
|
|
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.
|
|
7
|
+
*/
|
|
8
|
+
export declare class CopyPgModulesAfterApiBuildImpl implements ApiAfterBuild.Interface {
|
|
9
|
+
private getApp;
|
|
10
|
+
private ui;
|
|
11
|
+
constructor(getApp: GetApp.Interface, ui: UiService.Interface);
|
|
12
|
+
execute(): Promise<void>;
|
|
13
|
+
}
|
|
14
|
+
export declare const CopyPgModulesAfterApiBuild: typeof CopyPgModulesAfterApiBuildImpl & {
|
|
15
|
+
__abstraction: import("@webiny/di").Abstraction<import("@webiny/project/abstractions/index.js").IApiAfterBuild>;
|
|
16
|
+
};
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import fs from "fs";
|
|
2
|
+
import path from "path";
|
|
3
|
+
import { ApiAfterBuild, GetApp, UiService } from "@webiny/project/abstractions/index.js";
|
|
4
|
+
import { copyPgRuntimeModules } from "./copyPgRuntimeModules.js";
|
|
5
|
+
import { RDS_CA_BUNDLE_FILE, RDS_CA_BUNDLE_SOURCE } from "./rdsCaBundle.js";
|
|
6
|
+
const BUILD_FOLDERS = [
|
|
7
|
+
"build",
|
|
8
|
+
"build-web"
|
|
9
|
+
];
|
|
10
|
+
const WEB_BUILD_FOLDER = "build-web";
|
|
11
|
+
class CopyPgModulesAfterApiBuildImpl {
|
|
12
|
+
constructor(getApp, ui){
|
|
13
|
+
this.getApp = getApp;
|
|
14
|
+
this.ui = ui;
|
|
15
|
+
}
|
|
16
|
+
async execute() {
|
|
17
|
+
const graphqlFolder = this.getApp.execute("api").paths.workspaceFolder.join("graphql");
|
|
18
|
+
for (const buildFolder of BUILD_FOLDERS){
|
|
19
|
+
const buildDir = graphqlFolder.join(buildFolder).toString();
|
|
20
|
+
if (!fs.existsSync(buildDir)) continue;
|
|
21
|
+
const { packages, files } = await copyPgRuntimeModules({
|
|
22
|
+
resolveFrom: graphqlFolder.toString(),
|
|
23
|
+
buildDir
|
|
24
|
+
});
|
|
25
|
+
this.ui.info("Copied knex and pg into the API's %s (%s package(s), %s file(s)).", buildFolder, packages.length, files);
|
|
26
|
+
if (buildFolder === WEB_BUILD_FOLDER) {
|
|
27
|
+
fs.copyFileSync(RDS_CA_BUNDLE_SOURCE, path.join(buildDir, RDS_CA_BUNDLE_FILE));
|
|
28
|
+
this.ui.info("Copied the RDS CA bundle into the API's %s.", buildFolder);
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
const CopyPgModulesAfterApiBuild = ApiAfterBuild.createImplementation({
|
|
34
|
+
implementation: CopyPgModulesAfterApiBuildImpl,
|
|
35
|
+
dependencies: [
|
|
36
|
+
GetApp,
|
|
37
|
+
UiService
|
|
38
|
+
]
|
|
39
|
+
});
|
|
40
|
+
export { CopyPgModulesAfterApiBuild, CopyPgModulesAfterApiBuildImpl };
|
|
41
|
+
|
|
42
|
+
//# sourceMappingURL=CopyPgModulesAfterApiBuild.js.map
|
|
@@ -0,0 +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.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"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { BuildAppWorkspaceService, GetApp, LoggerService } from "@webiny/project/abstractions/index.js";
|
|
2
|
+
/**
|
|
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
|
+
*/
|
|
7
|
+
declare class ReplaceApiLambdaFnHandlersDecorator implements BuildAppWorkspaceService.Interface {
|
|
8
|
+
private getApp;
|
|
9
|
+
private logger;
|
|
10
|
+
private decoratee;
|
|
11
|
+
constructor(getApp: GetApp.Interface, logger: LoggerService.Interface, decoratee: BuildAppWorkspaceService.Interface);
|
|
12
|
+
execute(appName: GetApp.AppName, options?: BuildAppWorkspaceService.Options): Promise<void>;
|
|
13
|
+
}
|
|
14
|
+
export declare const ReplaceApiLambdaFnHandlers: typeof ReplaceApiLambdaFnHandlersDecorator & {
|
|
15
|
+
__abstraction: import("@webiny/di").Abstraction<import("@webiny/project/abstractions/services/BuildAppWorkspaceService").IBuildAppWorkspaceService>;
|
|
16
|
+
};
|
|
17
|
+
export {};
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import path from "path";
|
|
2
|
+
import fs from "fs";
|
|
3
|
+
import { BuildAppWorkspaceService, GetApp, LoggerService } from "@webiny/project/abstractions/index.js";
|
|
4
|
+
import { getTemplatesFolderPath } from "../../utils/index.js";
|
|
5
|
+
class ReplaceApiLambdaFnHandlersDecorator {
|
|
6
|
+
constructor(getApp, logger, decoratee){
|
|
7
|
+
this.getApp = getApp;
|
|
8
|
+
this.logger = logger;
|
|
9
|
+
this.decoratee = decoratee;
|
|
10
|
+
}
|
|
11
|
+
async execute(appName, options = {}) {
|
|
12
|
+
const result = await this.decoratee.execute(appName, options);
|
|
13
|
+
if ("api" !== appName) return result;
|
|
14
|
+
const app = this.getApp.execute("api");
|
|
15
|
+
const handlersFolderPath = path.join(getTemplatesFolderPath(), "extensions", "Postgres", "api");
|
|
16
|
+
fs.cpSync(handlersFolderPath, app.paths.workspaceFolder.toString(), {
|
|
17
|
+
recursive: true,
|
|
18
|
+
force: true
|
|
19
|
+
});
|
|
20
|
+
this.logger.debug("Replaced API Lambda function handlers with Postgres versions.");
|
|
21
|
+
return result;
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
const ReplaceApiLambdaFnHandlers = BuildAppWorkspaceService.createDecorator({
|
|
25
|
+
decorator: ReplaceApiLambdaFnHandlersDecorator,
|
|
26
|
+
dependencies: [
|
|
27
|
+
GetApp,
|
|
28
|
+
LoggerService
|
|
29
|
+
]
|
|
30
|
+
});
|
|
31
|
+
export { ReplaceApiLambdaFnHandlers };
|
|
32
|
+
|
|
33
|
+
//# sourceMappingURL=ReplaceApiLambdaFnHandlers.js.map
|
|
@@ -0,0 +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.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"}
|