@webiny/background-tasks 0.0.0-unstable.a4f3e4ea8b → 0.0.0-unstable.a85ef555b2
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/admin/BackgroundTaskRoutes.js +16 -3
- package/admin/BackgroundTaskRoutes.js.map +1 -1
- package/admin/features/listLogs/ListLogsGateway.js +1 -1
- package/admin/features/listLogs/ListLogsGateway.js.map +1 -1
- package/admin/features/permissions/feature.d.ts +1 -1
- package/admin/presentation/BackgroundTaskSettings/BackgroundTaskSettingsPresenter.js +2 -2
- package/admin/presentation/BackgroundTaskSettings/BackgroundTaskSettingsPresenter.js.map +1 -1
- package/admin/presentation/TaskDetail/TaskDetailPresenter.js +1 -1
- package/admin/presentation/TaskDetail/TaskDetailPresenter.js.map +1 -1
- package/admin/presentation/TaskExecutions/TaskExecutionsDataSource.js +1 -1
- package/admin/presentation/TaskExecutions/TaskExecutionsDataSource.js.map +1 -1
- package/api/BackgroundTasksFeature.d.ts +4 -0
- package/api/BackgroundTasksFeature.js +79 -0
- package/api/BackgroundTasksFeature.js.map +1 -0
- package/api/abstractions/Timer.d.ts +1 -0
- package/api/abstractions/Timer.js +0 -0
- package/api/abstractions/index.d.ts +1 -0
- package/api/abstractions/index.js +1 -0
- 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/TaskService.d.ts +12 -0
- package/api/domain/TaskService.js +5 -0
- package/api/domain/TaskService.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/AbortTask/AbortTaskUseCase.d.ts +2 -3
- package/api/features/AbortTask/AbortTaskUseCase.js +3 -3
- package/api/features/AbortTask/AbortTaskUseCase.js.map +1 -1
- package/api/features/AbortTask/feature.d.ts +1 -2
- package/api/features/AbortTask/feature.js +3 -2
- package/api/features/AbortTask/feature.js.map +1 -1
- package/api/features/CleanupTaskSubtree/CleanupTaskSubtreeUseCase.d.ts +25 -5
- package/api/features/CleanupTaskSubtree/CleanupTaskSubtreeUseCase.js +111 -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/GetBackgroundTaskSettings/GetBackgroundTaskSettingsRepository.js +7 -4
- package/api/features/GetBackgroundTaskSettings/GetBackgroundTaskSettingsRepository.js.map +1 -1
- 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.d.ts +1 -2
- package/api/features/GetTask/feature.js +3 -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 -5
- 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.d.ts +1 -2
- package/api/features/ListTasks/feature.js +3 -4
- package/api/features/ListTasks/feature.js.map +1 -1
- package/api/features/ListVisibleTaskDefinitions/ListVisibleTaskDefinitionsUseCase.d.ts +11 -0
- package/api/features/ListVisibleTaskDefinitions/ListVisibleTaskDefinitionsUseCase.js +19 -0
- package/api/features/ListVisibleTaskDefinitions/ListVisibleTaskDefinitionsUseCase.js.map +1 -0
- package/api/features/ListVisibleTaskDefinitions/abstractions.d.ts +9 -0
- package/api/features/ListVisibleTaskDefinitions/abstractions.js +5 -0
- package/api/features/ListVisibleTaskDefinitions/abstractions.js.map +1 -0
- package/api/features/ListVisibleTaskDefinitions/feature.d.ts +4 -0
- package/api/features/ListVisibleTaskDefinitions/feature.js +11 -0
- package/api/features/ListVisibleTaskDefinitions/feature.js.map +1 -0
- package/api/features/ListVisibleTaskDefinitions/index.d.ts +2 -0
- package/api/features/ListVisibleTaskDefinitions/index.js +2 -0
- package/api/features/TaskExecutionContext/TaskExecutionContext.d.ts +3 -3
- package/api/features/TaskExecutionContext/TaskExecutionContext.js.map +1 -1
- package/api/features/TaskExecutionContext/abstractions.d.ts +3 -3
- package/api/features/TaskExecutionContext/abstractions.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/TriggerTask/TriggerTaskUseCase.d.ts +2 -3
- package/api/features/TriggerTask/TriggerTaskUseCase.js +3 -3
- package/api/features/TriggerTask/TriggerTaskUseCase.js.map +1 -1
- package/api/features/TriggerTask/feature.d.ts +1 -2
- package/api/features/TriggerTask/feature.js +3 -2
- package/api/features/TriggerTask/feature.js.map +1 -1
- package/api/features/TriggerVisibleTask/TriggerVisibleTaskUseCase.d.ts +15 -0
- package/api/features/TriggerVisibleTask/TriggerVisibleTaskUseCase.js +26 -0
- package/api/features/TriggerVisibleTask/TriggerVisibleTaskUseCase.js.map +1 -0
- package/api/features/TriggerVisibleTask/abstractions.d.ts +17 -0
- package/api/features/TriggerVisibleTask/abstractions.js +5 -0
- package/api/features/TriggerVisibleTask/abstractions.js.map +1 -0
- package/api/features/TriggerVisibleTask/feature.d.ts +4 -0
- package/api/features/TriggerVisibleTask/feature.js +11 -0
- package/api/features/TriggerVisibleTask/feature.js.map +1 -0
- package/api/features/TriggerVisibleTask/index.d.ts +2 -0
- package/api/features/TriggerVisibleTask/index.js +2 -0
- package/api/features/UpdateBackgroundTaskSettings/UpdateBackgroundTaskSettingsRepository.js +6 -3
- 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/BackgroundTasksGraphQLSchema.js +462 -0
- package/api/graphql/BackgroundTasksGraphQLSchema.js.map +1 -0
- package/api/graphql/checkPermissions.js +2 -1
- package/api/graphql/checkPermissions.js.map +1 -1
- package/api/graphql/utils.d.ts +1 -1
- package/api/graphql/utils.js +1 -1
- package/api/graphql/utils.js.map +1 -1
- package/api/handler/types.d.ts +0 -2
- package/api/index.d.ts +19 -3
- package/api/index.js +18 -3
- package/api/response/DatabaseResponse.js +1 -1
- package/api/response/DatabaseResponse.js.map +1 -1
- package/api/runner/TaskControl.d.ts +35 -1
- package/api/runner/TaskControl.js +52 -39
- package/api/runner/TaskControl.js.map +1 -1
- package/api/runner/TaskManager.d.ts +12 -1
- package/api/runner/TaskManager.js +8 -6
- package/api/runner/TaskManager.js.map +1 -1
- package/api/runner/TaskManagerStore.d.ts +19 -2
- package/api/runner/TaskManagerStore.js +23 -5
- package/api/runner/TaskManagerStore.js.map +1 -1
- package/api/runner/TaskRunner.d.ts +3 -3
- package/api/runner/TaskRunner.js +35 -4
- package/api/runner/TaskRunner.js.map +1 -1
- package/api/runner/abstractions/TaskRunner.d.ts +2 -2
- 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 +25 -23
- 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/context.d.ts +0 -2
- package/api/context.js +0 -66
- package/api/context.js.map +0 -1
- package/api/crud/cleanupTaskSubtree.d.ts +0 -8
- package/api/crud/cleanupTaskSubtree.js +0 -62
- package/api/crud/cleanupTaskSubtree.js.map +0 -1
- package/api/crud/crud.tasks.d.ts +0 -2
- 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 -2
- 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 -2
- package/api/crud/service.tasks.js +0 -130
- 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/BackgroundTaskSettingsSchema.d.ts +0 -2
- package/api/graphql/BackgroundTaskSettingsSchema.js +0 -84
- package/api/graphql/BackgroundTaskSettingsSchema.js.map +0 -1
- package/api/graphql/index.d.ts +0 -2
- package/api/graphql/index.js +0 -301
- package/api/graphql/index.js.map +0 -1
- package/api/handler/index.d.ts +0 -6
- package/api/handler/index.js +0 -55
- package/api/handler/index.js.map +0 -1
- package/api/handler/register.d.ts +0 -1
- package/api/handler/register.js +0 -15
- package/api/handler/register.js.map +0 -1
- package/api/plugins/TaskServicePlugin.d.ts +0 -19
- package/api/plugins/TaskServicePlugin.js +0 -13
- package/api/plugins/TaskServicePlugin.js.map +0 -1
- package/api/plugins/index.d.ts +0 -1
- package/api/plugins/index.js +0 -1
- package/api/service/EventBridgeEventTransportPlugin.d.ts +0 -16
- package/api/service/EventBridgeEventTransportPlugin.js +0 -52
- package/api/service/EventBridgeEventTransportPlugin.js.map +0 -1
- package/api/service/StepFunctionServicePlugin.d.ts +0 -25
- package/api/service/StepFunctionServicePlugin.js +0 -77
- package/api/service/StepFunctionServicePlugin.js.map +0 -1
- package/api/service/createService.d.ts +0 -6
- package/api/service/createService.js +0 -16
- package/api/service/createService.js.map +0 -1
- package/api/service/index.d.ts +0 -4
- package/api/service/index.js +0 -12
- package/api/service/index.js.map +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"api/domain/task/TasksRepository.js","sources":["../../../../src/api/domain/task/TasksRepository.ts"],"sourcesContent":["import { Result } from \"@webiny/feature/api\";\nimport { IdentityContext } from \"@webiny/api-core/features/security/IdentityContext/index.js\";\nimport { GetEntryByIdUseCase } from \"@webiny/api-headless-cms/features/contentEntry/GetEntryById/index.js\";\nimport { ListLatestEntriesUseCase } from \"@webiny/api-headless-cms/features/contentEntry/ListEntries/index.js\";\nimport { CreateEntryUseCase } from \"@webiny/api-headless-cms/features/contentEntry/CreateEntry/index.js\";\nimport { UpdateEntryUseCase } from \"@webiny/api-headless-cms/features/contentEntry/UpdateEntry/index.js\";\nimport { DeleteEntryUseCase } from \"@webiny/api-headless-cms/features/contentEntry/DeleteEntry/index.js\";\nimport { CmsWhereMapper } from \"@webiny/api-headless-cms\";\nimport { TaskModelProvider, TasksRepository as Abstraction } from \"./abstractions.js\";\nimport { entryToTask } from \"./entryToTask.js\";\nimport { createRevisionId } from \"./createRevisionId.js\";\nimport { BackgroundTaskPersistenceError, TaskNotFoundError } from \"~/api/domain/errors.js\";\nimport { TaskDataStatus } from \"~/api/types.js\";\nimport type { IListTaskParams, ITaskCreateData, ITaskUpdateData } from \"~/api/types.js\";\nimport type { TaskService } from \"@webiny/api-core/features/task/TaskService/index.js\";\n\ntype TaskInput = TaskService.TaskInput;\ntype TaskOutput = TaskService.GenericOutput;\n\nconst ENTRY_NOT_FOUND = \"Cms/Entry/NotFound\";\n\nconst toTaskError = (error: {\n code?: string;\n}): TaskNotFoundError | BackgroundTaskPersistenceError => {\n if (error.code === ENTRY_NOT_FOUND) {\n return new TaskNotFoundError();\n }\n return BackgroundTaskPersistenceError.from(error);\n};\n\n/*\n * Tasks are stored as entries of a private CMS model. The calls run without authorization: who may\n * see or run a task is decided by the task use cases and the GraphQL layer, not by CMS permissions.\n */\nclass TasksRepositoryImpl implements Abstraction.Interface {\n constructor(\n private readonly identityContext: IdentityContext.Interface,\n private readonly modelProvider: TaskModelProvider.Interface,\n private readonly getEntryById: GetEntryByIdUseCase.Interface,\n private readonly listLatestEntries: ListLatestEntriesUseCase.Interface,\n private readonly createEntry: CreateEntryUseCase.Interface,\n private readonly updateEntry: UpdateEntryUseCase.Interface,\n private readonly deleteEntry: DeleteEntryUseCase.Interface,\n private readonly whereMapper: CmsWhereMapper.Interface\n ) {}\n\n async get<I extends TaskInput = TaskInput, O extends TaskOutput = TaskOutput>(id: string) {\n try {\n const result = await this.identityContext.withoutAuthorization(async () => {\n const model = await this.modelProvider.get();\n return this.getEntryById.execute(model, createRevisionId(id));\n });\n if (result.isFail()) {\n return Result.fail(toTaskError(result.error));\n }\n return Result.ok(entryToTask<I, O>(result.value));\n } catch (error) {\n return Result.fail(BackgroundTaskPersistenceError.from(error));\n }\n }\n\n async list<I extends TaskInput = TaskInput, O extends TaskOutput = TaskOutput>(\n params?: IListTaskParams\n ) {\n try {\n const result = await this.identityContext.withoutAuthorization(async () => {\n const model = await this.modelProvider.get();\n return this.listLatestEntries.execute(model, {\n ...params,\n where: this.whereMapper.map({\n input: params?.where,\n fields: model.fields\n })\n });\n });\n if (result.isFail()) {\n return Result.fail(BackgroundTaskPersistenceError.from(result.error));\n }\n const { entries, meta } = result.value;\n return Result.ok({\n items: entries.map(entry => entryToTask<I, O>(entry)),\n meta\n });\n } catch (error) {\n return Result.fail(BackgroundTaskPersistenceError.from(error));\n }\n }\n\n async create<I extends TaskInput = TaskInput>(data: ITaskCreateData<I>) {\n try {\n const result = await this.identityContext.withoutAuthorization(async () => {\n const model = await this.modelProvider.get();\n return this.createEntry.execute(model, {\n values: {\n ...data,\n iterations: 0,\n taskStatus: TaskDataStatus.PENDING\n }\n });\n });\n if (result.isFail()) {\n return Result.fail(BackgroundTaskPersistenceError.from(result.error));\n }\n return Result.ok(entryToTask<I>(result.value));\n } catch (error) {\n return Result.fail(BackgroundTaskPersistenceError.from(error));\n }\n }\n\n async update<I extends TaskInput = TaskInput, O extends TaskOutput = TaskOutput>(\n id: string,\n data: Partial<ITaskUpdateData<I, O>>\n ) {\n try {\n const result = await this.identityContext.withoutAuthorization(async () => {\n const model = await this.modelProvider.get();\n return this.updateEntry.execute(model, createRevisionId(id), {\n values: { ...data }\n });\n });\n if (result.isFail()) {\n return Result.fail(toTaskError(result.error));\n }\n return Result.ok(entryToTask<I, O>(result.value));\n } catch (error) {\n return Result.fail(BackgroundTaskPersistenceError.from(error));\n }\n }\n\n async delete(id: string) {\n try {\n const result = await this.identityContext.withoutAuthorization(async () => {\n const model = await this.modelProvider.get();\n return this.deleteEntry.execute(model, createRevisionId(id));\n });\n if (result.isFail()) {\n return Result.fail(toTaskError(result.error));\n }\n return Result.ok();\n } catch (error) {\n return Result.fail(BackgroundTaskPersistenceError.from(error));\n }\n }\n}\n\nexport const TasksRepository = Abstraction.createImplementation({\n implementation: TasksRepositoryImpl,\n dependencies: [\n IdentityContext,\n TaskModelProvider,\n GetEntryByIdUseCase,\n ListLatestEntriesUseCase,\n CreateEntryUseCase,\n UpdateEntryUseCase,\n DeleteEntryUseCase,\n CmsWhereMapper\n ]\n});\n"],"names":["ENTRY_NOT_FOUND","toTaskError","error","TaskNotFoundError","BackgroundTaskPersistenceError","TasksRepositoryImpl","identityContext","modelProvider","getEntryById","listLatestEntries","createEntry","updateEntry","deleteEntry","whereMapper","id","result","model","createRevisionId","Result","entryToTask","params","entries","meta","entry","data","TaskDataStatus","TasksRepository","Abstraction","IdentityContext","TaskModelProvider","GetEntryByIdUseCase","ListLatestEntriesUseCase","CreateEntryUseCase","UpdateEntryUseCase","DeleteEntryUseCase","CmsWhereMapper"],"mappings":"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"}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import { type Result } from "@webiny/feature/api";
|
|
2
|
+
import type { CmsModel } from "@webiny/api-headless-cms/types/index.js";
|
|
3
|
+
import type { TaskService } from "@webiny/api-core/features/task/TaskService/index.js";
|
|
4
|
+
import type { IListTaskLogParams, IListTaskLogsResponse, IListTaskParams, IListTasksResponse, ITaskCreateData, ITaskLog, ITaskLogCreateInput, ITaskLogUpdateInput, ITaskUpdateData } from "../../../api/types.js";
|
|
5
|
+
import type { BackgroundTaskPersistenceError, TaskLogNotFoundError, TaskNotFoundError } from "../../../api/domain/errors.js";
|
|
6
|
+
export interface ITaskModelProvider {
|
|
7
|
+
get(): Promise<CmsModel>;
|
|
8
|
+
}
|
|
9
|
+
/** The private CMS model that stores background tasks. */
|
|
10
|
+
export declare const TaskModelProvider: import("@webiny/di").Abstraction<ITaskModelProvider>;
|
|
11
|
+
export declare namespace TaskModelProvider {
|
|
12
|
+
type Interface = ITaskModelProvider;
|
|
13
|
+
}
|
|
14
|
+
export interface ITaskLogModelProvider {
|
|
15
|
+
get(): Promise<CmsModel>;
|
|
16
|
+
}
|
|
17
|
+
/** The private CMS model that stores background task logs. */
|
|
18
|
+
export declare const TaskLogModelProvider: import("@webiny/di").Abstraction<ITaskLogModelProvider>;
|
|
19
|
+
export declare namespace TaskLogModelProvider {
|
|
20
|
+
type Interface = ITaskLogModelProvider;
|
|
21
|
+
}
|
|
22
|
+
type TaskInput = TaskService.TaskInput;
|
|
23
|
+
type TaskOutput = TaskService.GenericOutput;
|
|
24
|
+
export interface ITasksRepository {
|
|
25
|
+
get<I extends TaskInput = TaskInput, O extends TaskOutput = TaskOutput>(id: string): Promise<Result<TaskService.Task<I, O>, TaskNotFoundError | BackgroundTaskPersistenceError>>;
|
|
26
|
+
list<I extends TaskInput = TaskInput, O extends TaskOutput = TaskOutput>(params?: IListTaskParams): Promise<Result<IListTasksResponse<I, O>, BackgroundTaskPersistenceError>>;
|
|
27
|
+
create<I extends TaskInput = TaskInput>(data: ITaskCreateData<I>): Promise<Result<TaskService.Task<I>, BackgroundTaskPersistenceError>>;
|
|
28
|
+
update<I extends TaskInput = TaskInput, O extends TaskOutput = TaskOutput>(id: string, data: Partial<ITaskUpdateData<I, O>>): Promise<Result<TaskService.Task<I, O>, TaskNotFoundError | BackgroundTaskPersistenceError>>;
|
|
29
|
+
delete(id: string): Promise<Result<void, TaskNotFoundError | BackgroundTaskPersistenceError>>;
|
|
30
|
+
}
|
|
31
|
+
/** Reads and writes background tasks. Publishes no events; the task use cases do that. */
|
|
32
|
+
export declare const TasksRepository: import("@webiny/di").Abstraction<ITasksRepository>;
|
|
33
|
+
export declare namespace TasksRepository {
|
|
34
|
+
type Interface = ITasksRepository;
|
|
35
|
+
}
|
|
36
|
+
type LogError = TaskLogNotFoundError | BackgroundTaskPersistenceError;
|
|
37
|
+
export interface ITaskLogsRepository {
|
|
38
|
+
create(task: Pick<TaskService.Task, "id">, data: ITaskLogCreateInput): Promise<Result<ITaskLog, BackgroundTaskPersistenceError>>;
|
|
39
|
+
update(id: string, data: ITaskLogUpdateInput): Promise<Result<ITaskLog, LogError>>;
|
|
40
|
+
delete(id: string): Promise<Result<void, LogError>>;
|
|
41
|
+
get(id: string): Promise<Result<ITaskLog, LogError>>;
|
|
42
|
+
getLatest(taskId: string): Promise<Result<ITaskLog, LogError>>;
|
|
43
|
+
list(params: IListTaskLogParams): Promise<Result<IListTaskLogsResponse, BackgroundTaskPersistenceError>>;
|
|
44
|
+
}
|
|
45
|
+
/** Reads and writes the logs of background tasks. */
|
|
46
|
+
export declare const TaskLogsRepository: import("@webiny/di").Abstraction<ITaskLogsRepository>;
|
|
47
|
+
export declare namespace TaskLogsRepository {
|
|
48
|
+
type Interface = ITaskLogsRepository;
|
|
49
|
+
}
|
|
50
|
+
export {};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { createAbstraction } from "@webiny/feature/api";
|
|
2
|
+
const TaskModelProvider = createAbstraction("Tasks/TaskModelProvider");
|
|
3
|
+
const TaskLogModelProvider = createAbstraction("Tasks/TaskLogModelProvider");
|
|
4
|
+
const TasksRepository = createAbstraction("Tasks/TasksRepository");
|
|
5
|
+
const TaskLogsRepository = createAbstraction("Tasks/TaskLogsRepository");
|
|
6
|
+
export { TaskLogModelProvider, TaskLogsRepository, TaskModelProvider, TasksRepository };
|
|
7
|
+
|
|
8
|
+
//# sourceMappingURL=abstractions.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"api/domain/task/abstractions.js","sources":["../../../../src/api/domain/task/abstractions.ts"],"sourcesContent":["import { createAbstraction, type Result } from \"@webiny/feature/api\";\nimport type { CmsModel } from \"@webiny/api-headless-cms/types/index.js\";\nimport type { TaskService } from \"@webiny/api-core/features/task/TaskService/index.js\";\nimport type {\n IListTaskLogParams,\n IListTaskLogsResponse,\n IListTaskParams,\n IListTasksResponse,\n ITaskCreateData,\n ITaskLog,\n ITaskLogCreateInput,\n ITaskLogUpdateInput,\n ITaskUpdateData\n} from \"~/api/types.js\";\nimport type {\n BackgroundTaskPersistenceError,\n TaskLogNotFoundError,\n TaskNotFoundError\n} from \"~/api/domain/errors.js\";\n\n// ============================================================================\n// Model providers\n// ============================================================================\n\nexport interface ITaskModelProvider {\n get(): Promise<CmsModel>;\n}\n\n/** The private CMS model that stores background tasks. */\nexport const TaskModelProvider = createAbstraction<ITaskModelProvider>(\"Tasks/TaskModelProvider\");\n\nexport namespace TaskModelProvider {\n export type Interface = ITaskModelProvider;\n}\n\nexport interface ITaskLogModelProvider {\n get(): Promise<CmsModel>;\n}\n\n/** The private CMS model that stores background task logs. */\nexport const TaskLogModelProvider = createAbstraction<ITaskLogModelProvider>(\n \"Tasks/TaskLogModelProvider\"\n);\n\nexport namespace TaskLogModelProvider {\n export type Interface = ITaskLogModelProvider;\n}\n\n// ============================================================================\n// Tasks repository\n// ============================================================================\n\ntype TaskInput = TaskService.TaskInput;\ntype TaskOutput = TaskService.GenericOutput;\n\nexport interface ITasksRepository {\n get<I extends TaskInput = TaskInput, O extends TaskOutput = TaskOutput>(\n id: string\n ): Promise<Result<TaskService.Task<I, O>, TaskNotFoundError | BackgroundTaskPersistenceError>>;\n list<I extends TaskInput = TaskInput, O extends TaskOutput = TaskOutput>(\n params?: IListTaskParams\n ): Promise<Result<IListTasksResponse<I, O>, BackgroundTaskPersistenceError>>;\n create<I extends TaskInput = TaskInput>(\n data: ITaskCreateData<I>\n ): Promise<Result<TaskService.Task<I>, BackgroundTaskPersistenceError>>;\n update<I extends TaskInput = TaskInput, O extends TaskOutput = TaskOutput>(\n id: string,\n data: Partial<ITaskUpdateData<I, O>>\n ): Promise<Result<TaskService.Task<I, O>, TaskNotFoundError | BackgroundTaskPersistenceError>>;\n delete(id: string): Promise<Result<void, TaskNotFoundError | BackgroundTaskPersistenceError>>;\n}\n\n/** Reads and writes background tasks. Publishes no events; the task use cases do that. */\nexport const TasksRepository = createAbstraction<ITasksRepository>(\"Tasks/TasksRepository\");\n\nexport namespace TasksRepository {\n export type Interface = ITasksRepository;\n}\n\n// ============================================================================\n// Task logs repository\n// ============================================================================\n\ntype LogError = TaskLogNotFoundError | BackgroundTaskPersistenceError;\n\nexport interface ITaskLogsRepository {\n create(\n task: Pick<TaskService.Task, \"id\">,\n data: ITaskLogCreateInput\n ): Promise<Result<ITaskLog, BackgroundTaskPersistenceError>>;\n update(id: string, data: ITaskLogUpdateInput): Promise<Result<ITaskLog, LogError>>;\n delete(id: string): Promise<Result<void, LogError>>;\n get(id: string): Promise<Result<ITaskLog, LogError>>;\n getLatest(taskId: string): Promise<Result<ITaskLog, LogError>>;\n list(\n params: IListTaskLogParams\n ): Promise<Result<IListTaskLogsResponse, BackgroundTaskPersistenceError>>;\n}\n\n/** Reads and writes the logs of background tasks. */\nexport const TaskLogsRepository = createAbstraction<ITaskLogsRepository>(\n \"Tasks/TaskLogsRepository\"\n);\n\nexport namespace TaskLogsRepository {\n export type Interface = ITaskLogsRepository;\n}\n"],"names":["TaskModelProvider","createAbstraction","TaskLogModelProvider","TasksRepository","TaskLogsRepository"],"mappings":";AA6BO,MAAMA,oBAAoBC,kBAAsC;AAWhE,MAAMC,uBAAuBD,kBAChC;AAgCG,MAAME,kBAAkBF,kBAAoC;AA2B5D,MAAMG,qBAAqBH,kBAC9B"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const createRevisionId: (id: string) => string;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"api/domain/task/createRevisionId.js","sources":["../../../../src/api/domain/task/createRevisionId.ts"],"sourcesContent":["import { parseIdentifier } from \"@webiny/utils\";\n\n// Tasks and logs are never revised, so every entry lives in its first revision.\nexport const createRevisionId = (id: string): string => {\n const { id: entryId } = parseIdentifier(id);\n return `${entryId}#0001`;\n};\n"],"names":["createRevisionId","id","entryId","parseIdentifier"],"mappings":";AAGO,MAAMA,mBAAmB,CAACC;IAC7B,MAAM,EAAE,IAAIC,OAAO,EAAE,GAAGC,gBAAgBF;IACxC,OAAO,GAAGC,QAAQ,KAAK,CAAC;AAC5B"}
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import type { CmsEntry } from "@webiny/api-headless-cms/types/index.js";
|
|
2
|
+
import type { TaskService } from "@webiny/api-core/features/task/TaskService/index.js";
|
|
3
|
+
export declare const entryToTask: <I extends TaskService.TaskInput = TaskService.TaskInput, O extends TaskService.GenericOutput = TaskService.GenericOutput>(entry: CmsEntry) => TaskService.Task<I, O>;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
const entryToTask = (entry)=>({
|
|
2
|
+
id: entry.entryId,
|
|
3
|
+
createdOn: entry.createdOn,
|
|
4
|
+
savedOn: entry.savedOn,
|
|
5
|
+
createdBy: entry.createdBy,
|
|
6
|
+
name: entry.values.name,
|
|
7
|
+
definitionId: entry.values.definitionId,
|
|
8
|
+
input: entry.values.input,
|
|
9
|
+
output: entry.values.output,
|
|
10
|
+
taskStatus: entry.values.taskStatus,
|
|
11
|
+
executionName: entry.values.executionName || "",
|
|
12
|
+
eventResponse: entry.values.eventResponse,
|
|
13
|
+
startedOn: entry.values.startedOn,
|
|
14
|
+
finishedOn: entry.values.finishedOn,
|
|
15
|
+
iterations: entry.values.iterations,
|
|
16
|
+
parentId: entry.values.parentId
|
|
17
|
+
});
|
|
18
|
+
export { entryToTask };
|
|
19
|
+
|
|
20
|
+
//# sourceMappingURL=entryToTask.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"api/domain/task/entryToTask.js","sources":["../../../../src/api/domain/task/entryToTask.ts"],"sourcesContent":["import type { CmsEntry } from \"@webiny/api-headless-cms/types/index.js\";\nimport type { TaskService } from \"@webiny/api-core/features/task/TaskService/index.js\";\n\nexport const entryToTask = <\n I extends TaskService.TaskInput = TaskService.TaskInput,\n O extends TaskService.GenericOutput = TaskService.GenericOutput\n>(\n entry: CmsEntry\n): TaskService.Task<I, O> => {\n return {\n id: entry.entryId,\n createdOn: entry.createdOn,\n savedOn: entry.savedOn,\n createdBy: entry.createdBy,\n name: entry.values.name,\n definitionId: entry.values.definitionId,\n input: entry.values.input,\n output: entry.values.output,\n taskStatus: entry.values.taskStatus,\n executionName: entry.values.executionName || \"\",\n eventResponse: entry.values.eventResponse,\n startedOn: entry.values.startedOn,\n finishedOn: entry.values.finishedOn,\n iterations: entry.values.iterations,\n parentId: entry.values.parentId\n };\n};\n"],"names":["entryToTask","entry"],"mappings":"AAGO,MAAMA,cAAc,CAIvBC,QAEO;QACH,IAAIA,MAAM,OAAO;QACjB,WAAWA,MAAM,SAAS;QAC1B,SAASA,MAAM,OAAO;QACtB,WAAWA,MAAM,SAAS;QAC1B,MAAMA,MAAM,MAAM,CAAC,IAAI;QACvB,cAAcA,MAAM,MAAM,CAAC,YAAY;QACvC,OAAOA,MAAM,MAAM,CAAC,KAAK;QACzB,QAAQA,MAAM,MAAM,CAAC,MAAM;QAC3B,YAAYA,MAAM,MAAM,CAAC,UAAU;QACnC,eAAeA,MAAM,MAAM,CAAC,aAAa,IAAI;QAC7C,eAAeA,MAAM,MAAM,CAAC,aAAa;QACzC,WAAWA,MAAM,MAAM,CAAC,SAAS;QACjC,YAAYA,MAAM,MAAM,CAAC,UAAU;QACnC,YAAYA,MAAM,MAAM,CAAC,UAAU;QACnC,UAAUA,MAAM,MAAM,CAAC,QAAQ;IACnC"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
const entryToTaskLog = (entry)=>({
|
|
2
|
+
id: entry.entryId,
|
|
3
|
+
createdOn: entry.createdOn,
|
|
4
|
+
createdBy: entry.createdBy,
|
|
5
|
+
executionName: entry.values.executionName,
|
|
6
|
+
task: entry.values.task,
|
|
7
|
+
iteration: entry.values.iteration,
|
|
8
|
+
items: entry.values.items || []
|
|
9
|
+
});
|
|
10
|
+
export { entryToTaskLog };
|
|
11
|
+
|
|
12
|
+
//# sourceMappingURL=entryToTaskLog.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"api/domain/task/entryToTaskLog.js","sources":["../../../../src/api/domain/task/entryToTaskLog.ts"],"sourcesContent":["import type { CmsEntry } from \"@webiny/api-headless-cms/types/index.js\";\nimport type { ITaskLog } from \"~/api/types.js\";\n\nexport const entryToTaskLog = (entry: CmsEntry): ITaskLog => {\n return {\n id: entry.entryId,\n createdOn: entry.createdOn,\n createdBy: entry.createdBy,\n executionName: entry.values.executionName,\n task: entry.values.task,\n iteration: entry.values.iteration,\n items: entry.values.items || []\n };\n};\n"],"names":["entryToTaskLog","entry"],"mappings":"AAGO,MAAMA,iBAAiB,CAACC,QACpB;QACH,IAAIA,MAAM,OAAO;QACjB,WAAWA,MAAM,SAAS;QAC1B,WAAWA,MAAM,SAAS;QAC1B,eAAeA,MAAM,MAAM,CAAC,aAAa;QACzC,MAAMA,MAAM,MAAM,CAAC,IAAI;QACvB,WAAWA,MAAM,MAAM,CAAC,SAAS;QACjC,OAAOA,MAAM,MAAM,CAAC,KAAK,IAAI,EAAE;IACnC"}
|
|
@@ -2,9 +2,8 @@ import { Result } from "@webiny/feature/api";
|
|
|
2
2
|
import { AbortTaskUseCase as UseCaseAbstraction } from "./abstractions.js";
|
|
3
3
|
import { TaskDefinition } from "@webiny/api-core/features/task/TaskDefinition/index.js";
|
|
4
4
|
import { TaskService } from "@webiny/api-core/features/task/TaskService/index.js";
|
|
5
|
-
import type { Context } from "../../../api/types.js";
|
|
6
5
|
export declare class AbortTaskUseCaseImpl implements UseCaseAbstraction.Interface {
|
|
7
|
-
private
|
|
8
|
-
constructor(
|
|
6
|
+
private taskService;
|
|
7
|
+
constructor(taskService: TaskService.Interface);
|
|
9
8
|
execute<I extends TaskDefinition.TaskInput = TaskDefinition.TaskInput, O extends TaskService.GenericOutput = TaskService.GenericOutput>(params: UseCaseAbstraction.Params): Promise<Result<TaskService.Task<I, O>, UseCaseAbstraction.Error>>;
|
|
10
9
|
}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
class AbortTaskUseCaseImpl {
|
|
2
|
-
constructor(
|
|
3
|
-
this.
|
|
2
|
+
constructor(taskService){
|
|
3
|
+
this.taskService = taskService;
|
|
4
4
|
}
|
|
5
5
|
async execute(params) {
|
|
6
|
-
const result = await this.
|
|
6
|
+
const result = await this.taskService.abort(params);
|
|
7
7
|
return result;
|
|
8
8
|
}
|
|
9
9
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"api/features/AbortTask/AbortTaskUseCase.js","sources":["../../../../src/api/features/AbortTask/AbortTaskUseCase.ts"],"sourcesContent":["import { Result } from \"@webiny/feature/api\";\nimport { AbortTaskUseCase 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\";\
|
|
1
|
+
{"version":3,"file":"api/features/AbortTask/AbortTaskUseCase.js","sources":["../../../../src/api/features/AbortTask/AbortTaskUseCase.ts"],"sourcesContent":["import { Result } from \"@webiny/feature/api\";\nimport { AbortTaskUseCase 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\";\nexport class AbortTaskUseCaseImpl implements UseCaseAbstraction.Interface {\n public constructor(private taskService: TaskService.Interface) {}\n\n async execute<\n I extends TaskDefinition.TaskInput = TaskDefinition.TaskInput,\n O extends TaskService.GenericOutput = TaskService.GenericOutput\n >(\n params: UseCaseAbstraction.Params\n ): Promise<Result<TaskService.Task<I, O>, UseCaseAbstraction.Error>> {\n const result = await this.taskService.abort<I, O>(params);\n return result as unknown as Promise<\n Result<TaskService.Task<I, O>, UseCaseAbstraction.Error>\n >;\n }\n}\n"],"names":["AbortTaskUseCaseImpl","taskService","params","result"],"mappings":"AAIO,MAAMA;IACT,YAA2BC,WAAkC,CAAE;aAApCA,WAAW,GAAXA;IAAqC;IAEhE,MAAM,QAIFC,MAAiC,EACgC;QACjE,MAAMC,SAAS,MAAM,IAAI,CAAC,WAAW,CAAC,KAAK,CAAOD;QAClD,OAAOC;IAGX;AACJ"}
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import { createFeature } from "@webiny/feature/api";
|
|
2
2
|
import { AbortTaskUseCaseImpl } from "./AbortTaskUseCase.js";
|
|
3
3
|
import { AbortTaskUseCase } from "./abstractions.js";
|
|
4
|
+
import { TaskService } from "@webiny/api-core/features/task/TaskService/index.js";
|
|
4
5
|
const AbortTaskFeature = createFeature({
|
|
5
6
|
name: "AbortTask",
|
|
6
|
-
register (container
|
|
7
|
-
container.
|
|
7
|
+
register (container) {
|
|
8
|
+
container.registerFactory(AbortTaskUseCase, ()=>new AbortTaskUseCaseImpl(container.resolve(TaskService)));
|
|
8
9
|
}
|
|
9
10
|
});
|
|
10
11
|
export { AbortTaskFeature };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"api/features/AbortTask/feature.js","sources":["../../../../src/api/features/AbortTask/feature.ts"],"sourcesContent":["import { createFeature } from \"@webiny/feature/api\";\nimport { AbortTaskUseCaseImpl } from \"./AbortTaskUseCase.js\";\nimport
|
|
1
|
+
{"version":3,"file":"api/features/AbortTask/feature.js","sources":["../../../../src/api/features/AbortTask/feature.ts"],"sourcesContent":["import { createFeature } from \"@webiny/feature/api\";\nimport { AbortTaskUseCaseImpl } from \"./AbortTaskUseCase.js\";\nimport { AbortTaskUseCase } from \"./abstractions.js\";\nimport { TaskService } from \"@webiny/api-core/features/task/TaskService/index.js\";\n\nexport const AbortTaskFeature = createFeature({\n name: \"AbortTask\",\n register(container) {\n container.registerFactory(AbortTaskUseCase, () => {\n return new AbortTaskUseCaseImpl(container.resolve(TaskService));\n });\n }\n});\n"],"names":["AbortTaskFeature","createFeature","container","AbortTaskUseCase","AbortTaskUseCaseImpl","TaskService"],"mappings":";;;;AAKO,MAAMA,mBAAmBC,cAAc;IAC1C,MAAM;IACN,UAASC,SAAS;QACdA,UAAU,eAAe,CAACC,kBAAkB,IACjC,IAAIC,qBAAqBF,UAAU,OAAO,CAACG;IAE1D;AACJ"}
|
|
@@ -1,7 +1,27 @@
|
|
|
1
|
+
import { Logger } from "@webiny/api-core/features/logger/index.js";
|
|
1
2
|
import { CleanupTaskSubtreeUseCase as UseCaseAbstraction } from "./abstractions.js";
|
|
2
|
-
import
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
3
|
+
import { TaskLogsRepository, TasksRepository } from "../../../api/domain/task/abstractions.js";
|
|
4
|
+
import { DeleteTaskUseCase } from "../../../api/features/DeleteTask/index.js";
|
|
5
|
+
/**
|
|
6
|
+
* Deletes the task identified by `rootId`, all its descendants, and their logs. The logs are listed
|
|
7
|
+
* by task id whatever the owning definition says (`databaseLogs`, or no registered definition): a
|
|
8
|
+
* self-cleaning task writes none of its own, but an abort still writes one log row, and cleanup
|
|
9
|
+
* removes whatever exists. Bottom-up and best-effort: a record that fails to delete is logged and
|
|
10
|
+
* skipped, and the use case never throws.
|
|
11
|
+
*/
|
|
12
|
+
declare class CleanupTaskSubtreeUseCaseImpl implements UseCaseAbstraction.Interface {
|
|
13
|
+
private readonly tasks;
|
|
14
|
+
private readonly logs;
|
|
15
|
+
private readonly deleteTask;
|
|
16
|
+
private readonly logger;
|
|
17
|
+
constructor(tasks: TasksRepository.Interface, logs: TaskLogsRepository.Interface, deleteTask: DeleteTaskUseCase.Interface, logger: Logger.Interface);
|
|
18
|
+
execute(rootId: string): Promise<void>;
|
|
19
|
+
private collectSubtree;
|
|
20
|
+
private listChildren;
|
|
21
|
+
private listLogs;
|
|
22
|
+
private deleteTaskLogs;
|
|
7
23
|
}
|
|
24
|
+
export declare const CleanupTaskSubtreeUseCase: typeof CleanupTaskSubtreeUseCaseImpl & {
|
|
25
|
+
__abstraction: import("@webiny/di").Abstraction<import("./abstractions.js").ICleanupTaskSubtreeUseCase>;
|
|
26
|
+
};
|
|
27
|
+
export {};
|
|
@@ -1,11 +1,117 @@
|
|
|
1
|
+
import { Logger } from "@webiny/api-core/features/logger/index.js";
|
|
2
|
+
import { CleanupTaskSubtreeUseCase } from "./abstractions.js";
|
|
3
|
+
import { TaskLogsRepository, TasksRepository } from "../../domain/task/abstractions.js";
|
|
4
|
+
import { DeleteTaskUseCase } from "../DeleteTask/index.js";
|
|
5
|
+
const PAGE_SIZE = 100;
|
|
1
6
|
class CleanupTaskSubtreeUseCaseImpl {
|
|
2
|
-
constructor(
|
|
3
|
-
this.
|
|
7
|
+
constructor(tasks, logs, deleteTask, logger){
|
|
8
|
+
this.tasks = tasks;
|
|
9
|
+
this.logs = logs;
|
|
10
|
+
this.deleteTask = deleteTask;
|
|
11
|
+
this.logger = logger;
|
|
4
12
|
}
|
|
5
|
-
async execute(
|
|
6
|
-
|
|
13
|
+
async execute(rootId) {
|
|
14
|
+
let ordered;
|
|
15
|
+
try {
|
|
16
|
+
ordered = await this.collectSubtree(rootId);
|
|
17
|
+
} catch (error) {
|
|
18
|
+
this.logger.warn({
|
|
19
|
+
error
|
|
20
|
+
}, `cleanupTaskSubtree: failed to collect the subtree of task "${rootId}", skipping.`);
|
|
21
|
+
return;
|
|
22
|
+
}
|
|
23
|
+
for (const task of ordered){
|
|
24
|
+
await this.deleteTaskLogs(task);
|
|
25
|
+
const result = await this.deleteTask.execute(task.id);
|
|
26
|
+
if (result.isFail()) this.logger.warn({
|
|
27
|
+
error: result.error
|
|
28
|
+
}, `cleanupTaskSubtree: failed to delete task "${task.id}".`);
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
async collectSubtree(rootId) {
|
|
32
|
+
const root = await this.tasks.get(rootId);
|
|
33
|
+
if (root.isFail()) return [];
|
|
34
|
+
const order = [
|
|
35
|
+
root.value
|
|
36
|
+
];
|
|
37
|
+
const seen = new Set([
|
|
38
|
+
root.value.id
|
|
39
|
+
]);
|
|
40
|
+
let i = 0;
|
|
41
|
+
while(i < order.length){
|
|
42
|
+
const current = order[i++];
|
|
43
|
+
for (const child of (await this.listChildren(current.id)))if (!seen.has(child.id)) {
|
|
44
|
+
seen.add(child.id);
|
|
45
|
+
order.push(child);
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
return order.reverse();
|
|
49
|
+
}
|
|
50
|
+
async listChildren(parentId) {
|
|
51
|
+
const children = [];
|
|
52
|
+
let after = null;
|
|
53
|
+
do {
|
|
54
|
+
const params = {
|
|
55
|
+
where: {
|
|
56
|
+
parentId
|
|
57
|
+
},
|
|
58
|
+
limit: PAGE_SIZE,
|
|
59
|
+
after
|
|
60
|
+
};
|
|
61
|
+
const result = await this.tasks.list(params);
|
|
62
|
+
if (result.isFail()) throw result.error;
|
|
63
|
+
const { items, meta } = result.value;
|
|
64
|
+
children.push(...items);
|
|
65
|
+
after = meta.hasMoreItems ? meta.cursor : null;
|
|
66
|
+
}while (after)
|
|
67
|
+
return children;
|
|
68
|
+
}
|
|
69
|
+
async listLogs(taskId) {
|
|
70
|
+
const logs = [];
|
|
71
|
+
let after = null;
|
|
72
|
+
do {
|
|
73
|
+
const params = {
|
|
74
|
+
where: {
|
|
75
|
+
task: taskId
|
|
76
|
+
},
|
|
77
|
+
limit: PAGE_SIZE,
|
|
78
|
+
after
|
|
79
|
+
};
|
|
80
|
+
const result = await this.logs.list(params);
|
|
81
|
+
if (result.isFail()) throw result.error;
|
|
82
|
+
const { items, meta } = result.value;
|
|
83
|
+
logs.push(...items);
|
|
84
|
+
after = meta.hasMoreItems ? meta.cursor : null;
|
|
85
|
+
}while (after)
|
|
86
|
+
return logs;
|
|
87
|
+
}
|
|
88
|
+
async deleteTaskLogs(task) {
|
|
89
|
+
let logs;
|
|
90
|
+
try {
|
|
91
|
+
logs = await this.listLogs(task.id);
|
|
92
|
+
} catch (error) {
|
|
93
|
+
this.logger.warn({
|
|
94
|
+
error
|
|
95
|
+
}, `cleanupTaskSubtree: failed to list logs for task "${task.id}".`);
|
|
96
|
+
return;
|
|
97
|
+
}
|
|
98
|
+
for (const log of logs){
|
|
99
|
+
const result = await this.logs.delete(log.id);
|
|
100
|
+
if (result.isFail()) this.logger.warn({
|
|
101
|
+
error: result.error
|
|
102
|
+
}, `cleanupTaskSubtree: failed to delete log "${log.id}" for task "${task.id}".`);
|
|
103
|
+
}
|
|
7
104
|
}
|
|
8
105
|
}
|
|
9
|
-
|
|
106
|
+
const CleanupTaskSubtreeUseCase_CleanupTaskSubtreeUseCase = CleanupTaskSubtreeUseCase.createImplementation({
|
|
107
|
+
implementation: CleanupTaskSubtreeUseCaseImpl,
|
|
108
|
+
dependencies: [
|
|
109
|
+
TasksRepository,
|
|
110
|
+
TaskLogsRepository,
|
|
111
|
+
DeleteTaskUseCase,
|
|
112
|
+
Logger
|
|
113
|
+
]
|
|
114
|
+
});
|
|
115
|
+
export { CleanupTaskSubtreeUseCase_CleanupTaskSubtreeUseCase as CleanupTaskSubtreeUseCase };
|
|
10
116
|
|
|
11
117
|
//# sourceMappingURL=CleanupTaskSubtreeUseCase.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"api/features/CleanupTaskSubtree/CleanupTaskSubtreeUseCase.js","sources":["../../../../src/api/features/CleanupTaskSubtree/CleanupTaskSubtreeUseCase.ts"],"sourcesContent":["import { CleanupTaskSubtreeUseCase as UseCaseAbstraction } from \"./abstractions.js\";\nimport type {
|
|
1
|
+
{"version":3,"file":"api/features/CleanupTaskSubtree/CleanupTaskSubtreeUseCase.js","sources":["../../../../src/api/features/CleanupTaskSubtree/CleanupTaskSubtreeUseCase.ts"],"sourcesContent":["import { Logger } from \"@webiny/api-core/features/logger/index.js\";\nimport { CleanupTaskSubtreeUseCase as UseCaseAbstraction } from \"./abstractions.js\";\nimport { TaskLogsRepository, TasksRepository } from \"~/api/domain/task/abstractions.js\";\nimport { DeleteTaskUseCase } from \"~/api/features/DeleteTask/index.js\";\nimport type { ITask } from \"~/api/types.js\";\nimport type { ITaskLog } from \"~/api/types.js\";\nimport type { IListTaskParams } from \"~/api/types.js\";\nimport type { IListTaskLogParams } from \"~/api/types.js\";\n\nconst PAGE_SIZE = 100;\n\n/**\n * Deletes the task identified by `rootId`, all its descendants, and their logs. The logs are listed\n * by task id whatever the owning definition says (`databaseLogs`, or no registered definition): a\n * self-cleaning task writes none of its own, but an abort still writes one log row, and cleanup\n * removes whatever exists. Bottom-up and best-effort: a record that fails to delete is logged and\n * skipped, and the use case never throws.\n */\nclass CleanupTaskSubtreeUseCaseImpl implements UseCaseAbstraction.Interface {\n public constructor(\n private readonly tasks: TasksRepository.Interface,\n private readonly logs: TaskLogsRepository.Interface,\n private readonly deleteTask: DeleteTaskUseCase.Interface,\n private readonly logger: Logger.Interface\n ) {}\n\n public async execute(rootId: string): Promise<void> {\n let ordered: ITask[];\n try {\n ordered = await this.collectSubtree(rootId);\n } catch (error) {\n // Without the full subtree, deleting anything could orphan the tasks we didn't find.\n this.logger.warn(\n { error },\n `cleanupTaskSubtree: failed to collect the subtree of task \"${rootId}\", skipping.`\n );\n return;\n }\n for (const task of ordered) {\n await this.deleteTaskLogs(task);\n const result = await this.deleteTask.execute(task.id);\n if (result.isFail()) {\n this.logger.warn(\n { error: result.error },\n `cleanupTaskSubtree: failed to delete task \"${task.id}\".`\n );\n }\n }\n }\n\n // Breadth-first from the root, then reversed, so children are deleted before their parents.\n private async collectSubtree(rootId: string): Promise<ITask[]> {\n const root = await this.tasks.get(rootId);\n if (root.isFail()) {\n return [];\n }\n const order: ITask[] = [root.value];\n const seen = new Set<string>([root.value.id]);\n let i = 0;\n while (i < order.length) {\n const current = order[i++];\n for (const child of await this.listChildren(current.id)) {\n if (seen.has(child.id)) {\n continue;\n }\n seen.add(child.id);\n order.push(child);\n }\n }\n return order.reverse();\n }\n\n // Every page, not just the first: a parent can have more children than one page holds.\n private async listChildren(parentId: string): Promise<ITask[]> {\n const children: ITask[] = [];\n let after: string | null = null;\n do {\n const params: IListTaskParams = { where: { parentId }, limit: PAGE_SIZE, after };\n const result = await this.tasks.list(params);\n if (result.isFail()) {\n throw result.error;\n }\n const { items, meta } = result.value;\n children.push(...items);\n after = meta.hasMoreItems ? meta.cursor : null;\n } while (after);\n return children;\n }\n\n // All pages are read before anything is deleted, so deleting doesn't shift what a cursor sees.\n private async listLogs(taskId: string): Promise<ITaskLog[]> {\n const logs: ITaskLog[] = [];\n let after: string | null = null;\n do {\n const params: IListTaskLogParams = { where: { task: taskId }, limit: PAGE_SIZE, after };\n const result = await this.logs.list(params);\n if (result.isFail()) {\n throw result.error;\n }\n const { items, meta } = result.value;\n logs.push(...items);\n after = meta.hasMoreItems ? meta.cursor : null;\n } while (after);\n return logs;\n }\n\n private async deleteTaskLogs(task: ITask): Promise<void> {\n let logs: ITaskLog[];\n try {\n logs = await this.listLogs(task.id);\n } catch (error) {\n this.logger.warn(\n { error },\n `cleanupTaskSubtree: failed to list logs for task \"${task.id}\".`\n );\n return;\n }\n for (const log of logs) {\n const result = await this.logs.delete(log.id);\n if (result.isFail()) {\n this.logger.warn(\n { error: result.error },\n `cleanupTaskSubtree: failed to delete log \"${log.id}\" for task \"${task.id}\".`\n );\n }\n }\n }\n}\n\nexport const CleanupTaskSubtreeUseCase = UseCaseAbstraction.createImplementation({\n implementation: CleanupTaskSubtreeUseCaseImpl,\n dependencies: [TasksRepository, TaskLogsRepository, DeleteTaskUseCase, Logger]\n});\n"],"names":["PAGE_SIZE","CleanupTaskSubtreeUseCaseImpl","tasks","logs","deleteTask","logger","rootId","ordered","error","task","result","root","order","seen","Set","i","current","child","parentId","children","after","params","items","meta","taskId","log","CleanupTaskSubtreeUseCase","UseCaseAbstraction","TasksRepository","TaskLogsRepository","DeleteTaskUseCase","Logger"],"mappings":"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"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { createFeature } from "@webiny/feature/api";
|
|
2
|
+
import { CleanupTaskSubtreeUseCase } from "./CleanupTaskSubtreeUseCase.js";
|
|
3
|
+
const CleanupTaskSubtreeFeature = createFeature({
|
|
4
|
+
name: "CleanupTaskSubtree",
|
|
5
|
+
register (container) {
|
|
6
|
+
container.register(CleanupTaskSubtreeUseCase);
|
|
7
|
+
}
|
|
8
|
+
});
|
|
9
|
+
export { CleanupTaskSubtreeFeature };
|
|
10
|
+
|
|
11
|
+
//# sourceMappingURL=feature.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"api/features/CleanupTaskSubtree/feature.js","sources":["../../../../src/api/features/CleanupTaskSubtree/feature.ts"],"sourcesContent":["import { createFeature } from \"@webiny/feature/api\";\nimport { CleanupTaskSubtreeUseCase } from \"./CleanupTaskSubtreeUseCase.js\";\n\nexport const CleanupTaskSubtreeFeature = createFeature({\n name: \"CleanupTaskSubtree\",\n register(container) {\n container.register(CleanupTaskSubtreeUseCase);\n }\n});\n"],"names":["CleanupTaskSubtreeFeature","createFeature","container","CleanupTaskSubtreeUseCase"],"mappings":";;AAGO,MAAMA,4BAA4BC,cAAc;IACnD,MAAM;IACN,UAASC,SAAS;QACdA,UAAU,QAAQ,CAACC;IACvB;AACJ"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
export { CleanupTaskSubtreeUseCase } from "./abstractions.js";
|
|
2
|
-
export {
|
|
2
|
+
export { CleanupTaskSubtreeFeature } from "./feature.js";
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
export { CleanupTaskSubtreeUseCase } from "./abstractions.js";
|
|
2
|
-
export {
|
|
2
|
+
export { CleanupTaskSubtreeFeature } from "./feature.js";
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { Result } from "@webiny/feature/api";
|
|
2
|
+
import { EventPublisher } from "@webiny/api-core/features/eventPublisher/index.js";
|
|
3
|
+
import type { TaskService } from "@webiny/api-core/features/task/TaskService/index.js";
|
|
4
|
+
import { CreateTaskUseCase as UseCaseAbstraction } from "./abstractions.js";
|
|
5
|
+
import { GetRunnableTaskDefinitionUseCase } from "../../../api/features/GetRunnableTaskDefinition/index.js";
|
|
6
|
+
import { TasksRepository } from "../../../api/domain/task/abstractions.js";
|
|
7
|
+
declare class CreateTaskUseCaseImpl implements UseCaseAbstraction.Interface {
|
|
8
|
+
private readonly getDefinition;
|
|
9
|
+
private readonly eventPublisher;
|
|
10
|
+
private readonly repository;
|
|
11
|
+
constructor(getDefinition: GetRunnableTaskDefinitionUseCase.Interface, eventPublisher: EventPublisher.Interface, repository: TasksRepository.Interface);
|
|
12
|
+
execute<I extends TaskService.TaskInput = TaskService.TaskInput>(data: UseCaseAbstraction.Params<I>): Promise<Result<TaskService.Task<I>, UseCaseAbstraction.Error>>;
|
|
13
|
+
}
|
|
14
|
+
export declare const CreateTaskUseCase: typeof CreateTaskUseCaseImpl & {
|
|
15
|
+
__abstraction: import("@webiny/di").Abstraction<import("./abstractions.js").ICreateTaskUseCase>;
|
|
16
|
+
};
|
|
17
|
+
export {};
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import zod from "zod";
|
|
2
|
+
import { Result } from "@webiny/feature/api";
|
|
3
|
+
import { EventPublisher } from "@webiny/api-core/features/eventPublisher/index.js";
|
|
4
|
+
import { CreateTaskUseCase } from "./abstractions.js";
|
|
5
|
+
import { GetRunnableTaskDefinitionUseCase } from "../GetRunnableTaskDefinition/index.js";
|
|
6
|
+
import { TasksRepository } from "../../domain/task/abstractions.js";
|
|
7
|
+
import { TaskInputValidationError } from "../../domain/errors.js";
|
|
8
|
+
import { TaskAfterCreateEvent, TaskBeforeCreateEvent } from "../../events/index.js";
|
|
9
|
+
const toZodSchema = (schema)=>{
|
|
10
|
+
if (!schema) return zod.looseObject({});
|
|
11
|
+
if (schema instanceof zod.ZodObject) return schema.loose();
|
|
12
|
+
if (schema instanceof zod.ZodType) return schema;
|
|
13
|
+
return zod.looseObject(schema);
|
|
14
|
+
};
|
|
15
|
+
const validateInput = async (definition, input)=>{
|
|
16
|
+
if (!definition.createInputValidation) return null;
|
|
17
|
+
const schema = toZodSchema(definition.createInputValidation({
|
|
18
|
+
validator: zod
|
|
19
|
+
}));
|
|
20
|
+
const result = await schema.safeParseAsync(input);
|
|
21
|
+
return result.success ? null : result.error;
|
|
22
|
+
};
|
|
23
|
+
class CreateTaskUseCaseImpl {
|
|
24
|
+
constructor(getDefinition, eventPublisher, repository){
|
|
25
|
+
this.getDefinition = getDefinition;
|
|
26
|
+
this.eventPublisher = eventPublisher;
|
|
27
|
+
this.repository = repository;
|
|
28
|
+
}
|
|
29
|
+
async execute(data) {
|
|
30
|
+
const definition = this.getDefinition.execute(data.definitionId);
|
|
31
|
+
if (definition.isFail()) return Result.fail(definition.error);
|
|
32
|
+
const invalid = await validateInput(definition.value, data.input);
|
|
33
|
+
if (invalid) return Result.fail(new TaskInputValidationError(invalid));
|
|
34
|
+
await this.eventPublisher.publish(new TaskBeforeCreateEvent({
|
|
35
|
+
input: data
|
|
36
|
+
}));
|
|
37
|
+
const result = await this.repository.create(data);
|
|
38
|
+
if (result.isFail()) return Result.fail(result.error);
|
|
39
|
+
await this.eventPublisher.publish(new TaskAfterCreateEvent({
|
|
40
|
+
input: data,
|
|
41
|
+
task: result.value
|
|
42
|
+
}));
|
|
43
|
+
return Result.ok(result.value);
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
const CreateTaskUseCase_CreateTaskUseCase = CreateTaskUseCase.createImplementation({
|
|
47
|
+
implementation: CreateTaskUseCaseImpl,
|
|
48
|
+
dependencies: [
|
|
49
|
+
GetRunnableTaskDefinitionUseCase,
|
|
50
|
+
EventPublisher,
|
|
51
|
+
TasksRepository
|
|
52
|
+
]
|
|
53
|
+
});
|
|
54
|
+
export { CreateTaskUseCase_CreateTaskUseCase as CreateTaskUseCase };
|
|
55
|
+
|
|
56
|
+
//# sourceMappingURL=CreateTaskUseCase.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"api/features/CreateTask/CreateTaskUseCase.js","sources":["../../../../src/api/features/CreateTask/CreateTaskUseCase.ts"],"sourcesContent":["import zod from \"zod\";\nimport { Result } from \"@webiny/feature/api\";\nimport type { GenericRecord } from \"@webiny/api/types.js\";\nimport { EventPublisher } from \"@webiny/api-core/features/eventPublisher/index.js\";\nimport type { TaskDefinition } from \"@webiny/api-core/features/task/TaskDefinition/index.js\";\nimport type { TaskService } from \"@webiny/api-core/features/task/TaskService/index.js\";\nimport { CreateTaskUseCase as UseCaseAbstraction } from \"./abstractions.js\";\nimport { GetRunnableTaskDefinitionUseCase } from \"~/api/features/GetRunnableTaskDefinition/index.js\";\nimport { TasksRepository } from \"~/api/domain/task/abstractions.js\";\nimport { TaskInputValidationError } from \"~/api/domain/errors.js\";\nimport { TaskAfterCreateEvent, TaskBeforeCreateEvent } from \"~/api/events/index.js\";\n\ntype InputSchema = GenericRecord<string, zod.ZodTypeAny> | zod.ZodTypeAny;\n\nconst toZodSchema = (schema: InputSchema) => {\n if (!schema) {\n return zod.looseObject({});\n } else if (schema instanceof zod.ZodObject) {\n return schema.loose();\n } else if (schema instanceof zod.ZodType) {\n return schema;\n }\n return zod.looseObject(schema);\n};\n\nconst validateInput = async (\n definition: Pick<TaskDefinition.Runnable, \"createInputValidation\">,\n input: unknown\n): Promise<zod.ZodError | null> => {\n if (!definition.createInputValidation) {\n return null;\n }\n const schema = toZodSchema(definition.createInputValidation({ validator: zod }));\n const result = await schema.safeParseAsync(input);\n return result.success ? null : result.error;\n};\n\nclass CreateTaskUseCaseImpl implements UseCaseAbstraction.Interface {\n constructor(\n private readonly getDefinition: GetRunnableTaskDefinitionUseCase.Interface,\n private readonly eventPublisher: EventPublisher.Interface,\n private readonly repository: TasksRepository.Interface\n ) {}\n\n async execute<I extends TaskService.TaskInput = TaskService.TaskInput>(\n data: UseCaseAbstraction.Params<I>\n ): Promise<Result<TaskService.Task<I>, UseCaseAbstraction.Error>> {\n const definition = this.getDefinition.execute(data.definitionId);\n if (definition.isFail()) {\n return Result.fail(definition.error);\n }\n\n const invalid = await validateInput(definition.value, data.input);\n if (invalid) {\n return Result.fail(new TaskInputValidationError(invalid));\n }\n\n await this.eventPublisher.publish(new TaskBeforeCreateEvent({ input: data }));\n\n const result = await this.repository.create<I>(data);\n if (result.isFail()) {\n return Result.fail(result.error);\n }\n\n await this.eventPublisher.publish(\n new TaskAfterCreateEvent({ input: data, task: result.value })\n );\n\n return Result.ok(result.value);\n }\n}\n\nexport const CreateTaskUseCase = UseCaseAbstraction.createImplementation({\n implementation: CreateTaskUseCaseImpl,\n dependencies: [GetRunnableTaskDefinitionUseCase, EventPublisher, TasksRepository]\n});\n"],"names":["toZodSchema","schema","zod","validateInput","definition","input","result","CreateTaskUseCaseImpl","getDefinition","eventPublisher","repository","data","Result","invalid","TaskInputValidationError","TaskBeforeCreateEvent","TaskAfterCreateEvent","CreateTaskUseCase","UseCaseAbstraction","GetRunnableTaskDefinitionUseCase","EventPublisher","TasksRepository"],"mappings":";;;;;;;;AAcA,MAAMA,cAAc,CAACC;IACjB,IAAI,CAACA,QACD,OAAOC,IAAI,WAAW,CAAC,CAAC;IACrB,IAAID,kBAAkBC,IAAI,SAAS,EACtC,OAAOD,OAAO,KAAK;IAChB,IAAIA,kBAAkBC,IAAI,OAAO,EACpC,OAAOD;IAEX,OAAOC,IAAI,WAAW,CAACD;AAC3B;AAEA,MAAME,gBAAgB,OAClBC,YACAC;IAEA,IAAI,CAACD,WAAW,qBAAqB,EACjC,OAAO;IAEX,MAAMH,SAASD,YAAYI,WAAW,qBAAqB,CAAC;QAAE,WAAWF;IAAI;IAC7E,MAAMI,SAAS,MAAML,OAAO,cAAc,CAACI;IAC3C,OAAOC,OAAO,OAAO,GAAG,OAAOA,OAAO,KAAK;AAC/C;AAEA,MAAMC;IACF,YACqBC,aAAyD,EACzDC,cAAwC,EACxCC,UAAqC,CACxD;aAHmBF,aAAa,GAAbA;aACAC,cAAc,GAAdA;aACAC,UAAU,GAAVA;IAClB;IAEH,MAAM,QACFC,IAAkC,EAC4B;QAC9D,MAAMP,aAAa,IAAI,CAAC,aAAa,CAAC,OAAO,CAACO,KAAK,YAAY;QAC/D,IAAIP,WAAW,MAAM,IACjB,OAAOQ,OAAO,IAAI,CAACR,WAAW,KAAK;QAGvC,MAAMS,UAAU,MAAMV,cAAcC,WAAW,KAAK,EAAEO,KAAK,KAAK;QAChE,IAAIE,SACA,OAAOD,OAAO,IAAI,CAAC,IAAIE,yBAAyBD;QAGpD,MAAM,IAAI,CAAC,cAAc,CAAC,OAAO,CAAC,IAAIE,sBAAsB;YAAE,OAAOJ;QAAK;QAE1E,MAAML,SAAS,MAAM,IAAI,CAAC,UAAU,CAAC,MAAM,CAAIK;QAC/C,IAAIL,OAAO,MAAM,IACb,OAAOM,OAAO,IAAI,CAACN,OAAO,KAAK;QAGnC,MAAM,IAAI,CAAC,cAAc,CAAC,OAAO,CAC7B,IAAIU,qBAAqB;YAAE,OAAOL;YAAM,MAAML,OAAO,KAAK;QAAC;QAG/D,OAAOM,OAAO,EAAE,CAACN,OAAO,KAAK;IACjC;AACJ;AAEO,MAAMW,sCAAoBC,kBAAAA,oBAAuC,CAAC;IACrE,gBAAgBX;IAChB,cAAc;QAACY;QAAkCC;QAAgBC;KAAgB;AACrF"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { type Result } from "@webiny/feature/api";
|
|
2
|
+
import type { TaskService } from "@webiny/api-core/features/task/TaskService/index.js";
|
|
3
|
+
import type { ITaskCreateData } from "../../../api/types.js";
|
|
4
|
+
import type { BackgroundTaskPersistenceError, TaskDefinitionNotFoundError, TaskInputValidationError } from "../../../api/domain/errors.js";
|
|
5
|
+
export interface ICreateTaskUseCase {
|
|
6
|
+
execute<I extends TaskService.TaskInput = TaskService.TaskInput>(data: ITaskCreateData<I>): Promise<Result<TaskService.Task<I>, UseCaseError>>;
|
|
7
|
+
}
|
|
8
|
+
export interface ICreateTaskUseCaseErrors {
|
|
9
|
+
definitionNotFound: TaskDefinitionNotFoundError;
|
|
10
|
+
validation: TaskInputValidationError;
|
|
11
|
+
persistence: BackgroundTaskPersistenceError;
|
|
12
|
+
}
|
|
13
|
+
type UseCaseError = ICreateTaskUseCaseErrors[keyof ICreateTaskUseCaseErrors];
|
|
14
|
+
/** Store a new task in the pending state. Doesn't send it for execution; see TriggerTaskUseCase. */
|
|
15
|
+
export declare const CreateTaskUseCase: import("@webiny/di").Abstraction<ICreateTaskUseCase>;
|
|
16
|
+
export declare namespace CreateTaskUseCase {
|
|
17
|
+
type Interface = ICreateTaskUseCase;
|
|
18
|
+
type Params<I extends TaskService.TaskInput = TaskService.TaskInput> = ITaskCreateData<I>;
|
|
19
|
+
type Error = UseCaseError;
|
|
20
|
+
}
|
|
21
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"api/features/CreateTask/abstractions.js","sources":["../../../../src/api/features/CreateTask/abstractions.ts"],"sourcesContent":["import { createAbstraction, type Result } from \"@webiny/feature/api\";\nimport type { TaskService } from \"@webiny/api-core/features/task/TaskService/index.js\";\nimport type { ITaskCreateData } from \"~/api/types.js\";\nimport type {\n BackgroundTaskPersistenceError,\n TaskDefinitionNotFoundError,\n TaskInputValidationError\n} from \"~/api/domain/errors.js\";\n\nexport interface ICreateTaskUseCase {\n execute<I extends TaskService.TaskInput = TaskService.TaskInput>(\n data: ITaskCreateData<I>\n ): Promise<Result<TaskService.Task<I>, UseCaseError>>;\n}\n\nexport interface ICreateTaskUseCaseErrors {\n definitionNotFound: TaskDefinitionNotFoundError;\n validation: TaskInputValidationError;\n persistence: BackgroundTaskPersistenceError;\n}\n\ntype UseCaseError = ICreateTaskUseCaseErrors[keyof ICreateTaskUseCaseErrors];\n\n/** Store a new task in the pending state. Doesn't send it for execution; see TriggerTaskUseCase. */\nexport const CreateTaskUseCase = createAbstraction<ICreateTaskUseCase>(\"Tasks/CreateTaskUseCase\");\n\nexport namespace CreateTaskUseCase {\n export type Interface = ICreateTaskUseCase;\n export type Params<I extends TaskService.TaskInput = TaskService.TaskInput> =\n ITaskCreateData<I>;\n export type Error = UseCaseError;\n}\n"],"names":["CreateTaskUseCase","createAbstraction"],"mappings":";AAwBO,MAAMA,oBAAoBC,kBAAsC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { createFeature } from "@webiny/feature/api";
|
|
2
|
+
import { CreateTaskUseCase } from "./CreateTaskUseCase.js";
|
|
3
|
+
const CreateTaskFeature = createFeature({
|
|
4
|
+
name: "CreateTask",
|
|
5
|
+
register (container) {
|
|
6
|
+
container.register(CreateTaskUseCase);
|
|
7
|
+
}
|
|
8
|
+
});
|
|
9
|
+
export { CreateTaskFeature };
|
|
10
|
+
|
|
11
|
+
//# sourceMappingURL=feature.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"api/features/CreateTask/feature.js","sources":["../../../../src/api/features/CreateTask/feature.ts"],"sourcesContent":["import { createFeature } from \"@webiny/feature/api\";\nimport { CreateTaskUseCase } from \"./CreateTaskUseCase.js\";\n\nexport const CreateTaskFeature = createFeature({\n name: \"CreateTask\",\n register(container) {\n container.register(CreateTaskUseCase);\n }\n});\n"],"names":["CreateTaskFeature","createFeature","container","CreateTaskUseCase"],"mappings":";;AAGO,MAAMA,oBAAoBC,cAAc;IAC3C,MAAM;IACN,UAASC,SAAS;QACdA,UAAU,QAAQ,CAACC;IACvB;AACJ"}
|