@webiny/tasks 0.0.0-unstable.eb196ccd2f → 0.0.0-unstable.f6dc066313

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
@@ -1,4 +1,4 @@
1
- import type { ITaskEvent } from "../../handler/types";
1
+ import type { ITaskEvent } from "../../handler/types.js";
2
2
  export type ITaskEventValidationResult = ITaskEvent;
3
3
  export interface ITaskEventValidation {
4
4
  validate: (event: Partial<ITaskEvent>) => ITaskEventValidationResult;
@@ -1,7 +1,3 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
1
+ export {};
6
2
 
7
3
  //# sourceMappingURL=TaskEventValidation.js.map
@@ -1 +1 @@
1
- {"version":3,"names":[],"sources":["TaskEventValidation.ts"],"sourcesContent":["import type { ITaskEvent } from \"~/handler/types\";\n\nexport type ITaskEventValidationResult = ITaskEvent;\n\nexport interface ITaskEventValidation {\n validate: (event: Partial<ITaskEvent>) => ITaskEventValidationResult;\n}\n"],"mappings":"","ignoreList":[]}
1
+ {"version":3,"names":[],"sources":["TaskEventValidation.ts"],"sourcesContent":["import type { ITaskEvent } from \"~/handler/types.js\";\n\nexport type ITaskEventValidationResult = ITaskEvent;\n\nexport interface ITaskEventValidation {\n validate: (event: Partial<ITaskEvent>) => ITaskEventValidationResult;\n}\n"],"mappings":"","ignoreList":[]}
@@ -1,5 +1,5 @@
1
- import type { IResponseResult } from "../../response/abstractions";
2
- import type { ITask, ITaskDataInput, ITaskDefinition } from "../../types";
3
- export interface ITaskManager<T = ITaskDataInput> {
4
- run: (definition: ITaskDefinition, task: ITask<T>) => Promise<IResponseResult>;
1
+ import type { IResponseResult } from "../../response/abstractions/index.js";
2
+ import { TaskDefinition } from "@webiny/api-core/features/task/TaskDefinition/index.js";
3
+ export interface ITaskManager {
4
+ run: (definition: TaskDefinition.Runnable) => Promise<IResponseResult>;
5
5
  }
@@ -1,7 +1,3 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
1
+ export {};
6
2
 
7
3
  //# sourceMappingURL=TaskManager.js.map
@@ -1 +1 @@
1
- {"version":3,"names":[],"sources":["TaskManager.ts"],"sourcesContent":["import type { IResponseResult } from \"~/response/abstractions\";\nimport type { ITask, ITaskDataInput, ITaskDefinition } from \"~/types\";\n\nexport interface ITaskManager<T = ITaskDataInput> {\n run: (definition: ITaskDefinition, task: ITask<T>) => Promise<IResponseResult>;\n}\n"],"mappings":"","ignoreList":[]}
1
+ {"version":3,"names":[],"sources":["TaskManager.ts"],"sourcesContent":["import type { IResponseResult } from \"~/response/abstractions/index.js\";\nimport { TaskDefinition } from \"@webiny/api-core/features/task/TaskDefinition/index.js\";\n\nexport interface ITaskManager {\n run: (definition: TaskDefinition.Runnable) => Promise<IResponseResult>;\n}\n"],"mappings":"","ignoreList":[]}
@@ -1,18 +1,18 @@
1
- import type { IResponseError, ITask, ITaskDataInput, ITaskLogItemData, ITaskResponseDoneResultOutput, ITaskUpdateData, TaskDataStatus } from "../../types";
2
- import type { GenericRecord } from "@webiny/api/types";
3
- export type ITaskManagerStoreUpdateTaskValues<T = ITaskDataInput> = T;
4
- export interface ITaskManagerStoreUpdateTaskValuesCb<T = ITaskDataInput> {
1
+ import type { IResponseError, ITask, ITaskLogItemData, ITaskUpdateData, TaskDataStatus } from "../../types.js";
2
+ import { TaskDefinition } from "@webiny/api-core/features/task/TaskDefinition/index.js";
3
+ export type ITaskManagerStoreUpdateTaskValues<T extends TaskDefinition.TaskInput = TaskDefinition.TaskInput> = T;
4
+ export interface ITaskManagerStoreUpdateTaskValuesCb<T extends TaskDefinition.TaskInput = TaskDefinition.TaskInput> {
5
5
  (input: T): T;
6
6
  }
7
7
  export interface ITaskManagerStoreUpdateTaskInputOptions {
8
8
  save: boolean;
9
9
  }
10
- export type ITaskManagerStoreUpdateTaskInputParam<T = ITaskDataInput> = ITaskManagerStoreUpdateTaskValuesCb<T> | Partial<ITaskManagerStoreUpdateTaskValues<T>>;
11
- export interface ITaskManagerStoreUpdateTaskParamCb<T = ITaskDataInput, O extends ITaskResponseDoneResultOutput = ITaskResponseDoneResultOutput> {
10
+ export type ITaskManagerStoreUpdateTaskInputParam<T extends TaskDefinition.TaskInput = TaskDefinition.TaskInput> = ITaskManagerStoreUpdateTaskValuesCb<T> | Partial<ITaskManagerStoreUpdateTaskValues<T>>;
11
+ export interface ITaskManagerStoreUpdateTaskParamCb<T extends TaskDefinition.TaskInput = TaskDefinition.TaskInput, O extends TaskDefinition.TaskOutput = TaskDefinition.TaskOutput> {
12
12
  (task: ITask<T, O>): ITaskUpdateData<T, O>;
13
13
  }
14
- export type ITaskManagerStoreUpdateTask<T = ITaskDataInput, O extends ITaskResponseDoneResultOutput = ITaskResponseDoneResultOutput> = ITaskUpdateData<T, O>;
15
- export type ITaskManagerStoreUpdateTaskParams<T = ITaskDataInput, O extends ITaskResponseDoneResultOutput = ITaskResponseDoneResultOutput> = ITaskManagerStoreUpdateTaskParamCb<T, O> | Partial<ITaskManagerStoreUpdateTask<T, O>>;
14
+ export type ITaskManagerStoreUpdateTask<T extends TaskDefinition.TaskInput = TaskDefinition.TaskInput, O extends TaskDefinition.TaskOutput = TaskDefinition.TaskOutput> = ITaskUpdateData<T, O>;
15
+ export type ITaskManagerStoreUpdateTaskParams<T extends TaskDefinition.TaskInput = TaskDefinition.TaskInput, O extends TaskDefinition.TaskOutput = TaskDefinition.TaskOutput> = ITaskManagerStoreUpdateTaskParamCb<T, O> | Partial<ITaskManagerStoreUpdateTask<T, O>>;
16
16
  export interface ITaskManagerStoreInfoLog {
17
17
  message: string;
18
18
  data?: ITaskLogItemData;
@@ -43,7 +43,7 @@ export interface ITaskManagerStoreAddLogOptions {
43
43
  /**
44
44
  * Interface should not be used outside the @webiny/tasks package.
45
45
  */
46
- export interface ITaskManagerStorePrivate<T = ITaskDataInput, O extends ITaskResponseDoneResultOutput = ITaskResponseDoneResultOutput> {
46
+ export interface ITaskManagerStorePrivate<T extends TaskDefinition.TaskInput = TaskDefinition.TaskInput, O extends TaskDefinition.TaskOutput = TaskDefinition.TaskOutput> {
47
47
  getTask: () => ITask<T, O>;
48
48
  getStatus: () => TaskDataStatus;
49
49
  /**
@@ -54,7 +54,7 @@ export interface ITaskManagerStorePrivate<T = ITaskDataInput, O extends ITaskRes
54
54
  * List all child tasks of the current task.
55
55
  * If definitionId is provided, filter by that parameter.
56
56
  */
57
- listChildTasks<T = GenericRecord, O extends ITaskResponseDoneResultOutput = ITaskResponseDoneResultOutput>(definitionId?: string): Promise<ITask<T, O>[]>;
57
+ listChildTasks<T extends TaskDefinition.TaskInput = TaskDefinition.TaskInput, O extends TaskDefinition.TaskOutput = TaskDefinition.TaskOutput>(definitionId?: string): Promise<ITask<T, O>[]>;
58
58
  /**
59
59
  * Update the task input, which are used to store custom user data.
60
60
  * You can send partial input, and it will be merged with the existing input.
@@ -89,4 +89,4 @@ export interface ITaskManagerStorePrivate<T = ITaskDataInput, O extends ITaskRes
89
89
  */
90
90
  save(): Promise<void>;
91
91
  }
92
- export type ITaskManagerStore<T = ITaskDataInput, O extends ITaskResponseDoneResultOutput = ITaskResponseDoneResultOutput> = Omit<ITaskManagerStorePrivate<T, O>, "save">;
92
+ export type ITaskManagerStore<T extends TaskDefinition.TaskInput = TaskDefinition.TaskInput, O extends TaskDefinition.TaskOutput = TaskDefinition.TaskOutput> = Omit<ITaskManagerStorePrivate<T, O>, "save">;
@@ -1,7 +1,3 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
1
+ export {};
6
2
 
7
3
  //# sourceMappingURL=TaskManagerStore.js.map
@@ -1 +1 @@
1
- {"version":3,"names":[],"sources":["TaskManagerStore.ts"],"sourcesContent":["import type {\n IResponseError,\n ITask,\n ITaskDataInput,\n ITaskLogItemData,\n ITaskResponseDoneResultOutput,\n ITaskUpdateData,\n TaskDataStatus\n} from \"~/types\";\nimport type { GenericRecord } from \"@webiny/api/types\";\n\nexport type ITaskManagerStoreUpdateTaskValues<T = ITaskDataInput> = T;\n\nexport interface ITaskManagerStoreUpdateTaskValuesCb<T = ITaskDataInput> {\n (input: T): T;\n}\n\nexport interface ITaskManagerStoreUpdateTaskInputOptions {\n save: boolean;\n}\n\nexport type ITaskManagerStoreUpdateTaskInputParam<T = ITaskDataInput> =\n | ITaskManagerStoreUpdateTaskValuesCb<T>\n | Partial<ITaskManagerStoreUpdateTaskValues<T>>;\n\nexport interface ITaskManagerStoreUpdateTaskParamCb<\n T = ITaskDataInput,\n O extends ITaskResponseDoneResultOutput = ITaskResponseDoneResultOutput\n> {\n (task: ITask<T, O>): ITaskUpdateData<T, O>;\n}\n\nexport type ITaskManagerStoreUpdateTask<\n T = ITaskDataInput,\n O extends ITaskResponseDoneResultOutput = ITaskResponseDoneResultOutput\n> = ITaskUpdateData<T, O>;\n\nexport type ITaskManagerStoreUpdateTaskParams<\n T = ITaskDataInput,\n O extends ITaskResponseDoneResultOutput = ITaskResponseDoneResultOutput\n> = ITaskManagerStoreUpdateTaskParamCb<T, O> | Partial<ITaskManagerStoreUpdateTask<T, O>>;\n\nexport interface ITaskManagerStoreInfoLog {\n message: string;\n data?: ITaskLogItemData;\n}\n\nexport interface ITaskManagerStoreErrorLog {\n message: string;\n data?: ITaskLogItemData;\n error: IResponseError | Error;\n}\n\nexport interface ITaskManagerStoreSetOutputOptions {\n /**\n * Default is true.\n */\n save?: boolean;\n}\n\nexport interface ITaskManagerStoreUpdateTaskOptions {\n /**\n * Default is true.\n */\n save?: boolean;\n}\n\nexport interface ITaskManagerStoreAddLogOptions {\n /**\n * Default is true.\n */\n save?: boolean;\n}\n\n/**\n * Interface should not be used outside the @webiny/tasks package.\n */\nexport interface ITaskManagerStorePrivate<\n T = ITaskDataInput,\n O extends ITaskResponseDoneResultOutput = ITaskResponseDoneResultOutput\n> {\n getTask: () => ITask<T, O>;\n getStatus: () => TaskDataStatus;\n /**\n * @throws {Error} If task not found or something goes wrong during the database update.\n */\n updateTask(\n params: ITaskManagerStoreUpdateTaskParams<T, O>,\n options?: ITaskManagerStoreUpdateTaskOptions\n ): Promise<void>;\n /**\n * List all child tasks of the current task.\n * If definitionId is provided, filter by that parameter.\n */\n listChildTasks<\n T = GenericRecord,\n O extends ITaskResponseDoneResultOutput = ITaskResponseDoneResultOutput\n >(\n definitionId?: string\n ): Promise<ITask<T, O>[]>;\n /**\n * Update the task input, which are used to store custom user data.\n * You can send partial input, and it will be merged with the existing input.\n *\n * @throws {Error} If task not found or something goes wrong during the database update.\n */\n updateInput: (\n params: ITaskManagerStoreUpdateTaskInputParam<T>,\n options?: ITaskManagerStoreUpdateTaskInputOptions\n ) => Promise<void>;\n getInput: () => T;\n /**\n * Update the task output, which are used to store the output data.\n * You can send partial output, and it will be merged with the existing output.\n *\n * Second parameter is optional options, and it contains a possibility not to store the task immediately.\n *\n * @throws {Error} If task not found or something goes wrong during the database update.\n */\n updateOutput: (\n values: Partial<O>,\n options?: ITaskManagerStoreSetOutputOptions\n ) => Promise<void>;\n getOutput: () => O;\n /**\n * @throws {Error} If task not found or something goes wrong during the database update.\n */\n addInfoLog: (log: ITaskManagerStoreInfoLog) => Promise<void>;\n /**\n * @throws {Error} If task not found or something goes wrong during the database update.\n *\n *\n */\n addErrorLog: (log: ITaskManagerStoreErrorLog) => Promise<void>;\n /**\n * Should store the task and logs into the database, if any.\n * If nothing to update, it should skip calling the internal store methods.\n */\n save(): Promise<void>;\n}\n\nexport type ITaskManagerStore<\n T = ITaskDataInput,\n O extends ITaskResponseDoneResultOutput = ITaskResponseDoneResultOutput\n> = Omit<ITaskManagerStorePrivate<T, O>, \"save\">;\n"],"mappings":"","ignoreList":[]}
1
+ {"version":3,"names":[],"sources":["TaskManagerStore.ts"],"sourcesContent":["import type {\n IResponseError,\n ITask,\n ITaskLogItemData,\n ITaskUpdateData,\n TaskDataStatus\n} from \"~/types.js\";\nimport { TaskDefinition } from \"@webiny/api-core/features/task/TaskDefinition/index.js\";\n\nexport type ITaskManagerStoreUpdateTaskValues<\n T extends TaskDefinition.TaskInput = TaskDefinition.TaskInput\n> = T;\n\nexport interface ITaskManagerStoreUpdateTaskValuesCb<\n T extends TaskDefinition.TaskInput = TaskDefinition.TaskInput\n> {\n (input: T): T;\n}\n\nexport interface ITaskManagerStoreUpdateTaskInputOptions {\n save: boolean;\n}\n\nexport type ITaskManagerStoreUpdateTaskInputParam<\n T extends TaskDefinition.TaskInput = TaskDefinition.TaskInput\n> = ITaskManagerStoreUpdateTaskValuesCb<T> | Partial<ITaskManagerStoreUpdateTaskValues<T>>;\n\nexport interface ITaskManagerStoreUpdateTaskParamCb<\n T extends TaskDefinition.TaskInput = TaskDefinition.TaskInput,\n O extends TaskDefinition.TaskOutput = TaskDefinition.TaskOutput\n> {\n (task: ITask<T, O>): ITaskUpdateData<T, O>;\n}\n\nexport type ITaskManagerStoreUpdateTask<\n T extends TaskDefinition.TaskInput = TaskDefinition.TaskInput,\n O extends TaskDefinition.TaskOutput = TaskDefinition.TaskOutput\n> = ITaskUpdateData<T, O>;\n\nexport type ITaskManagerStoreUpdateTaskParams<\n T extends TaskDefinition.TaskInput = TaskDefinition.TaskInput,\n O extends TaskDefinition.TaskOutput = TaskDefinition.TaskOutput\n> = ITaskManagerStoreUpdateTaskParamCb<T, O> | Partial<ITaskManagerStoreUpdateTask<T, O>>;\n\nexport interface ITaskManagerStoreInfoLog {\n message: string;\n data?: ITaskLogItemData;\n}\n\nexport interface ITaskManagerStoreErrorLog {\n message: string;\n data?: ITaskLogItemData;\n error: IResponseError | Error;\n}\n\nexport interface ITaskManagerStoreSetOutputOptions {\n /**\n * Default is true.\n */\n save?: boolean;\n}\n\nexport interface ITaskManagerStoreUpdateTaskOptions {\n /**\n * Default is true.\n */\n save?: boolean;\n}\n\nexport interface ITaskManagerStoreAddLogOptions {\n /**\n * Default is true.\n */\n save?: boolean;\n}\n\n/**\n * Interface should not be used outside the @webiny/tasks package.\n */\nexport interface ITaskManagerStorePrivate<\n T extends TaskDefinition.TaskInput = TaskDefinition.TaskInput,\n O extends TaskDefinition.TaskOutput = TaskDefinition.TaskOutput\n> {\n getTask: () => ITask<T, O>;\n getStatus: () => TaskDataStatus;\n /**\n * @throws {Error} If task not found or something goes wrong during the database update.\n */\n updateTask(\n params: ITaskManagerStoreUpdateTaskParams<T, O>,\n options?: ITaskManagerStoreUpdateTaskOptions\n ): Promise<void>;\n /**\n * List all child tasks of the current task.\n * If definitionId is provided, filter by that parameter.\n */\n listChildTasks<\n T extends TaskDefinition.TaskInput = TaskDefinition.TaskInput,\n O extends TaskDefinition.TaskOutput = TaskDefinition.TaskOutput\n >(\n definitionId?: string\n ): Promise<ITask<T, O>[]>;\n /**\n * Update the task input, which are used to store custom user data.\n * You can send partial input, and it will be merged with the existing input.\n *\n * @throws {Error} If task not found or something goes wrong during the database update.\n */\n updateInput: (\n params: ITaskManagerStoreUpdateTaskInputParam<T>,\n options?: ITaskManagerStoreUpdateTaskInputOptions\n ) => Promise<void>;\n getInput: () => T;\n /**\n * Update the task output, which are used to store the output data.\n * You can send partial output, and it will be merged with the existing output.\n *\n * Second parameter is optional options, and it contains a possibility not to store the task immediately.\n *\n * @throws {Error} If task not found or something goes wrong during the database update.\n */\n updateOutput: (\n values: Partial<O>,\n options?: ITaskManagerStoreSetOutputOptions\n ) => Promise<void>;\n getOutput: () => O;\n /**\n * @throws {Error} If task not found or something goes wrong during the database update.\n */\n addInfoLog: (log: ITaskManagerStoreInfoLog) => Promise<void>;\n /**\n * @throws {Error} If task not found or something goes wrong during the database update.\n *\n *\n */\n addErrorLog: (log: ITaskManagerStoreErrorLog) => Promise<void>;\n /**\n * Should store the task and logs into the database, if any.\n * If nothing to update, it should skip calling the internal store methods.\n */\n save(): Promise<void>;\n}\n\nexport type ITaskManagerStore<\n T extends TaskDefinition.TaskInput = TaskDefinition.TaskInput,\n O extends TaskDefinition.TaskOutput = TaskDefinition.TaskOutput\n> = Omit<ITaskManagerStorePrivate<T, O>, \"save\">;\n"],"mappings":"","ignoreList":[]}
@@ -1,6 +1,6 @@
1
- import type { Context } from "../../types";
2
- import type { ITaskEvent } from "../../handler/types";
3
- import type { IResponseResult } from "../../response/abstractions";
1
+ import type { Context } from "../../types.js";
2
+ import type { ITaskEvent } from "../../handler/types.js";
3
+ import type { IResponseResult } from "../../response/abstractions/index.js";
4
4
  import type { ITimer } from "@webiny/handler-aws";
5
5
  export interface IIsCloseToTimeoutCallable {
6
6
  (seconds?: number): boolean;
@@ -1,7 +1,3 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
1
+ export {};
6
2
 
7
3
  //# sourceMappingURL=TaskRunner.js.map
@@ -1 +1 @@
1
- {"version":3,"names":[],"sources":["TaskRunner.ts"],"sourcesContent":["import type { Context } from \"~/types\";\nimport type { ITaskEvent } from \"~/handler/types\";\nimport type { IResponseResult } from \"~/response/abstractions\";\nimport type { ITimer } from \"@webiny/handler-aws\";\n\nexport interface IIsCloseToTimeoutCallable {\n (seconds?: number): boolean;\n}\n\nexport interface ITaskRunner<C extends Context = Context> {\n context: C;\n isCloseToTimeout: IIsCloseToTimeoutCallable;\n timer: ITimer;\n run(event: ITaskEvent): Promise<IResponseResult>;\n}\n"],"mappings":"","ignoreList":[]}
1
+ {"version":3,"names":[],"sources":["TaskRunner.ts"],"sourcesContent":["import type { Context } from \"~/types.js\";\nimport type { ITaskEvent } from \"~/handler/types.js\";\nimport type { IResponseResult } from \"~/response/abstractions/index.js\";\nimport type { ITimer } from \"@webiny/handler-aws\";\n\nexport interface IIsCloseToTimeoutCallable {\n (seconds?: number): boolean;\n}\n\nexport interface ITaskRunner<C extends Context = Context> {\n context: C;\n isCloseToTimeout: IIsCloseToTimeoutCallable;\n timer: ITimer;\n run(event: ITaskEvent): Promise<IResponseResult>;\n}\n"],"mappings":"","ignoreList":[]}
@@ -1,5 +1,5 @@
1
- export * from "./TaskControl";
2
- export * from "./TaskEventValidation";
3
- export * from "./TaskManager";
4
- export * from "./TaskRunner";
5
- export * from "./TaskManagerStore";
1
+ export * from "./TaskControl.js";
2
+ export * from "./TaskEventValidation.js";
3
+ export * from "./TaskManager.js";
4
+ export * from "./TaskRunner.js";
5
+ export * from "./TaskManagerStore.js";
@@ -1,62 +1,7 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- var _TaskControl = require("./TaskControl");
7
- Object.keys(_TaskControl).forEach(function (key) {
8
- if (key === "default" || key === "__esModule") return;
9
- if (key in exports && exports[key] === _TaskControl[key]) return;
10
- Object.defineProperty(exports, key, {
11
- enumerable: true,
12
- get: function () {
13
- return _TaskControl[key];
14
- }
15
- });
16
- });
17
- var _TaskEventValidation = require("./TaskEventValidation");
18
- Object.keys(_TaskEventValidation).forEach(function (key) {
19
- if (key === "default" || key === "__esModule") return;
20
- if (key in exports && exports[key] === _TaskEventValidation[key]) return;
21
- Object.defineProperty(exports, key, {
22
- enumerable: true,
23
- get: function () {
24
- return _TaskEventValidation[key];
25
- }
26
- });
27
- });
28
- var _TaskManager = require("./TaskManager");
29
- Object.keys(_TaskManager).forEach(function (key) {
30
- if (key === "default" || key === "__esModule") return;
31
- if (key in exports && exports[key] === _TaskManager[key]) return;
32
- Object.defineProperty(exports, key, {
33
- enumerable: true,
34
- get: function () {
35
- return _TaskManager[key];
36
- }
37
- });
38
- });
39
- var _TaskRunner = require("./TaskRunner");
40
- Object.keys(_TaskRunner).forEach(function (key) {
41
- if (key === "default" || key === "__esModule") return;
42
- if (key in exports && exports[key] === _TaskRunner[key]) return;
43
- Object.defineProperty(exports, key, {
44
- enumerable: true,
45
- get: function () {
46
- return _TaskRunner[key];
47
- }
48
- });
49
- });
50
- var _TaskManagerStore = require("./TaskManagerStore");
51
- Object.keys(_TaskManagerStore).forEach(function (key) {
52
- if (key === "default" || key === "__esModule") return;
53
- if (key in exports && exports[key] === _TaskManagerStore[key]) return;
54
- Object.defineProperty(exports, key, {
55
- enumerable: true,
56
- get: function () {
57
- return _TaskManagerStore[key];
58
- }
59
- });
60
- });
1
+ export * from "./TaskControl.js";
2
+ export * from "./TaskEventValidation.js";
3
+ export * from "./TaskManager.js";
4
+ export * from "./TaskRunner.js";
5
+ export * from "./TaskManagerStore.js";
61
6
 
62
7
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["_TaskControl","require","Object","keys","forEach","key","exports","defineProperty","enumerable","get","_TaskEventValidation","_TaskManager","_TaskRunner","_TaskManagerStore"],"sources":["index.ts"],"sourcesContent":["export * from \"./TaskControl\";\nexport * from \"./TaskEventValidation\";\nexport * from \"./TaskManager\";\nexport * from \"./TaskRunner\";\nexport * from \"./TaskManagerStore\";\n"],"mappings":";;;;;AAAA,IAAAA,YAAA,GAAAC,OAAA;AAAAC,MAAA,CAAAC,IAAA,CAAAH,YAAA,EAAAI,OAAA,WAAAC,GAAA;EAAA,IAAAA,GAAA,kBAAAA,GAAA;EAAA,IAAAA,GAAA,IAAAC,OAAA,IAAAA,OAAA,CAAAD,GAAA,MAAAL,YAAA,CAAAK,GAAA;EAAAH,MAAA,CAAAK,cAAA,CAAAD,OAAA,EAAAD,GAAA;IAAAG,UAAA;IAAAC,GAAA,WAAAA,CAAA;MA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AA;EAAA,IAAAA,GAAA,kBAAAA,GAAA;EAAA,IAAAA,GAAA,IAAAC,OAAA,IAAAA,OAAA,CAAAD,GAAA,MAAAQ,iBAAA,CAAAR,GAAA;EAAAH,MAAA,CAAAK,cAAA,CAAAD,OAAA,EAAAD,GAAA;IAAAG,UAAA;IAAAC,GAAA,WAAAA,CAAA;MAAA,OAAAI,iBAAA,CAAAR,GAAA;IAAA;EAAA;AAAA","ignoreList":[]}
1
+ {"version":3,"names":[],"sources":["index.ts"],"sourcesContent":["export * from \"./TaskControl.js\";\nexport * from \"./TaskEventValidation.js\";\nexport * from \"./TaskManager.js\";\nexport * from \"./TaskRunner.js\";\nexport * from \"./TaskManagerStore.js\";\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA","ignoreList":[]}
package/runner/index.d.ts CHANGED
@@ -1 +1 @@
1
- export * from "./TaskRunner";
1
+ export * from "./TaskRunner.js";
package/runner/index.js CHANGED
@@ -1,18 +1,3 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- var _TaskRunner = require("./TaskRunner");
7
- Object.keys(_TaskRunner).forEach(function (key) {
8
- if (key === "default" || key === "__esModule") return;
9
- if (key in exports && exports[key] === _TaskRunner[key]) return;
10
- Object.defineProperty(exports, key, {
11
- enumerable: true,
12
- get: function () {
13
- return _TaskRunner[key];
14
- }
15
- });
16
- });
1
+ export * from "./TaskRunner.js";
17
2
 
18
3
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["_TaskRunner","require","Object","keys","forEach","key","exports","defineProperty","enumerable","get"],"sources":["index.ts"],"sourcesContent":["export * from \"./TaskRunner\";\n"],"mappings":";;;;;AAAA,IAAAA,WAAA,GAAAC,OAAA;AAAAC,MAAA,CAAAC,IAAA,CAAAH,WAAA,EAAAI,OAAA,WAAAC,GAAA;EAAA,IAAAA,GAAA,kBAAAA,GAAA;EAAA,IAAAA,GAAA,IAAAC,OAAA,IAAAA,OAAA,CAAAD,GAAA,MAAAL,WAAA,CAAAK,GAAA;EAAAH,MAAA,CAAAK,cAAA,CAAAD,OAAA,EAAAD,GAAA;IAAAG,UAAA;IAAAC,GAAA,WAAAA,CAAA;MAAA,OAAAT,WAAA,CAAAK,GAAA;IAAA;EAAA;AAAA","ignoreList":[]}
1
+ {"version":3,"names":[],"sources":["index.ts"],"sourcesContent":["export * from \"./TaskRunner.js\";\n"],"mappings":"AAAA","ignoreList":[]}
@@ -1,10 +1,9 @@
1
- import type { ITaskService, ITaskServiceCreatePluginParams, ITaskServiceTask } from "../plugins";
2
- import { TaskServicePlugin } from "../plugins";
3
- import type { PutEventsCommandOutput } from "@webiny/aws-sdk/client-eventbridge";
4
- import type { GenericRecord } from "@webiny/api/types";
1
+ import type { ITaskService, ITaskServiceCreatePluginParams, ITaskServiceTask } from "../plugins/index.js";
2
+ import { TaskServicePlugin } from "../plugins/index.js";
3
+ import type { PutEventsCommandOutput } from "@webiny/aws-sdk/client-eventbridge/index.js";
4
+ import type { GenericRecord } from "@webiny/api/types.js";
5
5
  declare class EventBridgeService implements ITaskService {
6
6
  protected readonly getTenant: () => string;
7
- protected readonly getLocale: () => string;
8
7
  private readonly client;
9
8
  constructor(params: ITaskServiceCreatePluginParams);
10
9
  send(task: ITaskServiceTask, delay: number): Promise<PutEventsCommandOutput>;
@@ -1,19 +1,12 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.EventBridgeEventTransportPlugin = void 0;
7
- var _plugins = require("../plugins");
8
- var _clientEventbridge = require("@webiny/aws-sdk/client-eventbridge");
9
- var _error = require("@webiny/error");
1
+ import { TaskServicePlugin } from "../plugins/index.js";
2
+ import { EventBridgeClient, PutEventsCommand } from "@webiny/aws-sdk/client-eventbridge/index.js";
3
+ import { WebinyError } from "@webiny/error";
10
4
  class EventBridgeService {
11
5
  constructor(params) {
12
- this.client = new _clientEventbridge.EventBridgeClient({
6
+ this.client = new EventBridgeClient({
13
7
  region: process.env.AWS_REGION
14
8
  });
15
9
  this.getTenant = params.getTenant;
16
- this.getLocale = params.getLocale;
17
10
  }
18
11
  async send(task, delay) {
19
12
  /**
@@ -24,10 +17,9 @@ class EventBridgeService {
24
17
  webinyTaskId: task.id,
25
18
  webinyTaskDefinitionId: task.definitionId,
26
19
  tenant: this.getTenant(),
27
- locale: this.getLocale(),
28
20
  delay
29
21
  };
30
- const cmd = new _clientEventbridge.PutEventsCommand({
22
+ const cmd = new PutEventsCommand({
31
23
  Entries: [{
32
24
  Source: "webiny-api-tasks",
33
25
  EventBusName: String(process.env.EVENT_BUS),
@@ -39,22 +31,21 @@ class EventBridgeService {
39
31
  const result = await this.client.send(cmd);
40
32
  return JSON.parse(JSON.stringify(result));
41
33
  } catch (ex) {
42
- throw new _error.WebinyError(ex.message || "Could not trigger task via Event Bridge!", ex.code || "TRIGGER_TASK_ERROR", {
34
+ throw new WebinyError(ex.message || "Could not trigger task via Event Bridge!", ex.code || "TRIGGER_TASK_ERROR", {
43
35
  event,
44
36
  ...(ex.data || {})
45
37
  });
46
38
  }
47
39
  }
48
40
  async fetch() {
49
- throw new _error.WebinyError("Not implemented!", "NOT_IMPLEMENTED");
41
+ throw new WebinyError("Not implemented!", "NOT_IMPLEMENTED");
50
42
  }
51
43
  }
52
- class EventBridgeEventTransportPlugin extends _plugins.TaskServicePlugin {
44
+ export class EventBridgeEventTransportPlugin extends TaskServicePlugin {
53
45
  name = "task.eventBridgeEventTransport";
54
46
  createService(params) {
55
47
  return new EventBridgeService(params);
56
48
  }
57
49
  }
58
- exports.EventBridgeEventTransportPlugin = EventBridgeEventTransportPlugin;
59
50
 
60
51
  //# sourceMappingURL=EventBridgeEventTransportPlugin.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["_plugins","require","_clientEventbridge","_error","EventBridgeService","constructor","params","client","EventBridgeClient","region","process","env","AWS_REGION","getTenant","getLocale","send","task","delay","event","webinyTaskId","id","webinyTaskDefinitionId","definitionId","tenant","locale","cmd","PutEventsCommand","Entries","Source","EventBusName","String","EVENT_BUS","DetailType","Detail","JSON","stringify","result","parse","ex","WebinyError","message","code","data","fetch","EventBridgeEventTransportPlugin","TaskServicePlugin","name","createService","exports"],"sources":["EventBridgeEventTransportPlugin.ts"],"sourcesContent":["import type { ITaskService, ITaskServiceCreatePluginParams, ITaskServiceTask } from \"~/plugins\";\nimport { TaskServicePlugin } from \"~/plugins\";\nimport type { ITaskEventInput } from \"~/types\";\nimport type { PutEventsCommandOutput } from \"@webiny/aws-sdk/client-eventbridge\";\nimport { EventBridgeClient, PutEventsCommand } from \"@webiny/aws-sdk/client-eventbridge\";\nimport { WebinyError } from \"@webiny/error\";\nimport type { GenericRecord } from \"@webiny/api/types\";\n\nclass EventBridgeService implements ITaskService {\n protected readonly getTenant: () => string;\n protected readonly getLocale: () => string;\n private readonly client: EventBridgeClient;\n\n public constructor(params: ITaskServiceCreatePluginParams) {\n this.client = new EventBridgeClient({\n region: process.env.AWS_REGION\n });\n this.getTenant = params.getTenant;\n this.getLocale = params.getLocale;\n }\n\n public async send(task: ITaskServiceTask, delay: number): Promise<PutEventsCommandOutput> {\n /**\n * The ITaskEvent is what our handler expect to get.\n * Endpoint and stateMachineId are added by the step function.\n */\n const event: ITaskEventInput = {\n webinyTaskId: task.id,\n webinyTaskDefinitionId: task.definitionId,\n tenant: this.getTenant(),\n locale: this.getLocale(),\n delay\n };\n\n const cmd = new PutEventsCommand({\n Entries: [\n {\n Source: \"webiny-api-tasks\",\n EventBusName: String(process.env.EVENT_BUS),\n DetailType: \"WebinyBackgroundTask\",\n Detail: JSON.stringify(event)\n }\n ]\n });\n try {\n const result = await this.client.send(cmd);\n\n return JSON.parse(JSON.stringify(result));\n } catch (ex) {\n throw new WebinyError(\n ex.message || \"Could not trigger task via Event Bridge!\",\n ex.code || \"TRIGGER_TASK_ERROR\",\n {\n event,\n ...(ex.data || {})\n }\n );\n }\n }\n\n public async fetch(): Promise<GenericRecord> {\n throw new WebinyError(\"Not implemented!\", \"NOT_IMPLEMENTED\");\n }\n}\n\nexport class EventBridgeEventTransportPlugin extends TaskServicePlugin {\n public override name = \"task.eventBridgeEventTransport\";\n public createService(params: ITaskServiceCreatePluginParams) {\n return new EventBridgeService(params);\n }\n}\n"],"mappings":";;;;;;AACA,IAAAA,QAAA,GAAAC,OAAA;AAGA,IAAAC,kBAAA,GAAAD,OAAA;AACA,IAAAE,MAAA,GAAAF,OAAA;AAGA,MAAMG,kBAAkB,CAAyB;EAKtCC,WAAWA,CAACC,MAAsC,EAAE;IACvD,IAAI,CAACC,MAAM,GAAG,IAAIC,oCAAiB,CAAC;MAChCC,MAAM,EAAEC,OAAO,CAACC,GAAG,CAACC;IACxB,CAAC,CAAC;IACF,IAAI,CAACC,SAAS,GAAGP,MAAM,CAACO,SAAS;IACjC,IAAI,CAACC,SAAS,GAAGR,MAAM,CAACQ,SAAS;EACrC;EAEA,MAAaC,IAAIA,CAACC,IAAsB,EAAEC,KAAa,EAAmC;IACtF;AACR;AACA;AACA;IACQ,MAAMC,KAAsB,GAAG;MAC3BC,YAAY,EAAEH,IAAI,CAACI,EAAE;MACrBC,sBAAsB,EAAEL,IAAI,CAACM,YAAY;MACzCC,MAAM,EAAE,IAAI,CAACV,SAAS,CAAC,CAAC;MACxBW,MAAM,EAAE,IAAI,CAACV,SAAS,CAAC,CAAC;MACxBG;IACJ,CAAC;IAED,MAAMQ,GAAG,GAAG,IAAIC,mCAAgB,CAAC;MAC7BC,OAAO,EAAE,CACL;QACIC,MAAM,EAAE,kBAAkB;QAC1BC,YAAY,EAAEC,MAAM,CAACpB,OAAO,CAACC,GAAG,CAACoB,SAAS,CAAC;QAC3CC,UAAU,EAAE,sBAAsB;QAClCC,MAAM,EAAEC,IAAI,CAACC,SAAS,CAACjB,KAAK;MAChC,CAAC;IAET,CAAC,CAAC;IACF,IAAI;MACA,MAAMkB,MAAM,GAAG,MAAM,IAAI,CAAC7B,MAAM,CAACQ,IAAI,CAACU,GAAG,CAAC;MAE1C,OAAOS,IAAI,CAACG,KAAK,CAACH,IAAI,CAACC,SAAS,CAACC,MAAM,CAAC,CAAC;IAC7C,CAAC,CAAC,OAAOE,EAAE,EAAE;MACT,MAAM,IAAIC,kBAAW,CACjBD,EAAE,CAACE,OAAO,IAAI,0CAA0C,EACxDF,EAAE,CAACG,IAAI,IAAI,oBAAoB,EAC/B;QACIvB,KAAK;QACL,IAAIoB,EAAE,CAACI,IAAI,IAAI,CAAC,CAAC;MACrB,CACJ,CAAC;IACL;EACJ;EAEA,MAAaC,KAAKA,CAAA,EAA2B;IACzC,MAAM,IAAIJ,kBAAW,CAAC,kBAAkB,EAAE,iBAAiB,CAAC;EAChE;AACJ;AAEO,MAAMK,+BAA+B,SAASC,0BAAiB,CAAC;EACnDC,IAAI,GAAG,gCAAgC;EAChDC,aAAaA,CAACzC,MAAsC,EAAE;IACzD,OAAO,IAAIF,kBAAkB,CAACE,MAAM,CAAC;EACzC;AACJ;AAAC0C,OAAA,CAAAJ,+BAAA,GAAAA,+BAAA","ignoreList":[]}
1
+ {"version":3,"names":["TaskServicePlugin","EventBridgeClient","PutEventsCommand","WebinyError","EventBridgeService","constructor","params","client","region","process","env","AWS_REGION","getTenant","send","task","delay","event","webinyTaskId","id","webinyTaskDefinitionId","definitionId","tenant","cmd","Entries","Source","EventBusName","String","EVENT_BUS","DetailType","Detail","JSON","stringify","result","parse","ex","message","code","data","fetch","EventBridgeEventTransportPlugin","name","createService"],"sources":["EventBridgeEventTransportPlugin.ts"],"sourcesContent":["import type {\n ITaskService,\n ITaskServiceCreatePluginParams,\n ITaskServiceTask\n} from \"~/plugins/index.js\";\nimport { TaskServicePlugin } from \"~/plugins/index.js\";\nimport type { ITaskEventInput } from \"~/types.js\";\nimport type { PutEventsCommandOutput } from \"@webiny/aws-sdk/client-eventbridge/index.js\";\nimport { EventBridgeClient, PutEventsCommand } from \"@webiny/aws-sdk/client-eventbridge/index.js\";\nimport { WebinyError } from \"@webiny/error\";\nimport type { GenericRecord } from \"@webiny/api/types.js\";\n\nclass EventBridgeService implements ITaskService {\n protected readonly getTenant: () => string;\n private readonly client: EventBridgeClient;\n\n public constructor(params: ITaskServiceCreatePluginParams) {\n this.client = new EventBridgeClient({\n region: process.env.AWS_REGION\n });\n this.getTenant = params.getTenant;\n }\n\n public async send(task: ITaskServiceTask, delay: number): Promise<PutEventsCommandOutput> {\n /**\n * The ITaskEvent is what our handler expect to get.\n * Endpoint and stateMachineId are added by the step function.\n */\n const event: ITaskEventInput = {\n webinyTaskId: task.id,\n webinyTaskDefinitionId: task.definitionId,\n tenant: this.getTenant(),\n delay\n };\n\n const cmd = new PutEventsCommand({\n Entries: [\n {\n Source: \"webiny-api-tasks\",\n EventBusName: String(process.env.EVENT_BUS),\n DetailType: \"WebinyBackgroundTask\",\n Detail: JSON.stringify(event)\n }\n ]\n });\n try {\n const result = await this.client.send(cmd);\n\n return JSON.parse(JSON.stringify(result));\n } catch (ex) {\n throw new WebinyError(\n ex.message || \"Could not trigger task via Event Bridge!\",\n ex.code || \"TRIGGER_TASK_ERROR\",\n {\n event,\n ...(ex.data || {})\n }\n );\n }\n }\n\n public async fetch(): Promise<GenericRecord> {\n throw new WebinyError(\"Not implemented!\", \"NOT_IMPLEMENTED\");\n }\n}\n\nexport class EventBridgeEventTransportPlugin extends TaskServicePlugin {\n public override name = \"task.eventBridgeEventTransport\";\n public createService(params: ITaskServiceCreatePluginParams) {\n return new EventBridgeService(params);\n }\n}\n"],"mappings":"AAKA,SAASA,iBAAiB;AAG1B,SAASC,iBAAiB,EAAEC,gBAAgB,QAAQ,6CAA6C;AACjG,SAASC,WAAW,QAAQ,eAAe;AAG3C,MAAMC,kBAAkB,CAAyB;EAItCC,WAAWA,CAACC,MAAsC,EAAE;IACvD,IAAI,CAACC,MAAM,GAAG,IAAIN,iBAAiB,CAAC;MAChCO,MAAM,EAAEC,OAAO,CAACC,GAAG,CAACC;IACxB,CAAC,CAAC;IACF,IAAI,CAACC,SAAS,GAAGN,MAAM,CAACM,S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J","ignoreList":[]}
@@ -1,14 +1,13 @@
1
- import type { ITaskService, ITaskServiceCreatePluginParams, ITaskServiceTask } from "../plugins";
2
- import { TaskServicePlugin } from "../plugins";
3
- import type { DescribeExecutionCommandOutput } from "@webiny/aws-sdk/client-sfn";
4
- import type { ITask } from "../types";
1
+ import type { ITaskService, ITaskServiceCreatePluginParams, ITaskServiceTask } from "../plugins/index.js";
2
+ import { TaskServicePlugin } from "../plugins/index.js";
3
+ import type { DescribeExecutionCommandOutput } from "@webiny/aws-sdk/client-sfn/index.js";
4
+ import type { ITask } from "../types.js";
5
5
  export type IStepFunctionServiceFetchResult = DescribeExecutionCommandOutput;
6
6
  export interface IDetailWrapper<T> {
7
7
  detail: T;
8
8
  }
9
9
  export declare class StepFunctionService implements ITaskService {
10
10
  private readonly getTenant;
11
- private readonly getLocale;
12
11
  private readonly trigger;
13
12
  private readonly get;
14
13
  constructor(params: ITaskServiceCreatePluginParams);
@@ -1,23 +1,16 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.StepFunctionServicePlugin = exports.StepFunctionService = void 0;
7
- var _plugins = require("../plugins");
8
- var _clientSfn = require("@webiny/aws-sdk/client-sfn");
9
- var _utils = require("@webiny/utils");
10
- var _api = require("@webiny/api");
11
- class StepFunctionService {
1
+ import { TaskServicePlugin } from "../plugins/index.js";
2
+ import { createStepFunctionClient, describeExecutionFactory, triggerStepFunctionFactory } from "@webiny/aws-sdk/client-sfn/index.js";
3
+ import { generateAlphaNumericId } from "@webiny/utils";
4
+ import { ServiceDiscovery } from "@webiny/api";
5
+ export class StepFunctionService {
12
6
  constructor(params) {
13
7
  this.getTenant = params.getTenant;
14
- this.getLocale = params.getLocale;
15
- const client = (0, _clientSfn.createStepFunctionClient)();
16
- this.trigger = (0, _clientSfn.triggerStepFunctionFactory)(client);
17
- this.get = (0, _clientSfn.describeExecutionFactory)(client);
8
+ const client = createStepFunctionClient();
9
+ this.trigger = triggerStepFunctionFactory(client);
10
+ this.get = describeExecutionFactory(client);
18
11
  }
19
12
  async send(task, delay) {
20
- const manifest = await _api.ServiceDiscovery.load();
13
+ const manifest = await ServiceDiscovery.load();
21
14
  if (!manifest) {
22
15
  console.error("Service manifest not found.");
23
16
  return null;
@@ -33,10 +26,9 @@ class StepFunctionService {
33
26
  webinyTaskId: task.id,
34
27
  webinyTaskDefinitionId: task.definitionId,
35
28
  tenant: this.getTenant(),
36
- locale: this.getLocale(),
37
29
  delay
38
30
  };
39
- const name = `${task.definitionId}_${task.id}_${(0, _utils.generateAlphaNumericId)(10)}`;
31
+ const name = `${task.definitionId}_${task.id}_${generateAlphaNumericId(10)}`;
40
32
  try {
41
33
  const result = await this.trigger({
42
34
  input: {
@@ -76,13 +68,11 @@ class StepFunctionService {
76
68
  }
77
69
  }
78
70
  }
79
- exports.StepFunctionService = StepFunctionService;
80
- class StepFunctionServicePlugin extends _plugins.TaskServicePlugin {
71
+ export class StepFunctionServicePlugin extends TaskServicePlugin {
81
72
  name = "task.stepFunctionTriggerTransport";
82
73
  createService(params) {
83
74
  return new StepFunctionService(params);
84
75
  }
85
76
  }
86
- exports.StepFunctionServicePlugin = StepFunctionServicePlugin;
87
77
 
88
78
  //# sourceMappingURL=StepFunctionServicePlugin.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["_plugins","require","_clientSfn","_utils","_api","StepFunctionService","constructor","params","getTenant","getLocale","client","createStepFunctionClient","trigger","triggerStepFunctionFactory","get","describeExecutionFactory","send","task","delay","manifest","ServiceDiscovery","load","console","error","bgTaskSfn","api","input","webinyTaskId","id","webinyTaskDefinitionId","definitionId","tenant","locale","name","generateAlphaNumericId","result","detail","stateMachineArn","ex","log","fetch","executionArn","eventResponse","JSON","parse","stringify","exports","StepFunctionServicePlugin","TaskServicePlugin","createService"],"sources":["StepFunctionServicePlugin.ts"],"sourcesContent":["import type { ITaskService, ITaskServiceCreatePluginParams, ITaskServiceTask } from \"~/plugins\";\nimport { TaskServicePlugin } from \"~/plugins\";\nimport type { DescribeExecutionCommandOutput } from \"@webiny/aws-sdk/client-sfn\";\nimport {\n createStepFunctionClient,\n describeExecutionFactory,\n triggerStepFunctionFactory\n} from \"@webiny/aws-sdk/client-sfn\";\nimport type { ITaskEventInput } from \"~/handler/types\";\nimport { generateAlphaNumericId } from \"@webiny/utils\";\nimport { ServiceDiscovery } from \"@webiny/api\";\nimport type { ITask } from \"~/types\";\n\nexport type IStepFunctionServiceFetchResult = DescribeExecutionCommandOutput;\n\nexport interface IDetailWrapper<T> {\n detail: T;\n}\n\nexport class StepFunctionService implements ITaskService {\n private readonly getTenant: () => string;\n private readonly getLocale: () => string;\n private readonly trigger: ReturnType<typeof triggerStepFunctionFactory>;\n private readonly get: ReturnType<typeof describeExecutionFactory>;\n\n public constructor(params: ITaskServiceCreatePluginParams) {\n this.getTenant = params.getTenant;\n this.getLocale = params.getLocale;\n const client = createStepFunctionClient();\n this.trigger = triggerStepFunctionFactory(client);\n this.get = describeExecutionFactory(client);\n }\n public async send(task: ITaskServiceTask, delay: number) {\n const manifest = await ServiceDiscovery.load();\n if (!manifest) {\n console.error(\"Service manifest not found.\");\n return null;\n }\n const { bgTaskSfn } = manifest.api || {};\n if (!bgTaskSfn) {\n console.error(\"Background task state machine not found.\");\n return null;\n }\n\n const input: ITaskEventInput = {\n webinyTaskId: task.id,\n webinyTaskDefinitionId: task.definitionId,\n tenant: this.getTenant(),\n locale: this.getLocale(),\n delay\n };\n const name = `${task.definitionId}_${task.id}_${generateAlphaNumericId(10)}`;\n try {\n const result = await this.trigger<IDetailWrapper<ITaskEventInput>>({\n input: {\n detail: input\n },\n stateMachineArn: bgTaskSfn,\n name\n });\n return {\n ...result,\n name\n };\n } catch (ex) {\n console.log(\"Could not trigger a step function.\");\n console.error(ex);\n return null;\n }\n }\n\n public async fetch(task: ITask): Promise<IStepFunctionServiceFetchResult | null> {\n const executionArn = task.eventResponse?.executionArn;\n if (!executionArn) {\n console.error(`Execution ARN not found in task \"${task.id}\".`);\n return null;\n }\n try {\n const result = await this.get({\n executionArn\n });\n if (!result) {\n return null;\n }\n return JSON.parse(JSON.stringify(result));\n } catch (ex) {\n console.log(\"Could not get the execution details.\");\n console.error(ex);\n return null;\n }\n }\n}\n\nexport class StepFunctionServicePlugin extends TaskServicePlugin {\n public override name = \"task.stepFunctionTriggerTransport\";\n\n public createService(params: ITaskServiceCreatePluginParams) {\n return new StepFunctionService(params);\n }\n}\n"],"mappings":";;;;;;AACA,IAAAA,QAAA,GAAAC,OAAA;AAEA,IAAAC,UAAA,GAAAD,OAAA;AAMA,IAAAE,MAAA,GAAAF,OAAA;AACA,IAAAG,IAAA,GAAAH,OAAA;AASO,MAAMI,mBAAmB,CAAyB;EAM9CC,WAAWA,CAACC,MAAsC,EAAE;IACvD,IAAI,CAACC,SAAS,GAAGD,MAAM,CAACC,SAAS;IACjC,IAAI,CAACC,SAAS,GAAGF,MAAM,CAACE,SAAS;IACjC,MAAMC,MAAM,GAAG,IAAAC,mCAAwB,EAAC,CAAC;IACzC,IAAI,CAACC,OAAO,GAAG,IAAAC,qCAA0B,EAACH,MAAM,CAAC;IACjD,IAAI,CAACI,GAAG,GAAG,IAAAC,mCAAwB,EAACL,MAAM,CAAC;EAC/C;EACA,MAAaM,IAAIA,CAACC,IAAsB,EAAEC,KAAa,EAAE;IACrD,MAAMC,QAAQ,GAAG,MAAMC,qBAAgB,CAACC,IAAI,CAAC,CAAC;IAC9C,IAAI,CAACF,QAAQ,EAAE;MACXG,OAAO,CAACC,KAAK,CAAC,6BAA6B,CAAC;MAC5C,OAAO,IAAI;IACf;IACA,MAAM;MAAEC;IAAU,CAAC,GAAGL,QAAQ,CAACM,GAAG,IAAI,CAAC,CAAC;IACxC,IAAI,CAACD,SAAS,EAAE;MACZF,OAAO,CAACC,KAAK,CAAC,0CAA0C,CAAC;MACzD,OAAO,IAAI;IACf;IAEA,MAAMG,KAAsB,GAAG;MAC3BC,YAAY,EAAEV,IAAI,CAACW,EAAE;MACrBC,s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;MACjB,OAAO,IAAI;IACf;EACJ;AACJ;AAACQ,OAAA,CAAAzC,mBAAA,GAAAA,mBAAA;AAEM,MAAM0C,yBAAyB,SAASC,0BAAiB,CAAC;EAC7Cf,IAAI,GAAG,mCAAmC;EAEnDgB,aAAaA,CAAC1C,MAAsC,EAAE;IACzD,OAAO,IAAIF,mBAAmB,CAACE,MAAM,CAAC;EAC1C;AACJ;AAACuC,OAAA,CAAAC,yBAAA,GAAAA,yBAAA","ignoreList":[]}
1
+ {"version":3,"names":["TaskServicePlugin","createStepFunctionClient","describeExecutionFactory","triggerStepFunctionFactory","generateAlphaNumericId","ServiceDiscovery","StepFunctionService","constructor","params","getTenant","client","trigger","get","send","task","delay","manifest","load","console","error","bgTaskSfn","api","input","webinyTaskId","id","webinyTaskDefinitionId","definitionId","tenant","name","result","detail","stateMachineArn","ex","log","fetch","executionArn","eventResponse","JSON","parse","stringify","StepFunctionServicePlugin","createService"],"sources":["StepFunctionServicePlugin.ts"],"sourcesContent":["import type {\n ITaskService,\n ITaskServiceCreatePluginParams,\n ITaskServiceTask\n} from \"~/plugins/index.js\";\nimport { TaskServicePlugin } from \"~/plugins/index.js\";\nimport type { DescribeExecutionCommandOutput } from \"@webiny/aws-sdk/client-sfn/index.js\";\nimport {\n createStepFunctionClient,\n describeExecutionFactory,\n triggerStepFunctionFactory\n} from \"@webiny/aws-sdk/client-sfn/index.js\";\nimport type { ITaskEventInput } from \"~/handler/types.js\";\nimport { generateAlphaNumericId } from \"@webiny/utils\";\nimport { ServiceDiscovery } from \"@webiny/api\";\nimport type { ITask } from \"~/types.js\";\n\nexport type IStepFunctionServiceFetchResult = DescribeExecutionCommandOutput;\n\nexport interface IDetailWrapper<T> {\n detail: T;\n}\n\nexport class StepFunctionService implements ITaskService {\n private readonly getTenant: () => string;\n private readonly trigger: ReturnType<typeof triggerStepFunctionFactory>;\n private readonly get: ReturnType<typeof describeExecutionFactory>;\n\n public constructor(params: ITaskServiceCreatePluginParams) {\n this.getTenant = params.getTenant;\n const client = createStepFunctionClient();\n this.trigger = triggerStepFunctionFactory(client);\n this.get = describeExecutionFactory(client);\n }\n public async send(task: ITaskServiceTask, delay: number) {\n const manifest = await ServiceDiscovery.load();\n if (!manifest) {\n console.error(\"Service manifest not found.\");\n return null;\n }\n const { bgTaskSfn } = manifest.api || {};\n if (!bgTaskSfn) {\n console.error(\"Background task state machine not found.\");\n return null;\n }\n\n const input: ITaskEventInput = {\n webinyTaskId: task.id,\n webinyTaskDefinitionId: task.definitionId,\n tenant: this.getTenant(),\n delay\n };\n const name = `${task.definitionId}_${task.id}_${generateAlphaNumericId(10)}`;\n try {\n const result = await this.trigger<IDetailWrapper<ITaskEventInput>>({\n input: {\n detail: input\n },\n stateMachineArn: bgTaskSfn,\n name\n });\n return {\n ...result,\n name\n };\n } catch (ex) {\n console.log(\"Could not trigger a step function.\");\n console.error(ex);\n return null;\n }\n }\n\n public async fetch(task: ITask): Promise<IStepFunctionServiceFetchResult | null> {\n const executionArn = task.eventResponse?.executionArn;\n if (!executionArn) {\n console.error(`Execution ARN not found in task \"${task.id}\".`);\n return null;\n }\n try {\n const result = await this.get({\n executionArn\n });\n if (!result) {\n return null;\n }\n return JSON.parse(JSON.stringify(result));\n } catch (ex) {\n console.log(\"Could not get the execution details.\");\n console.error(ex);\n return null;\n }\n }\n}\n\nexport class StepFunctionServicePlugin extends TaskServicePlugin {\n public override name = \"task.stepFunctionTriggerTransport\";\n\n public createService(params: ITaskServiceCreatePluginParams) {\n return new StepFunctionService(params);\n }\n}\n"],"mappings":"AAKA,SAASA,iBAAiB;AAE1B,SACIC,wBAAwB,EACxBC,wBAAwB,EACxBC,0BAA0B,QACvB,qCAAqC;AAE5C,SAASC,sBAAsB,QAAQ,eAAe;AACtD,SAASC,gBAAgB,QAAQ,aAAa;AAS9C,OAAO,MAAMC,mBAAmB,CAAyB;EAK9CC,WAAWA,CAACC,MAAsC,EAAE;IACvD,IAAI,CAACC,SAAS,GAAGD,MAAM,CAACC,SAAS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EAEA,MAAaE,KAAKA,CAACpB,IAAW,EAAmD;IAC7E,MAAMqB,YAAY,GAAGrB,IAAI,CAACsB,aAAa,EAAED,YAAY;IACrD,IAAI,CAACA,YAAY,EAAE;MACfjB,OAAO,CAACC,KAAK,CAAC,oCAAoCL,IAAI,CAACU,EAAE,IAAI,CAAC;MAC9D,OAAO,IAAI;IACf;IACA,IAAI;MACA,MAAMK,MAAM,GAAG,MAAM,IAAI,CAACjB,GAAG,CAAC;QAC1BuB;MACJ,CAAC,CAAC;MACF,IAAI,CAACN,MAAM,EAAE;QACT,OAAO,IAAI;MACf;MACA,OAAOQ,IAAI,CAACC,KAAK,CAACD,IAAI,CAACE,SAAS,CAACV,MAAM,CAAC,CAAC;IAC7C,CAAC,CAAC,OAAOG,EAAE,EAAE;MACTd,OAAO,CAACe,GAAG,CAAC,sCAAsC,CAAC;MACnDf,OAAO,CAACC,KAAK,CAACa,EAAE,CAAC;MACjB,OAAO,IAAI;IACf;EACJ;AACJ;AAEA,OAAO,MAAMQ,yBAAyB,SAASxC,iBAAiB,CAAC;EAC7C4B,IAAI,GAAG,mCAAmC;EAEnDa,aAAaA,CAACjC,MAAsC,EAAE;IACzD,OAAO,IAAIF,mBAAmB,CAACE,MAAM,CAAC;EAC1C;AACJ","ignoreList":[]}
@@ -1,5 +1,5 @@
1
- import type { Context } from "../types";
2
- import type { ITaskService } from "../plugins";
1
+ import type { Context } from "../types.js";
2
+ import type { ITaskService } from "../plugins/index.js";
3
3
  export interface ICreateTransport {
4
4
  context: Context;
5
5
  }
@@ -1,30 +1,19 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.createService = void 0;
7
- var _plugins = require("../plugins");
8
- var _error = require("@webiny/error");
9
- const createService = params => {
10
- const plugins = params.context.plugins.byType(_plugins.TaskServicePlugin.type).reverse();
1
+ import { TaskServicePlugin } from "../plugins/index.js";
2
+ import { WebinyError } from "@webiny/error";
3
+ export const createService = params => {
4
+ const plugins = params.context.plugins.byType(TaskServicePlugin.type).reverse();
11
5
  const plugin = plugins.find(plugin => plugin.default) || plugins[0];
12
6
  if (!plugin) {
13
- throw new _error.WebinyError("Missing TaskServicePlugin.", "PLUGIN_ERROR", {
14
- type: _plugins.TaskServicePlugin.type
7
+ throw new WebinyError("Missing TaskServicePlugin.", "PLUGIN_ERROR", {
8
+ type: TaskServicePlugin.type
15
9
  });
16
10
  }
17
11
  const getTenant = () => {
18
12
  return params.context.tenancy.getCurrentTenant().id;
19
13
  };
20
- const getLocale = () => {
21
- return params.context.cms.getLocale().code;
22
- };
23
14
  return plugin.createService({
24
- getTenant,
25
- getLocale
15
+ getTenant
26
16
  });
27
17
  };
28
- exports.createService = createService;
29
18
 
30
19
  //# sourceMappingURL=createService.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["_plugins","require","_error","createService","params","plugins","context","byType","TaskServicePlugin","type","reverse","plugin","find","default","WebinyError","getTenant","tenancy","getCurrentTenant","id","getLocale","cms","code","exports"],"sources":["createService.ts"],"sourcesContent":["import type { Context } from \"~/types\";\nimport type { ITaskService } from \"~/plugins\";\nimport { TaskServicePlugin } from \"~/plugins\";\nimport { WebinyError } from \"@webiny/error\";\n\nexport interface ICreateTransport {\n context: Context;\n}\n\nexport const createService = (params: ICreateTransport): ITaskService => {\n const plugins = params.context.plugins\n .byType<TaskServicePlugin>(TaskServicePlugin.type)\n .reverse();\n\n const plugin = plugins.find(plugin => plugin.default) || plugins[0];\n if (!plugin) {\n throw new WebinyError(\"Missing TaskServicePlugin.\", \"PLUGIN_ERROR\", {\n type: TaskServicePlugin.type\n });\n }\n\n const getTenant = (): string => {\n return params.context.tenancy.getCurrentTenant().id;\n };\n const getLocale = (): string => {\n return params.context.cms.getLocale().code;\n };\n\n return plugin.createService({\n getTenant,\n getLocale\n });\n};\n"],"mappings":";;;;;;AAEA,IAAAA,QAAA,GAAAC,OAAA;AACA,IAAAC,MAAA,GAAAD,OAAA;AAMO,MAAME,aAAa,GAAIC,MAAwB,IAAmB;EACrE,MAAMC,OAAO,GAAGD,MAAM,CAACE,OAAO,CAACD,OAAO,CACjCE,MAAM,CAAoBC,0BAAiB,CAACC,IAAI,CAAC,CACjDC,OAAO,CAAC,CAAC;EAEd,MAAMC,MAAM,GAAGN,OAAO,CAACO,IAAI,CAACD,MAAM,IAAIA,MAAM,CAACE,OAAO,CAAC,IAAIR,OAAO,CAAC,CAAC,CAAC;EACnE,IAAI,CAACM,MAAM,EAAE;IACT,MAAM,IAAIG,kBAAW,CAAC,4BAA4B,EAAE,cAAc,EAAE;MAChEL,IAAI,EAAED,0BAAiB,CAACC;IAC5B,CAAC,CAAC;EACN;EAEA,MAAMM,SAAS,GAAGA,CAAA,KAAc;IAC5B,OAAOX,MAAM,CAACE,OAAO,CAACU,OAAO,CAACC,gBAAgB,CAAC,CAAC,CAACC,EAAE;EACvD,CAAC;EACD,MAAMC,SAAS,GAAGA,CAAA,KAAc;IAC5B,OAAOf,MAAM,CAACE,OAAO,CAACc,GAAG,CAACD,SAAS,CAAC,CAAC,CAACE,IAAI;EAC9C,CAAC;EAED,OAAOV,MAAM,CAACR,aAAa,CAAC;IACxBY,SAAS;IACTI;EACJ,CAAC,CAAC;AACN,CAAC;AAACG,OAAA,CAAAnB,aAAA,GAAAA,aAAA","ignoreList":[]}
1
+ {"version":3,"names":["TaskServicePlugin","WebinyError","createService","params","plugins","context","byType","type","reverse","plugin","find","default","getTenant","tenancy","getCurrentTenant","id"],"sources":["createService.ts"],"sourcesContent":["import type { Context } from \"~/types.js\";\nimport type { ITaskService } from \"~/plugins/index.js\";\nimport { TaskServicePlugin } from \"~/plugins/index.js\";\nimport { WebinyError } from \"@webiny/error\";\n\nexport interface ICreateTransport {\n context: Context;\n}\n\nexport const createService = (params: ICreateTransport): ITaskService => {\n const plugins = params.context.plugins\n .byType<TaskServicePlugin>(TaskServicePlugin.type)\n .reverse();\n\n const plugin = plugins.find(plugin => plugin.default) || plugins[0];\n if (!plugin) {\n throw new WebinyError(\"Missing TaskServicePlugin.\", \"PLUGIN_ERROR\", {\n type: TaskServicePlugin.type\n });\n }\n\n const getTenant = (): string => {\n return params.context.tenancy.getCurrentTenant().id;\n };\n\n return plugin.createService({\n getTenant\n });\n};\n"],"mappings":"AAEA,SAASA,iBAAiB;AAC1B,SAASC,WAAW,QAAQ,eAAe;AAM3C,OAAO,MAAMC,aAAa,GAAIC,MAAwB,IAAmB;EACrE,MAAMC,OAAO,GAAGD,MAAM,CAACE,OAAO,CAACD,OAAO,CACjCE,MAAM,CAAoBN,iBAAiB,CAACO,IAAI,CAAC,CACjDC,OAAO,CAAC,CAAC;EAEd,MAAMC,MAAM,GAAGL,OAAO,CAACM,IAAI,CAACD,MAAM,IAAIA,MAAM,CAACE,OAAO,CAAC,IAAIP,OAAO,CAAC,CAAC,CAAC;EACnE,IAAI,CAACK,MAAM,EAAE;IACT,MAAM,IAAIR,WAAW,CAAC,4BAA4B,EAAE,cAAc,EAAE;MAChEM,IAAI,EAAEP,iBAAiB,CAACO;IAC5B,CAAC,CAAC;EACN;EAEA,MAAMK,SAAS,GAAGA,CAAA,KAAc;IAC5B,OAAOT,MAAM,CAACE,OAAO,CAACQ,OAAO,CAACC,gBAAgB,CAAC,CAAC,CAACC,EAAE;EACvD,CAAC;EAED,OAAON,MAAM,CAACP,aAAa,CAAC;IACxBU;EACJ,CAAC,CAAC;AACN,CAAC","ignoreList":[]}
@@ -1,4 +1,4 @@
1
- import { EventBridgeEventTransportPlugin } from "./EventBridgeEventTransportPlugin";
2
- import { StepFunctionServicePlugin } from "./StepFunctionServicePlugin";
1
+ import { EventBridgeEventTransportPlugin } from "./EventBridgeEventTransportPlugin.js";
2
+ import { StepFunctionServicePlugin } from "./StepFunctionServicePlugin.js";
3
3
  export declare const createServicePlugins: () => (StepFunctionServicePlugin | EventBridgeEventTransportPlugin)[];
4
- export * from "./createService";
4
+ export * from "./createService.js";