@webiny/project-aws 6.4.11 → 6.6.0-alpha.1
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 +3 -11
- package/_templates/appTemplates/api/graphql/src/index.ts +19 -78
- package/_templates/extensions/OpenSearch/api/graphql/src/index.ts +17 -92
- package/_templates/extensions/OpenSearch/coreDdbToEsHandler/dynamoToElastic/src/index.ts +19 -12
- package/abstractions/ApiGqlClient.js +1 -1
- package/abstractions/ApiGqlClient.js.map +1 -1
- package/abstractions/InvokeLambdaFunction.js +1 -1
- package/abstractions/InvokeLambdaFunction.js.map +1 -1
- package/admin.d.ts +6 -0
- package/admin.js +4 -2
- package/admin.js.map +1 -1
- package/api.d.ts +4 -4
- package/apps/createAdminApp.d.ts +1 -1
- package/apps/createApiApp.d.ts +8 -0
- package/apps/createCoreApp.d.ts +13 -13
- package/extensions/ApiRoute.d.ts +5 -5
- package/extensions/ApiRoute.js +14 -30
- package/extensions/ApiRoute.js.map +1 -1
- package/extensions/ProjectAws/AutoInstall/AutoInstallAfterApiDeploy.d.ts +1 -1
- package/extensions/ProjectAws/AutoInstall/AutoInstallAfterApiDeploy.js +1 -2
- package/extensions/ProjectAws/AutoInstall/AutoInstallAfterApiDeploy.js.map +1 -1
- package/extensions/ProjectAws/BuildAppWorkspace.d.ts +3 -2
- package/extensions/ProjectAws/BuildAppWorkspace.js +38 -11
- package/extensions/ProjectAws/BuildAppWorkspace.js.map +1 -1
- package/extensions/ProjectAws/BuildProjectWorkspace.d.ts +12 -0
- package/extensions/ProjectAws/BuildProjectWorkspace.js +30 -0
- package/extensions/ProjectAws/BuildProjectWorkspace.js.map +1 -0
- package/extensions/ProjectAws/EnsureApiDeployedBeforeAdminBuild.d.ts +11 -0
- package/extensions/ProjectAws/EnsureApiDeployedBeforeAdminBuild.js +30 -0
- package/extensions/ProjectAws/EnsureApiDeployedBeforeAdminBuild.js.map +1 -0
- package/extensions/ProjectAws/EnsureApiDeployedBeforeAdminWatch.d.ts +11 -0
- package/extensions/ProjectAws/EnsureApiDeployedBeforeAdminWatch.js +30 -0
- package/extensions/ProjectAws/EnsureApiDeployedBeforeAdminWatch.js.map +1 -0
- package/extensions/ProjectAws/EnsureApiDeployedBeforeWatch.d.ts +11 -0
- package/extensions/ProjectAws/EnsureApiDeployedBeforeWatch.js +30 -0
- package/extensions/ProjectAws/EnsureApiDeployedBeforeWatch.js.map +1 -0
- package/extensions/ProjectAws/EnsureAwsCredentialsBeforeDeploy.js +1 -1
- package/extensions/ProjectAws/EnsureAwsCredentialsBeforeDeploy.js.map +1 -1
- package/extensions/ProjectAws/EnsureCoreDeployedBeforeApiDeploy.d.ts +11 -0
- package/extensions/ProjectAws/EnsureCoreDeployedBeforeApiDeploy.js +31 -0
- package/extensions/ProjectAws/EnsureCoreDeployedBeforeApiDeploy.js.map +1 -0
- package/extensions/ProjectAws/EnsureTelemetryEnabledForOss.d.ts +13 -0
- package/extensions/ProjectAws/EnsureTelemetryEnabledForOss.js +34 -0
- package/extensions/ProjectAws/EnsureTelemetryEnabledForOss.js.map +1 -0
- package/extensions/ProjectAws/SetAdminEnvVars/SetAdminEnvVars.js +1 -2
- package/extensions/ProjectAws/SetAdminEnvVars/SetAdminEnvVars.js.map +1 -1
- package/extensions/ProjectAws/TelemetryNoLongerNewUser.d.ts +8 -0
- package/extensions/ProjectAws/TelemetryNoLongerNewUser.js +14 -0
- package/extensions/ProjectAws/TelemetryNoLongerNewUser.js.map +1 -0
- package/extensions/ProjectAws/ValidateEncryptionBeforeDeploy.d.ts +12 -0
- package/extensions/ProjectAws/ValidateEncryptionBeforeDeploy.js +31 -0
- package/extensions/ProjectAws/ValidateEncryptionBeforeDeploy.js.map +1 -0
- package/extensions/ProjectAws/ValidateProductionPulumiState.d.ts +12 -0
- package/extensions/ProjectAws/ValidateProductionPulumiState.js +33 -0
- package/extensions/ProjectAws/ValidateProductionPulumiState.js.map +1 -0
- package/extensions/ProjectAws/definitions.js +1 -3
- package/extensions/ProjectAws/definitions.js.map +1 -1
- package/extensions/ProjectAws.js +18 -4
- package/extensions/ProjectAws.js.map +1 -1
- package/extensions/RegisterRoutesPulumi.js +2 -5
- package/extensions/RegisterRoutesPulumi.js.map +1 -1
- package/extensions/definitions.js +0 -2
- package/extensions/definitions.js.map +1 -1
- package/extensions/index.d.ts +0 -1
- package/extensions/index.js +0 -1
- package/extensions/routePath.d.ts +20 -0
- package/extensions/routePath.js +13 -0
- package/extensions/routePath.js.map +1 -0
- package/features/Watch/AwsWatch.d.ts +17 -0
- package/features/Watch/AwsWatch.js +108 -0
- package/features/Watch/AwsWatch.js.map +1 -0
- package/features/Watch/getIotEndpoint.d.ts +2 -0
- package/features/Watch/getIotEndpoint.js +18 -0
- package/features/Watch/getIotEndpoint.js.map +1 -0
- package/features/Watch/handler/handler.zip +0 -0
- package/features/Watch/replaceLambdaFunctions.d.ts +19 -0
- package/features/Watch/replaceLambdaFunctions.js +72 -0
- package/features/Watch/replaceLambdaFunctions.js.map +1 -0
- package/index.d.ts +1 -0
- package/index.js +1 -0
- package/infra.d.ts +15 -18
- package/infra.js +5 -2
- package/infra.js.map +1 -1
- package/package.json +20 -17
- package/project.d.ts +16 -11
- package/pulumi/apps/admin/createAdminPulumiApp.d.ts +1 -1
- package/pulumi/apps/admin/createAdminPulumiApp.js +4 -5
- package/pulumi/apps/admin/createAdminPulumiApp.js.map +1 -1
- package/pulumi/apps/api/ApiCloudfront.js +103 -1
- package/pulumi/apps/api/ApiCloudfront.js.map +1 -1
- package/pulumi/apps/api/ApiGraphqlStream.d.ts +29 -0
- package/pulumi/apps/api/ApiGraphqlStream.js +58 -0
- package/pulumi/apps/api/ApiGraphqlStream.js.map +1 -0
- package/pulumi/apps/api/ApiOutput.js +1 -1
- package/pulumi/apps/api/ApiOutput.js.map +1 -1
- package/pulumi/apps/api/createApiPulumiApp.d.ts +8 -0
- package/pulumi/apps/api/createApiPulumiApp.js +30 -24
- package/pulumi/apps/api/createApiPulumiApp.js.map +1 -1
- package/pulumi/apps/api/index.d.ts +1 -0
- package/pulumi/apps/api/index.js +1 -0
- package/pulumi/apps/awsUtils.d.ts +1 -1
- package/pulumi/apps/awsUtils.js +2 -2
- package/pulumi/apps/awsUtils.js.map +1 -1
- package/pulumi/apps/blueGreen/createBlueGreenPulumiApp.js +2 -2
- package/pulumi/apps/blueGreen/createBlueGreenPulumiApp.js.map +1 -1
- package/pulumi/apps/blueGreen/domains/getApplicationDomains.js +1 -1
- package/pulumi/apps/blueGreen/domains/getApplicationDomains.js.map +1 -1
- package/pulumi/apps/common/CoreOutput.js +2 -2
- package/pulumi/apps/common/CoreOutput.js.map +1 -1
- package/pulumi/apps/core/CoreOpenSearch.d.ts +1 -1
- package/pulumi/apps/core/createCorePulumiApp.d.ts +13 -13
- package/pulumi/apps/core/createCorePulumiApp.js +5 -5
- package/pulumi/apps/core/createCorePulumiApp.js.map +1 -1
- package/pulumi/apps/core/webinyWatchCommand/handler.d.ts +1 -1
- package/pulumi/apps/customDomain.d.ts +0 -15
- package/pulumi/apps/customDomain.js +2 -14
- package/pulumi/apps/customDomain.js.map +1 -1
- package/pulumi/apps/extensions/getVpcConfigFromExtension.d.ts +4 -4
- package/pulumi/apps/react/createReactPulumiApp.d.ts +1 -1
- package/pulumi/apps/react/createReactPulumiApp.js +2 -2
- package/pulumi/apps/react/createReactPulumiApp.js.map +1 -1
- package/pulumi/apps/syncSystem/SyncSystemLambda.d.ts +1 -1
- package/pulumi/apps/syncSystem/SyncSystemLambda.js +1 -1
- package/pulumi/apps/syncSystem/SyncSystemLambda.js.map +1 -1
- package/pulumi/apps/syncSystem/createSyncSystemPulumiApp.js +2 -2
- package/pulumi/apps/syncSystem/createSyncSystemPulumiApp.js.map +1 -1
- package/pulumi/apps/syncSystem/getSyncSystemOutput.d.ts +1 -1
- package/pulumi/apps/syncSystem/getSyncSystemOutput.js +1 -1
- package/pulumi/apps/syncSystem/getSyncSystemOutput.js.map +1 -1
- package/pulumi/extensions/AdminCustomDomains.d.ts +0 -9
- package/pulumi/extensions/AdminCustomDomains.js +1 -3
- package/pulumi/extensions/AdminCustomDomains.js.map +1 -1
- package/pulumi/extensions/ApiCustomDomains.d.ts +0 -9
- package/pulumi/extensions/ApiCustomDomains.js +1 -3
- package/pulumi/extensions/ApiCustomDomains.js.map +1 -1
- package/pulumi/extensions/index.d.ts +16 -25
- package/pulumi/getAwsProjectSdk.d.ts +12 -0
- package/pulumi/getAwsProjectSdk.js +6 -0
- package/pulumi/getAwsProjectSdk.js.map +1 -0
- package/pulumi/getStackOutput.d.ts +7 -0
- package/pulumi/getStackOutput.js +8 -0
- package/pulumi/getStackOutput.js.map +1 -0
- package/pulumi/utils/lambdaEnvVariables.js +4 -16
- package/pulumi/utils/lambdaEnvVariables.js.map +1 -1
- package/registerAwsProjectFeatures.d.ts +8 -0
- package/registerAwsProjectFeatures.js +55 -0
- package/registerAwsProjectFeatures.js.map +1 -0
- package/services/GetPulumiService/GetPulumiService.d.ts +9 -0
- package/services/GetPulumiService/GetPulumiService.js +44 -0
- package/services/GetPulumiService/GetPulumiService.js.map +1 -0
- package/utils/getPulumiBaseTemplatesFolderPath.d.ts +1 -0
- package/utils/getPulumiBaseTemplatesFolderPath.js +10 -0
- package/utils/getPulumiBaseTemplatesFolderPath.js.map +1 -0
- package/utils/index.d.ts +1 -0
- package/utils/index.js +1 -0
- package/_templates/appTemplates/api/graphql/src/security.ts +0 -43
- package/extensions/Encryption.d.ts +0 -10
- package/extensions/Encryption.js +0 -36
- package/extensions/Encryption.js.map +0 -1
- package/pulumi/apps/extensions/isVpcEnabled.d.ts +0 -14
- package/pulumi/apps/extensions/isVpcEnabled.js +0 -8
- package/pulumi/apps/extensions/isVpcEnabled.js.map +0 -1
|
@@ -4,24 +4,18 @@
|
|
|
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
9
|
"@webiny/api-aco": "latest",
|
|
8
10
|
"@webiny/api-audit-logs": "latest",
|
|
9
|
-
"@webiny/api-background-tasks-ddb": "latest",
|
|
10
|
-
"@webiny/api-background-tasks-os": "latest",
|
|
11
11
|
"@webiny/api-core": "latest",
|
|
12
|
-
"@webiny/api-core-ddb": "latest",
|
|
13
|
-
"@webiny/api-dynamodb-to-elasticsearch": "latest",
|
|
14
|
-
"@webiny/api-opensearch": "latest",
|
|
15
12
|
"@webiny/api-file-manager": "latest",
|
|
16
13
|
"@webiny/api-file-manager-aco": "latest",
|
|
17
14
|
"@webiny/api-file-manager-s3": "latest",
|
|
18
15
|
"@webiny/api-headless-cms": "latest",
|
|
19
16
|
"@webiny/api-headless-cms-aco": "latest",
|
|
20
|
-
"@webiny/api-headless-cms-ddb": "latest",
|
|
21
|
-
"@webiny/api-headless-cms-ddb-es": "latest",
|
|
22
17
|
"@webiny/api-headless-cms-scheduler": "latest",
|
|
23
18
|
"@webiny/api-headless-cms-tasks": "latest",
|
|
24
|
-
"@webiny/api-headless-cms-tasks-ddb-es": "latest",
|
|
25
19
|
"@webiny/api-headless-cms-workflows": "latest",
|
|
26
20
|
"@webiny/api-mailer": "latest",
|
|
27
21
|
"@webiny/api-record-locking": "latest",
|
|
@@ -34,8 +28,6 @@
|
|
|
34
28
|
"@webiny/aws-sdk": "latest",
|
|
35
29
|
"@webiny/build-tools": "latest",
|
|
36
30
|
"@webiny/db-dynamodb": "latest",
|
|
37
|
-
"@webiny/
|
|
38
|
-
"@webiny/handler-db": "latest",
|
|
39
|
-
"@webiny/handler-graphql": "latest"
|
|
31
|
+
"@webiny/api-graphql": "latest"
|
|
40
32
|
}
|
|
41
33
|
}
|
|
@@ -1,81 +1,22 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
import {
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
import { createAuditLogs } from "@webiny/api-audit-logs";
|
|
19
|
-
import { createBackgroundTasks } from "@webiny/api-background-tasks-ddb";
|
|
20
|
-
import { createWebsockets } from "@webiny/api-websockets";
|
|
21
|
-
import { createRecordLocking } from "@webiny/api-record-locking";
|
|
22
|
-
import { createHeadlessCmsScheduler } from "@webiny/api-headless-cms-scheduler";
|
|
23
|
-
import { createScheduler } from "@webiny/api-scheduler";
|
|
24
|
-
import { createSchedulerClient } from "@webiny/aws-sdk/client-scheduler/index.js";
|
|
25
|
-
import { createMailerContext, createMailerGraphQL } from "@webiny/api-mailer";
|
|
26
|
-
import { createWorkflows } from "@webiny/api-workflows";
|
|
27
|
-
import { createHeadlessCmsWorkflows } from "@webiny/api-headless-cms-workflows";
|
|
28
|
-
import { createWebsiteBuilderWorkflows } from "@webiny/api-website-builder-workflows";
|
|
29
|
-
import { createWebsiteBuilderScheduler } from "@webiny/api-website-builder-scheduler";
|
|
30
|
-
import { createWebhooks } from "@webiny/webhooks/api";
|
|
31
|
-
|
|
1
|
+
/**
|
|
2
|
+
* DI-native API GraphQL handler (DynamoDB storage).
|
|
3
|
+
*
|
|
4
|
+
* The composition root lives in @webiny/api-event-handler-aws-ddb (`createAwsDdbApiHandler`) so the wiring
|
|
5
|
+
* is a real, testable package rather than template code. This file only supplies project-specific
|
|
6
|
+
* extensions.
|
|
7
|
+
*
|
|
8
|
+
* Two handlers are exported from this one bundle and deployed as two Lambda functions:
|
|
9
|
+
* - `handler` — behind API Gateway, buffered responses. Everything except streaming routes.
|
|
10
|
+
* - `streamHandler` — behind a Lambda Function URL with `InvokeMode: RESPONSE_STREAM`, for routes that
|
|
11
|
+
* stream (e.g. `/stream/*`). A separate function is required because a Lambda's handler entry is
|
|
12
|
+
* fixed per function, and API Gateway buffers the whole response so it cannot stream at all.
|
|
13
|
+
*/
|
|
14
|
+
import {
|
|
15
|
+
createAwsDdbApiHandler,
|
|
16
|
+
createAwsDdbStreamApiHandler
|
|
17
|
+
} from "@webiny/api-event-handler-aws-ddb";
|
|
32
18
|
import { extensions } from "./extensions";
|
|
33
19
|
|
|
34
|
-
const
|
|
35
|
-
|
|
36
|
-
const documentClient = getDocumentClient();
|
|
20
|
+
export const handler = createAwsDdbApiHandler({ extensions });
|
|
37
21
|
|
|
38
|
-
export const
|
|
39
|
-
plugins: [
|
|
40
|
-
createApiCore({
|
|
41
|
-
storageOperations: createApiCoreDdb({ documentClient })
|
|
42
|
-
}),
|
|
43
|
-
graphqlPlugins({ debug }),
|
|
44
|
-
dbPlugins({
|
|
45
|
-
table: process.env.DB_TABLE,
|
|
46
|
-
driver: new DynamoDbDriver({ documentClient })
|
|
47
|
-
}),
|
|
48
|
-
securityPlugins(),
|
|
49
|
-
createWebsockets(),
|
|
50
|
-
registerDynamoDbStorageOperations(),
|
|
51
|
-
createHeadlessCmsContext(),
|
|
52
|
-
createHeadlessCmsGraphQL(),
|
|
53
|
-
createMailerContext(),
|
|
54
|
-
createMailerGraphQL(),
|
|
55
|
-
createWebsiteBuilder(),
|
|
56
|
-
createRecordLocking(),
|
|
57
|
-
createBackgroundTasks(),
|
|
58
|
-
createFileManagerContext(),
|
|
59
|
-
createFileManagerGraphQL(),
|
|
60
|
-
createFileManagerAco(),
|
|
61
|
-
createAssetDelivery(),
|
|
62
|
-
createFileManagerS3(),
|
|
63
|
-
createAco({ documentClient }),
|
|
64
|
-
createWorkflows(),
|
|
65
|
-
createHeadlessCmsWorkflows(),
|
|
66
|
-
createWebsiteBuilderWorkflows(),
|
|
67
|
-
createAuditLogs(),
|
|
68
|
-
createAcoHcmsContext(),
|
|
69
|
-
createHcmsTasks(),
|
|
70
|
-
createScheduler({
|
|
71
|
-
getClient: config => {
|
|
72
|
-
return createSchedulerClient(config);
|
|
73
|
-
}
|
|
74
|
-
}),
|
|
75
|
-
createHeadlessCmsScheduler(),
|
|
76
|
-
createWebsiteBuilderScheduler(),
|
|
77
|
-
createWebhooks(),
|
|
78
|
-
extensions()
|
|
79
|
-
],
|
|
80
|
-
debug
|
|
81
|
-
});
|
|
22
|
+
export const streamHandler = createAwsDdbStreamApiHandler({ extensions });
|
|
@@ -1,95 +1,20 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
import {
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
import { createAcoHcmsContext } from "@webiny/api-headless-cms-aco";
|
|
17
|
-
import securityPlugins from "./security.js";
|
|
18
|
-
import { createWebsiteBuilder } from "@webiny/api-website-builder";
|
|
19
|
-
import { createAuditLogs } from "@webiny/api-audit-logs";
|
|
20
|
-
import { createBackgroundTasks } from "@webiny/api-background-tasks-os";
|
|
21
|
-
import { createWebsockets } from "@webiny/api-websockets";
|
|
22
|
-
import { createRecordLocking } from "@webiny/api-record-locking";
|
|
23
|
-
import { createSchedulerClient } from "@webiny/aws-sdk/client-scheduler/index.js";
|
|
24
|
-
import { createScheduler } from "@webiny/api-scheduler";
|
|
25
|
-
import { createHeadlessCmsScheduler } from "@webiny/api-headless-cms-scheduler";
|
|
26
|
-
import { createMailerContext, createMailerGraphQL } from "@webiny/api-mailer";
|
|
27
|
-
import { createWorkflows } from "@webiny/api-workflows";
|
|
28
|
-
import { createHeadlessCmsWorkflows } from "@webiny/api-headless-cms-workflows";
|
|
29
|
-
import { createWebsiteBuilderWorkflows } from "@webiny/api-website-builder-workflows";
|
|
30
|
-
import { createWebsiteBuilderScheduler } from "@webiny/api-website-builder-scheduler";
|
|
31
|
-
import { createWebhooks } from "@webiny/webhooks/api";
|
|
32
|
-
|
|
1
|
+
/**
|
|
2
|
+
* DI-native API GraphQL handler — OpenSearch (DDB+ES) variant.
|
|
3
|
+
*
|
|
4
|
+
* The composition root lives in @webiny/api-event-handler-aws-ddb-os (`createAwsDdbOsApiHandler`) so the
|
|
5
|
+
* wiring is a real, testable package rather than template code. The OpenSearch extension's
|
|
6
|
+
* ReplaceApiLambdaFnHandlers copies this file over the api workspace when OpenSearch is enabled.
|
|
7
|
+
* This file only supplies project-specific extensions.
|
|
8
|
+
*
|
|
9
|
+
* Exports both the buffered (API Gateway) and the response-streaming (Function URL) handler; see the
|
|
10
|
+
* DynamoDB variant of this file for why streaming needs its own Lambda function.
|
|
11
|
+
*/
|
|
12
|
+
import {
|
|
13
|
+
createAwsDdbOsApiHandler,
|
|
14
|
+
createAwsDdbOsStreamApiHandler
|
|
15
|
+
} from "@webiny/api-event-handler-aws-ddb-os";
|
|
33
16
|
import { extensions } from "./extensions";
|
|
34
17
|
|
|
35
|
-
const
|
|
36
|
-
|
|
37
|
-
const documentClient = getDocumentClient();
|
|
38
|
-
|
|
39
|
-
const osUsername = process.env.OPENSEARCH_USERNAME;
|
|
40
|
-
const osPassword = process.env.OPENSEARCH_PASSWORD;
|
|
41
|
-
|
|
42
|
-
const openSearchClientOptions: Parameters<typeof createOpenSearchClient>[0] = {
|
|
43
|
-
endpoint: `https://${process.env.OPENSEARCH_ENDPOINT}`
|
|
44
|
-
};
|
|
45
|
-
if (osUsername && osPassword) {
|
|
46
|
-
openSearchClientOptions.auth = { username: osUsername, password: osPassword };
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
const openSearchClient = createOpenSearchClient(openSearchClientOptions);
|
|
18
|
+
export const handler = createAwsDdbOsApiHandler({ extensions });
|
|
50
19
|
|
|
51
|
-
export const
|
|
52
|
-
plugins: [
|
|
53
|
-
createApiCore({
|
|
54
|
-
storageOperations: createApiCoreDdb({ documentClient })
|
|
55
|
-
}),
|
|
56
|
-
graphqlPlugins({ debug }),
|
|
57
|
-
createOpenSearchContext(openSearchClient),
|
|
58
|
-
dbPlugins({
|
|
59
|
-
table: process.env.DB_TABLE,
|
|
60
|
-
driver: new DynamoDbDriver({ documentClient })
|
|
61
|
-
}),
|
|
62
|
-
securityPlugins(),
|
|
63
|
-
createWebsockets(),
|
|
64
|
-
registerCmsOpenSearchStorageOperations(),
|
|
65
|
-
createHeadlessCmsContext(),
|
|
66
|
-
createHeadlessCmsGraphQL(),
|
|
67
|
-
createMailerContext(),
|
|
68
|
-
createMailerGraphQL(),
|
|
69
|
-
createWebsiteBuilder(),
|
|
70
|
-
createRecordLocking(),
|
|
71
|
-
createBackgroundTasks(),
|
|
72
|
-
createFileManagerContext(),
|
|
73
|
-
createFileManagerGraphQL(),
|
|
74
|
-
createFileManagerAco(),
|
|
75
|
-
createAssetDelivery(),
|
|
76
|
-
createFileManagerS3(),
|
|
77
|
-
createAco({ documentClient }),
|
|
78
|
-
createWorkflows(),
|
|
79
|
-
createHeadlessCmsWorkflows(),
|
|
80
|
-
createWebsiteBuilderWorkflows(),
|
|
81
|
-
createAuditLogs(),
|
|
82
|
-
createAcoHcmsContext(),
|
|
83
|
-
createHcmsTasks(),
|
|
84
|
-
createScheduler({
|
|
85
|
-
getClient: config => {
|
|
86
|
-
return createSchedulerClient(config);
|
|
87
|
-
}
|
|
88
|
-
}),
|
|
89
|
-
createHeadlessCmsScheduler(),
|
|
90
|
-
createWebsiteBuilderScheduler(),
|
|
91
|
-
createWebhooks(),
|
|
92
|
-
extensions()
|
|
93
|
-
],
|
|
94
|
-
debug
|
|
95
|
-
});
|
|
20
|
+
export const streamHandler = createAwsDdbOsStreamApiHandler({ extensions });
|
|
@@ -1,22 +1,29 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
/**
|
|
2
|
+
* DI-native DynamoDB -> OpenSearch stream handler (core app, OpenSearch setup).
|
|
3
|
+
*
|
|
4
|
+
* Triggered by the core table's DynamoDB stream (EventSourceMapping) and syncs records into
|
|
5
|
+
* OpenSearch. `createDdbToOpenSearchStreamHandler` wires DdbToOpenSearchHandler + OpenSearchClient +
|
|
6
|
+
* compression in its own DI container, so this entry only builds the OpenSearch client.
|
|
7
|
+
*/
|
|
8
|
+
import { type OpenSearchClientOptions } from "@webiny/api-opensearch";
|
|
9
|
+
import { createAwsOpenSearchClient } from "@webiny/api-opensearch-aws";
|
|
10
|
+
import { createDdbToOpenSearchStreamHandler } from "@webiny/api-sync-ddb-to-opensearch";
|
|
4
11
|
|
|
5
12
|
const osUsername = process.env.OPENSEARCH_USERNAME;
|
|
6
13
|
const osPassword = process.env.OPENSEARCH_PASSWORD;
|
|
7
14
|
|
|
8
|
-
const clientOptions:
|
|
15
|
+
const clientOptions: OpenSearchClientOptions = {
|
|
9
16
|
endpoint: `https://${process.env.OPENSEARCH_ENDPOINT}`
|
|
10
17
|
};
|
|
18
|
+
|
|
19
|
+
// Basic auth for local / self-managed OpenSearch; when absent the client falls back to AWS SigV4.
|
|
11
20
|
if (osUsername && osPassword) {
|
|
12
|
-
clientOptions.auth = {
|
|
21
|
+
clientOptions.auth = {
|
|
22
|
+
username: osUsername,
|
|
23
|
+
password: osPassword
|
|
24
|
+
};
|
|
13
25
|
}
|
|
14
26
|
|
|
15
|
-
const client =
|
|
27
|
+
const client = createAwsOpenSearchClient(clientOptions);
|
|
16
28
|
|
|
17
|
-
export const handler =
|
|
18
|
-
plugins: [createOpenSearchContext(client), createEventHandler()],
|
|
19
|
-
options: {
|
|
20
|
-
bodyLimit: 536870912 // 512MB
|
|
21
|
-
}
|
|
22
|
-
});
|
|
29
|
+
export const handler = createDdbToOpenSearchStreamHandler(client);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"abstractions/ApiGqlClient.js","sources":["../../src/abstractions/ApiGqlClient.ts"],"sourcesContent":["import { createAbstraction } from \"@webiny/project/abstractions/createAbstraction\";\n\nexport interface IApiGqlClientResponse<T = any> {\n data?: T;\n errors?: Array<{\n message: string;\n code?: string;\n data?: any;\n }>;\n}\n\nexport interface IApiGqlClient {\n query<T = any>(params: {\n query: string;\n variables?: Record<string, any>;\n }): Promise<IApiGqlClientResponse<T>>;\n mutation<T = any>(params: {\n mutation: string;\n variables?: Record<string, any>;\n }): Promise<IApiGqlClientResponse<T>>;\n}\n\nexport const ApiGqlClient = createAbstraction<IApiGqlClient>(\"ApiGqlClient\");\n\nexport namespace ApiGqlClient {\n export type Interface = IApiGqlClient;\n export type Response<T = any> = IApiGqlClientResponse<T>;\n}\n"],"names":["ApiGqlClient","createAbstraction"],"mappings":";AAsBO,MAAMA,eAAeC,kBAAiC"}
|
|
1
|
+
{"version":3,"file":"abstractions/ApiGqlClient.js","sources":["../../src/abstractions/ApiGqlClient.ts"],"sourcesContent":["import { createAbstraction } from \"@webiny/project/abstractions/createAbstraction.js\";\n\nexport interface IApiGqlClientResponse<T = any> {\n data?: T;\n errors?: Array<{\n message: string;\n code?: string;\n data?: any;\n }>;\n}\n\nexport interface IApiGqlClient {\n query<T = any>(params: {\n query: string;\n variables?: Record<string, any>;\n }): Promise<IApiGqlClientResponse<T>>;\n mutation<T = any>(params: {\n mutation: string;\n variables?: Record<string, any>;\n }): Promise<IApiGqlClientResponse<T>>;\n}\n\nexport const ApiGqlClient = createAbstraction<IApiGqlClient>(\"ApiGqlClient\");\n\nexport namespace ApiGqlClient {\n export type Interface = IApiGqlClient;\n export type Response<T = any> = IApiGqlClientResponse<T>;\n}\n"],"names":["ApiGqlClient","createAbstraction"],"mappings":";AAsBO,MAAMA,eAAeC,kBAAiC"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { createAbstraction } from "@webiny/project/abstractions/createAbstraction";
|
|
1
|
+
import { createAbstraction } from "@webiny/project/abstractions/createAbstraction.js";
|
|
2
2
|
const InvokeLambdaFunction = createAbstraction("InvokeLambdaFunction");
|
|
3
3
|
export { InvokeLambdaFunction };
|
|
4
4
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"abstractions/InvokeLambdaFunction.js","sources":["../../src/abstractions/InvokeLambdaFunction.ts"],"sourcesContent":["import { createAbstraction } from \"@webiny/project/abstractions/createAbstraction\";\n\nexport interface IInvokeLambdaFunctionParams {\n functionName: string;\n payload: Record<string, any>;\n invocationType?: \"RequestResponse\" | \"Event\";\n}\n\nexport interface IInvokeLambdaFunctionResult<T = any> {\n statusCode?: number;\n payload: T;\n}\n\nexport interface IInvokeLambdaFunction {\n execute<T = any>(params: IInvokeLambdaFunctionParams): Promise<IInvokeLambdaFunctionResult<T>>;\n}\n\nexport const InvokeLambdaFunction =\n createAbstraction<IInvokeLambdaFunction>(\"InvokeLambdaFunction\");\n\nexport namespace InvokeLambdaFunction {\n export type Interface = IInvokeLambdaFunction;\n export type Params = IInvokeLambdaFunctionParams;\n export type Result<T = any> = IInvokeLambdaFunctionResult<T>;\n}\n"],"names":["InvokeLambdaFunction","createAbstraction"],"mappings":";AAiBO,MAAMA,uBACTC,kBAAyC"}
|
|
1
|
+
{"version":3,"file":"abstractions/InvokeLambdaFunction.js","sources":["../../src/abstractions/InvokeLambdaFunction.ts"],"sourcesContent":["import { createAbstraction } from \"@webiny/project/abstractions/createAbstraction.js\";\n\nexport interface IInvokeLambdaFunctionParams {\n functionName: string;\n payload: Record<string, any>;\n invocationType?: \"RequestResponse\" | \"Event\";\n}\n\nexport interface IInvokeLambdaFunctionResult<T = any> {\n statusCode?: number;\n payload: T;\n}\n\nexport interface IInvokeLambdaFunction {\n execute<T = any>(params: IInvokeLambdaFunctionParams): Promise<IInvokeLambdaFunctionResult<T>>;\n}\n\nexport const InvokeLambdaFunction =\n createAbstraction<IInvokeLambdaFunction>(\"InvokeLambdaFunction\");\n\nexport namespace InvokeLambdaFunction {\n export type Interface = IInvokeLambdaFunction;\n export type Params = IInvokeLambdaFunctionParams;\n export type Result<T = any> = IInvokeLambdaFunctionResult<T>;\n}\n"],"names":["InvokeLambdaFunction","createAbstraction"],"mappings":";AAiBO,MAAMA,uBACTC,kBAAyC"}
|
package/admin.d.ts
CHANGED
|
@@ -7,4 +7,10 @@ export declare const Admin: {
|
|
|
7
7
|
paramName: import("zod").ZodString;
|
|
8
8
|
value: import("zod").ZodUnion<readonly [import("zod").ZodString, import("zod").ZodRecord<import("zod").ZodString, import("zod").ZodAny>, import("zod").ZodArray<import("zod").ZodAny>, import("zod").ZodNumber, import("zod").ZodBoolean]>;
|
|
9
9
|
}, import("zod/v4/core").$strip>>;
|
|
10
|
+
ApiUrl: import("@webiny/project/defineExtension").ExtensionComponent<import("zod").ZodObject<{
|
|
11
|
+
url: import("zod").ZodString;
|
|
12
|
+
}, import("zod/v4/core").$strip>>;
|
|
13
|
+
WebsocketsUrl: import("@webiny/project/defineExtension").ExtensionComponent<import("zod").ZodObject<{
|
|
14
|
+
url: import("zod").ZodString;
|
|
15
|
+
}, import("zod/v4/core").$strip>>;
|
|
10
16
|
};
|
package/admin.js
CHANGED
|
@@ -1,7 +1,9 @@
|
|
|
1
|
-
import { AdminBuildParam, AdminExtension } from "@webiny/project/extensions/index.js";
|
|
1
|
+
import { AdminApiUrl, AdminBuildParam, AdminExtension, AdminWebsocketsUrl } from "@webiny/project/extensions/index.js";
|
|
2
2
|
const Admin = {
|
|
3
3
|
Extension: AdminExtension,
|
|
4
|
-
BuildParam: AdminBuildParam
|
|
4
|
+
BuildParam: AdminBuildParam,
|
|
5
|
+
ApiUrl: AdminApiUrl,
|
|
6
|
+
WebsocketsUrl: AdminWebsocketsUrl
|
|
5
7
|
};
|
|
6
8
|
export { Admin };
|
|
7
9
|
|
package/admin.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"admin.js","sources":["../src/admin.ts"],"sourcesContent":["import {
|
|
1
|
+
{"version":3,"file":"admin.js","sources":["../src/admin.ts"],"sourcesContent":["import {\n AdminExtension,\n AdminBuildParam,\n AdminApiUrl,\n AdminWebsocketsUrl\n} from \"@webiny/project/extensions/index.js\";\n\nexport const Admin = {\n Extension: AdminExtension,\n BuildParam: AdminBuildParam,\n ApiUrl: AdminApiUrl,\n WebsocketsUrl: AdminWebsocketsUrl\n};\n"],"names":["Admin","AdminExtension","AdminBuildParam","AdminApiUrl","AdminWebsocketsUrl"],"mappings":";AAOO,MAAMA,QAAQ;IACjB,WAAWC;IACX,YAAYC;IACZ,QAAQC;IACR,eAAeC;AACnB"}
|
package/api.d.ts
CHANGED
|
@@ -6,14 +6,14 @@ export declare const Api: {
|
|
|
6
6
|
Route: import("@webiny/project/defineExtension/defineExtension.js").ExtensionComponent<import("zod").ZodObject<{
|
|
7
7
|
path: import("zod").ZodString;
|
|
8
8
|
method: import("zod").ZodEnum<{
|
|
9
|
-
|
|
9
|
+
ANY: "ANY";
|
|
10
|
+
DELETE: "DELETE";
|
|
10
11
|
GET: "GET";
|
|
11
|
-
PUT: "PUT";
|
|
12
12
|
HEAD: "HEAD";
|
|
13
13
|
OPTIONS: "OPTIONS";
|
|
14
14
|
PATCH: "PATCH";
|
|
15
|
-
|
|
16
|
-
|
|
15
|
+
POST: "POST";
|
|
16
|
+
PUT: "PUT";
|
|
17
17
|
}>;
|
|
18
18
|
src: import("zod").ZodPipe<import("zod").ZodString, import("zod").ZodTransform<string, string>>;
|
|
19
19
|
routeName: import("zod").ZodOptional<import("zod").ZodString>;
|
package/apps/createAdminApp.d.ts
CHANGED
|
@@ -3,7 +3,6 @@ export declare function createAdminApp(): {
|
|
|
3
3
|
name: string;
|
|
4
4
|
description: string;
|
|
5
5
|
getPulumi(): Promise<import("@webiny/pulumi/types").PulumiApp<{
|
|
6
|
-
cloudfront: import("@webiny/pulumi/PulumiAppResource").PulumiAppResource<typeof import("@pulumi/aws/cloudfront/distribution").Distribution>;
|
|
7
6
|
bucket: import("@webiny/pulumi/PulumiAppResource").PulumiAppResource<typeof import("@pulumi/aws/s3/bucket").Bucket>;
|
|
8
7
|
bucketOwnershipControls: import("@webiny/pulumi/PulumiAppResource").PulumiAppResource<typeof import("@pulumi/aws/s3/bucketOwnershipControls").BucketOwnershipControls>;
|
|
9
8
|
bucketAcl: import("@webiny/pulumi/PulumiAppResource").PulumiAppResource<typeof import("@pulumi/aws/s3/bucketAcl").BucketAcl>;
|
|
@@ -11,5 +10,6 @@ export declare function createAdminApp(): {
|
|
|
11
10
|
origin: import("@pulumi/aws/types/input").cloudfront.DistributionOrigin;
|
|
12
11
|
bucketPublicAccessBlock: import("@webiny/pulumi/PulumiAppResource").PulumiAppResource<typeof import("@pulumi/aws/s3/bucketPublicAccessBlock").BucketPublicAccessBlock>;
|
|
13
12
|
bucketPolicy: import("@webiny/pulumi/PulumiAppResource").PulumiAppResource<typeof import("@pulumi/aws/s3/bucketPolicy").BucketPolicy>;
|
|
13
|
+
cloudfront: import("@webiny/pulumi/PulumiAppResource").PulumiAppResource<typeof import("@pulumi/aws/cloudfront/distribution").Distribution>;
|
|
14
14
|
}> & import("../pulumi/utils/withServiceManifest").WithServiceManifest>;
|
|
15
15
|
};
|
package/apps/createApiApp.d.ts
CHANGED
|
@@ -22,6 +22,14 @@ export declare function createApiApp(): {
|
|
|
22
22
|
};
|
|
23
23
|
addRoute: (routeParams: import("~/pulumi/index.js").AddRouteParams) => any;
|
|
24
24
|
};
|
|
25
|
+
graphqlStream: {
|
|
26
|
+
role: import("@webiny/pulumi/PulumiAppResource").PulumiAppResource<typeof import("@pulumi/aws/iam/role").Role>;
|
|
27
|
+
functions: {
|
|
28
|
+
graphqlStream: import("@webiny/pulumi/PulumiAppResource").PulumiAppResource<typeof import("@pulumi/aws/lambda/function").Function>;
|
|
29
|
+
};
|
|
30
|
+
functionUrl: import("@webiny/pulumi/PulumiAppResource").PulumiAppResource<typeof import("@pulumi/aws/lambda/functionUrl").FunctionUrl>;
|
|
31
|
+
functionUrlDomain: import("@pulumi/pulumi").Output<string>;
|
|
32
|
+
};
|
|
25
33
|
apiGateway: {
|
|
26
34
|
api: import("@webiny/pulumi/PulumiAppResource").PulumiAppResource<typeof import("@pulumi/aws/apigatewayv2/api").Api>;
|
|
27
35
|
stage: import("@webiny/pulumi/PulumiAppResource").PulumiAppResource<typeof import("@pulumi/aws/apigatewayv2/stage").Stage>;
|
package/apps/createCoreApp.d.ts
CHANGED
|
@@ -4,19 +4,6 @@ export declare function createCoreApp(): {
|
|
|
4
4
|
name: string;
|
|
5
5
|
description: string;
|
|
6
6
|
getPulumi(): Promise<import("@webiny/pulumi/types").PulumiApp<{
|
|
7
|
-
fileManagerBucket: import("@webiny/pulumi/PulumiAppResource").PulumiAppResource<typeof import("@pulumi/aws/s3/bucket").Bucket>;
|
|
8
|
-
eventBus: import("@webiny/pulumi/PulumiAppResource").PulumiAppResource<typeof import("@pulumi/aws/cloudwatch/eventBus").EventBus>;
|
|
9
|
-
opensearch: {
|
|
10
|
-
domain: import("@webiny/pulumi/PulumiAppResource").PulumiAppResource<import("@webiny/pulumi/PulumiAppResource").PulumiAppResourceConstructor<import("@pulumi/aws/opensearch/domain").Domain, any>> | import("@webiny/pulumi/PulumiAppRemoteResource").PulumiAppRemoteResource<import("@pulumi/aws/opensearch").GetDomainResult>;
|
|
11
|
-
domainPolicy: import("@webiny/pulumi/PulumiAppResource").PulumiAppResource<typeof import("@pulumi/aws/opensearch/domainPolicy").DomainPolicy> | undefined;
|
|
12
|
-
table: import("@webiny/pulumi/PulumiAppResource").PulumiAppResource<typeof import("@pulumi/aws/dynamodb/table").Table>;
|
|
13
|
-
dynamoToElastic: {
|
|
14
|
-
role: import("@webiny/pulumi/PulumiAppResource").PulumiAppResource<typeof import("@pulumi/aws/iam/role").Role>;
|
|
15
|
-
policy: import("@webiny/pulumi/PulumiAppResource").PulumiAppResource<typeof import("@pulumi/aws/iam/policy").Policy>;
|
|
16
|
-
lambda: import("@webiny/pulumi/PulumiAppResource").PulumiAppResource<typeof import("@pulumi/aws/lambda/function").Function>;
|
|
17
|
-
eventSourceMapping: import("@webiny/pulumi/PulumiAppResource").PulumiAppResource<typeof import("@pulumi/aws/lambda/eventSourceMapping").EventSourceMapping>;
|
|
18
|
-
};
|
|
19
|
-
} | undefined;
|
|
20
7
|
userPool: import("@webiny/pulumi/PulumiAppResource").PulumiAppResource<typeof import("@pulumi/aws/cognito/userPool").UserPool>;
|
|
21
8
|
userPoolClient: import("@webiny/pulumi/PulumiAppResource").PulumiAppResource<typeof import("@pulumi/aws/cognito/userPoolClient").UserPoolClient>;
|
|
22
9
|
dynamoDbTable: import("@webiny/pulumi/PulumiAppResource").PulumiAppResource<typeof import("@pulumi/aws/dynamodb/table").Table>;
|
|
@@ -31,5 +18,18 @@ export declare function createCoreApp(): {
|
|
|
31
18
|
publicSubnets: import("@webiny/pulumi/PulumiAppResource").PulumiAppResource<typeof import("@pulumi/aws/ec2/routeTable").RouteTable>;
|
|
32
19
|
};
|
|
33
20
|
} | null;
|
|
21
|
+
fileManagerBucket: import("@webiny/pulumi/PulumiAppResource").PulumiAppResource<typeof import("@pulumi/aws/s3/bucket").Bucket>;
|
|
22
|
+
eventBus: import("@webiny/pulumi/PulumiAppResource").PulumiAppResource<typeof import("@pulumi/aws/cloudwatch/eventBus").EventBus>;
|
|
23
|
+
opensearch: {
|
|
24
|
+
domain: import("@webiny/pulumi/PulumiAppRemoteResource").PulumiAppRemoteResource<import("@pulumi/aws/opensearch").GetDomainResult> | import("@webiny/pulumi/PulumiAppResource").PulumiAppResource<import("@webiny/pulumi/PulumiAppResource").PulumiAppResourceConstructor<import("@pulumi/aws/opensearch/domain").Domain, any>>;
|
|
25
|
+
domainPolicy: import("@webiny/pulumi/PulumiAppResource").PulumiAppResource<typeof import("@pulumi/aws/opensearch/domainPolicy").DomainPolicy> | undefined;
|
|
26
|
+
table: import("@webiny/pulumi/PulumiAppResource").PulumiAppResource<typeof import("@pulumi/aws/dynamodb/table").Table>;
|
|
27
|
+
dynamoToElastic: {
|
|
28
|
+
role: import("@webiny/pulumi/PulumiAppResource").PulumiAppResource<typeof import("@pulumi/aws/iam/role").Role>;
|
|
29
|
+
policy: import("@webiny/pulumi/PulumiAppResource").PulumiAppResource<typeof import("@pulumi/aws/iam/policy").Policy>;
|
|
30
|
+
lambda: import("@webiny/pulumi/PulumiAppResource").PulumiAppResource<typeof import("@pulumi/aws/lambda/function").Function>;
|
|
31
|
+
eventSourceMapping: import("@webiny/pulumi/PulumiAppResource").PulumiAppResource<typeof import("@pulumi/aws/lambda/eventSourceMapping").EventSourceMapping>;
|
|
32
|
+
};
|
|
33
|
+
} | undefined;
|
|
34
34
|
}> & import("../pulumi/utils/withServiceManifest").WithServiceManifest>;
|
|
35
35
|
};
|
package/extensions/ApiRoute.d.ts
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
|
-
export declare const ApiRoute: import("@webiny/project/
|
|
2
|
+
export declare const ApiRoute: import("@webiny/project/defineExtension/defineExtension.js").ExtensionComponent<z.ZodObject<{
|
|
3
3
|
path: z.ZodString;
|
|
4
4
|
method: z.ZodEnum<{
|
|
5
|
-
|
|
5
|
+
ANY: "ANY";
|
|
6
|
+
DELETE: "DELETE";
|
|
6
7
|
GET: "GET";
|
|
7
|
-
PUT: "PUT";
|
|
8
8
|
HEAD: "HEAD";
|
|
9
9
|
OPTIONS: "OPTIONS";
|
|
10
10
|
PATCH: "PATCH";
|
|
11
|
-
|
|
12
|
-
|
|
11
|
+
POST: "POST";
|
|
12
|
+
PUT: "PUT";
|
|
13
13
|
}>;
|
|
14
14
|
src: z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>;
|
|
15
15
|
routeName: z.ZodOptional<z.ZodString>;
|
package/extensions/ApiRoute.js
CHANGED
|
@@ -8,6 +8,7 @@ import { zodSrcPath } from "@webiny/project/defineExtension/zodTypes/zodSrcPath.
|
|
|
8
8
|
import { ExtensionSrcResolver } from "@webiny/project/utils/index.js";
|
|
9
9
|
import { ApiPulumi } from "../pulumi/extensions/ApiPulumi.js";
|
|
10
10
|
import { createPathResolver } from "@webiny/project";
|
|
11
|
+
import { deriveRouteName, toRouterPath } from "./routePath.js";
|
|
11
12
|
const p = createPathResolver(import.meta.dirname);
|
|
12
13
|
const HTTP_METHODS = [
|
|
13
14
|
"DELETE",
|
|
@@ -19,16 +20,6 @@ const HTTP_METHODS = [
|
|
|
19
20
|
"OPTIONS",
|
|
20
21
|
"ANY"
|
|
21
22
|
];
|
|
22
|
-
const METHOD_HANDLER = {
|
|
23
|
-
DELETE: "onDelete",
|
|
24
|
-
GET: "onGet",
|
|
25
|
-
HEAD: "onHead",
|
|
26
|
-
PATCH: "onPatch",
|
|
27
|
-
POST: "onPost",
|
|
28
|
-
PUT: "onPut",
|
|
29
|
-
OPTIONS: "onOptions",
|
|
30
|
-
ANY: "onAll"
|
|
31
|
-
};
|
|
32
23
|
const ApiRoute = defineExtension({
|
|
33
24
|
type: "Api/Route",
|
|
34
25
|
tags: {
|
|
@@ -62,37 +53,30 @@ const ApiRoute = defineExtension({
|
|
|
62
53
|
defaultImport: alias,
|
|
63
54
|
moduleSpecifier: importPath
|
|
64
55
|
});
|
|
65
|
-
const
|
|
66
|
-
if (!source.getImportDeclaration(
|
|
56
|
+
const registerExtensionPluginPath = "@webiny/handler/plugins/RegisterExtensionPlugin.js";
|
|
57
|
+
if (!source.getImportDeclaration(registerExtensionPluginPath)) {
|
|
67
58
|
const lastIdx = source.getImportDeclarations()[source.getImportDeclarations().length - 1].getChildIndex() + 1;
|
|
68
59
|
source.insertImportDeclaration(lastIdx, {
|
|
69
60
|
namedImports: [
|
|
70
|
-
"
|
|
61
|
+
"createRegisterExtensionPlugin"
|
|
71
62
|
],
|
|
72
|
-
moduleSpecifier:
|
|
63
|
+
moduleSpecifier: registerExtensionPluginPath
|
|
73
64
|
});
|
|
74
65
|
}
|
|
75
|
-
const
|
|
76
|
-
|
|
77
|
-
const requiredHandlerImports = [
|
|
78
|
-
"createRoute",
|
|
79
|
-
"Route"
|
|
80
|
-
];
|
|
81
|
-
if (existingHandlerImport) {
|
|
82
|
-
const present = existingHandlerImport.getNamedImports().map((i)=>i.getName());
|
|
83
|
-
for (const name of requiredHandlerImports)if (!present.includes(name)) existingHandlerImport.addNamedImport(name);
|
|
84
|
-
} else {
|
|
66
|
+
const eventHandlerCorePath = "@webiny/event-handler-core";
|
|
67
|
+
if (!source.getImportDeclaration(eventHandlerCorePath)) {
|
|
85
68
|
const lastIdx = source.getImportDeclarations()[source.getImportDeclarations().length - 1].getChildIndex() + 1;
|
|
86
69
|
source.insertImportDeclaration(lastIdx, {
|
|
87
|
-
namedImports:
|
|
88
|
-
|
|
70
|
+
namedImports: [
|
|
71
|
+
"createHttpRouteDefinition"
|
|
72
|
+
],
|
|
73
|
+
moduleSpecifier: eventHandlerCorePath
|
|
89
74
|
});
|
|
90
75
|
}
|
|
91
|
-
const onMethod = METHOD_HANDLER[params.method];
|
|
92
|
-
const routePath = params.path;
|
|
93
76
|
const pluginsArray = source.getFirstDescendant((node)=>Node.isArrayLiteralExpression(node));
|
|
94
|
-
|
|
95
|
-
|
|
77
|
+
const routerPath = toRouterPath(params.path);
|
|
78
|
+
const routeName = params.routeName ?? deriveRouteName(params.path, params.method);
|
|
79
|
+
pluginsArray.addElement(`\ncreateRegisterExtensionPlugin(ctx => {\n\tctx.container.register(\n\t\tcreateHttpRouteDefinition({\n\t\t\tname: "${routeName}",\n\t\t\tmethod: "${params.method}",\n\t\t\tpath: "${routerPath}",\n\t\t\thandler: ${alias}\n\t\t})\n\t);\n})`);
|
|
96
80
|
await source.save();
|
|
97
81
|
},
|
|
98
82
|
render () {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"extensions/ApiRoute.js","sources":["../../src/extensions/ApiRoute.tsx"],"sourcesContent":["import React from \"react\";\nimport path from \"path\";\nimport crypto from \"crypto\";\nimport { z } from \"zod\";\nimport { Node, Project, ArrayLiteralExpression } from \"ts-morph\";\nimport { defineExtension } from \"@webiny/project/defineExtension/index.js\";\nimport { zodSrcPath } from \"@webiny/project/defineExtension/zodTypes/zodSrcPath.js\";\nimport { ExtensionSrcResolver } from \"@webiny/project/utils/index.js\";\nimport { ApiPulumi } from \"~/pulumi/extensions/ApiPulumi.js\";\nimport { createPathResolver } from \"@webiny/project\";\n\nconst p = createPathResolver(import.meta.dirname);\n\nconst HTTP_METHODS = [\"DELETE\", \"GET\", \"HEAD\", \"PATCH\", \"POST\", \"PUT\", \"OPTIONS\", \"ANY\"] as const;\n\
|
|
1
|
+
{"version":3,"file":"extensions/ApiRoute.js","sources":["../../src/extensions/ApiRoute.tsx"],"sourcesContent":["import React from \"react\";\nimport path from \"path\";\nimport crypto from \"crypto\";\nimport { z } from \"zod\";\nimport { Node, Project, ArrayLiteralExpression } from \"ts-morph\";\nimport { defineExtension } from \"@webiny/project/defineExtension/index.js\";\nimport { zodSrcPath } from \"@webiny/project/defineExtension/zodTypes/zodSrcPath.js\";\nimport { ExtensionSrcResolver } from \"@webiny/project/utils/index.js\";\nimport { ApiPulumi } from \"~/pulumi/extensions/ApiPulumi.js\";\nimport { createPathResolver } from \"@webiny/project\";\nimport { deriveRouteName, toRouterPath } from \"./routePath.js\";\n\nconst p = createPathResolver(import.meta.dirname);\n\nconst HTTP_METHODS = [\"DELETE\", \"GET\", \"HEAD\", \"PATCH\", \"POST\", \"PUT\", \"OPTIONS\", \"ANY\"] as const;\n\nexport const ApiRoute = defineExtension({\n type: \"Api/Route\",\n tags: { runtimeContext: \"app-build\", appName: \"api\" },\n description: \"Register a custom REST route on the API Gateway + GraphQL Lambda.\",\n multiple: true,\n paramsSchema: ({ project }) => {\n return z.object({\n // Path parameters may be written `{orderId}` (API Gateway) or `:orderId` (the DI\n // router). Both are accepted and converted per consumer — see `routePath.ts`.\n path: z.string().startsWith(\"/\"),\n method: z.enum(HTTP_METHODS),\n // The `src` file must default-export a route HANDLER — the result of\n // `HttpRouteHandler.createImplementation` from `@webiny/event-handler-core`. It does\n // NOT declare its own method/path: the `HttpRouteDefinition` the router matches on is\n // generated below from the props here, so the route the gateway forwards to and the\n // route the router matches cannot drift apart.\n src: zodSrcPath({ project }),\n // Doubles as the route's DI name, so a decorator on HttpRouteDefinition can pick this\n // route out by it. Derived from path + method when omitted, same as the Pulumi name.\n routeName: z.string().optional()\n });\n },\n async build(params, ctx) {\n const extensionsTsFilePath = ctx.project.paths.workspaceFolder\n .join(\"apps\", \"api\", \"graphql\", \"src\", \"extensions.ts\")\n .toString();\n\n const absoluteSrcFilePath = ExtensionSrcResolver.resolvePath(params.src, ctx.project);\n\n // Stable alias to avoid naming conflicts across multiple routes.\n const hash = crypto.createHash(\"sha256\").update(params.src).digest(\"hex\");\n const alias = `ApiRoute_${hash.slice(-10)}`;\n\n const importPath = path\n .relative(path.dirname(extensionsTsFilePath), absoluteSrcFilePath)\n .replace(/\\.tsx?$/, \".js\");\n\n const tsProject = new Project();\n tsProject.addSourceFileAtPath(extensionsTsFilePath);\n const source = tsProject.getSourceFileOrThrow(extensionsTsFilePath);\n\n // Skip if the route handler is already registered.\n if (source.getImportDeclaration(importPath)) {\n return;\n }\n\n // Insert handler import after the last existing import.\n let insertIndex = 1;\n const importDeclarations = source.getImportDeclarations();\n if (importDeclarations.length) {\n insertIndex = importDeclarations[importDeclarations.length - 1].getChildIndex() + 1;\n }\n\n source.insertImportDeclaration(insertIndex, {\n defaultImport: alias,\n moduleSpecifier: importPath\n });\n\n // Ensure createRegisterExtensionPlugin import exists.\n const registerExtensionPluginPath = \"@webiny/handler/plugins/RegisterExtensionPlugin.js\";\n if (!source.getImportDeclaration(registerExtensionPluginPath)) {\n const lastIdx =\n source\n .getImportDeclarations()\n [source.getImportDeclarations().length - 1].getChildIndex() + 1;\n source.insertImportDeclaration(lastIdx, {\n namedImports: [\"createRegisterExtensionPlugin\"],\n moduleSpecifier: registerExtensionPluginPath\n });\n }\n\n // Ensure createHttpRouteDefinition import exists.\n const eventHandlerCorePath = \"@webiny/event-handler-core\";\n if (!source.getImportDeclaration(eventHandlerCorePath)) {\n const lastIdx =\n source\n .getImportDeclarations()\n [source.getImportDeclarations().length - 1].getChildIndex() + 1;\n source.insertImportDeclaration(lastIdx, {\n namedImports: [\"createHttpRouteDefinition\"],\n moduleSpecifier: eventHandlerCorePath\n });\n }\n\n const pluginsArray = source.getFirstDescendant(node =>\n Node.isArrayLiteralExpression(node)\n ) as ArrayLiteralExpression;\n\n // Register an HttpRouteDefinition built from the props above. The router matches on\n // definitions and only then builds the handler, so registering the handler alone would\n // leave the route unreachable: it deploys, API Gateway forwards to the Lambda, and dispatch\n // finds nothing. The path is converted to the router's `:param` syntax.\n const routerPath = toRouterPath(params.path);\n const routeName = params.routeName ?? deriveRouteName(params.path, params.method);\n\n pluginsArray.addElement(\n `\\ncreateRegisterExtensionPlugin(ctx => {\\n\\tctx.container.register(\\n\\t\\tcreateHttpRouteDefinition({\\n\\t\\t\\tname: \"${routeName}\",\\n\\t\\t\\tmethod: \"${params.method}\",\\n\\t\\t\\tpath: \"${routerPath}\",\\n\\t\\t\\thandler: ${alias}\\n\\t\\t})\\n\\t);\\n})`\n );\n\n await source.save();\n },\n render() {\n return <ApiPulumi src={p(\"RegisterRoutesPulumi.js\")} />;\n }\n});\n"],"names":["p","createPathResolver","HTTP_METHODS","ApiRoute","defineExtension","project","z","zodSrcPath","params","ctx","extensionsTsFilePath","absoluteSrcFilePath","ExtensionSrcResolver","hash","crypto","alias","importPath","path","tsProject","Project","source","insertIndex","importDeclarations","registerExtensionPluginPath","lastIdx","eventHandlerCorePath","pluginsArray","node","Node","routerPath","toRouterPath","routeName","deriveRouteName","ApiPulumi"],"mappings":";;;;;;;;;;;AAYA,MAAMA,IAAIC,mBAAmB,YAAY,OAAO;AAEhD,MAAMC,eAAe;IAAC;IAAU;IAAO;IAAQ;IAAS;IAAQ;IAAO;IAAW;CAAM;AAEjF,MAAMC,WAAWC,gBAAgB;IACpC,MAAM;IACN,MAAM;QAAE,gBAAgB;QAAa,SAAS;IAAM;IACpD,aAAa;IACb,UAAU;IACV,cAAc,CAAC,EAAEC,OAAO,EAAE,GACfC,EAAE,MAAM,CAAC;YAGZ,MAAMA,EAAE,MAAM,GAAG,UAAU,CAAC;YAC5B,QAAQA,CAAC,CAADA,OAAM,CAACJ;YAMf,KAAKK,WAAW;gBAAEF;YAAQ;YAG1B,WAAWC,EAAE,MAAM,GAAG,QAAQ;QAClC;IAEJ,MAAM,OAAME,MAAM,EAAEC,GAAG;QACnB,MAAMC,uBAAuBD,IAAI,OAAO,CAAC,KAAK,CAAC,eAAe,CACzD,IAAI,CAAC,QAAQ,OAAO,WAAW,OAAO,iBACtC,QAAQ;QAEb,MAAME,sBAAsBC,qBAAqB,WAAW,CAACJ,OAAO,GAAG,EAAEC,IAAI,OAAO;QAGpF,MAAMI,OAAOC,SAAAA,UAAiB,CAAC,UAAU,MAAM,CAACN,OAAO,GAAG,EAAE,MAAM,CAAC;QACnE,MAAMO,QAAQ,CAAC,SAAS,EAAEF,KAAK,KAAK,CAAC,MAAM;QAE3C,MAAMG,aAAaC,KAAAA,QACN,CAACA,KAAK,OAAO,CAACP,uBAAuBC,qBAC7C,OAAO,CAAC,WAAW;QAExB,MAAMO,YAAY,IAAIC;QACtBD,UAAU,mBAAmB,CAACR;QAC9B,MAAMU,SAASF,UAAU,oBAAoB,CAACR;QAG9C,IAAIU,OAAO,oBAAoB,CAACJ,aAC5B;QAIJ,IAAIK,cAAc;QAClB,MAAMC,qBAAqBF,OAAO,qBAAqB;QACvD,IAAIE,mBAAmB,MAAM,EACzBD,cAAcC,kBAAkB,CAACA,mBAAmB,MAAM,GAAG,EAAE,CAAC,aAAa,KAAK;QAGtFF,OAAO,uBAAuB,CAACC,aAAa;YACxC,eAAeN;YACf,iBAAiBC;QACrB;QAGA,MAAMO,8BAA8B;QACpC,IAAI,CAACH,OAAO,oBAAoB,CAACG,8BAA8B;YAC3D,MAAMC,UACFJ,OACK,qBAAqB,EACtB,CAACA,OAAO,qBAAqB,GAAG,MAAM,GAAG,EAAE,CAAC,aAAa,KAAK;YACtEA,OAAO,uBAAuB,CAACI,SAAS;gBACpC,cAAc;oBAAC;iBAAgC;gBAC/C,iBAAiBD;YACrB;QACJ;QAGA,MAAME,uBAAuB;QAC7B,IAAI,CAACL,OAAO,oBAAoB,CAACK,uBAAuB;YACpD,MAAMD,UACFJ,OACK,qBAAqB,EACtB,CAACA,OAAO,qBAAqB,GAAG,MAAM,GAAG,EAAE,CAAC,aAAa,KAAK;YACtEA,OAAO,uBAAuB,CAACI,SAAS;gBACpC,cAAc;oBAAC;iBAA4B;gBAC3C,iBAAiBC;YACrB;QACJ;QAEA,MAAMC,eAAeN,OAAO,kBAAkB,CAACO,CAAAA,OAC3CC,KAAK,wBAAwB,CAACD;QAOlC,MAAME,aAAaC,aAAatB,OAAO,IAAI;QAC3C,MAAMuB,YAAYvB,OAAO,SAAS,IAAIwB,gBAAgBxB,OAAO,IAAI,EAAEA,OAAO,MAAM;QAEhFkB,aAAa,UAAU,CACnB,CAAC,mHAAmH,EAAEK,UAAU,mBAAmB,EAAEvB,OAAO,MAAM,CAAC,iBAAiB,EAAEqB,WAAW,mBAAmB,EAAEd,MAAM,kBAAkB,CAAC;QAGnP,MAAMK,OAAO,IAAI;IACrB;IACA;QACI,OAAO,WAAP,GAAO,oBAACa,WAASA;YAAC,KAAKjC,EAAE;;IAC7B;AACJ"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { ApiAfterDeploy } from "@webiny/project/abstractions/index.js";
|
|
2
2
|
import { UiService } from "@webiny/project/abstractions/services/UiService.js";
|
|
3
3
|
import { LoggerService } from "@webiny/project/abstractions/services/LoggerService.js";
|
|
4
|
-
import { GetProjectConfigService } from "@webiny/project/abstractions";
|
|
4
|
+
import { GetProjectConfigService } from "@webiny/project/abstractions/index.js";
|
|
5
5
|
import { ApiGqlClient } from "../../../abstractions/ApiGqlClient.js";
|
|
6
6
|
declare class AutoInstallAfterApiDeployImpl implements ApiAfterDeploy.Interface {
|
|
7
7
|
private apiGqlClient;
|