@webiny/api-aco 6.6.0-alpha.2 → 6.6.0-alpha.4

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":"flp/tasks/syncFlp.task.js","sources":["../../../src/flp/tasks/syncFlp.task.ts"],"sourcesContent":["import { TaskDefinition } from \"@webiny/api-core/features/task/TaskDefinition/index.js\";\nimport { ListModelsUseCase } from \"@webiny/api-headless-cms/features/contentModel/ListModels/index.js\";\nimport { SYNC_FLP_TASK_ID, UPDATE_FLP_TASK_ID } from \"~/flp/tasks/index.js\";\nimport { type ISyncFlpTaskInput, type IUpdateFlpTaskInput } from \"~/types.js\";\nimport { FM_FILE_TYPE } from \"~/constants.js\";\nimport { GetFolderUseCase } from \"~/features/folder/GetFolder/index.js\";\nimport { ListFoldersUseCase } from \"~/features/folder/ListFolders/index.js\";\n\nclass SyncFlpTaskImpl implements TaskDefinition.Interface<ISyncFlpTaskInput> {\n public readonly id = SYNC_FLP_TASK_ID;\n public readonly title = \"ACO - Sync FLP record\";\n public readonly description =\n \"Synchronizes the FLP catalog by updating the FLP record and its descendants.\";\n public readonly databaseLogs = false;\n public readonly isPrivate = true;\n public readonly selfCleanup = [\"onSuccess\" as const, \"onAbort\" as const];\n\n public constructor(\n private getFolder: GetFolderUseCase.Interface,\n private listFolders: ListFoldersUseCase.Interface,\n private listModels: ListModelsUseCase.Interface\n ) {}\n\n async run({ input, controller }: TaskDefinition.RunParams<ISyncFlpTaskInput>) {\n try {\n if (controller.runtime.isAborted()) {\n return controller.response.aborted();\n }\n\n /**\n * `folderId` provided in the task input. We need to:\n *\n * - update the FLP records for the found folder and all its descendants.\n */\n if (input.folderId) {\n const result = await this.getFolder.execute(input.folderId);\n if (result.isFail()) {\n return controller.response.error(result.error);\n }\n const folder = result.value;\n\n await controller.task.trigger<IUpdateFlpTaskInput>({\n definition: UPDATE_FLP_TASK_ID,\n input: {\n folder\n }\n });\n\n return controller.response.done(\n `Task completed successfully: all FLP records for folderId \"${input.folderId}\" and its children have been queued to be synchronized.`\n );\n }\n\n /**\n * Full update required. We need to:\n *\n * - list cms models to collect their types, together with the default ones [FM_FILE_TYPE]\n * - list all root folders\n * - update the FLP records for the found folders and all its descendants.\n */\n if (input.type && input.type === \"*\") {\n // Some folder types are fixed: pages and files.\n const folderTypes = [FM_FILE_TYPE];\n\n // List all non-private models\n const modelsResult = await this.listModels.execute();\n if (modelsResult.isOk()) {\n const models = modelsResult.value;\n for (const model of models) {\n folderTypes.push(`cms:${model.modelId}`);\n }\n }\n\n for (const folderType of folderTypes) {\n const result = await this.listFolders.execute({\n where: {\n type: folderType,\n parentId: null\n }\n });\n if (result.isFail()) {\n await controller.logger.error({\n message: `Failed to list root folders for type ${folderType}`,\n data: {\n type: folderType,\n error: result.error\n }\n });\n continue;\n }\n\n const { folders } = result.value;\n\n for (const folder of folders) {\n await controller.task.trigger<IUpdateFlpTaskInput>({\n definition: UPDATE_FLP_TASK_ID,\n input: {\n folder\n }\n });\n }\n\n await controller.logger.info({\n message: `FLP Update task triggered for type ${folderType}`,\n data: {\n type: folderType\n }\n });\n }\n\n return controller.response.done(\n `Task completed successfully: all FLP records have been queued to be synchronized.`\n );\n }\n\n /**\n * `type` provided in the task input. We need to:\n *\n * - list all root folders for the provided type\n * - update the FLP records for the found folders and all its descendants.\n */\n if (input.type) {\n const result = await this.listFolders.execute({\n where: {\n type: input.type!,\n parentId: null\n }\n });\n if (result.isFail()) {\n return controller.response.error(result.error);\n }\n\n const { folders } = result.value;\n\n for (const folder of folders) {\n await controller.task.trigger<IUpdateFlpTaskInput>({\n definition: UPDATE_FLP_TASK_ID,\n input: {\n folder\n }\n });\n }\n\n return controller.response.done(\n `Task completed successfully: all FLP records for type \"${input.type}\" have been queued to be synchronized.`\n );\n }\n\n return controller.response.error(\n \"Invalid input: please provide either `type` or `folderId`.\"\n );\n } catch (error) {\n return controller.response.error(error);\n }\n }\n}\n\nexport const SyncFlpTask = TaskDefinition.createImplementation({\n implementation: SyncFlpTaskImpl,\n dependencies: [GetFolderUseCase, ListFoldersUseCase, ListModelsUseCase]\n});\n"],"names":["SyncFlpTaskImpl","getFolder","listFolders","listModels","SYNC_FLP_TASK_ID","input","controller","result","folder","UPDATE_FLP_TASK_ID","folderTypes","FM_FILE_TYPE","modelsResult","models","model","folderType","folders","error","SyncFlpTask","TaskDefinition","GetFolderUseCase","ListFoldersUseCase","ListModelsUseCase"],"mappings":";;;;;;AAQA,MAAMA;IASF,YACYC,SAAqC,EACrCC,WAAyC,EACzCC,UAAuC,CACjD;aAHUF,SAAS,GAATA;aACAC,WAAW,GAAXA;aACAC,UAAU,GAAVA;aAXI,EAAE,GAAGC;aACL,KAAK,GAAG;aACR,WAAW,GACvB;aACY,YAAY,GAAG;aACf,SAAS,GAAG;aACZ,WAAW,GAAG;YAAC;YAAsB;SAAmB;IAMrE;IAEH,MAAM,IAAI,EAAEC,KAAK,EAAEC,UAAU,EAA+C,EAAE;QAC1E,IAAI;YACA,IAAIA,WAAW,OAAO,CAAC,SAAS,IAC5B,OAAOA,WAAW,QAAQ,CAAC,OAAO;YAQtC,IAAID,MAAM,QAAQ,EAAE;gBAChB,MAAME,SAAS,MAAM,IAAI,CAAC,SAAS,CAAC,OAAO,CAACF,MAAM,QAAQ;gBAC1D,IAAIE,OAAO,MAAM,IACb,OAAOD,WAAW,QAAQ,CAAC,KAAK,CAACC,OAAO,KAAK;gBAEjD,MAAMC,SAASD,OAAO,KAAK;gBAE3B,MAAMD,WAAW,IAAI,CAAC,OAAO,CAAsB;oBAC/C,YAAYG;oBACZ,OAAO;wBACHD;oBACJ;gBACJ;gBAEA,OAAOF,WAAW,QAAQ,CAAC,IAAI,CAC3B,CAAC,2DAA2D,EAAED,MAAM,QAAQ,CAAC,uDAAuD,CAAC;YAE7I;YASA,IAAIA,MAAM,IAAI,IAAIA,AAAe,QAAfA,MAAM,IAAI,EAAU;gBAElC,MAAMK,cAAc;oBAACC;iBAAa;gBAGlC,MAAMC,eAAe,MAAM,IAAI,CAAC,UAAU,CAAC,OAAO;gBACl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AC/C,YAAYG;oBACZ,OAAO;wBACHD;oBACJ;gBACJ;gBAGJ,OAAOF,WAAW,QAAQ,CAAC,IAAI,CAC3B,CAAC,uDAAuD,EAAED,MAAM,IAAI,CAAC,sCAAsC,CAAC;YAEpH;YAEA,OAAOC,WAAW,QAAQ,CAAC,KAAK,CAC5B;QAER,EAAE,OAAOW,OAAO;YACZ,OAAOX,WAAW,QAAQ,CAAC,KAAK,CAACW;QACrC;IACJ;AACJ;AAEO,MAAMC,cAAcC,eAAe,oBAAoB,CAAC;IAC3D,gBAAgBnB;IAChB,cAAc;QAACoB;QAAkBC;QAAoBC;KAAkB;AAC3E"}
1
+ {"version":3,"file":"flp/tasks/syncFlp.task.js","sources":["../../../src/flp/tasks/syncFlp.task.ts"],"sourcesContent":["import {\n TaskDefinition,\n TaskHandler\n} from \"@webiny/api-core/features/task/TaskDefinition/index.js\";\nimport { ListModelsUseCase } from \"@webiny/api-headless-cms/features/contentModel/ListModels/index.js\";\nimport { SYNC_FLP_TASK_ID, UPDATE_FLP_TASK_ID } from \"~/flp/tasks/index.js\";\nimport { type ISyncFlpTaskInput, type IUpdateFlpTaskInput } from \"~/types.js\";\nimport { FM_FILE_TYPE } from \"~/constants.js\";\nimport { GetFolderUseCase } from \"~/features/folder/GetFolder/index.js\";\nimport { ListFoldersUseCase } from \"~/features/folder/ListFolders/index.js\";\n\nclass SyncFlpTaskHandlerImpl implements TaskHandler.Interface<ISyncFlpTaskInput> {\n public constructor(\n private getFolder: GetFolderUseCase.Interface,\n private listFolders: ListFoldersUseCase.Interface,\n private listModels: ListModelsUseCase.Interface\n ) {}\n\n async run({ input, controller }: TaskHandler.RunParams<ISyncFlpTaskInput>) {\n try {\n if (controller.runtime.isAborted()) {\n return controller.response.aborted();\n }\n\n /**\n * `folderId` provided in the task input. We need to:\n *\n * - update the FLP records for the found folder and all its descendants.\n */\n if (input.folderId) {\n const result = await this.getFolder.execute(input.folderId);\n if (result.isFail()) {\n return controller.response.error(result.error);\n }\n const folder = result.value;\n\n await controller.task.trigger<IUpdateFlpTaskInput>({\n definition: UPDATE_FLP_TASK_ID,\n input: {\n folder\n }\n });\n\n return controller.response.done(\n `Task completed successfully: all FLP records for folderId \"${input.folderId}\" and its children have been queued to be synchronized.`\n );\n }\n\n /**\n * Full update required. We need to:\n *\n * - list cms models to collect their types, together with the default ones [FM_FILE_TYPE]\n * - list all root folders\n * - update the FLP records for the found folders and all its descendants.\n */\n if (input.type && input.type === \"*\") {\n // Some folder types are fixed: pages and files.\n const folderTypes = [FM_FILE_TYPE];\n\n // List all non-private models\n const modelsResult = await this.listModels.execute();\n if (modelsResult.isOk()) {\n const models = modelsResult.value;\n for (const model of models) {\n folderTypes.push(`cms:${model.modelId}`);\n }\n }\n\n for (const folderType of folderTypes) {\n const result = await this.listFolders.execute({\n where: {\n type: folderType,\n parentId: null\n }\n });\n if (result.isFail()) {\n await controller.logger.error({\n message: `Failed to list root folders for type ${folderType}`,\n data: {\n type: folderType,\n error: result.error\n }\n });\n continue;\n }\n\n const { folders } = result.value;\n\n for (const folder of folders) {\n await controller.task.trigger<IUpdateFlpTaskInput>({\n definition: UPDATE_FLP_TASK_ID,\n input: {\n folder\n }\n });\n }\n\n await controller.logger.info({\n message: `FLP Update task triggered for type ${folderType}`,\n data: {\n type: folderType\n }\n });\n }\n\n return controller.response.done(\n `Task completed successfully: all FLP records have been queued to be synchronized.`\n );\n }\n\n /**\n * `type` provided in the task input. We need to:\n *\n * - list all root folders for the provided type\n * - update the FLP records for the found folders and all its descendants.\n */\n if (input.type) {\n const result = await this.listFolders.execute({\n where: {\n type: input.type!,\n parentId: null\n }\n });\n if (result.isFail()) {\n return controller.response.error(result.error);\n }\n\n const { folders } = result.value;\n\n for (const folder of folders) {\n await controller.task.trigger<IUpdateFlpTaskInput>({\n definition: UPDATE_FLP_TASK_ID,\n input: {\n folder\n }\n });\n }\n\n return controller.response.done(\n `Task completed successfully: all FLP records for type \"${input.type}\" have been queued to be synchronized.`\n );\n }\n\n return controller.response.error(\n \"Invalid input: please provide either `type` or `folderId`.\"\n );\n } catch (error) {\n return controller.response.error(error);\n }\n }\n}\n\nconst SyncFlpTaskHandler = TaskHandler.createImplementation({\n implementation: SyncFlpTaskHandlerImpl,\n dependencies: [GetFolderUseCase, ListFoldersUseCase, ListModelsUseCase]\n});\n\nclass SyncFlpTaskImpl implements TaskDefinition.Interface {\n public readonly id = SYNC_FLP_TASK_ID;\n public readonly title = \"ACO - Sync FLP record\";\n public readonly description =\n \"Synchronizes the FLP catalog by updating the FLP record and its descendants.\";\n public readonly databaseLogs = false;\n public readonly isPrivate = true;\n public readonly selfCleanup = [\"onSuccess\" as const, \"onAbort\" as const];\n\n handler = SyncFlpTaskHandler;\n}\n\nexport const SyncFlpTask = TaskDefinition.createImplementation({\n implementation: SyncFlpTaskImpl,\n dependencies: []\n});\n"],"names":["SyncFlpTaskHandlerImpl","getFolder","listFolders","listModels","input","controller","result","folder","UPDATE_FLP_TASK_ID","folderTypes","FM_FILE_TYPE","modelsResult","models","model","folderType","folders","error","SyncFlpTaskHandler","TaskHandler","GetFolderUseCase","ListFoldersUseCase","ListModelsUseCase","SyncFlpTaskImpl","SYNC_FLP_TASK_ID","SyncFlpTask","TaskDefinition"],"mappings":";;;;;;AAWA,MAAMA;IACF,YACYC,SAAqC,EACrCC,WAAyC,EACzCC,UAAuC,CACjD;aAHUF,SAAS,GAATA;aACAC,WAAW,GAAXA;aACAC,UAAU,GAAVA;IACT;IAEH,MAAM,IAAI,EAAEC,KAAK,EAAEC,UAAU,EAA4C,EAAE;QACvE,IAAI;YACA,IAAIA,WAAW,OAAO,CAAC,SAAS,IAC5B,OAAOA,WAAW,QAAQ,CAAC,OAAO;YAQtC,IAAID,MAAM,QAAQ,EAAE;gBAChB,MAAME,SAAS,MAAM,IAAI,CAAC,SAAS,CAAC,OAAO,CAACF,MAAM,QAAQ;gBAC1D,IAAIE,OAAO,MAAM,IACb,OAAOD,WAAW,QAAQ,CAAC,KAAK,CAACC,OAAO,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,WAAW,QAAQ,CAAC,IAAI,CAC3B;YAER;YAQA,IAAID,MAAM,IAAI,EAAE;gBACZ,MAAME,SAAS,MAAM,IAAI,CAAC,WAAW,CAAC,OAAO,CAAC;oBAC1C,OAAO;wBACH,MAAMF,MAAM,IAAI;wBAChB,UAAU;oBACd;gBACJ;gBACA,IAAIE,OAAO,MAAM,IACb,OAAOD,WAAW,QAAQ,CAAC,KAAK,CAACC,OAAO,KAAK;gBAGjD,MAAM,EAAES,OAAO,EAAE,GAAGT,OAAO,KAAK;gBAEhC,KAAK,MAAMC,UAAUQ,QACjB,MAAMV,WAAW,IAAI,CAAC,OAAO,CAAsB;oBAC/C,YAAYG;oBACZ,OAAO;wBACHD;oBACJ;gBACJ;gBAGJ,OAAOF,WAAW,QAAQ,CAAC,IAAI,CAC3B,CAAC,uDAAuD,EAAED,MAAM,IAAI,CAAC,sCAAsC,CAAC;YAEpH;YAEA,OAAOC,WAAW,QAAQ,CAAC,KAAK,CAC5B;QAER,EAAE,OAAOW,OAAO;YACZ,OAAOX,WAAW,QAAQ,CAAC,KAAK,CAACW;QACrC;IACJ;AACJ;AAEA,MAAMC,qBAAqBC,YAAY,oBAAoB,CAAC;IACxD,gBAAgBlB;IAChB,cAAc;QAACmB;QAAkBC;QAAoBC;KAAkB;AAC3E;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,GAAGN;;AACd;AAEO,MAAMO,cAAcC,eAAe,oBAAoB,CAAC;IAC3D,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 IUpdateFlpTaskInput } from "../../types.js";
3
3
  import { UpdateFlpUseCase } from "../../features/flp/UpdateFlp/index.js";
4
- declare class UpdateFlpTaskImpl implements TaskDefinition.Interface<IUpdateFlpTaskInput> {
4
+ declare class UpdateFlpTaskHandlerImpl implements TaskHandler.Interface<IUpdateFlpTaskInput> {
5
5
  private updateFlp;
6
+ constructor(updateFlp: UpdateFlpUseCase.Interface);
7
+ run({ input, controller }: TaskHandler.RunParams<IUpdateFlpTaskInput>): 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>>;
8
+ }
9
+ declare class UpdateFlpTaskImpl implements TaskDefinition.Interface {
6
10
  readonly id = "acoUpdateFlp";
7
11
  readonly title = "ACO - Update FLP record";
8
12
  readonly description = "Synchronizes the FLP catalog by updating the FLP record and its descendants based on the provided folder.";
9
13
  readonly databaseLogs = false;
10
14
  readonly isPrivate = true;
11
15
  readonly selfCleanup: ("onAbort" | "onSuccess")[];
12
- constructor(updateFlp: UpdateFlpUseCase.Interface);
13
- run({ input, controller }: TaskDefinition.RunParams<IUpdateFlpTaskInput>): 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>>;
16
+ handler: typeof UpdateFlpTaskHandlerImpl & {
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 UpdateFlpTask: typeof UpdateFlpTaskImpl & {
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 { UPDATE_FLP_TASK_ID } from "./index.js";
3
3
  import { UpdateFlpUseCase } from "../../features/flp/UpdateFlp/index.js";
4
- class UpdateFlpTaskImpl {
4
+ class UpdateFlpTaskHandlerImpl {
5
5
  constructor(updateFlp){
6
6
  this.updateFlp = updateFlp;
7
- this.id = UPDATE_FLP_TASK_ID;
8
- this.title = "ACO - Update FLP record";
9
- this.description = "Synchronizes the FLP catalog by updating the FLP record and its descendants 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 {
@@ -32,12 +23,30 @@ class UpdateFlpTaskImpl {
32
23
  }
33
24
  }
34
25
  }
35
- const UpdateFlpTask = TaskDefinition.createImplementation({
36
- implementation: UpdateFlpTaskImpl,
26
+ const UpdateFlpTaskHandler = TaskHandler.createImplementation({
27
+ implementation: UpdateFlpTaskHandlerImpl,
37
28
  dependencies: [
38
29
  UpdateFlpUseCase
39
30
  ]
40
31
  });
32
+ class UpdateFlpTaskImpl {
33
+ constructor(){
34
+ this.id = UPDATE_FLP_TASK_ID;
35
+ this.title = "ACO - Update FLP record";
36
+ this.description = "Synchronizes the FLP catalog by updating the FLP record and its descendants based on the provided folder.";
37
+ this.databaseLogs = false;
38
+ this.isPrivate = true;
39
+ this.selfCleanup = [
40
+ "onSuccess",
41
+ "onAbort"
42
+ ];
43
+ this.handler = UpdateFlpTaskHandler;
44
+ }
45
+ }
46
+ const UpdateFlpTask = TaskDefinition.createImplementation({
47
+ implementation: UpdateFlpTaskImpl,
48
+ dependencies: []
49
+ });
41
50
  export { UpdateFlpTask };
42
51
 
43
52
  //# sourceMappingURL=updateFlp.task.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"flp/tasks/updateFlp.task.js","sources":["../../../src/flp/tasks/updateFlp.task.ts"],"sourcesContent":["import { TaskDefinition } from \"@webiny/api-core/features/task/TaskDefinition/index.js\";\nimport { UPDATE_FLP_TASK_ID } from \"~/flp/tasks/index.js\";\nimport { type IUpdateFlpTaskInput } from \"~/types.js\";\nimport { UpdateFlpUseCase } from \"~/features/flp/UpdateFlp/index.js\";\n\nclass UpdateFlpTaskImpl implements TaskDefinition.Interface<IUpdateFlpTaskInput> {\n public readonly id = UPDATE_FLP_TASK_ID;\n public readonly title = \"ACO - Update FLP record\";\n public readonly description =\n \"Synchronizes the FLP catalog by updating the FLP record and its descendants 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 public constructor(private updateFlp: UpdateFlpUseCase.Interface) {}\n\n async run({ input, controller }: TaskDefinition.RunParams<IUpdateFlpTaskInput>) {\n try {\n if (controller.runtime.isAborted()) {\n return controller.response.aborted();\n }\n\n await this.updateFlp.execute({\n folder: input.folder,\n queued: input.queued,\n isCloseToTimeout: controller.runtime.isCloseToTimeout,\n handleTimeout: queued => controller.response.continue({ ...input, queued })\n });\n\n return controller.response.done(\"Task done: FLP record updated.\");\n } catch (error) {\n return controller.response.error(error);\n }\n }\n}\n\nexport const UpdateFlpTask = TaskDefinition.createImplementation({\n implementation: UpdateFlpTaskImpl,\n dependencies: [UpdateFlpUseCase]\n});\n"],"names":["UpdateFlpTaskImpl","updateFlp","UPDATE_FLP_TASK_ID","input","controller","queued","error","UpdateFlpTask","TaskDefinition","UpdateFlpUseCase"],"mappings":";;;AAKA,MAAMA;IASF,YAA2BC,SAAqC,CAAE;aAAvCA,SAAS,GAATA;aARX,EAAE,GAAGC;aACL,KAAK,GAAG;aACR,WAAW,GACvB;aACY,YAAY,GAAG;aACf,SAAS,GAAG;aACZ,WAAW,GAAG;YAAC;YAAsB;SAAmB;IAEL;IAEnE,MAAM,IAAI,EAAEC,KAAK,EAAEC,UAAU,EAAiD,EAAE;QAC5E,IAAI;YACA,IAAIA,WAAW,OAAO,CAAC,SAAS,IAC5B,OAAOA,WAAW,QAAQ,CAAC,OAAO;YAGtC,MAAM,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC;gBACzB,QAAQD,MAAM,MAAM;gBACpB,QAAQA,MAAM,MAAM;gBACpB,kBAAkBC,WAAW,OAAO,CAAC,gBAAgB;gBACrD,eAAeC,CAAAA,SAAUD,WAAW,QAAQ,CAAC,QAAQ,CAAC;wBAAE,GAAGD,KAAK;wBAAEE;oBAAO;YAC7E;YAEA,OAAOD,WAAW,QAAQ,CAAC,IAAI,CAAC;QACpC,EAAE,OAAOE,OAAO;YACZ,OAAOF,WAAW,QAAQ,CAAC,KAAK,CAACE;QACrC;IACJ;AACJ;AAEO,MAAMC,gBAAgBC,eAAe,oBAAoB,CAAC;IAC7D,gBAAgBR;IAChB,cAAc;QAACS;KAAiB;AACpC"}
1
+ {"version":3,"file":"flp/tasks/updateFlp.task.js","sources":["../../../src/flp/tasks/updateFlp.task.ts"],"sourcesContent":["import {\n TaskDefinition,\n TaskHandler\n} from \"@webiny/api-core/features/task/TaskDefinition/index.js\";\nimport { UPDATE_FLP_TASK_ID } from \"~/flp/tasks/index.js\";\nimport { type IUpdateFlpTaskInput } from \"~/types.js\";\nimport { UpdateFlpUseCase } from \"~/features/flp/UpdateFlp/index.js\";\n\nclass UpdateFlpTaskHandlerImpl implements TaskHandler.Interface<IUpdateFlpTaskInput> {\n public constructor(private updateFlp: UpdateFlpUseCase.Interface) {}\n\n async run({ input, controller }: TaskHandler.RunParams<IUpdateFlpTaskInput>) {\n try {\n if (controller.runtime.isAborted()) {\n return controller.response.aborted();\n }\n\n await this.updateFlp.execute({\n folder: input.folder,\n queued: input.queued,\n isCloseToTimeout: controller.runtime.isCloseToTimeout,\n handleTimeout: queued => controller.response.continue({ ...input, queued })\n });\n\n return controller.response.done(\"Task done: FLP record updated.\");\n } catch (error) {\n return controller.response.error(error);\n }\n }\n}\n\nconst UpdateFlpTaskHandler = TaskHandler.createImplementation({\n implementation: UpdateFlpTaskHandlerImpl,\n dependencies: [UpdateFlpUseCase]\n});\n\nclass UpdateFlpTaskImpl implements TaskDefinition.Interface {\n public readonly id = UPDATE_FLP_TASK_ID;\n public readonly title = \"ACO - Update FLP record\";\n public readonly description =\n \"Synchronizes the FLP catalog by updating the FLP record and its descendants 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 = UpdateFlpTaskHandler;\n}\n\nexport const UpdateFlpTask = TaskDefinition.createImplementation({\n implementation: UpdateFlpTaskImpl,\n dependencies: []\n});\n"],"names":["UpdateFlpTaskHandlerImpl","updateFlp","input","controller","queued","error","UpdateFlpTaskHandler","TaskHandler","UpdateFlpUseCase","UpdateFlpTaskImpl","UPDATE_FLP_TASK_ID","UpdateFlpTask","TaskDefinition"],"mappings":";;;AAQA,MAAMA;IACF,YAA2BC,SAAqC,CAAE;aAAvCA,SAAS,GAATA;IAAwC;IAEnE,MAAM,IAAI,EAAEC,KAAK,EAAEC,UAAU,EAA8C,EAAE;QACzE,IAAI;YACA,IAAIA,WAAW,OAAO,CAAC,SAAS,IAC5B,OAAOA,WAAW,QAAQ,CAAC,OAAO;YAGtC,MAAM,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC;gBACzB,QAAQD,MAAM,MAAM;gBACpB,QAAQA,MAAM,MAAM;gBACpB,kBAAkBC,WAAW,OAAO,CAAC,gBAAgB;gBACrD,eAAeC,CAAAA,SAAUD,WAAW,QAAQ,CAAC,QAAQ,CAAC;wBAAE,GAAGD,KAAK;wBAAEE;oBAAO;YAC7E;YAEA,OAAOD,WAAW,QAAQ,CAAC,IAAI,CAAC;QACpC,EAAE,OAAOE,OAAO;YACZ,OAAOF,WAAW,QAAQ,CAAC,KAAK,CAACE;QACrC;IACJ;AACJ;AAEA,MAAMC,uBAAuBC,YAAY,oBAAoB,CAAC;IAC1D,gBAAgBP;IAChB,cAAc;QAACQ;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"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@webiny/api-aco",
3
- "version": "6.6.0-alpha.2",
3
+ "version": "6.6.0-alpha.4",
4
4
  "type": "module",
5
5
  "keywords": [
6
6
  "aco:base"
@@ -21,29 +21,29 @@
21
21
  ".": "./index.js"
22
22
  },
23
23
  "dependencies": {
24
- "@webiny/api-core": "6.6.0-alpha.2",
25
- "@webiny/api-graphql": "6.6.0-alpha.2",
26
- "@webiny/api-headless-cms": "6.6.0-alpha.2",
27
- "@webiny/background-tasks": "6.6.0-alpha.2",
24
+ "@webiny/api-core": "6.6.0-alpha.4",
25
+ "@webiny/api-graphql": "6.6.0-alpha.4",
26
+ "@webiny/api-headless-cms": "6.6.0-alpha.4",
27
+ "@webiny/background-tasks": "6.6.0-alpha.4",
28
28
  "@webiny/di": "1.1.0",
29
- "@webiny/error": "6.6.0-alpha.2",
30
- "@webiny/event-handler-core": "6.6.0-alpha.2",
31
- "@webiny/feature": "6.6.0-alpha.2",
32
- "@webiny/handler": "6.6.0-alpha.2",
33
- "@webiny/shared-aco": "6.6.0-alpha.2",
34
- "@webiny/utils": "6.6.0-alpha.2",
35
- "@webiny/validation": "6.6.0-alpha.2",
29
+ "@webiny/error": "6.6.0-alpha.4",
30
+ "@webiny/event-handler-core": "6.6.0-alpha.4",
31
+ "@webiny/feature": "6.6.0-alpha.4",
32
+ "@webiny/handler": "6.6.0-alpha.4",
33
+ "@webiny/shared-aco": "6.6.0-alpha.4",
34
+ "@webiny/utils": "6.6.0-alpha.4",
35
+ "@webiny/validation": "6.6.0-alpha.4",
36
36
  "lodash": "4.18.1",
37
37
  "zod": "4.4.3"
38
38
  },
39
39
  "devDependencies": {
40
- "@webiny/api": "6.6.0-alpha.2",
41
- "@webiny/api-core-testing": "6.6.0-alpha.2",
42
- "@webiny/api-file-manager": "6.6.0-alpha.2",
43
- "@webiny/api-headless-cms-testing": "6.6.0-alpha.2",
44
- "@webiny/build-tools": "6.6.0-alpha.2",
45
- "@webiny/plugins": "6.6.0-alpha.2",
46
- "@webiny/wcp": "6.6.0-alpha.2",
40
+ "@webiny/api": "6.6.0-alpha.4",
41
+ "@webiny/api-core-testing": "6.6.0-alpha.4",
42
+ "@webiny/api-file-manager": "6.6.0-alpha.4",
43
+ "@webiny/api-headless-cms-testing": "6.6.0-alpha.4",
44
+ "@webiny/build-tools": "6.6.0-alpha.4",
45
+ "@webiny/plugins": "6.6.0-alpha.4",
46
+ "@webiny/wcp": "6.6.0-alpha.4",
47
47
  "graphql": "16.14.2",
48
48
  "rimraf": "6.1.3",
49
49
  "typescript": "7.0.2",