@webiny/api-headless-cms-bulk-actions-standalone 0.0.0-unstable.0156a4c312

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.
@@ -0,0 +1,9 @@
1
+ import { Abstraction } from "@webiny/di";
2
+ import type { IEventHandler } from "@webiny/event-handler-core";
3
+ import type { IEmptyTrashBinsEvent } from "./EmptyTrashBinsEventType.js";
4
+ export interface IEmptyTrashBinsEventHandler extends IEventHandler<IEmptyTrashBinsEvent, void> {
5
+ }
6
+ export declare const EmptyTrashBinsEventHandler: Abstraction<IEmptyTrashBinsEventHandler>;
7
+ export declare namespace EmptyTrashBinsEventHandler {
8
+ type Interface = IEmptyTrashBinsEventHandler;
9
+ }
@@ -0,0 +1,5 @@
1
+ import { Abstraction } from "@webiny/di";
2
+ const EmptyTrashBinsEventHandler = new Abstraction("EmptyTrashBinsEventHandler");
3
+ export { EmptyTrashBinsEventHandler };
4
+
5
+ //# sourceMappingURL=EmptyTrashBinsEventHandler.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"EmptyTrashBinsEventHandler.js","sources":["../src/EmptyTrashBinsEventHandler.ts"],"sourcesContent":["import { Abstraction } from \"@webiny/di\";\nimport type { IEventHandler } from \"@webiny/event-handler-core\";\nimport type { IEmptyTrashBinsEvent } from \"./EmptyTrashBinsEventType.js\";\n\nexport interface IEmptyTrashBinsEventHandler extends IEventHandler<IEmptyTrashBinsEvent, void> {}\n\nexport const EmptyTrashBinsEventHandler = new Abstraction<IEmptyTrashBinsEventHandler>(\n \"EmptyTrashBinsEventHandler\"\n);\n\nexport namespace EmptyTrashBinsEventHandler {\n export type Interface = IEmptyTrashBinsEventHandler;\n}\n"],"names":["EmptyTrashBinsEventHandler","Abstraction"],"mappings":";AAMO,MAAMA,6BAA6B,IAAIC,YAC1C"}
@@ -0,0 +1,17 @@
1
+ import type { IEventType } from "@webiny/event-handler-core";
2
+ export declare const EMPTY_TRASH_BINS_EVENT_IDENTIFIER = "WebinyEmptyTrashBins";
3
+ /**
4
+ * Asks for the trash bins to be emptied. The standalone server dispatches it on a timer; AWS gets
5
+ * the same from an EventBridge rule (`WebinyEmptyTrashBin`).
6
+ */
7
+ export interface IEmptyTrashBinsEvent {
8
+ [EMPTY_TRASH_BINS_EVENT_IDENTIFIER]: true;
9
+ }
10
+ declare class EmptyTrashBinsEventTypeImpl implements IEventType<IEmptyTrashBinsEvent> {
11
+ canHandle(event: any): event is IEmptyTrashBinsEvent;
12
+ getHandlerAbstraction(): import("@webiny/di").Abstraction<import("./EmptyTrashBinsEventHandler.js").IEmptyTrashBinsEventHandler>;
13
+ }
14
+ export declare const EmptyTrashBinsEventType: typeof EmptyTrashBinsEventTypeImpl & {
15
+ __abstraction: import("@webiny/di").Abstraction<IEventType<any>>;
16
+ };
17
+ export {};
@@ -0,0 +1,18 @@
1
+ import { EventType } from "@webiny/event-handler-core";
2
+ import { EmptyTrashBinsEventHandler } from "./EmptyTrashBinsEventHandler.js";
3
+ const EMPTY_TRASH_BINS_EVENT_IDENTIFIER = "WebinyEmptyTrashBins";
4
+ class EmptyTrashBinsEventTypeImpl {
5
+ canHandle(event) {
6
+ return event?.[EMPTY_TRASH_BINS_EVENT_IDENTIFIER] === true;
7
+ }
8
+ getHandlerAbstraction() {
9
+ return EmptyTrashBinsEventHandler;
10
+ }
11
+ }
12
+ const EmptyTrashBinsEventType = EventType.createImplementation({
13
+ implementation: EmptyTrashBinsEventTypeImpl,
14
+ dependencies: []
15
+ });
16
+ export { EMPTY_TRASH_BINS_EVENT_IDENTIFIER, EmptyTrashBinsEventType };
17
+
18
+ //# sourceMappingURL=EmptyTrashBinsEventType.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"EmptyTrashBinsEventType.js","sources":["../src/EmptyTrashBinsEventType.ts"],"sourcesContent":["import { EventType } from \"@webiny/event-handler-core\";\nimport type { IEventType } from \"@webiny/event-handler-core\";\nimport { EmptyTrashBinsEventHandler } from \"./EmptyTrashBinsEventHandler.js\";\n\nexport const EMPTY_TRASH_BINS_EVENT_IDENTIFIER = \"WebinyEmptyTrashBins\";\n\n/**\n * Asks for the trash bins to be emptied. The standalone server dispatches it on a timer; AWS gets\n * the same from an EventBridge rule (`WebinyEmptyTrashBin`).\n */\nexport interface IEmptyTrashBinsEvent {\n [EMPTY_TRASH_BINS_EVENT_IDENTIFIER]: true;\n}\n\nclass EmptyTrashBinsEventTypeImpl implements IEventType<IEmptyTrashBinsEvent> {\n canHandle(event: any): event is IEmptyTrashBinsEvent {\n return event?.[EMPTY_TRASH_BINS_EVENT_IDENTIFIER] === true;\n }\n\n getHandlerAbstraction() {\n return EmptyTrashBinsEventHandler;\n }\n}\n\nexport const EmptyTrashBinsEventType = EventType.createImplementation({\n implementation: EmptyTrashBinsEventTypeImpl,\n dependencies: []\n});\n"],"names":["EMPTY_TRASH_BINS_EVENT_IDENTIFIER","EmptyTrashBinsEventTypeImpl","event","EmptyTrashBinsEventHandler","EmptyTrashBinsEventType","EventType"],"mappings":";;AAIO,MAAMA,oCAAoC;AAUjD,MAAMC;IACF,UAAUC,KAAU,EAAiC;QACjD,OAAOA,OAAO,CAACF,kCAAkC,KAAK;IAC1D;IAEA,wBAAwB;QACpB,OAAOG;IACX;AACJ;AAEO,MAAMC,0BAA0BC,UAAU,oBAAoB,CAAC;IAClE,gBAAgBJ;IAChB,cAAc,EAAE;AACpB"}
@@ -0,0 +1,8 @@
1
+ /**
2
+ * Lets the standalone server empty the trash bins by dispatching an `EmptyTrashBinsEvent`. Register
3
+ * at the root container.
4
+ */
5
+ export declare const EmptyTrashBinsFeature: {
6
+ name: string;
7
+ register(container: import("@webiny/di").Container): void;
8
+ };
@@ -0,0 +1,13 @@
1
+ import { createFeature } from "@webiny/feature/api";
2
+ import { EmptyTrashBinsEventType } from "./EmptyTrashBinsEventType.js";
3
+ import { TriggerEmptyTrashBinsHandler } from "./TriggerEmptyTrashBinsHandler.js";
4
+ const EmptyTrashBinsFeature = createFeature({
5
+ name: "BulkActions/EmptyTrashBins",
6
+ register: (container)=>{
7
+ container.register(EmptyTrashBinsEventType);
8
+ container.register(TriggerEmptyTrashBinsHandler);
9
+ }
10
+ });
11
+ export { EmptyTrashBinsFeature };
12
+
13
+ //# sourceMappingURL=EmptyTrashBinsFeature.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"EmptyTrashBinsFeature.js","sources":["../src/EmptyTrashBinsFeature.ts"],"sourcesContent":["import { createFeature } from \"@webiny/feature/api\";\nimport { EmptyTrashBinsEventType } from \"./EmptyTrashBinsEventType.js\";\nimport { TriggerEmptyTrashBinsHandler } from \"./TriggerEmptyTrashBinsHandler.js\";\n\n/**\n * Lets the standalone server empty the trash bins by dispatching an `EmptyTrashBinsEvent`. Register\n * at the root container.\n */\nexport const EmptyTrashBinsFeature = createFeature({\n name: \"BulkActions/EmptyTrashBins\",\n register: container => {\n container.register(EmptyTrashBinsEventType);\n container.register(TriggerEmptyTrashBinsHandler);\n }\n});\n"],"names":["EmptyTrashBinsFeature","createFeature","container","EmptyTrashBinsEventType","TriggerEmptyTrashBinsHandler"],"mappings":";;;AAQO,MAAMA,wBAAwBC,cAAc;IAC/C,MAAM;IACN,UAAUC,CAAAA;QACNA,UAAU,QAAQ,CAACC;QACnBD,UAAU,QAAQ,CAACE;IACvB;AACJ"}
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) Webiny
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,11 @@
1
+ # @webiny/api-headless-cms-bulk-actions-standalone
2
+
3
+ > [!NOTE]
4
+ > This package is part of the [Webiny](https://www.webiny.com) monorepo.
5
+ > It’s **included in every Webiny project by default** and is not meant to be used as a standalone package.
6
+
7
+ 📘 **Documentation:** [https://www.webiny.com/docs](https://www.webiny.com/docs)
8
+
9
+ ---
10
+
11
+ _This README file is automatically generated during the publish process._
@@ -0,0 +1,17 @@
1
+ import { TenantContext } from "@webiny/api-core/features/tenancy/TenantContext/index.js";
2
+ import { TaskService } from "@webiny/api-core/features/task/TaskService/abstractions.js";
3
+ import { EmptyTrashBinsEventHandler } from "./EmptyTrashBinsEventHandler.js";
4
+ /**
5
+ * Starts the task that empties the trash bins, as the root tenant. The task does the work; this
6
+ * only triggers it. Mirrors `BulkActionsEventBridgeLambdaHandler` on AWS.
7
+ */
8
+ declare class TriggerEmptyTrashBinsHandlerImpl implements EmptyTrashBinsEventHandler.Interface {
9
+ private readonly tenantContext;
10
+ private readonly taskService;
11
+ constructor(tenantContext: TenantContext.Interface, taskService: TaskService.Interface);
12
+ execute(): Promise<void>;
13
+ }
14
+ export declare const TriggerEmptyTrashBinsHandler: typeof TriggerEmptyTrashBinsHandlerImpl & {
15
+ __abstraction: import("@webiny/di").Abstraction<import("./EmptyTrashBinsEventHandler.js").IEmptyTrashBinsEventHandler>;
16
+ };
17
+ export {};
@@ -0,0 +1,26 @@
1
+ import { TenantContext } from "@webiny/api-core/features/tenancy/TenantContext/index.js";
2
+ import { TaskService } from "@webiny/api-core/features/task/TaskService/abstractions.js";
3
+ import { EmptyTrashBinsEventHandler } from "./EmptyTrashBinsEventHandler.js";
4
+ class TriggerEmptyTrashBinsHandlerImpl {
5
+ constructor(tenantContext, taskService){
6
+ this.tenantContext = tenantContext;
7
+ this.taskService = taskService;
8
+ }
9
+ async execute() {
10
+ await this.tenantContext.withRootTenant(async ()=>{
11
+ await this.taskService.trigger({
12
+ definition: "hcmsEntriesEmptyTrashBins"
13
+ });
14
+ });
15
+ }
16
+ }
17
+ const TriggerEmptyTrashBinsHandler = EmptyTrashBinsEventHandler.createImplementation({
18
+ implementation: TriggerEmptyTrashBinsHandlerImpl,
19
+ dependencies: [
20
+ TenantContext,
21
+ TaskService
22
+ ]
23
+ });
24
+ export { TriggerEmptyTrashBinsHandler };
25
+
26
+ //# sourceMappingURL=TriggerEmptyTrashBinsHandler.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"TriggerEmptyTrashBinsHandler.js","sources":["../src/TriggerEmptyTrashBinsHandler.ts"],"sourcesContent":["import { TenantContext } from \"@webiny/api-core/features/tenancy/TenantContext/index.js\";\nimport { TaskService } from \"@webiny/api-core/features/task/TaskService/abstractions.js\";\nimport { EmptyTrashBinsEventHandler } from \"./EmptyTrashBinsEventHandler.js\";\n\n/**\n * Starts the task that empties the trash bins, as the root tenant. The task does the work; this\n * only triggers it. Mirrors `BulkActionsEventBridgeLambdaHandler` on AWS.\n */\nclass TriggerEmptyTrashBinsHandlerImpl implements EmptyTrashBinsEventHandler.Interface {\n public constructor(\n private readonly tenantContext: TenantContext.Interface,\n private readonly taskService: TaskService.Interface\n ) {}\n\n public async execute(): Promise<void> {\n await this.tenantContext.withRootTenant(async () => {\n await this.taskService.trigger({ definition: \"hcmsEntriesEmptyTrashBins\" });\n });\n }\n}\n\nexport const TriggerEmptyTrashBinsHandler = EmptyTrashBinsEventHandler.createImplementation({\n implementation: TriggerEmptyTrashBinsHandlerImpl,\n dependencies: [TenantContext, TaskService]\n});\n"],"names":["TriggerEmptyTrashBinsHandlerImpl","tenantContext","taskService","TriggerEmptyTrashBinsHandler","EmptyTrashBinsEventHandler","TenantContext","TaskService"],"mappings":";;;AAQA,MAAMA;IACF,YACqBC,aAAsC,EACtCC,WAAkC,CACrD;aAFmBD,aAAa,GAAbA;aACAC,WAAW,GAAXA;IAClB;IAEH,MAAa,UAAyB;QAClC,MAAM,IAAI,CAAC,aAAa,CAAC,cAAc,CAAC;YACpC,MAAM,IAAI,CAAC,WAAW,CAAC,OAAO,CAAC;gBAAE,YAAY;YAA4B;QAC7E;IACJ;AACJ;AAEO,MAAMC,+BAA+BC,2BAA2B,oBAAoB,CAAC;IACxF,gBAAgBJ;IAChB,cAAc;QAACK;QAAeC;KAAY;AAC9C"}
package/index.d.ts ADDED
@@ -0,0 +1,3 @@
1
+ export { EmptyTrashBinsFeature } from "./EmptyTrashBinsFeature.js";
2
+ export { EMPTY_TRASH_BINS_EVENT_IDENTIFIER } from "./EmptyTrashBinsEventType.js";
3
+ export type { IEmptyTrashBinsEvent } from "./EmptyTrashBinsEventType.js";
package/index.js ADDED
@@ -0,0 +1,2 @@
1
+ export { EmptyTrashBinsFeature } from "./EmptyTrashBinsFeature.js";
2
+ export { EMPTY_TRASH_BINS_EVENT_IDENTIFIER } from "./EmptyTrashBinsEventType.js";
package/package.json ADDED
@@ -0,0 +1,39 @@
1
+ {
2
+ "name": "@webiny/api-headless-cms-bulk-actions-standalone",
3
+ "version": "0.0.0-unstable.0156a4c312",
4
+ "type": "module",
5
+ "exports": {
6
+ ".": "./index.js",
7
+ "./*": "./*"
8
+ },
9
+ "description": "Standalone-mode handler for Webiny Headless CMS bulk actions (empty trash bin)",
10
+ "keywords": [
11
+ "api-headless-cms-bulk-actions-server:base"
12
+ ],
13
+ "repository": {
14
+ "type": "git",
15
+ "url": "https://github.com/webiny/webiny-js.git",
16
+ "directory": "packages/api-headless-cms-bulk-actions-standalone"
17
+ },
18
+ "license": "MIT",
19
+ "dependencies": {
20
+ "@webiny/api-core": "0.0.0-unstable.0156a4c312",
21
+ "@webiny/event-handler-core": "0.0.0-unstable.0156a4c312",
22
+ "@webiny/feature": "0.0.0-unstable.0156a4c312"
23
+ },
24
+ "peerDependencies": {
25
+ "@webiny/di": "^2.0.0"
26
+ },
27
+ "devDependencies": {
28
+ "@webiny/build-tools": "0.0.0-unstable.0156a4c312",
29
+ "@webiny/di": "2.0.0",
30
+ "typescript": "7.0.2",
31
+ "vitest": "5.0.5"
32
+ },
33
+ "publishConfig": {
34
+ "access": "public"
35
+ },
36
+ "webiny": {
37
+ "publishFrom": "dist"
38
+ }
39
+ }