@webiny/api-aco 6.6.0-alpha.1 → 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.
Files changed (34) hide show
  1. package/features/ai/CreateFolderTool.d.ts +11 -6
  2. package/features/ai/CreateFolderTool.js +20 -11
  3. package/features/ai/CreateFolderTool.js.map +1 -1
  4. package/features/ai/CreateTeamTool.d.ts +11 -6
  5. package/features/ai/CreateTeamTool.js +20 -11
  6. package/features/ai/CreateTeamTool.js.map +1 -1
  7. package/features/ai/GrantFolderAccessTool.d.ts +13 -8
  8. package/features/ai/GrantFolderAccessTool.js +20 -11
  9. package/features/ai/GrantFolderAccessTool.js.map +1 -1
  10. package/features/ai/ListFoldersTool.d.ts +11 -6
  11. package/features/ai/ListFoldersTool.js +21 -12
  12. package/features/ai/ListFoldersTool.js.map +1 -1
  13. package/features/ai/ListRolesTool.d.ts +11 -6
  14. package/features/ai/ListRolesTool.js +21 -12
  15. package/features/ai/ListRolesTool.js.map +1 -1
  16. package/features/ai/ListTeamsTool.d.ts +11 -6
  17. package/features/ai/ListTeamsTool.js +21 -12
  18. package/features/ai/ListTeamsTool.js.map +1 -1
  19. package/features/ai/RevokeFolderAccessTool.d.ts +12 -7
  20. package/features/ai/RevokeFolderAccessTool.js +21 -12
  21. package/features/ai/RevokeFolderAccessTool.js.map +1 -1
  22. package/flp/tasks/createFlp.task.d.ts +9 -4
  23. package/flp/tasks/createFlp.task.js +22 -13
  24. package/flp/tasks/createFlp.task.js.map +1 -1
  25. package/flp/tasks/deleteFlp.task.d.ts +9 -4
  26. package/flp/tasks/deleteFlp.task.js +22 -13
  27. package/flp/tasks/deleteFlp.task.js.map +1 -1
  28. package/flp/tasks/syncFlp.task.d.ts +9 -4
  29. package/flp/tasks/syncFlp.task.js +22 -13
  30. package/flp/tasks/syncFlp.task.js.map +1 -1
  31. package/flp/tasks/updateFlp.task.d.ts +9 -4
  32. package/flp/tasks/updateFlp.task.js +22 -13
  33. package/flp/tasks/updateFlp.task.js.map +1 -1
  34. package/package.json +19 -19
@@ -1 +1 @@
1
- {"version":3,"file":"features/ai/ListRolesTool.js","sources":["../../../src/features/ai/ListRolesTool.ts"],"sourcesContent":["import { z } from \"zod\";\nimport { AiSdkTool } from \"@webiny/api-core/features/ai/index.js\";\nimport type { IAiSdkTool } from \"@webiny/api-core/features/ai/index.js\";\nimport { ListRolesUseCase } from \"@webiny/api-core/features/security/roles/ListRoles/index.js\";\n\nconst inputSchema = z.object({});\n\ninterface RoleSummary {\n id: string;\n name: string;\n slug: string;\n description?: string;\n}\n\n/**\n * Resolves role names to the IDs `createTeam` takes. Separate from the write, so the user approves a\n * team with roles that were looked up rather than guessed.\n *\n * Returns the slug too, because it is what a human recognises and what the admin UI shows, while\n * `id` is what a team actually stores. Nothing at the type level separates the two, so `createTeam`\n * accepts either and resolves it rather than making the caller guess which one that field wants.\n */\nclass ListRolesToolImpl implements IAiSdkTool<Record<string, never>> {\n readonly name = \"listRoles\";\n readonly title = \"List roles\";\n readonly description =\n \"Lists the security roles in this project. Call this before createTeam and pass the `id` of each role you want. A slug also works, but a value that is neither is rejected.\";\n readonly inputSchema = inputSchema;\n readonly annotations = { readOnlyHint: true, idempotentHint: true };\n\n constructor(private listRoles: ListRolesUseCase.Interface) {}\n\n async execute(): Promise<RoleSummary[]> {\n const result = await this.listRoles.execute();\n\n if (result.isFail()) {\n throw new Error(`Could not list roles: ${result.error.message}`);\n }\n\n return result.value.map(role => {\n const summary: RoleSummary = {\n id: role.id,\n name: role.name,\n slug: role.slug\n };\n\n if (role.description) {\n summary.description = role.description;\n }\n\n return summary;\n });\n }\n}\n\nexport const ListRolesTool = AiSdkTool.createImplementation({\n implementation: ListRolesToolImpl,\n dependencies: [ListRolesUseCase]\n});\n"],"names":["inputSchema","z","ListRolesToolImpl","listRoles","result","Error","role","summary","ListRolesTool","AiSdkTool","ListRolesUseCase"],"mappings":";;;AAKA,MAAMA,cAAcC,EAAE,MAAM,CAAC,CAAC;AAiB9B,MAAMC;IAQF,YAAoBC,SAAqC,CAAE;aAAvCA,SAAS,GAATA;aAPX,IAAI,GAAG;aACP,KAAK,GAAG;aACR,WAAW,GAChB;aACK,WAAW,GAAGH;aACd,WAAW,GAAG;YAAE,cAAc;YAAM,gBAAgB;QAAK;IAEN;IAE5D,MAAM,UAAkC;QACpC,MAAMI,SAAS,MAAM,IAAI,CAAC,SAAS,CAAC,OAAO;QAE3C,IAAIA,OAAO,MAAM,IACb,MAAM,IAAIC,MAAM,CAAC,sBAAsB,EAAED,OAAO,KAAK,CAAC,OAAO,EAAE;QAGnE,OAAOA,OAAO,KAAK,CAAC,GAAG,CAACE,CAAAA;YACpB,MAAMC,UAAuB;gBACzB,IAAID,KAAK,EAAE;gBACX,MAAMA,KAAK,IAAI;gBACf,MAAMA,KAAK,IAAI;YACnB;YAEA,IAAIA,KAAK,WAAW,EAChBC,QAAQ,WAAW,GAAGD,KAAK,WAAW;YAG1C,OAAOC;QACX;IACJ;AACJ;AAEO,MAAMC,gBAAgBC,UAAU,oBAAoB,CAAC;IACxD,gBAAgBP;IAChB,cAAc;QAACQ;KAAiB;AACpC"}
1
+ {"version":3,"file":"features/ai/ListRolesTool.js","sources":["../../../src/features/ai/ListRolesTool.ts"],"sourcesContent":["import { z } from \"zod\";\nimport { AiSdkToolDefinition, AiSdkToolHandler } from \"@webiny/api-core/features/ai/index.js\";\nimport { ListRolesUseCase } from \"@webiny/api-core/features/security/roles/ListRoles/index.js\";\n\nconst inputSchema = z.object({});\n\ninterface RoleSummary {\n id: string;\n name: string;\n slug: string;\n description?: string;\n}\n\nclass ListRolesToolHandlerImpl implements AiSdkToolHandler.Interface<Record<string, never>> {\n constructor(private listRoles: ListRolesUseCase.Interface) {}\n\n async execute(): Promise<RoleSummary[]> {\n const result = await this.listRoles.execute();\n\n if (result.isFail()) {\n throw new Error(`Could not list roles: ${result.error.message}`);\n }\n\n return result.value.map(role => {\n const summary: RoleSummary = {\n id: role.id,\n name: role.name,\n slug: role.slug\n };\n\n if (role.description) {\n summary.description = role.description;\n }\n\n return summary;\n });\n }\n}\n\nconst ListRolesToolHandler = AiSdkToolHandler.createImplementation({\n implementation: ListRolesToolHandlerImpl,\n dependencies: [ListRolesUseCase]\n});\n\n/**\n * Resolves role names to the IDs `createTeam` takes. Separate from the write, so the user approves a\n * team with roles that were looked up rather than guessed.\n *\n * Returns the slug too, because it is what a human recognises and what the admin UI shows, while\n * `id` is what a team actually stores. Nothing at the type level separates the two, so `createTeam`\n * accepts either and resolves it rather than making the caller guess which one that field wants.\n */\nclass ListRolesToolImpl implements AiSdkToolDefinition.Interface<Record<string, never>> {\n readonly name = \"listRoles\";\n readonly title = \"List roles\";\n readonly description =\n \"Lists the security roles in this project. Call this before createTeam and pass the `id` of each role you want. A slug also works, but a value that is neither is rejected.\";\n readonly inputSchema = inputSchema;\n readonly annotations = { readOnlyHint: true, idempotentHint: true };\n readonly handler = ListRolesToolHandler;\n}\n\nexport const ListRolesTool = AiSdkToolDefinition.createImplementation({\n implementation: ListRolesToolImpl,\n dependencies: []\n});\n"],"names":["inputSchema","z","ListRolesToolHandlerImpl","listRoles","result","Error","role","summary","ListRolesToolHandler","AiSdkToolHandler","ListRolesUseCase","ListRolesToolImpl","ListRolesTool","AiSdkToolDefinition"],"mappings":";;;AAIA,MAAMA,cAAcC,EAAE,MAAM,CAAC,CAAC;AAS9B,MAAMC;IACF,YAAoBC,SAAqC,CAAE;aAAvCA,SAAS,GAATA;IAAwC;IAE5D,MAAM,UAAkC;QACpC,MAAMC,SAAS,MAAM,IAAI,CAAC,SAAS,CAAC,OAAO;QAE3C,IAAIA,OAAO,MAAM,IACb,MAAM,IAAIC,MAAM,CAAC,sBAAsB,EAAED,OAAO,KAAK,CAAC,OAAO,EAAE;QAGnE,OAAOA,OAAO,KAAK,CAAC,GAAG,CAACE,CAAAA;YACpB,MAAMC,UAAuB;gBACzB,IAAID,KAAK,EAAE;gBACX,MAAMA,KAAK,IAAI;gBACf,MAAMA,KAAK,IAAI;YACnB;YAEA,IAAIA,KAAK,WAAW,EAChBC,QAAQ,WAAW,GAAGD,KAAK,WAAW;YAG1C,OAAOC;QACX;IACJ;AACJ;AAEA,MAAMC,uBAAuBC,iBAAiB,oBAAoB,CAAC;IAC/D,gBAAgBP;IAChB,cAAc;QAACQ;KAAiB;AACpC;AAUA,MAAMC;;aACO,IAAI,GAAG;aACP,KAAK,GAAG;aACR,WAAW,GAChB;aACK,WAAW,GAAGX;aACd,WAAW,GAAG;YAAE,cAAc;YAAM,gBAAgB;QAAK;aACzD,OAAO,GAAGQ;;AACvB;AAEO,MAAMI,gBAAgBC,oBAAoB,oBAAoB,CAAC;IAClE,gBAAgBF;IAChB,cAAc,EAAE;AACpB"}
@@ -1,5 +1,5 @@
1
1
  import { z } from "zod";
2
- import type { IAiSdkTool } from "@webiny/api-core/features/ai/index.js";
2
+ import { AiSdkToolDefinition, AiSdkToolHandler } from "@webiny/api-core/features/ai/index.js";
3
3
  import { ListTeamsUseCase } from "@webiny/api-core/features/security/teams/ListTeams/index.js";
4
4
  declare const inputSchema: z.ZodObject<{}, z.core.$strip>;
5
5
  type Input = z.infer<typeof inputSchema>;
@@ -9,14 +9,18 @@ interface TeamSummary {
9
9
  slug: string;
10
10
  description?: string;
11
11
  }
12
+ declare class ListTeamsToolHandlerImpl implements AiSdkToolHandler.Interface<Input> {
13
+ private listTeams;
14
+ constructor(listTeams: ListTeamsUseCase.Interface);
15
+ execute(): Promise<TeamSummary[]>;
16
+ }
12
17
  /**
13
18
  * Resolves human names ("team A") to the ids folder permissions actually take.
14
19
  *
15
20
  * Kept separate from setFolderPermissions rather than accepting a team name there: the user approves
16
21
  * the arguments of a write, so the id has to be looked up and shown, not guessed inside the write.
17
22
  */
18
- declare class ListTeamsToolImpl implements IAiSdkTool<Input> {
19
- private listTeams;
23
+ declare class ListTeamsToolImpl implements AiSdkToolDefinition.Interface<Input> {
20
24
  readonly name = "listTeams";
21
25
  readonly title = "List teams";
22
26
  readonly description = "Lists the teams in this project with their ids, names and slugs. Folder permission targets use the SLUG (`team:<slug>`), not the id.";
@@ -25,10 +29,11 @@ declare class ListTeamsToolImpl implements IAiSdkTool<Input> {
25
29
  readOnlyHint: boolean;
26
30
  idempotentHint: boolean;
27
31
  };
28
- constructor(listTeams: ListTeamsUseCase.Interface);
29
- execute(): Promise<TeamSummary[]>;
32
+ readonly handler: typeof ListTeamsToolHandlerImpl & {
33
+ __abstraction: import("@webiny/di").Abstraction<import("@webiny/api-core/features/ai/abstractions").IAiSdkToolHandler<any>>;
34
+ };
30
35
  }
31
36
  export declare const ListTeamsTool: typeof ListTeamsToolImpl & {
32
- __abstraction: import("@webiny/di").Abstraction<IAiSdkTool<any>>;
37
+ __abstraction: import("@webiny/di").Abstraction<import("@webiny/api-core/features/ai/abstractions").IAiSdkToolDefinition<any>>;
33
38
  };
34
39
  export {};
@@ -1,18 +1,10 @@
1
1
  import { z } from "zod";
2
- import { AiSdkTool } from "@webiny/api-core/features/ai/index.js";
2
+ import { AiSdkToolDefinition, AiSdkToolHandler } from "@webiny/api-core/features/ai/index.js";
3
3
  import { ListTeamsUseCase } from "@webiny/api-core/features/security/teams/ListTeams/index.js";
4
4
  const inputSchema = z.object({});
5
- class ListTeamsToolImpl {
5
+ class ListTeamsToolHandlerImpl {
6
6
  constructor(listTeams){
7
7
  this.listTeams = listTeams;
8
- this.name = "listTeams";
9
- this.title = "List teams";
10
- this.description = "Lists the teams in this project with their ids, names and slugs. Folder permission targets use the SLUG (`team:<slug>`), not the id.";
11
- this.inputSchema = inputSchema;
12
- this.annotations = {
13
- readOnlyHint: true,
14
- idempotentHint: true
15
- };
16
8
  }
17
9
  async execute() {
18
10
  const result = await this.listTeams.execute();
@@ -28,12 +20,29 @@ class ListTeamsToolImpl {
28
20
  });
29
21
  }
30
22
  }
31
- const ListTeamsTool = AiSdkTool.createImplementation({
32
- implementation: ListTeamsToolImpl,
23
+ const ListTeamsToolHandler = AiSdkToolHandler.createImplementation({
24
+ implementation: ListTeamsToolHandlerImpl,
33
25
  dependencies: [
34
26
  ListTeamsUseCase
35
27
  ]
36
28
  });
29
+ class ListTeamsToolImpl {
30
+ constructor(){
31
+ this.name = "listTeams";
32
+ this.title = "List teams";
33
+ this.description = "Lists the teams in this project with their ids, names and slugs. Folder permission targets use the SLUG (`team:<slug>`), not the id.";
34
+ this.inputSchema = inputSchema;
35
+ this.annotations = {
36
+ readOnlyHint: true,
37
+ idempotentHint: true
38
+ };
39
+ this.handler = ListTeamsToolHandler;
40
+ }
41
+ }
42
+ const ListTeamsTool = AiSdkToolDefinition.createImplementation({
43
+ implementation: ListTeamsToolImpl,
44
+ dependencies: []
45
+ });
37
46
  export { ListTeamsTool };
38
47
 
39
48
  //# sourceMappingURL=ListTeamsTool.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"features/ai/ListTeamsTool.js","sources":["../../../src/features/ai/ListTeamsTool.ts"],"sourcesContent":["import { z } from \"zod\";\nimport { AiSdkTool } from \"@webiny/api-core/features/ai/index.js\";\nimport type { IAiSdkTool } from \"@webiny/api-core/features/ai/index.js\";\nimport { ListTeamsUseCase } from \"@webiny/api-core/features/security/teams/ListTeams/index.js\";\n\nconst inputSchema = z.object({});\n\ntype Input = z.infer<typeof inputSchema>;\n\ninterface TeamSummary {\n id: string;\n name: string;\n slug: string;\n description?: string;\n}\n\n/**\n * Resolves human names (\"team A\") to the ids folder permissions actually take.\n *\n * Kept separate from setFolderPermissions rather than accepting a team name there: the user approves\n * the arguments of a write, so the id has to be looked up and shown, not guessed inside the write.\n */\nclass ListTeamsToolImpl implements IAiSdkTool<Input> {\n readonly name = \"listTeams\";\n readonly title = \"List teams\";\n readonly description =\n \"Lists the teams in this project with their ids, names and slugs. Folder permission targets use the SLUG (`team:<slug>`), not the id.\";\n readonly inputSchema = inputSchema;\n readonly annotations = { readOnlyHint: true, idempotentHint: true };\n\n constructor(private listTeams: ListTeamsUseCase.Interface) {}\n\n async execute(): Promise<TeamSummary[]> {\n const result = await this.listTeams.execute();\n\n if (result.isFail()) {\n throw new Error(`Could not list teams: ${result.error.message}`);\n }\n\n return result.value.map(team => {\n const summary: TeamSummary = {\n id: team.id,\n name: team.name,\n slug: team.slug\n };\n\n if (team.description) {\n summary.description = team.description;\n }\n\n return summary;\n });\n }\n}\n\nexport const ListTeamsTool = AiSdkTool.createImplementation({\n implementation: ListTeamsToolImpl,\n dependencies: [ListTeamsUseCase]\n});\n"],"names":["inputSchema","z","ListTeamsToolImpl","listTeams","result","Error","team","summary","ListTeamsTool","AiSdkTool","ListTeamsUseCase"],"mappings":";;;AAKA,MAAMA,cAAcC,EAAE,MAAM,CAAC,CAAC;AAiB9B,MAAMC;IAQF,YAAoBC,SAAqC,CAAE;aAAvCA,SAAS,GAATA;aAPX,IAAI,GAAG;aACP,KAAK,GAAG;aACR,WAAW,GAChB;aACK,WAAW,GAAGH;aACd,WAAW,GAAG;YAAE,cAAc;YAAM,gBAAgB;QAAK;IAEN;IAE5D,MAAM,UAAkC;QACpC,MAAMI,SAAS,MAAM,IAAI,CAAC,SAAS,CAAC,OAAO;QAE3C,IAAIA,OAAO,MAAM,IACb,MAAM,IAAIC,MAAM,CAAC,sBAAsB,EAAED,OAAO,KAAK,CAAC,OAAO,EAAE;QAGnE,OAAOA,OAAO,KAAK,CAAC,GAAG,CAACE,CAAAA;YACpB,MAAMC,UAAuB;gBACzB,IAAID,KAAK,EAAE;gBACX,MAAMA,KAAK,IAAI;gBACf,MAAMA,KAAK,IAAI;YACnB;YAEA,IAAIA,KAAK,WAAW,EAChBC,QAAQ,WAAW,GAAGD,KAAK,WAAW;YAG1C,OAAOC;QACX;IACJ;AACJ;AAEO,MAAMC,gBAAgBC,UAAU,oBAAoB,CAAC;IACxD,gBAAgBP;IAChB,cAAc;QAACQ;KAAiB;AACpC"}
1
+ {"version":3,"file":"features/ai/ListTeamsTool.js","sources":["../../../src/features/ai/ListTeamsTool.ts"],"sourcesContent":["import { z } from \"zod\";\nimport { AiSdkToolDefinition, AiSdkToolHandler } from \"@webiny/api-core/features/ai/index.js\";\nimport { ListTeamsUseCase } from \"@webiny/api-core/features/security/teams/ListTeams/index.js\";\n\nconst inputSchema = z.object({});\n\ntype Input = z.infer<typeof inputSchema>;\n\ninterface TeamSummary {\n id: string;\n name: string;\n slug: string;\n description?: string;\n}\n\nclass ListTeamsToolHandlerImpl implements AiSdkToolHandler.Interface<Input> {\n constructor(private listTeams: ListTeamsUseCase.Interface) {}\n\n async execute(): Promise<TeamSummary[]> {\n const result = await this.listTeams.execute();\n\n if (result.isFail()) {\n throw new Error(`Could not list teams: ${result.error.message}`);\n }\n\n return result.value.map(team => {\n const summary: TeamSummary = {\n id: team.id,\n name: team.name,\n slug: team.slug\n };\n\n if (team.description) {\n summary.description = team.description;\n }\n\n return summary;\n });\n }\n}\n\nconst ListTeamsToolHandler = AiSdkToolHandler.createImplementation({\n implementation: ListTeamsToolHandlerImpl,\n dependencies: [ListTeamsUseCase]\n});\n\n/**\n * Resolves human names (\"team A\") to the ids folder permissions actually take.\n *\n * Kept separate from setFolderPermissions rather than accepting a team name there: the user approves\n * the arguments of a write, so the id has to be looked up and shown, not guessed inside the write.\n */\nclass ListTeamsToolImpl implements AiSdkToolDefinition.Interface<Input> {\n readonly name = \"listTeams\";\n readonly title = \"List teams\";\n readonly description =\n \"Lists the teams in this project with their ids, names and slugs. Folder permission targets use the SLUG (`team:<slug>`), not the id.\";\n readonly inputSchema = inputSchema;\n readonly annotations = { readOnlyHint: true, idempotentHint: true };\n readonly handler = ListTeamsToolHandler;\n}\n\nexport const ListTeamsTool = AiSdkToolDefinition.createImplementation({\n implementation: ListTeamsToolImpl,\n dependencies: []\n});\n"],"names":["inputSchema","z","ListTeamsToolHandlerImpl","listTeams","result","Error","team","summary","ListTeamsToolHandler","AiSdkToolHandler","ListTeamsUseCase","ListTeamsToolImpl","ListTeamsTool","AiSdkToolDefinition"],"mappings":";;;AAIA,MAAMA,cAAcC,EAAE,MAAM,CAAC,CAAC;AAW9B,MAAMC;IACF,YAAoBC,SAAqC,CAAE;aAAvCA,SAAS,GAATA;IAAwC;IAE5D,MAAM,UAAkC;QACpC,MAAMC,SAAS,MAAM,IAAI,CAAC,SAAS,CAAC,OAAO;QAE3C,IAAIA,OAAO,MAAM,IACb,MAAM,IAAIC,MAAM,CAAC,sBAAsB,EAAED,OAAO,KAAK,CAAC,OAAO,EAAE;QAGnE,OAAOA,OAAO,KAAK,CAAC,GAAG,CAACE,CAAAA;YACpB,MAAMC,UAAuB;gBACzB,IAAID,KAAK,EAAE;gBACX,MAAMA,KAAK,IAAI;gBACf,MAAMA,KAAK,IAAI;YACnB;YAEA,IAAIA,KAAK,WAAW,EAChBC,QAAQ,WAAW,GAAGD,KAAK,WAAW;YAG1C,OAAOC;QACX;IACJ;AACJ;AAEA,MAAMC,uBAAuBC,iBAAiB,oBAAoB,CAAC;IAC/D,gBAAgBP;IAChB,cAAc;QAACQ;KAAiB;AACpC;AAQA,MAAMC;;aACO,IAAI,GAAG;aACP,KAAK,GAAG;aACR,WAAW,GAChB;aACK,WAAW,GAAGX;aACd,WAAW,GAAG;YAAE,cAAc;YAAM,gBAAgB;QAAK;aACzD,OAAO,GAAGQ;;AACvB;AAEO,MAAMI,gBAAgBC,oBAAoB,oBAAoB,CAAC;IAClE,gBAAgBF;IAChB,cAAc,EAAE;AACpB"}
@@ -1,5 +1,5 @@
1
1
  import { z } from "zod";
2
- import type { IAiSdkTool } from "@webiny/api-core/features/ai/index.js";
2
+ import { AiSdkToolDefinition, AiSdkToolHandler } from "@webiny/api-core/features/ai/index.js";
3
3
  import { GetFolderUseCase } from "../../features/folder/GetFolder/index.js";
4
4
  import { UpdateFolderUseCase } from "../../features/folder/UpdateFolder/index.js";
5
5
  declare const inputSchema: z.ZodObject<{
@@ -28,6 +28,12 @@ interface RevokeResult {
28
28
  level: string;
29
29
  }[];
30
30
  }
31
+ declare class RevokeFolderAccessToolHandlerImpl implements AiSdkToolHandler.Interface<Input> {
32
+ private getFolder;
33
+ private updateFolder;
34
+ constructor(getFolder: GetFolderUseCase.Interface, updateFolder: UpdateFolderUseCase.Interface);
35
+ execute(input: Input): Promise<RevokeResult>;
36
+ }
31
37
  /**
32
38
  * Removes one target's direct access to one folder.
33
39
  *
@@ -35,9 +41,7 @@ interface RevokeResult {
35
41
  * rather than reporting a removal that changed nothing — an inherited grant cannot be revoked here,
36
42
  * only where it is defined, and saying otherwise would leave the user believing access was withdrawn.
37
43
  */
38
- declare class RevokeFolderAccessToolImpl implements IAiSdkTool<Input> {
39
- private getFolder;
40
- private updateFolder;
44
+ declare class RevokeFolderAccessToolImpl implements AiSdkToolDefinition.Interface<Input> {
41
45
  readonly name = "revokeFolderAccess";
42
46
  readonly title = "Revoke folder access";
43
47
  readonly description = "Removes one team's or user's direct access to one folder, leaving all other permissions untouched. Cannot remove inherited access. Requires user approval.";
@@ -49,10 +53,11 @@ declare class RevokeFolderAccessToolImpl implements IAiSdkTool<Input> {
49
53
  readOnlyHint: boolean;
50
54
  destructiveHint: boolean;
51
55
  };
52
- constructor(getFolder: GetFolderUseCase.Interface, updateFolder: UpdateFolderUseCase.Interface);
53
- execute(input: Input): Promise<RevokeResult>;
56
+ readonly handler: typeof RevokeFolderAccessToolHandlerImpl & {
57
+ __abstraction: import("@webiny/di").Abstraction<import("@webiny/api-core/features/ai/abstractions.js").IAiSdkToolHandler<any>>;
58
+ };
54
59
  }
55
60
  export declare const RevokeFolderAccessTool: typeof RevokeFolderAccessToolImpl & {
56
- __abstraction: import("@webiny/di").Abstraction<IAiSdkTool<any>>;
61
+ __abstraction: import("@webiny/di").Abstraction<import("@webiny/api-core/features/ai/abstractions.js").IAiSdkToolDefinition<any>>;
57
62
  };
58
63
  export {};
@@ -1,5 +1,5 @@
1
1
  import { z } from "zod";
2
- import { AiSdkTool } from "@webiny/api-core/features/ai/index.js";
2
+ import { AiSdkToolDefinition, AiSdkToolHandler } from "@webiny/api-core/features/ai/index.js";
3
3
  import { GetFolderUseCase } from "../folder/GetFolder/index.js";
4
4
  import { UpdateFolderUseCase } from "../folder/UpdateFolder/index.js";
5
5
  import { loadFolderPermissions } from "./loadFolderPermissions.js";
@@ -7,18 +7,10 @@ const inputSchema = z.object({
7
7
  folderId: z.string().describe("Folder id as returned by listFolders."),
8
8
  target: z.string().describe("Whose access to remove: 'team:<slug>' or 'admin:<userId>', exactly as listFolders reports it.")
9
9
  });
10
- class RevokeFolderAccessToolImpl {
10
+ class RevokeFolderAccessToolHandlerImpl {
11
11
  constructor(getFolder, updateFolder){
12
12
  this.getFolder = getFolder;
13
13
  this.updateFolder = updateFolder;
14
- this.name = "revokeFolderAccess";
15
- this.title = "Revoke folder access";
16
- this.description = "Removes one team's or user's direct access to one folder, leaving all other permissions untouched. Cannot remove inherited access. Requires user approval.";
17
- this.inputSchema = inputSchema;
18
- this.annotations = {
19
- readOnlyHint: false,
20
- destructiveHint: true
21
- };
22
14
  }
23
15
  async execute(input) {
24
16
  const loaded = await loadFolderPermissions(this.getFolder, input.folderId);
@@ -48,13 +40,30 @@ class RevokeFolderAccessToolImpl {
48
40
  };
49
41
  }
50
42
  }
51
- const RevokeFolderAccessTool = AiSdkTool.createImplementation({
52
- implementation: RevokeFolderAccessToolImpl,
43
+ const RevokeFolderAccessToolHandler = AiSdkToolHandler.createImplementation({
44
+ implementation: RevokeFolderAccessToolHandlerImpl,
53
45
  dependencies: [
54
46
  GetFolderUseCase,
55
47
  UpdateFolderUseCase
56
48
  ]
57
49
  });
50
+ class RevokeFolderAccessToolImpl {
51
+ constructor(){
52
+ this.name = "revokeFolderAccess";
53
+ this.title = "Revoke folder access";
54
+ this.description = "Removes one team's or user's direct access to one folder, leaving all other permissions untouched. Cannot remove inherited access. Requires user approval.";
55
+ this.inputSchema = inputSchema;
56
+ this.annotations = {
57
+ readOnlyHint: false,
58
+ destructiveHint: true
59
+ };
60
+ this.handler = RevokeFolderAccessToolHandler;
61
+ }
62
+ }
63
+ const RevokeFolderAccessTool = AiSdkToolDefinition.createImplementation({
64
+ implementation: RevokeFolderAccessToolImpl,
65
+ dependencies: []
66
+ });
58
67
  export { RevokeFolderAccessTool };
59
68
 
60
69
  //# sourceMappingURL=RevokeFolderAccessTool.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"features/ai/RevokeFolderAccessTool.js","sources":["../../../src/features/ai/RevokeFolderAccessTool.ts"],"sourcesContent":["import { z } from \"zod\";\nimport { AiSdkTool } from \"@webiny/api-core/features/ai/index.js\";\nimport type { IAiSdkTool } from \"@webiny/api-core/features/ai/index.js\";\nimport { GetFolderUseCase } from \"~/features/folder/GetFolder/index.js\";\nimport { UpdateFolderUseCase } from \"~/features/folder/UpdateFolder/index.js\";\nimport { loadFolderPermissions } from \"./loadFolderPermissions.js\";\n\nconst inputSchema = z.object({\n folderId: z.string().describe(\"Folder id as returned by listFolders.\"),\n target: z\n .string()\n .describe(\n \"Whose access to remove: 'team:<slug>' or 'admin:<userId>', exactly as listFolders reports it.\"\n )\n});\n\ntype Input = z.infer<typeof inputSchema>;\n\ninterface RevokeResult {\n folderId: string;\n title: string;\n path: string;\n removed: { target: string; level: string };\n /**\n * Every direct rule remaining afterwards.\n *\n * This is the set the update was asked to store, not an independent read of it:\n * `UpdateFolderWithFolderLevelPermissions` returns the permissions it derived from the input\n * rather than the ones the repository wrote. Treating it as a verification would let the tool\n * confirm its own request back to itself.\n */\n permissions: { target: string; level: string }[];\n}\n\n/**\n * Removes one target's direct access to one folder.\n *\n * Destructive: somebody loses access, and there is no undo. Refuses when the target has no DIRECT rule\n * rather than reporting a removal that changed nothing — an inherited grant cannot be revoked here,\n * only where it is defined, and saying otherwise would leave the user believing access was withdrawn.\n */\nclass RevokeFolderAccessToolImpl implements IAiSdkTool<Input> {\n readonly name = \"revokeFolderAccess\";\n readonly title = \"Revoke folder access\";\n readonly description =\n \"Removes one team's or user's direct access to one folder, leaving all other permissions untouched. Cannot remove inherited access. Requires user approval.\";\n readonly inputSchema = inputSchema;\n readonly annotations = { readOnlyHint: false, destructiveHint: true };\n\n constructor(\n private getFolder: GetFolderUseCase.Interface,\n private updateFolder: UpdateFolderUseCase.Interface\n ) {}\n\n async execute(input: Input): Promise<RevokeResult> {\n const loaded = await loadFolderPermissions(this.getFolder, input.folderId);\n\n const existing = loaded.direct.find(\n permission => String(permission.target) === input.target\n );\n\n if (!existing) {\n if (loaded.inheritedTargets.has(input.target)) {\n throw new Error(\n `\"${input.target}\" has inherited access to this folder, not a direct rule, so it cannot be revoked here. Change it where it is defined.`\n );\n }\n\n throw new Error(\n `\"${input.target}\" has no direct access to this folder, so there is nothing to revoke.`\n );\n }\n\n const permissions = loaded.direct.filter(\n permission => String(permission.target) !== input.target\n );\n\n const result = await this.updateFolder.execute(input.folderId, { permissions });\n\n if (result.isFail()) {\n throw new Error(`Could not revoke access: ${result.error.message}`);\n }\n\n const folder = result.value;\n\n return {\n folderId: folder.id,\n title: folder.title,\n path: folder.path,\n removed: { target: input.target, level: existing.level },\n permissions: (folder.permissions ?? [])\n .filter(permission => !permission.inheritedFrom)\n .map(permission => ({ target: String(permission.target), level: permission.level }))\n };\n }\n}\n\nexport const RevokeFolderAccessTool = AiSdkTool.createImplementation({\n implementation: RevokeFolderAccessToolImpl,\n dependencies: [GetFolderUseCase, UpdateFolderUseCase]\n});\n"],"names":["inputSchema","z","RevokeFolderAccessToolImpl","getFolder","updateFolder","input","loaded","loadFolderPermissions","existing","permission","String","Error","permissions","result","folder","RevokeFolderAccessTool","AiSdkTool","GetFolderUseCase","UpdateFolderUseCase"],"mappings":";;;;;AAOA,MAAMA,cAAcC,EAAE,MAAM,CAAC;IACzB,UAAUA,EAAE,MAAM,GAAG,QAAQ,CAAC;IAC9B,QAAQA,EAAAA,MACG,GACN,QAAQ,CACL;AAEZ;AA2BA,MAAMC;IAQF,YACYC,SAAqC,EACrCC,YAA2C,CACrD;aAFUD,SAAS,GAATA;aACAC,YAAY,GAAZA;aATH,IAAI,GAAG;aACP,KAAK,GAAG;aACR,WAAW,GAChB;aACK,WAAW,GAAGJ;aACd,WAAW,GAAG;YAAE,cAAc;YAAO,iBAAiB;QAAK;IAKjE;IAEH,MAAM,QAAQK,KAAY,EAAyB;QAC/C,MAAMC,SAAS,MAAMC,sBAAsB,IAAI,CAAC,SAAS,EAAEF,MAAM,QAAQ;QAEzE,MAAMG,WAAWF,OAAO,MAAM,CAAC,IAAI,CAC/BG,CAAAA,aAAcC,OAAOD,WAAW,MAAM,MAAMJ,MAAM,MAAM;QAG5D,IAAI,CAACG,UAAU;YACX,IAAIF,OAAO,gBAAgB,CAAC,GAAG,CAACD,MAAM,MAAM,GACxC,MAAM,IAAIM,MACN,CAAC,CAAC,EAAEN,MAAM,MAAM,CAAC,sHAAsH,CAAC;YAIhJ,MAAM,IAAIM,MACN,CAAC,CAAC,EAAEN,MAAM,MAAM,CAAC,qEAAqE,CAAC;QAE/F;QAEA,MAAMO,cAAcN,OAAO,MAAM,CAAC,MAAM,CACpCG,CAAAA,aAAcC,OAAOD,WAAW,MAAM,MAAMJ,MAAM,MAAM;QAG5D,MAAMQ,SAAS,MAAM,IAAI,CAAC,YAAY,CAAC,OAAO,CAACR,MAAM,QAAQ,EAAE;YAAEO;QAAY;QAE7E,IAAIC,OAAO,MAAM,IACb,MAAM,IAAIF,MAAM,CAAC,yBAAyB,EAAEE,OAAO,KAAK,CAAC,OAAO,EAAE;QAGtE,MAAMC,SAASD,OAAO,KAAK;QAE3B,OAAO;YACH,UAAUC,OAAO,EAAE;YACnB,OAAOA,OAAO,KAAK;YACnB,MAAMA,OAAO,IAAI;YACjB,SAAS;gBAAE,QAAQT,MAAM,MAAM;gBAAE,OAAOG,SAAS,KAAK;YAAC;YACvD,aAAcM,AAAAA,CAAAA,OAAO,WAAW,IAAI,EAAC,EAChC,MAAM,CAACL,CAAAA,aAAc,CAACA,WAAW,aAAa,EAC9C,GAAG,CAACA,CAAAA,aAAe;oBAAE,QAAQC,OAAOD,WAAW,MAAM;oBAAG,OAAOA,WAAW,KAAK;gBAAC;QACzF;IACJ;AACJ;AAEO,MAAMM,yBAAyBC,UAAU,oBAAoB,CAAC;IACjE,gBAAgBd;IAChB,cAAc;QAACe;QAAkBC;KAAoB;AACzD"}
1
+ {"version":3,"file":"features/ai/RevokeFolderAccessTool.js","sources":["../../../src/features/ai/RevokeFolderAccessTool.ts"],"sourcesContent":["import { z } from \"zod\";\nimport { AiSdkToolDefinition, AiSdkToolHandler } from \"@webiny/api-core/features/ai/index.js\";\nimport { GetFolderUseCase } from \"~/features/folder/GetFolder/index.js\";\nimport { UpdateFolderUseCase } from \"~/features/folder/UpdateFolder/index.js\";\nimport { loadFolderPermissions } from \"./loadFolderPermissions.js\";\n\nconst inputSchema = z.object({\n folderId: z.string().describe(\"Folder id as returned by listFolders.\"),\n target: z\n .string()\n .describe(\n \"Whose access to remove: 'team:<slug>' or 'admin:<userId>', exactly as listFolders reports it.\"\n )\n});\n\ntype Input = z.infer<typeof inputSchema>;\n\ninterface RevokeResult {\n folderId: string;\n title: string;\n path: string;\n removed: { target: string; level: string };\n /**\n * Every direct rule remaining afterwards.\n *\n * This is the set the update was asked to store, not an independent read of it:\n * `UpdateFolderWithFolderLevelPermissions` returns the permissions it derived from the input\n * rather than the ones the repository wrote. Treating it as a verification would let the tool\n * confirm its own request back to itself.\n */\n permissions: { target: string; level: string }[];\n}\n\nclass RevokeFolderAccessToolHandlerImpl implements AiSdkToolHandler.Interface<Input> {\n constructor(\n private getFolder: GetFolderUseCase.Interface,\n private updateFolder: UpdateFolderUseCase.Interface\n ) {}\n\n async execute(input: Input): Promise<RevokeResult> {\n const loaded = await loadFolderPermissions(this.getFolder, input.folderId);\n\n const existing = loaded.direct.find(\n permission => String(permission.target) === input.target\n );\n\n if (!existing) {\n if (loaded.inheritedTargets.has(input.target)) {\n throw new Error(\n `\"${input.target}\" has inherited access to this folder, not a direct rule, so it cannot be revoked here. Change it where it is defined.`\n );\n }\n\n throw new Error(\n `\"${input.target}\" has no direct access to this folder, so there is nothing to revoke.`\n );\n }\n\n const permissions = loaded.direct.filter(\n permission => String(permission.target) !== input.target\n );\n\n const result = await this.updateFolder.execute(input.folderId, { permissions });\n\n if (result.isFail()) {\n throw new Error(`Could not revoke access: ${result.error.message}`);\n }\n\n const folder = result.value;\n\n return {\n folderId: folder.id,\n title: folder.title,\n path: folder.path,\n removed: { target: input.target, level: existing.level },\n permissions: (folder.permissions ?? [])\n .filter(permission => !permission.inheritedFrom)\n .map(permission => ({ target: String(permission.target), level: permission.level }))\n };\n }\n}\n\nconst RevokeFolderAccessToolHandler = AiSdkToolHandler.createImplementation({\n implementation: RevokeFolderAccessToolHandlerImpl,\n dependencies: [GetFolderUseCase, UpdateFolderUseCase]\n});\n\n/**\n * Removes one target's direct access to one folder.\n *\n * Destructive: somebody loses access, and there is no undo. Refuses when the target has no DIRECT rule\n * rather than reporting a removal that changed nothing — an inherited grant cannot be revoked here,\n * only where it is defined, and saying otherwise would leave the user believing access was withdrawn.\n */\nclass RevokeFolderAccessToolImpl implements AiSdkToolDefinition.Interface<Input> {\n readonly name = \"revokeFolderAccess\";\n readonly title = \"Revoke folder access\";\n readonly description =\n \"Removes one team's or user's direct access to one folder, leaving all other permissions untouched. Cannot remove inherited access. Requires user approval.\";\n readonly inputSchema = inputSchema;\n readonly annotations = { readOnlyHint: false, destructiveHint: true };\n readonly handler = RevokeFolderAccessToolHandler;\n}\n\nexport const RevokeFolderAccessTool = AiSdkToolDefinition.createImplementation({\n implementation: RevokeFolderAccessToolImpl,\n dependencies: []\n});\n"],"names":["inputSchema","z","RevokeFolderAccessToolHandlerImpl","getFolder","updateFolder","input","loaded","loadFolderPermissions","existing","permission","String","Error","permissions","result","folder","RevokeFolderAccessToolHandler","AiSdkToolHandler","GetFolderUseCase","UpdateFolderUseCase","RevokeFolderAccessToolImpl","RevokeFolderAccessTool","AiSdkToolDefinition"],"mappings":";;;;;AAMA,MAAMA,cAAcC,EAAE,MAAM,CAAC;IACzB,UAAUA,EAAE,MAAM,GAAG,QAAQ,CAAC;IAC9B,QAAQA,EAAAA,MACG,GACN,QAAQ,CACL;AAEZ;AAoBA,MAAMC;IACF,YACYC,SAAqC,EACrCC,YAA2C,CACrD;aAFUD,SAAS,GAATA;aACAC,YAAY,GAAZA;IACT;IAEH,MAAM,QAAQC,KAAY,EAAyB;QAC/C,MAAMC,SAAS,MAAMC,sBAAsB,IAAI,CAAC,SAAS,EAAEF,MAAM,QAAQ;QAEzE,MAAMG,WAAWF,OAAO,MAAM,CAAC,IAAI,CAC/BG,CAAAA,aAAcC,OAAOD,WAAW,MAAM,MAAMJ,MAAM,MAAM;QAG5D,IAAI,CAACG,UAAU;YACX,IAAIF,OAAO,gBAAgB,CAAC,GAAG,CAACD,MAAM,MAAM,GACxC,MAAM,IAAIM,MACN,CAAC,CAAC,EAAEN,MAAM,MAAM,CAAC,sHAAsH,CAAC;YAIhJ,MAAM,IAAIM,MACN,CAAC,CAAC,EAAEN,MAAM,MAAM,CAAC,qEAAqE,CAAC;QAE/F;QAEA,MAAMO,cAAcN,OAAO,MAAM,CAAC,MAAM,CACpCG,CAAAA,aAAcC,OAAOD,WAAW,MAAM,MAAMJ,MAAM,MAAM;QAG5D,MAAMQ,SAAS,MAAM,IAAI,CAAC,YAAY,CAAC,OAAO,CAACR,MAAM,QAAQ,EAAE;YAAEO;QAAY;QAE7E,IAAIC,OAAO,MAAM,IACb,MAAM,IAAIF,MAAM,CAAC,yBAAyB,EAAEE,OAAO,KAAK,CAAC,OAAO,EAAE;QAGtE,MAAMC,SAASD,OAAO,KAAK;QAE3B,OAAO;YACH,UAAUC,OAAO,EAAE;YACnB,OAAOA,OAAO,KAAK;YACnB,MAAMA,OAAO,IAAI;YACjB,SAAS;gBAAE,QAAQT,MAAM,MAAM;gBAAE,OAAOG,SAAS,KAAK;YAAC;YACvD,aAAcM,AAAAA,CAAAA,OAAO,WAAW,IAAI,EAAC,EAChC,MAAM,CAACL,CAAAA,aAAc,CAACA,WAAW,aAAa,EAC9C,GAAG,CAACA,CAAAA,aAAe;oBAAE,QAAQC,OAAOD,WAAW,MAAM;oBAAG,OAAOA,WAAW,KAAK;gBAAC;QACzF;IACJ;AACJ;AAEA,MAAMM,gCAAgCC,iBAAiB,oBAAoB,CAAC;IACxE,gBAAgBd;IAChB,cAAc;QAACe;QAAkBC;KAAoB;AACzD;AASA,MAAMC;;aACO,IAAI,GAAG;aACP,KAAK,GAAG;aACR,WAAW,GAChB;aACK,WAAW,GAAGnB;aACd,WAAW,GAAG;YAAE,cAAc;YAAO,iBAAiB;QAAK;aAC3D,OAAO,GAAGe;;AACvB;AAEO,MAAMK,yBAAyBC,oBAAoB,oBAAoB,CAAC;IAC3E,gBAAgBF;IAChB,cAAc,EAAE;AACpB"}
@@ -1,16 +1,21 @@
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 { type ICreateFlpTaskInput } from "../../types.js";
3
3
  import { CreateFlpUseCase } from "../../features/flp/CreateFlp/index.js";
4
- declare class CreateFlpTaskImpl implements TaskDefinition.Interface<ICreateFlpTaskInput> {
4
+ declare class CreateFlpTaskHandlerImpl implements TaskHandler.Interface<ICreateFlpTaskInput> {
5
5
  private createFlp;
6
+ constructor(createFlp: CreateFlpUseCase.Interface);
7
+ run({ input, controller }: TaskHandler.RunParams<ICreateFlpTaskInput>): Promise<import("@webiny/api-core/features/task/TaskDefinition/abstractions").ITaskResultAborted | import("@webiny/api-core/features/task/TaskDefinition/abstractions").ITaskResultError | TaskDefinition.ResultContinue<ICreateFlpTaskInput> | TaskDefinition.ResultDone<import("@webiny/api-core/features/task/TaskDefinition/abstractions").ITaskOutput>>;
8
+ }
9
+ declare class CreateFlpTaskImpl implements TaskDefinition.Interface {
6
10
  readonly id = "acoCreateFlp";
7
11
  readonly title = "ACO - Create FLP record";
8
12
  readonly description = "Synchronizes the FLP catalog by creating the FLP record based on the provided folder.";
9
13
  readonly databaseLogs = false;
10
14
  readonly isPrivate = true;
11
15
  readonly selfCleanup: ("onAbort" | "onSuccess")[];
12
- constructor(createFlp: CreateFlpUseCase.Interface);
13
- run({ input, controller }: TaskDefinition.RunParams<ICreateFlpTaskInput>): Promise<import("@webiny/api-core/features/task/TaskDefinition/abstractions").ITaskResultAborted | import("@webiny/api-core/features/task/TaskDefinition/abstractions").ITaskResultError | TaskDefinition.ResultContinue<ICreateFlpTaskInput> | TaskDefinition.ResultDone<import("@webiny/api-core/features/task/TaskDefinition/abstractions").ITaskOutput>>;
16
+ handler: typeof CreateFlpTaskHandlerImpl & {
17
+ __abstraction: import("@webiny/di").Abstraction<import("@webiny/api-core/features/task/TaskDefinition/abstractions").ITaskHandler<import("@webiny/api-core/features/task/TaskDefinition/abstractions").ITaskInput, import("@webiny/api-core/features/task/TaskDefinition/abstractions").ITaskOutput>>;
18
+ };
14
19
  }
15
20
  export declare const CreateFlpTask: typeof CreateFlpTaskImpl & {
16
21
  __abstraction: import("@webiny/di").Abstraction<import("@webiny/api-core/features/task/TaskDefinition/abstractions").ITaskDefinition<import("@webiny/api-core/features/task/TaskDefinition/abstractions").ITaskInput, import("@webiny/api-core/features/task/TaskDefinition/abstractions").ITaskOutput>>;
@@ -1,18 +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 { CREATE_FLP_TASK_ID } from "./index.js";
3
3
  import { CreateFlpUseCase } from "../../features/flp/CreateFlp/index.js";
4
- class CreateFlpTaskImpl {
4
+ class CreateFlpTaskHandlerImpl {
5
5
  constructor(createFlp){
6
6
  this.createFlp = createFlp;
7
- this.id = CREATE_FLP_TASK_ID;
8
- this.title = "ACO - Create FLP record";
9
- this.description = "Synchronizes the FLP catalog by creating the FLP record based on the provided folder.";
10
- this.databaseLogs = false;
11
- this.isPrivate = true;
12
- this.selfCleanup = [
13
- "onSuccess",
14
- "onAbort"
15
- ];
16
7
  }
17
8
  async run({ input, controller }) {
18
9
  try {
@@ -25,12 +16,30 @@ class CreateFlpTaskImpl {
25
16
  }
26
17
  }
27
18
  }
28
- const CreateFlpTask = TaskDefinition.createImplementation({
29
- implementation: CreateFlpTaskImpl,
19
+ const CreateFlpTaskHandler = TaskHandler.createImplementation({
20
+ implementation: CreateFlpTaskHandlerImpl,
30
21
  dependencies: [
31
22
  CreateFlpUseCase
32
23
  ]
33
24
  });
25
+ class CreateFlpTaskImpl {
26
+ constructor(){
27
+ this.id = CREATE_FLP_TASK_ID;
28
+ this.title = "ACO - Create FLP record";
29
+ this.description = "Synchronizes the FLP catalog by creating the FLP record based on the provided folder.";
30
+ this.databaseLogs = false;
31
+ this.isPrivate = true;
32
+ this.selfCleanup = [
33
+ "onSuccess",
34
+ "onAbort"
35
+ ];
36
+ this.handler = CreateFlpTaskHandler;
37
+ }
38
+ }
39
+ const CreateFlpTask = TaskDefinition.createImplementation({
40
+ implementation: CreateFlpTaskImpl,
41
+ dependencies: []
42
+ });
34
43
  export { CreateFlpTask };
35
44
 
36
45
  //# sourceMappingURL=createFlp.task.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"flp/tasks/createFlp.task.js","sources":["../../../src/flp/tasks/createFlp.task.ts"],"sourcesContent":["import { TaskDefinition } from \"@webiny/api-core/features/task/TaskDefinition/index.js\";\nimport { CREATE_FLP_TASK_ID } from \"~/flp/tasks/index.js\";\nimport { type ICreateFlpTaskInput } from \"~/types.js\";\nimport { CreateFlpUseCase } from \"~/features/flp/CreateFlp/index.js\";\n\nclass CreateFlpTaskImpl implements TaskDefinition.Interface<ICreateFlpTaskInput> {\n public readonly id = CREATE_FLP_TASK_ID;\n public readonly title = \"ACO - Create FLP record\";\n public readonly description =\n \"Synchronizes the FLP catalog by creating the FLP record based on the provided folder.\";\n public readonly databaseLogs = false;\n public readonly isPrivate = true;\n public readonly selfCleanup = [\"onSuccess\" as const, \"onAbort\" as const];\n\n constructor(private createFlp: CreateFlpUseCase.Interface) {}\n\n async run({ input, controller }: TaskDefinition.RunParams<ICreateFlpTaskInput>) {\n try {\n if (controller.runtime.isAborted()) {\n return controller.response.aborted();\n }\n\n if (controller.runtime.isCloseToTimeout()) {\n return controller.response.continue(input);\n }\n\n await this.createFlp.execute(input.folder);\n\n return controller.response.done(\"Task done: FLP record created.\");\n } catch (error) {\n return controller.response.error(error);\n }\n }\n}\n\nexport const CreateFlpTask = TaskDefinition.createImplementation({\n implementation: CreateFlpTaskImpl,\n dependencies: [CreateFlpUseCase]\n});\n"],"names":["CreateFlpTaskImpl","createFlp","CREATE_FLP_TASK_ID","input","controller","error","CreateFlpTask","TaskDefinition","CreateFlpUseCase"],"mappings":";;;AAKA,MAAMA;IASF,YAAoBC,SAAqC,CAAE;aAAvCA,SAAS,GAATA;aARJ,EAAE,GAAGC;aACL,KAAK,GAAG;aACR,WAAW,GACvB;aACY,YAAY,GAAG;aACf,SAAS,GAAG;aACZ,WAAW,GAAG;YAAC;YAAsB;SAAmB;IAEZ;IAE5D,MAAM,IAAI,EAAEC,KAAK,EAAEC,UAAU,EAAiD,EAAE;QAC5E,IAAI;YACA,IAAIA,WAAW,OAAO,CAAC,SAAS,IAC5B,OAAOA,WAAW,QAAQ,CAAC,OAAO;YAGtC,IAAIA,WAAW,OAAO,CAAC,gBAAgB,IACnC,OAAOA,WAAW,QAAQ,CAAC,QAAQ,CAACD;YAGxC,MAAM,IAAI,CAAC,SAAS,CAAC,OAAO,CAACA,MAAM,MAAM;YAEzC,OAAOC,WAAW,QAAQ,CAAC,IAAI,CAAC;QACpC,EAAE,OAAOC,OAAO;YACZ,OAAOD,WAAW,QAAQ,CAAC,KAAK,CAACC;QACrC;IACJ;AACJ;AAEO,MAAMC,gBAAgBC,eAAe,oBAAoB,CAAC;IAC7D,gBAAgBP;IAChB,cAAc;QAACQ;KAAiB;AACpC"}
1
+ {"version":3,"file":"flp/tasks/createFlp.task.js","sources":["../../../src/flp/tasks/createFlp.task.ts"],"sourcesContent":["import {\n TaskDefinition,\n TaskHandler\n} from \"@webiny/api-core/features/task/TaskDefinition/index.js\";\nimport { CREATE_FLP_TASK_ID } from \"~/flp/tasks/index.js\";\nimport { type ICreateFlpTaskInput } from \"~/types.js\";\nimport { CreateFlpUseCase } from \"~/features/flp/CreateFlp/index.js\";\n\nclass CreateFlpTaskHandlerImpl implements TaskHandler.Interface<ICreateFlpTaskInput> {\n constructor(private createFlp: CreateFlpUseCase.Interface) {}\n\n async run({ input, controller }: TaskHandler.RunParams<ICreateFlpTaskInput>) {\n try {\n if (controller.runtime.isAborted()) {\n return controller.response.aborted();\n }\n\n if (controller.runtime.isCloseToTimeout()) {\n return controller.response.continue(input);\n }\n\n await this.createFlp.execute(input.folder);\n\n return controller.response.done(\"Task done: FLP record created.\");\n } catch (error) {\n return controller.response.error(error);\n }\n }\n}\n\nconst CreateFlpTaskHandler = TaskHandler.createImplementation({\n implementation: CreateFlpTaskHandlerImpl,\n dependencies: [CreateFlpUseCase]\n});\n\nclass CreateFlpTaskImpl implements TaskDefinition.Interface {\n public readonly id = CREATE_FLP_TASK_ID;\n public readonly title = \"ACO - Create FLP record\";\n public readonly description =\n \"Synchronizes the FLP catalog by creating the FLP record based on the provided folder.\";\n public readonly databaseLogs = false;\n public readonly isPrivate = true;\n public readonly selfCleanup = [\"onSuccess\" as const, \"onAbort\" as const];\n\n handler = CreateFlpTaskHandler;\n}\n\nexport const CreateFlpTask = TaskDefinition.createImplementation({\n implementation: CreateFlpTaskImpl,\n dependencies: []\n});\n"],"names":["CreateFlpTaskHandlerImpl","createFlp","input","controller","error","CreateFlpTaskHandler","TaskHandler","CreateFlpUseCase","CreateFlpTaskImpl","CREATE_FLP_TASK_ID","CreateFlpTask","TaskDefinition"],"mappings":";;;AAQA,MAAMA;IACF,YAAoBC,SAAqC,CAAE;aAAvCA,SAAS,GAATA;IAAwC;IAE5D,MAAM,IAAI,EAAEC,KAAK,EAAEC,UAAU,EAA8C,EAAE;QACzE,IAAI;YACA,IAAIA,WAAW,OAAO,CAAC,SAAS,IAC5B,OAAOA,WAAW,QAAQ,CAAC,OAAO;YAGtC,IAAIA,WAAW,OAAO,CAAC,gBAAgB,IACnC,OAAOA,WAAW,QAAQ,CAAC,QAAQ,CAACD;YAGxC,MAAM,IAAI,CAAC,SAAS,CAAC,OAAO,CAACA,MAAM,MAAM;YAEzC,OAAOC,WAAW,QAAQ,CAAC,IAAI,CAAC;QACpC,EAAE,OAAOC,OAAO;YACZ,OAAOD,WAAW,QAAQ,CAAC,KAAK,CAACC;QACrC;IACJ;AACJ;AAEA,MAAMC,uBAAuBC,YAAY,oBAAoB,CAAC;IAC1D,gBAAgBN;IAChB,cAAc;QAACO;KAAiB;AACpC;AAEA,MAAMC;;aACc,EAAE,GAAGC;aACL,KAAK,GAAG;aACR,WAAW,GACvB;aACY,YAAY,GAAG;aACf,SAAS,GAAG;aACZ,WAAW,GAAG;YAAC;YAAsB;SAAmB;aAExE,OAAO,GAAGJ;;AACd;AAEO,MAAMK,gBAAgBC,eAAe,oBAAoB,CAAC;IAC7D,gBAAgBH;IAChB,cAAc,EAAE;AACpB"}
@@ -1,16 +1,21 @@
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 { type IDeleteFlpTaskInput } from "../../types.js";
3
3
  import { DeleteFlpUseCase } from "../../features/flp/DeleteFlp/index.js";
4
- declare class DeleteFlpTaskImpl implements TaskDefinition.Interface<IDeleteFlpTaskInput> {
4
+ declare class DeleteFlpTaskHandlerImpl implements TaskHandler.Interface<IDeleteFlpTaskInput> {
5
5
  private deleteFlp;
6
+ constructor(deleteFlp: DeleteFlpUseCase.Interface);
7
+ run({ input, controller }: TaskHandler.RunParams<IDeleteFlpTaskInput>): Promise<import("@webiny/api-core/features/task/TaskDefinition/abstractions").ITaskResultAborted | import("@webiny/api-core/features/task/TaskDefinition/abstractions").ITaskResultError | TaskDefinition.ResultContinue<IDeleteFlpTaskInput> | TaskDefinition.ResultDone<import("@webiny/api-core/features/task/TaskDefinition/abstractions").ITaskOutput>>;
8
+ }
9
+ declare class DeleteFlpTaskImpl implements TaskDefinition.Interface {
6
10
  readonly id = "acoDeleteFlp";
7
11
  readonly title = "ACO - Delete FLP record";
8
12
  readonly description = "Synchronizes the FLP catalog by deleting the FLP record based on the provided folder.";
9
13
  readonly databaseLogs = false;
10
14
  readonly isPrivate = true;
11
15
  readonly selfCleanup: ("onAbort" | "onSuccess")[];
12
- constructor(deleteFlp: DeleteFlpUseCase.Interface);
13
- run({ input, controller }: TaskDefinition.RunParams<IDeleteFlpTaskInput>): Promise<import("@webiny/api-core/features/task/TaskDefinition/abstractions").ITaskResultAborted | import("@webiny/api-core/features/task/TaskDefinition/abstractions").ITaskResultError | TaskDefinition.ResultContinue<IDeleteFlpTaskInput> | TaskDefinition.ResultDone<import("@webiny/api-core/features/task/TaskDefinition/abstractions").ITaskOutput>>;
16
+ handler: typeof DeleteFlpTaskHandlerImpl & {
17
+ __abstraction: import("@webiny/di").Abstraction<import("@webiny/api-core/features/task/TaskDefinition/abstractions").ITaskHandler<import("@webiny/api-core/features/task/TaskDefinition/abstractions").ITaskInput, import("@webiny/api-core/features/task/TaskDefinition/abstractions").ITaskOutput>>;
18
+ };
14
19
  }
15
20
  export declare const DeleteFlpTask: typeof DeleteFlpTaskImpl & {
16
21
  __abstraction: import("@webiny/di").Abstraction<import("@webiny/api-core/features/task/TaskDefinition/abstractions").ITaskDefinition<import("@webiny/api-core/features/task/TaskDefinition/abstractions").ITaskInput, import("@webiny/api-core/features/task/TaskDefinition/abstractions").ITaskOutput>>;
@@ -1,18 +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 { DELETE_FLP_TASK_ID } from "./index.js";
3
3
  import { DeleteFlpUseCase } from "../../features/flp/DeleteFlp/index.js";
4
- class DeleteFlpTaskImpl {
4
+ class DeleteFlpTaskHandlerImpl {
5
5
  constructor(deleteFlp){
6
6
  this.deleteFlp = deleteFlp;
7
- this.id = DELETE_FLP_TASK_ID;
8
- this.title = "ACO - Delete FLP record";
9
- this.description = "Synchronizes the FLP catalog by deleting the FLP record based on the provided folder.";
10
- this.databaseLogs = false;
11
- this.isPrivate = true;
12
- this.selfCleanup = [
13
- "onSuccess",
14
- "onAbort"
15
- ];
16
7
  }
17
8
  async run({ input, controller }) {
18
9
  try {
@@ -25,12 +16,30 @@ class DeleteFlpTaskImpl {
25
16
  }
26
17
  }
27
18
  }
28
- const DeleteFlpTask = TaskDefinition.createImplementation({
29
- implementation: DeleteFlpTaskImpl,
19
+ const DeleteFlpTaskHandler = TaskHandler.createImplementation({
20
+ implementation: DeleteFlpTaskHandlerImpl,
30
21
  dependencies: [
31
22
  DeleteFlpUseCase
32
23
  ]
33
24
  });
25
+ class DeleteFlpTaskImpl {
26
+ constructor(){
27
+ this.id = DELETE_FLP_TASK_ID;
28
+ this.title = "ACO - Delete FLP record";
29
+ this.description = "Synchronizes the FLP catalog by deleting the FLP record based on the provided folder.";
30
+ this.databaseLogs = false;
31
+ this.isPrivate = true;
32
+ this.selfCleanup = [
33
+ "onSuccess",
34
+ "onAbort"
35
+ ];
36
+ this.handler = DeleteFlpTaskHandler;
37
+ }
38
+ }
39
+ const DeleteFlpTask = TaskDefinition.createImplementation({
40
+ implementation: DeleteFlpTaskImpl,
41
+ dependencies: []
42
+ });
34
43
  export { DeleteFlpTask };
35
44
 
36
45
  //# sourceMappingURL=deleteFlp.task.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"flp/tasks/deleteFlp.task.js","sources":["../../../src/flp/tasks/deleteFlp.task.ts"],"sourcesContent":["import { TaskDefinition } from \"@webiny/api-core/features/task/TaskDefinition/index.js\";\nimport { DELETE_FLP_TASK_ID } from \"~/flp/tasks/index.js\";\nimport { type IDeleteFlpTaskInput } from \"~/types.js\";\nimport { DeleteFlpUseCase } from \"~/features/flp/DeleteFlp/index.js\";\n\nclass DeleteFlpTaskImpl implements TaskDefinition.Interface<IDeleteFlpTaskInput> {\n public readonly id = DELETE_FLP_TASK_ID;\n public readonly title = \"ACO - Delete FLP record\";\n public readonly description =\n \"Synchronizes the FLP catalog by deleting the FLP record based on the provided folder.\";\n public readonly databaseLogs = false;\n public readonly isPrivate = true;\n public readonly selfCleanup = [\"onSuccess\" as const, \"onAbort\" as const];\n\n constructor(private deleteFlp: DeleteFlpUseCase.Interface) {}\n\n async run({ input, controller }: TaskDefinition.RunParams<IDeleteFlpTaskInput>) {\n try {\n if (controller.runtime.isAborted()) {\n return controller.response.aborted();\n }\n\n if (controller.runtime.isCloseToTimeout()) {\n return controller.response.continue(input);\n }\n\n await this.deleteFlp.execute(input.folder);\n\n return controller.response.done(\"Task done: FLP record deleted.\");\n } catch (error) {\n return controller.response.error(error);\n }\n }\n}\n\nexport const DeleteFlpTask = TaskDefinition.createImplementation({\n implementation: DeleteFlpTaskImpl,\n dependencies: [DeleteFlpUseCase]\n});\n"],"names":["DeleteFlpTaskImpl","deleteFlp","DELETE_FLP_TASK_ID","input","controller","error","DeleteFlpTask","TaskDefinition","DeleteFlpUseCase"],"mappings":";;;AAKA,MAAMA;IASF,YAAoBC,SAAqC,CAAE;aAAvCA,SAAS,GAATA;aARJ,EAAE,GAAGC;aACL,KAAK,GAAG;aACR,WAAW,GACvB;aACY,YAAY,GAAG;aACf,SAAS,GAAG;aACZ,WAAW,GAAG;YAAC;YAAsB;SAAmB;IAEZ;IAE5D,MAAM,IAAI,EAAEC,KAAK,EAAEC,UAAU,EAAiD,EAAE;QAC5E,IAAI;YACA,IAAIA,WAAW,OAAO,CAAC,SAAS,IAC5B,OAAOA,WAAW,QAAQ,CAAC,OAAO;YAGtC,IAAIA,WAAW,OAAO,CAAC,gBAAgB,IACnC,OAAOA,WAAW,QAAQ,CAAC,QAAQ,CAACD;YAGxC,MAAM,IAAI,CAAC,SAAS,CAAC,OAAO,CAACA,MAAM,MAAM;YAEzC,OAAOC,WAAW,QAAQ,CAAC,IAAI,CAAC;QACpC,EAAE,OAAOC,OAAO;YACZ,OAAOD,WAAW,QAAQ,CAAC,KAAK,CAACC;QACrC;IACJ;AACJ;AAEO,MAAMC,gBAAgBC,eAAe,oBAAoB,CAAC;IAC7D,gBAAgBP;IAChB,cAAc;QAACQ;KAAiB;AACpC"}
1
+ {"version":3,"file":"flp/tasks/deleteFlp.task.js","sources":["../../../src/flp/tasks/deleteFlp.task.ts"],"sourcesContent":["import {\n TaskDefinition,\n TaskHandler\n} from \"@webiny/api-core/features/task/TaskDefinition/index.js\";\nimport { DELETE_FLP_TASK_ID } from \"~/flp/tasks/index.js\";\nimport { type IDeleteFlpTaskInput } from \"~/types.js\";\nimport { DeleteFlpUseCase } from \"~/features/flp/DeleteFlp/index.js\";\n\nclass DeleteFlpTaskHandlerImpl implements TaskHandler.Interface<IDeleteFlpTaskInput> {\n constructor(private deleteFlp: DeleteFlpUseCase.Interface) {}\n\n async run({ input, controller }: TaskHandler.RunParams<IDeleteFlpTaskInput>) {\n try {\n if (controller.runtime.isAborted()) {\n return controller.response.aborted();\n }\n\n if (controller.runtime.isCloseToTimeout()) {\n return controller.response.continue(input);\n }\n\n await this.deleteFlp.execute(input.folder);\n\n return controller.response.done(\"Task done: FLP record deleted.\");\n } catch (error) {\n return controller.response.error(error);\n }\n }\n}\n\nconst DeleteFlpTaskHandler = TaskHandler.createImplementation({\n implementation: DeleteFlpTaskHandlerImpl,\n dependencies: [DeleteFlpUseCase]\n});\n\nclass DeleteFlpTaskImpl implements TaskDefinition.Interface {\n public readonly id = DELETE_FLP_TASK_ID;\n public readonly title = \"ACO - Delete FLP record\";\n public readonly description =\n \"Synchronizes the FLP catalog by deleting the FLP record based on the provided folder.\";\n public readonly databaseLogs = false;\n public readonly isPrivate = true;\n public readonly selfCleanup = [\"onSuccess\" as const, \"onAbort\" as const];\n\n handler = DeleteFlpTaskHandler;\n}\n\nexport const DeleteFlpTask = TaskDefinition.createImplementation({\n implementation: DeleteFlpTaskImpl,\n dependencies: []\n});\n"],"names":["DeleteFlpTaskHandlerImpl","deleteFlp","input","controller","error","DeleteFlpTaskHandler","TaskHandler","DeleteFlpUseCase","DeleteFlpTaskImpl","DELETE_FLP_TASK_ID","DeleteFlpTask","TaskDefinition"],"mappings":";;;AAQA,MAAMA;IACF,YAAoBC,SAAqC,CAAE;aAAvCA,SAAS,GAATA;IAAwC;IAE5D,MAAM,IAAI,EAAEC,KAAK,EAAEC,UAAU,EAA8C,EAAE;QACzE,IAAI;YACA,IAAIA,WAAW,OAAO,CAAC,SAAS,IAC5B,OAAOA,WAAW,QAAQ,CAAC,OAAO;YAGtC,IAAIA,WAAW,OAAO,CAAC,gBAAgB,IACnC,OAAOA,WAAW,QAAQ,CAAC,QAAQ,CAACD;YAGxC,MAAM,IAAI,CAAC,SAAS,CAAC,OAAO,CAACA,MAAM,MAAM;YAEzC,OAAOC,WAAW,QAAQ,CAAC,IAAI,CAAC;QACpC,EAAE,OAAOC,OAAO;YACZ,OAAOD,WAAW,QAAQ,CAAC,KAAK,CAACC;QACrC;IACJ;AACJ;AAEA,MAAMC,uBAAuBC,YAAY,oBAAoB,CAAC;IAC1D,gBAAgBN;IAChB,cAAc;QAACO;KAAiB;AACpC;AAEA,MAAMC;;aACc,EAAE,GAAGC;aACL,KAAK,GAAG;aACR,WAAW,GACvB;aACY,YAAY,GAAG;aACf,SAAS,GAAG;aACZ,WAAW,GAAG;YAAC;YAAsB;SAAmB;aAExE,OAAO,GAAGJ;;AACd;AAEO,MAAMK,gBAAgBC,eAAe,oBAAoB,CAAC;IAC7D,gBAAgBH;IAChB,cAAc,EAAE;AACpB"}
@@ -1,20 +1,25 @@
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 { ListModelsUseCase } from "@webiny/api-headless-cms/features/contentModel/ListModels/index.js";
3
3
  import { type ISyncFlpTaskInput } from "../../types.js";
4
4
  import { GetFolderUseCase } from "../../features/folder/GetFolder/index.js";
5
5
  import { ListFoldersUseCase } from "../../features/folder/ListFolders/index.js";
6
- declare class SyncFlpTaskImpl implements TaskDefinition.Interface<ISyncFlpTaskInput> {
6
+ declare class SyncFlpTaskHandlerImpl implements TaskHandler.Interface<ISyncFlpTaskInput> {
7
7
  private getFolder;
8
8
  private listFolders;
9
9
  private listModels;
10
+ constructor(getFolder: GetFolderUseCase.Interface, listFolders: ListFoldersUseCase.Interface, listModels: ListModelsUseCase.Interface);
11
+ run({ input, controller }: TaskHandler.RunParams<ISyncFlpTaskInput>): Promise<import("@webiny/api-core/features/task/TaskDefinition/abstractions").ITaskResultAborted | import("@webiny/api-core/features/task/TaskDefinition/abstractions").ITaskResultError | TaskDefinition.ResultDone<import("@webiny/api-core/features/task/TaskDefinition/abstractions").ITaskOutput>>;
12
+ }
13
+ declare class SyncFlpTaskImpl implements TaskDefinition.Interface {
10
14
  readonly id = "acoSyncFlp";
11
15
  readonly title = "ACO - Sync FLP record";
12
16
  readonly description = "Synchronizes the FLP catalog by updating the FLP record and its descendants.";
13
17
  readonly databaseLogs = false;
14
18
  readonly isPrivate = true;
15
19
  readonly selfCleanup: ("onAbort" | "onSuccess")[];
16
- constructor(getFolder: GetFolderUseCase.Interface, listFolders: ListFoldersUseCase.Interface, listModels: ListModelsUseCase.Interface);
17
- run({ input, controller }: TaskDefinition.RunParams<ISyncFlpTaskInput>): Promise<import("@webiny/api-core/features/task/TaskDefinition/abstractions").ITaskResultAborted | import("@webiny/api-core/features/task/TaskDefinition/abstractions").ITaskResultError | TaskDefinition.ResultDone<import("@webiny/api-core/features/task/TaskDefinition/abstractions").ITaskOutput>>;
20
+ handler: typeof SyncFlpTaskHandlerImpl & {
21
+ __abstraction: import("@webiny/di").Abstraction<import("@webiny/api-core/features/task/TaskDefinition/abstractions").ITaskHandler<import("@webiny/api-core/features/task/TaskDefinition/abstractions").ITaskInput, import("@webiny/api-core/features/task/TaskDefinition/abstractions").ITaskOutput>>;
22
+ };
18
23
  }
19
24
  export declare const SyncFlpTask: typeof SyncFlpTaskImpl & {
20
25
  __abstraction: import("@webiny/di").Abstraction<import("@webiny/api-core/features/task/TaskDefinition/abstractions").ITaskDefinition<import("@webiny/api-core/features/task/TaskDefinition/abstractions").ITaskInput, import("@webiny/api-core/features/task/TaskDefinition/abstractions").ITaskOutput>>;
@@ -1,23 +1,14 @@
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 { ListModelsUseCase } from "@webiny/api-headless-cms/features/contentModel/ListModels/index.js";
3
3
  import { SYNC_FLP_TASK_ID, UPDATE_FLP_TASK_ID } from "./index.js";
4
4
  import { FM_FILE_TYPE } from "../../constants.js";
5
5
  import { GetFolderUseCase } from "../../features/folder/GetFolder/index.js";
6
6
  import { ListFoldersUseCase } from "../../features/folder/ListFolders/index.js";
7
- class SyncFlpTaskImpl {
7
+ class SyncFlpTaskHandlerImpl {
8
8
  constructor(getFolder, listFolders, listModels){
9
9
  this.getFolder = getFolder;
10
10
  this.listFolders = listFolders;
11
11
  this.listModels = listModels;
12
- this.id = SYNC_FLP_TASK_ID;
13
- this.title = "ACO - Sync FLP record";
14
- this.description = "Synchronizes the FLP catalog by updating the FLP record and its descendants.";
15
- this.databaseLogs = false;
16
- this.isPrivate = true;
17
- this.selfCleanup = [
18
- "onSuccess",
19
- "onAbort"
20
- ];
21
12
  }
22
13
  async run({ input, controller }) {
23
14
  try {
@@ -99,14 +90,32 @@ class SyncFlpTaskImpl {
99
90
  }
100
91
  }
101
92
  }
102
- const SyncFlpTask = TaskDefinition.createImplementation({
103
- implementation: SyncFlpTaskImpl,
93
+ const SyncFlpTaskHandler = TaskHandler.createImplementation({
94
+ implementation: SyncFlpTaskHandlerImpl,
104
95
  dependencies: [
105
96
  GetFolderUseCase,
106
97
  ListFoldersUseCase,
107
98
  ListModelsUseCase
108
99
  ]
109
100
  });
101
+ class SyncFlpTaskImpl {
102
+ constructor(){
103
+ this.id = SYNC_FLP_TASK_ID;
104
+ this.title = "ACO - Sync FLP record";
105
+ this.description = "Synchronizes the FLP catalog by updating the FLP record and its descendants.";
106
+ this.databaseLogs = false;
107
+ this.isPrivate = true;
108
+ this.selfCleanup = [
109
+ "onSuccess",
110
+ "onAbort"
111
+ ];
112
+ this.handler = SyncFlpTaskHandler;
113
+ }
114
+ }
115
+ const SyncFlpTask = TaskDefinition.createImplementation({
116
+ implementation: SyncFlpTaskImpl,
117
+ dependencies: []
118
+ });
110
119
  export { SyncFlpTask };
111
120
 
112
121
  //# sourceMappingURL=syncFlp.task.js.map