@webiny/project-aws 6.4.5-beta.0 → 6.6.0-alpha.0
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 +9 -79
- package/_templates/extensions/OpenSearch/api/graphql/src/index.ts +10 -93
- 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/createCoreApp.d.ts +13 -13
- package/extensions/ApiRoute.d.ts +4 -4
- package/extensions/ApiRoute.js +5 -34
- package/extensions/ApiRoute.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/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/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/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 -0
- package/infra.js +5 -2
- package/infra.js.map +1 -1
- package/package.json +17 -14
- package/pulumi/apps/admin/createAdminPulumiApp.d.ts +1 -1
- package/pulumi/apps/admin/createAdminPulumiApp.js +2 -2
- package/pulumi/apps/admin/createAdminPulumiApp.js.map +1 -1
- package/pulumi/apps/api/ApiOutput.js +1 -1
- package/pulumi/apps/api/ApiOutput.js.map +1 -1
- package/pulumi/apps/api/createApiPulumiApp.js +2 -2
- package/pulumi/apps/api/createApiPulumiApp.js.map +1 -1
- 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/CoreCognito.d.ts +0 -1
- package/pulumi/apps/core/CoreCognito.js +1 -4
- package/pulumi/apps/core/CoreCognito.js.map +1 -1
- package/pulumi/apps/core/CoreOpenSearch.d.ts +1 -1
- package/pulumi/apps/core/cognitoIdentityProviders/configure.js +1 -9
- package/pulumi/apps/core/cognitoIdentityProviders/configure.js.map +1 -1
- package/pulumi/apps/core/createCorePulumiApp.d.ts +13 -13
- package/pulumi/apps/core/createCorePulumiApp.js +3 -19
- package/pulumi/apps/core/createCorePulumiApp.js.map +1 -1
- package/pulumi/apps/core/webinyWatchCommand/handler.d.ts +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/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/index.d.ts +2 -2
- 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
|
@@ -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,11 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
import {
|
|
9
|
-
import { createFileManagerAco } from "@webiny/api-file-manager-aco";
|
|
10
|
-
import { createFileManagerS3, createAssetDelivery } from "@webiny/api-file-manager-s3";
|
|
11
|
-
import { createHeadlessCmsContext, createHeadlessCmsGraphQL } from "@webiny/api-headless-cms";
|
|
12
|
-
import { registerDynamoDbStorageOperations } from "@webiny/api-headless-cms-ddb";
|
|
13
|
-
import { createHcmsTasks } from "@webiny/api-headless-cms-tasks";
|
|
14
|
-
import { createAco } from "@webiny/api-aco";
|
|
15
|
-
import { createAcoHcmsContext } from "@webiny/api-headless-cms-aco";
|
|
16
|
-
import securityPlugins from "./security";
|
|
17
|
-
import { createWebsiteBuilder } from "@webiny/api-website-builder";
|
|
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
|
+
import { createAwsDdbApiHandler } from "@webiny/api-event-handler-aws-ddb";
|
|
32
9
|
import { extensions } from "./extensions";
|
|
33
10
|
|
|
34
|
-
const
|
|
35
|
-
|
|
36
|
-
const documentClient = getDocumentClient();
|
|
37
|
-
|
|
38
|
-
export const handler = createHandler({
|
|
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
|
-
});
|
|
11
|
+
export const handler = createAwsDdbApiHandler({ extensions });
|
|
@@ -1,95 +1,12 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
import {
|
|
10
|
-
import { createFileManagerAco } from "@webiny/api-file-manager-aco";
|
|
11
|
-
import { createAssetDelivery, createFileManagerS3 } from "@webiny/api-file-manager-s3";
|
|
12
|
-
import { createHeadlessCmsContext, createHeadlessCmsGraphQL } from "@webiny/api-headless-cms";
|
|
13
|
-
import { registerCmsOpenSearchStorageOperations } from "@webiny/api-headless-cms-ddb-es";
|
|
14
|
-
import { createHcmsTasks } from "@webiny/api-headless-cms-tasks-ddb-es";
|
|
15
|
-
import { createAco } from "@webiny/api-aco";
|
|
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
|
+
import { createAwsDdbOsApiHandler } from "@webiny/api-event-handler-aws-ddb-os";
|
|
33
10
|
import { extensions } from "./extensions";
|
|
34
11
|
|
|
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);
|
|
50
|
-
|
|
51
|
-
export const handler = createHandler({
|
|
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
|
-
});
|
|
12
|
+
export const handler = createAwsDdbOsApiHandler({ 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/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
|
@@ -2,14 +2,14 @@ import { z } from "zod";
|
|
|
2
2
|
export declare const ApiRoute: import("@webiny/project/extensions").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
|
@@ -19,16 +19,6 @@ const HTTP_METHODS = [
|
|
|
19
19
|
"OPTIONS",
|
|
20
20
|
"ANY"
|
|
21
21
|
];
|
|
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
22
|
const ApiRoute = defineExtension({
|
|
33
23
|
type: "Api/Route",
|
|
34
24
|
tags: {
|
|
@@ -62,37 +52,18 @@ const ApiRoute = defineExtension({
|
|
|
62
52
|
defaultImport: alias,
|
|
63
53
|
moduleSpecifier: importPath
|
|
64
54
|
});
|
|
65
|
-
const
|
|
66
|
-
if (!source.getImportDeclaration(
|
|
55
|
+
const registerExtensionPluginPath = "@webiny/handler/plugins/RegisterExtensionPlugin.js";
|
|
56
|
+
if (!source.getImportDeclaration(registerExtensionPluginPath)) {
|
|
67
57
|
const lastIdx = source.getImportDeclarations()[source.getImportDeclarations().length - 1].getChildIndex() + 1;
|
|
68
58
|
source.insertImportDeclaration(lastIdx, {
|
|
69
59
|
namedImports: [
|
|
70
|
-
"
|
|
60
|
+
"createRegisterExtensionPlugin"
|
|
71
61
|
],
|
|
72
|
-
moduleSpecifier:
|
|
62
|
+
moduleSpecifier: registerExtensionPluginPath
|
|
73
63
|
});
|
|
74
64
|
}
|
|
75
|
-
const handlerImportPath = "@webiny/handler";
|
|
76
|
-
const existingHandlerImport = source.getImportDeclaration(handlerImportPath);
|
|
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 {
|
|
85
|
-
const lastIdx = source.getImportDeclarations()[source.getImportDeclarations().length - 1].getChildIndex() + 1;
|
|
86
|
-
source.insertImportDeclaration(lastIdx, {
|
|
87
|
-
namedImports: requiredHandlerImports,
|
|
88
|
-
moduleSpecifier: handlerImportPath
|
|
89
|
-
});
|
|
90
|
-
}
|
|
91
|
-
const onMethod = METHOD_HANDLER[params.method];
|
|
92
|
-
const routePath = params.path;
|
|
93
65
|
const pluginsArray = source.getFirstDescendant((node)=>Node.isArrayLiteralExpression(node));
|
|
94
|
-
pluginsArray.addElement(`\
|
|
95
|
-
pluginsArray.addElement(`\ncreateRoute(({ ${onMethod}, context }) => {\n\t${onMethod}("${routePath}", async (request, reply) => {\n\t\tconst instance = context.container.resolveAll(Route).find(i => i instanceof ${alias})!;\n\t\treturn instance.execute(request, reply);\n\t});\n})`);
|
|
66
|
+
pluginsArray.addElement(`\ncreateRegisterExtensionPlugin(ctx => {\n\tregisterExtension(ctx.container, ${alias});\n})`);
|
|
96
67
|
await source.save();
|
|
97
68
|
},
|
|
98
69
|
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\";\n\nconst p = createPathResolver(import.meta.dirname);\n\nconst HTTP_METHODS = [\"DELETE\", \"GET\", \"HEAD\", \"PATCH\", \"POST\", \"PUT\", \"OPTIONS\", \"ANY\"] as const;\n\nexport const ApiRoute = defineExtension({\n type: \"Api/Route\",\n tags: { runtimeContext: \"app-build\", appName: \"api\" },\n description: \"Register a custom REST route on the API Gateway + GraphQL Lambda.\",\n multiple: true,\n paramsSchema: ({ project }) => {\n return z.object({\n path: z.string().startsWith(\"/\"),\n method: z.enum(HTTP_METHODS),\n // The `src` file must default-export an HttpRoute implementation\n // (HttpRoute.createImplementation from @webiny/event-handler-core), the same shape as\n // the framework's own routes (e.g. createCmsRoute). Its `method`/`path` must match the\n // `method`/`path` params here (used to configure the API Gateway route).\n src: zodSrcPath({ project }),\n routeName: z.string().optional()\n });\n },\n async build(params, ctx) {\n const extensionsTsFilePath = ctx.project.paths.workspaceFolder\n .join(\"apps\", \"api\", \"graphql\", \"src\", \"extensions.ts\")\n .toString();\n\n const absoluteSrcFilePath = ExtensionSrcResolver.resolvePath(params.src, ctx.project);\n\n // Stable alias to avoid naming conflicts across multiple routes.\n const hash = crypto.createHash(\"sha256\").update(params.src).digest(\"hex\");\n const alias = `ApiRoute_${hash.slice(-10)}`;\n\n const importPath = path\n .relative(path.dirname(extensionsTsFilePath), absoluteSrcFilePath)\n .replace(/\\.tsx?$/, \".js\");\n\n const tsProject = new Project();\n tsProject.addSourceFileAtPath(extensionsTsFilePath);\n const source = tsProject.getSourceFileOrThrow(extensionsTsFilePath);\n\n // Skip if the route handler is already registered.\n if (source.getImportDeclaration(importPath)) {\n return;\n }\n\n // Insert handler import after the last existing import.\n let insertIndex = 1;\n const importDeclarations = source.getImportDeclarations();\n if (importDeclarations.length) {\n insertIndex = importDeclarations[importDeclarations.length - 1].getChildIndex() + 1;\n }\n\n source.insertImportDeclaration(insertIndex, {\n defaultImport: alias,\n moduleSpecifier: importPath\n });\n\n // Ensure createRegisterExtensionPlugin import exists.\n const registerExtensionPluginPath = \"@webiny/handler/plugins/RegisterExtensionPlugin.js\";\n if (!source.getImportDeclaration(registerExtensionPluginPath)) {\n const lastIdx =\n source\n .getImportDeclarations()\n [source.getImportDeclarations().length - 1].getChildIndex() + 1;\n source.insertImportDeclaration(lastIdx, {\n namedImports: [\"createRegisterExtensionPlugin\"],\n moduleSpecifier: registerExtensionPluginPath\n });\n }\n\n const pluginsArray = source.getFirstDescendant(node =>\n Node.isArrayLiteralExpression(node)\n ) as ArrayLiteralExpression;\n\n // Register the route's HttpRoute implementation in the DI container. The DI HttpRouter\n // resolves every registered HttpRoute and dispatches by matching the request method/path\n // against each route's own `method`/`path` — no explicit route wiring needed.\n pluginsArray.addElement(\n `\\ncreateRegisterExtensionPlugin(ctx => {\\n\\tregisterExtension(ctx.container, ${alias});\\n})`\n );\n\n await source.save();\n },\n render() {\n return <ApiPulumi src={p(\"RegisterRoutesPulumi.js\")} />;\n }\n});\n"],"names":["p","createPathResolver","HTTP_METHODS","ApiRoute","defineExtension","project","z","zodSrcPath","params","ctx","extensionsTsFilePath","absoluteSrcFilePath","ExtensionSrcResolver","hash","crypto","alias","importPath","path","tsProject","Project","source","insertIndex","importDeclarations","registerExtensionPluginPath","lastIdx","pluginsArray","node","Node","ApiPulumi"],"mappings":";;;;;;;;;;AAWA,MAAMA,IAAIC,mBAAmB,YAAY,OAAO;AAEhD,MAAMC,eAAe;IAAC;IAAU;IAAO;IAAQ;IAAS;IAAQ;IAAO;IAAW;CAAM;AAEjF,MAAMC,WAAWC,gBAAgB;IACpC,MAAM;IACN,MAAM;QAAE,gBAAgB;QAAa,SAAS;IAAM;IACpD,aAAa;IACb,UAAU;IACV,cAAc,CAAC,EAAEC,OAAO,EAAE,GACfC,EAAE,MAAM,CAAC;YACZ,MAAMA,EAAE,MAAM,GAAG,UAAU,CAAC;YAC5B,QAAQA,CAAC,CAADA,OAAM,CAACJ;YAKf,KAAKK,WAAW;gBAAEF;YAAQ;YAC1B,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;QAEA,MAAME,eAAeL,OAAO,kBAAkB,CAACM,CAAAA,OAC3CC,KAAK,wBAAwB,CAACD;QAMlCD,aAAa,UAAU,CACnB,CAAC,6EAA6E,EAAEV,MAAM,MAAM,CAAC;QAGjG,MAAMK,OAAO,IAAI;IACrB;IACA;QACI,OAAO,WAAP,GAAO,oBAACQ,WAASA;YAAC,KAAK5B,EAAE;;IAC7B;AACJ"}
|
|
@@ -1,9 +1,10 @@
|
|
|
1
|
-
import { BuildAppWorkspaceService, GetApp, LoggerService } from "@webiny/project/abstractions/index.js";
|
|
1
|
+
import { BuildAppWorkspaceService, GetApp, LoggerService, ProjectSdkParamsService } from "@webiny/project/abstractions/index.js";
|
|
2
2
|
declare class BuildAppWorkspaceImpl implements BuildAppWorkspaceService.Interface {
|
|
3
3
|
private getApp;
|
|
4
4
|
private logger;
|
|
5
|
+
private projectSdkParamsService;
|
|
5
6
|
private decoratee;
|
|
6
|
-
constructor(getApp: GetApp.Interface, logger: LoggerService.Interface, decoratee: BuildAppWorkspaceService.Interface);
|
|
7
|
+
constructor(getApp: GetApp.Interface, logger: LoggerService.Interface, projectSdkParamsService: ProjectSdkParamsService.Interface, decoratee: BuildAppWorkspaceService.Interface);
|
|
7
8
|
execute(appName: GetApp.AppName, options?: BuildAppWorkspaceService.Options): Promise<void>;
|
|
8
9
|
}
|
|
9
10
|
export declare const BuildAppWorkspace: typeof BuildAppWorkspaceImpl & {
|