@webiny/tasks 6.0.0-alpha.5 → 6.0.0-rc.0

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 (298) hide show
  1. package/README.md +10 -9
  2. package/context.js +43 -21
  3. package/context.js.map +1 -1
  4. package/crud/TaskLogPrivateModel.d.ts +9 -0
  5. package/crud/TaskLogPrivateModel.js +34 -0
  6. package/crud/TaskLogPrivateModel.js.map +1 -0
  7. package/crud/TaskPrivateModel.d.ts +9 -0
  8. package/crud/TaskPrivateModel.js +46 -0
  9. package/crud/TaskPrivateModel.js.map +1 -0
  10. package/crud/crud.tasks.d.ts +1 -1
  11. package/crud/crud.tasks.js +209 -104
  12. package/crud/crud.tasks.js.map +1 -1
  13. package/crud/definition.tasks.d.ts +1 -1
  14. package/crud/definition.tasks.js +9 -18
  15. package/crud/definition.tasks.js.map +1 -1
  16. package/crud/service.tasks.d.ts +1 -1
  17. package/crud/service.tasks.js +31 -36
  18. package/crud/service.tasks.js.map +1 -1
  19. package/decorators/RunnableTaskDecorator.d.ts +31 -0
  20. package/decorators/RunnableTaskDecorator.js +82 -0
  21. package/decorators/RunnableTaskDecorator.js.map +1 -0
  22. package/domain/errors.d.ts +29 -0
  23. package/domain/errors.js +47 -0
  24. package/domain/errors.js.map +1 -0
  25. package/events/TaskAfterCreateEvent.d.ts +6 -0
  26. package/events/TaskAfterCreateEvent.js +10 -0
  27. package/events/TaskAfterCreateEvent.js.map +1 -0
  28. package/events/TaskAfterDeleteEvent.d.ts +6 -0
  29. package/events/TaskAfterDeleteEvent.js +10 -0
  30. package/events/TaskAfterDeleteEvent.js.map +1 -0
  31. package/events/TaskAfterUpdateEvent.d.ts +6 -0
  32. package/events/TaskAfterUpdateEvent.js +10 -0
  33. package/events/TaskAfterUpdateEvent.js.map +1 -0
  34. package/events/TaskBeforeCreateEvent.d.ts +6 -0
  35. package/events/TaskBeforeCreateEvent.js +10 -0
  36. package/events/TaskBeforeCreateEvent.js.map +1 -0
  37. package/events/TaskBeforeDeleteEvent.d.ts +6 -0
  38. package/events/TaskBeforeDeleteEvent.js +10 -0
  39. package/events/TaskBeforeDeleteEvent.js.map +1 -0
  40. package/events/TaskBeforeUpdateEvent.d.ts +6 -0
  41. package/events/TaskBeforeUpdateEvent.js +10 -0
  42. package/events/TaskBeforeUpdateEvent.js.map +1 -0
  43. package/events/abstractions.d.ts +53 -0
  44. package/events/abstractions.js +39 -0
  45. package/events/abstractions.js.map +1 -0
  46. package/events/index.d.ts +7 -0
  47. package/events/index.js +9 -0
  48. package/events/index.js.map +1 -0
  49. package/features/AbortTask/AbortTaskUseCase.d.ts +10 -0
  50. package/features/AbortTask/AbortTaskUseCase.js +11 -0
  51. package/features/AbortTask/AbortTaskUseCase.js.map +1 -0
  52. package/features/AbortTask/abstractions.d.ts +25 -0
  53. package/features/AbortTask/abstractions.js +4 -0
  54. package/features/AbortTask/abstractions.js.map +1 -0
  55. package/features/AbortTask/feature.d.ts +2 -0
  56. package/features/AbortTask/feature.js +11 -0
  57. package/features/AbortTask/feature.js.map +1 -0
  58. package/features/AbortTask/index.d.ts +2 -0
  59. package/features/AbortTask/index.js +4 -0
  60. package/features/AbortTask/index.js.map +1 -0
  61. package/features/GetTask/GetTaskUseCase.d.ts +9 -0
  62. package/features/GetTask/GetTaskUseCase.js +10 -0
  63. package/features/GetTask/GetTaskUseCase.js.map +1 -0
  64. package/features/GetTask/abstractions.d.ts +10 -0
  65. package/features/GetTask/abstractions.js +4 -0
  66. package/features/GetTask/abstractions.js.map +1 -0
  67. package/features/GetTask/feature.d.ts +2 -0
  68. package/features/GetTask/feature.js +11 -0
  69. package/features/GetTask/feature.js.map +1 -0
  70. package/features/GetTask/index.d.ts +2 -0
  71. package/features/GetTask/index.js +4 -0
  72. package/features/GetTask/index.js.map +1 -0
  73. package/features/GetTaskDefinition/GetTaskDefinitionUseCase.d.ts +12 -0
  74. package/features/GetTaskDefinition/GetTaskDefinitionUseCase.js +25 -0
  75. package/features/GetTaskDefinition/GetTaskDefinitionUseCase.js.map +1 -0
  76. package/features/GetTaskDefinition/abstractions.d.ts +17 -0
  77. package/features/GetTaskDefinition/abstractions.js +4 -0
  78. package/features/GetTaskDefinition/abstractions.js.map +1 -0
  79. package/features/GetTaskDefinition/feature.d.ts +1 -0
  80. package/features/GetTaskDefinition/feature.js +10 -0
  81. package/features/GetTaskDefinition/feature.js.map +1 -0
  82. package/features/GetTaskDefinition/index.d.ts +2 -0
  83. package/features/GetTaskDefinition/index.js +4 -0
  84. package/features/GetTaskDefinition/index.js.map +1 -0
  85. package/features/ListTaskDefinitions/ListTaskDefinitionsUseCase.d.ts +11 -0
  86. package/features/ListTaskDefinitions/ListTaskDefinitionsUseCase.js +18 -0
  87. package/features/ListTaskDefinitions/ListTaskDefinitionsUseCase.js.map +1 -0
  88. package/features/ListTaskDefinitions/abstractions.d.ts +9 -0
  89. package/features/ListTaskDefinitions/abstractions.js +4 -0
  90. package/features/ListTaskDefinitions/abstractions.js.map +1 -0
  91. package/features/ListTaskDefinitions/feature.d.ts +1 -0
  92. package/features/ListTaskDefinitions/feature.js +10 -0
  93. package/features/ListTaskDefinitions/feature.js.map +1 -0
  94. package/features/ListTaskDefinitions/index.d.ts +2 -0
  95. package/features/ListTaskDefinitions/index.js +4 -0
  96. package/features/ListTaskDefinitions/index.js.map +1 -0
  97. package/features/ListTasks/ListTasksUseCase.d.ts +9 -0
  98. package/features/ListTasks/ListTasksUseCase.js +10 -0
  99. package/features/ListTasks/ListTasksUseCase.js.map +1 -0
  100. package/features/ListTasks/abstractions.d.ts +13 -0
  101. package/features/ListTasks/abstractions.js +4 -0
  102. package/features/ListTasks/abstractions.js.map +1 -0
  103. package/features/ListTasks/feature.d.ts +2 -0
  104. package/features/ListTasks/feature.js +11 -0
  105. package/features/ListTasks/feature.js.map +1 -0
  106. package/features/ListTasks/index.d.ts +2 -0
  107. package/features/ListTasks/index.js +4 -0
  108. package/features/ListTasks/index.js.map +1 -0
  109. package/features/TaskController/TaskController.d.ts +49 -0
  110. package/features/TaskController/TaskController.js +71 -0
  111. package/features/TaskController/TaskController.js.map +1 -0
  112. package/features/TaskController/augmentation.d.ts +60 -0
  113. package/features/TaskController/augmentation.js +3 -0
  114. package/features/TaskController/augmentation.js.map +1 -0
  115. package/features/TaskController/index.d.ts +2 -0
  116. package/features/TaskController/index.js +7 -0
  117. package/features/TaskController/index.js.map +1 -0
  118. package/features/TaskExecutionContext/TaskExecutionContext.d.ts +24 -0
  119. package/features/TaskExecutionContext/TaskExecutionContext.js +50 -0
  120. package/features/TaskExecutionContext/TaskExecutionContext.js.map +1 -0
  121. package/features/TaskExecutionContext/abstractions.d.ts +26 -0
  122. package/features/TaskExecutionContext/abstractions.js +13 -0
  123. package/features/TaskExecutionContext/abstractions.js.map +1 -0
  124. package/features/TaskExecutionContext/feature.d.ts +1 -0
  125. package/features/TaskExecutionContext/feature.js +10 -0
  126. package/features/TaskExecutionContext/feature.js.map +1 -0
  127. package/features/TaskExecutionContext/index.d.ts +1 -0
  128. package/features/TaskExecutionContext/index.js +3 -0
  129. package/features/TaskExecutionContext/index.js.map +1 -0
  130. package/features/TriggerTask/TriggerTaskUseCase.d.ts +10 -0
  131. package/features/TriggerTask/TriggerTaskUseCase.js +11 -0
  132. package/features/TriggerTask/TriggerTaskUseCase.js.map +1 -0
  133. package/features/TriggerTask/abstractions.d.ts +28 -0
  134. package/features/TriggerTask/abstractions.js +4 -0
  135. package/features/TriggerTask/abstractions.js.map +1 -0
  136. package/features/TriggerTask/feature.d.ts +2 -0
  137. package/features/TriggerTask/feature.js +11 -0
  138. package/features/TriggerTask/feature.js.map +1 -0
  139. package/features/TriggerTask/index.d.ts +2 -0
  140. package/features/TriggerTask/index.js +4 -0
  141. package/features/TriggerTask/index.js.map +1 -0
  142. package/global.d.ts +1 -0
  143. package/global.js +3 -0
  144. package/global.js.map +1 -0
  145. package/graphql/checkPermissions.d.ts +1 -1
  146. package/graphql/checkPermissions.js +3 -9
  147. package/graphql/checkPermissions.js.map +1 -1
  148. package/graphql/index.d.ts +1 -1
  149. package/graphql/index.js +58 -61
  150. package/graphql/index.js.map +1 -1
  151. package/graphql/utils.d.ts +1 -1
  152. package/graphql/utils.js +8 -17
  153. package/graphql/utils.js.map +1 -1
  154. package/handler/index.d.ts +2 -2
  155. package/handler/index.js +33 -40
  156. package/handler/index.js.map +1 -1
  157. package/handler/register.js +5 -7
  158. package/handler/register.js.map +1 -1
  159. package/handler/types.d.ts +1 -3
  160. package/handler/types.js +1 -5
  161. package/handler/types.js.map +1 -1
  162. package/index.d.ts +5 -6
  163. package/index.js +5 -60
  164. package/index.js.map +1 -1
  165. package/package.json +22 -26
  166. package/plugins/TaskServicePlugin.d.ts +1 -2
  167. package/plugins/TaskServicePlugin.js +2 -9
  168. package/plugins/TaskServicePlugin.js.map +1 -1
  169. package/plugins/index.d.ts +1 -1
  170. package/plugins/index.js +1 -16
  171. package/plugins/index.js.map +1 -1
  172. package/response/DatabaseResponse.d.ts +3 -3
  173. package/response/DatabaseResponse.js +14 -20
  174. package/response/DatabaseResponse.js.map +1 -1
  175. package/response/Response.d.ts +4 -3
  176. package/response/Response.js +20 -31
  177. package/response/Response.js.map +1 -1
  178. package/response/ResponseAbortedResult.d.ts +3 -4
  179. package/response/ResponseAbortedResult.js +3 -11
  180. package/response/ResponseAbortedResult.js.map +1 -1
  181. package/response/ResponseContinueResult.d.ts +4 -5
  182. package/response/ResponseContinueResult.js +3 -11
  183. package/response/ResponseContinueResult.js.map +1 -1
  184. package/response/ResponseDoneResult.d.ts +4 -6
  185. package/response/ResponseDoneResult.js +3 -11
  186. package/response/ResponseDoneResult.js.map +1 -1
  187. package/response/ResponseErrorResult.d.ts +3 -4
  188. package/response/ResponseErrorResult.js +3 -11
  189. package/response/ResponseErrorResult.js.map +1 -1
  190. package/response/TaskResponse.d.ts +7 -6
  191. package/response/TaskResponse.js +5 -12
  192. package/response/TaskResponse.js.map +1 -1
  193. package/response/abstractions/Response.d.ts +7 -7
  194. package/response/abstractions/Response.js +1 -5
  195. package/response/abstractions/Response.js.map +1 -1
  196. package/response/abstractions/ResponseAbortedResult.d.ts +3 -3
  197. package/response/abstractions/ResponseAbortedResult.js +1 -5
  198. package/response/abstractions/ResponseAbortedResult.js.map +1 -1
  199. package/response/abstractions/ResponseBaseResult.d.ts +2 -3
  200. package/response/abstractions/ResponseBaseResult.js +1 -5
  201. package/response/abstractions/ResponseBaseResult.js.map +1 -1
  202. package/response/abstractions/ResponseContinueResult.d.ts +4 -4
  203. package/response/abstractions/ResponseContinueResult.js +1 -5
  204. package/response/abstractions/ResponseContinueResult.js.map +1 -1
  205. package/response/abstractions/ResponseDoneResult.d.ts +5 -6
  206. package/response/abstractions/ResponseDoneResult.js +1 -5
  207. package/response/abstractions/ResponseDoneResult.js.map +1 -1
  208. package/response/abstractions/ResponseErrorResult.d.ts +4 -5
  209. package/response/abstractions/ResponseErrorResult.js +1 -5
  210. package/response/abstractions/ResponseErrorResult.js.map +1 -1
  211. package/response/abstractions/TaskResponse.d.ts +8 -30
  212. package/response/abstractions/TaskResponse.js +1 -5
  213. package/response/abstractions/TaskResponse.js.map +1 -1
  214. package/response/abstractions/index.d.ts +7 -7
  215. package/response/abstractions/index.js +7 -82
  216. package/response/abstractions/index.js.map +1 -1
  217. package/response/index.d.ts +7 -7
  218. package/response/index.js +7 -82
  219. package/response/index.js.map +1 -1
  220. package/runner/TaskControl.d.ts +4 -4
  221. package/runner/TaskControl.js +61 -39
  222. package/runner/TaskControl.js.map +1 -1
  223. package/runner/TaskEventValidation.d.ts +2 -2
  224. package/runner/TaskEventValidation.js +11 -20
  225. package/runner/TaskEventValidation.js.map +1 -1
  226. package/runner/TaskManager.d.ts +7 -10
  227. package/runner/TaskManager.js +19 -39
  228. package/runner/TaskManager.js.map +1 -1
  229. package/runner/TaskManagerStore.d.ts +7 -7
  230. package/runner/TaskManagerStore.js +16 -25
  231. package/runner/TaskManagerStore.js.map +1 -1
  232. package/runner/TaskRunner.d.ts +5 -6
  233. package/runner/TaskRunner.js +9 -31
  234. package/runner/TaskRunner.js.map +1 -1
  235. package/runner/abstractions/TaskControl.d.ts +4 -4
  236. package/runner/abstractions/TaskControl.js +1 -5
  237. package/runner/abstractions/TaskControl.js.map +1 -1
  238. package/runner/abstractions/TaskEventValidation.d.ts +1 -1
  239. package/runner/abstractions/TaskEventValidation.js +1 -5
  240. package/runner/abstractions/TaskEventValidation.js.map +1 -1
  241. package/runner/abstractions/TaskManager.d.ts +4 -4
  242. package/runner/abstractions/TaskManager.js +1 -5
  243. package/runner/abstractions/TaskManager.js.map +1 -1
  244. package/runner/abstractions/TaskManagerStore.d.ts +11 -11
  245. package/runner/abstractions/TaskManagerStore.js +1 -5
  246. package/runner/abstractions/TaskManagerStore.js.map +1 -1
  247. package/runner/abstractions/TaskRunner.d.ts +3 -3
  248. package/runner/abstractions/TaskRunner.js +1 -5
  249. package/runner/abstractions/TaskRunner.js.map +1 -1
  250. package/runner/abstractions/index.d.ts +5 -5
  251. package/runner/abstractions/index.js +5 -60
  252. package/runner/abstractions/index.js.map +1 -1
  253. package/runner/index.d.ts +1 -1
  254. package/runner/index.js +1 -16
  255. package/runner/index.js.map +1 -1
  256. package/service/EventBridgeEventTransportPlugin.d.ts +4 -5
  257. package/service/EventBridgeEventTransportPlugin.js +8 -17
  258. package/service/EventBridgeEventTransportPlugin.js.map +1 -1
  259. package/service/StepFunctionServicePlugin.d.ts +4 -5
  260. package/service/StepFunctionServicePlugin.js +11 -21
  261. package/service/StepFunctionServicePlugin.js.map +1 -1
  262. package/service/createService.d.ts +2 -2
  263. package/service/createService.js +7 -18
  264. package/service/createService.js.map +1 -1
  265. package/service/index.d.ts +3 -3
  266. package/service/index.js +6 -27
  267. package/service/index.js.map +1 -1
  268. package/tasks/testingRunTask.d.ts +10 -1
  269. package/tasks/testingRunTask.js +13 -18
  270. package/tasks/testingRunTask.js.map +1 -1
  271. package/types.d.ts +32 -214
  272. package/types.js +5 -56
  273. package/types.js.map +1 -1
  274. package/utils/ObjectUpdater.js +4 -11
  275. package/utils/ObjectUpdater.js.map +1 -1
  276. package/utils/getErrorProperties.d.ts +1 -1
  277. package/utils/getErrorProperties.js +3 -10
  278. package/utils/getErrorProperties.js.map +1 -1
  279. package/utils/getObjectProperties.js +1 -8
  280. package/utils/getObjectProperties.js.map +1 -1
  281. package/utils/index.d.ts +3 -3
  282. package/utils/index.js +3 -38
  283. package/utils/index.js.map +1 -1
  284. package/crud/model.d.ts +0 -5
  285. package/crud/model.js +0 -216
  286. package/crud/model.js.map +0 -1
  287. package/crud/where.d.ts +0 -1
  288. package/crud/where.js +0 -33
  289. package/crud/where.js.map +0 -1
  290. package/task/index.d.ts +0 -2
  291. package/task/index.js +0 -29
  292. package/task/index.js.map +0 -1
  293. package/task/input.d.ts +0 -15
  294. package/task/input.js +0 -21
  295. package/task/input.js.map +0 -1
  296. package/task/plugin.d.ts +0 -36
  297. package/task/plugin.js +0 -106
  298. package/task/plugin.js.map +0 -1
package/service/index.js CHANGED
@@ -1,31 +1,10 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- var _exportNames = {
7
- createServicePlugins: true
8
- };
9
- exports.createServicePlugins = void 0;
10
- var _EventBridgeEventTransportPlugin = require("./EventBridgeEventTransportPlugin");
11
- var _StepFunctionServicePlugin = require("./StepFunctionServicePlugin");
12
- var _createService = require("./createService");
13
- Object.keys(_createService).forEach(function (key) {
14
- if (key === "default" || key === "__esModule") return;
15
- if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
16
- if (key in exports && exports[key] === _createService[key]) return;
17
- Object.defineProperty(exports, key, {
18
- enumerable: true,
19
- get: function () {
20
- return _createService[key];
21
- }
22
- });
23
- });
24
- const createServicePlugins = () => {
25
- return [new _StepFunctionServicePlugin.StepFunctionServicePlugin({
1
+ import { EventBridgeEventTransportPlugin } from "./EventBridgeEventTransportPlugin.js";
2
+ import { StepFunctionServicePlugin } from "./StepFunctionServicePlugin.js";
3
+ export const createServicePlugins = () => {
4
+ return [new StepFunctionServicePlugin({
26
5
  default: true
27
- }), new _EventBridgeEventTransportPlugin.EventBridgeEventTransportPlugin()];
6
+ }), new EventBridgeEventTransportPlugin()];
28
7
  };
29
- exports.createServicePlugins = createServicePlugins;
8
+ export * from "./createService.js";
30
9
 
31
10
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["_EventBridgeEventTransportPlugin","require","_StepFunctionServicePlugin","_createService","Object","keys","forEach","key","prototype","hasOwnProperty","call","_exportNames","exports","defineProperty","enumerable","get","createServicePlugins","StepFunctionServicePlugin","default","EventBridgeEventTransportPlugin"],"sources":["index.ts"],"sourcesContent":["import { EventBridgeEventTransportPlugin } from \"./EventBridgeEventTransportPlugin\";\nimport { StepFunctionServicePlugin } from \"./StepFunctionServicePlugin\";\n\nexport const createServicePlugins = () => {\n return [\n new StepFunctionServicePlugin({ default: true }),\n new EventBridgeEventTransportPlugin()\n ];\n};\n\nexport * from \"./createService\";\n"],"mappings":";;;;;;;;;AAAA,IAAAA,gCAAA,GAAAC,OAAA;AACA,IAAAC,0BAAA,GAAAD,OAAA;AASA,IAAAE,cAAA,GAAAF,OAAA;AAAAG,MAAA,CAAAC,IAAA,CAAAF,cAAA,EAAAG,OAAA,WAAAC,GAAA;EAAA,IAAAA,GAAA,kBAAAA,GAAA;EAAA,IAAAH,MAAA,CAAAI,SAAA,CAAAC,cAAA,CAAAC,IAAA,CAAAC,YAAA,EAAAJ,GAAA;EAAA,IAAAA,GAAA,IAAAK,OAAA,IAAAA,OAAA,CAAAL,GAAA,MAAAJ,cAAA,CAAAI,GAAA;EAAAH,MAAA,CAAAS,cAAA,CAAAD,OAAA,EAAAL,GAAA;IAAAO,UAAA;IAAAC,GAAA,WAAAA,CAAA;MAAA,OAAAZ,cAAA,CAAAI,GAAA;IAAA;EAAA;AAAA;AAPO,MAAMS,oBAAoB,GAAGA,CAAA,KAAM;EACtC,OAAO,CACH,IAAIC,oDAAyB,CAAC;IAAEC,OAAO,EAAE;EAAK,CAAC,CAAC,EAChD,IAAIC,gEAA+B,CAAC,CAAC,CACxC;AACL,CAAC;AAACP,OAAA,CAAAI,oBAAA,GAAAA,oBAAA","ignoreList":[]}
1
+ {"version":3,"names":["EventBridgeEventTransportPlugin","StepFunctionServicePlugin","createServicePlugins","default"],"sources":["index.ts"],"sourcesContent":["import { EventBridgeEventTransportPlugin } from \"./EventBridgeEventTransportPlugin.js\";\nimport { StepFunctionServicePlugin } from \"./StepFunctionServicePlugin.js\";\n\nexport const createServicePlugins = () => {\n return [\n new StepFunctionServicePlugin({ default: true }),\n new EventBridgeEventTransportPlugin()\n ];\n};\n\nexport * from \"./createService.js\";\n"],"mappings":"AAAA,SAASA,+BAA+B;AACxC,SAASC,yBAAyB;AAElC,OAAO,MAAMC,oBAAoB,GAAGA,CAAA,KAAM;EACtC,OAAO,CACH,IAAID,yBAAyB,CAAC;IAAEE,OAAO,EAAE;EAAK,CAAC,CAAC,EAChD,IAAIH,+BAA+B,CAAC,CAAC,CACxC;AACL,CAAC;AAED","ignoreList":[]}
@@ -1 +1,10 @@
1
- export declare const createTestingRunTask: () => import("../task").TaskDefinitionPlugin<import("..").Context, any, import("..").ITaskResponseDoneResultOutput>;
1
+ import { TaskDefinition } from "@webiny/api-core/features/task/TaskDefinition/index.js";
2
+ declare class TestingRunTask implements TaskDefinition.Interface {
3
+ id: string;
4
+ title: string;
5
+ run({ controller }: TaskDefinition.RunParams): Promise<TaskDefinition.ResultDone<import("@webiny/api-core/features/task/TaskDefinition/abstractions").ITaskOutput>>;
6
+ }
7
+ export declare const TestingRunTaskDefinition: typeof TestingRunTask & {
8
+ __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>>;
9
+ };
10
+ export {};
@@ -1,21 +1,16 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
1
+ import { TaskDefinition } from "@webiny/api-core/features/task/TaskDefinition/index.js";
2
+ class TestingRunTask {
3
+ id = "testingRun";
4
+ title = "A mock task to test run the step function permissions.";
5
+ async run({
6
+ controller
7
+ }) {
8
+ return controller.response.done("Task successfully finished.");
9
+ }
10
+ }
11
+ export const TestingRunTaskDefinition = TaskDefinition.createImplementation({
12
+ implementation: TestingRunTask,
13
+ dependencies: []
5
14
  });
6
- exports.createTestingRunTask = void 0;
7
- var _task = require("../task");
8
- const createTestingRunTask = () => {
9
- return (0, _task.createTaskDefinition)({
10
- id: "testingRun",
11
- title: "A mock task to test run the step function permissions.",
12
- run: async ({
13
- response
14
- }) => {
15
- return response.done("Task successfully finished.");
16
- }
17
- });
18
- };
19
- exports.createTestingRunTask = createTestingRunTask;
20
15
 
21
16
  //# sourceMappingURL=testingRunTask.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["_task","require","createTestingRunTask","createTaskDefinition","id","title","run","response","done","exports"],"sources":["testingRunTask.ts"],"sourcesContent":["import { createTaskDefinition } from \"~/task\";\n\nexport const createTestingRunTask = () => {\n return createTaskDefinition({\n id: \"testingRun\",\n title: \"A mock task to test run the step function permissions.\",\n run: async ({ response }) => {\n return response.done(\"Task successfully finished.\");\n }\n });\n};\n"],"mappings":";;;;;;AAAA,IAAAA,KAAA,GAAAC,OAAA;AAEO,MAAMC,oBAAoB,GAAGA,CAAA,KAAM;EACtC,OAAO,IAAAC,0BAAoB,EAAC;IACxBC,EAAE,EAAE,YAAY;IAChBC,KAAK,EAAE,wDAAwD;IAC/DC,GAAG,EAAE,MAAAA,CAAO;MAAEC;IAAS,CAAC,KAAK;MACzB,OAAOA,QAAQ,CAACC,IAAI,CAAC,6BAA6B,CAAC;IACvD;EACJ,CAAC,CAAC;AACN,CAAC;AAACC,OAAA,CAAAP,oBAAA,GAAAA,oBAAA","ignoreList":[]}
1
+ {"version":3,"names":["TaskDefinition","TestingRunTask","id","title","run","controller","response","done","TestingRunTaskDefinition","createImplementation","implementation","dependencies"],"sources":["testingRunTask.ts"],"sourcesContent":["import { TaskDefinition } from \"@webiny/api-core/features/task/TaskDefinition/index.js\";\n\nclass TestingRunTask implements TaskDefinition.Interface {\n id = \"testingRun\";\n title = \"A mock task to test run the step function permissions.\";\n\n async run({ controller }: TaskDefinition.RunParams) {\n return controller.response.done(\"Task successfully finished.\");\n }\n}\n\nexport const TestingRunTaskDefinition = TaskDefinition.createImplementation({\n implementation: TestingRunTask,\n dependencies: []\n});\n"],"mappings":"AAAA,SAASA,cAAc,QAAQ,wDAAwD;AAEvF,MAAMC,cAAc,CAAqC;EACrDC,EAAE,GAAG,YAAY;EACjBC,KAAK,GAAG,wDAAwD;EAEhE,MAAMC,GAAGA,CAAC;IAAEC;EAAqC,CAAC,EAAE;IAChD,OAAOA,UAAU,CAACC,QAAQ,CAACC,IAAI,CAAC,6BAA6B,CAAC;EAClE;AACJ;AAEA,OAAO,MAAMC,wBAAwB,GAAGR,cAAc,CAACS,oBAAoB,CAAC;EACxEC,cAAc,EAAET,cAAc;EAC9BU,YAAY,EAAE;AAClB,CAAC,CAAC","ignoreList":[]}
package/types.d.ts CHANGED
@@ -1,15 +1,15 @@
1
- import type { CmsContext as BaseContext, CmsEntryListParams, CmsEntryListWhere, CmsEntryMeta, CmsModel, CmsModelField } from "@webiny/api-headless-cms/types";
2
- import type { Topic } from "@webiny/pubsub/types";
3
- import type { IResponseError, ITaskResponse, ITaskResponseDoneResultOutput, ITaskResponseResult } from "./response/abstractions";
4
- import type { IIsCloseToTimeoutCallable, ITaskManagerStore } from "./runner/abstractions";
5
- import type { SecurityPermission } from "@webiny/api-security/types";
6
- import type { GenericRecord } from "@webiny/api/types";
7
- import type { IStepFunctionServiceFetchResult } from "./service/StepFunctionServicePlugin";
8
- import type { ITimer } from "@webiny/handler-aws";
9
- import type zod from "zod";
10
- export * from "./handler/types";
11
- export * from "./response/abstractions";
12
- export * from "./runner/abstractions";
1
+ import type { CmsContext as BaseContext, CmsEntryListParams, CmsEntryMeta, CmsModel } from "@webiny/api-headless-cms/types/index.js";
2
+ import type { IResponseError } from "./response/abstractions/index.js";
3
+ import type { GenericRecord } from "@webiny/api/types.js";
4
+ import type { IStepFunctionServiceFetchResult } from "./service/StepFunctionServicePlugin.js";
5
+ import type { SecurityPermission } from "@webiny/api-core/types/security.js";
6
+ import { TaskDefinition } from "@webiny/api-core/features/task/TaskDefinition/index.js";
7
+ import { TaskService } from "@webiny/api-core/features/task/TaskService/index.js";
8
+ import { BaseError, Result } from "@webiny/feature/api";
9
+ import type { IdInterfaceGenerator, NumericInterfaceGenerator } from "@webiny/api";
10
+ export * from "./handler/types.js";
11
+ export * from "./response/abstractions/index.js";
12
+ export * from "./runner/abstractions/index.js";
13
13
  export type ITaskDataInput = GenericRecord;
14
14
  export declare enum TaskLogItemType {
15
15
  INFO = "info",
@@ -53,31 +53,11 @@ export declare enum TaskDataStatus {
53
53
  }
54
54
  export interface ITaskIdentity {
55
55
  id: string;
56
- displayName: string | null;
56
+ displayName: string;
57
57
  type: string;
58
58
  }
59
- export interface ITask<T = GenericRecord, O extends ITaskResponseDoneResultOutput = ITaskResponseDoneResultOutput> {
60
- /**
61
- * ID without the revision number (for example: #0001).
62
- */
63
- id: string;
64
- name: string;
65
- taskStatus: TaskDataStatus;
66
- definitionId: string;
67
- executionName: string;
68
- input: T;
69
- output?: O;
70
- createdOn: string;
71
- savedOn: string;
72
- createdBy: ITaskIdentity;
73
- startedOn?: string;
74
- finishedOn?: string;
75
- eventResponse: GenericRecord | undefined;
76
- iterations: number;
77
- parentId?: string;
78
- }
79
- export type IGetTaskResponse<T = any, O extends ITaskResponseDoneResultOutput = ITaskResponseDoneResultOutput> = ITask<T, O> | null;
80
- export interface IListTasksResponse<T = any, O extends ITaskResponseDoneResultOutput = ITaskResponseDoneResultOutput> {
59
+ export type IGetTaskResponse<T extends TaskService.TaskInput = TaskService.TaskInput, O extends TaskService.GenericOutput = TaskService.GenericOutput> = ITask<T, O> | null;
60
+ export interface IListTasksResponse<T extends TaskService.TaskInput = TaskService.TaskInput, O extends TaskService.GenericOutput = TaskService.GenericOutput> {
81
61
  items: ITask<T, O>[];
82
62
  meta: CmsEntryMeta;
83
63
  }
@@ -85,47 +65,26 @@ export interface IListTaskLogsResponse {
85
65
  items: ITaskLog[];
86
66
  meta: CmsEntryMeta;
87
67
  }
88
- export type ICreateTaskResponse<T = ITaskDataInput, O extends ITaskResponseDoneResultOutput = ITaskResponseDoneResultOutput> = ITask<T, O>;
89
- export type IUpdateTaskResponse<T = ITaskDataInput, O extends ITaskResponseDoneResultOutput = ITaskResponseDoneResultOutput> = ITask<T, O>;
68
+ export type ICreateTaskResponse<T extends TaskService.TaskInput = TaskService.TaskInput, O extends TaskService.GenericOutput = TaskService.GenericOutput> = ITask<T, O>;
69
+ export type IUpdateTaskResponse<T extends TaskService.TaskInput = TaskService.TaskInput, O extends TaskService.GenericOutput = TaskService.GenericOutput> = ITask<T, O>;
90
70
  export type IDeleteTaskResponse = boolean;
91
- export interface IListTaskParamsWhere extends CmsEntryListWhere {
92
- parentId?: string;
93
- parentId_not?: string;
94
- parentId_in?: string[];
95
- parentId_not_in?: string[];
96
- definitionId?: string;
97
- definitionId_not?: string;
98
- definitionId_in?: string[];
99
- definitionId_not_in?: string[];
100
- taskStatus?: string;
101
- taskStatus_not?: string;
102
- taskStatus_in?: string[];
103
- taskStatus_not_in?: string[];
71
+ export interface IListTaskParamsWhere extends IdInterfaceGenerator<"id">, IdInterfaceGenerator<"parentId">, IdInterfaceGenerator<"definitionId">, IdInterfaceGenerator<"taskStatus"> {
104
72
  }
105
73
  export interface IListTaskParams extends Omit<CmsEntryListParams, "fields" | "search"> {
106
74
  where?: IListTaskParamsWhere;
107
75
  }
108
- export interface IListTaskLogParamsWhere extends CmsEntryListWhere {
109
- task?: string;
110
- task_in?: string[];
111
- task_not?: string;
112
- iteration?: number;
113
- iteration_not?: number;
114
- iteration_gte?: number;
115
- iteration_gt?: number;
116
- iteration_lte?: number;
117
- iteration_lt?: number;
76
+ export interface IListTaskLogParamsWhere extends IdInterfaceGenerator<"id">, IdInterfaceGenerator<"task">, NumericInterfaceGenerator<"iteration"> {
118
77
  }
119
- export interface IListTaskLogParams extends Omit<CmsEntryListParams, "fields" | "search"> {
78
+ export interface IListTaskLogParams extends Omit<CmsEntryListParams, "fields" | "search" | "where"> {
120
79
  where?: IListTaskLogParamsWhere;
121
80
  }
122
- export interface ITaskCreateData<T = ITaskDataInput> {
81
+ export interface ITaskCreateData<T extends TaskDefinition.TaskInput = TaskDefinition.TaskInput> {
123
82
  definitionId: string;
124
83
  name: string;
125
84
  input: T;
126
85
  parentId?: string;
127
86
  }
128
- export interface ITaskUpdateData<I = ITaskDataInput, O extends ITaskResponseDoneResultOutput = ITaskResponseDoneResultOutput> {
87
+ export interface ITaskUpdateData<I extends TaskDefinition.TaskInput = TaskDefinition.TaskInput, O extends TaskDefinition.TaskOutput = TaskDefinition.TaskOutput> {
129
88
  name?: string;
130
89
  input?: I;
131
90
  output?: O;
@@ -136,27 +95,6 @@ export interface ITaskUpdateData<I = ITaskDataInput, O extends ITaskResponseDone
136
95
  eventResponse?: GenericRecord;
137
96
  iterations?: number;
138
97
  }
139
- export interface OnTaskBeforeCreateTopicParams {
140
- input: ITaskCreateData;
141
- }
142
- export interface OnTaskAfterCreateTopicParams {
143
- input: ITaskCreateData;
144
- task: ITask;
145
- }
146
- export interface OnTaskBeforeUpdateTopicParams {
147
- input: ITaskUpdateData;
148
- original: ITask;
149
- }
150
- export interface OnTaskAfterUpdateTopicParams {
151
- input: ITaskUpdateData;
152
- task: ITask;
153
- }
154
- export interface OnTaskBeforeDeleteTopicParams {
155
- task: ITask;
156
- }
157
- export interface OnTaskAfterDeleteTopicParams {
158
- task: ITask;
159
- }
160
98
  export interface ITaskLogCreateInput {
161
99
  executionName: string;
162
100
  iteration: number;
@@ -173,10 +111,10 @@ export interface ITasksContextCrudObject {
173
111
  /**
174
112
  * Tasks
175
113
  */
176
- getTask<T = any, O extends ITaskResponseDoneResultOutput = ITaskResponseDoneResultOutput>(id: string): Promise<IGetTaskResponse<T, O> | null>;
177
- listTasks<T = any, O extends ITaskResponseDoneResultOutput = ITaskResponseDoneResultOutput>(params?: IListTaskParams): Promise<IListTasksResponse<T, O>>;
178
- createTask<T = any>(task: ITaskCreateData<T>): Promise<ICreateTaskResponse<T>>;
179
- updateTask<T = ITaskDataInput, O extends ITaskResponseDoneResultOutput = ITaskResponseDoneResultOutput>(id: string, data: Partial<ITaskUpdateData<T, O>>): Promise<IUpdateTaskResponse<T, O>>;
114
+ getTask<T extends TaskService.TaskInput = TaskService.TaskInput, O extends TaskService.GenericOutput = TaskService.GenericOutput>(id: string): Promise<IGetTaskResponse<T, O> | null>;
115
+ listTasks<T extends TaskService.TaskInput = TaskService.TaskInput, O extends TaskService.GenericOutput = TaskService.GenericOutput>(params?: IListTaskParams): Promise<IListTasksResponse<T, O>>;
116
+ createTask<T extends TaskService.TaskInput = TaskService.TaskInput>(task: ITaskCreateData<T>): Promise<ICreateTaskResponse<T>>;
117
+ updateTask<T extends TaskService.TaskInput = TaskService.TaskInput, O extends TaskService.GenericOutput = TaskService.GenericOutput>(id: string, data: Partial<ITaskUpdateData<T, O>>): Promise<IUpdateTaskResponse<T, O>>;
180
118
  deleteTask(id: string): Promise<IDeleteTaskResponse>;
181
119
  /**
182
120
  * Logs
@@ -187,19 +125,10 @@ export interface ITasksContextCrudObject {
187
125
  getLog(id: string): Promise<ITaskLog | null>;
188
126
  getLatestLog(taskId: string): Promise<ITaskLog>;
189
127
  listLogs(params: IListTaskLogParams): Promise<IListTaskLogsResponse>;
190
- /**
191
- * Lifecycle events.
192
- */
193
- onTaskBeforeCreate: Topic<OnTaskBeforeCreateTopicParams>;
194
- onTaskAfterCreate: Topic<OnTaskAfterCreateTopicParams>;
195
- onTaskBeforeUpdate: Topic<OnTaskBeforeUpdateTopicParams>;
196
- onTaskAfterUpdate: Topic<OnTaskAfterUpdateTopicParams>;
197
- onTaskBeforeDelete: Topic<OnTaskBeforeDeleteTopicParams>;
198
- onTaskAfterDelete: Topic<OnTaskAfterDeleteTopicParams>;
199
128
  }
200
129
  export interface ITasksContextDefinitionObject {
201
- getDefinition: <C extends Context = Context, I = ITaskDataInput, O extends ITaskResponseDoneResultOutput = ITaskResponseDoneResultOutput>(id: string) => ITaskDefinition<C, I, O> | null;
202
- listDefinitions: () => ITaskDefinition[];
130
+ getDefinition: <I extends TaskDefinition.TaskInput = TaskDefinition.TaskInput, O extends TaskDefinition.TaskOutput = TaskDefinition.TaskOutput>(id: string) => TaskDefinition.Runnable<I, O> | null;
131
+ listDefinitions: () => TaskDefinition.Interface[];
203
132
  }
204
133
  export interface ITaskTriggerParams<I = ITaskDataInput> {
205
134
  parent?: Pick<ITask, "id">;
@@ -213,128 +142,17 @@ export interface ITaskAbortParams {
213
142
  message?: string;
214
143
  }
215
144
  export interface ITasksContextServiceObject {
216
- trigger: <T = ITaskDataInput, O extends ITaskResponseDoneResultOutput = ITaskResponseDoneResultOutput>(params: ITaskTriggerParams<T>) => Promise<ITask<T, O>>;
217
- abort: <T = ITaskDataInput, O extends ITaskResponseDoneResultOutput = ITaskResponseDoneResultOutput>(params: ITaskAbortParams) => Promise<ITask<T, O>>;
218
- fetchServiceInfo: (input: ITask<any, any> | string) => Promise<IStepFunctionServiceFetchResult | null>;
145
+ trigger: <T extends TaskDefinition.TaskInput = TaskDefinition.TaskInput, O extends TaskService.GenericOutput = TaskService.GenericOutput>(params: ITaskTriggerParams<T>) => Promise<Result<ITask<T, O>, BaseError>>;
146
+ abort: <T extends TaskDefinition.TaskInput = TaskDefinition.TaskInput, O extends TaskService.GenericOutput = TaskService.GenericOutput>(params: ITaskAbortParams) => Promise<Result<ITask<T, O>, BaseError>>;
147
+ fetchServiceInfo: (input: ITask<any, any> | string) => Promise<Result<IStepFunctionServiceFetchResult, BaseError>>;
219
148
  }
220
149
  export interface ITasksContextObject extends ITasksContextCrudObject, ITasksContextDefinitionObject, ITasksContextServiceObject {
221
150
  }
222
151
  export interface Context extends BaseContext {
223
152
  tasks: ITasksContextObject;
224
153
  }
225
- export interface ITaskRunParams<C extends Context, I = ITaskDataInput, O extends ITaskResponseDoneResultOutput = ITaskResponseDoneResultOutput> {
226
- context: C;
227
- response: ITaskResponse<I, O>;
228
- isCloseToTimeout: IIsCloseToTimeoutCallable;
229
- isAborted(): boolean;
230
- input: I;
231
- store: ITaskManagerStore<I>;
232
- trigger<SI = ITaskDataInput>(params: Omit<ITaskTriggerParams<SI>, "parent">): Promise<ITask<SI>>;
233
- timer: ITimer;
234
- }
235
- export interface ITaskOnSuccessParams<C extends Context, I = ITaskDataInput, O extends ITaskResponseDoneResultOutput = ITaskResponseDoneResultOutput> {
236
- context: C;
237
- task: ITask<I, O>;
238
- }
239
- export interface ITaskOnErrorParams<C extends Context, I = ITaskDataInput, O extends ITaskResponseDoneResultOutput = ITaskResponseDoneResultOutput> {
240
- context: C;
241
- task: ITask<I, O>;
242
- }
243
- export interface ITaskOnAbortParams<C extends Context, I = ITaskDataInput, O extends ITaskResponseDoneResultOutput = ITaskResponseDoneResultOutput> {
244
- context: C;
245
- task: ITask<I, O>;
246
- }
247
- export interface ITaskOnMaxIterationsParams<C extends Context> {
248
- context: C;
249
- task: ITask;
250
- }
251
- export declare enum TaskResponseStatus {
252
- DONE = "done",
253
- ERROR = "error",
254
- CONTINUE = "continue",
255
- ABORTED = "aborted"
256
- }
257
- export type ITaskDefinitionField = Pick<CmsModelField, "fieldId" | "type" | "label" | "renderer" | "helpText" | "placeholderText" | "predefinedValues" | "validation" | "listValidation" | "multipleValues" | "settings">;
258
- export interface ITaskBeforeTriggerParams<C extends Context = Context, I = ITaskDataInput> {
259
- context: C;
260
- data: ITaskCreateData<I>;
261
- }
262
- export interface ITaskCreateInputValidationParams<C extends Context = Context> {
263
- validator: typeof zod;
264
- context: C;
265
- }
266
- export interface ITaskDefinition<C extends Context = Context, I = ITaskDataInput, O extends ITaskResponseDoneResultOutput = ITaskResponseDoneResultOutput> {
267
- /**
268
- * ID of the task must be unique in the system.
269
- * It should be in camelCase format, for example: "myCustomTask".
270
- *
271
- * TODO: figure out a way to force camelCase in types.
272
- * CamelCase from type-fest does not help with this.
273
- */
274
- id: string;
275
- /**
276
- * Name should be unique, as it will get used to identify the task in the UI.
277
- */
278
- title: string;
279
- /**
280
- * A description of the task, for the UI.
281
- */
282
- description?: string;
283
- /**
284
- * Maximum number a step function can call the Lambda.
285
- */
286
- maxIterations: number;
287
- /**
288
- * Disable storing logs in database for this task.
289
- */
290
- disableDatabaseLogs?: boolean;
291
- /**
292
- * Task run method.
293
- */
294
- run(params: ITaskRunParams<C, I, O>): Promise<ITaskResponseResult>;
295
- /**
296
- * When a new task is about to be triggered, we will run this method.
297
- * For example, you can use this method to check if there is a task of the same type already running.
298
- */
299
- onBeforeTrigger?<T = ITaskDataInput>(params: ITaskBeforeTriggerParams<C, T>): Promise<void>;
300
- /**
301
- * When task successfully finishes, this method will be called.
302
- * This will be called during the run time of the task.
303
- */
304
- onDone?(params: ITaskOnSuccessParams<C, I, O>): Promise<void>;
305
- /**
306
- * When task fails, this method will be called.
307
- * This will be called during the run time of the task.
308
- */
309
- onError?(params: ITaskOnErrorParams<C, I>): Promise<void>;
310
- /**
311
- * When task is aborted, this method will be called.
312
- * This method will be called when user aborts the task.
313
- */
314
- onAbort?(params: ITaskOnAbortParams<C, I, O>): Promise<void>;
315
- /**
316
- * When task hits max iterations, this method will be called.
317
- * This will be called during the run time of the task.
318
- */
319
- onMaxIterations?(params: ITaskOnMaxIterationsParams<C>): Promise<void>;
320
- /**
321
- * Create a validation schema for the task input.
322
- * This will be used to validate the input before the task is triggered.
323
- *
324
- * By default, the input validation validates the input against the fields defined in the task definition.
325
- * But it also passes through any fields which might not be defined in the task validation.
326
- */
327
- createInputValidation?: (params: ITaskCreateInputValidationParams<C>) => GenericRecord<keyof I, zod.Schema> | zod.Schema;
328
- /**
329
- * Custom input fields and layout for the task input.
330
- */
331
- fields?: ITaskDefinitionField[];
332
- /**
333
- * Is the task visible when listing?
334
- */
335
- isPrivate?: boolean;
336
- }
337
154
  export interface TaskPermission extends SecurityPermission {
338
155
  name: "task";
339
156
  rwd?: string;
340
157
  }
158
+ export type ITask<I extends TaskService.TaskInput = TaskService.TaskInput, O extends TaskService.GenericOutput = TaskService.GenericOutput> = TaskService.Task<I, O>;
package/types.js CHANGED
@@ -1,56 +1,12 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- var _exportNames = {
7
- TaskLogItemType: true,
8
- TaskDataStatus: true,
9
- TaskResponseStatus: true
10
- };
11
- exports.TaskResponseStatus = exports.TaskLogItemType = exports.TaskDataStatus = void 0;
12
- var _types = require("./handler/types");
13
- Object.keys(_types).forEach(function (key) {
14
- if (key === "default" || key === "__esModule") return;
15
- if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
16
- if (key in exports && exports[key] === _types[key]) return;
17
- Object.defineProperty(exports, key, {
18
- enumerable: true,
19
- get: function () {
20
- return _types[key];
21
- }
22
- });
23
- });
24
- var _abstractions = require("./response/abstractions");
25
- Object.keys(_abstractions).forEach(function (key) {
26
- if (key === "default" || key === "__esModule") return;
27
- if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
28
- if (key in exports && exports[key] === _abstractions[key]) return;
29
- Object.defineProperty(exports, key, {
30
- enumerable: true,
31
- get: function () {
32
- return _abstractions[key];
33
- }
34
- });
35
- });
36
- var _abstractions2 = require("./runner/abstractions");
37
- Object.keys(_abstractions2).forEach(function (key) {
38
- if (key === "default" || key === "__esModule") return;
39
- if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
40
- if (key in exports && exports[key] === _abstractions2[key]) return;
41
- Object.defineProperty(exports, key, {
42
- enumerable: true,
43
- get: function () {
44
- return _abstractions2[key];
45
- }
46
- });
47
- });
48
- let TaskLogItemType = exports.TaskLogItemType = /*#__PURE__*/function (TaskLogItemType) {
1
+ export * from "./handler/types.js";
2
+ export * from "./response/abstractions/index.js";
3
+ export * from "./runner/abstractions/index.js";
4
+ export let TaskLogItemType = /*#__PURE__*/function (TaskLogItemType) {
49
5
  TaskLogItemType["INFO"] = "info";
50
6
  TaskLogItemType["ERROR"] = "error";
51
7
  return TaskLogItemType;
52
8
  }({});
53
- let TaskDataStatus = exports.TaskDataStatus = /*#__PURE__*/function (TaskDataStatus) {
9
+ export let TaskDataStatus = /*#__PURE__*/function (TaskDataStatus) {
54
10
  TaskDataStatus["PENDING"] = "pending";
55
11
  TaskDataStatus["RUNNING"] = "running";
56
12
  TaskDataStatus["FAILED"] = "failed";
@@ -58,12 +14,5 @@ let TaskDataStatus = exports.TaskDataStatus = /*#__PURE__*/function (TaskDataSta
58
14
  TaskDataStatus["ABORTED"] = "aborted";
59
15
  return TaskDataStatus;
60
16
  }({});
61
- let TaskResponseStatus = exports.TaskResponseStatus = /*#__PURE__*/function (TaskResponseStatus) {
62
- TaskResponseStatus["DONE"] = "done";
63
- TaskResponseStatus["ERROR"] = "error";
64
- TaskResponseStatus["CONTINUE"] = "continue";
65
- TaskResponseStatus["ABORTED"] = "aborted";
66
- return TaskResponseStatus;
67
- }({});
68
17
 
69
18
  //# sourceMappingURL=types.js.map
package/types.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"names":["_types","require","Object","keys","forEach","key","prototype","hasOwnProperty","call","_exportNames","exports","defineProperty","enumerable","get","_abstractions","_abstractions2","TaskLogItemType","TaskDataStatus","TaskResponseStatus"],"sources":["types.ts"],"sourcesContent":["import type {\n CmsContext as BaseContext,\n CmsEntryListParams,\n CmsEntryListWhere,\n CmsEntryMeta,\n CmsModel,\n CmsModelField\n} from \"@webiny/api-headless-cms/types\";\nimport type { Topic } from \"@webiny/pubsub/types\";\nimport type {\n IResponseError,\n ITaskResponse,\n ITaskResponseDoneResultOutput,\n ITaskResponseResult\n} from \"~/response/abstractions\";\nimport type { IIsCloseToTimeoutCallable, ITaskManagerStore } from \"./runner/abstractions\";\nimport type { SecurityPermission } from \"@webiny/api-security/types\";\nimport type { GenericRecord } from \"@webiny/api/types\";\nimport type { IStepFunctionServiceFetchResult } from \"~/service/StepFunctionServicePlugin\";\nimport type { ITimer } from \"@webiny/handler-aws\";\n\nimport type zod from \"zod\";\n\nexport * from \"./handler/types\";\nexport * from \"./response/abstractions\";\nexport * from \"./runner/abstractions\";\n\nexport type ITaskDataInput = GenericRecord;\n\nexport enum TaskLogItemType {\n INFO = \"info\",\n ERROR = \"error\"\n}\n\nexport interface ITaskLogItemData {\n [key: string]: any;\n}\n\nexport interface ITaskLogItemBase {\n message: string;\n createdOn: string;\n type: TaskLogItemType;\n data?: ITaskLogItemData;\n}\n\nexport interface ITaskLogItemInfo extends ITaskLogItemBase {\n type: TaskLogItemType.INFO;\n}\n\nexport interface ITaskLogItemError extends ITaskLogItemBase {\n type: TaskLogItemType.ERROR;\n error?: IResponseError;\n}\n\nexport type ITaskLogItem = ITaskLogItemInfo | ITaskLogItemError;\n\nexport interface ITaskLog {\n /**\n * ID without the revision number (for example: #0001).\n */\n id: string;\n createdOn: string;\n createdBy: ITaskIdentity;\n executionName: string;\n task: string;\n iteration: number;\n items: ITaskLogItem[];\n}\n\nexport enum TaskDataStatus {\n PENDING = \"pending\",\n RUNNING = \"running\",\n FAILED = \"failed\",\n SUCCESS = \"success\",\n ABORTED = \"aborted\"\n}\n\nexport interface ITaskIdentity {\n id: string;\n displayName: string | null;\n type: string;\n}\n\nexport interface ITask<\n T = GenericRecord,\n O extends ITaskResponseDoneResultOutput = ITaskResponseDoneResultOutput\n> {\n /**\n * ID without the revision number (for example: #0001).\n */\n id: string;\n name: string;\n taskStatus: TaskDataStatus;\n definitionId: string;\n executionName: string;\n input: T;\n output?: O;\n createdOn: string;\n savedOn: string;\n createdBy: ITaskIdentity;\n startedOn?: string;\n finishedOn?: string;\n eventResponse: GenericRecord | undefined;\n iterations: number;\n parentId?: string;\n}\n\nexport type IGetTaskResponse<\n T = any,\n O extends ITaskResponseDoneResultOutput = ITaskResponseDoneResultOutput\n> = ITask<T, O> | null;\n\nexport interface IListTasksResponse<\n T = any,\n O extends ITaskResponseDoneResultOutput = ITaskResponseDoneResultOutput\n> {\n items: ITask<T, O>[];\n meta: CmsEntryMeta;\n}\n\nexport interface IListTaskLogsResponse {\n items: ITaskLog[];\n meta: CmsEntryMeta;\n}\n\nexport type ICreateTaskResponse<\n T = ITaskDataInput,\n O extends ITaskResponseDoneResultOutput = ITaskResponseDoneResultOutput\n> = ITask<T, O>;\nexport type IUpdateTaskResponse<\n T = ITaskDataInput,\n O extends ITaskResponseDoneResultOutput = ITaskResponseDoneResultOutput\n> = ITask<T, O>;\nexport type IDeleteTaskResponse = boolean;\n\nexport interface IListTaskParamsWhere extends CmsEntryListWhere {\n parentId?: string;\n parentId_not?: string;\n parentId_in?: string[];\n parentId_not_in?: string[];\n definitionId?: string;\n definitionId_not?: string;\n definitionId_in?: string[];\n definitionId_not_in?: string[];\n taskStatus?: string;\n taskStatus_not?: string;\n taskStatus_in?: string[];\n taskStatus_not_in?: string[];\n}\n\nexport interface IListTaskParams extends Omit<CmsEntryListParams, \"fields\" | \"search\"> {\n where?: IListTaskParamsWhere;\n}\n\nexport interface IListTaskLogParamsWhere extends CmsEntryListWhere {\n task?: string;\n task_in?: string[];\n task_not?: string;\n iteration?: number;\n iteration_not?: number;\n iteration_gte?: number;\n iteration_gt?: number;\n iteration_lte?: number;\n iteration_lt?: number;\n}\n\nexport interface IListTaskLogParams extends Omit<CmsEntryListParams, \"fields\" | \"search\"> {\n where?: IListTaskLogParamsWhere;\n}\n\nexport interface ITaskCreateData<T = ITaskDataInput> {\n definitionId: string;\n name: string;\n input: T;\n parentId?: string;\n}\n\nexport interface ITaskUpdateData<\n I = ITaskDataInput,\n O extends ITaskResponseDoneResultOutput = ITaskResponseDoneResultOutput\n> {\n name?: string;\n input?: I;\n output?: O;\n taskStatus?: TaskDataStatus;\n executionName?: string;\n startedOn?: string;\n finishedOn?: string;\n eventResponse?: GenericRecord;\n iterations?: number;\n}\n\nexport interface OnTaskBeforeCreateTopicParams {\n input: ITaskCreateData;\n}\n\nexport interface OnTaskAfterCreateTopicParams {\n input: ITaskCreateData;\n task: ITask;\n}\n\nexport interface OnTaskBeforeUpdateTopicParams {\n input: ITaskUpdateData;\n original: ITask;\n}\n\nexport interface OnTaskAfterUpdateTopicParams {\n input: ITaskUpdateData;\n task: ITask;\n}\n\nexport interface OnTaskBeforeDeleteTopicParams {\n task: ITask;\n}\n\nexport interface OnTaskAfterDeleteTopicParams {\n task: ITask;\n}\n\nexport interface ITaskLogCreateInput {\n executionName: string;\n iteration: number;\n}\n\nexport interface ITaskLogUpdateInput {\n items?: ITaskLogItem[];\n}\n\nexport interface ITasksContextCrudObject {\n /**\n * Models\n */\n getTaskModel(): Promise<CmsModel>;\n getLogModel(): Promise<CmsModel>;\n /**\n * Tasks\n */\n getTask<T = any, O extends ITaskResponseDoneResultOutput = ITaskResponseDoneResultOutput>(\n id: string\n ): Promise<IGetTaskResponse<T, O> | null>;\n listTasks<T = any, O extends ITaskResponseDoneResultOutput = ITaskResponseDoneResultOutput>(\n params?: IListTaskParams\n ): Promise<IListTasksResponse<T, O>>;\n createTask<T = any>(task: ITaskCreateData<T>): Promise<ICreateTaskResponse<T>>;\n updateTask<\n T = ITaskDataInput,\n O extends ITaskResponseDoneResultOutput = ITaskResponseDoneResultOutput\n >(\n id: string,\n data: Partial<ITaskUpdateData<T, O>>\n ): Promise<IUpdateTaskResponse<T, O>>;\n deleteTask(id: string): Promise<IDeleteTaskResponse>;\n /**\n * Logs\n */\n createLog(task: Pick<ITask, \"id\">, data: ITaskLogCreateInput): Promise<ITaskLog>;\n updateLog(id: string, data: ITaskLogUpdateInput): Promise<ITaskLog>;\n deleteLog(id: string): Promise<boolean>;\n getLog(id: string): Promise<ITaskLog | null>;\n getLatestLog(taskId: string): Promise<ITaskLog>;\n listLogs(params: IListTaskLogParams): Promise<IListTaskLogsResponse>;\n /**\n * Lifecycle events.\n */\n onTaskBeforeCreate: Topic<OnTaskBeforeCreateTopicParams>;\n onTaskAfterCreate: Topic<OnTaskAfterCreateTopicParams>;\n onTaskBeforeUpdate: Topic<OnTaskBeforeUpdateTopicParams>;\n onTaskAfterUpdate: Topic<OnTaskAfterUpdateTopicParams>;\n onTaskBeforeDelete: Topic<OnTaskBeforeDeleteTopicParams>;\n onTaskAfterDelete: Topic<OnTaskAfterDeleteTopicParams>;\n}\n\nexport interface ITasksContextDefinitionObject {\n getDefinition: <\n C extends Context = Context,\n I = ITaskDataInput,\n O extends ITaskResponseDoneResultOutput = ITaskResponseDoneResultOutput\n >(\n id: string\n ) => ITaskDefinition<C, I, O> | null;\n listDefinitions: () => ITaskDefinition[];\n}\n\nexport interface ITaskTriggerParams<I = ITaskDataInput> {\n parent?: Pick<ITask, \"id\">;\n definition: string;\n name?: string;\n input?: I;\n delay?: number;\n}\n\nexport interface ITaskAbortParams {\n id: string;\n message?: string;\n}\n\nexport interface ITasksContextServiceObject {\n trigger: <\n T = ITaskDataInput,\n O extends ITaskResponseDoneResultOutput = ITaskResponseDoneResultOutput\n >(\n params: ITaskTriggerParams<T>\n ) => Promise<ITask<T, O>>;\n abort: <\n T = ITaskDataInput,\n O extends ITaskResponseDoneResultOutput = ITaskResponseDoneResultOutput\n >(\n params: ITaskAbortParams\n ) => Promise<ITask<T, O>>;\n fetchServiceInfo: (\n input: ITask<any, any> | string\n ) => Promise<IStepFunctionServiceFetchResult | null>;\n}\n\nexport interface ITasksContextObject\n extends ITasksContextCrudObject,\n ITasksContextDefinitionObject,\n ITasksContextServiceObject {}\n\nexport interface Context extends BaseContext {\n tasks: ITasksContextObject;\n}\n\nexport interface ITaskRunParams<\n C extends Context,\n I = ITaskDataInput,\n O extends ITaskResponseDoneResultOutput = ITaskResponseDoneResultOutput\n> {\n context: C;\n response: ITaskResponse<I, O>;\n isCloseToTimeout: IIsCloseToTimeoutCallable;\n isAborted(): boolean;\n input: I;\n store: ITaskManagerStore<I>;\n trigger<SI = ITaskDataInput>(\n params: Omit<ITaskTriggerParams<SI>, \"parent\">\n ): Promise<ITask<SI>>;\n timer: ITimer;\n}\n\nexport interface ITaskOnSuccessParams<\n C extends Context,\n I = ITaskDataInput,\n O extends ITaskResponseDoneResultOutput = ITaskResponseDoneResultOutput\n> {\n context: C;\n task: ITask<I, O>;\n}\n\nexport interface ITaskOnErrorParams<\n C extends Context,\n I = ITaskDataInput,\n O extends ITaskResponseDoneResultOutput = ITaskResponseDoneResultOutput\n> {\n context: C;\n task: ITask<I, O>;\n}\n\nexport interface ITaskOnAbortParams<\n C extends Context,\n I = ITaskDataInput,\n O extends ITaskResponseDoneResultOutput = ITaskResponseDoneResultOutput\n> {\n context: C;\n task: ITask<I, O>;\n}\n\nexport interface ITaskOnMaxIterationsParams<C extends Context> {\n context: C;\n task: ITask;\n}\n\nexport enum TaskResponseStatus {\n DONE = \"done\",\n ERROR = \"error\",\n CONTINUE = \"continue\",\n ABORTED = \"aborted\"\n}\n\nexport type ITaskDefinitionField = Pick<\n CmsModelField,\n | \"fieldId\"\n | \"type\"\n | \"label\"\n | \"renderer\"\n | \"helpText\"\n | \"placeholderText\"\n | \"predefinedValues\"\n | \"validation\"\n | \"listValidation\"\n | \"multipleValues\"\n | \"settings\"\n>;\n\nexport interface ITaskBeforeTriggerParams<C extends Context = Context, I = ITaskDataInput> {\n context: C;\n data: ITaskCreateData<I>;\n}\n\nexport interface ITaskCreateInputValidationParams<C extends Context = Context> {\n validator: typeof zod;\n context: C;\n}\n\nexport interface ITaskDefinition<\n C extends Context = Context,\n I = ITaskDataInput,\n O extends ITaskResponseDoneResultOutput = ITaskResponseDoneResultOutput\n> {\n /**\n * ID of the task must be unique in the system.\n * It should be in camelCase format, for example: \"myCustomTask\".\n *\n * TODO: figure out a way to force camelCase in types.\n * CamelCase from type-fest does not help with this.\n */\n id: string;\n /**\n * Name should be unique, as it will get used to identify the task in the UI.\n */\n title: string;\n /**\n * A description of the task, for the UI.\n */\n description?: string;\n /**\n * Maximum number a step function can call the Lambda.\n */\n maxIterations: number;\n /**\n * Disable storing logs in database for this task.\n */\n disableDatabaseLogs?: boolean;\n /**\n * Task run method.\n */\n run(params: ITaskRunParams<C, I, O>): Promise<ITaskResponseResult>;\n /**\n * When a new task is about to be triggered, we will run this method.\n * For example, you can use this method to check if there is a task of the same type already running.\n */\n onBeforeTrigger?<T = ITaskDataInput>(params: ITaskBeforeTriggerParams<C, T>): Promise<void>;\n /**\n * When task successfully finishes, this method will be called.\n * This will be called during the run time of the task.\n */\n onDone?(params: ITaskOnSuccessParams<C, I, O>): Promise<void>;\n /**\n * When task fails, this method will be called.\n * This will be called during the run time of the task.\n */\n onError?(params: ITaskOnErrorParams<C, I>): Promise<void>;\n /**\n * When task is aborted, this method will be called.\n * This method will be called when user aborts the task.\n */\n onAbort?(params: ITaskOnAbortParams<C, I, O>): Promise<void>;\n /**\n * When task hits max iterations, this method will be called.\n * This will be called during the run time of the task.\n */\n onMaxIterations?(params: ITaskOnMaxIterationsParams<C>): Promise<void>;\n /**\n * Create a validation schema for the task input.\n * This will be used to validate the input before the task is triggered.\n *\n * By default, the input validation validates the input against the fields defined in the task definition.\n * But it also passes through any fields which might not be defined in the task validation.\n */\n createInputValidation?: (\n params: ITaskCreateInputValidationParams<C>\n ) => GenericRecord<keyof I, zod.Schema> | zod.Schema;\n /**\n * Custom input fields and layout for the task input.\n */\n fields?: ITaskDefinitionField[];\n /**\n * Is the task visible when listing?\n */\n isPrivate?: boolean;\n}\n\nexport interface TaskPermission extends SecurityPermission {\n name: \"task\";\n rwd?: string;\n}\n"],"mappings":";;;;;;;;;;;AAuBA,IAAAA,MAAA,GAAAC,OAAA;AAAAC,MAAA,CAAAC,IAAA,CAAAH,MAAA,EAAAI,OAAA,WAAAC,GAAA;EAAA,IAAAA,GAAA,kBAAAA,GAAA;EAAA,IAAAH,MAAA,CAAAI,SAAA,CAAAC,cAAA,CAAAC,IAAA,CAAAC,YAAA,EAAAJ,GAAA;EAAA,IAAAA,GAAA,IAAAK,OAAA,IAAAA,OAAA,CAAAL,GAAA,MAAAL,MAAA,CAAAK,GAAA;EAAAH,MAAA,CAAAS,cAAA,CAAAD,OAAA,EAAAL,GAAA;IAAAO,UAAA;IAAAC,GAAA,WAAAA,CAAA;MAAA,OAAAb,MAAA,CAAAK,GAAA;IAAA;EAAA;AAAA;AACA,IAAAS,aAAA,GAAAb,OAAA;AAAAC,MAAA,CAAAC,IAAA,CAAAW,aAAA,EAAAV,OAAA,WAAAC,GAAA;EAAA,IAAAA,GAAA,kBAAAA,GAAA;EAAA,IAAAH,MAAA,CAAAI,SAAA,CAAAC,cAAA,CAAAC,IAAA,CAAAC,YAAA,EAAAJ,GAAA;EAAA,IAAAA,GAAA,IAAAK,OAAA,IAAAA,OAAA,CAAAL,GAAA,MAAAS,aAAA,CAAAT,GAAA;EAAAH,MAAA,CAAAS,cAAA,CAAAD,OAAA,EAAAL,GAAA;IAAAO,UAAA;IAAAC,GAAA,WAAAA,CAAA;MAAA,OAAAC,aAAA,CAAAT,GAAA;IAAA;EAAA;AAAA;AACA,IAAAU,cAAA,GAAAd,OAAA;AAAAC,MAAA,CAAAC,IAAA,CAAAY,cAAA,EAAAX,OAAA,WAAAC,GAAA;EAAA,IAAAA,GAAA,kBAAAA,GAAA;EAAA,IAAAH,MAAA,CAAAI,SAAA,CAAAC,cAAA,CAAAC,IAAA,CAAAC,YAAA,EAAAJ,GAAA;EAAA,IAAAA,GAAA,IAAAK,OAAA,IAAAA,OAAA,CAAAL,GAAA,MAAAU,cAAA,CAAAV,GAAA;EAAAH,MAAA,CAAAS,cAAA,CAAAD,OAAA,EAAAL,GAAA;IAAAO,UAAA;IAAAC,GAAA,WAAAA,CAAA;MAAA,OAAAE,cAAA,CAAAV,GAAA;IAAA;EAAA;AAAA;AAAsC,IAI1BW,eAAe,GAAAN,OAAA,CAAAM,eAAA,0BAAfA,eAAe;EAAfA,eAAe;EAAfA,eAAe;EAAA,OAAfA,eAAe;AAAA;AAAA,IAwCfC,cAAc,GAAAP,OAAA,CAAAO,cAAA,0BAAdA,cAAc;EAAdA,cAAc;EAAdA,cAAc;EAAdA,cAAc;EAAdA,cAAc;EAAdA,cAAc;EAAA,OAAdA,cAAc;AAAA;AAAA,IA+SdC,kBAAkB,GAAAR,OAAA,CAAAQ,kBAAA,0BAAlBA,kBAAkB;EAAlBA,kBAAkB;EAAlBA,kBAAkB;EAAlBA,kBAAkB;EAAlBA,kBAAkB;EAAA,OAAlBA,kBAAkB;AAAA","ignoreList":[]}
1
+ {"version":3,"names":["TaskLogItemType","TaskDataStatus"],"sources":["types.ts"],"sourcesContent":["import type {\n CmsContext as BaseContext,\n CmsEntryListParams,\n CmsEntryMeta,\n CmsModel\n} from \"@webiny/api-headless-cms/types/index.js\";\nimport type { IResponseError } from \"~/response/abstractions/index.js\";\nimport type { GenericRecord } from \"@webiny/api/types.js\";\nimport type { IStepFunctionServiceFetchResult } from \"~/service/StepFunctionServicePlugin.js\";\nimport type { SecurityPermission } from \"@webiny/api-core/types/security.js\";\nimport { TaskDefinition } from \"@webiny/api-core/features/task/TaskDefinition/index.js\";\nimport { TaskService } from \"@webiny/api-core/features/task/TaskService/index.js\";\nimport { BaseError, Result } from \"@webiny/feature/api\";\nimport type { IdInterfaceGenerator, NumericInterfaceGenerator } from \"@webiny/api\";\n\nexport * from \"./handler/types.js\";\nexport * from \"./response/abstractions/index.js\";\nexport * from \"./runner/abstractions/index.js\";\n\nexport type ITaskDataInput = GenericRecord;\n\nexport enum TaskLogItemType {\n INFO = \"info\",\n ERROR = \"error\"\n}\n\nexport interface ITaskLogItemData {\n [key: string]: any;\n}\n\nexport interface ITaskLogItemBase {\n message: string;\n createdOn: string;\n type: TaskLogItemType;\n data?: ITaskLogItemData;\n}\n\nexport interface ITaskLogItemInfo extends ITaskLogItemBase {\n type: TaskLogItemType.INFO;\n}\n\nexport interface ITaskLogItemError extends ITaskLogItemBase {\n type: TaskLogItemType.ERROR;\n error?: IResponseError;\n}\n\nexport type ITaskLogItem = ITaskLogItemInfo | ITaskLogItemError;\n\nexport interface ITaskLog {\n /**\n * ID without the revision number (for example: #0001).\n */\n id: string;\n createdOn: string;\n createdBy: ITaskIdentity;\n executionName: string;\n task: string;\n iteration: number;\n items: ITaskLogItem[];\n}\n\nexport enum TaskDataStatus {\n PENDING = \"pending\",\n RUNNING = \"running\",\n FAILED = \"failed\",\n SUCCESS = \"success\",\n ABORTED = \"aborted\"\n}\n\nexport interface ITaskIdentity {\n id: string;\n displayName: string;\n type: string;\n}\n\nexport type IGetTaskResponse<\n T extends TaskService.TaskInput = TaskService.TaskInput,\n O extends TaskService.GenericOutput = TaskService.GenericOutput\n> = ITask<T, O> | null;\n\nexport interface IListTasksResponse<\n T extends TaskService.TaskInput = TaskService.TaskInput,\n O extends TaskService.GenericOutput = TaskService.GenericOutput\n> {\n items: ITask<T, O>[];\n meta: CmsEntryMeta;\n}\n\nexport interface IListTaskLogsResponse {\n items: ITaskLog[];\n meta: CmsEntryMeta;\n}\n\nexport type ICreateTaskResponse<\n T extends TaskService.TaskInput = TaskService.TaskInput,\n O extends TaskService.GenericOutput = TaskService.GenericOutput\n> = ITask<T, O>;\nexport type IUpdateTaskResponse<\n T extends TaskService.TaskInput = TaskService.TaskInput,\n O extends TaskService.GenericOutput = TaskService.GenericOutput\n> = ITask<T, O>;\nexport type IDeleteTaskResponse = boolean;\n\nexport interface IListTaskParamsWhere\n extends IdInterfaceGenerator<\"id\">,\n IdInterfaceGenerator<\"parentId\">,\n IdInterfaceGenerator<\"definitionId\">,\n IdInterfaceGenerator<\"taskStatus\"> {\n //\n}\n\nexport interface IListTaskParams extends Omit<CmsEntryListParams, \"fields\" | \"search\"> {\n where?: IListTaskParamsWhere;\n}\n\nexport interface IListTaskLogParamsWhere\n extends IdInterfaceGenerator<\"id\">,\n IdInterfaceGenerator<\"task\">,\n NumericInterfaceGenerator<\"iteration\"> {}\n\nexport interface IListTaskLogParams\n extends Omit<CmsEntryListParams, \"fields\" | \"search\" | \"where\"> {\n where?: IListTaskLogParamsWhere;\n}\n\nexport interface ITaskCreateData<T extends TaskDefinition.TaskInput = TaskDefinition.TaskInput> {\n definitionId: string;\n name: string;\n input: T;\n parentId?: string;\n}\n\nexport interface ITaskUpdateData<\n I extends TaskDefinition.TaskInput = TaskDefinition.TaskInput,\n O extends TaskDefinition.TaskOutput = TaskDefinition.TaskOutput\n> {\n name?: string;\n input?: I;\n output?: O;\n taskStatus?: TaskDataStatus;\n executionName?: string;\n startedOn?: string;\n finishedOn?: string;\n eventResponse?: GenericRecord;\n iterations?: number;\n}\n\nexport interface ITaskLogCreateInput {\n executionName: string;\n iteration: number;\n}\n\nexport interface ITaskLogUpdateInput {\n items?: ITaskLogItem[];\n}\n\nexport interface ITasksContextCrudObject {\n /**\n * Models\n */\n getTaskModel(): Promise<CmsModel>;\n getLogModel(): Promise<CmsModel>;\n /**\n * Tasks\n */\n getTask<\n T extends TaskService.TaskInput = TaskService.TaskInput,\n O extends TaskService.GenericOutput = TaskService.GenericOutput\n >(\n id: string\n ): Promise<IGetTaskResponse<T, O> | null>;\n listTasks<\n T extends TaskService.TaskInput = TaskService.TaskInput,\n O extends TaskService.GenericOutput = TaskService.GenericOutput\n >(\n params?: IListTaskParams\n ): Promise<IListTasksResponse<T, O>>;\n createTask<T extends TaskService.TaskInput = TaskService.TaskInput>(\n task: ITaskCreateData<T>\n ): Promise<ICreateTaskResponse<T>>;\n updateTask<\n T extends TaskService.TaskInput = TaskService.TaskInput,\n O extends TaskService.GenericOutput = TaskService.GenericOutput\n >(\n id: string,\n data: Partial<ITaskUpdateData<T, O>>\n ): Promise<IUpdateTaskResponse<T, O>>;\n deleteTask(id: string): Promise<IDeleteTaskResponse>;\n /**\n * Logs\n */\n createLog(task: Pick<ITask, \"id\">, data: ITaskLogCreateInput): Promise<ITaskLog>;\n updateLog(id: string, data: ITaskLogUpdateInput): Promise<ITaskLog>;\n deleteLog(id: string): Promise<boolean>;\n getLog(id: string): Promise<ITaskLog | null>;\n getLatestLog(taskId: string): Promise<ITaskLog>;\n listLogs(params: IListTaskLogParams): Promise<IListTaskLogsResponse>;\n}\n\nexport interface ITasksContextDefinitionObject {\n getDefinition: <\n I extends TaskDefinition.TaskInput = TaskDefinition.TaskInput,\n O extends TaskDefinition.TaskOutput = TaskDefinition.TaskOutput\n >(\n id: string\n ) => TaskDefinition.Runnable<I, O> | null;\n listDefinitions: () => TaskDefinition.Interface[];\n}\n\nexport interface ITaskTriggerParams<I = ITaskDataInput> {\n parent?: Pick<ITask, \"id\">;\n definition: string;\n name?: string;\n input?: I;\n delay?: number;\n}\n\nexport interface ITaskAbortParams {\n id: string;\n message?: string;\n}\n\nexport interface ITasksContextServiceObject {\n trigger: <\n T extends TaskDefinition.TaskInput = TaskDefinition.TaskInput,\n O extends TaskService.GenericOutput = TaskService.GenericOutput\n >(\n params: ITaskTriggerParams<T>\n ) => Promise<Result<ITask<T, O>, BaseError>>;\n abort: <\n T extends TaskDefinition.TaskInput = TaskDefinition.TaskInput,\n O extends TaskService.GenericOutput = TaskService.GenericOutput\n >(\n params: ITaskAbortParams\n ) => Promise<Result<ITask<T, O>, BaseError>>;\n fetchServiceInfo: (\n input: ITask<any, any> | string\n ) => Promise<Result<IStepFunctionServiceFetchResult, BaseError>>;\n}\n\nexport interface ITasksContextObject\n extends ITasksContextCrudObject,\n ITasksContextDefinitionObject,\n ITasksContextServiceObject {}\n\nexport interface Context extends BaseContext {\n tasks: ITasksContextObject;\n}\n\nexport interface TaskPermission extends SecurityPermission {\n name: \"task\";\n rwd?: string;\n}\n\nexport type ITask<\n I extends TaskService.TaskInput = TaskService.TaskInput,\n O extends TaskService.GenericOutput = TaskService.GenericOutput\n> = TaskService.Task<I, O>;\n"],"mappings":"AAeA;AACA;AACA;AAIA,WAAYA,eAAe,0BAAfA,eAAe;EAAfA,eAAe;EAAfA,eAAe;EAAA,OAAfA,eAAe;AAAA;AAwC3B,WAAYC,cAAc,0BAAdA,cAAc;EAAdA,cAAc;EAAdA,cAAc;EAAdA,cAAc;EAAdA,cAAc;EAAdA,cAAc;EAAA,OAAdA,cAAc;AAAA","ignoreList":[]}
@@ -1,22 +1,16 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.ObjectUpdater = void 0;
7
- var _objectMergeAdvanced = require("object-merge-advanced");
8
1
  /**
9
2
  * We need to use the object-merge-advanced library to merge array items properly.
10
3
  * With plain assign or lodash merge, we will lose array items from the source object.
11
4
  */
12
5
 
6
+ import { mergeAdvanced } from "object-merge-advanced";
13
7
  const mergeOptions = {
14
8
  hardArrayConcat: true
15
9
  };
16
- class ObjectUpdater {
10
+ export class ObjectUpdater {
17
11
  data = {};
18
12
  merge(target, clear = true) {
19
- const item = (0, _objectMergeAdvanced.mergeAdvanced)(target, this.data, mergeOptions);
13
+ const item = mergeAdvanced(target, this.data, mergeOptions);
20
14
  if (!clear) {
21
15
  return item;
22
16
  }
@@ -32,7 +26,7 @@ class ObjectUpdater {
32
26
  return values;
33
27
  }
34
28
  update(input) {
35
- this.data = (0, _objectMergeAdvanced.mergeAdvanced)(this.data, input, mergeOptions);
29
+ this.data = mergeAdvanced(this.data, input, mergeOptions);
36
30
  }
37
31
  isDirty() {
38
32
  return Object.keys(this.data).length > 0;
@@ -41,6 +35,5 @@ class ObjectUpdater {
41
35
  this.data = {};
42
36
  }
43
37
  }
44
- exports.ObjectUpdater = ObjectUpdater;
45
38
 
46
39
  //# sourceMappingURL=ObjectUpdater.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["_objectMergeAdvanced","require","mergeOptions","hardArrayConcat","ObjectUpdater","data","merge","target","clear","item","mergeAdvanced","fetch","values","structuredClone","update","input","isDirty","Object","keys","length","exports"],"sources":["ObjectUpdater.ts"],"sourcesContent":["/**\n * We need to use the object-merge-advanced library to merge array items properly.\n * With plain assign or lodash merge, we will lose array items from the source object.\n */\nimport type { defaults } from \"object-merge-advanced\";\nimport { mergeAdvanced } from \"object-merge-advanced\";\n\nconst mergeOptions: Partial<typeof defaults> = {\n hardArrayConcat: true\n};\n\nexport class ObjectUpdater<T> {\n private data: Partial<T> = {};\n\n public merge(target: T, clear = true): T {\n const item = mergeAdvanced(target, this.data, mergeOptions);\n if (!clear) {\n return item;\n }\n this.clear();\n return item;\n }\n\n public fetch(clear = true): Partial<T> {\n const values = structuredClone(this.data);\n if (!clear) {\n return values;\n }\n this.clear();\n return values;\n }\n public update(input: Partial<T>) {\n this.data = mergeAdvanced(this.data, input, mergeOptions);\n }\n\n public isDirty(): boolean {\n return Object.keys(this.data).length > 0;\n }\n\n private clear() {\n this.data = {};\n }\n}\n"],"mappings":";;;;;;AAKA,IAAAA,oBAAA,GAAAC,OAAA;AALA;AACA;AACA;AACA;;AAIA,MAAMC,YAAsC,GAAG;EAC3CC,eAAe,EAAE;AACrB,CAAC;AAEM,MAAMC,aAAa,CAAI;EAClBC,IAAI,GAAe,CAAC,CAAC;EAEtBC,KAAKA,CAACC,MAAS,EAAEC,KAAK,GAAG,IAAI,EAAK;IACrC,MAAMC,IAAI,GAAG,IAAAC,kCAAa,EAACH,MAAM,EAAE,IAAI,CAACF,IAAI,EAAEH,YAAY,CAAC;IAC3D,IAAI,CAACM,KAAK,EAAE;MACR,OAAOC,IAAI;IACf;IACA,IAAI,CAACD,KAAK,CAAC,CAAC;IACZ,OAAOC,IAAI;EACf;EAEOE,KAAKA,CAACH,KAAK,GAAG,IAAI,EAAc;IACnC,MAAMI,MAAM,GAAGC,eAAe,CAAC,IAAI,CAACR,IAAI,CAAC;IACzC,IAAI,CAACG,KAAK,EAAE;MACR,OAAOI,MAAM;IACjB;IACA,IAAI,CAACJ,KAAK,CAAC,CAAC;IACZ,OAAOI,MAAM;EACjB;EACOE,MAAMA,CAACC,KAAiB,EAAE;IAC7B,IAAI,CAACV,IAAI,GAAG,IAAAK,kCAAa,EAAC,IAAI,CAACL,IAAI,EAAEU,KAAK,EAAEb,YAAY,CAAC;EAC7D;EAEOc,OAAOA,CAAA,EAAY;IACtB,OAAOC,MAAM,CAACC,IAAI,CAAC,IAAI,CAACb,IAAI,CAAC,CAACc,MAAM,GAAG,CAAC;EAC5C;EAEQX,KAAKA,CAAA,EAAG;IACZ,IAAI,CAACH,IAAI,GAAG,CAAC,CAAC;EAClB;AACJ;AAACe,OAAA,CAAAhB,aAAA,GAAAA,aAAA","ignoreList":[]}
1
+ {"version":3,"names":["mergeAdvanced","mergeOptions","hardArrayConcat","ObjectUpdater","data","merge","target","clear","item","fetch","values","structuredClone","update","input","isDirty","Object","keys","length"],"sources":["ObjectUpdater.ts"],"sourcesContent":["/**\n * We need to use the object-merge-advanced library to merge array items properly.\n * With plain assign or lodash merge, we will lose array items from the source object.\n */\nimport type { defaults } from \"object-merge-advanced\";\nimport { mergeAdvanced } from \"object-merge-advanced\";\n\nconst mergeOptions: Partial<typeof defaults> = {\n hardArrayConcat: true\n};\n\nexport class ObjectUpdater<T> {\n private data: Partial<T> = {};\n\n public merge(target: T, clear = true): T {\n const item = mergeAdvanced(target, this.data, mergeOptions);\n if (!clear) {\n return item;\n }\n this.clear();\n return item;\n }\n\n public fetch(clear = true): Partial<T> {\n const values = structuredClone(this.data);\n if (!clear) {\n return values;\n }\n this.clear();\n return values;\n }\n public update(input: Partial<T>) {\n this.data = mergeAdvanced(this.data, input, mergeOptions);\n }\n\n public isDirty(): boolean {\n return Object.keys(this.data).length > 0;\n }\n\n private clear() {\n this.data = {};\n }\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;;AAEA,SAASA,aAAa,QAAQ,uBAAuB;AAErD,MAAMC,YAAsC,GAAG;EAC3CC,eAAe,EAAE;AACrB,CAAC;AAED,OAAO,MAAMC,aAAa,CAAI;EAClBC,IAAI,GAAe,CAAC,CAAC;EAEtBC,KAAKA,CAACC,MAAS,EAAEC,KAAK,GAAG,IAAI,EAAK;IACrC,MAAMC,IAAI,GAAGR,aAAa,CAACM,MAAM,EAAE,IAAI,CAACF,IAAI,EAAEH,YAAY,CAAC;IAC3D,IAAI,CAACM,KAAK,EAAE;MACR,OAAOC,IAAI;IACf;IACA,IAAI,CAACD,KAAK,CAAC,CAAC;IACZ,OAAOC,IAAI;EACf;EAEOC,KAAKA,CAACF,KAAK,GAAG,IAAI,EAAc;IACnC,MAAMG,MAAM,GAAGC,eAAe,CAAC,IAAI,CAACP,IAAI,CAAC;IACzC,IAAI,CAACG,KAAK,EAAE;MACR,OAAOG,MAAM;IACjB;IACA,IAAI,CAACH,KAAK,CAAC,CAAC;IACZ,OAAOG,MAAM;EACjB;EACOE,MAAMA,CAACC,KAAiB,EAAE;IAC7B,IAAI,CAACT,IAAI,GAAGJ,aAAa,CAAC,IAAI,CAACI,IAAI,EAAES,KAAK,EAAEZ,YAAY,CAAC;EAC7D;EAEOa,OAAOA,CAAA,EAAY;IACtB,OAAOC,MAAM,CAACC,IAAI,CAAC,IAAI,CAACZ,IAAI,CAAC,CAACa,MAAM,GAAG,CAAC;EAC5C;EAEQV,KAAKA,CAAA,EAAG;IACZ,IAAI,CAACH,IAAI,GAAG,CAAC,CAAC;EAClB;AACJ","ignoreList":[]}
@@ -1,2 +1,2 @@
1
- import type { IResponseError } from "../response/abstractions";
1
+ import type { IResponseError } from "../response/abstractions/index.js";
2
2
  export declare const getErrorProperties: (error: Error | IResponseError) => IResponseError;
@@ -1,15 +1,8 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.getErrorProperties = void 0;
7
- var _getObjectProperties = require("./getObjectProperties");
8
- const getErrorProperties = error => {
9
- const value = (0, _getObjectProperties.getObjectProperties)(error);
1
+ import { getObjectProperties } from "./getObjectProperties.js";
2
+ export const getErrorProperties = error => {
3
+ const value = getObjectProperties(error);
10
4
  delete value.stack;
11
5
  return value;
12
6
  };
13
- exports.getErrorProperties = getErrorProperties;
14
7
 
15
8
  //# sourceMappingURL=getErrorProperties.js.map