@webiny/tasks 0.0.0-unstable.e53eceafb5 → 0.0.0-unstable.e6f0dc8ca7
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.
- package/README.md +10 -9
- package/context.js +50 -21
- package/context.js.map +1 -1
- package/crud/TaskLogPrivateModel.d.ts +9 -0
- package/crud/TaskLogPrivateModel.js +34 -0
- package/crud/TaskLogPrivateModel.js.map +1 -0
- package/crud/TaskPrivateModel.d.ts +9 -0
- package/crud/TaskPrivateModel.js +46 -0
- package/crud/TaskPrivateModel.js.map +1 -0
- package/crud/cleanupTaskSubtree.d.ts +8 -0
- package/crud/cleanupTaskSubtree.js +76 -0
- package/crud/cleanupTaskSubtree.js.map +1 -0
- package/crud/crud.tasks.d.ts +1 -1
- package/crud/crud.tasks.js +213 -105
- package/crud/crud.tasks.js.map +1 -1
- package/crud/definition.tasks.d.ts +1 -1
- package/crud/definition.tasks.js +9 -18
- package/crud/definition.tasks.js.map +1 -1
- package/crud/service.tasks.d.ts +1 -1
- package/crud/service.tasks.js +31 -36
- package/crud/service.tasks.js.map +1 -1
- package/decorators/RunnableTaskDecorator.d.ts +32 -0
- package/decorators/RunnableTaskDecorator.js +85 -0
- package/decorators/RunnableTaskDecorator.js.map +1 -0
- package/decorators/SelfCleaningTaskDecorator.d.ts +30 -0
- package/decorators/SelfCleaningTaskDecorator.js +98 -0
- package/decorators/SelfCleaningTaskDecorator.js.map +1 -0
- package/domain/errors.d.ts +29 -0
- package/domain/errors.js +47 -0
- package/domain/errors.js.map +1 -0
- package/events/TaskAfterCreateEvent.d.ts +6 -0
- package/events/TaskAfterCreateEvent.js +10 -0
- package/events/TaskAfterCreateEvent.js.map +1 -0
- package/events/TaskAfterDeleteEvent.d.ts +6 -0
- package/events/TaskAfterDeleteEvent.js +10 -0
- package/events/TaskAfterDeleteEvent.js.map +1 -0
- package/events/TaskAfterUpdateEvent.d.ts +6 -0
- package/events/TaskAfterUpdateEvent.js +10 -0
- package/events/TaskAfterUpdateEvent.js.map +1 -0
- package/events/TaskBeforeCreateEvent.d.ts +6 -0
- package/events/TaskBeforeCreateEvent.js +10 -0
- package/events/TaskBeforeCreateEvent.js.map +1 -0
- package/events/TaskBeforeDeleteEvent.d.ts +6 -0
- package/events/TaskBeforeDeleteEvent.js +10 -0
- package/events/TaskBeforeDeleteEvent.js.map +1 -0
- package/events/TaskBeforeUpdateEvent.d.ts +6 -0
- package/events/TaskBeforeUpdateEvent.js +10 -0
- package/events/TaskBeforeUpdateEvent.js.map +1 -0
- package/events/abstractions.d.ts +53 -0
- package/events/abstractions.js +39 -0
- package/events/abstractions.js.map +1 -0
- package/events/index.d.ts +7 -0
- package/events/index.js +9 -0
- package/events/index.js.map +1 -0
- package/features/AbortTask/AbortTaskUseCase.d.ts +10 -0
- package/features/AbortTask/AbortTaskUseCase.js +11 -0
- package/features/AbortTask/AbortTaskUseCase.js.map +1 -0
- package/features/AbortTask/abstractions.d.ts +25 -0
- package/features/AbortTask/abstractions.js +4 -0
- package/features/AbortTask/abstractions.js.map +1 -0
- package/features/AbortTask/feature.d.ts +5 -0
- package/features/AbortTask/feature.js +11 -0
- package/features/AbortTask/feature.js.map +1 -0
- package/features/AbortTask/index.d.ts +2 -0
- package/features/AbortTask/index.js +4 -0
- package/features/AbortTask/index.js.map +1 -0
- package/features/CleanupTaskSubtree/CleanupTaskSubtreeUseCase.d.ts +7 -0
- package/features/CleanupTaskSubtree/CleanupTaskSubtreeUseCase.js +10 -0
- package/features/CleanupTaskSubtree/CleanupTaskSubtreeUseCase.js.map +1 -0
- package/features/CleanupTaskSubtree/abstractions.d.ts +7 -0
- package/features/CleanupTaskSubtree/abstractions.js +4 -0
- package/features/CleanupTaskSubtree/abstractions.js.map +1 -0
- package/features/CleanupTaskSubtree/index.d.ts +2 -0
- package/features/CleanupTaskSubtree/index.js +4 -0
- package/features/CleanupTaskSubtree/index.js.map +1 -0
- package/features/GetTask/GetTaskUseCase.d.ts +9 -0
- package/features/GetTask/GetTaskUseCase.js +10 -0
- package/features/GetTask/GetTaskUseCase.js.map +1 -0
- package/features/GetTask/abstractions.d.ts +10 -0
- package/features/GetTask/abstractions.js +4 -0
- package/features/GetTask/abstractions.js.map +1 -0
- package/features/GetTask/feature.d.ts +5 -0
- package/features/GetTask/feature.js +11 -0
- package/features/GetTask/feature.js.map +1 -0
- package/features/GetTask/index.d.ts +2 -0
- package/features/GetTask/index.js +4 -0
- package/features/GetTask/index.js.map +1 -0
- package/features/GetTaskDefinition/GetTaskDefinitionUseCase.d.ts +12 -0
- package/features/GetTaskDefinition/GetTaskDefinitionUseCase.js +25 -0
- package/features/GetTaskDefinition/GetTaskDefinitionUseCase.js.map +1 -0
- package/features/GetTaskDefinition/abstractions.d.ts +17 -0
- package/features/GetTaskDefinition/abstractions.js +4 -0
- package/features/GetTaskDefinition/abstractions.js.map +1 -0
- package/features/GetTaskDefinition/feature.d.ts +4 -0
- package/features/GetTaskDefinition/feature.js +10 -0
- package/features/GetTaskDefinition/feature.js.map +1 -0
- package/features/GetTaskDefinition/index.d.ts +2 -0
- package/features/GetTaskDefinition/index.js +4 -0
- package/features/GetTaskDefinition/index.js.map +1 -0
- package/features/ListTaskDefinitions/ListTaskDefinitionsUseCase.d.ts +11 -0
- package/features/ListTaskDefinitions/ListTaskDefinitionsUseCase.js +18 -0
- package/features/ListTaskDefinitions/ListTaskDefinitionsUseCase.js.map +1 -0
- package/features/ListTaskDefinitions/abstractions.d.ts +9 -0
- package/features/ListTaskDefinitions/abstractions.js +4 -0
- package/features/ListTaskDefinitions/abstractions.js.map +1 -0
- package/features/ListTaskDefinitions/feature.d.ts +4 -0
- package/features/ListTaskDefinitions/feature.js +10 -0
- package/features/ListTaskDefinitions/feature.js.map +1 -0
- package/features/ListTaskDefinitions/index.d.ts +2 -0
- package/features/ListTaskDefinitions/index.js +4 -0
- package/features/ListTaskDefinitions/index.js.map +1 -0
- package/features/ListTasks/ListTasksUseCase.d.ts +9 -0
- package/features/ListTasks/ListTasksUseCase.js +10 -0
- package/features/ListTasks/ListTasksUseCase.js.map +1 -0
- package/features/ListTasks/abstractions.d.ts +13 -0
- package/features/ListTasks/abstractions.js +4 -0
- package/features/ListTasks/abstractions.js.map +1 -0
- package/features/ListTasks/feature.d.ts +5 -0
- package/features/ListTasks/feature.js +11 -0
- package/features/ListTasks/feature.js.map +1 -0
- package/features/ListTasks/index.d.ts +2 -0
- package/features/ListTasks/index.js +4 -0
- package/features/ListTasks/index.js.map +1 -0
- package/features/TaskController/TaskController.d.ts +49 -0
- package/features/TaskController/TaskController.js +71 -0
- package/features/TaskController/TaskController.js.map +1 -0
- package/features/TaskController/augmentation.d.ts +60 -0
- package/features/TaskController/augmentation.js +3 -0
- package/features/TaskController/augmentation.js.map +1 -0
- package/features/TaskController/index.d.ts +2 -0
- package/features/TaskController/index.js +7 -0
- package/features/TaskController/index.js.map +1 -0
- package/features/TaskExecutionContext/TaskExecutionContext.d.ts +24 -0
- package/features/TaskExecutionContext/TaskExecutionContext.js +50 -0
- package/features/TaskExecutionContext/TaskExecutionContext.js.map +1 -0
- package/features/TaskExecutionContext/abstractions.d.ts +26 -0
- package/features/TaskExecutionContext/abstractions.js +13 -0
- package/features/TaskExecutionContext/abstractions.js.map +1 -0
- package/features/TaskExecutionContext/feature.d.ts +4 -0
- package/features/TaskExecutionContext/feature.js +10 -0
- package/features/TaskExecutionContext/feature.js.map +1 -0
- package/features/TaskExecutionContext/index.d.ts +1 -0
- package/features/TaskExecutionContext/index.js +3 -0
- package/features/TaskExecutionContext/index.js.map +1 -0
- package/features/TriggerTask/TriggerTaskUseCase.d.ts +10 -0
- package/features/TriggerTask/TriggerTaskUseCase.js +11 -0
- package/features/TriggerTask/TriggerTaskUseCase.js.map +1 -0
- package/features/TriggerTask/abstractions.d.ts +28 -0
- package/features/TriggerTask/abstractions.js +4 -0
- package/features/TriggerTask/abstractions.js.map +1 -0
- package/features/TriggerTask/feature.d.ts +5 -0
- package/features/TriggerTask/feature.js +11 -0
- package/features/TriggerTask/feature.js.map +1 -0
- package/features/TriggerTask/index.d.ts +2 -0
- package/features/TriggerTask/index.js +4 -0
- package/features/TriggerTask/index.js.map +1 -0
- package/global.d.ts +1 -0
- package/global.js +3 -0
- package/global.js.map +1 -0
- package/graphql/checkPermissions.d.ts +1 -1
- package/graphql/checkPermissions.js +3 -9
- package/graphql/checkPermissions.js.map +1 -1
- package/graphql/index.d.ts +1 -1
- package/graphql/index.js +67 -83
- package/graphql/index.js.map +1 -1
- package/graphql/utils.d.ts +3 -3
- package/graphql/utils.js +8 -17
- package/graphql/utils.js.map +1 -1
- package/handler/index.d.ts +2 -2
- package/handler/index.js +33 -40
- package/handler/index.js.map +1 -1
- package/handler/register.js +5 -7
- package/handler/register.js.map +1 -1
- package/handler/types.d.ts +1 -3
- package/handler/types.js +1 -5
- package/handler/types.js.map +1 -1
- package/index.d.ts +5 -6
- package/index.js +5 -60
- package/index.js.map +1 -1
- package/package.json +27 -28
- package/plugins/TaskServicePlugin.d.ts +1 -2
- package/plugins/TaskServicePlugin.js +2 -9
- package/plugins/TaskServicePlugin.js.map +1 -1
- package/plugins/index.d.ts +1 -1
- package/plugins/index.js +1 -16
- package/plugins/index.js.map +1 -1
- package/response/DatabaseResponse.d.ts +3 -3
- package/response/DatabaseResponse.js +14 -20
- package/response/DatabaseResponse.js.map +1 -1
- package/response/Response.d.ts +4 -3
- package/response/Response.js +20 -31
- package/response/Response.js.map +1 -1
- package/response/ResponseAbortedResult.d.ts +3 -4
- package/response/ResponseAbortedResult.js +3 -11
- package/response/ResponseAbortedResult.js.map +1 -1
- package/response/ResponseContinueResult.d.ts +4 -5
- package/response/ResponseContinueResult.js +3 -11
- package/response/ResponseContinueResult.js.map +1 -1
- package/response/ResponseDoneResult.d.ts +4 -6
- package/response/ResponseDoneResult.js +3 -11
- package/response/ResponseDoneResult.js.map +1 -1
- package/response/ResponseErrorResult.d.ts +3 -4
- package/response/ResponseErrorResult.js +3 -11
- package/response/ResponseErrorResult.js.map +1 -1
- package/response/TaskResponse.d.ts +7 -6
- package/response/TaskResponse.js +5 -12
- package/response/TaskResponse.js.map +1 -1
- package/response/abstractions/Response.d.ts +7 -7
- package/response/abstractions/Response.js +1 -5
- package/response/abstractions/Response.js.map +1 -1
- package/response/abstractions/ResponseAbortedResult.d.ts +3 -3
- package/response/abstractions/ResponseAbortedResult.js +1 -5
- package/response/abstractions/ResponseAbortedResult.js.map +1 -1
- package/response/abstractions/ResponseBaseResult.d.ts +2 -3
- package/response/abstractions/ResponseBaseResult.js +1 -5
- package/response/abstractions/ResponseBaseResult.js.map +1 -1
- package/response/abstractions/ResponseContinueResult.d.ts +4 -4
- package/response/abstractions/ResponseContinueResult.js +1 -5
- package/response/abstractions/ResponseContinueResult.js.map +1 -1
- package/response/abstractions/ResponseDoneResult.d.ts +5 -6
- package/response/abstractions/ResponseDoneResult.js +1 -5
- package/response/abstractions/ResponseDoneResult.js.map +1 -1
- package/response/abstractions/ResponseErrorResult.d.ts +4 -5
- package/response/abstractions/ResponseErrorResult.js +1 -5
- package/response/abstractions/ResponseErrorResult.js.map +1 -1
- package/response/abstractions/TaskResponse.d.ts +8 -30
- package/response/abstractions/TaskResponse.js +1 -5
- package/response/abstractions/TaskResponse.js.map +1 -1
- package/response/abstractions/index.d.ts +7 -7
- package/response/abstractions/index.js +7 -82
- package/response/abstractions/index.js.map +1 -1
- package/response/index.d.ts +7 -7
- package/response/index.js +7 -82
- package/response/index.js.map +1 -1
- package/runner/TaskControl.d.ts +4 -4
- package/runner/TaskControl.js +61 -39
- package/runner/TaskControl.js.map +1 -1
- package/runner/TaskEventValidation.d.ts +2 -2
- package/runner/TaskEventValidation.js +11 -20
- package/runner/TaskEventValidation.js.map +1 -1
- package/runner/TaskManager.d.ts +7 -10
- package/runner/TaskManager.js +19 -39
- package/runner/TaskManager.js.map +1 -1
- package/runner/TaskManagerStore.d.ts +7 -7
- package/runner/TaskManagerStore.js +16 -25
- package/runner/TaskManagerStore.js.map +1 -1
- package/runner/TaskRunner.d.ts +5 -6
- package/runner/TaskRunner.js +9 -31
- package/runner/TaskRunner.js.map +1 -1
- package/runner/abstractions/TaskControl.d.ts +4 -4
- package/runner/abstractions/TaskControl.js +1 -5
- package/runner/abstractions/TaskControl.js.map +1 -1
- package/runner/abstractions/TaskEventValidation.d.ts +1 -1
- package/runner/abstractions/TaskEventValidation.js +1 -5
- package/runner/abstractions/TaskEventValidation.js.map +1 -1
- package/runner/abstractions/TaskManager.d.ts +4 -4
- package/runner/abstractions/TaskManager.js +1 -5
- package/runner/abstractions/TaskManager.js.map +1 -1
- package/runner/abstractions/TaskManagerStore.d.ts +11 -11
- package/runner/abstractions/TaskManagerStore.js +1 -5
- package/runner/abstractions/TaskManagerStore.js.map +1 -1
- package/runner/abstractions/TaskRunner.d.ts +3 -3
- package/runner/abstractions/TaskRunner.js +1 -5
- package/runner/abstractions/TaskRunner.js.map +1 -1
- package/runner/abstractions/index.d.ts +5 -5
- package/runner/abstractions/index.js +5 -60
- package/runner/abstractions/index.js.map +1 -1
- package/runner/index.d.ts +1 -1
- package/runner/index.js +1 -16
- package/runner/index.js.map +1 -1
- package/service/EventBridgeEventTransportPlugin.d.ts +4 -5
- package/service/EventBridgeEventTransportPlugin.js +8 -17
- package/service/EventBridgeEventTransportPlugin.js.map +1 -1
- package/service/StepFunctionServicePlugin.d.ts +4 -5
- package/service/StepFunctionServicePlugin.js +11 -21
- package/service/StepFunctionServicePlugin.js.map +1 -1
- package/service/createService.d.ts +2 -2
- package/service/createService.js +7 -18
- package/service/createService.js.map +1 -1
- package/service/index.d.ts +3 -3
- package/service/index.js +6 -27
- package/service/index.js.map +1 -1
- package/tasks/testingRunTask.d.ts +10 -1
- package/tasks/testingRunTask.js +13 -18
- package/tasks/testingRunTask.js.map +1 -1
- package/types.d.ts +41 -214
- package/types.js +7 -56
- package/types.js.map +1 -1
- package/utils/ObjectUpdater.js +4 -11
- package/utils/ObjectUpdater.js.map +1 -1
- package/utils/getErrorProperties.d.ts +1 -1
- package/utils/getErrorProperties.js +3 -10
- package/utils/getErrorProperties.js.map +1 -1
- package/utils/getObjectProperties.js +1 -8
- package/utils/getObjectProperties.js.map +1 -1
- package/utils/index.d.ts +3 -3
- package/utils/index.js +3 -38
- package/utils/index.js.map +1 -1
- package/utils/normalizeSelfCleanup.d.ts +2 -0
- package/utils/normalizeSelfCleanup.js +15 -0
- package/utils/normalizeSelfCleanup.js.map +1 -0
- package/crud/model.d.ts +0 -5
- package/crud/model.js +0 -216
- package/crud/model.js.map +0 -1
- package/crud/where.d.ts +0 -1
- package/crud/where.js +0 -33
- package/crud/where.js.map +0 -1
- package/task/index.d.ts +0 -2
- package/task/index.js +0 -29
- package/task/index.js.map +0 -1
- package/task/input.d.ts +0 -15
- package/task/input.js +0 -21
- package/task/input.js.map +0 -1
- package/task/plugin.d.ts +0 -36
- package/task/plugin.js +0 -106
- package/task/plugin.js.map +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["createAbstraction","GetTaskDefinitionUseCase"],"sources":["abstractions.ts"],"sourcesContent":["import { createAbstraction } from \"@webiny/feature/api\";\nimport type { Result } from \"@webiny/feature/api\";\nimport type { TaskDefinition } from \"@webiny/api-core/features/task/TaskDefinition/index.js\";\nimport type { TaskDefinitionNotFoundError } from \"~/domain/errors.js\";\n\nexport interface IGetTaskDefinitionUseCase {\n execute<\n I extends TaskDefinition.TaskInput = TaskDefinition.TaskInput,\n O extends TaskDefinition.TaskOutput = TaskDefinition.TaskOutput\n >(\n id: string\n ): Result<TaskDefinition.Runnable<I, O>, UseCaseError>;\n}\n\nexport interface IGetTaskDefinitionUseCaseErrors {\n notFound: TaskDefinitionNotFoundError;\n}\n\ntype UseCaseError = IGetTaskDefinitionUseCaseErrors[keyof IGetTaskDefinitionUseCaseErrors];\n\nexport const GetTaskDefinitionUseCase = createAbstraction<IGetTaskDefinitionUseCase>(\n \"Tasks/GetTaskDefinitionUseCase\"\n);\n\nexport namespace GetTaskDefinitionUseCase {\n export type Interface = IGetTaskDefinitionUseCase;\n\n export type Error = UseCaseError;\n export type Return<\n I extends TaskDefinition.TaskInput = TaskDefinition.TaskInput,\n O extends TaskDefinition.TaskOutput = TaskDefinition.TaskOutput\n > = Result<TaskDefinition.Runnable<I, O>, UseCaseError>;\n}\n"],"mappings":"AAAA,SAASA,iBAAiB,QAAQ,qBAAqB;AAoBvD,OAAO,MAAMC,wBAAwB,GAAGD,iBAAiB,CACrD,gCACJ,CAAC","ignoreList":[]}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { createFeature } from "@webiny/feature/api";
|
|
2
|
+
import { GetTaskDefinitionUseCase } from "./GetTaskDefinitionUseCase.js";
|
|
3
|
+
export const GetTaskDefinitionFeature = createFeature({
|
|
4
|
+
name: "GetTaskDefinition",
|
|
5
|
+
register(container) {
|
|
6
|
+
container.register(GetTaskDefinitionUseCase);
|
|
7
|
+
}
|
|
8
|
+
});
|
|
9
|
+
|
|
10
|
+
//# sourceMappingURL=feature.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["createFeature","GetTaskDefinitionUseCase","GetTaskDefinitionFeature","name","register","container"],"sources":["feature.ts"],"sourcesContent":["import { createFeature } from \"@webiny/feature/api\";\nimport { GetTaskDefinitionUseCase } from \"./GetTaskDefinitionUseCase.js\";\n\nexport const GetTaskDefinitionFeature = createFeature({\n name: \"GetTaskDefinition\",\n register(container) {\n container.register(GetTaskDefinitionUseCase);\n }\n});\n"],"mappings":"AAAA,SAASA,aAAa,QAAQ,qBAAqB;AACnD,SAASC,wBAAwB;AAEjC,OAAO,MAAMC,wBAAwB,GAAGF,aAAa,CAAC;EAClDG,IAAI,EAAE,mBAAmB;EACzBC,QAAQA,CAACC,SAAS,EAAE;IAChBA,SAAS,CAACD,QAAQ,CAACH,wBAAwB,CAAC;EAChD;AACJ,CAAC,CAAC","ignoreList":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["GetTaskDefinitionUseCase","GetTaskDefinitionFeature"],"sources":["index.ts"],"sourcesContent":["export { GetTaskDefinitionUseCase } from \"./abstractions.js\";\nexport { GetTaskDefinitionFeature } from \"./feature.js\";\n"],"mappings":"AAAA,SAASA,wBAAwB;AACjC,SAASC,wBAAwB","ignoreList":[]}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { ListTaskDefinitionsUseCase as UseCaseAbstraction } from "./abstractions.js";
|
|
2
|
+
import { TaskDefinition } from "@webiny/api-core/features/task/TaskDefinition/index.js";
|
|
3
|
+
declare class ListTaskDefinitionsUseCaseImpl implements UseCaseAbstraction.Interface {
|
|
4
|
+
private definitions;
|
|
5
|
+
constructor(definitions: TaskDefinition.Interface[]);
|
|
6
|
+
execute(): TaskDefinition.Interface[];
|
|
7
|
+
}
|
|
8
|
+
export declare const ListTaskDefinitionsUseCase: typeof ListTaskDefinitionsUseCaseImpl & {
|
|
9
|
+
__abstraction: import("@webiny/di").Abstraction<import("./abstractions.js").IListTaskDefinitionsUseCase>;
|
|
10
|
+
};
|
|
11
|
+
export {};
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { ListTaskDefinitionsUseCase as UseCaseAbstraction } from "./abstractions.js";
|
|
2
|
+
import { TaskDefinition } from "@webiny/api-core/features/task/TaskDefinition/index.js";
|
|
3
|
+
class ListTaskDefinitionsUseCaseImpl {
|
|
4
|
+
constructor(definitions) {
|
|
5
|
+
this.definitions = definitions;
|
|
6
|
+
}
|
|
7
|
+
execute() {
|
|
8
|
+
return this.definitions;
|
|
9
|
+
}
|
|
10
|
+
}
|
|
11
|
+
export const ListTaskDefinitionsUseCase = UseCaseAbstraction.createImplementation({
|
|
12
|
+
implementation: ListTaskDefinitionsUseCaseImpl,
|
|
13
|
+
dependencies: [[TaskDefinition, {
|
|
14
|
+
multiple: true
|
|
15
|
+
}]]
|
|
16
|
+
});
|
|
17
|
+
|
|
18
|
+
//# sourceMappingURL=ListTaskDefinitionsUseCase.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["ListTaskDefinitionsUseCase","UseCaseAbstraction","TaskDefinition","ListTaskDefinitionsUseCaseImpl","constructor","definitions","execute","createImplementation","implementation","dependencies","multiple"],"sources":["ListTaskDefinitionsUseCase.ts"],"sourcesContent":["import { ListTaskDefinitionsUseCase as UseCaseAbstraction } from \"./abstractions.js\";\nimport { TaskDefinition } from \"@webiny/api-core/features/task/TaskDefinition/index.js\";\n\nclass ListTaskDefinitionsUseCaseImpl implements UseCaseAbstraction.Interface {\n public constructor(private definitions: TaskDefinition.Interface[]) {}\n\n public execute(): TaskDefinition.Interface[] {\n return this.definitions;\n }\n}\n\nexport const ListTaskDefinitionsUseCase = UseCaseAbstraction.createImplementation({\n implementation: ListTaskDefinitionsUseCaseImpl,\n dependencies: [[TaskDefinition, { multiple: true }]]\n});\n"],"mappings":"AAAA,SAASA,0BAA0B,IAAIC,kBAAkB;AACzD,SAASC,cAAc,QAAQ,wDAAwD;AAEvF,MAAMC,8BAA8B,CAAyC;EAClEC,WAAWA,CAASC,WAAuC,EAAE;IAAA,KAAzCA,WAAuC,GAAvCA,WAAuC;EAAG;EAE9DC,OAAOA,CAAA,EAA+B;IACzC,OAAO,IAAI,CAACD,WAAW;EAC3B;AACJ;AAEA,OAAO,MAAML,0BAA0B,GAAGC,kBAAkB,CAACM,oBAAoB,CAAC;EAC9EC,cAAc,EAAEL,8BAA8B;EAC9CM,YAAY,EAAE,CAAC,CAACP,cAAc,EAAE;IAAEQ,QAAQ,EAAE;EAAK,CAAC,CAAC;AACvD,CAAC,CAAC","ignoreList":[]}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { TaskDefinition } from "@webiny/api-core/features/task/TaskDefinition/index.js";
|
|
2
|
+
export interface IListTaskDefinitionsUseCase {
|
|
3
|
+
execute(): TaskDefinition.Interface[];
|
|
4
|
+
}
|
|
5
|
+
export declare const ListTaskDefinitionsUseCase: import("@webiny/di").Abstraction<IListTaskDefinitionsUseCase>;
|
|
6
|
+
export declare namespace ListTaskDefinitionsUseCase {
|
|
7
|
+
type Interface = IListTaskDefinitionsUseCase;
|
|
8
|
+
type Return = TaskDefinition.Interface[];
|
|
9
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["createAbstraction","ListTaskDefinitionsUseCase"],"sources":["abstractions.ts"],"sourcesContent":["import { createAbstraction } from \"@webiny/feature/api\";\nimport { TaskDefinition } from \"@webiny/api-core/features/task/TaskDefinition/index.js\";\n\nexport interface IListTaskDefinitionsUseCase {\n execute(): TaskDefinition.Interface[];\n}\n\nexport const ListTaskDefinitionsUseCase = createAbstraction<IListTaskDefinitionsUseCase>(\n \"Tasks/ListTaskDefinitionsUseCase\"\n);\n\nexport namespace ListTaskDefinitionsUseCase {\n export type Interface = IListTaskDefinitionsUseCase;\n export type Return = TaskDefinition.Interface[];\n}\n"],"mappings":"AAAA,SAASA,iBAAiB,QAAQ,qBAAqB;AAOvD,OAAO,MAAMC,0BAA0B,GAAGD,iBAAiB,CACvD,kCACJ,CAAC","ignoreList":[]}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { createFeature } from "@webiny/feature/api";
|
|
2
|
+
import { ListTaskDefinitionsUseCase } from "./ListTaskDefinitionsUseCase.js";
|
|
3
|
+
export const ListTaskDefinitionsFeature = createFeature({
|
|
4
|
+
name: "ListTaskDefinitions",
|
|
5
|
+
register(container) {
|
|
6
|
+
container.register(ListTaskDefinitionsUseCase);
|
|
7
|
+
}
|
|
8
|
+
});
|
|
9
|
+
|
|
10
|
+
//# sourceMappingURL=feature.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["createFeature","ListTaskDefinitionsUseCase","ListTaskDefinitionsFeature","name","register","container"],"sources":["feature.ts"],"sourcesContent":["import { createFeature } from \"@webiny/feature/api\";\nimport { ListTaskDefinitionsUseCase } from \"./ListTaskDefinitionsUseCase.js\";\n\nexport const ListTaskDefinitionsFeature = createFeature({\n name: \"ListTaskDefinitions\",\n register(container) {\n container.register(ListTaskDefinitionsUseCase);\n }\n});\n"],"mappings":"AAAA,SAASA,aAAa,QAAQ,qBAAqB;AACnD,SAASC,0BAA0B;AAEnC,OAAO,MAAMC,0BAA0B,GAAGF,aAAa,CAAC;EACpDG,IAAI,EAAE,qBAAqB;EAC3BC,QAAQA,CAACC,SAAS,EAAE;IAChBA,SAAS,CAACD,QAAQ,CAACH,0BAA0B,CAAC;EAClD;AACJ,CAAC,CAAC","ignoreList":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["ListTaskDefinitionsUseCase","ListTaskDefinitionsFeature"],"sources":["index.ts"],"sourcesContent":["export { ListTaskDefinitionsUseCase } from \"./abstractions.js\";\nexport { ListTaskDefinitionsFeature } from \"./feature.js\";\n"],"mappings":"AAAA,SAASA,0BAA0B;AACnC,SAASC,0BAA0B","ignoreList":[]}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { ListTasksUseCase as UseCaseAbstraction } from "./abstractions.js";
|
|
2
|
+
import { TaskDefinition } from "@webiny/api-core/features/task/TaskDefinition/index.js";
|
|
3
|
+
import { TaskService } from "@webiny/api-core/features/task/TaskService/index.js";
|
|
4
|
+
import type { Context, IListTasksResponse } from "../../types.js";
|
|
5
|
+
export declare class ListTasksUseCaseImpl implements UseCaseAbstraction.Interface {
|
|
6
|
+
private context;
|
|
7
|
+
constructor(context: Context);
|
|
8
|
+
execute<I extends TaskDefinition.TaskInput = TaskDefinition.TaskInput, O extends TaskService.GenericOutput = TaskService.GenericOutput>(params?: UseCaseAbstraction.Params): Promise<IListTasksResponse<I, O>>;
|
|
9
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["ListTasksUseCaseImpl","constructor","context","execute","params","tasks","listTasks"],"sources":["ListTasksUseCase.ts"],"sourcesContent":["import { ListTasksUseCase as UseCaseAbstraction } from \"./abstractions.js\";\nimport { TaskDefinition } from \"@webiny/api-core/features/task/TaskDefinition/index.js\";\nimport { TaskService } from \"@webiny/api-core/features/task/TaskService/index.js\";\nimport type { Context, IListTasksResponse } from \"~/types.js\";\n\nexport class ListTasksUseCaseImpl implements UseCaseAbstraction.Interface {\n public constructor(private context: Context) {}\n\n async execute<\n I extends TaskDefinition.TaskInput = TaskDefinition.TaskInput,\n O extends TaskService.GenericOutput = TaskService.GenericOutput\n >(params?: UseCaseAbstraction.Params): Promise<IListTasksResponse<I, O>> {\n return await this.context.tasks.listTasks<I, O>(params);\n }\n}\n"],"mappings":"AAKA,OAAO,MAAMA,oBAAoB,CAAyC;EAC/DC,WAAWA,CAASC,OAAgB,EAAE;IAAA,KAAlBA,OAAgB,GAAhBA,OAAgB;EAAG;EAE9C,MAAMC,OAAOA,CAGXC,MAAkC,EAAqC;IACrE,OAAO,MAAM,IAAI,CAACF,OAAO,CAACG,KAAK,CAACC,SAAS,CAAOF,MAAM,CAAC;EAC3D;AACJ","ignoreList":[]}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { TaskService } from "@webiny/api-core/features/task/TaskService/index.js";
|
|
2
|
+
import { TaskDefinition } from "@webiny/api-core/features/task/TaskDefinition/index.js";
|
|
3
|
+
import type { IListTasksResponse, IListTaskParams } from "../../types.js";
|
|
4
|
+
export interface IListTasksUseCase {
|
|
5
|
+
execute<I extends TaskDefinition.TaskInput = TaskDefinition.TaskInput, O extends TaskService.GenericOutput = TaskService.GenericOutput>(params?: ListTasksParams): Promise<IListTasksResponse<I, O>>;
|
|
6
|
+
}
|
|
7
|
+
export type ListTasksParams = IListTaskParams;
|
|
8
|
+
export declare const ListTasksUseCase: import("@webiny/di").Abstraction<IListTasksUseCase>;
|
|
9
|
+
export declare namespace ListTasksUseCase {
|
|
10
|
+
type Interface = IListTasksUseCase;
|
|
11
|
+
type Params = ListTasksParams;
|
|
12
|
+
type Return<I extends TaskDefinition.TaskInput = TaskDefinition.TaskInput, O extends TaskService.GenericOutput = TaskService.GenericOutput> = Promise<IListTasksResponse<I, O>>;
|
|
13
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["createAbstraction","ListTasksUseCase"],"sources":["abstractions.ts"],"sourcesContent":["import { createAbstraction } from \"@webiny/feature/api\";\nimport { TaskService } from \"@webiny/api-core/features/task/TaskService/index.js\";\nimport { TaskDefinition } from \"@webiny/api-core/features/task/TaskDefinition/index.js\";\nimport type { IListTasksResponse, IListTaskParams } from \"~/types.js\";\n\nexport interface IListTasksUseCase {\n execute<\n I extends TaskDefinition.TaskInput = TaskDefinition.TaskInput,\n O extends TaskService.GenericOutput = TaskService.GenericOutput\n >(\n params?: ListTasksParams\n ): Promise<IListTasksResponse<I, O>>;\n}\n\nexport type ListTasksParams = IListTaskParams;\n\nexport const ListTasksUseCase = createAbstraction<IListTasksUseCase>(\"Tasks/ListTasksUseCase\");\n\nexport namespace ListTasksUseCase {\n export type Interface = IListTasksUseCase;\n export type Params = ListTasksParams;\n\n export type Return<\n I extends TaskDefinition.TaskInput = TaskDefinition.TaskInput,\n O extends TaskService.GenericOutput = TaskService.GenericOutput\n > = Promise<IListTasksResponse<I, O>>;\n}\n"],"mappings":"AAAA,SAASA,iBAAiB,QAAQ,qBAAqB;AAgBvD,OAAO,MAAMC,gBAAgB,GAAGD,iBAAiB,CAAoB,wBAAwB,CAAC","ignoreList":[]}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { createFeature } from "@webiny/feature/api";
|
|
2
|
+
import { ListTasksUseCaseImpl } from "./ListTasksUseCase.js";
|
|
3
|
+
import { ListTasksUseCase } from "./abstractions.js";
|
|
4
|
+
export const ListTasksFeature = createFeature({
|
|
5
|
+
name: "ListTasks",
|
|
6
|
+
register(container, context) {
|
|
7
|
+
container.registerInstance(ListTasksUseCase, new ListTasksUseCaseImpl(context));
|
|
8
|
+
}
|
|
9
|
+
});
|
|
10
|
+
|
|
11
|
+
//# sourceMappingURL=feature.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["createFeature","ListTasksUseCaseImpl","ListTasksUseCase","ListTasksFeature","name","register","container","context","registerInstance"],"sources":["feature.ts"],"sourcesContent":["import { createFeature } from \"@webiny/feature/api\";\nimport { ListTasksUseCaseImpl } from \"./ListTasksUseCase.js\";\nimport type { Context } from \"~/types.js\";\nimport { ListTasksUseCase } from \"./abstractions.js\";\n\nexport const ListTasksFeature = createFeature<Context>({\n name: \"ListTasks\",\n register(container, context) {\n container.registerInstance(ListTasksUseCase, new ListTasksUseCaseImpl(context!));\n }\n});\n"],"mappings":"AAAA,SAASA,aAAa,QAAQ,qBAAqB;AACnD,SAASC,oBAAoB;AAE7B,SAASC,gBAAgB;AAEzB,OAAO,MAAMC,gBAAgB,GAAGH,aAAa,CAAU;EACnDI,IAAI,EAAE,WAAW;EACjBC,QAAQA,CAACC,SAAS,EAAEC,OAAO,EAAE;IACzBD,SAAS,CAACE,gBAAgB,CAACN,gBAAgB,EAAE,IAAID,oBAAoB,CAACM,OAAQ,CAAC,CAAC;EACpF;AACJ,CAAC,CAAC","ignoreList":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["ListTasksUseCase","ListTasksFeature"],"sources":["index.ts"],"sourcesContent":["export { ListTasksUseCase } from \"./abstractions.js\";\nexport { ListTasksFeature } from \"./feature.js\";\n"],"mappings":"AAAA,SAASA,gBAAgB;AACzB,SAASC,gBAAgB","ignoreList":[]}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import { TaskDefinition } from "@webiny/api-core/features/task/TaskDefinition/abstractions.js";
|
|
2
|
+
import { TaskController as Abstraction } from "@webiny/api-core/features/task/TaskController/abstractions.js";
|
|
3
|
+
import { TaskService } from "@webiny/api-core/features/task/TaskService/index.js";
|
|
4
|
+
import { TaskExecutionContext } from "../TaskExecutionContext/abstractions.js";
|
|
5
|
+
import { type ITaskTriggerParams, TaskDataStatus } from "../../types.js";
|
|
6
|
+
import "./augmentation.js";
|
|
7
|
+
import { BaseError, Result } from "@webiny/feature/api/index.js";
|
|
8
|
+
declare class TaskControllerImpl implements Abstraction.Interface {
|
|
9
|
+
private taskService;
|
|
10
|
+
private executionContext;
|
|
11
|
+
constructor(taskService: TaskService.Interface, executionContext: TaskExecutionContext.Interface);
|
|
12
|
+
private get store();
|
|
13
|
+
private get runner();
|
|
14
|
+
private get timer();
|
|
15
|
+
get response(): import("~/types.js").ITaskResponse<import("@webiny/api-core/features/task/TaskDefinition/abstractions.js").ITaskInput, import("@webiny/api-core/features/task/TaskDefinition/abstractions.js").ITaskOutput>;
|
|
16
|
+
state: {
|
|
17
|
+
getTask: () => import("~/types.js").ITask<import("@webiny/api-core/features/task/TaskDefinition/abstractions.js").ITaskInput, import("@webiny/api-core/features/task/TaskDefinition/abstractions.js").ITaskOutput>;
|
|
18
|
+
getStatus: () => TaskDataStatus;
|
|
19
|
+
getInput: () => import("@webiny/api-core/features/task/TaskDefinition/abstractions.js").ITaskInput;
|
|
20
|
+
getOutput: () => import("@webiny/api-core/features/task/TaskDefinition/abstractions.js").ITaskOutput;
|
|
21
|
+
updateInput: (input: any) => Promise<void>;
|
|
22
|
+
updateOutput: (output: any) => Promise<void>;
|
|
23
|
+
};
|
|
24
|
+
logger: {
|
|
25
|
+
info: (params: {
|
|
26
|
+
message: string;
|
|
27
|
+
data?: Record<string, any>;
|
|
28
|
+
}) => Promise<void>;
|
|
29
|
+
error: (params: {
|
|
30
|
+
message: string;
|
|
31
|
+
error?: Error | any;
|
|
32
|
+
data?: Record<string, any>;
|
|
33
|
+
}) => Promise<void>;
|
|
34
|
+
};
|
|
35
|
+
task: {
|
|
36
|
+
trigger: <CI extends TaskDefinition.TaskInput = import("@webiny/api-core/features/task/TaskDefinition/abstractions.js").ITaskInput>(params: ITaskTriggerParams<CI>) => Promise<Result<TaskService.Task<CI>, BaseError>>;
|
|
37
|
+
listChildren: <CT extends TaskDefinition.TaskInput = import("@webiny/api-core/features/task/TaskDefinition/abstractions.js").ITaskInput, CO extends TaskDefinition.TaskOutput = import("@webiny/api-core/features/task/TaskDefinition/abstractions.js").ITaskOutput>(definitionId?: string) => Promise<TaskService.Task<CT, CO>[]>;
|
|
38
|
+
};
|
|
39
|
+
runtime: {
|
|
40
|
+
isCloseToTimeout: (seconds?: number) => boolean;
|
|
41
|
+
isAborted: () => boolean;
|
|
42
|
+
getRemainingSeconds: () => number;
|
|
43
|
+
getRemainingMilliseconds: () => number;
|
|
44
|
+
};
|
|
45
|
+
}
|
|
46
|
+
export declare const TaskController: typeof TaskControllerImpl & {
|
|
47
|
+
__abstraction: import("@webiny/di").Abstraction<import("@webiny/api-core/features/task/TaskController/abstractions.js").ITaskController<import("@webiny/api-core/features/task/TaskDefinition/abstractions.js").ITaskInput, import("@webiny/api-core/features/task/TaskDefinition/abstractions.js").ITaskOutput>>;
|
|
48
|
+
};
|
|
49
|
+
export {};
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
import { TaskController as Abstraction } from "@webiny/api-core/features/task/TaskController/abstractions.js";
|
|
2
|
+
import { TaskService } from "@webiny/api-core/features/task/TaskService/index.js";
|
|
3
|
+
import { TaskExecutionContext } from "../TaskExecutionContext/abstractions.js";
|
|
4
|
+
import { TaskDataStatus } from "../../types.js";
|
|
5
|
+
import "./augmentation.js";
|
|
6
|
+
class TaskControllerImpl {
|
|
7
|
+
constructor(taskService, executionContext) {
|
|
8
|
+
this.taskService = taskService;
|
|
9
|
+
this.executionContext = executionContext;
|
|
10
|
+
}
|
|
11
|
+
get store() {
|
|
12
|
+
return this.executionContext.store;
|
|
13
|
+
}
|
|
14
|
+
get runner() {
|
|
15
|
+
return this.executionContext.runner;
|
|
16
|
+
}
|
|
17
|
+
get timer() {
|
|
18
|
+
return this.executionContext.timer;
|
|
19
|
+
}
|
|
20
|
+
get response() {
|
|
21
|
+
return this.executionContext.response;
|
|
22
|
+
}
|
|
23
|
+
state = {
|
|
24
|
+
getTask: () => this.store.getTask(),
|
|
25
|
+
getStatus: () => this.store.getStatus(),
|
|
26
|
+
getInput: () => this.store.getInput(),
|
|
27
|
+
getOutput: () => this.store.getOutput(),
|
|
28
|
+
updateInput: async input => await this.store.updateInput(input),
|
|
29
|
+
updateOutput: async output => await this.store.updateOutput(output)
|
|
30
|
+
};
|
|
31
|
+
logger = {
|
|
32
|
+
info: async params => {
|
|
33
|
+
await this.store.addInfoLog(params);
|
|
34
|
+
},
|
|
35
|
+
error: async params => {
|
|
36
|
+
const error = params.error;
|
|
37
|
+
const errorObj = error instanceof Error ? {
|
|
38
|
+
message: error.message,
|
|
39
|
+
stack: error.stack
|
|
40
|
+
} : error;
|
|
41
|
+
await this.store.addErrorLog({
|
|
42
|
+
message: params.message,
|
|
43
|
+
error: errorObj,
|
|
44
|
+
data: params.data
|
|
45
|
+
});
|
|
46
|
+
}
|
|
47
|
+
};
|
|
48
|
+
task = {
|
|
49
|
+
trigger: async params => {
|
|
50
|
+
return this.taskService.trigger({
|
|
51
|
+
...params,
|
|
52
|
+
parent: this.store.getTask()
|
|
53
|
+
});
|
|
54
|
+
},
|
|
55
|
+
listChildren: async definitionId => {
|
|
56
|
+
return this.store.listChildTasks(definitionId);
|
|
57
|
+
}
|
|
58
|
+
};
|
|
59
|
+
runtime = {
|
|
60
|
+
isCloseToTimeout: seconds => this.runner.isCloseToTimeout(seconds),
|
|
61
|
+
isAborted: () => this.store.getStatus() === TaskDataStatus.ABORTED,
|
|
62
|
+
getRemainingSeconds: () => this.timer.getRemainingSeconds(),
|
|
63
|
+
getRemainingMilliseconds: () => this.timer.getRemainingMilliseconds()
|
|
64
|
+
};
|
|
65
|
+
}
|
|
66
|
+
export const TaskController = Abstraction.createImplementation({
|
|
67
|
+
implementation: TaskControllerImpl,
|
|
68
|
+
dependencies: [TaskService, TaskExecutionContext]
|
|
69
|
+
});
|
|
70
|
+
|
|
71
|
+
//# sourceMappingURL=TaskController.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["TaskController","Abstraction","TaskService","TaskExecutionContext","TaskDataStatus","TaskControllerImpl","constructor","taskService","executionContext","store","runner","timer","response","state","getTask","getStatus","getInput","getOutput","updateInput","input","updateOutput","output","logger","info","params","addInfoLog","error","errorObj","Error","message","stack","addErrorLog","data","task","trigger","parent","listChildren","definitionId","listChildTasks","runtime","isCloseToTimeout","seconds","isAborted","ABORTED","getRemainingSeconds","getRemainingMilliseconds","createImplementation","implementation","dependencies"],"sources":["TaskController.ts"],"sourcesContent":["import { TaskDefinition } from \"@webiny/api-core/features/task/TaskDefinition/abstractions.js\";\nimport { TaskController as Abstraction } from \"@webiny/api-core/features/task/TaskController/abstractions.js\";\nimport { TaskService } from \"@webiny/api-core/features/task/TaskService/index.js\";\nimport { TaskExecutionContext } from \"../TaskExecutionContext/abstractions.js\";\nimport { type ITaskTriggerParams, TaskDataStatus } from \"~/types.js\";\nimport \"./augmentation.js\";\nimport { BaseError, Result } from \"@webiny/feature/api/index.js\";\n\nclass TaskControllerImpl implements Abstraction.Interface {\n constructor(\n private taskService: TaskService.Interface,\n private executionContext: TaskExecutionContext.Interface\n ) {}\n\n private get store() {\n return this.executionContext.store;\n }\n\n private get runner() {\n return this.executionContext.runner;\n }\n\n private get timer() {\n return this.executionContext.timer;\n }\n\n public get response() {\n return this.executionContext.response;\n }\n\n state = {\n getTask: () => this.store.getTask(),\n getStatus: () => this.store.getStatus(),\n getInput: () => this.store.getInput(),\n getOutput: () => this.store.getOutput(),\n updateInput: async (input: any) => await this.store.updateInput(input),\n updateOutput: async (output: any) => await this.store.updateOutput(output)\n };\n\n logger = {\n info: async (params: { message: string; data?: Record<string, any> }) => {\n await this.store.addInfoLog(params);\n },\n error: async (params: {\n message: string;\n error?: Error | any;\n data?: Record<string, any>;\n }) => {\n const error = params.error;\n const errorObj =\n error instanceof Error ? { message: error.message, stack: error.stack } : error;\n await this.store.addErrorLog({\n message: params.message,\n error: errorObj,\n data: params.data\n });\n }\n };\n\n task = {\n trigger: async <CI extends TaskDefinition.TaskInput = TaskDefinition.TaskInput>(\n params: ITaskTriggerParams<CI>\n ): Promise<Result<TaskService.Task<CI>, BaseError>> => {\n return this.taskService.trigger({ ...params, parent: this.store.getTask() });\n },\n listChildren: async <\n CT extends TaskDefinition.TaskInput = TaskDefinition.TaskInput,\n CO extends TaskDefinition.TaskOutput = TaskDefinition.TaskOutput\n >(\n definitionId?: string\n ): Promise<TaskService.Task<CT, CO>[]> => {\n return this.store.listChildTasks(definitionId);\n }\n };\n\n runtime = {\n isCloseToTimeout: (seconds?: number) => this.runner.isCloseToTimeout(seconds),\n isAborted: () => this.store.getStatus() === TaskDataStatus.ABORTED,\n getRemainingSeconds: () => this.timer.getRemainingSeconds(),\n getRemainingMilliseconds: () => this.timer.getRemainingMilliseconds()\n };\n}\n\nexport const TaskController = Abstraction.createImplementation({\n implementation: TaskControllerImpl,\n dependencies: [TaskService, TaskExecutionContext]\n});\n"],"mappings":"AACA,SAASA,cAAc,IAAIC,WAAW,QAAQ,+DAA+D;AAC7G,SAASC,WAAW,QAAQ,qDAAqD;AACjF,SAASC,oBAAoB;AAC7B,SAAkCC,cAAc;AAChD;AAGA,MAAMC,kBAAkB,CAAkC;EACtDC,WAAWA,CACCC,WAAkC,EAClCC,gBAAgD,EAC1D;IAAA,KAFUD,WAAkC,GAAlCA,WAAkC;IAAA,KAClCC,gBAAgD,GAAhDA,gBAAgD;EACzD;EAEH,IAAYC,KAAKA,CAAA,EAAG;IAChB,OAAO,IAAI,CAACD,gBAAgB,CAACC,KAAK;EACtC;EAEA,IAAYC,MAAMA,CAAA,EAAG;IACjB,OAAO,IAAI,CAACF,gBAAgB,CAACE,MAAM;EACvC;EAEA,IAAYC,KAAKA,CAAA,EAAG;IAChB,OAAO,IAAI,CAACH,gBAAgB,CAACG,KAAK;EACtC;EAEA,IAAWC,QAAQA,CAAA,EAAG;IAClB,OAAO,IAAI,CAACJ,gBAAgB,CAACI,QAAQ;EACzC;EAEAC,KAAK,GAAG;IACJC,OAAO,EAAEA,CAAA,KAAM,IAAI,CAACL,KAAK,CAACK,OAAO,CAAC,CAAC;IACnCC,SAAS,EAAEA,CAAA,KAAM,IAAI,CAACN,KAAK,CAACM,SAAS,CAAC,CAAC;IACvCC,QAAQ,EAAEA,CAAA,KAAM,IAAI,CAACP,KAAK,CAACO,QAAQ,CAAC,CAAC;IACrCC,SAAS,EAAEA,CAAA,KAAM,IAAI,CAACR,KAAK,CAACQ,SAAS,CAAC,CAAC;IACvCC,WAAW,EAAE,MAAOC,KAAU,IAAK,MAAM,IAAI,CAACV,KAAK,CAACS,WAAW,CAACC,KAAK,CAAC;IACtEC,YAAY,EAAE,MAAOC,MAAW,IAAK,MAAM,IAAI,CAACZ,KAAK,CAACW,YAAY,CAACC,MAAM;EAC7E,CAAC;EAEDC,MAAM,GAAG;IACLC,IAAI,EAAE,MAAOC,MAAuD,IAAK;MACrE,MAAM,IAAI,CAACf,KAAK,CAACgB,UAAU,CAACD,MAAM,CAAC;IACvC,CAAC;IACDE,KAAK,EAAE,MAAOF,MAIb,IAAK;MACF,MAAME,KAAK,GAAGF,MAAM,CAACE,KAAK;MAC1B,MAAMC,QAAQ,GACVD,KAAK,YAAYE,KAAK,GAAG;QAAEC,OAAO,EAAEH,KAAK,CAACG,OAAO;QAAEC,KAAK,EAAEJ,KAAK,CAACI;MAAM,CAAC,GAAGJ,KAAK;MACnF,MAAM,IAAI,CAACjB,KAAK,CAACsB,WAAW,CAAC;QACzBF,OAAO,EAAEL,MAAM,CAACK,OAAO;QACvBH,KAAK,EAAEC,QAAQ;QACfK,IAAI,EAAER,MAAM,CAACQ;MACjB,CAAC,CAAC;IACN;EACJ,CAAC;EAEDC,IAAI,GAAG;IACHC,OAAO,EAAE,MACLV,MAA8B,IACqB;MACnD,OAAO,IAAI,CAACjB,WAAW,CAAC2B,OAAO,CAAC;QAAE,GAAGV,MAAM;QAAEW,MAAM,EAAE,IAAI,CAAC1B,KAAK,CAACK,OAAO,CAAC;MAAE,CAAC,CAAC;IAChF,CAAC;IACDsB,YAAY,EAAE,MAIVC,YAAqB,IACiB;MACtC,OAAO,IAAI,CAAC5B,KAAK,CAAC6B,cAAc,CAACD,YAAY,CAAC;IAClD;EACJ,CAAC;EAEDE,OAAO,GAAG;IACNC,gBAAgB,EAAGC,OAAgB,IAAK,IAAI,CAAC/B,MAAM,CAAC8B,gBAAgB,CAACC,OAAO,CAAC;IAC7EC,SAAS,EAAEA,CAAA,KAAM,IAAI,CAACjC,KAAK,CAACM,SAAS,CAAC,CAAC,KAAKX,cAAc,CAACuC,OAAO;IAClEC,mBAAmB,EAAEA,CAAA,KAAM,IAAI,CAACjC,KAAK,CAACiC,mBAAmB,CAAC,CAAC;IAC3DC,wBAAwB,EAAEA,CAAA,KAAM,IAAI,CAAClC,KAAK,CAACkC,wBAAwB,CAAC;EACxE,CAAC;AACL;AAEA,OAAO,MAAM7C,cAAc,GAAGC,WAAW,CAAC6C,oBAAoB,CAAC;EAC3DC,cAAc,EAAE1C,kBAAkB;EAClC2C,YAAY,EAAE,CAAC9C,WAAW,EAAEC,oBAAoB;AACpD,CAAC,CAAC","ignoreList":[]}
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import type { IResponseError } from "@webiny/api-core/features/task/TaskDefinition";
|
|
2
|
+
import type { TaskDataStatus } from "../../types.js";
|
|
3
|
+
import { type ITaskTriggerParams, TaskService } from "@webiny/api-core/features/task/TaskService/index.js";
|
|
4
|
+
import { TaskDefinition } from "@webiny/api-core/features/task/TaskDefinition/index.js";
|
|
5
|
+
import type { ITaskResponse } from "../../response/abstractions/index.js";
|
|
6
|
+
import { Result } from "@webiny/feature/api";
|
|
7
|
+
import { BaseError } from "@webiny/feature/api/index.js";
|
|
8
|
+
/**
|
|
9
|
+
* Augment the TaskController interface from api-core with implementation details.
|
|
10
|
+
* This allows developers to import from @webiny/api-core but get the full interface.
|
|
11
|
+
*/
|
|
12
|
+
declare module "@webiny/api-core/features/task/TaskController/abstractions.js" {
|
|
13
|
+
interface ITaskController<I extends TaskDefinition.TaskInput = TaskDefinition.TaskInput, O extends TaskDefinition.TaskOutput = TaskDefinition.TaskOutput> {
|
|
14
|
+
/**
|
|
15
|
+
* Response object
|
|
16
|
+
*/
|
|
17
|
+
response: ITaskResponse<I, O>;
|
|
18
|
+
/**
|
|
19
|
+
* State management - access and update task state
|
|
20
|
+
*/
|
|
21
|
+
state: {
|
|
22
|
+
getTask(): TaskService.Task<I, O>;
|
|
23
|
+
getStatus(): TaskDataStatus;
|
|
24
|
+
getInput(): I;
|
|
25
|
+
getOutput(): O | undefined;
|
|
26
|
+
updateInput(input: Partial<I>): Promise<void>;
|
|
27
|
+
updateOutput(output: Partial<O>): Promise<void>;
|
|
28
|
+
};
|
|
29
|
+
/**
|
|
30
|
+
* Logging - add log entries to task
|
|
31
|
+
*/
|
|
32
|
+
logger: {
|
|
33
|
+
info(params: {
|
|
34
|
+
message: string;
|
|
35
|
+
data?: Record<string, any>;
|
|
36
|
+
}): Promise<void>;
|
|
37
|
+
error(params: {
|
|
38
|
+
message: string;
|
|
39
|
+
error?: Error | IResponseError;
|
|
40
|
+
data?: Record<string, any>;
|
|
41
|
+
}): Promise<void>;
|
|
42
|
+
};
|
|
43
|
+
/**
|
|
44
|
+
* Task management - trigger and query child tasks
|
|
45
|
+
*/
|
|
46
|
+
task: {
|
|
47
|
+
trigger<CI extends TaskDefinition.TaskInput = TaskDefinition.TaskInput>(params: ITaskTriggerParams<CI>): Promise<Result<TaskService.Task<CI>, BaseError>>;
|
|
48
|
+
listChildren<CT extends TaskDefinition.TaskInput = I, CO extends TaskDefinition.TaskOutput = O>(definitionId?: string): Promise<TaskService.Task<CT, CO>[]>;
|
|
49
|
+
};
|
|
50
|
+
/**
|
|
51
|
+
* Runtime checks
|
|
52
|
+
*/
|
|
53
|
+
runtime: {
|
|
54
|
+
isCloseToTimeout(seconds?: number): boolean;
|
|
55
|
+
isAborted(): boolean;
|
|
56
|
+
getRemainingSeconds(): number;
|
|
57
|
+
getRemainingMilliseconds(): number;
|
|
58
|
+
};
|
|
59
|
+
}
|
|
60
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":[],"sources":["augmentation.ts"],"sourcesContent":["import type { IResponseError } from \"@webiny/api-core/features/task/TaskDefinition\";\nimport type { TaskDataStatus } from \"~/types.js\";\nimport {\n type ITaskTriggerParams,\n TaskService\n} from \"@webiny/api-core/features/task/TaskService/index.js\";\nimport { TaskDefinition } from \"@webiny/api-core/features/task/TaskDefinition/index.js\";\nimport type { ITaskResponse } from \"~/response/abstractions/index.js\";\nimport { Result } from \"@webiny/feature/api\";\nimport { BaseError } from \"@webiny/feature/api/index.js\";\n\n/**\n * Augment the TaskController interface from api-core with implementation details.\n * This allows developers to import from @webiny/api-core but get the full interface.\n */\ndeclare module \"@webiny/api-core/features/task/TaskController/abstractions.js\" {\n interface ITaskController<\n I extends TaskDefinition.TaskInput = TaskDefinition.TaskInput,\n O extends TaskDefinition.TaskOutput = TaskDefinition.TaskOutput\n > {\n /**\n * Response object\n */\n response: ITaskResponse<I, O>;\n\n /**\n * State management - access and update task state\n */\n state: {\n getTask(): TaskService.Task<I, O>;\n getStatus(): TaskDataStatus;\n getInput(): I;\n getOutput(): O | undefined;\n updateInput(input: Partial<I>): Promise<void>;\n updateOutput(output: Partial<O>): Promise<void>;\n };\n\n /**\n * Logging - add log entries to task\n */\n logger: {\n info(params: { message: string; data?: Record<string, any> }): Promise<void>;\n error(params: {\n message: string;\n error?: Error | IResponseError;\n data?: Record<string, any>;\n }): Promise<void>;\n };\n\n /**\n * Task management - trigger and query child tasks\n */\n task: {\n trigger<CI extends TaskDefinition.TaskInput = TaskDefinition.TaskInput>(\n params: ITaskTriggerParams<CI>\n ): Promise<Result<TaskService.Task<CI>, BaseError>>;\n\n listChildren<\n CT extends TaskDefinition.TaskInput = I,\n CO extends TaskDefinition.TaskOutput = O\n >(\n definitionId?: string\n ): Promise<TaskService.Task<CT, CO>[]>;\n };\n\n /**\n * Runtime checks\n */\n runtime: {\n isCloseToTimeout(seconds?: number): boolean;\n isAborted(): boolean;\n getRemainingSeconds(): number;\n getRemainingMilliseconds(): number;\n };\n }\n}\n"],"mappings":"","ignoreList":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["TaskController"],"sources":["index.ts"],"sourcesContent":["// Import augmentation to ensure it's loaded\nimport \"./augmentation.js\";\n\n// Export implementation only\nexport { TaskController } from \"./TaskController.js\";\n"],"mappings":"AAAA;AACA;;AAEA;AACA,SAASA,cAAc","ignoreList":[]}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { TaskExecutionContext as Abstraction } from "./abstractions.js";
|
|
2
|
+
import type { ITaskManagerStore } from "../../runner/abstractions/TaskManagerStore.js";
|
|
3
|
+
import type { ITaskRunner } from "../../runner/abstractions/TaskRunner.js";
|
|
4
|
+
import type { ITimer } from "@webiny/handler-aws";
|
|
5
|
+
import type { ITaskResponse } from "../../response/abstractions/index.js";
|
|
6
|
+
declare class TaskExecutionContextImpl implements Abstraction.Interface {
|
|
7
|
+
private _store?;
|
|
8
|
+
private _runner?;
|
|
9
|
+
private _timer?;
|
|
10
|
+
private _response?;
|
|
11
|
+
get store(): ITaskManagerStore;
|
|
12
|
+
get runner(): ITaskRunner;
|
|
13
|
+
get timer(): ITimer;
|
|
14
|
+
get response(): ITaskResponse;
|
|
15
|
+
setStore(store: ITaskManagerStore): void;
|
|
16
|
+
setRunner(runner: ITaskRunner): void;
|
|
17
|
+
setTimer(timer: ITimer): void;
|
|
18
|
+
setResponse(response: ITaskResponse): void;
|
|
19
|
+
clear(): void;
|
|
20
|
+
}
|
|
21
|
+
export declare const TaskExecutionContext: typeof TaskExecutionContextImpl & {
|
|
22
|
+
__abstraction: import("@webiny/di").Abstraction<import("./abstractions.js").ITaskExecutionContext>;
|
|
23
|
+
};
|
|
24
|
+
export {};
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import { TaskExecutionContext as Abstraction } from "./abstractions.js";
|
|
2
|
+
class TaskExecutionContextImpl {
|
|
3
|
+
get store() {
|
|
4
|
+
if (!this._store) {
|
|
5
|
+
throw new Error("TaskExecutionContext: store not set. Task execution not started.");
|
|
6
|
+
}
|
|
7
|
+
return this._store;
|
|
8
|
+
}
|
|
9
|
+
get runner() {
|
|
10
|
+
if (!this._runner) {
|
|
11
|
+
throw new Error("TaskExecutionContext: runner not set. Task execution not started.");
|
|
12
|
+
}
|
|
13
|
+
return this._runner;
|
|
14
|
+
}
|
|
15
|
+
get timer() {
|
|
16
|
+
if (!this._timer) {
|
|
17
|
+
throw new Error("TaskExecutionContext: timer not set. Task execution not started.");
|
|
18
|
+
}
|
|
19
|
+
return this._timer;
|
|
20
|
+
}
|
|
21
|
+
get response() {
|
|
22
|
+
if (!this._response) {
|
|
23
|
+
throw new Error("TaskExecutionContext: response not set. Task execution not started.");
|
|
24
|
+
}
|
|
25
|
+
return this._response;
|
|
26
|
+
}
|
|
27
|
+
setStore(store) {
|
|
28
|
+
this._store = store;
|
|
29
|
+
}
|
|
30
|
+
setRunner(runner) {
|
|
31
|
+
this._runner = runner;
|
|
32
|
+
}
|
|
33
|
+
setTimer(timer) {
|
|
34
|
+
this._timer = timer;
|
|
35
|
+
}
|
|
36
|
+
setResponse(response) {
|
|
37
|
+
this._response = response;
|
|
38
|
+
}
|
|
39
|
+
clear() {
|
|
40
|
+
this._store = undefined;
|
|
41
|
+
this._runner = undefined;
|
|
42
|
+
this._timer = undefined;
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
export const TaskExecutionContext = Abstraction.createImplementation({
|
|
46
|
+
implementation: TaskExecutionContextImpl,
|
|
47
|
+
dependencies: []
|
|
48
|
+
});
|
|
49
|
+
|
|
50
|
+
//# sourceMappingURL=TaskExecutionContext.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["TaskExecutionContext","Abstraction","TaskExecutionContextImpl","store","_store","Error","runner","_runner","timer","_timer","response","_response","setStore","setRunner","setTimer","setResponse","clear","undefined","createImplementation","implementation","dependencies"],"sources":["TaskExecutionContext.ts"],"sourcesContent":["import { TaskExecutionContext as Abstraction } from \"./abstractions.js\";\nimport type { ITaskManagerStore } from \"~/runner/abstractions/TaskManagerStore.js\";\nimport type { ITaskRunner } from \"~/runner/abstractions/TaskRunner.js\";\nimport type { ITimer } from \"@webiny/handler-aws\";\nimport type { ITaskResponse } from \"~/response/abstractions/index.js\";\n\nclass TaskExecutionContextImpl implements Abstraction.Interface {\n private _store?: ITaskManagerStore;\n private _runner?: ITaskRunner;\n private _timer?: ITimer;\n private _response?: ITaskResponse;\n\n get store(): ITaskManagerStore {\n if (!this._store) {\n throw new Error(\"TaskExecutionContext: store not set. Task execution not started.\");\n }\n return this._store;\n }\n\n get runner(): ITaskRunner {\n if (!this._runner) {\n throw new Error(\"TaskExecutionContext: runner not set. Task execution not started.\");\n }\n return this._runner;\n }\n\n get timer(): ITimer {\n if (!this._timer) {\n throw new Error(\"TaskExecutionContext: timer not set. Task execution not started.\");\n }\n return this._timer;\n }\n\n get response(): ITaskResponse {\n if (!this._response) {\n throw new Error(\"TaskExecutionContext: response not set. Task execution not started.\");\n }\n return this._response;\n }\n\n setStore(store: ITaskManagerStore): void {\n this._store = store;\n }\n\n setRunner(runner: ITaskRunner): void {\n this._runner = runner;\n }\n\n setTimer(timer: ITimer): void {\n this._timer = timer;\n }\n\n setResponse(response: ITaskResponse): void {\n this._response = response;\n }\n\n clear(): void {\n this._store = undefined;\n this._runner = undefined;\n this._timer = undefined;\n }\n}\n\nexport const TaskExecutionContext = Abstraction.createImplementation({\n implementation: TaskExecutionContextImpl,\n dependencies: []\n});\n"],"mappings":"AAAA,SAASA,oBAAoB,IAAIC,WAAW;AAM5C,MAAMC,wBAAwB,CAAkC;EAM5D,IAAIC,KAAKA,CAAA,EAAsB;IAC3B,IAAI,CAAC,IAAI,CAACC,MAAM,EAAE;MACd,MAAM,IAAIC,KAAK,CAAC,kEAAkE,CAAC;IACvF;IACA,OAAO,IAAI,CAACD,MAAM;EACtB;EAEA,IAAIE,MAAMA,CAAA,EAAgB;IACtB,IAAI,CAAC,IAAI,CAACC,OAAO,EAAE;MACf,MAAM,IAAIF,KAAK,CAAC,mEAAmE,CAAC;IACxF;IACA,OAAO,IAAI,CAACE,OAAO;EACvB;EAEA,IAAIC,KAAKA,CAAA,EAAW;IAChB,IAAI,CAAC,IAAI,CAACC,MAAM,EAAE;MACd,MAAM,IAAIJ,KAAK,CAAC,kEAAkE,CAAC;IACvF;IACA,OAAO,IAAI,CAACI,MAAM;EACtB;EAEA,IAAIC,QAAQA,CAAA,EAAkB;IAC1B,IAAI,CAAC,IAAI,CAACC,SAAS,EAAE;MACjB,MAAM,IAAIN,KAAK,CAAC,qEAAqE,CAAC;IAC1F;IACA,OAAO,IAAI,CAACM,SAAS;EACzB;EAEAC,QAAQA,CAACT,KAAwB,EAAQ;IACrC,IAAI,CAACC,MAAM,GAAGD,KAAK;EACvB;EAEAU,SAASA,CAACP,MAAmB,EAAQ;IACjC,IAAI,CAACC,OAAO,GAAGD,MAAM;EACzB;EAEAQ,QAAQA,CAACN,KAAa,EAAQ;IAC1B,IAAI,CAACC,MAAM,GAAGD,KAAK;EACvB;EAEAO,WAAWA,CAACL,QAAuB,EAAQ;IACvC,IAAI,CAACC,SAAS,GAAGD,QAAQ;EAC7B;EAEAM,KAAKA,CAAA,EAAS;IACV,IAAI,CAACZ,MAAM,GAAGa,SAAS;IACvB,IAAI,CAACV,OAAO,GAAGU,SAAS;IACxB,IAAI,CAACR,MAAM,GAAGQ,SAAS;EAC3B;AACJ;AAEA,OAAO,MAAMjB,oBAAoB,GAAGC,WAAW,CAACiB,oBAAoB,CAAC;EACjEC,cAAc,EAAEjB,wBAAwB;EACxCkB,YAAY,EAAE;AAClB,CAAC,CAAC","ignoreList":[]}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import type { ITimer } from "@webiny/handler-aws";
|
|
2
|
+
import type { ITaskManagerStore } from "../../runner/abstractions/TaskManagerStore.js";
|
|
3
|
+
import type { ITaskRunner } from "../../runner/abstractions/TaskRunner.js";
|
|
4
|
+
import type { ITaskResponse } from "../../response/abstractions/index.js";
|
|
5
|
+
/**
|
|
6
|
+
* TaskExecutionContext holds runtime state for the currently executing task.
|
|
7
|
+
* Properties are set by TaskRunner before task execution.
|
|
8
|
+
*
|
|
9
|
+
* This is registered as a singleton in the DI container with empty values,
|
|
10
|
+
* then populated at runtime by TaskControl before executing each task.
|
|
11
|
+
*/
|
|
12
|
+
export interface ITaskExecutionContext {
|
|
13
|
+
readonly store: ITaskManagerStore;
|
|
14
|
+
readonly runner: ITaskRunner;
|
|
15
|
+
readonly timer: ITimer;
|
|
16
|
+
readonly response: ITaskResponse;
|
|
17
|
+
setStore(store: ITaskManagerStore): void;
|
|
18
|
+
setRunner(runner: ITaskRunner): void;
|
|
19
|
+
setTimer(timer: ITimer): void;
|
|
20
|
+
setResponse(response: ITaskResponse): void;
|
|
21
|
+
clear(): void;
|
|
22
|
+
}
|
|
23
|
+
export declare const TaskExecutionContext: import("@webiny/di").Abstraction<ITaskExecutionContext>;
|
|
24
|
+
export declare namespace TaskExecutionContext {
|
|
25
|
+
type Interface = ITaskExecutionContext;
|
|
26
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { createAbstraction } from "@webiny/feature/api";
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* TaskExecutionContext holds runtime state for the currently executing task.
|
|
5
|
+
* Properties are set by TaskRunner before task execution.
|
|
6
|
+
*
|
|
7
|
+
* This is registered as a singleton in the DI container with empty values,
|
|
8
|
+
* then populated at runtime by TaskControl before executing each task.
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
export const TaskExecutionContext = createAbstraction("TaskExecutionContext");
|
|
12
|
+
|
|
13
|
+
//# sourceMappingURL=abstractions.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["createAbstraction","TaskExecutionContext"],"sources":["abstractions.ts"],"sourcesContent":["import { createAbstraction } from \"@webiny/feature/api\";\nimport type { ITimer } from \"@webiny/handler-aws\";\nimport type { ITaskManagerStore } from \"~/runner/abstractions/TaskManagerStore.js\";\nimport type { ITaskRunner } from \"~/runner/abstractions/TaskRunner.js\";\nimport type { ITaskResponse } from \"~/response/abstractions/index.js\";\n\n/**\n * TaskExecutionContext holds runtime state for the currently executing task.\n * Properties are set by TaskRunner before task execution.\n *\n * This is registered as a singleton in the DI container with empty values,\n * then populated at runtime by TaskControl before executing each task.\n */\nexport interface ITaskExecutionContext {\n // Getters - may throw if not set\n readonly store: ITaskManagerStore;\n readonly runner: ITaskRunner;\n readonly timer: ITimer;\n readonly response: ITaskResponse;\n\n // Setters - called by TaskControl\n setStore(store: ITaskManagerStore): void;\n setRunner(runner: ITaskRunner): void;\n setTimer(timer: ITimer): void;\n setResponse(response: ITaskResponse): void;\n\n // Clear after execution\n clear(): void;\n}\n\nexport const TaskExecutionContext =\n createAbstraction<ITaskExecutionContext>(\"TaskExecutionContext\");\n\nexport namespace TaskExecutionContext {\n export type Interface = ITaskExecutionContext;\n}\n"],"mappings":"AAAA,SAASA,iBAAiB,QAAQ,qBAAqB;;AAMvD;AACA;AACA;AACA;AACA;AACA;AACA;;AAkBA,OAAO,MAAMC,oBAAoB,GAC7BD,iBAAiB,CAAwB,sBAAsB,CAAC","ignoreList":[]}
|