@webiny/background-tasks 0.0.0-unstable.0156a4c312
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/LICENSE +21 -0
- package/README.md +11 -0
- package/admin/BackgroundTaskRoutes.d.ts +2 -0
- package/admin/BackgroundTaskRoutes.js +70 -0
- package/admin/BackgroundTaskRoutes.js.map +1 -0
- package/admin/BackgroundTasks.d.ts +2 -0
- package/admin/BackgroundTasks.js +55 -0
- package/admin/BackgroundTasks.js.map +1 -0
- package/admin/features/abortTask/AbortTaskGateway.d.ts +12 -0
- package/admin/features/abortTask/AbortTaskGateway.js +62 -0
- package/admin/features/abortTask/AbortTaskGateway.js.map +1 -0
- package/admin/features/abortTask/AbortTaskUseCase.d.ts +11 -0
- package/admin/features/abortTask/AbortTaskUseCase.js +18 -0
- package/admin/features/abortTask/AbortTaskUseCase.js.map +1 -0
- package/admin/features/abortTask/abstractions.d.ts +19 -0
- package/admin/features/abortTask/abstractions.js +6 -0
- package/admin/features/abortTask/abstractions.js.map +1 -0
- package/admin/features/abortTask/feature.d.ts +3 -0
- package/admin/features/abortTask/feature.js +19 -0
- package/admin/features/abortTask/feature.js.map +1 -0
- package/admin/features/abortTask/index.d.ts +2 -0
- package/admin/features/abortTask/index.js +2 -0
- package/admin/features/deleteTask/DeleteTaskGateway.d.ts +11 -0
- package/admin/features/deleteTask/DeleteTaskGateway.js +41 -0
- package/admin/features/deleteTask/DeleteTaskGateway.js.map +1 -0
- package/admin/features/deleteTask/DeleteTaskUseCase.d.ts +10 -0
- package/admin/features/deleteTask/DeleteTaskUseCase.js +18 -0
- package/admin/features/deleteTask/DeleteTaskUseCase.js.map +1 -0
- package/admin/features/deleteTask/abstractions.d.ts +14 -0
- package/admin/features/deleteTask/abstractions.js +6 -0
- package/admin/features/deleteTask/abstractions.js.map +1 -0
- package/admin/features/deleteTask/feature.d.ts +3 -0
- package/admin/features/deleteTask/feature.js +19 -0
- package/admin/features/deleteTask/feature.js.map +1 -0
- package/admin/features/deleteTask/index.d.ts +2 -0
- package/admin/features/deleteTask/index.js +2 -0
- package/admin/features/getBackgroundTaskSettings/GetBackgroundTaskSettingsGateway.d.ts +12 -0
- package/admin/features/getBackgroundTaskSettings/GetBackgroundTaskSettingsGateway.js +40 -0
- package/admin/features/getBackgroundTaskSettings/GetBackgroundTaskSettingsGateway.js.map +1 -0
- package/admin/features/getBackgroundTaskSettings/GetBackgroundTaskSettingsUseCase.d.ts +11 -0
- package/admin/features/getBackgroundTaskSettings/GetBackgroundTaskSettingsUseCase.js +18 -0
- package/admin/features/getBackgroundTaskSettings/GetBackgroundTaskSettingsUseCase.js.map +1 -0
- package/admin/features/getBackgroundTaskSettings/abstractions.d.ts +15 -0
- package/admin/features/getBackgroundTaskSettings/abstractions.js +6 -0
- package/admin/features/getBackgroundTaskSettings/abstractions.js.map +1 -0
- package/admin/features/getBackgroundTaskSettings/feature.d.ts +3 -0
- package/admin/features/getBackgroundTaskSettings/feature.js +19 -0
- package/admin/features/getBackgroundTaskSettings/feature.js.map +1 -0
- package/admin/features/getBackgroundTaskSettings/index.d.ts +3 -0
- package/admin/features/getBackgroundTaskSettings/index.js +2 -0
- package/admin/features/getTask/GetTaskGateway.d.ts +12 -0
- package/admin/features/getTask/GetTaskGateway.js +61 -0
- package/admin/features/getTask/GetTaskGateway.js.map +1 -0
- package/admin/features/getTask/GetTaskUseCase.d.ts +11 -0
- package/admin/features/getTask/GetTaskUseCase.js +18 -0
- package/admin/features/getTask/GetTaskUseCase.js.map +1 -0
- package/admin/features/getTask/abstractions.d.ts +15 -0
- package/admin/features/getTask/abstractions.js +6 -0
- package/admin/features/getTask/abstractions.js.map +1 -0
- package/admin/features/getTask/feature.d.ts +3 -0
- package/admin/features/getTask/feature.js +19 -0
- package/admin/features/getTask/feature.js.map +1 -0
- package/admin/features/getTask/index.d.ts +2 -0
- package/admin/features/getTask/index.js +2 -0
- package/admin/features/listDefinitions/ListDefinitionsGateway.d.ts +12 -0
- package/admin/features/listDefinitions/ListDefinitionsGateway.js +42 -0
- package/admin/features/listDefinitions/ListDefinitionsGateway.js.map +1 -0
- package/admin/features/listDefinitions/ListDefinitionsUseCase.d.ts +11 -0
- package/admin/features/listDefinitions/ListDefinitionsUseCase.js +18 -0
- package/admin/features/listDefinitions/ListDefinitionsUseCase.js.map +1 -0
- package/admin/features/listDefinitions/abstractions.d.ts +15 -0
- package/admin/features/listDefinitions/abstractions.js +6 -0
- package/admin/features/listDefinitions/abstractions.js.map +1 -0
- package/admin/features/listDefinitions/feature.d.ts +3 -0
- package/admin/features/listDefinitions/feature.js +19 -0
- package/admin/features/listDefinitions/feature.js.map +1 -0
- package/admin/features/listDefinitions/index.d.ts +2 -0
- package/admin/features/listDefinitions/index.js +2 -0
- package/admin/features/listLogs/ListLogsGateway.d.ts +11 -0
- package/admin/features/listLogs/ListLogsGateway.js +73 -0
- package/admin/features/listLogs/ListLogsGateway.js.map +1 -0
- package/admin/features/listLogs/ListLogsUseCase.d.ts +10 -0
- package/admin/features/listLogs/ListLogsUseCase.js +18 -0
- package/admin/features/listLogs/ListLogsUseCase.js.map +1 -0
- package/admin/features/listLogs/abstractions.d.ts +30 -0
- package/admin/features/listLogs/abstractions.js +6 -0
- package/admin/features/listLogs/abstractions.js.map +1 -0
- package/admin/features/listLogs/feature.d.ts +3 -0
- package/admin/features/listLogs/feature.js +19 -0
- package/admin/features/listLogs/feature.js.map +1 -0
- package/admin/features/listLogs/index.d.ts +2 -0
- package/admin/features/listLogs/index.js +2 -0
- package/admin/features/listTasks/ListTasksGateway.d.ts +11 -0
- package/admin/features/listTasks/ListTasksGateway.js +79 -0
- package/admin/features/listTasks/ListTasksGateway.js.map +1 -0
- package/admin/features/listTasks/ListTasksUseCase.d.ts +10 -0
- package/admin/features/listTasks/ListTasksUseCase.js +18 -0
- package/admin/features/listTasks/ListTasksUseCase.js.map +1 -0
- package/admin/features/listTasks/abstractions.d.ts +31 -0
- package/admin/features/listTasks/abstractions.js +6 -0
- package/admin/features/listTasks/abstractions.js.map +1 -0
- package/admin/features/listTasks/feature.d.ts +3 -0
- package/admin/features/listTasks/feature.js +19 -0
- package/admin/features/listTasks/feature.js.map +1 -0
- package/admin/features/listTasks/index.d.ts +2 -0
- package/admin/features/listTasks/index.js +2 -0
- package/admin/features/permissions/abstractions.d.ts +17 -0
- package/admin/features/permissions/abstractions.js +6 -0
- package/admin/features/permissions/abstractions.js.map +1 -0
- package/admin/features/permissions/feature.d.ts +14 -0
- package/admin/features/permissions/feature.js +7 -0
- package/admin/features/permissions/feature.js.map +1 -0
- package/admin/features/permissions/index.d.ts +2 -0
- package/admin/features/permissions/index.js +2 -0
- package/admin/features/updateBackgroundTaskSettings/UpdateBackgroundTaskSettingsGateway.d.ts +12 -0
- package/admin/features/updateBackgroundTaskSettings/UpdateBackgroundTaskSettingsGateway.js +43 -0
- package/admin/features/updateBackgroundTaskSettings/UpdateBackgroundTaskSettingsGateway.js.map +1 -0
- package/admin/features/updateBackgroundTaskSettings/UpdateBackgroundTaskSettingsUseCase.d.ts +11 -0
- package/admin/features/updateBackgroundTaskSettings/UpdateBackgroundTaskSettingsUseCase.js +18 -0
- package/admin/features/updateBackgroundTaskSettings/UpdateBackgroundTaskSettingsUseCase.js.map +1 -0
- package/admin/features/updateBackgroundTaskSettings/abstractions.d.ts +18 -0
- package/admin/features/updateBackgroundTaskSettings/abstractions.js +6 -0
- package/admin/features/updateBackgroundTaskSettings/abstractions.js.map +1 -0
- package/admin/features/updateBackgroundTaskSettings/feature.d.ts +3 -0
- package/admin/features/updateBackgroundTaskSettings/feature.js +19 -0
- package/admin/features/updateBackgroundTaskSettings/feature.js.map +1 -0
- package/admin/features/updateBackgroundTaskSettings/index.d.ts +3 -0
- package/admin/features/updateBackgroundTaskSettings/index.js +2 -0
- package/admin/index.d.ts +2 -0
- package/admin/index.js +2 -0
- package/admin/permissions.d.ts +12 -0
- package/admin/permissions.js +22 -0
- package/admin/permissions.js.map +1 -0
- package/admin/presentation/BackgroundTaskSettings/BackgroundTaskSettingsPresenter.d.ts +21 -0
- package/admin/presentation/BackgroundTaskSettings/BackgroundTaskSettingsPresenter.js +86 -0
- package/admin/presentation/BackgroundTaskSettings/BackgroundTaskSettingsPresenter.js.map +1 -0
- package/admin/presentation/BackgroundTaskSettings/abstractions.d.ts +16 -0
- package/admin/presentation/BackgroundTaskSettings/abstractions.js +5 -0
- package/admin/presentation/BackgroundTaskSettings/abstractions.js.map +1 -0
- package/admin/presentation/BackgroundTaskSettings/components/BackgroundTaskSettingsView.d.ts +2 -0
- package/admin/presentation/BackgroundTaskSettings/components/BackgroundTaskSettingsView.js +56 -0
- package/admin/presentation/BackgroundTaskSettings/components/BackgroundTaskSettingsView.js.map +1 -0
- package/admin/presentation/BackgroundTaskSettings/feature.d.ts +3 -0
- package/admin/presentation/BackgroundTaskSettings/feature.js +17 -0
- package/admin/presentation/BackgroundTaskSettings/feature.js.map +1 -0
- package/admin/presentation/BackgroundTaskSettings/index.d.ts +2 -0
- package/admin/presentation/BackgroundTaskSettings/index.js +2 -0
- package/admin/presentation/TaskDefinitions/TaskDefinitionsPresenter.d.ts +14 -0
- package/admin/presentation/TaskDefinitions/TaskDefinitionsPresenter.js +41 -0
- package/admin/presentation/TaskDefinitions/TaskDefinitionsPresenter.js.map +1 -0
- package/admin/presentation/TaskDefinitions/abstractions.d.ts +14 -0
- package/admin/presentation/TaskDefinitions/abstractions.js +5 -0
- package/admin/presentation/TaskDefinitions/abstractions.js.map +1 -0
- package/admin/presentation/TaskDefinitions/components/TaskDefinitionsView.d.ts +2 -0
- package/admin/presentation/TaskDefinitions/components/TaskDefinitionsView.js +76 -0
- package/admin/presentation/TaskDefinitions/components/TaskDefinitionsView.js.map +1 -0
- package/admin/presentation/TaskDefinitions/components/TaskExecutionsButton.d.ts +2 -0
- package/admin/presentation/TaskDefinitions/components/TaskExecutionsButton.js +16 -0
- package/admin/presentation/TaskDefinitions/components/TaskExecutionsButton.js.map +1 -0
- package/admin/presentation/TaskDefinitions/feature.d.ts +3 -0
- package/admin/presentation/TaskDefinitions/feature.js +17 -0
- package/admin/presentation/TaskDefinitions/feature.js.map +1 -0
- package/admin/presentation/TaskDefinitions/index.d.ts +2 -0
- package/admin/presentation/TaskDefinitions/index.js +2 -0
- package/admin/presentation/TaskDetail/TaskDetailPresenter.d.ts +24 -0
- package/admin/presentation/TaskDetail/TaskDetailPresenter.js +87 -0
- package/admin/presentation/TaskDetail/TaskDetailPresenter.js.map +1 -0
- package/admin/presentation/TaskDetail/abstractions.d.ts +24 -0
- package/admin/presentation/TaskDetail/abstractions.js +5 -0
- package/admin/presentation/TaskDetail/abstractions.js.map +1 -0
- package/admin/presentation/TaskDetail/components/TaskDetailDrawer.d.ts +11 -0
- package/admin/presentation/TaskDetail/components/TaskDetailDrawer.js +270 -0
- package/admin/presentation/TaskDetail/components/TaskDetailDrawer.js.map +1 -0
- package/admin/presentation/TaskDetail/feature.d.ts +3 -0
- package/admin/presentation/TaskDetail/feature.js +17 -0
- package/admin/presentation/TaskDetail/feature.js.map +1 -0
- package/admin/presentation/TaskDetail/index.d.ts +2 -0
- package/admin/presentation/TaskDetail/index.js +2 -0
- package/admin/presentation/TaskExecutions/TaskExecutionsDataSource.d.ts +15 -0
- package/admin/presentation/TaskExecutions/TaskExecutionsDataSource.js +91 -0
- package/admin/presentation/TaskExecutions/TaskExecutionsDataSource.js.map +1 -0
- package/admin/presentation/TaskExecutions/TaskExecutionsPresenter.d.ts +54 -0
- package/admin/presentation/TaskExecutions/TaskExecutionsPresenter.js +109 -0
- package/admin/presentation/TaskExecutions/TaskExecutionsPresenter.js.map +1 -0
- package/admin/presentation/TaskExecutions/abstractions.d.ts +28 -0
- package/admin/presentation/TaskExecutions/abstractions.js +5 -0
- package/admin/presentation/TaskExecutions/abstractions.js.map +1 -0
- package/admin/presentation/TaskExecutions/components/TaskDefinitionsButton.d.ts +2 -0
- package/admin/presentation/TaskExecutions/components/TaskDefinitionsButton.js +16 -0
- package/admin/presentation/TaskExecutions/components/TaskDefinitionsButton.js.map +1 -0
- package/admin/presentation/TaskExecutions/components/TaskExecutionsView.d.ts +2 -0
- package/admin/presentation/TaskExecutions/components/TaskExecutionsView.js +341 -0
- package/admin/presentation/TaskExecutions/components/TaskExecutionsView.js.map +1 -0
- package/admin/presentation/TaskExecutions/feature.d.ts +3 -0
- package/admin/presentation/TaskExecutions/feature.js +17 -0
- package/admin/presentation/TaskExecutions/feature.js.map +1 -0
- package/admin/presentation/TaskExecutions/index.d.ts +2 -0
- package/admin/presentation/TaskExecutions/index.js +2 -0
- package/admin/presentation/security/HasPermission.d.ts +12 -0
- package/admin/presentation/security/HasPermission.js +6 -0
- package/admin/presentation/security/HasPermission.js.map +1 -0
- package/admin/presentation/security/usePermissions.d.ts +12 -0
- package/admin/presentation/security/usePermissions.js +6 -0
- package/admin/presentation/security/usePermissions.js.map +1 -0
- package/admin/routes.d.ts +6 -0
- package/admin/routes.js +18 -0
- package/admin/routes.js.map +1 -0
- package/admin/shared/types.d.ts +18 -0
- package/admin/shared/types.js +0 -0
- 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.d.ts +9 -0
- package/api/crud/TaskLogPrivateModel.js +41 -0
- package/api/crud/TaskLogPrivateModel.js.map +1 -0
- package/api/crud/TaskPrivateModel.d.ts +9 -0
- package/api/crud/TaskPrivateModel.js +56 -0
- package/api/crud/TaskPrivateModel.js.map +1 -0
- package/api/decorators/SelfCleaningTaskHandlerDecorator.d.ts +33 -0
- 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/BackgroundTaskSettings.d.ts +3 -0
- package/api/domain/BackgroundTaskSettings.js +0 -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/constants.d.ts +3 -0
- package/api/domain/constants.js +6 -0
- package/api/domain/constants.js.map +1 -0
- package/api/domain/errors.d.ts +61 -0
- package/api/domain/errors.js +109 -0
- package/api/domain/errors.js.map +1 -0
- 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/events/TaskAfterCreateEvent.d.ts +6 -0
- package/api/events/TaskAfterCreateEvent.js +13 -0
- package/api/events/TaskAfterCreateEvent.js.map +1 -0
- package/api/events/TaskAfterDeleteEvent.d.ts +6 -0
- package/api/events/TaskAfterDeleteEvent.js +13 -0
- package/api/events/TaskAfterDeleteEvent.js.map +1 -0
- package/api/events/TaskAfterUpdateEvent.d.ts +6 -0
- package/api/events/TaskAfterUpdateEvent.js +13 -0
- package/api/events/TaskAfterUpdateEvent.js.map +1 -0
- package/api/events/TaskBeforeCreateEvent.d.ts +6 -0
- package/api/events/TaskBeforeCreateEvent.js +13 -0
- package/api/events/TaskBeforeCreateEvent.js.map +1 -0
- package/api/events/TaskBeforeDeleteEvent.d.ts +6 -0
- package/api/events/TaskBeforeDeleteEvent.js +13 -0
- package/api/events/TaskBeforeDeleteEvent.js.map +1 -0
- package/api/events/TaskBeforeUpdateEvent.d.ts +6 -0
- package/api/events/TaskBeforeUpdateEvent.js +13 -0
- package/api/events/TaskBeforeUpdateEvent.js.map +1 -0
- package/api/events/abstractions.d.ts +53 -0
- package/api/events/abstractions.js +10 -0
- package/api/events/abstractions.js.map +1 -0
- package/api/events/index.d.ts +7 -0
- package/api/events/index.js +7 -0
- package/api/features/AbortTask/AbortTaskUseCase.d.ts +9 -0
- package/api/features/AbortTask/AbortTaskUseCase.js +12 -0
- package/api/features/AbortTask/AbortTaskUseCase.js.map +1 -0
- package/api/features/AbortTask/abstractions.d.ts +25 -0
- package/api/features/AbortTask/abstractions.js +5 -0
- package/api/features/AbortTask/abstractions.js.map +1 -0
- package/api/features/AbortTask/feature.d.ts +4 -0
- package/api/features/AbortTask/feature.js +13 -0
- package/api/features/AbortTask/feature.js.map +1 -0
- package/api/features/AbortTask/index.d.ts +2 -0
- package/api/features/AbortTask/index.js +2 -0
- package/api/features/BackgroundTaskPermissions/abstractions.d.ts +17 -0
- package/api/features/BackgroundTaskPermissions/abstractions.js +6 -0
- package/api/features/BackgroundTaskPermissions/abstractions.js.map +1 -0
- package/api/features/BackgroundTaskPermissions/feature.d.ts +4 -0
- package/api/features/BackgroundTaskPermissions/feature.js +7 -0
- package/api/features/BackgroundTaskPermissions/feature.js.map +1 -0
- package/api/features/BackgroundTaskPermissions/index.d.ts +2 -0
- package/api/features/BackgroundTaskPermissions/index.js +2 -0
- package/api/features/CleanupTaskSubtree/CleanupTaskSubtreeUseCase.d.ts +27 -0
- package/api/features/CleanupTaskSubtree/CleanupTaskSubtreeUseCase.js +117 -0
- package/api/features/CleanupTaskSubtree/CleanupTaskSubtreeUseCase.js.map +1 -0
- package/api/features/CleanupTaskSubtree/abstractions.d.ts +7 -0
- package/api/features/CleanupTaskSubtree/abstractions.js +5 -0
- package/api/features/CleanupTaskSubtree/abstractions.js.map +1 -0
- 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 +2 -0
- package/api/features/CleanupTaskSubtree/index.js +2 -0
- 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/CreateTask/feature.d.ts +4 -0
- 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.d.ts +21 -0
- package/api/features/GetBackgroundTaskSettings/GetBackgroundTaskSettingsRepository.js +63 -0
- package/api/features/GetBackgroundTaskSettings/GetBackgroundTaskSettingsRepository.js.map +1 -0
- package/api/features/GetBackgroundTaskSettings/abstractions.d.ts +13 -0
- package/api/features/GetBackgroundTaskSettings/abstractions.js +5 -0
- package/api/features/GetBackgroundTaskSettings/abstractions.js.map +1 -0
- package/api/features/GetBackgroundTaskSettings/feature.d.ts +4 -0
- package/api/features/GetBackgroundTaskSettings/feature.js +11 -0
- package/api/features/GetBackgroundTaskSettings/feature.js.map +1 -0
- package/api/features/GetBackgroundTaskSettings/index.d.ts +2 -0
- package/api/features/GetBackgroundTaskSettings/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/GetRunnableTaskDefinition/abstractions.d.ts +17 -0
- 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 +13 -0
- package/api/features/GetTask/GetTaskUseCase.js +19 -0
- package/api/features/GetTask/GetTaskUseCase.js.map +1 -0
- package/api/features/GetTask/abstractions.d.ts +17 -0
- package/api/features/GetTask/abstractions.js +5 -0
- package/api/features/GetTask/abstractions.js.map +1 -0
- package/api/features/GetTask/feature.d.ts +4 -0
- package/api/features/GetTask/feature.js +11 -0
- package/api/features/GetTask/feature.js.map +1 -0
- package/api/features/GetTask/index.d.ts +2 -0
- package/api/features/GetTask/index.js +2 -0
- package/api/features/ListTaskDefinitions/ListTaskDefinitionsUseCase.d.ts +11 -0
- package/api/features/ListTaskDefinitions/ListTaskDefinitionsUseCase.js +24 -0
- package/api/features/ListTaskDefinitions/ListTaskDefinitionsUseCase.js.map +1 -0
- package/api/features/ListTaskDefinitions/abstractions.d.ts +9 -0
- package/api/features/ListTaskDefinitions/abstractions.js +5 -0
- package/api/features/ListTaskDefinitions/abstractions.js.map +1 -0
- package/api/features/ListTaskDefinitions/feature.d.ts +4 -0
- package/api/features/ListTaskDefinitions/feature.js +11 -0
- package/api/features/ListTaskDefinitions/feature.js.map +1 -0
- package/api/features/ListTaskDefinitions/index.d.ts +2 -0
- package/api/features/ListTaskDefinitions/index.js +2 -0
- 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 +13 -0
- package/api/features/ListTasks/ListTasksUseCase.js +19 -0
- package/api/features/ListTasks/ListTasksUseCase.js.map +1 -0
- package/api/features/ListTasks/abstractions.d.ts +19 -0
- package/api/features/ListTasks/abstractions.js +5 -0
- package/api/features/ListTasks/abstractions.js.map +1 -0
- package/api/features/ListTasks/feature.d.ts +4 -0
- package/api/features/ListTasks/feature.js +11 -0
- package/api/features/ListTasks/feature.js.map +1 -0
- package/api/features/ListTasks/index.d.ts +2 -0
- package/api/features/ListTasks/index.js +2 -0
- 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/TaskController/TaskController.d.ts +49 -0
- package/api/features/TaskController/TaskController.js +71 -0
- package/api/features/TaskController/TaskController.js.map +1 -0
- package/api/features/TaskController/augmentation.d.ts +60 -0
- package/api/features/TaskController/augmentation.js +0 -0
- package/api/features/TaskController/index.d.ts +2 -0
- package/api/features/TaskController/index.js +2 -0
- package/api/features/TaskExecutionContext/TaskExecutionContext.d.ts +24 -0
- package/api/features/TaskExecutionContext/TaskExecutionContext.js +43 -0
- package/api/features/TaskExecutionContext/TaskExecutionContext.js.map +1 -0
- package/api/features/TaskExecutionContext/abstractions.d.ts +26 -0
- package/api/features/TaskExecutionContext/abstractions.js +5 -0
- package/api/features/TaskExecutionContext/abstractions.js.map +1 -0
- package/api/features/TaskExecutionContext/feature.d.ts +4 -0
- package/api/features/TaskExecutionContext/feature.js +11 -0
- package/api/features/TaskExecutionContext/feature.js.map +1 -0
- package/api/features/TaskExecutionContext/index.d.ts +1 -0
- package/api/features/TaskExecutionContext/index.js +1 -0
- 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 +9 -0
- package/api/features/TriggerTask/TriggerTaskUseCase.js +12 -0
- package/api/features/TriggerTask/TriggerTaskUseCase.js.map +1 -0
- package/api/features/TriggerTask/abstractions.d.ts +28 -0
- package/api/features/TriggerTask/abstractions.js +5 -0
- package/api/features/TriggerTask/abstractions.js.map +1 -0
- package/api/features/TriggerTask/feature.d.ts +4 -0
- package/api/features/TriggerTask/feature.js +13 -0
- package/api/features/TriggerTask/feature.js.map +1 -0
- package/api/features/TriggerTask/index.d.ts +2 -0
- package/api/features/TriggerTask/index.js +2 -0
- 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.d.ts +23 -0
- package/api/features/UpdateBackgroundTaskSettings/UpdateBackgroundTaskSettingsRepository.js +67 -0
- package/api/features/UpdateBackgroundTaskSettings/UpdateBackgroundTaskSettingsRepository.js.map +1 -0
- package/api/features/UpdateBackgroundTaskSettings/UpdateBackgroundTaskSettingsUseCase.d.ts +14 -0
- package/api/features/UpdateBackgroundTaskSettings/UpdateBackgroundTaskSettingsUseCase.js +27 -0
- package/api/features/UpdateBackgroundTaskSettings/UpdateBackgroundTaskSettingsUseCase.js.map +1 -0
- package/api/features/UpdateBackgroundTaskSettings/abstractions.d.ts +26 -0
- package/api/features/UpdateBackgroundTaskSettings/abstractions.js +6 -0
- package/api/features/UpdateBackgroundTaskSettings/abstractions.js.map +1 -0
- package/api/features/UpdateBackgroundTaskSettings/feature.d.ts +4 -0
- package/api/features/UpdateBackgroundTaskSettings/feature.js +13 -0
- package/api/features/UpdateBackgroundTaskSettings/feature.js.map +1 -0
- package/api/features/UpdateBackgroundTaskSettings/index.d.ts +2 -0
- package/api/features/UpdateBackgroundTaskSettings/index.js +2 -0
- package/api/features/UpdateBackgroundTaskSettings/schema.d.ts +4 -0
- package/api/features/UpdateBackgroundTaskSettings/schema.js +8 -0
- package/api/features/UpdateBackgroundTaskSettings/schema.js.map +1 -0
- 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/global.d.ts +1 -0
- package/api/global.js +1 -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.d.ts +7 -0
- package/api/graphql/checkPermissions.js +22 -0
- package/api/graphql/checkPermissions.js.map +1 -0
- package/api/graphql/utils.d.ts +9 -0
- package/api/graphql/utils.js +20 -0
- package/api/graphql/utils.js.map +1 -0
- package/api/handler/types.d.ts +21 -0
- package/api/handler/types.js +0 -0
- package/api/index.d.ts +21 -0
- package/api/index.js +20 -0
- package/api/models/BackgroundTaskSettingsModel.d.ts +8 -0
- package/api/models/BackgroundTaskSettingsModel.js +27 -0
- package/api/models/BackgroundTaskSettingsModel.js.map +1 -0
- package/api/permissions.d.ts +12 -0
- package/api/permissions.js +22 -0
- package/api/permissions.js.map +1 -0
- package/api/response/DatabaseResponse.d.ts +12 -0
- package/api/response/DatabaseResponse.js +127 -0
- package/api/response/DatabaseResponse.js.map +1 -0
- package/api/response/Response.d.ts +14 -0
- package/api/response/Response.js +91 -0
- package/api/response/Response.js.map +1 -0
- package/api/response/ResponseAbortedResult.d.ts +9 -0
- package/api/response/ResponseAbortedResult.js +12 -0
- package/api/response/ResponseAbortedResult.js.map +1 -0
- package/api/response/ResponseContinueResult.d.ts +17 -0
- package/api/response/ResponseContinueResult.js +16 -0
- package/api/response/ResponseContinueResult.js.map +1 -0
- package/api/response/ResponseDoneResult.d.ts +11 -0
- package/api/response/ResponseDoneResult.js +14 -0
- package/api/response/ResponseDoneResult.js.map +1 -0
- package/api/response/ResponseErrorResult.d.ts +10 -0
- package/api/response/ResponseErrorResult.js +13 -0
- package/api/response/ResponseErrorResult.js.map +1 -0
- package/api/response/TaskResponse.d.ts +12 -0
- package/api/response/TaskResponse.js +53 -0
- package/api/response/TaskResponse.js.map +1 -0
- package/api/response/abstractions/Response.d.ts +25 -0
- package/api/response/abstractions/Response.js +0 -0
- package/api/response/abstractions/ResponseAbortedResult.d.ts +5 -0
- package/api/response/abstractions/ResponseAbortedResult.js +0 -0
- package/api/response/abstractions/ResponseBaseResult.d.ts +7 -0
- package/api/response/abstractions/ResponseBaseResult.js +0 -0
- package/api/response/abstractions/ResponseContinueResult.d.ts +21 -0
- package/api/response/abstractions/ResponseContinueResult.js +0 -0
- package/api/response/abstractions/ResponseDoneResult.d.ts +13 -0
- package/api/response/abstractions/ResponseDoneResult.js +0 -0
- package/api/response/abstractions/ResponseErrorResult.d.ts +18 -0
- package/api/response/abstractions/ResponseErrorResult.js +0 -0
- package/api/response/abstractions/TaskResponse.d.ts +16 -0
- package/api/response/abstractions/TaskResponse.js +0 -0
- package/api/response/abstractions/index.d.ts +7 -0
- package/api/response/abstractions/index.js +7 -0
- package/api/response/index.d.ts +7 -0
- package/api/response/index.js +7 -0
- package/api/runner/TaskControl.d.ts +48 -0
- package/api/runner/TaskControl.js +186 -0
- package/api/runner/TaskControl.js.map +1 -0
- package/api/runner/TaskEventValidation.d.ts +5 -0
- package/api/runner/TaskEventValidation.js +20 -0
- package/api/runner/TaskEventValidation.js.map +1 -0
- package/api/runner/TaskManager.d.ts +22 -0
- package/api/runner/TaskManager.js +83 -0
- package/api/runner/TaskManager.js.map +1 -0
- package/api/runner/TaskManagerStore.d.ts +57 -0
- package/api/runner/TaskManagerStore.js +127 -0
- package/api/runner/TaskManagerStore.js.map +1 -0
- package/api/runner/TaskRunner.d.ts +25 -0
- package/api/runner/TaskRunner.js +86 -0
- package/api/runner/TaskRunner.js.map +1 -0
- package/api/runner/abstractions/TaskControl.d.ts +10 -0
- package/api/runner/abstractions/TaskControl.js +0 -0
- package/api/runner/abstractions/TaskEventValidation.d.ts +5 -0
- package/api/runner/abstractions/TaskEventValidation.js +0 -0
- package/api/runner/abstractions/TaskManager.d.ts +5 -0
- package/api/runner/abstractions/TaskManager.js +0 -0
- package/api/runner/abstractions/TaskManagerStore.d.ts +92 -0
- package/api/runner/abstractions/TaskManagerStore.js +0 -0
- package/api/runner/abstractions/TaskRunner.d.ts +13 -0
- package/api/runner/abstractions/TaskRunner.js +0 -0
- package/api/runner/abstractions/index.d.ts +5 -0
- package/api/runner/abstractions/index.js +5 -0
- package/api/runner/index.d.ts +1 -0
- package/api/runner/index.js +1 -0
- package/api/tasks/testingRunTask.d.ts +19 -0
- package/api/tasks/testingRunTask.js +25 -0
- package/api/tasks/testingRunTask.js.map +1 -0
- package/api/types.d.ts +120 -0
- package/api/types.js +20 -0
- package/api/types.js.map +1 -0
- package/api/utils/ObjectUpdater.d.ts +8 -0
- package/api/utils/ObjectUpdater.js +33 -0
- package/api/utils/ObjectUpdater.js.map +1 -0
- package/api/utils/getErrorProperties.d.ts +2 -0
- package/api/utils/getErrorProperties.js +9 -0
- package/api/utils/getErrorProperties.js.map +1 -0
- package/api/utils/getObjectProperties.d.ts +8 -0
- package/api/utils/getObjectProperties.js +11 -0
- package/api/utils/getObjectProperties.js.map +1 -0
- package/api/utils/index.d.ts +3 -0
- package/api/utils/index.js +3 -0
- package/api/utils/normalizeSelfCleanup.d.ts +2 -0
- package/api/utils/normalizeSelfCleanup.js +16 -0
- package/api/utils/normalizeSelfCleanup.js.map +1 -0
- package/index.d.ts +2 -0
- package/index.js +2 -0
- package/package.json +65 -0
- 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
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { Result } from "@webiny/feature/api";
|
|
2
|
+
import { EventPublisher } from "@webiny/api-core/features/eventPublisher/index.js";
|
|
3
|
+
import { DeleteTaskUseCase as UseCaseAbstraction } from "./abstractions.js";
|
|
4
|
+
import { TasksRepository } from "../../../api/domain/task/abstractions.js";
|
|
5
|
+
declare class DeleteTaskUseCaseImpl implements UseCaseAbstraction.Interface {
|
|
6
|
+
private readonly eventPublisher;
|
|
7
|
+
private readonly repository;
|
|
8
|
+
constructor(eventPublisher: EventPublisher.Interface, repository: TasksRepository.Interface);
|
|
9
|
+
execute(id: string): Promise<Result<void, UseCaseAbstraction.Error>>;
|
|
10
|
+
}
|
|
11
|
+
export declare const DeleteTaskUseCase: typeof DeleteTaskUseCaseImpl & {
|
|
12
|
+
__abstraction: import("@webiny/di").Abstraction<import("./abstractions.js").IDeleteTaskUseCase>;
|
|
13
|
+
};
|
|
14
|
+
export {};
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { Result } from "@webiny/feature/api";
|
|
2
|
+
import { EventPublisher } from "@webiny/api-core/features/eventPublisher/index.js";
|
|
3
|
+
import { DeleteTaskUseCase } from "./abstractions.js";
|
|
4
|
+
import { TasksRepository } from "../../domain/task/abstractions.js";
|
|
5
|
+
import { TaskAfterDeleteEvent, TaskBeforeDeleteEvent } from "../../events/index.js";
|
|
6
|
+
class DeleteTaskUseCaseImpl {
|
|
7
|
+
constructor(eventPublisher, repository){
|
|
8
|
+
this.eventPublisher = eventPublisher;
|
|
9
|
+
this.repository = repository;
|
|
10
|
+
}
|
|
11
|
+
async execute(id) {
|
|
12
|
+
const task = await this.repository.get(id);
|
|
13
|
+
if (task.isFail()) return Result.fail(task.error);
|
|
14
|
+
await this.eventPublisher.publish(new TaskBeforeDeleteEvent({
|
|
15
|
+
task: task.value
|
|
16
|
+
}));
|
|
17
|
+
const result = await this.repository.delete(id);
|
|
18
|
+
if (result.isFail()) return Result.fail(result.error);
|
|
19
|
+
await this.eventPublisher.publish(new TaskAfterDeleteEvent({
|
|
20
|
+
task: task.value
|
|
21
|
+
}));
|
|
22
|
+
return Result.ok();
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
const DeleteTaskUseCase_DeleteTaskUseCase = DeleteTaskUseCase.createImplementation({
|
|
26
|
+
implementation: DeleteTaskUseCaseImpl,
|
|
27
|
+
dependencies: [
|
|
28
|
+
EventPublisher,
|
|
29
|
+
TasksRepository
|
|
30
|
+
]
|
|
31
|
+
});
|
|
32
|
+
export { DeleteTaskUseCase_DeleteTaskUseCase as DeleteTaskUseCase };
|
|
33
|
+
|
|
34
|
+
//# sourceMappingURL=DeleteTaskUseCase.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"api/features/DeleteTask/DeleteTaskUseCase.js","sources":["../../../../src/api/features/DeleteTask/DeleteTaskUseCase.ts"],"sourcesContent":["import { Result } from \"@webiny/feature/api\";\nimport { EventPublisher } from \"@webiny/api-core/features/eventPublisher/index.js\";\nimport { DeleteTaskUseCase as UseCaseAbstraction } from \"./abstractions.js\";\nimport { TasksRepository } from \"~/api/domain/task/abstractions.js\";\nimport { TaskAfterDeleteEvent, TaskBeforeDeleteEvent } from \"~/api/events/index.js\";\n\nclass DeleteTaskUseCaseImpl implements UseCaseAbstraction.Interface {\n constructor(\n private readonly eventPublisher: EventPublisher.Interface,\n private readonly repository: TasksRepository.Interface\n ) {}\n\n async execute(id: string): Promise<Result<void, UseCaseAbstraction.Error>> {\n const task = await this.repository.get(id);\n if (task.isFail()) {\n return Result.fail(task.error);\n }\n\n await this.eventPublisher.publish(new TaskBeforeDeleteEvent({ task: task.value }));\n\n const result = await this.repository.delete(id);\n if (result.isFail()) {\n return Result.fail(result.error);\n }\n\n await this.eventPublisher.publish(new TaskAfterDeleteEvent({ task: task.value }));\n\n return Result.ok();\n }\n}\n\nexport const DeleteTaskUseCase = UseCaseAbstraction.createImplementation({\n implementation: DeleteTaskUseCaseImpl,\n dependencies: [EventPublisher, TasksRepository]\n});\n"],"names":["DeleteTaskUseCaseImpl","eventPublisher","repository","id","task","Result","TaskBeforeDeleteEvent","result","TaskAfterDeleteEvent","DeleteTaskUseCase","UseCaseAbstraction","EventPublisher","TasksRepository"],"mappings":";;;;;AAMA,MAAMA;IACF,YACqBC,cAAwC,EACxCC,UAAqC,CACxD;aAFmBD,cAAc,GAAdA;aACAC,UAAU,GAAVA;IAClB;IAEH,MAAM,QAAQC,EAAU,EAAmD;QACvE,MAAMC,OAAO,MAAM,IAAI,CAAC,UAAU,CAAC,GAAG,CAACD;QACvC,IAAIC,KAAK,MAAM,IACX,OAAOC,OAAO,IAAI,CAACD,KAAK,KAAK;QAGjC,MAAM,IAAI,CAAC,cAAc,CAAC,OAAO,CAAC,IAAIE,sBAAsB;YAAE,MAAMF,KAAK,KAAK;QAAC;QAE/E,MAAMG,SAAS,MAAM,IAAI,CAAC,UAAU,CAAC,MAAM,CAACJ;QAC5C,IAAII,OAAO,MAAM,IACb,OAAOF,OAAO,IAAI,CAACE,OAAO,KAAK;QAGnC,MAAM,IAAI,CAAC,cAAc,CAAC,OAAO,CAAC,IAAIC,qBAAqB;YAAE,MAAMJ,KAAK,KAAK;QAAC;QAE9E,OAAOC,OAAO,EAAE;IACpB;AACJ;AAEO,MAAMI,sCAAoBC,kBAAAA,oBAAuC,CAAC;IACrE,gBAAgBV;IAChB,cAAc;QAACW;QAAgBC;KAAgB;AACnD"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { type Result } from "@webiny/feature/api";
|
|
2
|
+
import type { BackgroundTaskPersistenceError, TaskNotFoundError } from "../../../api/domain/errors.js";
|
|
3
|
+
export interface IDeleteTaskUseCase {
|
|
4
|
+
execute(id: string): Promise<Result<void, UseCaseError>>;
|
|
5
|
+
}
|
|
6
|
+
export interface IDeleteTaskUseCaseErrors {
|
|
7
|
+
notFound: TaskNotFoundError;
|
|
8
|
+
persistence: BackgroundTaskPersistenceError;
|
|
9
|
+
}
|
|
10
|
+
type UseCaseError = IDeleteTaskUseCaseErrors[keyof IDeleteTaskUseCaseErrors];
|
|
11
|
+
/** Delete a single stored task. Its logs and child tasks stay; see CleanupTaskSubtreeUseCase. */
|
|
12
|
+
export declare const DeleteTaskUseCase: import("@webiny/di").Abstraction<IDeleteTaskUseCase>;
|
|
13
|
+
export declare namespace DeleteTaskUseCase {
|
|
14
|
+
type Interface = IDeleteTaskUseCase;
|
|
15
|
+
type Error = UseCaseError;
|
|
16
|
+
}
|
|
17
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"api/features/DeleteTask/abstractions.js","sources":["../../../../src/api/features/DeleteTask/abstractions.ts"],"sourcesContent":["import { createAbstraction, type Result } from \"@webiny/feature/api\";\nimport type { BackgroundTaskPersistenceError, TaskNotFoundError } from \"~/api/domain/errors.js\";\n\nexport interface IDeleteTaskUseCase {\n execute(id: string): Promise<Result<void, UseCaseError>>;\n}\n\nexport interface IDeleteTaskUseCaseErrors {\n notFound: TaskNotFoundError;\n persistence: BackgroundTaskPersistenceError;\n}\n\ntype UseCaseError = IDeleteTaskUseCaseErrors[keyof IDeleteTaskUseCaseErrors];\n\n/** Delete a single stored task. Its logs and child tasks stay; see CleanupTaskSubtreeUseCase. */\nexport const DeleteTaskUseCase = createAbstraction<IDeleteTaskUseCase>(\"Tasks/DeleteTaskUseCase\");\n\nexport namespace DeleteTaskUseCase {\n export type Interface = IDeleteTaskUseCase;\n export type Error = UseCaseError;\n}\n"],"names":["DeleteTaskUseCase","createAbstraction"],"mappings":";AAeO,MAAMA,oBAAoBC,kBAAsC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { createFeature } from "@webiny/feature/api";
|
|
2
|
+
import { DeleteTaskUseCase } from "./DeleteTaskUseCase.js";
|
|
3
|
+
const DeleteTaskFeature = createFeature({
|
|
4
|
+
name: "DeleteTask",
|
|
5
|
+
register (container) {
|
|
6
|
+
container.register(DeleteTaskUseCase);
|
|
7
|
+
}
|
|
8
|
+
});
|
|
9
|
+
export { DeleteTaskFeature };
|
|
10
|
+
|
|
11
|
+
//# sourceMappingURL=feature.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"api/features/DeleteTask/feature.js","sources":["../../../../src/api/features/DeleteTask/feature.ts"],"sourcesContent":["import { createFeature } from \"@webiny/feature/api\";\nimport { DeleteTaskUseCase } from \"./DeleteTaskUseCase.js\";\n\nexport const DeleteTaskFeature = createFeature({\n name: \"DeleteTask\",\n register(container) {\n container.register(DeleteTaskUseCase);\n }\n});\n"],"names":["DeleteTaskFeature","createFeature","container","DeleteTaskUseCase"],"mappings":";;AAGO,MAAMA,oBAAoBC,cAAc;IAC3C,MAAM;IACN,UAASC,SAAS;QACdA,UAAU,QAAQ,CAACC;IACvB;AACJ"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { DeleteTaskLogUseCase as UseCaseAbstraction } from "./abstractions.js";
|
|
2
|
+
import { TaskLogsRepository } from "../../../api/domain/task/abstractions.js";
|
|
3
|
+
declare class DeleteTaskLogUseCaseImpl implements UseCaseAbstraction.Interface {
|
|
4
|
+
private readonly repository;
|
|
5
|
+
constructor(repository: TaskLogsRepository.Interface);
|
|
6
|
+
execute(id: string): Promise<import("@webiny/feature/api/Result.js").Result<void, import("../../domain/errors.js").BackgroundTaskPersistenceError | import("../../domain/errors.js").TaskLogNotFoundError>>;
|
|
7
|
+
}
|
|
8
|
+
export declare const DeleteTaskLogUseCase: typeof DeleteTaskLogUseCaseImpl & {
|
|
9
|
+
__abstraction: import("@webiny/di").Abstraction<import("./abstractions.js").IDeleteTaskLogUseCase>;
|
|
10
|
+
};
|
|
11
|
+
export {};
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { DeleteTaskLogUseCase } from "./abstractions.js";
|
|
2
|
+
import { TaskLogsRepository } from "../../domain/task/abstractions.js";
|
|
3
|
+
class DeleteTaskLogUseCaseImpl {
|
|
4
|
+
constructor(repository){
|
|
5
|
+
this.repository = repository;
|
|
6
|
+
}
|
|
7
|
+
execute(id) {
|
|
8
|
+
return this.repository.delete(id);
|
|
9
|
+
}
|
|
10
|
+
}
|
|
11
|
+
const DeleteTaskLogUseCase_DeleteTaskLogUseCase = DeleteTaskLogUseCase.createImplementation({
|
|
12
|
+
implementation: DeleteTaskLogUseCaseImpl,
|
|
13
|
+
dependencies: [
|
|
14
|
+
TaskLogsRepository
|
|
15
|
+
]
|
|
16
|
+
});
|
|
17
|
+
export { DeleteTaskLogUseCase_DeleteTaskLogUseCase as DeleteTaskLogUseCase };
|
|
18
|
+
|
|
19
|
+
//# sourceMappingURL=DeleteTaskLogUseCase.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"api/features/DeleteTaskLog/DeleteTaskLogUseCase.js","sources":["../../../../src/api/features/DeleteTaskLog/DeleteTaskLogUseCase.ts"],"sourcesContent":["import { DeleteTaskLogUseCase as UseCaseAbstraction } from \"./abstractions.js\";\nimport { TaskLogsRepository } from \"~/api/domain/task/abstractions.js\";\n\nclass DeleteTaskLogUseCaseImpl implements UseCaseAbstraction.Interface {\n constructor(private readonly repository: TaskLogsRepository.Interface) {}\n\n execute(id: string) {\n return this.repository.delete(id);\n }\n}\n\nexport const DeleteTaskLogUseCase = UseCaseAbstraction.createImplementation({\n implementation: DeleteTaskLogUseCaseImpl,\n dependencies: [TaskLogsRepository]\n});\n"],"names":["DeleteTaskLogUseCaseImpl","repository","id","DeleteTaskLogUseCase","UseCaseAbstraction","TaskLogsRepository"],"mappings":";;AAGA,MAAMA;IACF,YAA6BC,UAAwC,CAAE;aAA1CA,UAAU,GAAVA;IAA2C;IAExE,QAAQC,EAAU,EAAE;QAChB,OAAO,IAAI,CAAC,UAAU,CAAC,MAAM,CAACA;IAClC;AACJ;AAEO,MAAMC,4CAAuBC,qBAAAA,oBAAuC,CAAC;IACxE,gBAAgBJ;IAChB,cAAc;QAACK;KAAmB;AACtC"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { Result } from "@webiny/feature/api";
|
|
2
|
+
import type { BackgroundTaskPersistenceError } from "../../../api/domain/errors.js";
|
|
3
|
+
import type { TaskLogNotFoundError } from "../../../api/domain/errors.js";
|
|
4
|
+
type UseCaseError = TaskLogNotFoundError | BackgroundTaskPersistenceError;
|
|
5
|
+
export interface IDeleteTaskLogUseCase {
|
|
6
|
+
execute(id: string): Promise<Result<void, UseCaseError>>;
|
|
7
|
+
}
|
|
8
|
+
/** Delete a task log. */
|
|
9
|
+
export declare const DeleteTaskLogUseCase: import("@webiny/di").Abstraction<IDeleteTaskLogUseCase>;
|
|
10
|
+
export declare namespace DeleteTaskLogUseCase {
|
|
11
|
+
type Interface = IDeleteTaskLogUseCase;
|
|
12
|
+
type Error = UseCaseError;
|
|
13
|
+
}
|
|
14
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"api/features/DeleteTaskLog/abstractions.js","sources":["../../../../src/api/features/DeleteTaskLog/abstractions.ts"],"sourcesContent":["import { createAbstraction } from \"@webiny/feature/api\";\nimport type { Result } from \"@webiny/feature/api\";\n\nimport type { BackgroundTaskPersistenceError } from \"~/api/domain/errors.js\";\nimport type { TaskLogNotFoundError } from \"~/api/domain/errors.js\";\n\ntype UseCaseError = TaskLogNotFoundError | BackgroundTaskPersistenceError;\n\nexport interface IDeleteTaskLogUseCase {\n execute(id: string): Promise<Result<void, UseCaseError>>;\n}\n\n/** Delete a task log. */\nexport const DeleteTaskLogUseCase = createAbstraction<IDeleteTaskLogUseCase>(\n \"Tasks/DeleteTaskLogUseCase\"\n);\n\nexport namespace DeleteTaskLogUseCase {\n export type Interface = IDeleteTaskLogUseCase;\n export type Error = UseCaseError;\n}\n"],"names":["DeleteTaskLogUseCase","createAbstraction"],"mappings":";AAaO,MAAMA,uBAAuBC,kBAChC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { createFeature } from "@webiny/feature/api";
|
|
2
|
+
import { DeleteTaskLogUseCase } from "./DeleteTaskLogUseCase.js";
|
|
3
|
+
const DeleteTaskLogFeature = createFeature({
|
|
4
|
+
name: "DeleteTaskLog",
|
|
5
|
+
register (container) {
|
|
6
|
+
container.register(DeleteTaskLogUseCase);
|
|
7
|
+
}
|
|
8
|
+
});
|
|
9
|
+
export { DeleteTaskLogFeature };
|
|
10
|
+
|
|
11
|
+
//# sourceMappingURL=feature.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"api/features/DeleteTaskLog/feature.js","sources":["../../../../src/api/features/DeleteTaskLog/feature.ts"],"sourcesContent":["import { createFeature } from \"@webiny/feature/api\";\nimport { DeleteTaskLogUseCase } from \"./DeleteTaskLogUseCase.js\";\n\nexport const DeleteTaskLogFeature = createFeature({\n name: \"DeleteTaskLog\",\n register(container) {\n container.register(DeleteTaskLogUseCase);\n }\n});\n"],"names":["DeleteTaskLogFeature","createFeature","container","DeleteTaskLogUseCase"],"mappings":";;AAGO,MAAMA,uBAAuBC,cAAc;IAC9C,MAAM;IACN,UAASC,SAAS;QACdA,UAAU,QAAQ,CAACC;IACvB;AACJ"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { Result } from "@webiny/feature/api";
|
|
2
|
+
import { GetModelRepository } from "@webiny/api-headless-cms/features/contentModel/GetModel/index.js";
|
|
3
|
+
import { GetLatestRevisionByEntryIdRepository } from "@webiny/api-headless-cms/features/contentEntry/GetLatestRevisionByEntryId/index.js";
|
|
4
|
+
import { CreateEntryRepository } from "@webiny/api-headless-cms/features/contentEntry/CreateEntry/index.js";
|
|
5
|
+
import { CreateEntryDataFactory } from "@webiny/api-headless-cms/exports/api/cms/entry.js";
|
|
6
|
+
import { BuildParams } from "@webiny/api-core/features/buildParams/index.js";
|
|
7
|
+
import { GetBackgroundTaskSettingsRepository as RepositoryAbstraction } from "./abstractions.js";
|
|
8
|
+
import type { IBackgroundTaskSettings } from "../../../api/domain/BackgroundTaskSettings.js";
|
|
9
|
+
declare class GetBackgroundTaskSettingsRepositoryImpl implements RepositoryAbstraction.Interface {
|
|
10
|
+
private readonly getModelRepository;
|
|
11
|
+
private readonly getLatestRevisionRepository;
|
|
12
|
+
private readonly createEntryRepository;
|
|
13
|
+
private readonly createEntryDataFactory;
|
|
14
|
+
private readonly defaultRetentionDays;
|
|
15
|
+
constructor(getModelRepository: GetModelRepository.Interface, getLatestRevisionRepository: GetLatestRevisionByEntryIdRepository.Interface, createEntryRepository: CreateEntryRepository.Interface, createEntryDataFactory: CreateEntryDataFactory.Interface, buildParams: BuildParams.Interface);
|
|
16
|
+
execute(): Promise<Result<IBackgroundTaskSettings, RepositoryAbstraction.Error>>;
|
|
17
|
+
}
|
|
18
|
+
export declare const GetBackgroundTaskSettingsRepository: typeof GetBackgroundTaskSettingsRepositoryImpl & {
|
|
19
|
+
__abstraction: import("@webiny/di").Abstraction<import("./abstractions.js").IGetBackgroundTaskSettingsRepository>;
|
|
20
|
+
};
|
|
21
|
+
export {};
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import { Result } from "@webiny/feature/api";
|
|
2
|
+
import { createCacheKey } from "@webiny/utils";
|
|
3
|
+
import { GetModelRepository } from "@webiny/api-headless-cms/features/contentModel/GetModel/index.js";
|
|
4
|
+
import { GetLatestRevisionByEntryIdRepository } from "@webiny/api-headless-cms/features/contentEntry/GetLatestRevisionByEntryId/index.js";
|
|
5
|
+
import { CreateEntryRepository } from "@webiny/api-headless-cms/features/contentEntry/CreateEntry/index.js";
|
|
6
|
+
import { CreateEntryDataFactory } from "@webiny/api-headless-cms/exports/api/cms/entry.js";
|
|
7
|
+
import { BuildParams } from "@webiny/api-core/features/buildParams/index.js";
|
|
8
|
+
import { GetBackgroundTaskSettingsRepository } from "./abstractions.js";
|
|
9
|
+
import { BackgroundTaskModelNotFoundError, BackgroundTaskPersistenceError } from "../../domain/errors.js";
|
|
10
|
+
import { BACKGROUND_TASK_DEFAULT_RETENTION_DAYS, BACKGROUND_TASK_SETTINGS_MODEL_ID } from "../../domain/constants.js";
|
|
11
|
+
class GetBackgroundTaskSettingsRepositoryImpl {
|
|
12
|
+
constructor(getModelRepository, getLatestRevisionRepository, createEntryRepository, createEntryDataFactory, buildParams){
|
|
13
|
+
this.getModelRepository = getModelRepository;
|
|
14
|
+
this.getLatestRevisionRepository = getLatestRevisionRepository;
|
|
15
|
+
this.createEntryRepository = createEntryRepository;
|
|
16
|
+
this.createEntryDataFactory = createEntryDataFactory;
|
|
17
|
+
this.defaultRetentionDays = buildParams.get("BackgroundTasks.RetentionDays") || BACKGROUND_TASK_DEFAULT_RETENTION_DAYS;
|
|
18
|
+
}
|
|
19
|
+
async execute() {
|
|
20
|
+
try {
|
|
21
|
+
const modelResult = await this.getModelRepository.execute(BACKGROUND_TASK_SETTINGS_MODEL_ID);
|
|
22
|
+
if (modelResult.isFail()) return Result.fail(new BackgroundTaskModelNotFoundError(BACKGROUND_TASK_SETTINGS_MODEL_ID));
|
|
23
|
+
const model = modelResult.value;
|
|
24
|
+
const singletonId = createCacheKey(model.modelId);
|
|
25
|
+
const entryId = `${singletonId}#0001`;
|
|
26
|
+
const entryResult = await this.getLatestRevisionRepository.execute(model, {
|
|
27
|
+
id: entryId
|
|
28
|
+
});
|
|
29
|
+
if (entryResult.isOk()) {
|
|
30
|
+
const retentionDays = null != entryResult.value.values.retentionDays ? entryResult.value.values.retentionDays : this.defaultRetentionDays;
|
|
31
|
+
return Result.ok({
|
|
32
|
+
retentionDays
|
|
33
|
+
});
|
|
34
|
+
}
|
|
35
|
+
const { entry } = await this.createEntryDataFactory.create(model, {
|
|
36
|
+
id: singletonId,
|
|
37
|
+
values: {
|
|
38
|
+
retentionDays: this.defaultRetentionDays
|
|
39
|
+
}
|
|
40
|
+
});
|
|
41
|
+
const createResult = await this.createEntryRepository.execute(model, entry);
|
|
42
|
+
if (createResult.isFail()) return Result.fail(BackgroundTaskPersistenceError.from(createResult.error));
|
|
43
|
+
return Result.ok({
|
|
44
|
+
retentionDays: this.defaultRetentionDays
|
|
45
|
+
});
|
|
46
|
+
} catch (error) {
|
|
47
|
+
return Result.fail(BackgroundTaskPersistenceError.from(error));
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
const GetBackgroundTaskSettingsRepository_GetBackgroundTaskSettingsRepository = GetBackgroundTaskSettingsRepository.createImplementation({
|
|
52
|
+
implementation: GetBackgroundTaskSettingsRepositoryImpl,
|
|
53
|
+
dependencies: [
|
|
54
|
+
GetModelRepository,
|
|
55
|
+
GetLatestRevisionByEntryIdRepository,
|
|
56
|
+
CreateEntryRepository,
|
|
57
|
+
CreateEntryDataFactory,
|
|
58
|
+
BuildParams
|
|
59
|
+
]
|
|
60
|
+
});
|
|
61
|
+
export { GetBackgroundTaskSettingsRepository_GetBackgroundTaskSettingsRepository as GetBackgroundTaskSettingsRepository };
|
|
62
|
+
|
|
63
|
+
//# sourceMappingURL=GetBackgroundTaskSettingsRepository.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"api/features/GetBackgroundTaskSettings/GetBackgroundTaskSettingsRepository.js","sources":["../../../../src/api/features/GetBackgroundTaskSettings/GetBackgroundTaskSettingsRepository.ts"],"sourcesContent":["import { Result } from \"@webiny/feature/api\";\nimport { createCacheKey } from \"@webiny/utils\";\nimport { GetModelRepository } from \"@webiny/api-headless-cms/features/contentModel/GetModel/index.js\";\nimport { GetLatestRevisionByEntryIdRepository } from \"@webiny/api-headless-cms/features/contentEntry/GetLatestRevisionByEntryId/index.js\";\nimport { CreateEntryRepository } from \"@webiny/api-headless-cms/features/contentEntry/CreateEntry/index.js\";\nimport { CreateEntryDataFactory } from \"@webiny/api-headless-cms/exports/api/cms/entry.js\";\nimport { BuildParams } from \"@webiny/api-core/features/buildParams/index.js\";\nimport { GetBackgroundTaskSettingsRepository as RepositoryAbstraction } from \"./abstractions.js\";\nimport {\n BackgroundTaskModelNotFoundError,\n BackgroundTaskPersistenceError\n} from \"~/api/domain/errors.js\";\nimport {\n BACKGROUND_TASK_SETTINGS_MODEL_ID,\n BACKGROUND_TASK_DEFAULT_RETENTION_DAYS\n} from \"~/api/domain/constants.js\";\nimport type { IBackgroundTaskSettings } from \"~/api/domain/BackgroundTaskSettings.js\";\n\ninterface BackgroundTaskSettingsValues {\n retentionDays?: number;\n}\n\nclass GetBackgroundTaskSettingsRepositoryImpl implements RepositoryAbstraction.Interface {\n private readonly defaultRetentionDays: number;\n\n constructor(\n private readonly getModelRepository: GetModelRepository.Interface,\n private readonly getLatestRevisionRepository: GetLatestRevisionByEntryIdRepository.Interface,\n private readonly createEntryRepository: CreateEntryRepository.Interface,\n private readonly createEntryDataFactory: CreateEntryDataFactory.Interface,\n buildParams: BuildParams.Interface\n ) {\n this.defaultRetentionDays =\n buildParams.get<number>(\"BackgroundTasks.RetentionDays\") ||\n BACKGROUND_TASK_DEFAULT_RETENTION_DAYS;\n }\n\n async execute(): Promise<Result<IBackgroundTaskSettings, RepositoryAbstraction.Error>> {\n try {\n const modelResult = await this.getModelRepository.execute(\n BACKGROUND_TASK_SETTINGS_MODEL_ID\n );\n if (modelResult.isFail()) {\n return Result.fail(\n new BackgroundTaskModelNotFoundError(BACKGROUND_TASK_SETTINGS_MODEL_ID)\n );\n }\n\n const model = modelResult.value;\n const singletonId = createCacheKey(model.modelId);\n const entryId = `${singletonId}#0001`;\n\n const entryResult =\n await this.getLatestRevisionRepository.execute<BackgroundTaskSettingsValues>(\n model,\n { id: entryId }\n );\n\n if (entryResult.isOk()) {\n const retentionDays =\n entryResult.value.values.retentionDays != null\n ? entryResult.value.values.retentionDays\n : this.defaultRetentionDays;\n\n return Result.ok({ retentionDays });\n }\n\n /* Entry doesn't exist yet — create it with the build-param default. */\n const { entry } =\n await this.createEntryDataFactory.create<BackgroundTaskSettingsValues>(model, {\n id: singletonId,\n values: {\n retentionDays: this.defaultRetentionDays\n }\n });\n\n const createResult = await this.createEntryRepository.execute(model, entry);\n if (createResult.isFail()) {\n return Result.fail(BackgroundTaskPersistenceError.from(createResult.error));\n }\n\n return Result.ok({ retentionDays: this.defaultRetentionDays });\n } catch (error) {\n return Result.fail(BackgroundTaskPersistenceError.from(error));\n }\n }\n}\n\nexport const GetBackgroundTaskSettingsRepository = RepositoryAbstraction.createImplementation({\n implementation: GetBackgroundTaskSettingsRepositoryImpl,\n dependencies: [\n GetModelRepository,\n GetLatestRevisionByEntryIdRepository,\n CreateEntryRepository,\n CreateEntryDataFactory,\n BuildParams\n ]\n});\n"],"names":["GetBackgroundTaskSettingsRepositoryImpl","getModelRepository","getLatestRevisionRepository","createEntryRepository","createEntryDataFactory","buildParams","BACKGROUND_TASK_DEFAULT_RETENTION_DAYS","modelResult","BACKGROUND_TASK_SETTINGS_MODEL_ID","Result","BackgroundTaskModelNotFoundError","model","singletonId","createCacheKey","entryId","entryResult","retentionDays","entry","createResult","BackgroundTaskPersistenceError","error","GetBackgroundTaskSettingsRepository","RepositoryAbstraction","GetModelRepository","GetLatestRevisionByEntryIdRepository","CreateEntryRepository","CreateEntryDataFactory","BuildParams"],"mappings":";;;;;;;;;;AAsBA,MAAMA;IAGF,YACqBC,kBAAgD,EAChDC,2BAA2E,EAC3EC,qBAAsD,EACtDC,sBAAwD,EACzEC,WAAkC,CACpC;aALmBJ,kBAAkB,GAAlBA;aACAC,2BAA2B,GAA3BA;aACAC,qBAAqB,GAArBA;aACAC,sBAAsB,GAAtBA;QAGjB,IAAI,CAAC,oBAAoB,GACrBC,YAAY,GAAG,CAAS,oCACxBC;IACR;IAEA,MAAM,UAAiF;QACnF,IAAI;YACA,MAAMC,cAAc,MAAM,IAAI,CAAC,kBAAkB,CAAC,OAAO,CACrDC;YAEJ,IAAID,YAAY,MAAM,IAClB,OAAOE,OAAO,IAAI,CACd,IAAIC,iCAAiCF;YAI7C,MAAMG,QAAQJ,YAAY,KAAK;YAC/B,MAAMK,cAAcC,eAAeF,MAAM,OAAO;YAChD,MAAMG,UAAU,GAAGF,YAAY,KAAK,CAAC;YAErC,MAAMG,cACF,MAAM,IAAI,CAAC,2BAA2B,CAAC,OAAO,CAC1CJ,OACA;gBAAE,IAAIG;YAAQ;YAGtB,IAAIC,YAAY,IAAI,IAAI;gBACpB,MAAMC,gBACFD,AAA0C,QAA1CA,YAAY,KAAK,CAAC,MAAM,CAAC,aAAa,GAChCA,YAAY,KAAK,CAAC,MAAM,CAAC,aAAa,GACtC,IAAI,CAAC,oBAAoB;gBAEnC,OAAON,OAAO,EAAE,CAAC;oBAAEO;gBAAc;YACrC;YAGA,MAAM,EAAEC,KAAK,EAAE,GACX,MAAM,IAAI,CAAC,sBAAsB,CAAC,MAAM,CAA+BN,OAAO;gBAC1E,IAAIC;gBACJ,QAAQ;oBACJ,eAAe,IAAI,CAAC,oBAAoB;gBAC5C;YACJ;YAEJ,MAAMM,eAAe,MAAM,IAAI,CAAC,qBAAqB,CAAC,OAAO,CAACP,OAAOM;YACrE,IAAIC,aAAa,MAAM,IACnB,OAAOT,OAAO,IAAI,CAACU,+BAA+B,IAAI,CAACD,aAAa,KAAK;YAG7E,OAAOT,OAAO,EAAE,CAAC;gBAAE,eAAe,IAAI,CAAC,oBAAoB;YAAC;QAChE,EAAE,OAAOW,OAAO;YACZ,OAAOX,OAAO,IAAI,CAACU,+BAA+B,IAAI,CAACC;QAC3D;IACJ;AACJ;AAEO,MAAMC,0EAAsCC,oCAAAA,oBAA0C,CAAC;IAC1F,gBAAgBtB;IAChB,cAAc;QACVuB;QACAC;QACAC;QACAC;QACAC;KACH;AACL"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { type Result } from "@webiny/feature/api";
|
|
2
|
+
import type { IBackgroundTaskSettings } from "../../../api/domain/BackgroundTaskSettings.js";
|
|
3
|
+
import type { BackgroundTaskModelNotFoundError, BackgroundTaskPersistenceError } from "../../../api/domain/errors.js";
|
|
4
|
+
type IError = BackgroundTaskModelNotFoundError | BackgroundTaskPersistenceError;
|
|
5
|
+
export interface IGetBackgroundTaskSettingsRepository {
|
|
6
|
+
execute(): Promise<Result<IBackgroundTaskSettings, IError>>;
|
|
7
|
+
}
|
|
8
|
+
export declare const GetBackgroundTaskSettingsRepository: import("@webiny/di").Abstraction<IGetBackgroundTaskSettingsRepository>;
|
|
9
|
+
export declare namespace GetBackgroundTaskSettingsRepository {
|
|
10
|
+
type Interface = IGetBackgroundTaskSettingsRepository;
|
|
11
|
+
type Error = IError;
|
|
12
|
+
}
|
|
13
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"api/features/GetBackgroundTaskSettings/abstractions.js","sources":["../../../../src/api/features/GetBackgroundTaskSettings/abstractions.ts"],"sourcesContent":["import { createAbstraction, type Result } from \"@webiny/feature/api\";\nimport type { IBackgroundTaskSettings } from \"~/api/domain/BackgroundTaskSettings.js\";\nimport type {\n BackgroundTaskModelNotFoundError,\n BackgroundTaskPersistenceError\n} from \"~/api/domain/errors.js\";\n\ntype IError = BackgroundTaskModelNotFoundError | BackgroundTaskPersistenceError;\n\nexport interface IGetBackgroundTaskSettingsRepository {\n execute(): Promise<Result<IBackgroundTaskSettings, IError>>;\n}\n\nexport const GetBackgroundTaskSettingsRepository =\n createAbstraction<IGetBackgroundTaskSettingsRepository>(\n \"BackgroundTasks/GetBackgroundTaskSettingsRepository\"\n );\n\nexport namespace GetBackgroundTaskSettingsRepository {\n export type Interface = IGetBackgroundTaskSettingsRepository;\n export type Error = IError;\n}\n"],"names":["GetBackgroundTaskSettingsRepository","createAbstraction"],"mappings":";AAaO,MAAMA,sCACTC,kBACI"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { createFeature } from "@webiny/feature/api";
|
|
2
|
+
import { GetBackgroundTaskSettingsRepository } from "./GetBackgroundTaskSettingsRepository.js";
|
|
3
|
+
const GetBackgroundTaskSettingsFeature = createFeature({
|
|
4
|
+
name: "GetBackgroundTaskSettings",
|
|
5
|
+
register (container) {
|
|
6
|
+
container.register(GetBackgroundTaskSettingsRepository).inSingletonScope();
|
|
7
|
+
}
|
|
8
|
+
});
|
|
9
|
+
export { GetBackgroundTaskSettingsFeature };
|
|
10
|
+
|
|
11
|
+
//# sourceMappingURL=feature.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"api/features/GetBackgroundTaskSettings/feature.js","sources":["../../../../src/api/features/GetBackgroundTaskSettings/feature.ts"],"sourcesContent":["import { createFeature } from \"@webiny/feature/api\";\nimport { GetBackgroundTaskSettingsRepository } from \"./GetBackgroundTaskSettingsRepository.js\";\n\nexport const GetBackgroundTaskSettingsFeature = createFeature({\n name: \"GetBackgroundTaskSettings\",\n register(container) {\n container.register(GetBackgroundTaskSettingsRepository).inSingletonScope();\n }\n});\n"],"names":["GetBackgroundTaskSettingsFeature","createFeature","container","GetBackgroundTaskSettingsRepository"],"mappings":";;AAGO,MAAMA,mCAAmCC,cAAc;IAC1D,MAAM;IACN,UAASC,SAAS;QACdA,UAAU,QAAQ,CAACC,qCAAqC,gBAAgB;IAC5E;AACJ"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { GetLatestTaskLogUseCase as UseCaseAbstraction } from "./abstractions.js";
|
|
2
|
+
import { TaskLogsRepository } from "../../../api/domain/task/abstractions.js";
|
|
3
|
+
declare class GetLatestTaskLogUseCaseImpl implements UseCaseAbstraction.Interface {
|
|
4
|
+
private readonly repository;
|
|
5
|
+
constructor(repository: TaskLogsRepository.Interface);
|
|
6
|
+
execute(taskId: string): Promise<import("@webiny/feature/api/Result.js").Result<import("../../types.js").ITaskLog, import("../../domain/errors.js").BackgroundTaskPersistenceError | import("../../domain/errors.js").TaskLogNotFoundError>>;
|
|
7
|
+
}
|
|
8
|
+
export declare const GetLatestTaskLogUseCase: typeof GetLatestTaskLogUseCaseImpl & {
|
|
9
|
+
__abstraction: import("@webiny/di").Abstraction<import("./abstractions.js").IGetLatestTaskLogUseCase>;
|
|
10
|
+
};
|
|
11
|
+
export {};
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { GetLatestTaskLogUseCase } from "./abstractions.js";
|
|
2
|
+
import { TaskLogsRepository } from "../../domain/task/abstractions.js";
|
|
3
|
+
class GetLatestTaskLogUseCaseImpl {
|
|
4
|
+
constructor(repository){
|
|
5
|
+
this.repository = repository;
|
|
6
|
+
}
|
|
7
|
+
execute(taskId) {
|
|
8
|
+
return this.repository.getLatest(taskId);
|
|
9
|
+
}
|
|
10
|
+
}
|
|
11
|
+
const GetLatestTaskLogUseCase_GetLatestTaskLogUseCase = GetLatestTaskLogUseCase.createImplementation({
|
|
12
|
+
implementation: GetLatestTaskLogUseCaseImpl,
|
|
13
|
+
dependencies: [
|
|
14
|
+
TaskLogsRepository
|
|
15
|
+
]
|
|
16
|
+
});
|
|
17
|
+
export { GetLatestTaskLogUseCase_GetLatestTaskLogUseCase as GetLatestTaskLogUseCase };
|
|
18
|
+
|
|
19
|
+
//# sourceMappingURL=GetLatestTaskLogUseCase.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"api/features/GetLatestTaskLog/GetLatestTaskLogUseCase.js","sources":["../../../../src/api/features/GetLatestTaskLog/GetLatestTaskLogUseCase.ts"],"sourcesContent":["import { GetLatestTaskLogUseCase as UseCaseAbstraction } from \"./abstractions.js\";\nimport { TaskLogsRepository } from \"~/api/domain/task/abstractions.js\";\n\nclass GetLatestTaskLogUseCaseImpl implements UseCaseAbstraction.Interface {\n constructor(private readonly repository: TaskLogsRepository.Interface) {}\n\n execute(taskId: string) {\n return this.repository.getLatest(taskId);\n }\n}\n\nexport const GetLatestTaskLogUseCase = UseCaseAbstraction.createImplementation({\n implementation: GetLatestTaskLogUseCaseImpl,\n dependencies: [TaskLogsRepository]\n});\n"],"names":["GetLatestTaskLogUseCaseImpl","repository","taskId","GetLatestTaskLogUseCase","UseCaseAbstraction","TaskLogsRepository"],"mappings":";;AAGA,MAAMA;IACF,YAA6BC,UAAwC,CAAE;aAA1CA,UAAU,GAAVA;IAA2C;IAExE,QAAQC,MAAc,EAAE;QACpB,OAAO,IAAI,CAAC,UAAU,CAAC,SAAS,CAACA;IACrC;AACJ;AAEO,MAAMC,kDAA0BC,wBAAAA,oBAAuC,CAAC;IAC3E,gBAAgBJ;IAChB,cAAc;QAACK;KAAmB;AACtC"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { Result } from "@webiny/feature/api";
|
|
2
|
+
import type { ITaskLog } from "../../../api/types.js";
|
|
3
|
+
import type { BackgroundTaskPersistenceError } from "../../../api/domain/errors.js";
|
|
4
|
+
import type { TaskLogNotFoundError } from "../../../api/domain/errors.js";
|
|
5
|
+
type UseCaseError = TaskLogNotFoundError | BackgroundTaskPersistenceError;
|
|
6
|
+
export interface IGetLatestTaskLogUseCase {
|
|
7
|
+
execute(taskId: string): Promise<Result<ITaskLog, UseCaseError>>;
|
|
8
|
+
}
|
|
9
|
+
/** Get the most recent log of a task. Fails with TaskLogNotFoundError when the task has none yet. */
|
|
10
|
+
export declare const GetLatestTaskLogUseCase: import("@webiny/di").Abstraction<IGetLatestTaskLogUseCase>;
|
|
11
|
+
export declare namespace GetLatestTaskLogUseCase {
|
|
12
|
+
type Interface = IGetLatestTaskLogUseCase;
|
|
13
|
+
type Error = UseCaseError;
|
|
14
|
+
}
|
|
15
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"api/features/GetLatestTaskLog/abstractions.js","sources":["../../../../src/api/features/GetLatestTaskLog/abstractions.ts"],"sourcesContent":["import { createAbstraction } from \"@webiny/feature/api\";\nimport type { Result } from \"@webiny/feature/api\";\nimport type { ITaskLog } from \"~/api/types.js\";\nimport type { BackgroundTaskPersistenceError } from \"~/api/domain/errors.js\";\nimport type { TaskLogNotFoundError } from \"~/api/domain/errors.js\";\n\ntype UseCaseError = TaskLogNotFoundError | BackgroundTaskPersistenceError;\n\nexport interface IGetLatestTaskLogUseCase {\n execute(taskId: string): Promise<Result<ITaskLog, UseCaseError>>;\n}\n\n/** Get the most recent log of a task. Fails with TaskLogNotFoundError when the task has none yet. */\nexport const GetLatestTaskLogUseCase = createAbstraction<IGetLatestTaskLogUseCase>(\n \"Tasks/GetLatestTaskLogUseCase\"\n);\n\nexport namespace GetLatestTaskLogUseCase {\n export type Interface = IGetLatestTaskLogUseCase;\n export type Error = UseCaseError;\n}\n"],"names":["GetLatestTaskLogUseCase","createAbstraction"],"mappings":";AAaO,MAAMA,0BAA0BC,kBACnC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { createFeature } from "@webiny/feature/api";
|
|
2
|
+
import { GetLatestTaskLogUseCase } from "./GetLatestTaskLogUseCase.js";
|
|
3
|
+
const GetLatestTaskLogFeature = createFeature({
|
|
4
|
+
name: "GetLatestTaskLog",
|
|
5
|
+
register (container) {
|
|
6
|
+
container.register(GetLatestTaskLogUseCase);
|
|
7
|
+
}
|
|
8
|
+
});
|
|
9
|
+
export { GetLatestTaskLogFeature };
|
|
10
|
+
|
|
11
|
+
//# sourceMappingURL=feature.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"api/features/GetLatestTaskLog/feature.js","sources":["../../../../src/api/features/GetLatestTaskLog/feature.ts"],"sourcesContent":["import { createFeature } from \"@webiny/feature/api\";\nimport { GetLatestTaskLogUseCase } from \"./GetLatestTaskLogUseCase.js\";\n\nexport const GetLatestTaskLogFeature = createFeature({\n name: \"GetLatestTaskLog\",\n register(container) {\n container.register(GetLatestTaskLogUseCase);\n }\n});\n"],"names":["GetLatestTaskLogFeature","createFeature","container","GetLatestTaskLogUseCase"],"mappings":";;AAGO,MAAMA,0BAA0BC,cAAc;IACjD,MAAM;IACN,UAASC,SAAS;QACdA,UAAU,QAAQ,CAACC;IACvB;AACJ"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { Result } from "@webiny/feature/api";
|
|
2
|
+
import { GetRunnableTaskDefinitionUseCase as UseCaseAbstraction } from "./abstractions.js";
|
|
3
|
+
import { TaskDefinition } from "@webiny/api-core/features/task/TaskDefinition/index.js";
|
|
4
|
+
import { TaskHandlerResolver } from "../../../api/features/TaskHandlerResolver/index.js";
|
|
5
|
+
export declare class GetRunnableTaskDefinitionUseCaseImpl implements UseCaseAbstraction.Interface {
|
|
6
|
+
private definitions;
|
|
7
|
+
private handlerResolver;
|
|
8
|
+
constructor(definitions: TaskDefinition.Interface[], handlerResolver: TaskHandlerResolver.Interface);
|
|
9
|
+
execute<I extends TaskDefinition.TaskInput = TaskDefinition.TaskInput, O extends TaskDefinition.TaskOutput = TaskDefinition.TaskOutput>(id: string): Result<TaskDefinition.Runnable<I, O>, UseCaseAbstraction.Error>;
|
|
10
|
+
}
|
|
11
|
+
export declare const GetRunnableTaskDefinitionUseCase: typeof GetRunnableTaskDefinitionUseCaseImpl & {
|
|
12
|
+
__abstraction: import("@webiny/di").Abstraction<import("./abstractions.js").IGetRunnableTaskDefinitionUseCase>;
|
|
13
|
+
};
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import { Result } from "@webiny/feature/api";
|
|
2
|
+
import { GetRunnableTaskDefinitionUseCase } from "./abstractions.js";
|
|
3
|
+
import { TaskDefinition } from "@webiny/api-core/features/task/TaskDefinition/index.js";
|
|
4
|
+
import { TaskHandlerResolver } from "../TaskHandlerResolver/index.js";
|
|
5
|
+
import { TaskDefinitionNotFoundError } from "../../domain/errors.js";
|
|
6
|
+
class GetRunnableTaskDefinitionUseCaseImpl {
|
|
7
|
+
constructor(definitions, handlerResolver){
|
|
8
|
+
this.definitions = definitions;
|
|
9
|
+
this.handlerResolver = handlerResolver;
|
|
10
|
+
}
|
|
11
|
+
execute(id) {
|
|
12
|
+
for (const definition of this.definitions){
|
|
13
|
+
if (definition.id !== id) continue;
|
|
14
|
+
const handlerClass = definition.handler;
|
|
15
|
+
const handler = this.handlerResolver.resolve(handlerClass);
|
|
16
|
+
const runnable = {
|
|
17
|
+
id: definition.id,
|
|
18
|
+
title: definition.title,
|
|
19
|
+
description: definition.description,
|
|
20
|
+
isPrivate: definition.isPrivate,
|
|
21
|
+
databaseLogs: definition.databaseLogs,
|
|
22
|
+
maxIterations: definition.maxIterations,
|
|
23
|
+
selfCleanup: definition.selfCleanup,
|
|
24
|
+
run: handler.run.bind(handler),
|
|
25
|
+
onBeforeTrigger: handler.onBeforeTrigger?.bind(handler),
|
|
26
|
+
onDone: handler.onDone?.bind(handler),
|
|
27
|
+
onError: handler.onError?.bind(handler),
|
|
28
|
+
onAbort: handler.onAbort?.bind(handler),
|
|
29
|
+
onMaxIterations: handler.onMaxIterations?.bind(handler),
|
|
30
|
+
createInputValidation: handler.createInputValidation?.bind(handler)
|
|
31
|
+
};
|
|
32
|
+
return Result.ok(runnable);
|
|
33
|
+
}
|
|
34
|
+
return Result.fail(new TaskDefinitionNotFoundError(id));
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
const GetRunnableTaskDefinitionUseCase_GetRunnableTaskDefinitionUseCase = GetRunnableTaskDefinitionUseCase.createImplementation({
|
|
38
|
+
implementation: GetRunnableTaskDefinitionUseCaseImpl,
|
|
39
|
+
dependencies: [
|
|
40
|
+
[
|
|
41
|
+
TaskDefinition,
|
|
42
|
+
{
|
|
43
|
+
multiple: true
|
|
44
|
+
}
|
|
45
|
+
],
|
|
46
|
+
TaskHandlerResolver
|
|
47
|
+
]
|
|
48
|
+
});
|
|
49
|
+
export { GetRunnableTaskDefinitionUseCaseImpl, GetRunnableTaskDefinitionUseCase_GetRunnableTaskDefinitionUseCase as GetRunnableTaskDefinitionUseCase };
|
|
50
|
+
|
|
51
|
+
//# sourceMappingURL=GetRunnableTaskDefinitionUseCase.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"api/features/GetRunnableTaskDefinition/GetRunnableTaskDefinitionUseCase.js","sources":["../../../../src/api/features/GetRunnableTaskDefinition/GetRunnableTaskDefinitionUseCase.ts"],"sourcesContent":["import { Result } from \"@webiny/feature/api\";\nimport type { Constructor } from \"@webiny/di\";\nimport { GetRunnableTaskDefinitionUseCase as UseCaseAbstraction } from \"./abstractions.js\";\nimport { TaskDefinition } from \"@webiny/api-core/features/task/TaskDefinition/index.js\";\nimport { TaskHandlerResolver } from \"~/api/features/TaskHandlerResolver/index.js\";\nimport { TaskDefinitionNotFoundError } from \"~/api/domain/errors.js\";\n\nexport class GetRunnableTaskDefinitionUseCaseImpl implements UseCaseAbstraction.Interface {\n public constructor(\n private definitions: TaskDefinition.Interface[],\n private handlerResolver: TaskHandlerResolver.Interface\n ) {}\n\n public execute<\n I extends TaskDefinition.TaskInput = TaskDefinition.TaskInput,\n O extends TaskDefinition.TaskOutput = TaskDefinition.TaskOutput\n >(id: string): Result<TaskDefinition.Runnable<I, O>, UseCaseAbstraction.Error> {\n for (const definition of this.definitions) {\n if (definition.id !== id) {\n continue;\n }\n\n // Every definition is free to build, so reaching this point cost nothing. The handler is\n // the expensive half and it is built only now, for the one task that was asked for.\n //\n // The registered definition is stored under the abstraction's default generics, so its\n // handler cannot be proven assignable to the caller's narrower <I, O>.\n const handlerClass = definition.handler as Constructor<TaskDefinition.Handler<I, O>>;\n const handler = this.handlerResolver.resolve(handlerClass);\n\n // Present the two halves as the single object the runner and\n // `context.tasks.getDefinition()` expect. Metadata from the definition, behaviour from\n // the handler, bound so `this` inside a hook is still the instance that owns the\n // injected dependencies.\n const runnable: TaskDefinition.Runnable<I, O> = {\n id: definition.id,\n title: definition.title,\n description: definition.description,\n isPrivate: definition.isPrivate as boolean,\n databaseLogs: definition.databaseLogs as boolean,\n maxIterations: definition.maxIterations as number,\n selfCleanup: definition.selfCleanup,\n\n run: handler.run.bind(handler),\n onBeforeTrigger: handler.onBeforeTrigger?.bind(handler),\n onDone: handler.onDone?.bind(handler),\n onError: handler.onError?.bind(handler),\n onAbort: handler.onAbort?.bind(handler),\n onMaxIterations: handler.onMaxIterations?.bind(handler),\n createInputValidation: handler.createInputValidation?.bind(handler)\n };\n\n return Result.ok(runnable);\n }\n\n return Result.fail(new TaskDefinitionNotFoundError(id));\n }\n}\n\nexport const GetRunnableTaskDefinitionUseCase = UseCaseAbstraction.createImplementation({\n implementation: GetRunnableTaskDefinitionUseCaseImpl,\n dependencies: [[TaskDefinition, { multiple: true }], TaskHandlerResolver]\n});\n"],"names":["GetRunnableTaskDefinitionUseCaseImpl","definitions","handlerResolver","id","definition","handlerClass","handler","runnable","Result","TaskDefinitionNotFoundError","GetRunnableTaskDefinitionUseCase","UseCaseAbstraction","TaskDefinition","TaskHandlerResolver"],"mappings":";;;;;AAOO,MAAMA;IACT,YACYC,WAAuC,EACvCC,eAA8C,CACxD;aAFUD,WAAW,GAAXA;aACAC,eAAe,GAAfA;IACT;IAEI,QAGLC,EAAU,EAAmE;QAC3E,KAAK,MAAMC,cAAc,IAAI,CAAC,WAAW,CAAE;YACvC,IAAIA,WAAW,EAAE,KAAKD,IAClB;YAQJ,MAAME,eAAeD,WAAW,OAAO;YACvC,MAAME,UAAU,IAAI,CAAC,eAAe,CAAC,OAAO,CAACD;YAM7C,MAAME,WAA0C;gBAC5C,IAAIH,WAAW,EAAE;gBACjB,OAAOA,WAAW,KAAK;gBACvB,aAAaA,WAAW,WAAW;gBACnC,WAAWA,WAAW,SAAS;gBAC/B,cAAcA,WAAW,YAAY;gBACrC,eAAeA,WAAW,aAAa;gBACvC,aAAaA,WAAW,WAAW;gBAEnC,KAAKE,QAAQ,GAAG,CAAC,IAAI,CAACA;gBACtB,iBAAiBA,QAAQ,eAAe,EAAE,KAAKA;gBAC/C,QAAQA,QAAQ,MAAM,EAAE,KAAKA;gBAC7B,SAASA,QAAQ,OAAO,EAAE,KAAKA;gBAC/B,SAASA,QAAQ,OAAO,EAAE,KAAKA;gBAC/B,iBAAiBA,QAAQ,eAAe,EAAE,KAAKA;gBAC/C,uBAAuBA,QAAQ,qBAAqB,EAAE,KAAKA;YAC/D;YAEA,OAAOE,OAAO,EAAE,CAACD;QACrB;QAEA,OAAOC,OAAO,IAAI,CAAC,IAAIC,4BAA4BN;IACvD;AACJ;AAEO,MAAMO,oEAAmCC,iCAAAA,oBAAuC,CAAC;IACpF,gBAAgBX;IAChB,cAAc;QAAC;YAACY;YAAgB;gBAAE,UAAU;YAAK;SAAE;QAAEC;KAAoB;AAC7E"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { Result } from "@webiny/feature/api";
|
|
2
|
+
import type { TaskDefinition } from "@webiny/api-core/features/task/TaskDefinition/index.js";
|
|
3
|
+
import type { TaskDefinitionNotFoundError } from "../../../api/domain/errors.js";
|
|
4
|
+
export interface IGetRunnableTaskDefinitionUseCase {
|
|
5
|
+
execute<I extends TaskDefinition.TaskInput = TaskDefinition.TaskInput, O extends TaskDefinition.TaskOutput = TaskDefinition.TaskOutput>(id: string): Result<TaskDefinition.Runnable<I, O>, UseCaseError>;
|
|
6
|
+
}
|
|
7
|
+
export interface IGetRunnableTaskDefinitionUseCaseErrors {
|
|
8
|
+
notFound: TaskDefinitionNotFoundError;
|
|
9
|
+
}
|
|
10
|
+
type UseCaseError = IGetRunnableTaskDefinitionUseCaseErrors[keyof IGetRunnableTaskDefinitionUseCaseErrors];
|
|
11
|
+
export declare const GetRunnableTaskDefinitionUseCase: import("@webiny/di").Abstraction<IGetRunnableTaskDefinitionUseCase>;
|
|
12
|
+
export declare namespace GetRunnableTaskDefinitionUseCase {
|
|
13
|
+
type Interface = IGetRunnableTaskDefinitionUseCase;
|
|
14
|
+
type Error = UseCaseError;
|
|
15
|
+
type Return<I extends TaskDefinition.TaskInput = TaskDefinition.TaskInput, O extends TaskDefinition.TaskOutput = TaskDefinition.TaskOutput> = Result<TaskDefinition.Runnable<I, O>, UseCaseError>;
|
|
16
|
+
}
|
|
17
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"api/features/GetRunnableTaskDefinition/abstractions.js","sources":["../../../../src/api/features/GetRunnableTaskDefinition/abstractions.ts"],"sourcesContent":["import { createAbstraction } from \"@webiny/feature/api\";\nimport type { Result } from \"@webiny/feature/api\";\nimport type { TaskDefinition } from \"@webiny/api-core/features/task/TaskDefinition/index.js\";\nimport type { TaskDefinitionNotFoundError } from \"~/api/domain/errors.js\";\n\nexport interface IGetRunnableTaskDefinitionUseCase {\n execute<\n I extends TaskDefinition.TaskInput = TaskDefinition.TaskInput,\n O extends TaskDefinition.TaskOutput = TaskDefinition.TaskOutput\n >(\n id: string\n ): Result<TaskDefinition.Runnable<I, O>, UseCaseError>;\n}\n\nexport interface IGetRunnableTaskDefinitionUseCaseErrors {\n notFound: TaskDefinitionNotFoundError;\n}\n\ntype UseCaseError =\n IGetRunnableTaskDefinitionUseCaseErrors[keyof IGetRunnableTaskDefinitionUseCaseErrors];\n\nexport const GetRunnableTaskDefinitionUseCase =\n createAbstraction<IGetRunnableTaskDefinitionUseCase>(\"Tasks/GetRunnableTaskDefinitionUseCase\");\n\nexport namespace GetRunnableTaskDefinitionUseCase {\n export type Interface = IGetRunnableTaskDefinitionUseCase;\n\n export type Error = UseCaseError;\n export type Return<\n I extends TaskDefinition.TaskInput = TaskDefinition.TaskInput,\n O extends TaskDefinition.TaskOutput = TaskDefinition.TaskOutput\n > = Result<TaskDefinition.Runnable<I, O>, UseCaseError>;\n}\n"],"names":["GetRunnableTaskDefinitionUseCase","createAbstraction"],"mappings":";AAqBO,MAAMA,mCACTC,kBAAqD"}
|