@webiny/tasks 6.3.0 → 6.4.0-beta.0
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/context.js +31 -43
- package/context.js.map +1 -1
- package/crud/TaskLogPrivateModel.js +33 -27
- package/crud/TaskLogPrivateModel.js.map +1 -1
- package/crud/TaskPrivateModel.js +48 -39
- package/crud/TaskPrivateModel.js.map +1 -1
- package/crud/cleanupTaskSubtree.js +55 -69
- package/crud/cleanupTaskSubtree.js.map +1 -1
- package/crud/crud.tasks.js +289 -352
- package/crud/crud.tasks.js.map +1 -1
- package/crud/definition.tasks.js +13 -16
- package/crud/definition.tasks.js.map +1 -1
- package/crud/service.tasks.js +119 -155
- package/crud/service.tasks.js.map +1 -1
- package/decorators/RunnableTaskDecorator.js +61 -77
- package/decorators/RunnableTaskDecorator.js.map +1 -1
- package/decorators/SelfCleaningTaskDecorator.js +75 -89
- package/decorators/SelfCleaningTaskDecorator.js.map +1 -1
- package/domain/errors.js +35 -39
- package/domain/errors.js.map +1 -1
- package/events/TaskAfterCreateEvent.js +8 -5
- package/events/TaskAfterCreateEvent.js.map +1 -1
- package/events/TaskAfterDeleteEvent.js +8 -5
- package/events/TaskAfterDeleteEvent.js.map +1 -1
- package/events/TaskAfterUpdateEvent.js +8 -5
- package/events/TaskAfterUpdateEvent.js.map +1 -1
- package/events/TaskBeforeCreateEvent.js +8 -5
- package/events/TaskBeforeCreateEvent.js.map +1 -1
- package/events/TaskBeforeDeleteEvent.js +8 -5
- package/events/TaskBeforeDeleteEvent.js.map +1 -1
- package/events/TaskBeforeUpdateEvent.js +8 -5
- package/events/TaskBeforeUpdateEvent.js.map +1 -1
- package/events/abstractions.js +7 -36
- package/events/abstractions.js.map +1 -1
- package/events/index.js +0 -2
- package/features/AbortTask/AbortTaskUseCase.js +9 -8
- package/features/AbortTask/AbortTaskUseCase.js.map +1 -1
- package/features/AbortTask/abstractions.js +2 -1
- package/features/AbortTask/abstractions.js.map +1 -1
- package/features/AbortTask/feature.js +6 -5
- package/features/AbortTask/feature.js.map +1 -1
- package/features/AbortTask/index.js +0 -2
- package/features/CleanupTaskSubtree/CleanupTaskSubtreeUseCase.js +8 -7
- package/features/CleanupTaskSubtree/CleanupTaskSubtreeUseCase.js.map +1 -1
- package/features/CleanupTaskSubtree/abstractions.js +2 -1
- package/features/CleanupTaskSubtree/abstractions.js.map +1 -1
- package/features/CleanupTaskSubtree/index.js +0 -2
- package/features/GetTask/GetTaskUseCase.js +8 -7
- package/features/GetTask/GetTaskUseCase.js.map +1 -1
- package/features/GetTask/abstractions.js +2 -1
- package/features/GetTask/abstractions.js.map +1 -1
- package/features/GetTask/feature.js +6 -5
- package/features/GetTask/feature.js.map +1 -1
- package/features/GetTask/index.js +0 -2
- package/features/GetTaskDefinition/GetTaskDefinitionUseCase.js +18 -16
- package/features/GetTaskDefinition/GetTaskDefinitionUseCase.js.map +1 -1
- package/features/GetTaskDefinition/abstractions.js +2 -1
- package/features/GetTaskDefinition/abstractions.js.map +1 -1
- package/features/GetTaskDefinition/feature.js +6 -5
- package/features/GetTaskDefinition/feature.js.map +1 -1
- package/features/GetTaskDefinition/index.js +0 -2
- package/features/ListTaskDefinitions/ListTaskDefinitionsUseCase.js +18 -12
- package/features/ListTaskDefinitions/ListTaskDefinitionsUseCase.js.map +1 -1
- package/features/ListTaskDefinitions/abstractions.js +2 -1
- package/features/ListTaskDefinitions/abstractions.js.map +1 -1
- package/features/ListTaskDefinitions/feature.js +6 -5
- package/features/ListTaskDefinitions/feature.js.map +1 -1
- package/features/ListTaskDefinitions/index.js +0 -2
- package/features/ListTasks/ListTasksUseCase.js +8 -7
- package/features/ListTasks/ListTasksUseCase.js.map +1 -1
- package/features/ListTasks/abstractions.js +2 -1
- package/features/ListTasks/abstractions.js.map +1 -1
- package/features/ListTasks/feature.js +6 -5
- package/features/ListTasks/feature.js.map +1 -1
- package/features/ListTasks/index.js +0 -2
- package/features/TaskController/TaskController.js +60 -60
- package/features/TaskController/TaskController.js.map +1 -1
- package/features/TaskController/augmentation.js +0 -3
- package/features/TaskController/index.js +0 -5
- package/features/TaskExecutionContext/TaskExecutionContext.js +38 -45
- package/features/TaskExecutionContext/TaskExecutionContext.js.map +1 -1
- package/features/TaskExecutionContext/abstractions.js +2 -10
- package/features/TaskExecutionContext/abstractions.js.map +1 -1
- package/features/TaskExecutionContext/feature.js +6 -5
- package/features/TaskExecutionContext/feature.js.map +1 -1
- package/features/TaskExecutionContext/index.js +0 -2
- package/features/TriggerTask/TriggerTaskUseCase.js +9 -8
- package/features/TriggerTask/TriggerTaskUseCase.js.map +1 -1
- package/features/TriggerTask/abstractions.js +2 -1
- package/features/TriggerTask/abstractions.js.map +1 -1
- package/features/TriggerTask/feature.js +6 -5
- package/features/TriggerTask/feature.js.map +1 -1
- package/features/TriggerTask/index.js +0 -2
- package/global.js +0 -2
- package/graphql/checkPermissions.js +16 -35
- package/graphql/checkPermissions.js.map +1 -1
- package/graphql/index.js +154 -187
- package/graphql/index.js.map +1 -1
- package/graphql/utils.js +15 -14
- package/graphql/utils.js.map +1 -1
- package/handler/index.js +46 -53
- package/handler/index.js.map +1 -1
- package/handler/register.js +7 -15
- package/handler/register.js.map +1 -1
- package/handler/types.js +0 -3
- package/index.js +2 -4
- package/package.json +17 -17
- package/plugins/TaskServicePlugin.js +9 -6
- package/plugins/TaskServicePlugin.js.map +1 -1
- package/plugins/index.js +0 -2
- package/response/DatabaseResponse.js +113 -132
- package/response/DatabaseResponse.js.map +1 -1
- package/response/Response.js +78 -96
- package/response/Response.js.map +1 -1
- package/response/ResponseAbortedResult.js +8 -7
- package/response/ResponseAbortedResult.js.map +1 -1
- package/response/ResponseContinueResult.js +12 -14
- package/response/ResponseContinueResult.js.map +1 -1
- package/response/ResponseDoneResult.js +10 -9
- package/response/ResponseDoneResult.js.map +1 -1
- package/response/ResponseErrorResult.js +9 -8
- package/response/ResponseErrorResult.js.map +1 -1
- package/response/TaskResponse.js +44 -64
- package/response/TaskResponse.js.map +1 -1
- package/response/abstractions/Response.js +0 -3
- package/response/abstractions/ResponseAbortedResult.js +0 -3
- package/response/abstractions/ResponseBaseResult.js +0 -3
- package/response/abstractions/ResponseContinueResult.js +0 -3
- package/response/abstractions/ResponseDoneResult.js +0 -3
- package/response/abstractions/ResponseErrorResult.js +0 -3
- package/response/abstractions/TaskResponse.js +0 -3
- package/response/abstractions/index.js +0 -2
- package/response/index.js +0 -2
- package/runner/TaskControl.js +150 -221
- package/runner/TaskControl.js.map +1 -1
- package/runner/TaskEventValidation.js +12 -13
- package/runner/TaskEventValidation.js.map +1 -1
- package/runner/TaskManager.js +68 -106
- package/runner/TaskManager.js.map +1 -1
- package/runner/TaskManagerStore.js +90 -139
- package/runner/TaskManagerStore.js.map +1 -1
- package/runner/TaskRunner.js +45 -65
- package/runner/TaskRunner.js.map +1 -1
- package/runner/abstractions/TaskControl.js +0 -3
- package/runner/abstractions/TaskEventValidation.js +0 -3
- package/runner/abstractions/TaskManager.js +0 -3
- package/runner/abstractions/TaskManagerStore.js +0 -3
- package/runner/abstractions/TaskRunner.js +0 -3
- package/runner/abstractions/index.js +0 -2
- package/runner/index.js +0 -2
- package/service/EventBridgeEventTransportPlugin.js +43 -42
- package/service/EventBridgeEventTransportPlugin.js.map +1 -1
- package/service/StepFunctionServicePlugin.js +65 -66
- package/service/StepFunctionServicePlugin.js.map +1 -1
- package/service/createService.js +10 -13
- package/service/createService.js.map +1 -1
- package/service/index.js +7 -5
- package/service/index.js.map +1 -1
- package/tasks/testingRunTask.js +11 -10
- package/tasks/testingRunTask.js.map +1 -1
- package/types.js +12 -12
- package/types.js.map +1 -1
- package/utils/ObjectUpdater.js +25 -31
- package/utils/ObjectUpdater.js.map +1 -1
- package/utils/getErrorProperties.js +5 -4
- package/utils/getErrorProperties.js.map +1 -1
- package/utils/getObjectProperties.js +8 -15
- package/utils/getObjectProperties.js.map +1 -1
- package/utils/index.js +0 -2
- package/utils/normalizeSelfCleanup.js +13 -12
- package/utils/normalizeSelfCleanup.js.map +1 -1
- package/events/index.js.map +0 -1
- package/features/AbortTask/index.js.map +0 -1
- package/features/CleanupTaskSubtree/index.js.map +0 -1
- package/features/GetTask/index.js.map +0 -1
- package/features/GetTaskDefinition/index.js.map +0 -1
- package/features/ListTaskDefinitions/index.js.map +0 -1
- package/features/ListTasks/index.js.map +0 -1
- package/features/TaskController/augmentation.js.map +0 -1
- package/features/TaskController/index.js.map +0 -1
- package/features/TaskExecutionContext/index.js.map +0 -1
- package/features/TriggerTask/index.js.map +0 -1
- package/global.js.map +0 -1
- package/handler/types.js.map +0 -1
- package/index.js.map +0 -1
- package/plugins/index.js.map +0 -1
- package/response/abstractions/Response.js.map +0 -1
- package/response/abstractions/ResponseAbortedResult.js.map +0 -1
- package/response/abstractions/ResponseBaseResult.js.map +0 -1
- package/response/abstractions/ResponseContinueResult.js.map +0 -1
- package/response/abstractions/ResponseDoneResult.js.map +0 -1
- package/response/abstractions/ResponseErrorResult.js.map +0 -1
- package/response/abstractions/TaskResponse.js.map +0 -1
- package/response/abstractions/index.js.map +0 -1
- package/response/index.js.map +0 -1
- package/runner/abstractions/TaskControl.js.map +0 -1
- package/runner/abstractions/TaskEventValidation.js.map +0 -1
- package/runner/abstractions/TaskManager.js.map +0 -1
- package/runner/abstractions/TaskManagerStore.js.map +0 -1
- package/runner/abstractions/TaskRunner.js.map +0 -1
- package/runner/abstractions/index.js.map +0 -1
- package/runner/index.js.map +0 -1
- package/utils/index.js.map +0 -1
package/types.js
CHANGED
|
@@ -1,20 +1,20 @@
|
|
|
1
|
-
// TODO had to import for augmentation to work, but is there a better way to do this?
|
|
2
1
|
import "./features/TaskController/augmentation.js";
|
|
3
2
|
export * from "./handler/types.js";
|
|
4
3
|
export * from "./response/abstractions/index.js";
|
|
5
4
|
export * from "./runner/abstractions/index.js";
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
5
|
+
var types_TaskLogItemType = /*#__PURE__*/ function(TaskLogItemType) {
|
|
6
|
+
TaskLogItemType["INFO"] = "info";
|
|
7
|
+
TaskLogItemType["ERROR"] = "error";
|
|
8
|
+
return TaskLogItemType;
|
|
10
9
|
}({});
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
10
|
+
var types_TaskDataStatus = /*#__PURE__*/ function(TaskDataStatus) {
|
|
11
|
+
TaskDataStatus["PENDING"] = "pending";
|
|
12
|
+
TaskDataStatus["RUNNING"] = "running";
|
|
13
|
+
TaskDataStatus["FAILED"] = "failed";
|
|
14
|
+
TaskDataStatus["SUCCESS"] = "success";
|
|
15
|
+
TaskDataStatus["ABORTED"] = "aborted";
|
|
16
|
+
return TaskDataStatus;
|
|
18
17
|
}({});
|
|
18
|
+
export { types_TaskDataStatus as TaskDataStatus, types_TaskLogItemType as TaskLogItemType };
|
|
19
19
|
|
|
20
20
|
//# sourceMappingURL=types.js.map
|
package/types.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"file":"types.js","sources":["../src/types.ts"],"sourcesContent":["import type {\n CmsContext as BaseContext,\n CmsEntryListParams,\n CmsEntryMeta,\n CmsModel\n} from \"@webiny/api-headless-cms/types/index.js\";\nimport type { IResponseError } from \"~/response/abstractions/index.js\";\nimport type { GenericRecord } from \"@webiny/api/types.js\";\nimport type { IStepFunctionServiceFetchResult } from \"~/service/StepFunctionServicePlugin.js\";\nimport type { SecurityPermission } from \"@webiny/api-core/types/security.js\";\nimport type { TaskDefinition } from \"@webiny/api-core/features/task/TaskDefinition/index.js\";\nimport { TaskService } from \"@webiny/api-core/features/task/TaskService/index.js\";\nimport { BaseError, Result } from \"@webiny/feature/api\";\nimport type { IdInterfaceGenerator, NumericInterfaceGenerator } from \"@webiny/api\";\n// TODO had to import for augmentation to work, but is there a better way to do this?\nimport \"./features/TaskController/augmentation.js\";\n\nexport * from \"./handler/types.js\";\nexport * from \"./response/abstractions/index.js\";\nexport * from \"./runner/abstractions/index.js\";\n\nexport type ITaskDataInput = GenericRecord;\n\nexport enum TaskLogItemType {\n INFO = \"info\",\n ERROR = \"error\"\n}\n\nexport interface ITaskLogItemData {\n [key: string]: any;\n}\n\nexport interface ITaskLogItemBase {\n message: string;\n createdOn: string;\n type: TaskLogItemType;\n data?: ITaskLogItemData;\n}\n\nexport interface ITaskLogItemInfo extends ITaskLogItemBase {\n type: TaskLogItemType.INFO;\n}\n\nexport interface ITaskLogItemError extends ITaskLogItemBase {\n type: TaskLogItemType.ERROR;\n error?: IResponseError;\n}\n\nexport type ITaskLogItem = ITaskLogItemInfo | ITaskLogItemError;\n\nexport interface ITaskLog {\n /**\n * ID without the revision number (for example: #0001).\n */\n id: string;\n createdOn: string;\n createdBy: ITaskIdentity;\n executionName: string;\n task: string;\n iteration: number;\n items: ITaskLogItem[];\n}\n\nexport enum TaskDataStatus {\n PENDING = \"pending\",\n RUNNING = \"running\",\n FAILED = \"failed\",\n SUCCESS = \"success\",\n ABORTED = \"aborted\"\n}\n\nexport interface ITaskIdentity {\n id: string;\n displayName: string;\n type: string;\n}\n\nexport type IGetTaskResponse<\n T extends TaskService.TaskInput = TaskService.TaskInput,\n O extends TaskService.GenericOutput = TaskService.GenericOutput\n> = ITask<T, O> | null;\n\nexport interface IListTasksResponse<\n T extends TaskService.TaskInput = TaskService.TaskInput,\n O extends TaskService.GenericOutput = TaskService.GenericOutput\n> {\n items: ITask<T, O>[];\n meta: CmsEntryMeta;\n}\n\nexport interface IListTaskLogsResponse {\n items: ITaskLog[];\n meta: CmsEntryMeta;\n}\n\nexport type ICreateTaskResponse<\n T extends TaskService.TaskInput = TaskService.TaskInput,\n O extends TaskService.GenericOutput = TaskService.GenericOutput\n> = ITask<T, O>;\nexport type IUpdateTaskResponse<\n T extends TaskService.TaskInput = TaskService.TaskInput,\n O extends TaskService.GenericOutput = TaskService.GenericOutput\n> = ITask<T, O>;\nexport type IDeleteTaskResponse = boolean;\n\nexport interface IListTaskParamsWhere\n extends\n IdInterfaceGenerator<\"id\">,\n IdInterfaceGenerator<\"parentId\">,\n IdInterfaceGenerator<\"definitionId\">,\n IdInterfaceGenerator<\"taskStatus\"> {\n //\n}\n\nexport interface IListTaskParams extends Omit<CmsEntryListParams, \"fields\" | \"search\"> {\n where?: IListTaskParamsWhere;\n}\n\nexport interface IListTaskLogParamsWhere\n extends\n IdInterfaceGenerator<\"id\">,\n IdInterfaceGenerator<\"task\">,\n NumericInterfaceGenerator<\"iteration\"> {}\n\nexport interface IListTaskLogParams extends Omit<\n CmsEntryListParams,\n \"fields\" | \"search\" | \"where\"\n> {\n where?: IListTaskLogParamsWhere;\n}\n\nexport interface ITaskCreateData<T extends TaskDefinition.TaskInput = TaskDefinition.TaskInput> {\n definitionId: string;\n name: string;\n input: T;\n parentId?: string;\n}\n\nexport interface ITaskUpdateData<\n I extends TaskDefinition.TaskInput = TaskDefinition.TaskInput,\n O extends TaskDefinition.TaskOutput = TaskDefinition.TaskOutput\n> {\n name?: string;\n input?: I;\n output?: O;\n taskStatus?: TaskDataStatus;\n executionName?: string;\n startedOn?: string;\n finishedOn?: string;\n eventResponse?: GenericRecord;\n iterations?: number;\n}\n\nexport interface ITaskLogCreateInput {\n executionName: string;\n iteration: number;\n}\n\nexport interface ITaskLogUpdateInput {\n items?: ITaskLogItem[];\n}\n\nexport interface ITasksContextCrudObject {\n /**\n * Models\n */\n getTaskModel(): Promise<CmsModel>;\n getLogModel(): Promise<CmsModel>;\n /**\n * Tasks\n */\n getTask<\n T extends TaskService.TaskInput = TaskService.TaskInput,\n O extends TaskService.GenericOutput = TaskService.GenericOutput\n >(\n id: string\n ): Promise<IGetTaskResponse<T, O> | null>;\n listTasks<\n T extends TaskService.TaskInput = TaskService.TaskInput,\n O extends TaskService.GenericOutput = TaskService.GenericOutput\n >(\n params?: IListTaskParams\n ): Promise<IListTasksResponse<T, O>>;\n createTask<T extends TaskService.TaskInput = TaskService.TaskInput>(\n task: ITaskCreateData<T>\n ): Promise<ICreateTaskResponse<T>>;\n updateTask<\n T extends TaskService.TaskInput = TaskService.TaskInput,\n O extends TaskService.GenericOutput = TaskService.GenericOutput\n >(\n id: string,\n data: Partial<ITaskUpdateData<T, O>>\n ): Promise<IUpdateTaskResponse<T, O>>;\n deleteTask(id: string): Promise<IDeleteTaskResponse>;\n /**\n * Recursively delete a task, its logs (if any were written), and its entire\n * descendant subtree. Best-effort: per-record failures are logged and swallowed,\n * the method never throws.\n */\n cleanupTaskSubtree(id: string): Promise<void>;\n /**\n * Logs\n */\n createLog(task: Pick<ITask, \"id\">, data: ITaskLogCreateInput): Promise<ITaskLog>;\n updateLog(id: string, data: ITaskLogUpdateInput): Promise<ITaskLog>;\n deleteLog(id: string): Promise<boolean>;\n getLog(id: string): Promise<ITaskLog | null>;\n getLatestLog(taskId: string): Promise<ITaskLog>;\n listLogs(params: IListTaskLogParams): Promise<IListTaskLogsResponse>;\n}\n\nexport interface ITasksContextDefinitionObject {\n getDefinition: <\n I extends TaskDefinition.TaskInput = TaskDefinition.TaskInput,\n O extends TaskDefinition.TaskOutput = TaskDefinition.TaskOutput\n >(\n id: string\n ) => TaskDefinition.Runnable<I, O> | null;\n listDefinitions: () => TaskDefinition.Interface[];\n}\n\nexport interface ITaskTriggerParams<I = ITaskDataInput> {\n parent?: Pick<ITask, \"id\">;\n definition: string;\n name?: string;\n input?: I;\n delay?: number;\n}\n\nexport interface ITaskAbortParams {\n id: string;\n message?: string;\n}\n\nexport interface ITasksContextServiceObject {\n trigger: <\n T extends TaskDefinition.TaskInput = TaskDefinition.TaskInput,\n O extends TaskService.GenericOutput = TaskService.GenericOutput\n >(\n params: ITaskTriggerParams<T>\n ) => Promise<Result<ITask<T, O>, BaseError>>;\n abort: <\n T extends TaskDefinition.TaskInput = TaskDefinition.TaskInput,\n O extends TaskService.GenericOutput = TaskService.GenericOutput\n >(\n params: ITaskAbortParams\n ) => Promise<Result<ITask<T, O>, BaseError>>;\n fetchServiceInfo: (\n input: ITask<any, any> | string\n ) => Promise<Result<IStepFunctionServiceFetchResult, BaseError>>;\n}\n\nexport interface ITasksContextObject\n extends ITasksContextCrudObject, ITasksContextDefinitionObject, ITasksContextServiceObject {}\n\nexport interface Context extends BaseContext {\n tasks: ITasksContextObject;\n}\n\nexport interface TaskPermission extends SecurityPermission {\n name: \"task\";\n rwd?: string;\n}\n\nexport type ITask<\n I extends TaskService.TaskInput = TaskService.TaskInput,\n O extends TaskService.GenericOutput = TaskService.GenericOutput\n> = TaskService.Task<I, O>;\n\nexport type SelfCleanup = TaskDefinition.SelfCleanup;\nexport type SelfCleanupEvent = TaskDefinition.SelfCleanupEvent;\n"],"names":["TaskLogItemType","TaskDataStatus"],"mappings":";;;;AAuBO,IAAKA,wBAAeA,WAAAA,GAAAA,SAAfA,eAAe;;;WAAfA;;AAwCL,IAAKC,uBAAcA,WAAAA,GAAAA,SAAdA,cAAc;;;;;;WAAdA"}
|
package/utils/ObjectUpdater.js
CHANGED
|
@@ -1,39 +1,33 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* We need to use the object-merge-advanced library to merge array items properly.
|
|
3
|
-
* With plain assign or lodash merge, we will lose array items from the source object.
|
|
4
|
-
*/
|
|
5
|
-
|
|
6
1
|
import { mergeAdvanced } from "object-merge-advanced";
|
|
7
2
|
const mergeOptions = {
|
|
8
|
-
|
|
3
|
+
hardArrayConcat: true
|
|
9
4
|
};
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
5
|
+
class ObjectUpdater {
|
|
6
|
+
merge(target, clear = true) {
|
|
7
|
+
const item = mergeAdvanced(target, this.data, mergeOptions);
|
|
8
|
+
if (!clear) return item;
|
|
9
|
+
this.clear();
|
|
10
|
+
return item;
|
|
11
|
+
}
|
|
12
|
+
fetch(clear = true) {
|
|
13
|
+
const values = structuredClone(this.data);
|
|
14
|
+
if (!clear) return values;
|
|
15
|
+
this.clear();
|
|
16
|
+
return values;
|
|
17
|
+
}
|
|
18
|
+
update(input) {
|
|
19
|
+
this.data = mergeAdvanced(this.data, input, mergeOptions);
|
|
20
|
+
}
|
|
21
|
+
isDirty() {
|
|
22
|
+
return Object.keys(this.data).length > 0;
|
|
23
|
+
}
|
|
24
|
+
clear() {
|
|
25
|
+
this.data = {};
|
|
16
26
|
}
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
}
|
|
20
|
-
fetch(clear = true) {
|
|
21
|
-
const values = structuredClone(this.data);
|
|
22
|
-
if (!clear) {
|
|
23
|
-
return values;
|
|
27
|
+
constructor(){
|
|
28
|
+
this.data = {};
|
|
24
29
|
}
|
|
25
|
-
this.clear();
|
|
26
|
-
return values;
|
|
27
|
-
}
|
|
28
|
-
update(input) {
|
|
29
|
-
this.data = mergeAdvanced(this.data, input, mergeOptions);
|
|
30
|
-
}
|
|
31
|
-
isDirty() {
|
|
32
|
-
return Object.keys(this.data).length > 0;
|
|
33
|
-
}
|
|
34
|
-
clear() {
|
|
35
|
-
this.data = {};
|
|
36
|
-
}
|
|
37
30
|
}
|
|
31
|
+
export { ObjectUpdater };
|
|
38
32
|
|
|
39
33
|
//# sourceMappingURL=ObjectUpdater.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"file":"utils/ObjectUpdater.js","sources":["../../src/utils/ObjectUpdater.ts"],"sourcesContent":["/**\n * We need to use the object-merge-advanced library to merge array items properly.\n * With plain assign or lodash merge, we will lose array items from the source object.\n */\nimport type { defaults } from \"object-merge-advanced\";\nimport { mergeAdvanced } from \"object-merge-advanced\";\n\nconst mergeOptions: Partial<typeof defaults> = {\n hardArrayConcat: true\n};\n\nexport class ObjectUpdater<T> {\n private data: Partial<T> = {};\n\n public merge(target: T, clear = true): T {\n const item = mergeAdvanced(target, this.data, mergeOptions);\n if (!clear) {\n return item;\n }\n this.clear();\n return item;\n }\n\n public fetch(clear = true): Partial<T> {\n const values = structuredClone(this.data);\n if (!clear) {\n return values;\n }\n this.clear();\n return values;\n }\n public update(input: Partial<T>) {\n this.data = mergeAdvanced(this.data, input, mergeOptions);\n }\n\n public isDirty(): boolean {\n return Object.keys(this.data).length > 0;\n }\n\n private clear() {\n this.data = {};\n }\n}\n"],"names":["mergeOptions","ObjectUpdater","target","clear","item","mergeAdvanced","values","structuredClone","input","Object"],"mappings":";AAOA,MAAMA,eAAyC;IAC3C,iBAAiB;AACrB;AAEO,MAAMC;IAGF,MAAMC,MAAS,EAAEC,QAAQ,IAAI,EAAK;QACrC,MAAMC,OAAOC,cAAcH,QAAQ,IAAI,CAAC,IAAI,EAAEF;QAC9C,IAAI,CAACG,OACD,OAAOC;QAEX,IAAI,CAAC,KAAK;QACV,OAAOA;IACX;IAEO,MAAMD,QAAQ,IAAI,EAAc;QACnC,MAAMG,SAASC,gBAAgB,IAAI,CAAC,IAAI;QACxC,IAAI,CAACJ,OACD,OAAOG;QAEX,IAAI,CAAC,KAAK;QACV,OAAOA;IACX;IACO,OAAOE,KAAiB,EAAE;QAC7B,IAAI,CAAC,IAAI,GAAGH,cAAc,IAAI,CAAC,IAAI,EAAEG,OAAOR;IAChD;IAEO,UAAmB;QACtB,OAAOS,OAAO,IAAI,CAAC,IAAI,CAAC,IAAI,EAAE,MAAM,GAAG;IAC3C;IAEQ,QAAQ;QACZ,IAAI,CAAC,IAAI,GAAG,CAAC;IACjB;;aA7BQ,IAAI,GAAe,CAAC;;AA8BhC"}
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import { getObjectProperties } from "./getObjectProperties.js";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
2
|
+
const getErrorProperties = (error)=>{
|
|
3
|
+
const value = getObjectProperties(error);
|
|
4
|
+
delete value.stack;
|
|
5
|
+
return value;
|
|
6
6
|
};
|
|
7
|
+
export { getErrorProperties };
|
|
7
8
|
|
|
8
9
|
//# sourceMappingURL=getErrorProperties.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"file":"utils/getErrorProperties.js","sources":["../../src/utils/getErrorProperties.ts"],"sourcesContent":["import type { IResponseError } from \"~/response/abstractions/index.js\";\nimport { getObjectProperties } from \"~/utils/getObjectProperties.js\";\n\nexport const getErrorProperties = (error: Error | IResponseError): IResponseError => {\n const value = getObjectProperties<IResponseError>(error);\n\n delete value.stack;\n\n return value;\n};\n"],"names":["getErrorProperties","error","value","getObjectProperties"],"mappings":";AAGO,MAAMA,qBAAqB,CAACC;IAC/B,MAAMC,QAAQC,oBAAoCF;IAElD,OAAOC,MAAM,KAAK;IAElB,OAAOA;AACX"}
|
|
@@ -1,18 +1,11 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
}
|
|
9
|
-
return Object.getOwnPropertyNames(input).reduce((acc, key) => {
|
|
10
|
-
if (key === "stack") {
|
|
11
|
-
return acc;
|
|
12
|
-
}
|
|
13
|
-
acc[key] = input[key];
|
|
14
|
-
return acc;
|
|
15
|
-
}, {});
|
|
1
|
+
const getObjectProperties = (input)=>{
|
|
2
|
+
if (!input || "object" != typeof input) return {};
|
|
3
|
+
return Object.getOwnPropertyNames(input).reduce((acc, key)=>{
|
|
4
|
+
if ("stack" === key) return acc;
|
|
5
|
+
acc[key] = input[key];
|
|
6
|
+
return acc;
|
|
7
|
+
}, {});
|
|
16
8
|
};
|
|
9
|
+
export { getObjectProperties };
|
|
17
10
|
|
|
18
11
|
//# sourceMappingURL=getObjectProperties.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"file":"utils/getObjectProperties.js","sources":["../../src/utils/getObjectProperties.ts"],"sourcesContent":["/**\n * Unfortunately we need some casting as we do not know which properties are available on the object.\n */\ninterface GenericRecord {\n [key: string]: any;\n}\n\nexport const getObjectProperties = <T = GenericRecord>(input: unknown): T => {\n if (!input || typeof input !== \"object\") {\n return {} as unknown as T;\n }\n return Object.getOwnPropertyNames(input).reduce<T>((acc, key) => {\n if (key === \"stack\") {\n return acc;\n }\n acc[key as keyof T] = (input as unknown as T)[key as keyof T];\n return acc;\n }, {} as T) as unknown as T;\n};\n"],"names":["getObjectProperties","input","Object","acc","key"],"mappings":"AAOO,MAAMA,sBAAsB,CAAoBC;IACnD,IAAI,CAACA,SAAS,AAAiB,YAAjB,OAAOA,OACjB,OAAO,CAAC;IAEZ,OAAOC,OAAO,mBAAmB,CAACD,OAAO,MAAM,CAAI,CAACE,KAAKC;QACrD,IAAIA,AAAQ,YAARA,KACA,OAAOD;QAEXA,GAAG,CAACC,IAAe,GAAIH,KAAsB,CAACG,IAAe;QAC7D,OAAOD;IACX,GAAG,CAAC;AACR"}
|
package/utils/index.js
CHANGED
|
@@ -1,15 +1,16 @@
|
|
|
1
|
-
const ALL_EVENTS = [
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
return new Set(
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
return new Set(
|
|
11
|
-
|
|
12
|
-
|
|
1
|
+
const ALL_EVENTS = [
|
|
2
|
+
"onSuccess",
|
|
3
|
+
"onError",
|
|
4
|
+
"onAbort"
|
|
5
|
+
];
|
|
6
|
+
const normalizeSelfCleanup = (value)=>{
|
|
7
|
+
if (void 0 === value || "never" === value) return new Set();
|
|
8
|
+
if ("always" === value) return new Set(ALL_EVENTS);
|
|
9
|
+
if (Array.isArray(value)) return new Set(value);
|
|
10
|
+
return new Set([
|
|
11
|
+
value
|
|
12
|
+
]);
|
|
13
13
|
};
|
|
14
|
+
export { normalizeSelfCleanup };
|
|
14
15
|
|
|
15
16
|
//# sourceMappingURL=normalizeSelfCleanup.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"file":"utils/normalizeSelfCleanup.js","sources":["../../src/utils/normalizeSelfCleanup.ts"],"sourcesContent":["import type { TaskDefinition } from \"@webiny/api-core/features/task/TaskDefinition/index.js\";\n\nconst ALL_EVENTS: ReadonlyArray<TaskDefinition.SelfCleanupEvent> = [\n \"onSuccess\",\n \"onError\",\n \"onAbort\"\n];\n\nexport const normalizeSelfCleanup = (\n value: TaskDefinition.SelfCleanup | undefined\n): ReadonlySet<TaskDefinition.SelfCleanupEvent> => {\n if (value === undefined || value === \"never\") {\n return new Set();\n }\n if (value === \"always\") {\n return new Set(ALL_EVENTS);\n }\n if (Array.isArray(value)) {\n return new Set(value);\n }\n return new Set([value]);\n};\n"],"names":["ALL_EVENTS","normalizeSelfCleanup","value","undefined","Set","Array"],"mappings":"AAEA,MAAMA,aAA6D;IAC/D;IACA;IACA;CACH;AAEM,MAAMC,uBAAuB,CAChCC;IAEA,IAAIA,AAAUC,WAAVD,SAAuBA,AAAU,YAAVA,OACvB,OAAO,IAAIE;IAEf,IAAIF,AAAU,aAAVA,OACA,OAAO,IAAIE,IAAIJ;IAEnB,IAAIK,MAAM,OAAO,CAACH,QACd,OAAO,IAAIE,IAAIF;IAEnB,OAAO,IAAIE,IAAI;QAACF;KAAM;AAC1B"}
|
package/events/index.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":[],"sources":["index.ts"],"sourcesContent":["export * from \"./abstractions.js\";\nexport * from \"./TaskBeforeCreateEvent.js\";\nexport * from \"./TaskAfterCreateEvent.js\";\nexport * from \"./TaskBeforeUpdateEvent.js\";\nexport * from \"./TaskAfterUpdateEvent.js\";\nexport * from \"./TaskBeforeDeleteEvent.js\";\nexport * from \"./TaskAfterDeleteEvent.js\";\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA","ignoreList":[]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":["AbortTaskUseCase","AbortTaskFeature"],"sources":["index.ts"],"sourcesContent":["export { AbortTaskUseCase } from \"./abstractions.js\";\nexport { AbortTaskFeature } from \"./feature.js\";\n"],"mappings":"AAAA,SAASA,gBAAgB;AACzB,SAASC,gBAAgB","ignoreList":[]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":["CleanupTaskSubtreeUseCase","CleanupTaskSubtreeUseCaseImpl"],"sources":["index.ts"],"sourcesContent":["export { CleanupTaskSubtreeUseCase } from \"./abstractions.js\";\nexport { CleanupTaskSubtreeUseCaseImpl } from \"./CleanupTaskSubtreeUseCase.js\";\n"],"mappings":"AAAA,SAASA,yBAAyB;AAClC,SAASC,6BAA6B","ignoreList":[]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":["GetTaskUseCase","GetTaskFeature"],"sources":["index.ts"],"sourcesContent":["export { GetTaskUseCase } from \"./abstractions.js\";\nexport { GetTaskFeature } from \"./feature.js\";\n"],"mappings":"AAAA,SAASA,cAAc;AACvB,SAASC,cAAc","ignoreList":[]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":["GetTaskDefinitionUseCase","GetTaskDefinitionFeature"],"sources":["index.ts"],"sourcesContent":["export { GetTaskDefinitionUseCase } from \"./abstractions.js\";\nexport { GetTaskDefinitionFeature } from \"./feature.js\";\n"],"mappings":"AAAA,SAASA,wBAAwB;AACjC,SAASC,wBAAwB","ignoreList":[]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":["ListTaskDefinitionsUseCase","ListTaskDefinitionsFeature"],"sources":["index.ts"],"sourcesContent":["export { ListTaskDefinitionsUseCase } from \"./abstractions.js\";\nexport { ListTaskDefinitionsFeature } from \"./feature.js\";\n"],"mappings":"AAAA,SAASA,0BAA0B;AACnC,SAASC,0BAA0B","ignoreList":[]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":["ListTasksUseCase","ListTasksFeature"],"sources":["index.ts"],"sourcesContent":["export { ListTasksUseCase } from \"./abstractions.js\";\nexport { ListTasksFeature } from \"./feature.js\";\n"],"mappings":"AAAA,SAASA,gBAAgB;AACzB,SAASC,gBAAgB","ignoreList":[]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":[],"sources":["augmentation.ts"],"sourcesContent":["import type { IResponseError } from \"@webiny/api-core/features/task/TaskDefinition\";\nimport type { TaskDataStatus } from \"~/types.js\";\nimport {\n type ITaskTriggerParams,\n TaskService\n} from \"@webiny/api-core/features/task/TaskService/index.js\";\nimport { TaskDefinition } from \"@webiny/api-core/features/task/TaskDefinition/index.js\";\nimport type { ITaskResponse } from \"~/response/abstractions/index.js\";\nimport { Result } from \"@webiny/feature/api\";\nimport { BaseError } from \"@webiny/feature/api/index.js\";\n\n/**\n * Augment the TaskController interface from api-core with implementation details.\n * This allows developers to import from @webiny/api-core but get the full interface.\n */\ndeclare module \"@webiny/api-core/features/task/TaskController/abstractions.js\" {\n interface ITaskController<\n I extends TaskDefinition.TaskInput = TaskDefinition.TaskInput,\n O extends TaskDefinition.TaskOutput = TaskDefinition.TaskOutput\n > {\n /**\n * Response object\n */\n response: ITaskResponse<I, O>;\n\n /**\n * State management - access and update task state\n */\n state: {\n getTask(): TaskService.Task<I, O>;\n getStatus(): TaskDataStatus;\n getInput(): I;\n getOutput(): O | undefined;\n updateInput(input: Partial<I>): Promise<void>;\n updateOutput(output: Partial<O>): Promise<void>;\n };\n\n /**\n * Logging - add log entries to task\n */\n logger: {\n info(params: { message: string; data?: Record<string, any> }): Promise<void>;\n error(params: {\n message: string;\n error?: Error | IResponseError;\n data?: Record<string, any>;\n }): Promise<void>;\n };\n\n /**\n * Task management - trigger and query child tasks\n */\n task: {\n trigger<CI extends TaskDefinition.TaskInput = TaskDefinition.TaskInput>(\n params: ITaskTriggerParams<CI>\n ): Promise<Result<TaskService.Task<CI>, BaseError>>;\n\n listChildren<\n CT extends TaskDefinition.TaskInput = I,\n CO extends TaskDefinition.TaskOutput = O\n >(\n definitionId?: string\n ): Promise<TaskService.Task<CT, CO>[]>;\n };\n\n /**\n * Runtime checks\n */\n runtime: {\n isCloseToTimeout(seconds?: number): boolean;\n isAborted(): boolean;\n getRemainingSeconds(): number;\n getRemainingMilliseconds(): number;\n };\n }\n}\n"],"mappings":"","ignoreList":[]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":["TaskController"],"sources":["index.ts"],"sourcesContent":["// Import augmentation to ensure it's loaded\nimport \"./augmentation.js\";\n\n// Export implementation only\nexport { TaskController } from \"./TaskController.js\";\n"],"mappings":"AAAA;AACA;;AAEA;AACA,SAASA,cAAc","ignoreList":[]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":[],"sources":["index.ts"],"sourcesContent":["export * from \"./abstractions.js\";\n"],"mappings":"AAAA","ignoreList":[]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":["TriggerTaskUseCase","TriggerTaskFeature"],"sources":["index.ts"],"sourcesContent":["export { TriggerTaskUseCase } from \"./abstractions.js\";\nexport { TriggerTaskFeature } from \"./feature.js\";\n"],"mappings":"AAAA,SAASA,kBAAkB;AAC3B,SAASC,kBAAkB","ignoreList":[]}
|
package/global.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":[],"sources":["global.ts"],"sourcesContent":["import \"./features/TaskController/augmentation.js\";\n"],"mappings":"AAAA","ignoreList":[]}
|
package/handler/types.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":[],"sources":["types.ts"],"sourcesContent":["import type { HandlerFactoryParams } from \"@webiny/handler-aws/types.js\";\n\nexport type HandlerParams = HandlerFactoryParams;\n\nexport interface IIncomingEvent<TEvent> {\n name: string;\n payload: TEvent;\n}\n\nexport interface ITaskEventInput {\n tenant: string;\n webinyTaskId: string;\n webinyTaskDefinitionId: string;\n delay?: number;\n}\n\nexport interface ITaskEvent {\n tenant: string;\n endpoint: string;\n webinyTaskId: string;\n webinyTaskDefinitionId: string;\n executionName: string;\n stateMachineId: string;\n}\n\nexport interface ITaskRawEvent extends ITaskEvent {\n delay?: number;\n}\n"],"mappings":"","ignoreList":[]}
|
package/index.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":["createBackgroundTaskGraphQL","createBackgroundTaskContext"],"sources":["index.ts"],"sourcesContent":["import \"./handler/register.js\";\n\nexport { createBackgroundTaskGraphQL } from \"./graphql/index.js\";\nexport { createBackgroundTaskContext } from \"./context.js\";\n\nexport * from \"./response/index.js\";\nexport * from \"./types.js\";\n"],"mappings":"AAAA;AAEA,SAASA,2BAA2B;AACpC,SAASC,2BAA2B;AAEpC;AACA","ignoreList":[]}
|
package/plugins/index.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":[],"sources":["index.ts"],"sourcesContent":["export * from \"./TaskServicePlugin.js\";\n"],"mappings":"AAAA","ignoreList":[]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":[],"sources":["Response.ts"],"sourcesContent":["import type { ITaskEvent } from \"~/handler/types.js\";\nimport type { IResponseContinueParams, IResponseContinueResult } from \"./ResponseContinueResult.js\";\nimport type { IResponseDoneParams, IResponseDoneResult } from \"./ResponseDoneResult.js\";\nimport type { IResponseErrorParams, IResponseErrorResult } from \"./ResponseErrorResult.js\";\nimport type { IResponseAbortedResult } from \"./ResponseAbortedResult.js\";\nimport { TaskDefinition } from \"@webiny/api-core/features/task/TaskDefinition/index.js\";\n\nexport type IResponseFromParams =\n | IResponseDoneResult\n | IResponseContinueResult\n | IResponseErrorResult;\n\nexport type IResponseResult =\n | IResponseDoneResult\n | IResponseContinueResult\n | IResponseErrorResult\n | IResponseAbortedResult;\n\nexport interface IResponse {\n readonly event: ITaskEvent;\n\n setEvent: (event: ITaskEvent) => void;\n\n from: (params: IResponseFromParams) => IResponseResult;\n done: <O extends TaskDefinition.TaskOutput = TaskDefinition.TaskOutput>(\n params?: IResponseDoneParams<O>\n ) => IResponseDoneResult<O>;\n aborted: () => IResponseAbortedResult;\n continue: (params: IResponseContinueParams) => IResponseContinueResult;\n error: (params: IResponseErrorParams) => IResponseErrorResult;\n}\n\nexport interface IResponseAsync {\n readonly response: IResponse;\n\n from: (result: IResponseResult) => Promise<IResponseResult>;\n done: (params: IResponseDoneParams) => Promise<IResponseDoneResult>;\n continue: (\n params: IResponseContinueParams\n ) => Promise<IResponseContinueResult | IResponseErrorResult>;\n aborted: () => Promise<IResponseAbortedResult>;\n error: (params: IResponseErrorParams) => Promise<IResponseErrorResult>;\n}\n"],"mappings":"","ignoreList":[]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":[],"sources":["ResponseAbortedResult.ts"],"sourcesContent":["import type { IResponseBaseResult } from \"~/response/abstractions/ResponseBaseResult.js\";\nimport { TaskResultStatus } from \"@webiny/api-core/features/task/TaskDefinition/index.js\";\n\nexport interface IResponseAbortedResult extends IResponseBaseResult {\n status: TaskResultStatus.ABORTED;\n}\n"],"mappings":"","ignoreList":[]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":[],"sources":["ResponseBaseResult.ts"],"sourcesContent":["import { TaskResultStatus } from \"@webiny/api-core/features/task/TaskDefinition/index.js\";\n\nexport interface IResponseBaseResult {\n status: TaskResultStatus;\n webinyTaskId: string;\n webinyTaskDefinitionId: string;\n tenant: string;\n}\n"],"mappings":"","ignoreList":[]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":[],"sources":["ResponseContinueResult.ts"],"sourcesContent":["import type { ITaskDataInput } from \"~/types.js\";\nimport type { IResponseBaseResult } from \"./ResponseBaseResult.js\";\nimport { TaskResultStatus } from \"@webiny/api-core/features/task/TaskDefinition/index.js\";\n\n/**\n * Wait can be used to pause next iteration of the Lambda execution.\n * For example, if the task is hammering the Elasticsearch cluster too much, you can use this to pause the execution for some time.\n */\n\nexport interface IResponseContinueParams<T = ITaskDataInput> {\n message?: string;\n tenant?: string;\n webinyTaskId?: string;\n input: T;\n wait?: number;\n}\n\nexport interface IResponseContinueResult<T = ITaskDataInput> extends IResponseBaseResult {\n message?: string;\n input: T;\n wait?: number;\n delay: -1;\n status: TaskResultStatus.CONTINUE;\n}\n"],"mappings":"","ignoreList":[]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":[],"sources":["ResponseDoneResult.ts"],"sourcesContent":["import type { IResponseBaseResult } from \"./ResponseBaseResult.js\";\nimport {\n TaskDefinition,\n TaskResultStatus\n} from \"@webiny/api-core/features/task/TaskDefinition/index.js\";\n\nexport interface IResponseDoneParams<\n O extends TaskDefinition.TaskOutput = TaskDefinition.TaskOutput\n> {\n tenant?: string;\n webinyTaskId?: string;\n message?: string;\n output?: O;\n}\n\nexport interface IResponseDoneResult<\n O extends TaskDefinition.TaskOutput = TaskDefinition.TaskOutput\n> extends IResponseBaseResult {\n message?: string;\n output?: O;\n status: TaskResultStatus.DONE;\n}\n"],"mappings":"","ignoreList":[]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":[],"sources":["ResponseErrorResult.ts"],"sourcesContent":["import type { IResponseBaseResult } from \"./ResponseBaseResult.js\";\nimport type { GenericRecord } from \"@webiny/api/types.js\";\nimport { TaskResultStatus } from \"@webiny/api-core/features/task/TaskDefinition/index.js\";\n\nexport interface IResponseError {\n message: string;\n code?: string | null;\n data?: GenericRecord | null;\n stack?: string;\n}\n\nexport interface IResponseErrorParams {\n error: IResponseError | Error;\n tenant?: string;\n webinyTaskId?: string;\n}\n\nexport interface IResponseErrorResult extends IResponseBaseResult {\n error: IResponseError;\n status: TaskResultStatus.ERROR;\n}\n"],"mappings":"","ignoreList":[]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":[],"sources":["TaskResponse.ts"],"sourcesContent":["import type { IResponseError } from \"./ResponseErrorResult.js\";\nimport { TaskDefinition } from \"@webiny/api-core/features/task/TaskDefinition/index.js\";\n\nexport interface ITaskResponseContinueOptionsUntil {\n date: Date;\n}\nexport interface ITaskResponseContinueOptionsSeconds {\n seconds: number;\n}\n\nexport type ITaskResponseContinueOptions =\n | ITaskResponseContinueOptionsUntil\n | ITaskResponseContinueOptionsSeconds;\n\nexport interface ITaskResponse<\n I extends TaskDefinition.TaskInput = TaskDefinition.TaskInput,\n O extends TaskDefinition.TaskOutput = TaskDefinition.TaskOutput\n> {\n done(output?: O): TaskDefinition.ResultDone<O>;\n done(message?: string, output?: O): TaskDefinition.ResultDone<O>;\n continue(data: I, options?: ITaskResponseContinueOptions): TaskDefinition.ResultContinue<I>;\n error(error: IResponseError | Error | string): TaskDefinition.ResultError;\n aborted(): TaskDefinition.ResultAborted;\n}\n"],"mappings":"","ignoreList":[]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":[],"sources":["index.ts"],"sourcesContent":["export * from \"./Response.js\";\nexport * from \"./ResponseContinueResult.js\";\nexport * from \"./ResponseDoneResult.js\";\nexport * from \"./ResponseErrorResult.js\";\nexport * from \"./ResponseAbortedResult.js\";\nexport * from \"./ResponseBaseResult.js\";\nexport * from \"./TaskResponse.js\";\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA","ignoreList":[]}
|
package/response/index.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":[],"sources":["index.ts"],"sourcesContent":["export * from \"./DatabaseResponse.js\";\nexport * from \"./Response.js\";\nexport * from \"./ResponseContinueResult.js\";\nexport * from \"./ResponseDoneResult.js\";\nexport * from \"./ResponseAbortedResult.js\";\nexport * from \"./ResponseErrorResult.js\";\nexport * from \"./TaskResponse.js\";\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA","ignoreList":[]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":[],"sources":["TaskControl.ts"],"sourcesContent":["import type { ITaskRunner } from \"~/runner/abstractions/index.js\";\nimport type { IResponse, IResponseResult } from \"~/response/abstractions/index.js\";\nimport type { Context } from \"~/types.js\";\nimport type { ITaskEvent } from \"~/handler/types.js\";\n\nexport interface ITaskControl {\n runner: ITaskRunner;\n response: IResponse;\n context: Context;\n\n run(event: ITaskEvent): Promise<IResponseResult>;\n}\n"],"mappings":"","ignoreList":[]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":[],"sources":["TaskEventValidation.ts"],"sourcesContent":["import type { ITaskEvent } from \"~/handler/types.js\";\n\nexport type ITaskEventValidationResult = ITaskEvent;\n\nexport interface ITaskEventValidation {\n validate: (event: Partial<ITaskEvent>) => ITaskEventValidationResult;\n}\n"],"mappings":"","ignoreList":[]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":[],"sources":["TaskManager.ts"],"sourcesContent":["import type { IResponseResult } from \"~/response/abstractions/index.js\";\nimport { TaskDefinition } from \"@webiny/api-core/features/task/TaskDefinition/index.js\";\n\nexport interface ITaskManager {\n run: (definition: TaskDefinition.Runnable) => Promise<IResponseResult>;\n}\n"],"mappings":"","ignoreList":[]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":[],"sources":["TaskManagerStore.ts"],"sourcesContent":["import type {\n IResponseError,\n ITask,\n ITaskLogItemData,\n ITaskUpdateData,\n TaskDataStatus\n} from \"~/types.js\";\nimport { TaskDefinition } from \"@webiny/api-core/features/task/TaskDefinition/index.js\";\n\nexport type ITaskManagerStoreUpdateTaskValues<\n T extends TaskDefinition.TaskInput = TaskDefinition.TaskInput\n> = T;\n\nexport interface ITaskManagerStoreUpdateTaskValuesCb<\n T extends TaskDefinition.TaskInput = TaskDefinition.TaskInput\n> {\n (input: T): T;\n}\n\nexport interface ITaskManagerStoreUpdateTaskInputOptions {\n save: boolean;\n}\n\nexport type ITaskManagerStoreUpdateTaskInputParam<\n T extends TaskDefinition.TaskInput = TaskDefinition.TaskInput\n> = ITaskManagerStoreUpdateTaskValuesCb<T> | Partial<ITaskManagerStoreUpdateTaskValues<T>>;\n\nexport interface ITaskManagerStoreUpdateTaskParamCb<\n T extends TaskDefinition.TaskInput = TaskDefinition.TaskInput,\n O extends TaskDefinition.TaskOutput = TaskDefinition.TaskOutput\n> {\n (task: ITask<T, O>): ITaskUpdateData<T, O>;\n}\n\nexport type ITaskManagerStoreUpdateTask<\n T extends TaskDefinition.TaskInput = TaskDefinition.TaskInput,\n O extends TaskDefinition.TaskOutput = TaskDefinition.TaskOutput\n> = ITaskUpdateData<T, O>;\n\nexport type ITaskManagerStoreUpdateTaskParams<\n T extends TaskDefinition.TaskInput = TaskDefinition.TaskInput,\n O extends TaskDefinition.TaskOutput = TaskDefinition.TaskOutput\n> = ITaskManagerStoreUpdateTaskParamCb<T, O> | Partial<ITaskManagerStoreUpdateTask<T, O>>;\n\nexport interface ITaskManagerStoreInfoLog {\n message: string;\n data?: ITaskLogItemData;\n}\n\nexport interface ITaskManagerStoreErrorLog {\n message: string;\n data?: ITaskLogItemData;\n error: IResponseError | Error;\n}\n\nexport interface ITaskManagerStoreSetOutputOptions {\n /**\n * Default is true.\n */\n save?: boolean;\n}\n\nexport interface ITaskManagerStoreUpdateTaskOptions {\n /**\n * Default is true.\n */\n save?: boolean;\n}\n\nexport interface ITaskManagerStoreAddLogOptions {\n /**\n * Default is true.\n */\n save?: boolean;\n}\n\n/**\n * Interface should not be used outside the @webiny/tasks package.\n */\nexport interface ITaskManagerStorePrivate<\n T extends TaskDefinition.TaskInput = TaskDefinition.TaskInput,\n O extends TaskDefinition.TaskOutput = TaskDefinition.TaskOutput\n> {\n getTask: () => ITask<T, O>;\n getStatus: () => TaskDataStatus;\n /**\n * @throws {Error} If task not found or something goes wrong during the database update.\n */\n updateTask(\n params: ITaskManagerStoreUpdateTaskParams<T, O>,\n options?: ITaskManagerStoreUpdateTaskOptions\n ): Promise<void>;\n /**\n * List all child tasks of the current task.\n * If definitionId is provided, filter by that parameter.\n */\n listChildTasks<\n T extends TaskDefinition.TaskInput = TaskDefinition.TaskInput,\n O extends TaskDefinition.TaskOutput = TaskDefinition.TaskOutput\n >(\n definitionId?: string\n ): Promise<ITask<T, O>[]>;\n /**\n * Update the task input, which are used to store custom user data.\n * You can send partial input, and it will be merged with the existing input.\n *\n * @throws {Error} If task not found or something goes wrong during the database update.\n */\n updateInput: (\n params: ITaskManagerStoreUpdateTaskInputParam<T>,\n options?: ITaskManagerStoreUpdateTaskInputOptions\n ) => Promise<void>;\n getInput: () => T;\n /**\n * Update the task output, which are used to store the output data.\n * You can send partial output, and it will be merged with the existing output.\n *\n * Second parameter is optional options, and it contains a possibility not to store the task immediately.\n *\n * @throws {Error} If task not found or something goes wrong during the database update.\n */\n updateOutput: (\n values: Partial<O>,\n options?: ITaskManagerStoreSetOutputOptions\n ) => Promise<void>;\n getOutput: () => O;\n /**\n * @throws {Error} If task not found or something goes wrong during the database update.\n */\n addInfoLog: (log: ITaskManagerStoreInfoLog) => Promise<void>;\n /**\n * @throws {Error} If task not found or something goes wrong during the database update.\n *\n *\n */\n addErrorLog: (log: ITaskManagerStoreErrorLog) => Promise<void>;\n /**\n * Should store the task and logs into the database, if any.\n * If nothing to update, it should skip calling the internal store methods.\n */\n save(): Promise<void>;\n}\n\nexport type ITaskManagerStore<\n T extends TaskDefinition.TaskInput = TaskDefinition.TaskInput,\n O extends TaskDefinition.TaskOutput = TaskDefinition.TaskOutput\n> = Omit<ITaskManagerStorePrivate<T, O>, \"save\">;\n"],"mappings":"","ignoreList":[]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":[],"sources":["TaskRunner.ts"],"sourcesContent":["import type { Context } from \"~/types.js\";\nimport type { ITaskEvent } from \"~/handler/types.js\";\nimport type { IResponseResult } from \"~/response/abstractions/index.js\";\nimport type { ITimer } from \"@webiny/handler-aws\";\n\nexport interface IIsCloseToTimeoutCallable {\n (seconds?: number): boolean;\n}\n\nexport interface ITaskRunner<C extends Context = Context> {\n context: C;\n isCloseToTimeout: IIsCloseToTimeoutCallable;\n timer: ITimer;\n run(event: ITaskEvent): Promise<IResponseResult>;\n}\n"],"mappings":"","ignoreList":[]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":[],"sources":["index.ts"],"sourcesContent":["export * from \"./TaskControl.js\";\nexport * from \"./TaskEventValidation.js\";\nexport * from \"./TaskManager.js\";\nexport * from \"./TaskRunner.js\";\nexport * from \"./TaskManagerStore.js\";\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA","ignoreList":[]}
|
package/runner/index.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":[],"sources":["index.ts"],"sourcesContent":["export * from \"./TaskRunner.js\";\n"],"mappings":"AAAA","ignoreList":[]}
|
package/utils/index.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":[],"sources":["index.ts"],"sourcesContent":["export * from \"./getErrorProperties.js\";\nexport * from \"./getObjectProperties.js\";\nexport * from \"./ObjectUpdater.js\";\n"],"mappings":"AAAA;AACA;AACA","ignoreList":[]}
|