@webiny/background-tasks 0.0.0-unstable.0d717d18dd → 0.0.0-unstable.5387e5f7c8
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/api/BackgroundTasksFeature.js +40 -24
- package/api/BackgroundTasksFeature.js.map +1 -1
- package/api/crud/TaskLogPrivateModel.js +2 -1
- package/api/crud/TaskLogPrivateModel.js.map +1 -1
- package/api/crud/TaskPrivateModel.js +2 -1
- package/api/crud/TaskPrivateModel.js.map +1 -1
- package/api/decorators/{SelfCleaningTaskDecorator.d.ts → SelfCleaningTaskHandlerDecorator.d.ts} +21 -18
- package/api/decorators/SelfCleaningTaskHandlerDecorator.js +69 -0
- package/api/decorators/SelfCleaningTaskHandlerDecorator.js.map +1 -0
- package/api/decorators/TaskDefinitionDefaultsDecorator.d.ts +27 -0
- package/api/decorators/TaskDefinitionDefaultsDecorator.js +47 -0
- package/api/decorators/TaskDefinitionDefaultsDecorator.js.map +1 -0
- package/api/domain/errors.d.ts +4 -0
- package/api/domain/errors.js +10 -2
- package/api/domain/errors.js.map +1 -1
- package/api/domain/task/TaskLogModelProvider.d.ts +12 -0
- package/api/domain/task/TaskLogModelProvider.js +23 -0
- package/api/domain/task/TaskLogModelProvider.js.map +1 -0
- package/api/domain/task/TaskLogsRepository.d.ts +34 -0
- package/api/domain/task/TaskLogsRepository.js +146 -0
- package/api/domain/task/TaskLogsRepository.js.map +1 -0
- package/api/domain/task/TaskModelProvider.d.ts +12 -0
- package/api/domain/task/TaskModelProvider.js +23 -0
- package/api/domain/task/TaskModelProvider.js.map +1 -0
- package/api/domain/task/TasksRepository.d.ts +37 -0
- package/api/domain/task/TasksRepository.js +126 -0
- package/api/domain/task/TasksRepository.js.map +1 -0
- package/api/domain/task/abstractions.d.ts +50 -0
- package/api/domain/task/abstractions.js +8 -0
- package/api/domain/task/abstractions.js.map +1 -0
- package/api/domain/task/createRevisionId.d.ts +1 -0
- package/api/domain/task/createRevisionId.js +8 -0
- package/api/domain/task/createRevisionId.js.map +1 -0
- package/api/domain/task/entryToTask.d.ts +3 -0
- package/api/domain/task/entryToTask.js +20 -0
- package/api/domain/task/entryToTask.js.map +1 -0
- package/api/domain/task/entryToTaskLog.d.ts +3 -0
- package/api/domain/task/entryToTaskLog.js +12 -0
- package/api/domain/task/entryToTaskLog.js.map +1 -0
- package/api/features/CleanupTaskSubtree/CleanupTaskSubtreeUseCase.d.ts +25 -5
- package/api/features/CleanupTaskSubtree/CleanupTaskSubtreeUseCase.js +116 -5
- package/api/features/CleanupTaskSubtree/CleanupTaskSubtreeUseCase.js.map +1 -1
- package/api/features/CleanupTaskSubtree/feature.d.ts +4 -0
- package/api/features/CleanupTaskSubtree/feature.js +11 -0
- package/api/features/CleanupTaskSubtree/feature.js.map +1 -0
- package/api/features/CleanupTaskSubtree/index.d.ts +1 -1
- package/api/features/CleanupTaskSubtree/index.js +1 -1
- package/api/features/CreateTask/CreateTaskUseCase.d.ts +17 -0
- package/api/features/CreateTask/CreateTaskUseCase.js +56 -0
- package/api/features/CreateTask/CreateTaskUseCase.js.map +1 -0
- package/api/features/CreateTask/abstractions.d.ts +21 -0
- package/api/features/CreateTask/abstractions.js +5 -0
- package/api/features/CreateTask/abstractions.js.map +1 -0
- package/api/features/{GetTaskDefinition → CreateTask}/feature.d.ts +1 -1
- package/api/features/CreateTask/feature.js +11 -0
- package/api/features/CreateTask/feature.js.map +1 -0
- package/api/features/CreateTask/index.d.ts +2 -0
- package/api/features/CreateTask/index.js +2 -0
- package/api/features/CreateTaskLog/CreateTaskLogUseCase.d.ts +13 -0
- package/api/features/CreateTaskLog/CreateTaskLogUseCase.js +19 -0
- package/api/features/CreateTaskLog/CreateTaskLogUseCase.js.map +1 -0
- package/api/features/CreateTaskLog/abstractions.d.ts +16 -0
- package/api/features/CreateTaskLog/abstractions.js +5 -0
- package/api/features/CreateTaskLog/abstractions.js.map +1 -0
- package/api/features/CreateTaskLog/feature.d.ts +4 -0
- package/api/features/CreateTaskLog/feature.js +11 -0
- package/api/features/CreateTaskLog/feature.js.map +1 -0
- package/api/features/CreateTaskLog/index.d.ts +2 -0
- package/api/features/CreateTaskLog/index.js +2 -0
- package/api/features/DeleteTask/DeleteTaskUseCase.d.ts +14 -0
- package/api/features/DeleteTask/DeleteTaskUseCase.js +34 -0
- package/api/features/DeleteTask/DeleteTaskUseCase.js.map +1 -0
- package/api/features/DeleteTask/abstractions.d.ts +17 -0
- package/api/features/DeleteTask/abstractions.js +5 -0
- package/api/features/DeleteTask/abstractions.js.map +1 -0
- package/api/features/DeleteTask/feature.d.ts +4 -0
- package/api/features/DeleteTask/feature.js +11 -0
- package/api/features/DeleteTask/feature.js.map +1 -0
- package/api/features/DeleteTask/index.d.ts +2 -0
- package/api/features/DeleteTask/index.js +2 -0
- package/api/features/DeleteTaskLog/DeleteTaskLogUseCase.d.ts +11 -0
- package/api/features/DeleteTaskLog/DeleteTaskLogUseCase.js +19 -0
- package/api/features/DeleteTaskLog/DeleteTaskLogUseCase.js.map +1 -0
- package/api/features/DeleteTaskLog/abstractions.d.ts +14 -0
- package/api/features/DeleteTaskLog/abstractions.js +5 -0
- package/api/features/DeleteTaskLog/abstractions.js.map +1 -0
- package/api/features/DeleteTaskLog/feature.d.ts +4 -0
- package/api/features/DeleteTaskLog/feature.js +11 -0
- package/api/features/DeleteTaskLog/feature.js.map +1 -0
- package/api/features/DeleteTaskLog/index.d.ts +2 -0
- package/api/features/DeleteTaskLog/index.js +2 -0
- package/api/features/GetLatestTaskLog/GetLatestTaskLogUseCase.d.ts +11 -0
- package/api/features/GetLatestTaskLog/GetLatestTaskLogUseCase.js +19 -0
- package/api/features/GetLatestTaskLog/GetLatestTaskLogUseCase.js.map +1 -0
- package/api/features/GetLatestTaskLog/abstractions.d.ts +15 -0
- package/api/features/GetLatestTaskLog/abstractions.js +5 -0
- package/api/features/GetLatestTaskLog/abstractions.js.map +1 -0
- package/api/features/GetLatestTaskLog/feature.d.ts +4 -0
- package/api/features/GetLatestTaskLog/feature.js +11 -0
- package/api/features/GetLatestTaskLog/feature.js.map +1 -0
- package/api/features/GetLatestTaskLog/index.d.ts +2 -0
- package/api/features/GetLatestTaskLog/index.js +2 -0
- package/api/features/GetRunnableTaskDefinition/GetRunnableTaskDefinitionUseCase.d.ts +13 -0
- package/api/features/GetRunnableTaskDefinition/GetRunnableTaskDefinitionUseCase.js +51 -0
- package/api/features/GetRunnableTaskDefinition/GetRunnableTaskDefinitionUseCase.js.map +1 -0
- package/api/features/{GetTaskDefinition → GetRunnableTaskDefinition}/abstractions.d.ts +6 -6
- package/api/features/GetRunnableTaskDefinition/abstractions.js +5 -0
- package/api/features/GetRunnableTaskDefinition/abstractions.js.map +1 -0
- package/api/features/GetRunnableTaskDefinition/feature.d.ts +4 -0
- package/api/features/GetRunnableTaskDefinition/feature.js +11 -0
- package/api/features/GetRunnableTaskDefinition/feature.js.map +1 -0
- package/api/features/GetRunnableTaskDefinition/index.d.ts +2 -0
- package/api/features/GetRunnableTaskDefinition/index.js +2 -0
- package/api/features/GetTask/GetTaskUseCase.d.ts +9 -5
- package/api/features/GetTask/GetTaskUseCase.js +12 -4
- package/api/features/GetTask/GetTaskUseCase.js.map +1 -1
- package/api/features/GetTask/abstractions.d.ts +9 -2
- package/api/features/GetTask/abstractions.js.map +1 -1
- package/api/features/GetTask/feature.js +2 -4
- package/api/features/GetTask/feature.js.map +1 -1
- package/api/features/ListTaskLogs/ListTaskLogsUseCase.d.ts +12 -0
- package/api/features/ListTaskLogs/ListTaskLogsUseCase.js +19 -0
- package/api/features/ListTaskLogs/ListTaskLogsUseCase.js.map +1 -0
- package/api/features/ListTaskLogs/abstractions.d.ts +15 -0
- package/api/features/ListTaskLogs/abstractions.js +5 -0
- package/api/features/ListTaskLogs/abstractions.js.map +1 -0
- package/api/features/ListTaskLogs/feature.d.ts +4 -0
- package/api/features/ListTaskLogs/feature.js +11 -0
- package/api/features/ListTaskLogs/feature.js.map +1 -0
- package/api/features/ListTaskLogs/index.d.ts +2 -0
- package/api/features/ListTaskLogs/index.js +2 -0
- package/api/features/ListTasks/ListTasksUseCase.d.ts +9 -6
- package/api/features/ListTasks/ListTasksUseCase.js +12 -4
- package/api/features/ListTasks/ListTasksUseCase.js.map +1 -1
- package/api/features/ListTasks/abstractions.d.ts +9 -3
- package/api/features/ListTasks/abstractions.js.map +1 -1
- package/api/features/ListTasks/feature.js +2 -4
- package/api/features/ListTasks/feature.js.map +1 -1
- package/api/features/TaskHandlerResolver/TaskHandlerResolver.d.ts +12 -0
- package/api/features/TaskHandlerResolver/TaskHandlerResolver.js +19 -0
- package/api/features/TaskHandlerResolver/TaskHandlerResolver.js.map +1 -0
- package/api/features/TaskHandlerResolver/abstractions.d.ts +17 -0
- package/api/features/TaskHandlerResolver/abstractions.js +5 -0
- package/api/features/TaskHandlerResolver/abstractions.js.map +1 -0
- package/api/features/TaskHandlerResolver/feature.d.ts +9 -0
- package/api/features/TaskHandlerResolver/feature.js +11 -0
- package/api/features/TaskHandlerResolver/feature.js.map +1 -0
- package/api/features/TaskHandlerResolver/index.d.ts +2 -0
- package/api/features/TaskHandlerResolver/index.js +2 -0
- package/api/features/TaskService/BackgroundTaskService.d.ts +42 -0
- package/api/features/TaskService/BackgroundTaskService.js +191 -0
- package/api/features/TaskService/BackgroundTaskService.js.map +1 -0
- package/api/features/TaskService/feature.d.ts +4 -0
- package/api/features/TaskService/feature.js +11 -0
- package/api/features/TaskService/feature.js.map +1 -0
- package/api/features/TaskService/index.d.ts +1 -0
- package/api/features/TaskService/index.js +1 -0
- package/api/features/UpdateBackgroundTaskSettings/UpdateBackgroundTaskSettingsRepository.js +3 -1
- package/api/features/UpdateBackgroundTaskSettings/UpdateBackgroundTaskSettingsRepository.js.map +1 -1
- package/api/features/UpdateTask/UpdateTaskUseCase.d.ts +17 -0
- package/api/features/UpdateTask/UpdateTaskUseCase.js +36 -0
- package/api/features/UpdateTask/UpdateTaskUseCase.js.map +1 -0
- package/api/features/UpdateTask/abstractions.d.ts +22 -0
- package/api/features/UpdateTask/abstractions.js +5 -0
- package/api/features/UpdateTask/abstractions.js.map +1 -0
- package/api/features/UpdateTask/feature.d.ts +4 -0
- package/api/features/UpdateTask/feature.js +11 -0
- package/api/features/UpdateTask/feature.js.map +1 -0
- package/api/features/UpdateTask/index.d.ts +2 -0
- package/api/features/UpdateTask/index.js +2 -0
- package/api/features/UpdateTaskLog/UpdateTaskLogUseCase.d.ts +12 -0
- package/api/features/UpdateTaskLog/UpdateTaskLogUseCase.js +19 -0
- package/api/features/UpdateTaskLog/UpdateTaskLogUseCase.js.map +1 -0
- package/api/features/UpdateTaskLog/abstractions.d.ts +16 -0
- package/api/features/UpdateTaskLog/abstractions.js +5 -0
- package/api/features/UpdateTaskLog/abstractions.js.map +1 -0
- package/api/features/UpdateTaskLog/feature.d.ts +4 -0
- package/api/features/UpdateTaskLog/feature.js +11 -0
- package/api/features/UpdateTaskLog/feature.js.map +1 -0
- package/api/features/UpdateTaskLog/index.d.ts +2 -0
- package/api/features/UpdateTaskLog/index.js +2 -0
- package/api/graphql/BackgroundTasksGraphQLSchema.d.ts +29 -0
- package/api/graphql/{BackgroundTasksContextualSchema.js → BackgroundTasksGraphQLSchema.js} +231 -137
- package/api/graphql/BackgroundTasksGraphQLSchema.js.map +1 -0
- package/api/index.d.ts +11 -2
- package/api/index.js +11 -2
- package/api/runner/TaskControl.d.ts +35 -1
- package/api/runner/TaskControl.js +50 -40
- package/api/runner/TaskControl.js.map +1 -1
- package/api/runner/TaskManager.d.ts +12 -1
- package/api/runner/TaskManager.js +8 -7
- package/api/runner/TaskManager.js.map +1 -1
- package/api/runner/TaskManagerStore.d.ts +16 -0
- package/api/runner/TaskManagerStore.js +23 -7
- package/api/runner/TaskManagerStore.js.map +1 -1
- package/api/runner/TaskRunner.js +35 -4
- package/api/runner/TaskRunner.js.map +1 -1
- package/api/tasks/testingRunTask.d.ts +10 -2
- package/api/tasks/testingRunTask.js +10 -3
- package/api/tasks/testingRunTask.js.map +1 -1
- package/api/types.d.ts +1 -48
- package/api/types.js.map +1 -1
- package/package.json +24 -28
- package/testing/index.d.ts +3 -0
- package/testing/index.js +2 -0
- package/testing/mockTaskTriggerTransportPlugin.d.ts +2 -0
- package/testing/mockTaskTriggerTransportPlugin.js +18 -0
- package/testing/mockTaskTriggerTransportPlugin.js.map +1 -0
- package/testing/runner.d.ts +19 -0
- package/testing/runner.js +44 -0
- package/testing/runner.js.map +1 -0
- package/api/TasksCrud.d.ts +0 -10
- package/api/TasksCrud.js +0 -5
- package/api/TasksCrud.js.map +0 -1
- package/api/crud/cleanupTaskSubtree.d.ts +0 -8
- package/api/crud/cleanupTaskSubtree.js +0 -63
- package/api/crud/cleanupTaskSubtree.js.map +0 -1
- package/api/crud/crud.tasks.d.ts +0 -3
- package/api/crud/crud.tasks.js +0 -318
- package/api/crud/crud.tasks.js.map +0 -1
- package/api/crud/definition.tasks.d.ts +0 -3
- package/api/crud/definition.tasks.js +0 -17
- package/api/crud/definition.tasks.js.map +0 -1
- package/api/crud/service.tasks.d.ts +0 -3
- package/api/crud/service.tasks.js +0 -132
- package/api/crud/service.tasks.js.map +0 -1
- package/api/decorators/RunnableTaskDecorator.d.ts +0 -32
- package/api/decorators/RunnableTaskDecorator.js +0 -69
- package/api/decorators/RunnableTaskDecorator.js.map +0 -1
- package/api/decorators/SelfCleaningTaskDecorator.js +0 -84
- package/api/decorators/SelfCleaningTaskDecorator.js.map +0 -1
- package/api/features/GetTaskDefinition/GetTaskDefinitionUseCase.d.ts +0 -12
- package/api/features/GetTaskDefinition/GetTaskDefinitionUseCase.js +0 -27
- package/api/features/GetTaskDefinition/GetTaskDefinitionUseCase.js.map +0 -1
- package/api/features/GetTaskDefinition/abstractions.js +0 -5
- package/api/features/GetTaskDefinition/abstractions.js.map +0 -1
- package/api/features/GetTaskDefinition/feature.js +0 -11
- package/api/features/GetTaskDefinition/feature.js.map +0 -1
- package/api/features/GetTaskDefinition/index.d.ts +0 -2
- package/api/features/GetTaskDefinition/index.js +0 -2
- package/api/graphql/BackgroundTasksContextualSchema.d.ts +0 -21
- package/api/graphql/BackgroundTasksContextualSchema.js.map +0 -1
- package/api/service/createService.d.ts +0 -6
- package/api/service/createService.js +0 -11
- package/api/service/createService.js.map +0 -1
- package/api/service/index.d.ts +0 -1
- package/api/service/index.js +0 -1
|
@@ -1,19 +1,28 @@
|
|
|
1
1
|
import { createFeature } from "@webiny/feature/api";
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import { SelfCleaningTaskDecorator } from "./decorators/SelfCleaningTaskDecorator.js";
|
|
2
|
+
import { TaskDefinitionDefaultsDecorator } from "./decorators/TaskDefinitionDefaultsDecorator.js";
|
|
3
|
+
import { SelfCleaningTaskHandlerDecorator } from "./decorators/SelfCleaningTaskHandlerDecorator.js";
|
|
5
4
|
import { TaskController } from "./features/TaskController/index.js";
|
|
6
5
|
import { TaskPrivateModel } from "./crud/TaskPrivateModel.js";
|
|
7
6
|
import { TaskLogPrivateModel } from "./crud/TaskLogPrivateModel.js";
|
|
8
7
|
import { BackgroundTaskSettingsModel } from "./models/BackgroundTaskSettingsModel.js";
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
8
|
+
import { TaskModelProvider } from "./domain/task/TaskModelProvider.js";
|
|
9
|
+
import { TaskLogModelProvider } from "./domain/task/TaskLogModelProvider.js";
|
|
10
|
+
import { TasksRepository } from "./domain/task/TasksRepository.js";
|
|
11
|
+
import { TaskLogsRepository } from "./domain/task/TaskLogsRepository.js";
|
|
12
12
|
import { TaskExecutionContextFeature } from "./features/TaskExecutionContext/feature.js";
|
|
13
|
-
import {
|
|
13
|
+
import { TaskHandlerResolverFeature } from "./features/TaskHandlerResolver/feature.js";
|
|
14
|
+
import { GetRunnableTaskDefinitionFeature } from "./features/GetRunnableTaskDefinition/feature.js";
|
|
14
15
|
import { ListTaskDefinitionsFeature } from "./features/ListTaskDefinitions/feature.js";
|
|
15
|
-
import {
|
|
16
|
-
import {
|
|
16
|
+
import { CleanupTaskSubtreeFeature } from "./features/CleanupTaskSubtree/index.js";
|
|
17
|
+
import { CreateTaskFeature } from "./features/CreateTask/index.js";
|
|
18
|
+
import { UpdateTaskFeature } from "./features/UpdateTask/index.js";
|
|
19
|
+
import { DeleteTaskFeature } from "./features/DeleteTask/index.js";
|
|
20
|
+
import { BackgroundTaskServiceFeature } from "./features/TaskService/index.js";
|
|
21
|
+
import { CreateTaskLogFeature } from "./features/CreateTaskLog/index.js";
|
|
22
|
+
import { UpdateTaskLogFeature } from "./features/UpdateTaskLog/index.js";
|
|
23
|
+
import { DeleteTaskLogFeature } from "./features/DeleteTaskLog/index.js";
|
|
24
|
+
import { GetLatestTaskLogFeature } from "./features/GetLatestTaskLog/index.js";
|
|
25
|
+
import { ListTaskLogsFeature } from "./features/ListTaskLogs/index.js";
|
|
17
26
|
import { TriggerTaskFeature } from "./features/TriggerTask/feature.js";
|
|
18
27
|
import { AbortTaskFeature } from "./features/AbortTask/feature.js";
|
|
19
28
|
import { GetTaskFeature } from "./features/GetTask/feature.js";
|
|
@@ -22,36 +31,43 @@ import { TestingRunTaskDefinition } from "./tasks/testingRunTask.js";
|
|
|
22
31
|
import { BackgroundTaskPermissionsFeature } from "./features/BackgroundTaskPermissions/feature.js";
|
|
23
32
|
import { GetBackgroundTaskSettingsFeature } from "./features/GetBackgroundTaskSettings/feature.js";
|
|
24
33
|
import { UpdateBackgroundTaskSettingsFeature } from "./features/UpdateBackgroundTaskSettings/feature.js";
|
|
25
|
-
import {
|
|
34
|
+
import { BackgroundTasksGraphQLSchema } from "./graphql/BackgroundTasksGraphQLSchema.js";
|
|
26
35
|
const BackgroundTasksFeature = createFeature({
|
|
27
36
|
name: "BackgroundTasks",
|
|
28
37
|
register (container) {
|
|
29
38
|
container.register(TaskPrivateModel);
|
|
30
39
|
container.register(TaskLogPrivateModel);
|
|
31
40
|
container.register(BackgroundTaskSettingsModel);
|
|
32
|
-
container.registerDecorator(
|
|
33
|
-
container.registerDecorator(
|
|
34
|
-
|
|
41
|
+
container.registerDecorator(TaskDefinitionDefaultsDecorator);
|
|
42
|
+
container.registerDecorator(SelfCleaningTaskHandlerDecorator);
|
|
43
|
+
TaskHandlerResolverFeature.register(container);
|
|
44
|
+
GetRunnableTaskDefinitionFeature.register(container);
|
|
35
45
|
ListTaskDefinitionsFeature.register(container);
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
};
|
|
41
|
-
container.registerInstance(TasksCrud, tasksCrud);
|
|
42
|
-
container.registerInstance(TaskService, tasksCrud);
|
|
43
|
-
TriggerTaskFeature.register(container);
|
|
44
|
-
AbortTaskFeature.register(container);
|
|
46
|
+
container.register(TaskModelProvider);
|
|
47
|
+
container.register(TaskLogModelProvider);
|
|
48
|
+
container.register(TasksRepository);
|
|
49
|
+
container.register(TaskLogsRepository);
|
|
45
50
|
GetTaskFeature.register(container);
|
|
46
51
|
ListTasksFeature.register(container);
|
|
47
|
-
|
|
52
|
+
CreateTaskFeature.register(container);
|
|
53
|
+
UpdateTaskFeature.register(container);
|
|
54
|
+
DeleteTaskFeature.register(container);
|
|
55
|
+
CleanupTaskSubtreeFeature.register(container);
|
|
56
|
+
CreateTaskLogFeature.register(container);
|
|
57
|
+
UpdateTaskLogFeature.register(container);
|
|
58
|
+
DeleteTaskLogFeature.register(container);
|
|
59
|
+
GetLatestTaskLogFeature.register(container);
|
|
60
|
+
ListTaskLogsFeature.register(container);
|
|
61
|
+
BackgroundTaskServiceFeature.register(container);
|
|
62
|
+
TriggerTaskFeature.register(container);
|
|
63
|
+
AbortTaskFeature.register(container);
|
|
48
64
|
TaskExecutionContextFeature.register(container);
|
|
49
65
|
container.register(TaskController);
|
|
50
66
|
container.register(TestingRunTaskDefinition);
|
|
51
67
|
BackgroundTaskPermissionsFeature.register(container);
|
|
52
68
|
GetBackgroundTaskSettingsFeature.register(container);
|
|
53
69
|
UpdateBackgroundTaskSettingsFeature.register(container);
|
|
54
|
-
container.register(
|
|
70
|
+
container.register(BackgroundTasksGraphQLSchema);
|
|
55
71
|
}
|
|
56
72
|
});
|
|
57
73
|
export { BackgroundTasksFeature };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"api/BackgroundTasksFeature.js","sources":["../../src/api/BackgroundTasksFeature.ts"],"sourcesContent":["import { createFeature } from \"@webiny/feature/api\";\nimport {
|
|
1
|
+
{"version":3,"file":"api/BackgroundTasksFeature.js","sources":["../../src/api/BackgroundTasksFeature.ts"],"sourcesContent":["import { createFeature } from \"@webiny/feature/api\";\nimport { TaskDefinitionDefaultsDecorator } from \"./decorators/TaskDefinitionDefaultsDecorator.js\";\nimport { SelfCleaningTaskHandlerDecorator } from \"./decorators/SelfCleaningTaskHandlerDecorator.js\";\nimport { TaskController } from \"./features/TaskController/index.js\";\nimport { TaskPrivateModel } from \"./crud/TaskPrivateModel.js\";\nimport { TaskLogPrivateModel } from \"./crud/TaskLogPrivateModel.js\";\nimport { BackgroundTaskSettingsModel } from \"./models/BackgroundTaskSettingsModel.js\";\nimport { TaskModelProvider } from \"./domain/task/TaskModelProvider.js\";\nimport { TaskLogModelProvider } from \"./domain/task/TaskLogModelProvider.js\";\nimport { TasksRepository } from \"./domain/task/TasksRepository.js\";\nimport { TaskLogsRepository } from \"./domain/task/TaskLogsRepository.js\";\nimport { TaskExecutionContextFeature } from \"./features/TaskExecutionContext/feature.js\";\nimport { TaskHandlerResolverFeature } from \"./features/TaskHandlerResolver/feature.js\";\nimport { GetRunnableTaskDefinitionFeature } from \"./features/GetRunnableTaskDefinition/feature.js\";\nimport { ListTaskDefinitionsFeature } from \"./features/ListTaskDefinitions/feature.js\";\nimport { CleanupTaskSubtreeFeature } from \"./features/CleanupTaskSubtree/index.js\";\nimport { CreateTaskFeature } from \"./features/CreateTask/index.js\";\nimport { UpdateTaskFeature } from \"./features/UpdateTask/index.js\";\nimport { DeleteTaskFeature } from \"./features/DeleteTask/index.js\";\nimport { BackgroundTaskServiceFeature } from \"./features/TaskService/index.js\";\nimport { CreateTaskLogFeature } from \"./features/CreateTaskLog/index.js\";\nimport { UpdateTaskLogFeature } from \"./features/UpdateTaskLog/index.js\";\nimport { DeleteTaskLogFeature } from \"./features/DeleteTaskLog/index.js\";\nimport { GetLatestTaskLogFeature } from \"./features/GetLatestTaskLog/index.js\";\nimport { ListTaskLogsFeature } from \"./features/ListTaskLogs/index.js\";\nimport { TriggerTaskFeature } from \"./features/TriggerTask/feature.js\";\nimport { AbortTaskFeature } from \"./features/AbortTask/feature.js\";\nimport { GetTaskFeature } from \"./features/GetTask/feature.js\";\nimport { ListTasksFeature } from \"./features/ListTasks/feature.js\";\nimport { TestingRunTaskDefinition } from \"./tasks/testingRunTask.js\";\nimport { BackgroundTaskPermissionsFeature } from \"./features/BackgroundTaskPermissions/feature.js\";\nimport { GetBackgroundTaskSettingsFeature } from \"./features/GetBackgroundTaskSettings/feature.js\";\nimport { UpdateBackgroundTaskSettingsFeature } from \"./features/UpdateBackgroundTaskSettings/feature.js\";\nimport { BackgroundTasksGraphQLSchema } from \"./graphql/BackgroundTasksGraphQLSchema.js\";\n\nexport const BackgroundTasksFeature = createFeature({\n name: \"BackgroundTasks\",\n register(container) {\n // Register models at register() time so they are available to GetModelUseCase when the\n // ModelsFetcher cache is first filled (which may happen during an earlier feature's enhance).\n container.register(TaskPrivateModel);\n container.register(TaskLogPrivateModel);\n container.register(BackgroundTaskSettingsModel);\n\n // Metadata rules, applied to every registered TaskDefinition.\n container.registerDecorator(TaskDefinitionDefaultsDecorator);\n\n // Self-cleanup runs in the lifecycle hooks, which belong to the handler. Applied when the\n // runner resolves the handler a definition names.\n container.registerDecorator(SelfCleaningTaskHandlerDecorator);\n\n // Task definition use cases.\n TaskHandlerResolverFeature.register(container);\n GetRunnableTaskDefinitionFeature.register(container);\n ListTaskDefinitionsFeature.register(container);\n\n // Task and log storage.\n container.register(TaskModelProvider);\n container.register(TaskLogModelProvider);\n container.register(TasksRepository);\n container.register(TaskLogsRepository);\n\n // Task use cases, and the public TaskService (trigger, abort, service info) on top of them.\n GetTaskFeature.register(container);\n ListTasksFeature.register(container);\n CreateTaskFeature.register(container);\n UpdateTaskFeature.register(container);\n DeleteTaskFeature.register(container);\n CleanupTaskSubtreeFeature.register(container);\n CreateTaskLogFeature.register(container);\n UpdateTaskLogFeature.register(container);\n DeleteTaskLogFeature.register(container);\n GetLatestTaskLogFeature.register(container);\n ListTaskLogsFeature.register(container);\n BackgroundTaskServiceFeature.register(container);\n TriggerTaskFeature.register(container);\n AbortTaskFeature.register(container);\n\n // Execution context (singleton), controller, and the built-in test task.\n TaskExecutionContextFeature.register(container);\n container.register(TaskController);\n container.register(TestingRunTaskDefinition);\n\n // Permissions + settings features.\n BackgroundTaskPermissionsFeature.register(container);\n GetBackgroundTaskSettingsFeature.register(container);\n UpdateBackgroundTaskSettingsFeature.register(container);\n\n // GraphQL schema, rendered from the CMS task/log content models.\n container.register(BackgroundTasksGraphQLSchema);\n }\n});\n"],"names":["BackgroundTasksFeature","createFeature","container","TaskPrivateModel","TaskLogPrivateModel","BackgroundTaskSettingsModel","TaskDefinitionDefaultsDecorator","SelfCleaningTaskHandlerDecorator","TaskHandlerResolverFeature","GetRunnableTaskDefinitionFeature","ListTaskDefinitionsFeature","TaskModelProvider","TaskLogModelProvider","TasksRepository","TaskLogsRepository","GetTaskFeature","ListTasksFeature","CreateTaskFeature","UpdateTaskFeature","DeleteTaskFeature","CleanupTaskSubtreeFeature","CreateTaskLogFeature","UpdateTaskLogFeature","DeleteTaskLogFeature","GetLatestTaskLogFeature","ListTaskLogsFeature","BackgroundTaskServiceFeature","TriggerTaskFeature","AbortTaskFeature","TaskExecutionContextFeature","TaskController","TestingRunTaskDefinition","BackgroundTaskPermissionsFeature","GetBackgroundTaskSettingsFeature","UpdateBackgroundTaskSettingsFeature","BackgroundTasksGraphQLSchema"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAmCO,MAAMA,yBAAyBC,cAAc;IAChD,MAAM;IACN,UAASC,SAAS;QAGdA,UAAU,QAAQ,CAACC;QACnBD,UAAU,QAAQ,CAACE;QACnBF,UAAU,QAAQ,CAACG;QAGnBH,UAAU,iBAAiB,CAACI;QAI5BJ,UAAU,iBAAiB,CAACK;QAG5BC,2BAA2B,QAAQ,CAACN;QACpCO,iCAAiC,QAAQ,CAACP;QAC1CQ,2BAA2B,QAAQ,CAACR;QAGpCA,UAAU,QAAQ,CAACS;QACnBT,UAAU,QAAQ,CAACU;QACnBV,UAAU,QAAQ,CAACW;QACnBX,UAAU,QAAQ,CAACY;QAGnBC,eAAe,QAAQ,CAACb;QACxBc,iBAAiB,QAAQ,CAACd;QAC1Be,kBAAkB,QAAQ,CAACf;QAC3BgB,kBAAkB,QAAQ,CAAChB;QAC3BiB,kBAAkB,QAAQ,CAACjB;QAC3BkB,0BAA0B,QAAQ,CAAClB;QACnCmB,qBAAqB,QAAQ,CAACnB;QAC9BoB,qBAAqB,QAAQ,CAACpB;QAC9BqB,qBAAqB,QAAQ,CAACrB;QAC9BsB,wBAAwB,QAAQ,CAACtB;QACjCuB,oBAAoB,QAAQ,CAACvB;QAC7BwB,6BAA6B,QAAQ,CAACxB;QACtCyB,mBAAmB,QAAQ,CAACzB;QAC5B0B,iBAAiB,QAAQ,CAAC1B;QAG1B2B,4BAA4B,QAAQ,CAAC3B;QACrCA,UAAU,QAAQ,CAAC4B;QACnB5B,UAAU,QAAQ,CAAC6B;QAGnBC,iCAAiC,QAAQ,CAAC9B;QAC1C+B,iCAAiC,QAAQ,CAAC/B;QAC1CgC,oCAAoC,QAAQ,CAAChC;QAG7CA,UAAU,QAAQ,CAACiC;IACvB;AACJ"}
|
|
@@ -6,7 +6,8 @@ class TaskLogPrivateModelImpl {
|
|
|
6
6
|
return [
|
|
7
7
|
builder.private({
|
|
8
8
|
modelId: WEBINY_TASK_LOG_MODEL_ID,
|
|
9
|
-
name: "Webiny Task Log"
|
|
9
|
+
name: "Webiny Task Log",
|
|
10
|
+
lifecycleEvents: false
|
|
10
11
|
}).fields((fields)=>({
|
|
11
12
|
executionName: fields.text().label("Execution Name"),
|
|
12
13
|
task: fields.text().label("Task").required("Task is required."),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"api/crud/TaskLogPrivateModel.js","sources":["../../../src/api/crud/TaskLogPrivateModel.ts"],"sourcesContent":["import { ModelFactory } from \"@webiny/api-headless-cms/features/modelBuilder/index.js\";\nimport { TaskLogItemType } from \"~/api/types.js\";\n\nexport const WEBINY_TASK_LOG_MODEL_ID = \"wbyTaskLog\";\n\nclass TaskLogPrivateModelImpl implements ModelFactory.Interface {\n public async execute(builder: ModelFactory.Builder) {\n return [\n builder\n .private({\n modelId: WEBINY_TASK_LOG_MODEL_ID,\n name: \"Webiny Task Log\"\n })\n .fields(fields => ({\n executionName: fields.text().label(\"Execution Name\"),\n task: fields.text().label(\"Task\").required(\"Task is required.\"),\n iteration: fields\n .number()\n .label(\"Iteration\")\n .required(\"Iteration is required.\"),\n items: fields\n .object()\n .label(\"Items\")\n .list()\n .required(\"Items is required.\")\n .fields(fields => ({\n message: fields\n .text()\n .label(\"Message\")\n .required(\"Message is required.\"),\n createdOn: fields\n .datetime()\n .label(\"Created On\")\n .required(\"Created On is required.\"),\n type: fields\n .text()\n .label(\"Type\")\n .required(\"Type is required.\")\n .predefinedValues([\n {\n value: TaskLogItemType.INFO,\n label: \"Info\"\n },\n {\n value: TaskLogItemType.ERROR,\n label: \"Error\"\n }\n ]),\n data: fields.json().label(\"Data\"),\n error: fields.json().label(\"Error\")\n }))\n }))\n ];\n }\n}\n\nexport const TaskLogPrivateModel = ModelFactory.createImplementation({\n implementation: TaskLogPrivateModelImpl,\n dependencies: []\n});\n"],"names":["WEBINY_TASK_LOG_MODEL_ID","TaskLogPrivateModelImpl","builder","fields","TaskLogItemType","TaskLogPrivateModel","ModelFactory"],"mappings":";;AAGO,MAAMA,2BAA2B;AAExC,MAAMC;IACF,MAAa,QAAQC,OAA6B,EAAE;QAChD,OAAO;YACHA,QACK,OAAO,CAAC;gBACL,SAASF;gBACT,MAAM;
|
|
1
|
+
{"version":3,"file":"api/crud/TaskLogPrivateModel.js","sources":["../../../src/api/crud/TaskLogPrivateModel.ts"],"sourcesContent":["import { ModelFactory } from \"@webiny/api-headless-cms/features/modelBuilder/index.js\";\nimport { TaskLogItemType } from \"~/api/types.js\";\n\nexport const WEBINY_TASK_LOG_MODEL_ID = \"wbyTaskLog\";\n\nclass TaskLogPrivateModelImpl implements ModelFactory.Interface {\n public async execute(builder: ModelFactory.Builder) {\n return [\n builder\n .private({\n modelId: WEBINY_TASK_LOG_MODEL_ID,\n name: \"Webiny Task Log\",\n lifecycleEvents: false\n })\n .fields(fields => ({\n executionName: fields.text().label(\"Execution Name\"),\n task: fields.text().label(\"Task\").required(\"Task is required.\"),\n iteration: fields\n .number()\n .label(\"Iteration\")\n .required(\"Iteration is required.\"),\n items: fields\n .object()\n .label(\"Items\")\n .list()\n .required(\"Items is required.\")\n .fields(fields => ({\n message: fields\n .text()\n .label(\"Message\")\n .required(\"Message is required.\"),\n createdOn: fields\n .datetime()\n .label(\"Created On\")\n .required(\"Created On is required.\"),\n type: fields\n .text()\n .label(\"Type\")\n .required(\"Type is required.\")\n .predefinedValues([\n {\n value: TaskLogItemType.INFO,\n label: \"Info\"\n },\n {\n value: TaskLogItemType.ERROR,\n label: \"Error\"\n }\n ]),\n data: fields.json().label(\"Data\"),\n error: fields.json().label(\"Error\")\n }))\n }))\n ];\n }\n}\n\nexport const TaskLogPrivateModel = ModelFactory.createImplementation({\n implementation: TaskLogPrivateModelImpl,\n dependencies: []\n});\n"],"names":["WEBINY_TASK_LOG_MODEL_ID","TaskLogPrivateModelImpl","builder","fields","TaskLogItemType","TaskLogPrivateModel","ModelFactory"],"mappings":";;AAGO,MAAMA,2BAA2B;AAExC,MAAMC;IACF,MAAa,QAAQC,OAA6B,EAAE;QAChD,OAAO;YACHA,QACK,OAAO,CAAC;gBACL,SAASF;gBACT,MAAM;gBACN,iBAAiB;YACrB,GACC,MAAM,CAACG,CAAAA,SAAW;oBACf,eAAeA,OAAO,IAAI,GAAG,KAAK,CAAC;oBACnC,MAAMA,OAAO,IAAI,GAAG,KAAK,CAAC,QAAQ,QAAQ,CAAC;oBAC3C,WAAWA,OACN,MAAM,GACN,KAAK,CAAC,aACN,QAAQ,CAAC;oBACd,OAAOA,OACF,MAAM,GACN,KAAK,CAAC,SACN,IAAI,GACJ,QAAQ,CAAC,sBACT,MAAM,CAACA,CAAAA,SAAW;4BACf,SAASA,OACJ,IAAI,GACJ,KAAK,CAAC,WACN,QAAQ,CAAC;4BACd,WAAWA,OACN,QAAQ,GACR,KAAK,CAAC,cACN,QAAQ,CAAC;4BACd,MAAMA,OACD,IAAI,GACJ,KAAK,CAAC,QACN,QAAQ,CAAC,qBACT,gBAAgB,CAAC;gCACd;oCACI,OAAOC,gBAAgB,IAAI;oCAC3B,OAAO;gCACX;gCACA;oCACI,OAAOA,gBAAgB,KAAK;oCAC5B,OAAO;gCACX;6BACH;4BACL,MAAMD,OAAO,IAAI,GAAG,KAAK,CAAC;4BAC1B,OAAOA,OAAO,IAAI,GAAG,KAAK,CAAC;wBAC/B;gBACR;SACP;IACL;AACJ;AAEO,MAAME,sBAAsBC,aAAa,oBAAoB,CAAC;IACjE,gBAAgBL;IAChB,cAAc,EAAE;AACpB"}
|
|
@@ -6,7 +6,8 @@ class TaskPrivateModelImpl {
|
|
|
6
6
|
return [
|
|
7
7
|
builder.private({
|
|
8
8
|
modelId: WEBINY_TASK_MODEL_ID,
|
|
9
|
-
name: "Webiny Task"
|
|
9
|
+
name: "Webiny Task",
|
|
10
|
+
lifecycleEvents: false
|
|
10
11
|
}).fields((fields)=>({
|
|
11
12
|
name: fields.text().label("Name").required("Name is required."),
|
|
12
13
|
definitionId: fields.text().label("Definition ID").required("Definition ID is required."),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"api/crud/TaskPrivateModel.js","sources":["../../../src/api/crud/TaskPrivateModel.ts"],"sourcesContent":["import { ModelFactory } from \"@webiny/api-headless-cms/features/modelBuilder/index.js\";\nimport { TaskDataStatus } from \"~/api/types.js\";\n\nexport const WEBINY_TASK_MODEL_ID = \"wbyTask\";\n\nclass TaskPrivateModelImpl implements ModelFactory.Interface {\n public async execute(builder: ModelFactory.Builder) {\n return [\n builder\n .private({\n modelId: WEBINY_TASK_MODEL_ID,\n name: \"Webiny Task\"\n })\n .fields(fields => ({\n name: fields.text().label(\"Name\").required(\"Name is required.\"),\n definitionId: fields\n .text()\n .label(\"Definition ID\")\n .required(\"Definition ID is required.\"),\n parentId: fields.text().label(\"Parent ID\"),\n executionName: fields.text().label(\"Execution Name\"),\n iterations: fields.number().label(\"Iterations\"),\n input: fields.json().label(\"Input\"),\n output: fields.json().label(\"Output\"),\n taskStatus: fields\n .text()\n .label(\"Status\")\n .predefinedValues([\n {\n value: TaskDataStatus.PENDING,\n label: \"Pending\"\n },\n {\n value: TaskDataStatus.RUNNING,\n label: \"Running\"\n },\n {\n value: TaskDataStatus.FAILED,\n label: \"Failed\"\n },\n {\n value: TaskDataStatus.SUCCESS,\n label: \"Success\"\n },\n {\n value: TaskDataStatus.ABORTED,\n label: \"Aborted\"\n }\n ])\n .settings({ defaultValue: TaskDataStatus.PENDING }),\n startedOn: fields.datetime().label(\"Started On\"),\n finishedOn: fields.datetime().label(\"Finished On\"),\n eventResponse: fields.json().label(\"Event Response\")\n }))\n ];\n }\n}\n\nexport const TaskPrivateModel = ModelFactory.createImplementation({\n implementation: TaskPrivateModelImpl,\n dependencies: []\n});\n"],"names":["WEBINY_TASK_MODEL_ID","TaskPrivateModelImpl","builder","fields","TaskDataStatus","TaskPrivateModel","ModelFactory"],"mappings":";;AAGO,MAAMA,uBAAuB;AAEpC,MAAMC;IACF,MAAa,QAAQC,OAA6B,EAAE;QAChD,OAAO;YACHA,QACK,OAAO,CAAC;gBACL,SAASF;gBACT,MAAM;
|
|
1
|
+
{"version":3,"file":"api/crud/TaskPrivateModel.js","sources":["../../../src/api/crud/TaskPrivateModel.ts"],"sourcesContent":["import { ModelFactory } from \"@webiny/api-headless-cms/features/modelBuilder/index.js\";\nimport { TaskDataStatus } from \"~/api/types.js\";\n\nexport const WEBINY_TASK_MODEL_ID = \"wbyTask\";\n\nclass TaskPrivateModelImpl implements ModelFactory.Interface {\n public async execute(builder: ModelFactory.Builder) {\n return [\n builder\n .private({\n modelId: WEBINY_TASK_MODEL_ID,\n name: \"Webiny Task\",\n lifecycleEvents: false\n })\n .fields(fields => ({\n name: fields.text().label(\"Name\").required(\"Name is required.\"),\n definitionId: fields\n .text()\n .label(\"Definition ID\")\n .required(\"Definition ID is required.\"),\n parentId: fields.text().label(\"Parent ID\"),\n executionName: fields.text().label(\"Execution Name\"),\n iterations: fields.number().label(\"Iterations\"),\n input: fields.json().label(\"Input\"),\n output: fields.json().label(\"Output\"),\n taskStatus: fields\n .text()\n .label(\"Status\")\n .predefinedValues([\n {\n value: TaskDataStatus.PENDING,\n label: \"Pending\"\n },\n {\n value: TaskDataStatus.RUNNING,\n label: \"Running\"\n },\n {\n value: TaskDataStatus.FAILED,\n label: \"Failed\"\n },\n {\n value: TaskDataStatus.SUCCESS,\n label: \"Success\"\n },\n {\n value: TaskDataStatus.ABORTED,\n label: \"Aborted\"\n }\n ])\n .settings({ defaultValue: TaskDataStatus.PENDING }),\n startedOn: fields.datetime().label(\"Started On\"),\n finishedOn: fields.datetime().label(\"Finished On\"),\n eventResponse: fields.json().label(\"Event Response\")\n }))\n ];\n }\n}\n\nexport const TaskPrivateModel = ModelFactory.createImplementation({\n implementation: TaskPrivateModelImpl,\n dependencies: []\n});\n"],"names":["WEBINY_TASK_MODEL_ID","TaskPrivateModelImpl","builder","fields","TaskDataStatus","TaskPrivateModel","ModelFactory"],"mappings":";;AAGO,MAAMA,uBAAuB;AAEpC,MAAMC;IACF,MAAa,QAAQC,OAA6B,EAAE;QAChD,OAAO;YACHA,QACK,OAAO,CAAC;gBACL,SAASF;gBACT,MAAM;gBACN,iBAAiB;YACrB,GACC,MAAM,CAACG,CAAAA,SAAW;oBACf,MAAMA,OAAO,IAAI,GAAG,KAAK,CAAC,QAAQ,QAAQ,CAAC;oBAC3C,cAAcA,OACT,IAAI,GACJ,KAAK,CAAC,iBACN,QAAQ,CAAC;oBACd,UAAUA,OAAO,IAAI,GAAG,KAAK,CAAC;oBAC9B,eAAeA,OAAO,IAAI,GAAG,KAAK,CAAC;oBACnC,YAAYA,OAAO,MAAM,GAAG,KAAK,CAAC;oBAClC,OAAOA,OAAO,IAAI,GAAG,KAAK,CAAC;oBAC3B,QAAQA,OAAO,IAAI,GAAG,KAAK,CAAC;oBAC5B,YAAYA,OACP,IAAI,GACJ,KAAK,CAAC,UACN,gBAAgB,CAAC;wBACd;4BACI,OAAOC,eAAe,OAAO;4BAC7B,OAAO;wBACX;wBACA;4BACI,OAAOA,eAAe,OAAO;4BAC7B,OAAO;wBACX;wBACA;4BACI,OAAOA,eAAe,MAAM;4BAC5B,OAAO;wBACX;wBACA;4BACI,OAAOA,eAAe,OAAO;4BAC7B,OAAO;wBACX;wBACA;4BACI,OAAOA,eAAe,OAAO;4BAC7B,OAAO;wBACX;qBACH,EACA,QAAQ,CAAC;wBAAE,cAAcA,eAAe,OAAO;oBAAC;oBACrD,WAAWD,OAAO,QAAQ,GAAG,KAAK,CAAC;oBACnC,YAAYA,OAAO,QAAQ,GAAG,KAAK,CAAC;oBACpC,eAAeA,OAAO,IAAI,GAAG,KAAK,CAAC;gBACvC;SACP;IACL;AACJ;AAEO,MAAME,mBAAmBC,aAAa,oBAAoB,CAAC;IAC9D,gBAAgBL;IAChB,cAAc,EAAE;AACpB"}
|
package/api/decorators/{SelfCleaningTaskDecorator.d.ts → SelfCleaningTaskHandlerDecorator.d.ts}
RENAMED
|
@@ -1,30 +1,33 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { TaskHandler } from "@webiny/api-core/features/task/TaskDefinition/index.js";
|
|
2
|
+
import { Logger } from "@webiny/api-core/features/logger/index.js";
|
|
2
3
|
import { CleanupTaskSubtreeUseCase } from "../../api/features/CleanupTaskSubtree/index.js";
|
|
3
|
-
type
|
|
4
|
-
|
|
5
|
-
|
|
4
|
+
type HookParams = TaskHandler.LifecycleHookParams;
|
|
5
|
+
/**
|
|
6
|
+
* Deletes a finished task, and its descendants, for the events its definition asked for.
|
|
7
|
+
*
|
|
8
|
+
* Registered against `TaskHandler`, so it wraps every task's handler. Which task it is wrapping, and
|
|
9
|
+
* whether that task wants cleaning up, both come from `params.definition` rather than from anything
|
|
10
|
+
* captured at construction: one decorator instance serves whichever handler is resolved.
|
|
11
|
+
*
|
|
12
|
+
* The user's hook runs first and its failure is swallowed, so a task that throws on the way out is
|
|
13
|
+
* still cleaned up. That is what the previous single-object implementation did.
|
|
14
|
+
*/
|
|
15
|
+
export declare class SelfCleaningTaskHandlerDecoratorImpl implements TaskHandler.Interface {
|
|
6
16
|
private readonly cleanupTaskSubtree;
|
|
7
|
-
private
|
|
8
|
-
private readonly
|
|
9
|
-
constructor(cleanupTaskSubtree: CleanupTaskSubtreeUseCase.Interface, decoratee:
|
|
10
|
-
get id(): string;
|
|
11
|
-
get title(): string;
|
|
12
|
-
get description(): string | undefined;
|
|
13
|
-
get isPrivate(): boolean | undefined;
|
|
14
|
-
get maxIterations(): number | undefined;
|
|
15
|
-
get selfCleanup(): import("@webiny/api-core/features/task/TaskDefinition/abstractions").ISelfCleanup | undefined;
|
|
16
|
-
get createInputValidation(): ((params: import("@webiny/api-core/features/task/TaskDefinition/abstractions").ITaskCreateInputValidationParams) => import("@webiny/api/types").GenericRecord<PropertyKey, import("zod").ZodType<unknown, unknown, import("zod/v4/core").$ZodTypeInternals<unknown, unknown>>> | import("zod").ZodType<unknown, unknown, import("zod/v4/core").$ZodTypeInternals<unknown, unknown>>) | undefined;
|
|
17
|
+
private readonly logger;
|
|
18
|
+
private readonly decoratee;
|
|
19
|
+
constructor(cleanupTaskSubtree: CleanupTaskSubtreeUseCase.Interface, logger: Logger.Interface, decoratee: TaskHandler.Interface);
|
|
17
20
|
get run(): (params: import("@webiny/api-core/features/task/TaskDefinition/abstractions").ITaskRunParams<import("@webiny/api-core/features/task/TaskDefinition/abstractions").ITaskInput, import("@webiny/api-core/features/task/TaskDefinition/abstractions").ITaskOutput>) => Promise<import("@webiny/api-core/features/task/TaskDefinition/abstractions").ITaskResult<import("@webiny/api-core/features/task/TaskDefinition/abstractions").ITaskInput, import("@webiny/api-core/features/task/TaskDefinition/abstractions").ITaskOutput>>;
|
|
18
21
|
get onBeforeTrigger(): ((params: import("@webiny/api-core/features/task/TaskDefinition/abstractions").ITaskBeforeTriggerParams<import("@webiny/api-core/features/task/TaskDefinition/abstractions").ITaskInput>) => Promise<void>) | undefined;
|
|
19
22
|
get onMaxIterations(): ((params: import("@webiny/api-core/features/task/TaskDefinition/abstractions").ITaskLifecycleHook<import("@webiny/api-core/features/task/TaskDefinition/abstractions").ITaskInput, import("@webiny/api-core/features/task/TaskDefinition/abstractions").ITaskOutput>) => Promise<void>) | undefined;
|
|
20
|
-
get
|
|
23
|
+
get createInputValidation(): ((params: import("@webiny/api-core/features/task/TaskDefinition/abstractions").ITaskCreateInputValidationParams) => import("@webiny/api/types").GenericRecord<PropertyKey, import("zod").ZodType<unknown, unknown, import("zod/v4/core").$ZodTypeInternals<unknown, unknown>>> | import("zod").ZodType<unknown, unknown, import("zod/v4/core").$ZodTypeInternals<unknown, unknown>>) | undefined;
|
|
21
24
|
get onDone(): (params: HookParams) => Promise<void>;
|
|
22
25
|
get onError(): (params: HookParams) => Promise<void>;
|
|
23
26
|
get onAbort(): (params: HookParams) => Promise<void>;
|
|
24
|
-
private
|
|
27
|
+
private cleanUpIfAsked;
|
|
25
28
|
private safeCall;
|
|
26
29
|
}
|
|
27
|
-
export declare const
|
|
28
|
-
__abstraction: import("@webiny/di").Abstraction<import("@webiny/api-core/features/task/TaskDefinition/abstractions").
|
|
30
|
+
export declare const SelfCleaningTaskHandlerDecorator: typeof SelfCleaningTaskHandlerDecoratorImpl & {
|
|
31
|
+
__abstraction: import("@webiny/di").Abstraction<import("@webiny/api-core/features/task/TaskDefinition/abstractions").ITaskHandler<import("@webiny/api-core/features/task/TaskDefinition/abstractions").ITaskInput, import("@webiny/api-core/features/task/TaskDefinition/abstractions").ITaskOutput>>;
|
|
29
32
|
};
|
|
30
33
|
export {};
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import { TaskHandler } from "@webiny/api-core/features/task/TaskDefinition/index.js";
|
|
2
|
+
import { Logger } from "@webiny/api-core/features/logger/index.js";
|
|
3
|
+
import { normalizeSelfCleanup } from "../utils/normalizeSelfCleanup.js";
|
|
4
|
+
import { CleanupTaskSubtreeUseCase } from "../features/CleanupTaskSubtree/index.js";
|
|
5
|
+
import { getErrorProperties } from "../utils/getErrorProperties.js";
|
|
6
|
+
class SelfCleaningTaskHandlerDecoratorImpl {
|
|
7
|
+
constructor(cleanupTaskSubtree, logger, decoratee){
|
|
8
|
+
this.cleanupTaskSubtree = cleanupTaskSubtree;
|
|
9
|
+
this.logger = logger;
|
|
10
|
+
this.decoratee = decoratee;
|
|
11
|
+
}
|
|
12
|
+
get run() {
|
|
13
|
+
return this.decoratee.run.bind(this.decoratee);
|
|
14
|
+
}
|
|
15
|
+
get onBeforeTrigger() {
|
|
16
|
+
return this.decoratee.onBeforeTrigger?.bind(this.decoratee);
|
|
17
|
+
}
|
|
18
|
+
get onMaxIterations() {
|
|
19
|
+
return this.decoratee.onMaxIterations?.bind(this.decoratee);
|
|
20
|
+
}
|
|
21
|
+
get createInputValidation() {
|
|
22
|
+
return this.decoratee.createInputValidation?.bind(this.decoratee);
|
|
23
|
+
}
|
|
24
|
+
get onDone() {
|
|
25
|
+
return async (params)=>{
|
|
26
|
+
await this.safeCall(this.decoratee.onDone, params, "onDone");
|
|
27
|
+
await this.cleanUpIfAsked(params, "onSuccess");
|
|
28
|
+
};
|
|
29
|
+
}
|
|
30
|
+
get onError() {
|
|
31
|
+
return async (params)=>{
|
|
32
|
+
await this.safeCall(this.decoratee.onError, params, "onError");
|
|
33
|
+
await this.cleanUpIfAsked(params, "onError");
|
|
34
|
+
};
|
|
35
|
+
}
|
|
36
|
+
get onAbort() {
|
|
37
|
+
return async (params)=>{
|
|
38
|
+
await this.safeCall(this.decoratee.onAbort, params, "onAbort");
|
|
39
|
+
await this.cleanUpIfAsked(params, "onAbort");
|
|
40
|
+
};
|
|
41
|
+
}
|
|
42
|
+
async cleanUpIfAsked(params, event) {
|
|
43
|
+
const events = normalizeSelfCleanup(params.definition.selfCleanup);
|
|
44
|
+
if (!events.has(event)) return;
|
|
45
|
+
await this.cleanupTaskSubtree.execute(params.task.id);
|
|
46
|
+
}
|
|
47
|
+
async safeCall(hook, params, name) {
|
|
48
|
+
if (!hook) return;
|
|
49
|
+
try {
|
|
50
|
+
await hook.call(this.decoratee, params);
|
|
51
|
+
} catch (ex) {
|
|
52
|
+
this.logger.error({
|
|
53
|
+
error: getErrorProperties(ex),
|
|
54
|
+
taskId: params.task.id,
|
|
55
|
+
hook: name
|
|
56
|
+
}, "Error executing task lifecycle hook.");
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
const SelfCleaningTaskHandlerDecorator = TaskHandler.createDecorator({
|
|
61
|
+
decorator: SelfCleaningTaskHandlerDecoratorImpl,
|
|
62
|
+
dependencies: [
|
|
63
|
+
CleanupTaskSubtreeUseCase,
|
|
64
|
+
Logger
|
|
65
|
+
]
|
|
66
|
+
});
|
|
67
|
+
export { SelfCleaningTaskHandlerDecorator, SelfCleaningTaskHandlerDecoratorImpl };
|
|
68
|
+
|
|
69
|
+
//# sourceMappingURL=SelfCleaningTaskHandlerDecorator.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"api/decorators/SelfCleaningTaskHandlerDecorator.js","sources":["../../../src/api/decorators/SelfCleaningTaskHandlerDecorator.ts"],"sourcesContent":["import { TaskHandler } from \"@webiny/api-core/features/task/TaskDefinition/index.js\";\nimport { Logger } from \"@webiny/api-core/features/logger/index.js\";\nimport { normalizeSelfCleanup } from \"~/api/utils/normalizeSelfCleanup.js\";\nimport { CleanupTaskSubtreeUseCase } from \"~/api/features/CleanupTaskSubtree/index.js\";\nimport { getErrorProperties } from \"~/api/utils/getErrorProperties.js\";\n\ntype HookParams = TaskHandler.LifecycleHookParams;\n\n/**\n * Deletes a finished task, and its descendants, for the events its definition asked for.\n *\n * Registered against `TaskHandler`, so it wraps every task's handler. Which task it is wrapping, and\n * whether that task wants cleaning up, both come from `params.definition` rather than from anything\n * captured at construction: one decorator instance serves whichever handler is resolved.\n *\n * The user's hook runs first and its failure is swallowed, so a task that throws on the way out is\n * still cleaned up. That is what the previous single-object implementation did.\n */\nexport class SelfCleaningTaskHandlerDecoratorImpl implements TaskHandler.Interface {\n public constructor(\n private readonly cleanupTaskSubtree: CleanupTaskSubtreeUseCase.Interface,\n private readonly logger: Logger.Interface,\n private readonly decoratee: TaskHandler.Interface\n ) {}\n\n get run() {\n return this.decoratee.run.bind(this.decoratee);\n }\n\n get onBeforeTrigger() {\n return this.decoratee.onBeforeTrigger?.bind(this.decoratee);\n }\n\n get onMaxIterations() {\n return this.decoratee.onMaxIterations?.bind(this.decoratee);\n }\n\n get createInputValidation() {\n return this.decoratee.createInputValidation?.bind(this.decoratee);\n }\n\n get onDone() {\n return async (params: HookParams) => {\n await this.safeCall(this.decoratee.onDone, params, \"onDone\");\n await this.cleanUpIfAsked(params, \"onSuccess\");\n };\n }\n\n get onError() {\n return async (params: HookParams) => {\n await this.safeCall(this.decoratee.onError, params, \"onError\");\n await this.cleanUpIfAsked(params, \"onError\");\n };\n }\n\n get onAbort() {\n return async (params: HookParams) => {\n await this.safeCall(this.decoratee.onAbort, params, \"onAbort\");\n await this.cleanUpIfAsked(params, \"onAbort\");\n };\n }\n\n private async cleanUpIfAsked(\n params: HookParams,\n event: \"onSuccess\" | \"onError\" | \"onAbort\"\n ): Promise<void> {\n const events = normalizeSelfCleanup(params.definition.selfCleanup);\n if (!events.has(event)) {\n return;\n }\n\n await this.cleanupTaskSubtree.execute(params.task.id);\n }\n\n private async safeCall(\n hook: TaskHandler.Interface[\"onDone\"],\n params: HookParams,\n name: string\n ): Promise<void> {\n if (!hook) {\n return;\n }\n\n try {\n await hook.call(this.decoratee, params);\n } catch (ex) {\n this.logger.error(\n { error: getErrorProperties(ex), taskId: params.task.id, hook: name },\n \"Error executing task lifecycle hook.\"\n );\n }\n }\n}\n\nexport const SelfCleaningTaskHandlerDecorator = TaskHandler.createDecorator({\n decorator: SelfCleaningTaskHandlerDecoratorImpl,\n dependencies: [CleanupTaskSubtreeUseCase, Logger]\n});\n"],"names":["SelfCleaningTaskHandlerDecoratorImpl","cleanupTaskSubtree","logger","decoratee","params","event","events","normalizeSelfCleanup","hook","name","ex","getErrorProperties","SelfCleaningTaskHandlerDecorator","TaskHandler","CleanupTaskSubtreeUseCase","Logger"],"mappings":";;;;;AAkBO,MAAMA;IACT,YACqBC,kBAAuD,EACvDC,MAAwB,EACxBC,SAAgC,CACnD;aAHmBF,kBAAkB,GAAlBA;aACAC,MAAM,GAANA;aACAC,SAAS,GAATA;IAClB;IAEH,IAAI,MAAM;QACN,OAAO,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,IAAI,CAAC,IAAI,CAAC,SAAS;IACjD;IAEA,IAAI,kBAAkB;QAClB,OAAO,IAAI,CAAC,SAAS,CAAC,eAAe,EAAE,KAAK,IAAI,CAAC,SAAS;IAC9D;IAEA,IAAI,kBAAkB;QAClB,OAAO,IAAI,CAAC,SAAS,CAAC,eAAe,EAAE,KAAK,IAAI,CAAC,SAAS;IAC9D;IAEA,IAAI,wBAAwB;QACxB,OAAO,IAAI,CAAC,SAAS,CAAC,qBAAqB,EAAE,KAAK,IAAI,CAAC,SAAS;IACpE;IAEA,IAAI,SAAS;QACT,OAAO,OAAOC;YACV,MAAM,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,SAAS,CAAC,MAAM,EAAEA,QAAQ;YACnD,MAAM,IAAI,CAAC,cAAc,CAACA,QAAQ;QACtC;IACJ;IAEA,IAAI,UAAU;QACV,OAAO,OAAOA;YACV,MAAM,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,SAAS,CAAC,OAAO,EAAEA,QAAQ;YACpD,MAAM,IAAI,CAAC,cAAc,CAACA,QAAQ;QACtC;IACJ;IAEA,IAAI,UAAU;QACV,OAAO,OAAOA;YACV,MAAM,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,SAAS,CAAC,OAAO,EAAEA,QAAQ;YACpD,MAAM,IAAI,CAAC,cAAc,CAACA,QAAQ;QACtC;IACJ;IAEA,MAAc,eACVA,MAAkB,EAClBC,KAA0C,EAC7B;QACb,MAAMC,SAASC,qBAAqBH,OAAO,UAAU,CAAC,WAAW;QACjE,IAAI,CAACE,OAAO,GAAG,CAACD,QACZ;QAGJ,MAAM,IAAI,CAAC,kBAAkB,CAAC,OAAO,CAACD,OAAO,IAAI,CAAC,EAAE;IACxD;IAEA,MAAc,SACVI,IAAqC,EACrCJ,MAAkB,EAClBK,IAAY,EACC;QACb,IAAI,CAACD,MACD;QAGJ,IAAI;YACA,MAAMA,KAAK,IAAI,CAAC,IAAI,CAAC,SAAS,EAAEJ;QACpC,EAAE,OAAOM,IAAI;YACT,IAAI,CAAC,MAAM,CAAC,KAAK,CACb;gBAAE,OAAOC,mBAAmBD;gBAAK,QAAQN,OAAO,IAAI,CAAC,EAAE;gBAAE,MAAMK;YAAK,GACpE;QAER;IACJ;AACJ;AAEO,MAAMG,mCAAmCC,YAAY,eAAe,CAAC;IACxE,WAAWb;IACX,cAAc;QAACc;QAA2BC;KAAO;AACrD"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { TaskDefinition } from "@webiny/api-core/features/task/TaskDefinition/index.js";
|
|
2
|
+
/**
|
|
3
|
+
* Fills in the defaults a definition is allowed to leave out, applies the one rule that overrides
|
|
4
|
+
* what a definition asked for (self-cleanup forces `databaseLogs` off), and rejects an id that is
|
|
5
|
+
* not camelCase.
|
|
6
|
+
*
|
|
7
|
+
* Everything here is metadata. A definition carries no behaviour, so there is nothing to forward:
|
|
8
|
+
* `GetRunnableTaskDefinitionUseCase` takes `run` and the hooks from the handler that `handler` names, after
|
|
9
|
+
* this decorator has run.
|
|
10
|
+
*/
|
|
11
|
+
export declare class TaskDefinitionDefaultsDecoratorImpl implements TaskDefinition.Interface {
|
|
12
|
+
private decoratee;
|
|
13
|
+
private readonly cleansUp;
|
|
14
|
+
constructor(decoratee: TaskDefinition.Interface);
|
|
15
|
+
get id(): string;
|
|
16
|
+
get title(): string;
|
|
17
|
+
get description(): string | undefined;
|
|
18
|
+
get handler(): import("@webiny/di").Constructor<import("@webiny/api-core/features/task/TaskDefinition/abstractions").ITaskHandler<import("@webiny/api-core/features/task/TaskDefinition/abstractions").ITaskInput, import("@webiny/api-core/features/task/TaskDefinition/abstractions").ITaskOutput>>;
|
|
19
|
+
get isPrivate(): boolean;
|
|
20
|
+
get databaseLogs(): boolean;
|
|
21
|
+
get maxIterations(): number;
|
|
22
|
+
get selfCleanup(): import("@webiny/api-core/features/task/TaskDefinition/abstractions").ISelfCleanup | undefined;
|
|
23
|
+
private validate;
|
|
24
|
+
}
|
|
25
|
+
export declare const TaskDefinitionDefaultsDecorator: typeof TaskDefinitionDefaultsDecoratorImpl & {
|
|
26
|
+
__abstraction: import("@webiny/di").Abstraction<import("@webiny/api-core/features/task/TaskDefinition/abstractions").ITaskDefinition<import("@webiny/api-core/features/task/TaskDefinition/abstractions").ITaskInput, import("@webiny/api-core/features/task/TaskDefinition/abstractions").ITaskOutput>>;
|
|
27
|
+
};
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import camelCase from "lodash/camelCase.js";
|
|
2
|
+
import error from "@webiny/error";
|
|
3
|
+
import { TaskDefinition } from "@webiny/api-core/features/task/TaskDefinition/index.js";
|
|
4
|
+
import { normalizeSelfCleanup } from "../utils/normalizeSelfCleanup.js";
|
|
5
|
+
const DEFAULT_MAX_ITERATIONS = 50;
|
|
6
|
+
class TaskDefinitionDefaultsDecoratorImpl {
|
|
7
|
+
constructor(decoratee){
|
|
8
|
+
this.decoratee = decoratee;
|
|
9
|
+
this.validate();
|
|
10
|
+
this.cleansUp = normalizeSelfCleanup(decoratee.selfCleanup).size > 0;
|
|
11
|
+
}
|
|
12
|
+
get id() {
|
|
13
|
+
return this.decoratee.id;
|
|
14
|
+
}
|
|
15
|
+
get title() {
|
|
16
|
+
return this.decoratee.title;
|
|
17
|
+
}
|
|
18
|
+
get description() {
|
|
19
|
+
return this.decoratee.description;
|
|
20
|
+
}
|
|
21
|
+
get handler() {
|
|
22
|
+
return this.decoratee.handler;
|
|
23
|
+
}
|
|
24
|
+
get isPrivate() {
|
|
25
|
+
return this.decoratee.isPrivate || false;
|
|
26
|
+
}
|
|
27
|
+
get databaseLogs() {
|
|
28
|
+
if (this.cleansUp) return false;
|
|
29
|
+
return this.decoratee.databaseLogs || false;
|
|
30
|
+
}
|
|
31
|
+
get maxIterations() {
|
|
32
|
+
return this.decoratee.maxIterations || DEFAULT_MAX_ITERATIONS;
|
|
33
|
+
}
|
|
34
|
+
get selfCleanup() {
|
|
35
|
+
return this.decoratee.selfCleanup;
|
|
36
|
+
}
|
|
37
|
+
validate() {
|
|
38
|
+
if (camelCase(this.decoratee.id) !== this.decoratee.id) throw new error(`Task ID "${this.decoratee.id}" is invalid. It must be in camelCase format, for example: "myCustomTask".`);
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
const TaskDefinitionDefaultsDecorator = TaskDefinition.createDecorator({
|
|
42
|
+
decorator: TaskDefinitionDefaultsDecoratorImpl,
|
|
43
|
+
dependencies: []
|
|
44
|
+
});
|
|
45
|
+
export { TaskDefinitionDefaultsDecorator, TaskDefinitionDefaultsDecoratorImpl };
|
|
46
|
+
|
|
47
|
+
//# sourceMappingURL=TaskDefinitionDefaultsDecorator.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"api/decorators/TaskDefinitionDefaultsDecorator.js","sources":["../../../src/api/decorators/TaskDefinitionDefaultsDecorator.ts"],"sourcesContent":["import camelCase from \"lodash/camelCase.js\";\nimport WebinyError from \"@webiny/error\";\nimport { TaskDefinition } from \"@webiny/api-core/features/task/TaskDefinition/index.js\";\nimport { normalizeSelfCleanup } from \"~/api/utils/normalizeSelfCleanup.js\";\n\nconst DEFAULT_MAX_ITERATIONS = 50;\n\n/**\n * Fills in the defaults a definition is allowed to leave out, applies the one rule that overrides\n * what a definition asked for (self-cleanup forces `databaseLogs` off), and rejects an id that is\n * not camelCase.\n *\n * Everything here is metadata. A definition carries no behaviour, so there is nothing to forward:\n * `GetRunnableTaskDefinitionUseCase` takes `run` and the hooks from the handler that `handler` names, after\n * this decorator has run.\n */\nexport class TaskDefinitionDefaultsDecoratorImpl implements TaskDefinition.Interface {\n private readonly cleansUp: boolean;\n\n constructor(private decoratee: TaskDefinition.Interface) {\n this.validate();\n this.cleansUp = normalizeSelfCleanup(decoratee.selfCleanup).size > 0;\n }\n\n get id() {\n return this.decoratee.id;\n }\n\n get title() {\n return this.decoratee.title;\n }\n\n get description() {\n return this.decoratee.description;\n }\n\n get handler() {\n return this.decoratee.handler;\n }\n\n // The three defaults.\n get isPrivate() {\n return this.decoratee.isPrivate || false;\n }\n\n get databaseLogs() {\n // A task that deletes itself on the way out has nowhere to keep logs, so asking for any\n // cleanup event overrides the task's own choice.\n if (this.cleansUp) {\n return false;\n }\n return this.decoratee.databaseLogs || false;\n }\n\n get maxIterations() {\n return this.decoratee.maxIterations || DEFAULT_MAX_ITERATIONS;\n }\n\n get selfCleanup() {\n return this.decoratee.selfCleanup;\n }\n\n private validate(): void {\n if (camelCase(this.decoratee.id) !== this.decoratee.id) {\n throw new WebinyError(\n `Task ID \"${this.decoratee.id}\" is invalid. It must be in camelCase format, for example: \"myCustomTask\".`\n );\n }\n }\n}\n\nexport const TaskDefinitionDefaultsDecorator = TaskDefinition.createDecorator({\n decorator: TaskDefinitionDefaultsDecoratorImpl,\n dependencies: []\n});\n"],"names":["DEFAULT_MAX_ITERATIONS","TaskDefinitionDefaultsDecoratorImpl","decoratee","normalizeSelfCleanup","camelCase","WebinyError","TaskDefinitionDefaultsDecorator","TaskDefinition"],"mappings":";;;;AAKA,MAAMA,yBAAyB;AAWxB,MAAMC;IAGT,YAAoBC,SAAmC,CAAE;aAArCA,SAAS,GAATA;QAChB,IAAI,CAAC,QAAQ;QACb,IAAI,CAAC,QAAQ,GAAGC,qBAAqBD,UAAU,WAAW,EAAE,IAAI,GAAG;IACvE;IAEA,IAAI,KAAK;QACL,OAAO,IAAI,CAAC,SAAS,CAAC,EAAE;IAC5B;IAEA,IAAI,QAAQ;QACR,OAAO,IAAI,CAAC,SAAS,CAAC,KAAK;IAC/B;IAEA,IAAI,cAAc;QACd,OAAO,IAAI,CAAC,SAAS,CAAC,WAAW;IACrC;IAEA,IAAI,UAAU;QACV,OAAO,IAAI,CAAC,SAAS,CAAC,OAAO;IACjC;IAGA,IAAI,YAAY;QACZ,OAAO,IAAI,CAAC,SAAS,CAAC,SAAS,IAAI;IACvC;IAEA,IAAI,eAAe;QAGf,IAAI,IAAI,CAAC,QAAQ,EACb,OAAO;QAEX,OAAO,IAAI,CAAC,SAAS,CAAC,YAAY,IAAI;IAC1C;IAEA,IAAI,gBAAgB;QAChB,OAAO,IAAI,CAAC,SAAS,CAAC,aAAa,IAAIF;IAC3C;IAEA,IAAI,cAAc;QACd,OAAO,IAAI,CAAC,SAAS,CAAC,WAAW;IACrC;IAEQ,WAAiB;QACrB,IAAII,UAAU,IAAI,CAAC,SAAS,CAAC,EAAE,MAAM,IAAI,CAAC,SAAS,CAAC,EAAE,EAClD,MAAM,IAAIC,MACN,CAAC,SAAS,EAAE,IAAI,CAAC,SAAS,CAAC,EAAE,CAAC,0EAA0E,CAAC;IAGrH;AACJ;AAEO,MAAMC,kCAAkCC,eAAe,eAAe,CAAC;IAC1E,WAAWN;IACX,cAAc,EAAE;AACpB"}
|
package/api/domain/errors.d.ts
CHANGED
|
@@ -54,4 +54,8 @@ export declare class BackgroundTaskNotAuthorizedError extends BaseError {
|
|
|
54
54
|
readonly code: "BackgroundTasks/NotAuthorized";
|
|
55
55
|
constructor();
|
|
56
56
|
}
|
|
57
|
+
export declare class TaskInputValidationError extends BaseError<Record<string, any>> {
|
|
58
|
+
readonly code: "VALIDATION_FAILED_INVALID_FIELDS";
|
|
59
|
+
constructor(error: ZodError);
|
|
60
|
+
}
|
|
57
61
|
export {};
|
package/api/domain/errors.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { BaseError } from "@webiny/feature/api";
|
|
2
|
-
import { parseZodError } from "@webiny/utils";
|
|
2
|
+
import { createZodError, parseZodError } from "@webiny/utils";
|
|
3
3
|
class TaskDefinitionNotFoundError extends BaseError {
|
|
4
4
|
constructor(id){
|
|
5
5
|
super({
|
|
@@ -96,6 +96,14 @@ class BackgroundTaskNotAuthorizedError extends BaseError {
|
|
|
96
96
|
}), this.code = "BackgroundTasks/NotAuthorized";
|
|
97
97
|
}
|
|
98
98
|
}
|
|
99
|
-
|
|
99
|
+
class TaskInputValidationError extends BaseError {
|
|
100
|
+
constructor(error){
|
|
101
|
+
super({
|
|
102
|
+
message: "Validation failed.",
|
|
103
|
+
data: createZodError(error).data ?? {}
|
|
104
|
+
}), this.code = "VALIDATION_FAILED_INVALID_FIELDS";
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
export { BackgroundTaskModelNotFoundError, BackgroundTaskNotAuthorizedError, BackgroundTaskPersistenceError, BackgroundTaskValidationError, TaskAbortError, TaskDefinitionNotFoundError, TaskInputValidationError, TaskLogNotFoundError, TaskNotFoundError, TaskServiceInfoError };
|
|
100
108
|
|
|
101
109
|
//# sourceMappingURL=errors.js.map
|
package/api/domain/errors.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"api/domain/errors.js","sources":["../../../src/api/domain/errors.ts"],"sourcesContent":["import { BaseError } from \"@webiny/feature/api\";\nimport type { ZodError } from \"zod\";\nimport { parseZodError } from \"@webiny/utils\";\nimport type { ValidationIssue } from \"@webiny/utils\";\n\nexport class TaskDefinitionNotFoundError extends BaseError<{ id: string }> {\n override readonly code = \"BackgroundTasks/TaskDefinition/NotFoundError\" as const;\n\n constructor(id: string) {\n super({\n message: \"Task definition not found.\",\n data: {\n id\n }\n });\n }\n}\n\nexport class TaskNotFoundError extends BaseError {\n override readonly code = \"BackgroundTasks/Task/NotFoundError\" as const;\n\n constructor() {\n super({\n message: \"Task not found.\"\n });\n }\n}\n\nexport class TaskAbortError extends BaseError<{ id: string; status: string }> {\n override readonly code = \"BackgroundTasks/Task/Abort\" as const;\n\n constructor(data: { id: string; status: string }) {\n super({\n message: \"Cannot abort a task that is not pending or running!\",\n data\n });\n }\n}\n\nexport class TaskLogNotFoundError extends BaseError {\n override readonly code = \"BackgroundTasks/Log/NotFoundError\" as const;\n\n constructor() {\n super({\n message: \"Task log not found.\"\n });\n }\n}\n\nexport class TaskServiceInfoError extends BaseError {\n override readonly code = \"BackgroundTasks/Service/InfoUnavailable\" as const;\n\n constructor() {\n super({\n message: \"Unable to fetch service info.\"\n });\n }\n}\n\ninterface BackgroundTaskValidationErrorData {\n issues: ValidationIssue[];\n}\n\nexport class BackgroundTaskValidationError extends BaseError<BackgroundTaskValidationErrorData> {\n override readonly code = \"BackgroundTasks/ValidationError\" as const;\n\n constructor(error: string | ZodError) {\n if (typeof error === \"string\") {\n super({ message: error, data: { issues: [] } });\n } else {\n const issues = parseZodError(error);\n super({ message: \"Validation failed.\", data: { issues } });\n }\n }\n}\n\ninterface BackgroundTaskPersistenceErrorData {\n originalMessage: string;\n originalCode?: string;\n originalData?: unknown;\n}\n\nexport class BackgroundTaskPersistenceError extends BaseError<BackgroundTaskPersistenceErrorData> {\n override readonly code = \"BackgroundTasks/PersistenceError\" as const;\n\n constructor(error: Error) {\n super({ message: error.message, data: { originalMessage: error.message } });\n }\n\n static from(error: unknown): BackgroundTaskPersistenceError {\n if (error instanceof Error) {\n const instance = new BackgroundTaskPersistenceError(error);\n const data: BackgroundTaskPersistenceErrorData = {\n originalMessage: error.message,\n originalCode: (error as any).code,\n originalData: (error as any).data\n };\n (instance as any).data = data;\n instance.stack = error.stack;\n return instance;\n }\n\n return new BackgroundTaskPersistenceError(new Error(String(error)));\n }\n}\n\nexport class BackgroundTaskModelNotFoundError extends BaseError {\n override readonly code = \"BackgroundTasks/ModelNotFound\" as const;\n\n constructor(modelId: string) {\n super({ message: `Background task model \"${modelId}\" was not found.` });\n }\n}\n\nexport class BackgroundTaskNotAuthorizedError extends BaseError {\n override readonly code = \"BackgroundTasks/NotAuthorized\" as const;\n\n constructor() {\n super({ message: \"Not authorized!\" });\n }\n}\n"],"names":["TaskDefinitionNotFoundError","BaseError","id","TaskNotFoundError","TaskAbortError","data","TaskLogNotFoundError","TaskServiceInfoError","BackgroundTaskValidationError","error","issues","parseZodError","BackgroundTaskPersistenceError","Error","instance","String","BackgroundTaskModelNotFoundError","modelId","BackgroundTaskNotAuthorizedError"],"mappings":";;AAKO,MAAMA,oCAAoCC;IAG7C,YAAYC,EAAU,CAAE;QACpB,KAAK,CAAC;YACF,SAAS;YACT,MAAM;gBACFA;YACJ;QACJ,SARc,IAAI,GAAG;IASzB;AACJ;AAEO,MAAMC,0BAA0BF;IAGnC,aAAc;QACV,KAAK,CAAC;YACF,SAAS;QACb,SALc,IAAI,GAAG;IAMzB;AACJ;AAEO,MAAMG,uBAAuBH;IAGhC,YAAYI,IAAoC,CAAE;QAC9C,KAAK,CAAC;YACF,SAAS;YACTA;QACJ,SANc,IAAI,GAAG;IAOzB;AACJ;AAEO,MAAMC,6BAA6BL;IAGtC,aAAc;QACV,KAAK,CAAC;YACF,SAAS;QACb,SALc,IAAI,GAAG;IAMzB;AACJ;AAEO,MAAMM,6BAA6BN;IAGtC,aAAc;QACV,KAAK,CAAC;YACF,SAAS;QACb,SALc,IAAI,GAAG;IAMzB;AACJ;AAMO,MAAMO,sCAAsCP;IAG/C,YAAYQ,KAAwB,CAAE;QAClC,IAAI,AAAiB,YAAjB,OAAOA,OACP,KAAK,CAAC;YAAE,SAASA;YAAO,MAAM;gBAAE,QAAQ,EAAE;YAAC;QAAE,SAJnC,IAAI,GAAG;aAKd;YACH,MAAMC,SAASC,cAAcF;YAC7B,KAAK,CAAC;gBAAE,SAAS;gBAAsB,MAAM;oBAAEC;gBAAO;YAAE,SAP9C,IAAI,GAAG;QAQrB;IACJ;AACJ;AAQO,MAAME,uCAAuCX;IAGhD,YAAYQ,KAAY,CAAE;QACtB,KAAK,CAAC;YAAE,SAASA,MAAM,OAAO;YAAE,MAAM;gBAAE,iBAAiBA,MAAM,OAAO;YAAC;QAAE,SAH3D,IAAI,GAAG;IAIzB;IAEA,OAAO,KAAKA,KAAc,EAAkC;QACxD,IAAIA,iBAAiBI,OAAO;YACxB,MAAMC,WAAW,IAAIF,+BAA+BH;YACpD,MAAMJ,OAA2C;gBAC7C,iBAAiBI,MAAM,OAAO;gBAC9B,cAAeA,MAAc,IAAI;gBACjC,cAAeA,MAAc,IAAI;YACrC;YACCK,SAAiB,IAAI,GAAGT;YACzBS,SAAS,KAAK,GAAGL,MAAM,KAAK;YAC5B,OAAOK;QACX;QAEA,OAAO,IAAIF,+BAA+B,IAAIC,MAAME,OAAON;IAC/D;AACJ;AAEO,MAAMO,yCAAyCf;IAGlD,YAAYgB,OAAe,CAAE;QACzB,KAAK,CAAC;YAAE,SAAS,CAAC,uBAAuB,EAAEA,QAAQ,gBAAgB,CAAC;QAAC,SAHvD,IAAI,GAAG;IAIzB;AACJ;AAEO,MAAMC,yCAAyCjB;IAGlD,aAAc;QACV,KAAK,CAAC;YAAE,SAAS;QAAkB,SAHrB,IAAI,GAAG;IAIzB;AACJ"}
|
|
1
|
+
{"version":3,"file":"api/domain/errors.js","sources":["../../../src/api/domain/errors.ts"],"sourcesContent":["import { BaseError } from \"@webiny/feature/api\";\nimport type { ZodError } from \"zod\";\nimport { createZodError, parseZodError } from \"@webiny/utils\";\nimport type { ValidationIssue } from \"@webiny/utils\";\n\nexport class TaskDefinitionNotFoundError extends BaseError<{ id: string }> {\n override readonly code = \"BackgroundTasks/TaskDefinition/NotFoundError\" as const;\n\n constructor(id: string) {\n super({\n message: \"Task definition not found.\",\n data: {\n id\n }\n });\n }\n}\n\nexport class TaskNotFoundError extends BaseError {\n override readonly code = \"BackgroundTasks/Task/NotFoundError\" as const;\n\n constructor() {\n super({\n message: \"Task not found.\"\n });\n }\n}\n\nexport class TaskAbortError extends BaseError<{ id: string; status: string }> {\n override readonly code = \"BackgroundTasks/Task/Abort\" as const;\n\n constructor(data: { id: string; status: string }) {\n super({\n message: \"Cannot abort a task that is not pending or running!\",\n data\n });\n }\n}\n\nexport class TaskLogNotFoundError extends BaseError {\n override readonly code = \"BackgroundTasks/Log/NotFoundError\" as const;\n\n constructor() {\n super({\n message: \"Task log not found.\"\n });\n }\n}\n\nexport class TaskServiceInfoError extends BaseError {\n override readonly code = \"BackgroundTasks/Service/InfoUnavailable\" as const;\n\n constructor() {\n super({\n message: \"Unable to fetch service info.\"\n });\n }\n}\n\ninterface BackgroundTaskValidationErrorData {\n issues: ValidationIssue[];\n}\n\nexport class BackgroundTaskValidationError extends BaseError<BackgroundTaskValidationErrorData> {\n override readonly code = \"BackgroundTasks/ValidationError\" as const;\n\n constructor(error: string | ZodError) {\n if (typeof error === \"string\") {\n super({ message: error, data: { issues: [] } });\n } else {\n const issues = parseZodError(error);\n super({ message: \"Validation failed.\", data: { issues } });\n }\n }\n}\n\ninterface BackgroundTaskPersistenceErrorData {\n originalMessage: string;\n originalCode?: string;\n originalData?: unknown;\n}\n\nexport class BackgroundTaskPersistenceError extends BaseError<BackgroundTaskPersistenceErrorData> {\n override readonly code = \"BackgroundTasks/PersistenceError\" as const;\n\n constructor(error: Error) {\n super({ message: error.message, data: { originalMessage: error.message } });\n }\n\n static from(error: unknown): BackgroundTaskPersistenceError {\n if (error instanceof Error) {\n const instance = new BackgroundTaskPersistenceError(error);\n const data: BackgroundTaskPersistenceErrorData = {\n originalMessage: error.message,\n originalCode: (error as any).code,\n originalData: (error as any).data\n };\n (instance as any).data = data;\n instance.stack = error.stack;\n return instance;\n }\n\n return new BackgroundTaskPersistenceError(new Error(String(error)));\n }\n}\n\nexport class BackgroundTaskModelNotFoundError extends BaseError {\n override readonly code = \"BackgroundTasks/ModelNotFound\" as const;\n\n constructor(modelId: string) {\n super({ message: `Background task model \"${modelId}\" was not found.` });\n }\n}\n\nexport class BackgroundTaskNotAuthorizedError extends BaseError {\n override readonly code = \"BackgroundTasks/NotAuthorized\" as const;\n\n constructor() {\n super({ message: \"Not authorized!\" });\n }\n}\n\n/*\n * Keeps the code, message and `invalidFields` data that `createZodError` produced before task input\n * validation moved into a use case, so clients that read them see no difference.\n */\nexport class TaskInputValidationError extends BaseError<Record<string, any>> {\n override readonly code = \"VALIDATION_FAILED_INVALID_FIELDS\" as const;\n\n constructor(error: ZodError) {\n super({\n message: \"Validation failed.\",\n data: createZodError(error).data ?? {}\n });\n }\n}\n"],"names":["TaskDefinitionNotFoundError","BaseError","id","TaskNotFoundError","TaskAbortError","data","TaskLogNotFoundError","TaskServiceInfoError","BackgroundTaskValidationError","error","issues","parseZodError","BackgroundTaskPersistenceError","Error","instance","String","BackgroundTaskModelNotFoundError","modelId","BackgroundTaskNotAuthorizedError","TaskInputValidationError","createZodError"],"mappings":";;AAKO,MAAMA,oCAAoCC;IAG7C,YAAYC,EAAU,CAAE;QACpB,KAAK,CAAC;YACF,SAAS;YACT,MAAM;gBACFA;YACJ;QACJ,SARc,IAAI,GAAG;IASzB;AACJ;AAEO,MAAMC,0BAA0BF;IAGnC,aAAc;QACV,KAAK,CAAC;YACF,SAAS;QACb,SALc,IAAI,GAAG;IAMzB;AACJ;AAEO,MAAMG,uBAAuBH;IAGhC,YAAYI,IAAoC,CAAE;QAC9C,KAAK,CAAC;YACF,SAAS;YACTA;QACJ,SANc,IAAI,GAAG;IAOzB;AACJ;AAEO,MAAMC,6BAA6BL;IAGtC,aAAc;QACV,KAAK,CAAC;YACF,SAAS;QACb,SALc,IAAI,GAAG;IAMzB;AACJ;AAEO,MAAMM,6BAA6BN;IAGtC,aAAc;QACV,KAAK,CAAC;YACF,SAAS;QACb,SALc,IAAI,GAAG;IAMzB;AACJ;AAMO,MAAMO,sCAAsCP;IAG/C,YAAYQ,KAAwB,CAAE;QAClC,IAAI,AAAiB,YAAjB,OAAOA,OACP,KAAK,CAAC;YAAE,SAASA;YAAO,MAAM;gBAAE,QAAQ,EAAE;YAAC;QAAE,SAJnC,IAAI,GAAG;aAKd;YACH,MAAMC,SAASC,cAAcF;YAC7B,KAAK,CAAC;gBAAE,SAAS;gBAAsB,MAAM;oBAAEC;gBAAO;YAAE,SAP9C,IAAI,GAAG;QAQrB;IACJ;AACJ;AAQO,MAAME,uCAAuCX;IAGhD,YAAYQ,KAAY,CAAE;QACtB,KAAK,CAAC;YAAE,SAASA,MAAM,OAAO;YAAE,MAAM;gBAAE,iBAAiBA,MAAM,OAAO;YAAC;QAAE,SAH3D,IAAI,GAAG;IAIzB;IAEA,OAAO,KAAKA,KAAc,EAAkC;QACxD,IAAIA,iBAAiBI,OAAO;YACxB,MAAMC,WAAW,IAAIF,+BAA+BH;YACpD,MAAMJ,OAA2C;gBAC7C,iBAAiBI,MAAM,OAAO;gBAC9B,cAAeA,MAAc,IAAI;gBACjC,cAAeA,MAAc,IAAI;YACrC;YACCK,SAAiB,IAAI,GAAGT;YACzBS,SAAS,KAAK,GAAGL,MAAM,KAAK;YAC5B,OAAOK;QACX;QAEA,OAAO,IAAIF,+BAA+B,IAAIC,MAAME,OAAON;IAC/D;AACJ;AAEO,MAAMO,yCAAyCf;IAGlD,YAAYgB,OAAe,CAAE;QACzB,KAAK,CAAC;YAAE,SAAS,CAAC,uBAAuB,EAAEA,QAAQ,gBAAgB,CAAC;QAAC,SAHvD,IAAI,GAAG;IAIzB;AACJ;AAEO,MAAMC,yCAAyCjB;IAGlD,aAAc;QACV,KAAK,CAAC;YAAE,SAAS;QAAkB,SAHrB,IAAI,GAAG;IAIzB;AACJ;AAMO,MAAMkB,iCAAiClB;IAG1C,YAAYQ,KAAe,CAAE;QACzB,KAAK,CAAC;YACF,SAAS;YACT,MAAMW,eAAeX,OAAO,IAAI,IAAI,CAAC;QACzC,SANc,IAAI,GAAG;IAOzB;AACJ"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { CmsModel } from "@webiny/api-headless-cms/types/index.js";
|
|
2
|
+
import { GetModelUseCase } from "@webiny/api-headless-cms/features/contentModel/GetModel/index.js";
|
|
3
|
+
import { TaskLogModelProvider as Abstraction } from "./abstractions.js";
|
|
4
|
+
declare class TaskLogModelProviderImpl implements Abstraction.Interface {
|
|
5
|
+
private readonly getModel;
|
|
6
|
+
constructor(getModel: GetModelUseCase.Interface);
|
|
7
|
+
get(): Promise<CmsModel>;
|
|
8
|
+
}
|
|
9
|
+
export declare const TaskLogModelProvider: typeof TaskLogModelProviderImpl & {
|
|
10
|
+
__abstraction: import("@webiny/di").Abstraction<import("./abstractions.js").ITaskLogModelProvider>;
|
|
11
|
+
};
|
|
12
|
+
export {};
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { GetModelUseCase } from "@webiny/api-headless-cms/features/contentModel/GetModel/index.js";
|
|
2
|
+
import { TaskLogModelProvider } from "./abstractions.js";
|
|
3
|
+
import { BackgroundTaskModelNotFoundError } from "../errors.js";
|
|
4
|
+
import { WEBINY_TASK_LOG_MODEL_ID } from "../../crud/TaskLogPrivateModel.js";
|
|
5
|
+
class TaskLogModelProviderImpl {
|
|
6
|
+
constructor(getModel){
|
|
7
|
+
this.getModel = getModel;
|
|
8
|
+
}
|
|
9
|
+
async get() {
|
|
10
|
+
const result = await this.getModel.execute(WEBINY_TASK_LOG_MODEL_ID);
|
|
11
|
+
if (result.isFail()) throw new BackgroundTaskModelNotFoundError(WEBINY_TASK_LOG_MODEL_ID);
|
|
12
|
+
return result.value;
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
const TaskLogModelProvider_TaskLogModelProvider = TaskLogModelProvider.createImplementation({
|
|
16
|
+
implementation: TaskLogModelProviderImpl,
|
|
17
|
+
dependencies: [
|
|
18
|
+
GetModelUseCase
|
|
19
|
+
]
|
|
20
|
+
});
|
|
21
|
+
export { TaskLogModelProvider_TaskLogModelProvider as TaskLogModelProvider };
|
|
22
|
+
|
|
23
|
+
//# sourceMappingURL=TaskLogModelProvider.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"api/domain/task/TaskLogModelProvider.js","sources":["../../../../src/api/domain/task/TaskLogModelProvider.ts"],"sourcesContent":["import type { CmsModel } from \"@webiny/api-headless-cms/types/index.js\";\nimport { GetModelUseCase } from \"@webiny/api-headless-cms/features/contentModel/GetModel/index.js\";\nimport { TaskLogModelProvider as Abstraction } from \"./abstractions.js\";\nimport { BackgroundTaskModelNotFoundError } from \"~/api/domain/errors.js\";\nimport { WEBINY_TASK_LOG_MODEL_ID } from \"~/api/crud/TaskLogPrivateModel.js\";\n\nclass TaskLogModelProviderImpl implements Abstraction.Interface {\n constructor(private readonly getModel: GetModelUseCase.Interface) {}\n\n async get(): Promise<CmsModel> {\n const result = await this.getModel.execute(WEBINY_TASK_LOG_MODEL_ID);\n if (result.isFail()) {\n throw new BackgroundTaskModelNotFoundError(WEBINY_TASK_LOG_MODEL_ID);\n }\n return result.value;\n }\n}\n\nexport const TaskLogModelProvider = Abstraction.createImplementation({\n implementation: TaskLogModelProviderImpl,\n dependencies: [GetModelUseCase]\n});\n"],"names":["TaskLogModelProviderImpl","getModel","result","WEBINY_TASK_LOG_MODEL_ID","BackgroundTaskModelNotFoundError","TaskLogModelProvider","Abstraction","GetModelUseCase"],"mappings":";;;;AAMA,MAAMA;IACF,YAA6BC,QAAmC,CAAE;aAArCA,QAAQ,GAARA;IAAsC;IAEnE,MAAM,MAAyB;QAC3B,MAAMC,SAAS,MAAM,IAAI,CAAC,QAAQ,CAAC,OAAO,CAACC;QAC3C,IAAID,OAAO,MAAM,IACb,MAAM,IAAIE,iCAAiCD;QAE/C,OAAOD,OAAO,KAAK;IACvB;AACJ;AAEO,MAAMG,4CAAuBC,qBAAAA,oBAAgC,CAAC;IACjE,gBAAgBN;IAChB,cAAc;QAACO;KAAgB;AACnC"}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { Result } from "@webiny/feature/api";
|
|
2
|
+
import { IdentityContext } from "@webiny/api-core/features/security/IdentityContext/index.js";
|
|
3
|
+
import { GetEntryByIdUseCase } from "@webiny/api-headless-cms/features/contentEntry/GetEntryById/index.js";
|
|
4
|
+
import { ListLatestEntriesUseCase } from "@webiny/api-headless-cms/features/contentEntry/ListEntries/index.js";
|
|
5
|
+
import { CreateEntryUseCase } from "@webiny/api-headless-cms/features/contentEntry/CreateEntry/index.js";
|
|
6
|
+
import { UpdateEntryUseCase } from "@webiny/api-headless-cms/features/contentEntry/UpdateEntry/index.js";
|
|
7
|
+
import { DeleteEntryUseCase } from "@webiny/api-headless-cms/features/contentEntry/DeleteEntry/index.js";
|
|
8
|
+
import { CmsWhereMapper } from "@webiny/api-headless-cms";
|
|
9
|
+
import { TaskLogModelProvider, TaskLogsRepository as Abstraction } from "./abstractions.js";
|
|
10
|
+
import { BackgroundTaskPersistenceError, TaskLogNotFoundError } from "../../../api/domain/errors.js";
|
|
11
|
+
declare class TaskLogsRepositoryImpl implements Abstraction.Interface {
|
|
12
|
+
private readonly identityContext;
|
|
13
|
+
private readonly modelProvider;
|
|
14
|
+
private readonly getEntryById;
|
|
15
|
+
private readonly listLatestEntries;
|
|
16
|
+
private readonly createEntry;
|
|
17
|
+
private readonly updateEntry;
|
|
18
|
+
private readonly deleteEntry;
|
|
19
|
+
private readonly whereMapper;
|
|
20
|
+
constructor(identityContext: IdentityContext.Interface, modelProvider: TaskLogModelProvider.Interface, getEntryById: GetEntryByIdUseCase.Interface, listLatestEntries: ListLatestEntriesUseCase.Interface, createEntry: CreateEntryUseCase.Interface, updateEntry: UpdateEntryUseCase.Interface, deleteEntry: DeleteEntryUseCase.Interface, whereMapper: CmsWhereMapper.Interface);
|
|
21
|
+
create(task: Parameters<Abstraction.Interface["create"]>[0], data: Parameters<Abstraction.Interface["create"]>[1]): Promise<Result<never, BackgroundTaskPersistenceError> | Result<import("../../types.js").ITaskLog, never>>;
|
|
22
|
+
update(id: string, data: Parameters<Abstraction.Interface["update"]>[1]): Promise<Result<never, BackgroundTaskPersistenceError | TaskLogNotFoundError> | Result<import("../../types.js").ITaskLog, never>>;
|
|
23
|
+
delete(id: string): Promise<Result<void, never> | Result<never, BackgroundTaskPersistenceError | TaskLogNotFoundError>>;
|
|
24
|
+
get(id: string): Promise<Result<never, BackgroundTaskPersistenceError | TaskLogNotFoundError> | Result<import("../../types.js").ITaskLog, never>>;
|
|
25
|
+
getLatest(taskId: string): Promise<Result<never, BackgroundTaskPersistenceError> | Result<never, TaskLogNotFoundError> | Result<import("../../types.js").ITaskLog, never>>;
|
|
26
|
+
list(params: Parameters<Abstraction.Interface["list"]>[0]): Promise<Result<never, BackgroundTaskPersistenceError> | Result<{
|
|
27
|
+
items: import("../../types.js").ITaskLog[];
|
|
28
|
+
meta: import("@webiny/api-headless-cms/types/types.js").CmsEntryMeta;
|
|
29
|
+
}, never>>;
|
|
30
|
+
}
|
|
31
|
+
export declare const TaskLogsRepository: typeof TaskLogsRepositoryImpl & {
|
|
32
|
+
__abstraction: import("@webiny/di").Abstraction<import("./abstractions.js").ITaskLogsRepository>;
|
|
33
|
+
};
|
|
34
|
+
export {};
|