@webiny/api-headless-cms-bulk-actions-aws 6.6.0-alpha.12 → 6.6.0-alpha.13
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -1,15 +1,13 @@
|
|
|
1
1
|
import type { EventBridgeEvent } from "@webiny/aws-sdk/types/index.js";
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
constructor(tenantContext: TenantContext.Interface, taskService: TaskService.Interface);
|
|
10
|
-
execute(eventCtx: EventContext<EventBridgeEvent<string, any>>): Promise<EventBridgeResult>;
|
|
2
|
+
import { EventBridgeInputHandler, type EventBridgeResult } from "@webiny/api-kernel-aws/abstractions/handlers/EventBridgeInputHandler.js";
|
|
3
|
+
import { TenantScopes } from "@webiny/api-core/features/tenancy/TenantScopes/index.js";
|
|
4
|
+
import type { InputContext } from "@webiny/api-kernel-core";
|
|
5
|
+
declare class BulkActionsEventBridgeLambdaHandlerImpl implements EventBridgeInputHandler.Interface {
|
|
6
|
+
private readonly tenantScopes;
|
|
7
|
+
constructor(tenantScopes: TenantScopes.Interface);
|
|
8
|
+
execute(inputCtx: InputContext<EventBridgeEvent<string, any>>): Promise<EventBridgeResult>;
|
|
11
9
|
}
|
|
12
10
|
export declare const BulkActionsEventBridgeLambdaHandler: typeof BulkActionsEventBridgeLambdaHandlerImpl & {
|
|
13
|
-
__abstraction: import("@webiny/di").Abstraction<import("@webiny/
|
|
11
|
+
__abstraction: import("@webiny/di").Abstraction<import("@webiny/api-kernel-aws/abstractions/handlers/EventBridgeInputHandler.js").IEventBridgeInputHandler>;
|
|
14
12
|
};
|
|
15
13
|
export {};
|
|
@@ -1,18 +1,17 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { EventBridgeInputHandler } from "@webiny/api-kernel-aws/abstractions/handlers/EventBridgeInputHandler.js";
|
|
2
|
+
import { TenantScopes } from "@webiny/api-core/features/tenancy/TenantScopes/index.js";
|
|
3
3
|
import { TaskService } from "@webiny/api-core/features/task/TaskService/abstractions.js";
|
|
4
4
|
const DETAIL_TYPE = "WebinyEmptyTrashBin";
|
|
5
5
|
class BulkActionsEventBridgeLambdaHandlerImpl {
|
|
6
|
-
constructor(
|
|
7
|
-
this.
|
|
8
|
-
this.taskService = taskService;
|
|
6
|
+
constructor(tenantScopes){
|
|
7
|
+
this.tenantScopes = tenantScopes;
|
|
9
8
|
}
|
|
10
|
-
async execute(
|
|
11
|
-
if (
|
|
9
|
+
async execute(inputCtx) {
|
|
10
|
+
if (inputCtx.input["detail-type"] !== DETAIL_TYPE) return {
|
|
12
11
|
success: true,
|
|
13
12
|
message: "Not a bulk action event."
|
|
14
13
|
};
|
|
15
|
-
const result = await this.
|
|
14
|
+
const result = await this.tenantScopes.withRootTenant(async (scope)=>await scope.resolve(TaskService).trigger({
|
|
16
15
|
definition: "hcmsEntriesEmptyTrashBins"
|
|
17
16
|
}));
|
|
18
17
|
if (result.isFail()) return {
|
|
@@ -24,11 +23,10 @@ class BulkActionsEventBridgeLambdaHandlerImpl {
|
|
|
24
23
|
};
|
|
25
24
|
}
|
|
26
25
|
}
|
|
27
|
-
const BulkActionsEventBridgeLambdaHandler =
|
|
26
|
+
const BulkActionsEventBridgeLambdaHandler = EventBridgeInputHandler.createImplementation({
|
|
28
27
|
implementation: BulkActionsEventBridgeLambdaHandlerImpl,
|
|
29
28
|
dependencies: [
|
|
30
|
-
|
|
31
|
-
TaskService
|
|
29
|
+
TenantScopes
|
|
32
30
|
]
|
|
33
31
|
});
|
|
34
32
|
export { BulkActionsEventBridgeLambdaHandler };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BulkActionsEventBridgeLambdaHandler.js","sources":["../src/BulkActionsEventBridgeLambdaHandler.ts"],"sourcesContent":["import type { EventBridgeEvent } from \"@webiny/aws-sdk/types/index.js\";\nimport {\n
|
|
1
|
+
{"version":3,"file":"BulkActionsEventBridgeLambdaHandler.js","sources":["../src/BulkActionsEventBridgeLambdaHandler.ts"],"sourcesContent":["import type { EventBridgeEvent } from \"@webiny/aws-sdk/types/index.js\";\nimport {\n EventBridgeInputHandler,\n type EventBridgeResult\n} from \"@webiny/api-kernel-aws/abstractions/handlers/EventBridgeInputHandler.js\";\nimport { TenantScopes } from \"@webiny/api-core/features/tenancy/TenantScopes/index.js\";\nimport { TaskService } from \"@webiny/api-core/features/task/TaskService/abstractions.js\";\nimport type { InputContext } from \"@webiny/api-kernel-core\";\n\nconst DETAIL_TYPE = \"WebinyEmptyTrashBin\";\n\nclass BulkActionsEventBridgeLambdaHandlerImpl implements EventBridgeInputHandler.Interface {\n public constructor(private readonly tenantScopes: TenantScopes.Interface) {}\n\n public async execute(\n inputCtx: InputContext<EventBridgeEvent<string, any>>\n ): Promise<EventBridgeResult> {\n if (inputCtx.input[\"detail-type\"] !== DETAIL_TYPE) {\n return {\n success: true,\n message: \"Not a bulk action event.\"\n };\n }\n\n const result = await this.tenantScopes.withRootTenant(async scope => {\n return await scope.resolve(TaskService).trigger({\n definition: \"hcmsEntriesEmptyTrashBins\"\n });\n });\n if (result.isFail()) {\n return {\n success: false,\n message: result.error.message\n };\n }\n\n return { success: true };\n }\n}\n\nexport const BulkActionsEventBridgeLambdaHandler = EventBridgeInputHandler.createImplementation({\n implementation: BulkActionsEventBridgeLambdaHandlerImpl,\n dependencies: [TenantScopes]\n});\n"],"names":["DETAIL_TYPE","BulkActionsEventBridgeLambdaHandlerImpl","tenantScopes","inputCtx","result","scope","TaskService","BulkActionsEventBridgeLambdaHandler","EventBridgeInputHandler","TenantScopes"],"mappings":";;;AASA,MAAMA,cAAc;AAEpB,MAAMC;IACF,YAAoCC,YAAoC,CAAE;aAAtCA,YAAY,GAAZA;IAAuC;IAE3E,MAAa,QACTC,QAAqD,EAC3B;QAC1B,IAAIA,SAAS,KAAK,CAAC,cAAc,KAAKH,aAClC,OAAO;YACH,SAAS;YACT,SAAS;QACb;QAGJ,MAAMI,SAAS,MAAM,IAAI,CAAC,YAAY,CAAC,cAAc,CAAC,OAAMC,QACjD,MAAMA,MAAM,OAAO,CAACC,aAAa,OAAO,CAAC;gBAC5C,YAAY;YAChB;QAEJ,IAAIF,OAAO,MAAM,IACb,OAAO;YACH,SAAS;YACT,SAASA,OAAO,KAAK,CAAC,OAAO;QACjC;QAGJ,OAAO;YAAE,SAAS;QAAK;IAC3B;AACJ;AAEO,MAAMG,sCAAsCC,wBAAwB,oBAAoB,CAAC;IAC5F,gBAAgBP;IAChB,cAAc;QAACQ;KAAa;AAChC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@webiny/api-headless-cms-bulk-actions-aws",
|
|
3
|
-
"version": "6.6.0-alpha.
|
|
3
|
+
"version": "6.6.0-alpha.13",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"exports": {
|
|
6
6
|
".": "./index.js",
|
|
@@ -17,20 +17,20 @@
|
|
|
17
17
|
},
|
|
18
18
|
"license": "MIT",
|
|
19
19
|
"dependencies": {
|
|
20
|
-
"@webiny/aws
|
|
21
|
-
"@webiny/
|
|
22
|
-
"@webiny/
|
|
23
|
-
"@webiny/feature": "6.6.0-alpha.
|
|
20
|
+
"@webiny/api-kernel-aws": "6.6.0-alpha.13",
|
|
21
|
+
"@webiny/api-kernel-core": "6.6.0-alpha.13",
|
|
22
|
+
"@webiny/aws-sdk": "6.6.0-alpha.13",
|
|
23
|
+
"@webiny/feature": "6.6.0-alpha.13"
|
|
24
24
|
},
|
|
25
25
|
"peerDependencies": {
|
|
26
26
|
"@webiny/di": "^2.0.0"
|
|
27
27
|
},
|
|
28
28
|
"devDependencies": {
|
|
29
|
-
"@webiny/api-core": "6.6.0-alpha.
|
|
30
|
-
"@webiny/build-tools": "6.6.0-alpha.
|
|
29
|
+
"@webiny/api-core": "6.6.0-alpha.13",
|
|
30
|
+
"@webiny/build-tools": "6.6.0-alpha.13",
|
|
31
31
|
"@webiny/di": "2.0.0",
|
|
32
32
|
"typescript": "7.0.2",
|
|
33
|
-
"vitest": "5.
|
|
33
|
+
"vitest": "5.1.1"
|
|
34
34
|
},
|
|
35
35
|
"publishConfig": {
|
|
36
36
|
"access": "public"
|