@webiny/api-headless-cms-tasks 6.6.0-alpha.2 → 6.6.0-alpha.3

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,10 +1,18 @@
1
1
  import type { IDeleteModelTaskInput } from "./types.js";
2
2
  import type { IDeleteModelTaskOutput } from "./types.js";
3
- import { TaskDefinition } from "@webiny/api-core/features/task/TaskDefinition/index.js";
3
+ import { TaskDefinition, TaskHandler } from "@webiny/api-core/features/task/TaskDefinition/index.js";
4
4
  import { CmsContext } from "@webiny/api-headless-cms/features/shared/abstractions.js";
5
- type IRunParams = TaskDefinition.RunParams<IDeleteModelTaskInput, IDeleteModelTaskOutput>;
6
- declare class DeleteModelTaskDefinition implements TaskDefinition.Interface<IDeleteModelTaskInput, IDeleteModelTaskOutput> {
5
+ type IRunParams = TaskHandler.RunParams<IDeleteModelTaskInput, IDeleteModelTaskOutput>;
6
+ declare class DeleteModelTaskDefinitionHandlerImpl implements TaskHandler.Interface<IDeleteModelTaskInput, IDeleteModelTaskOutput> {
7
7
  private context;
8
+ constructor(context: CmsContext.Interface);
9
+ run(params: IRunParams): Promise<TaskDefinition.Result<IDeleteModelTaskInput, IDeleteModelTaskOutput>>;
10
+ createInputValidation({ validator }: TaskDefinition.CreateInputValidationParams): {
11
+ modelId: import("zod").ZodString;
12
+ lastDeletedId: import("zod").ZodOptional<import("zod").ZodString>;
13
+ };
14
+ }
15
+ declare class DeleteModelTaskDefinition implements TaskDefinition.Interface {
8
16
  id: string;
9
17
  title: string;
10
18
  maxIterations: number;
@@ -12,11 +20,8 @@ declare class DeleteModelTaskDefinition implements TaskDefinition.Interface<IDel
12
20
  databaseLogs: boolean;
13
21
  description: string;
14
22
  readonly selfCleanup: ("onAbort" | "onSuccess")[];
15
- constructor(context: CmsContext.Interface);
16
- run(params: IRunParams): Promise<TaskDefinition.Result<IDeleteModelTaskInput, IDeleteModelTaskOutput>>;
17
- createInputValidation({ validator }: TaskDefinition.CreateInputValidationParams): {
18
- modelId: import("zod").ZodString;
19
- lastDeletedId: import("zod").ZodOptional<import("zod").ZodString>;
23
+ handler: typeof DeleteModelTaskDefinitionHandlerImpl & {
24
+ __abstraction: import("@webiny/di").Abstraction<import("@webiny/api-core/features/task/TaskDefinition/abstractions.js").ITaskHandler<import("@webiny/api-core/features/task/TaskDefinition/abstractions.js").ITaskInput, import("@webiny/api-core/features/task/TaskDefinition/abstractions.js").ITaskOutput>>;
20
25
  };
21
26
  }
22
27
  export declare const DeleteModelTask: typeof DeleteModelTaskDefinition & {
@@ -1,19 +1,9 @@
1
- import { TaskDefinition } from "@webiny/api-core/features/task/TaskDefinition/index.js";
1
+ import { TaskDefinition, TaskHandler } from "@webiny/api-core/features/task/TaskDefinition/index.js";
2
2
  import { CmsContext } from "@webiny/api-headless-cms/features/shared/abstractions.js";
3
3
  import { DELETE_MODEL_TASK } from "../../constants.js";
4
- class DeleteModelTaskDefinition {
4
+ class DeleteModelTaskDefinitionHandlerImpl {
5
5
  constructor(context){
6
6
  this.context = context;
7
- this.id = DELETE_MODEL_TASK;
8
- this.title = "Delete model and all of the entries";
9
- this.maxIterations = 50;
10
- this.isPrivate = true;
11
- this.databaseLogs = false;
12
- this.description = "Delete a content model and all associated entries.";
13
- this.selfCleanup = [
14
- "onSuccess",
15
- "onAbort"
16
- ];
17
7
  }
18
8
  async run(params) {
19
9
  const { DeleteModel } = await import("./DeleteModel.js");
@@ -31,12 +21,31 @@ class DeleteModelTaskDefinition {
31
21
  };
32
22
  }
33
23
  }
34
- const DeleteModelTask = TaskDefinition.createImplementation({
35
- implementation: DeleteModelTaskDefinition,
24
+ const DeleteModelTaskDefinitionHandler = TaskHandler.createImplementation({
25
+ implementation: DeleteModelTaskDefinitionHandlerImpl,
36
26
  dependencies: [
37
27
  CmsContext
38
28
  ]
39
29
  });
30
+ class DeleteModelTaskDefinition {
31
+ constructor(){
32
+ this.id = DELETE_MODEL_TASK;
33
+ this.title = "Delete model and all of the entries";
34
+ this.maxIterations = 50;
35
+ this.isPrivate = true;
36
+ this.databaseLogs = false;
37
+ this.description = "Delete a content model and all associated entries.";
38
+ this.selfCleanup = [
39
+ "onSuccess",
40
+ "onAbort"
41
+ ];
42
+ this.handler = DeleteModelTaskDefinitionHandler;
43
+ }
44
+ }
45
+ const DeleteModelTask = TaskDefinition.createImplementation({
46
+ implementation: DeleteModelTaskDefinition,
47
+ dependencies: []
48
+ });
40
49
  export { DeleteModelTask };
41
50
 
42
51
  //# sourceMappingURL=DeleteModelTask.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"features/DeleteModelTask/DeleteModelTask.js","sources":["../../../src/features/DeleteModelTask/DeleteModelTask.ts"],"sourcesContent":["import type { IDeleteModelTaskInput } from \"./types.js\";\nimport type { IDeleteModelTaskOutput } from \"./types.js\";\nimport { TaskDefinition } from \"@webiny/api-core/features/task/TaskDefinition/index.js\";\nimport { CmsContext } from \"@webiny/api-headless-cms/features/shared/abstractions.js\";\nimport { DELETE_MODEL_TASK } from \"~/constants.js\";\n\ntype IRunParams = TaskDefinition.RunParams<IDeleteModelTaskInput, IDeleteModelTaskOutput>;\n\nclass DeleteModelTaskDefinition implements TaskDefinition.Interface<\n IDeleteModelTaskInput,\n IDeleteModelTaskOutput\n> {\n id = DELETE_MODEL_TASK;\n title = \"Delete model and all of the entries\";\n maxIterations = 50;\n isPrivate = true;\n databaseLogs = false;\n description = \"Delete a content model and all associated entries.\";\n\n public readonly selfCleanup = [\"onSuccess\" as const, \"onAbort\" as const];\n\n constructor(private context: CmsContext.Interface) {}\n\n async run(params: IRunParams) {\n const { DeleteModel } = await import(\n /* webpackChunkName: \"createDeleteModel\" */ \"./DeleteModel.js\"\n );\n\n try {\n const runner = new DeleteModel(this.context);\n return await runner.run(params);\n } catch (ex) {\n return params.controller.response.error(ex);\n }\n }\n\n createInputValidation({ validator }: TaskDefinition.CreateInputValidationParams) {\n return {\n modelId: validator.string(),\n lastDeletedId: validator.string().optional()\n };\n }\n}\n\nexport const DeleteModelTask = TaskDefinition.createImplementation({\n implementation: DeleteModelTaskDefinition,\n dependencies: [CmsContext]\n});\n"],"names":["DeleteModelTaskDefinition","context","DELETE_MODEL_TASK","params","DeleteModel","runner","ex","validator","DeleteModelTask","TaskDefinition","CmsContext"],"mappings":";;;AAQA,MAAMA;IAaF,YAAoBC,OAA6B,CAAE;aAA/BA,OAAO,GAAPA;aATpB,EAAE,GAAGC;aACL,KAAK,GAAG;aACR,aAAa,GAAG;aAChB,SAAS,GAAG;aACZ,YAAY,GAAG;aACf,WAAW,GAAG;aAEE,WAAW,GAAG;YAAC;YAAsB;SAAmB;IAEpB;IAEpD,MAAM,IAAIC,MAAkB,EAAE;QAC1B,MAAM,EAAEC,WAAW,EAAE,GAAG,MAAM,MAAM,CAAN;QAI9B,IAAI;YACA,MAAMC,SAAS,IAAID,YAAY,IAAI,CAAC,OAAO;YAC3C,OAAO,MAAMC,OAAO,GAAG,CAACF;QAC5B,EAAE,OAAOG,IAAI;YACT,OAAOH,OAAO,UAAU,CAAC,QAAQ,CAAC,KAAK,CAACG;QAC5C;IACJ;IAEA,sBAAsB,EAAEC,SAAS,EAA8C,EAAE;QAC7E,OAAO;YACH,SAASA,UAAU,MAAM;YACzB,eAAeA,UAAU,MAAM,GAAG,QAAQ;QAC9C;IACJ;AACJ;AAEO,MAAMC,kBAAkBC,eAAe,oBAAoB,CAAC;IAC/D,gBAAgBT;IAChB,cAAc;QAACU;KAAW;AAC9B"}
1
+ {"version":3,"file":"features/DeleteModelTask/DeleteModelTask.js","sources":["../../../src/features/DeleteModelTask/DeleteModelTask.ts"],"sourcesContent":["import type { IDeleteModelTaskInput } from \"./types.js\";\nimport type { IDeleteModelTaskOutput } from \"./types.js\";\nimport {\n TaskDefinition,\n TaskHandler\n} from \"@webiny/api-core/features/task/TaskDefinition/index.js\";\nimport { CmsContext } from \"@webiny/api-headless-cms/features/shared/abstractions.js\";\nimport { DELETE_MODEL_TASK } from \"~/constants.js\";\n\ntype IRunParams = TaskHandler.RunParams<IDeleteModelTaskInput, IDeleteModelTaskOutput>;\n\nclass DeleteModelTaskDefinitionHandlerImpl implements TaskHandler.Interface<\n IDeleteModelTaskInput,\n IDeleteModelTaskOutput\n> {\n constructor(private context: CmsContext.Interface) {}\n\n async run(params: IRunParams) {\n const { DeleteModel } = await import(\n /* webpackChunkName: \"createDeleteModel\" */ \"./DeleteModel.js\"\n );\n\n try {\n const runner = new DeleteModel(this.context);\n return await runner.run(params);\n } catch (ex) {\n return params.controller.response.error(ex);\n }\n }\n\n createInputValidation({ validator }: TaskDefinition.CreateInputValidationParams) {\n return {\n modelId: validator.string(),\n lastDeletedId: validator.string().optional()\n };\n }\n}\n\nconst DeleteModelTaskDefinitionHandler = TaskHandler.createImplementation({\n implementation: DeleteModelTaskDefinitionHandlerImpl,\n dependencies: [CmsContext]\n});\n\nclass DeleteModelTaskDefinition implements TaskDefinition.Interface {\n id = DELETE_MODEL_TASK;\n title = \"Delete model and all of the entries\";\n maxIterations = 50;\n isPrivate = true;\n databaseLogs = false;\n description = \"Delete a content model and all associated entries.\";\n\n public readonly selfCleanup = [\"onSuccess\" as const, \"onAbort\" as const];\n\n handler = DeleteModelTaskDefinitionHandler;\n}\n\nexport const DeleteModelTask = TaskDefinition.createImplementation({\n implementation: DeleteModelTaskDefinition,\n dependencies: []\n});\n"],"names":["DeleteModelTaskDefinitionHandlerImpl","context","params","DeleteModel","runner","ex","validator","DeleteModelTaskDefinitionHandler","TaskHandler","CmsContext","DeleteModelTaskDefinition","DELETE_MODEL_TASK","DeleteModelTask","TaskDefinition"],"mappings":";;;AAWA,MAAMA;IAIF,YAAoBC,OAA6B,CAAE;aAA/BA,OAAO,GAAPA;IAAgC;IAEpD,MAAM,IAAIC,MAAkB,EAAE;QAC1B,MAAM,EAAEC,WAAW,EAAE,GAAG,MAAM,MAAM,CAAN;QAI9B,IAAI;YACA,MAAMC,SAAS,IAAID,YAAY,IAAI,CAAC,OAAO;YAC3C,OAAO,MAAMC,OAAO,GAAG,CAACF;QAC5B,EAAE,OAAOG,IAAI;YACT,OAAOH,OAAO,UAAU,CAAC,QAAQ,CAAC,KAAK,CAACG;QAC5C;IACJ;IAEA,sBAAsB,EAAEC,SAAS,EAA8C,EAAE;QAC7E,OAAO;YACH,SAASA,UAAU,MAAM;YACzB,eAAeA,UAAU,MAAM,GAAG,QAAQ;QAC9C;IACJ;AACJ;AAEA,MAAMC,mCAAmCC,YAAY,oBAAoB,CAAC;IACtE,gBAAgBR;IAChB,cAAc;QAACS;KAAW;AAC9B;AAEA,MAAMC;;aACF,EAAE,GAAGC;aACL,KAAK,GAAG;aACR,aAAa,GAAG;aAChB,SAAS,GAAG;aACZ,YAAY,GAAG;aACf,WAAW,GAAG;aAEE,WAAW,GAAG;YAAC;YAAsB;SAAmB;aAExE,OAAO,GAAGJ;;AACd;AAEO,MAAMK,kBAAkBC,eAAe,oBAAoB,CAAC;IAC/D,gBAAgBH;IAChB,cAAc,EAAE;AACpB"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@webiny/api-headless-cms-tasks",
3
- "version": "6.6.0-alpha.2",
3
+ "version": "6.6.0-alpha.3",
4
4
  "type": "module",
5
5
  "exports": {
6
6
  ".": "./index.js",
@@ -17,26 +17,26 @@
17
17
  },
18
18
  "license": "MIT",
19
19
  "dependencies": {
20
- "@webiny/api-aco": "6.6.0-alpha.2",
21
- "@webiny/api-graphql": "6.6.0-alpha.2",
22
- "@webiny/api-headless-cms": "6.6.0-alpha.2",
23
- "@webiny/api-headless-cms-bulk-actions": "6.6.0-alpha.2",
24
- "@webiny/background-tasks": "6.6.0-alpha.2",
25
- "@webiny/error": "6.6.0-alpha.2",
26
- "@webiny/feature": "6.6.0-alpha.2",
27
- "@webiny/utils": "6.6.0-alpha.2",
20
+ "@webiny/api-aco": "6.6.0-alpha.3",
21
+ "@webiny/api-graphql": "6.6.0-alpha.3",
22
+ "@webiny/api-headless-cms": "6.6.0-alpha.3",
23
+ "@webiny/api-headless-cms-bulk-actions": "6.6.0-alpha.3",
24
+ "@webiny/background-tasks": "6.6.0-alpha.3",
25
+ "@webiny/error": "6.6.0-alpha.3",
26
+ "@webiny/feature": "6.6.0-alpha.3",
27
+ "@webiny/utils": "6.6.0-alpha.3",
28
28
  "graphql": "16.14.2",
29
29
  "zod": "4.4.3"
30
30
  },
31
31
  "devDependencies": {
32
- "@webiny/api-core": "6.6.0-alpha.2",
33
- "@webiny/api-headless-cms-testing": "6.6.0-alpha.2",
34
- "@webiny/api-opensearch": "6.6.0-alpha.2",
35
- "@webiny/build-tools": "6.6.0-alpha.2",
36
- "@webiny/event-handler-core": "6.6.0-alpha.2",
37
- "@webiny/handler": "6.6.0-alpha.2",
38
- "@webiny/plugins": "6.6.0-alpha.2",
39
- "@webiny/wcp": "6.6.0-alpha.2",
32
+ "@webiny/api-core": "6.6.0-alpha.3",
33
+ "@webiny/api-headless-cms-testing": "6.6.0-alpha.3",
34
+ "@webiny/api-opensearch": "6.6.0-alpha.3",
35
+ "@webiny/build-tools": "6.6.0-alpha.3",
36
+ "@webiny/event-handler-core": "6.6.0-alpha.3",
37
+ "@webiny/handler": "6.6.0-alpha.3",
38
+ "@webiny/plugins": "6.6.0-alpha.3",
39
+ "@webiny/wcp": "6.6.0-alpha.3",
40
40
  "typescript": "7.0.2",
41
41
  "vitest": "4.1.11"
42
42
  },