@webiny/tasks 6.0.0-alpha.5 → 6.0.0-rc.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/README.md +10 -9
- package/context.js +43 -21
- package/context.js.map +1 -1
- package/crud/TaskLogPrivateModel.d.ts +9 -0
- package/crud/TaskLogPrivateModel.js +34 -0
- package/crud/TaskLogPrivateModel.js.map +1 -0
- package/crud/TaskPrivateModel.d.ts +9 -0
- package/crud/TaskPrivateModel.js +46 -0
- package/crud/TaskPrivateModel.js.map +1 -0
- package/crud/crud.tasks.d.ts +1 -1
- package/crud/crud.tasks.js +209 -104
- package/crud/crud.tasks.js.map +1 -1
- package/crud/definition.tasks.d.ts +1 -1
- package/crud/definition.tasks.js +9 -18
- package/crud/definition.tasks.js.map +1 -1
- package/crud/service.tasks.d.ts +1 -1
- package/crud/service.tasks.js +31 -36
- package/crud/service.tasks.js.map +1 -1
- package/decorators/RunnableTaskDecorator.d.ts +31 -0
- package/decorators/RunnableTaskDecorator.js +82 -0
- package/decorators/RunnableTaskDecorator.js.map +1 -0
- package/domain/errors.d.ts +29 -0
- package/domain/errors.js +47 -0
- package/domain/errors.js.map +1 -0
- package/events/TaskAfterCreateEvent.d.ts +6 -0
- package/events/TaskAfterCreateEvent.js +10 -0
- package/events/TaskAfterCreateEvent.js.map +1 -0
- package/events/TaskAfterDeleteEvent.d.ts +6 -0
- package/events/TaskAfterDeleteEvent.js +10 -0
- package/events/TaskAfterDeleteEvent.js.map +1 -0
- package/events/TaskAfterUpdateEvent.d.ts +6 -0
- package/events/TaskAfterUpdateEvent.js +10 -0
- package/events/TaskAfterUpdateEvent.js.map +1 -0
- package/events/TaskBeforeCreateEvent.d.ts +6 -0
- package/events/TaskBeforeCreateEvent.js +10 -0
- package/events/TaskBeforeCreateEvent.js.map +1 -0
- package/events/TaskBeforeDeleteEvent.d.ts +6 -0
- package/events/TaskBeforeDeleteEvent.js +10 -0
- package/events/TaskBeforeDeleteEvent.js.map +1 -0
- package/events/TaskBeforeUpdateEvent.d.ts +6 -0
- package/events/TaskBeforeUpdateEvent.js +10 -0
- package/events/TaskBeforeUpdateEvent.js.map +1 -0
- package/events/abstractions.d.ts +53 -0
- package/events/abstractions.js +39 -0
- package/events/abstractions.js.map +1 -0
- package/events/index.d.ts +7 -0
- package/events/index.js +9 -0
- package/events/index.js.map +1 -0
- package/features/AbortTask/AbortTaskUseCase.d.ts +10 -0
- package/features/AbortTask/AbortTaskUseCase.js +11 -0
- package/features/AbortTask/AbortTaskUseCase.js.map +1 -0
- package/features/AbortTask/abstractions.d.ts +25 -0
- package/features/AbortTask/abstractions.js +4 -0
- package/features/AbortTask/abstractions.js.map +1 -0
- package/features/AbortTask/feature.d.ts +2 -0
- package/features/AbortTask/feature.js +11 -0
- package/features/AbortTask/feature.js.map +1 -0
- package/features/AbortTask/index.d.ts +2 -0
- package/features/AbortTask/index.js +4 -0
- package/features/AbortTask/index.js.map +1 -0
- package/features/GetTask/GetTaskUseCase.d.ts +9 -0
- package/features/GetTask/GetTaskUseCase.js +10 -0
- package/features/GetTask/GetTaskUseCase.js.map +1 -0
- package/features/GetTask/abstractions.d.ts +10 -0
- package/features/GetTask/abstractions.js +4 -0
- package/features/GetTask/abstractions.js.map +1 -0
- package/features/GetTask/feature.d.ts +2 -0
- package/features/GetTask/feature.js +11 -0
- package/features/GetTask/feature.js.map +1 -0
- package/features/GetTask/index.d.ts +2 -0
- package/features/GetTask/index.js +4 -0
- package/features/GetTask/index.js.map +1 -0
- package/features/GetTaskDefinition/GetTaskDefinitionUseCase.d.ts +12 -0
- package/features/GetTaskDefinition/GetTaskDefinitionUseCase.js +25 -0
- package/features/GetTaskDefinition/GetTaskDefinitionUseCase.js.map +1 -0
- package/features/GetTaskDefinition/abstractions.d.ts +17 -0
- package/features/GetTaskDefinition/abstractions.js +4 -0
- package/features/GetTaskDefinition/abstractions.js.map +1 -0
- package/features/GetTaskDefinition/feature.d.ts +1 -0
- package/features/GetTaskDefinition/feature.js +10 -0
- package/features/GetTaskDefinition/feature.js.map +1 -0
- package/features/GetTaskDefinition/index.d.ts +2 -0
- package/features/GetTaskDefinition/index.js +4 -0
- package/features/GetTaskDefinition/index.js.map +1 -0
- package/features/ListTaskDefinitions/ListTaskDefinitionsUseCase.d.ts +11 -0
- package/features/ListTaskDefinitions/ListTaskDefinitionsUseCase.js +18 -0
- package/features/ListTaskDefinitions/ListTaskDefinitionsUseCase.js.map +1 -0
- package/features/ListTaskDefinitions/abstractions.d.ts +9 -0
- package/features/ListTaskDefinitions/abstractions.js +4 -0
- package/features/ListTaskDefinitions/abstractions.js.map +1 -0
- package/features/ListTaskDefinitions/feature.d.ts +1 -0
- package/features/ListTaskDefinitions/feature.js +10 -0
- package/features/ListTaskDefinitions/feature.js.map +1 -0
- package/features/ListTaskDefinitions/index.d.ts +2 -0
- package/features/ListTaskDefinitions/index.js +4 -0
- package/features/ListTaskDefinitions/index.js.map +1 -0
- package/features/ListTasks/ListTasksUseCase.d.ts +9 -0
- package/features/ListTasks/ListTasksUseCase.js +10 -0
- package/features/ListTasks/ListTasksUseCase.js.map +1 -0
- package/features/ListTasks/abstractions.d.ts +13 -0
- package/features/ListTasks/abstractions.js +4 -0
- package/features/ListTasks/abstractions.js.map +1 -0
- package/features/ListTasks/feature.d.ts +2 -0
- package/features/ListTasks/feature.js +11 -0
- package/features/ListTasks/feature.js.map +1 -0
- package/features/ListTasks/index.d.ts +2 -0
- package/features/ListTasks/index.js +4 -0
- package/features/ListTasks/index.js.map +1 -0
- package/features/TaskController/TaskController.d.ts +49 -0
- package/features/TaskController/TaskController.js +71 -0
- package/features/TaskController/TaskController.js.map +1 -0
- package/features/TaskController/augmentation.d.ts +60 -0
- package/features/TaskController/augmentation.js +3 -0
- package/features/TaskController/augmentation.js.map +1 -0
- package/features/TaskController/index.d.ts +2 -0
- package/features/TaskController/index.js +7 -0
- package/features/TaskController/index.js.map +1 -0
- package/features/TaskExecutionContext/TaskExecutionContext.d.ts +24 -0
- package/features/TaskExecutionContext/TaskExecutionContext.js +50 -0
- package/features/TaskExecutionContext/TaskExecutionContext.js.map +1 -0
- package/features/TaskExecutionContext/abstractions.d.ts +26 -0
- package/features/TaskExecutionContext/abstractions.js +13 -0
- package/features/TaskExecutionContext/abstractions.js.map +1 -0
- package/features/TaskExecutionContext/feature.d.ts +1 -0
- package/features/TaskExecutionContext/feature.js +10 -0
- package/features/TaskExecutionContext/feature.js.map +1 -0
- package/features/TaskExecutionContext/index.d.ts +1 -0
- package/features/TaskExecutionContext/index.js +3 -0
- package/features/TaskExecutionContext/index.js.map +1 -0
- package/features/TriggerTask/TriggerTaskUseCase.d.ts +10 -0
- package/features/TriggerTask/TriggerTaskUseCase.js +11 -0
- package/features/TriggerTask/TriggerTaskUseCase.js.map +1 -0
- package/features/TriggerTask/abstractions.d.ts +28 -0
- package/features/TriggerTask/abstractions.js +4 -0
- package/features/TriggerTask/abstractions.js.map +1 -0
- package/features/TriggerTask/feature.d.ts +2 -0
- package/features/TriggerTask/feature.js +11 -0
- package/features/TriggerTask/feature.js.map +1 -0
- package/features/TriggerTask/index.d.ts +2 -0
- package/features/TriggerTask/index.js +4 -0
- package/features/TriggerTask/index.js.map +1 -0
- package/global.d.ts +1 -0
- package/global.js +3 -0
- package/global.js.map +1 -0
- package/graphql/checkPermissions.d.ts +1 -1
- package/graphql/checkPermissions.js +3 -9
- package/graphql/checkPermissions.js.map +1 -1
- package/graphql/index.d.ts +1 -1
- package/graphql/index.js +58 -61
- package/graphql/index.js.map +1 -1
- package/graphql/utils.d.ts +1 -1
- package/graphql/utils.js +8 -17
- package/graphql/utils.js.map +1 -1
- package/handler/index.d.ts +2 -2
- package/handler/index.js +33 -40
- package/handler/index.js.map +1 -1
- package/handler/register.js +5 -7
- package/handler/register.js.map +1 -1
- package/handler/types.d.ts +1 -3
- package/handler/types.js +1 -5
- package/handler/types.js.map +1 -1
- package/index.d.ts +5 -6
- package/index.js +5 -60
- package/index.js.map +1 -1
- package/package.json +22 -26
- package/plugins/TaskServicePlugin.d.ts +1 -2
- package/plugins/TaskServicePlugin.js +2 -9
- package/plugins/TaskServicePlugin.js.map +1 -1
- package/plugins/index.d.ts +1 -1
- package/plugins/index.js +1 -16
- package/plugins/index.js.map +1 -1
- package/response/DatabaseResponse.d.ts +3 -3
- package/response/DatabaseResponse.js +14 -20
- package/response/DatabaseResponse.js.map +1 -1
- package/response/Response.d.ts +4 -3
- package/response/Response.js +20 -31
- package/response/Response.js.map +1 -1
- package/response/ResponseAbortedResult.d.ts +3 -4
- package/response/ResponseAbortedResult.js +3 -11
- package/response/ResponseAbortedResult.js.map +1 -1
- package/response/ResponseContinueResult.d.ts +4 -5
- package/response/ResponseContinueResult.js +3 -11
- package/response/ResponseContinueResult.js.map +1 -1
- package/response/ResponseDoneResult.d.ts +4 -6
- package/response/ResponseDoneResult.js +3 -11
- package/response/ResponseDoneResult.js.map +1 -1
- package/response/ResponseErrorResult.d.ts +3 -4
- package/response/ResponseErrorResult.js +3 -11
- package/response/ResponseErrorResult.js.map +1 -1
- package/response/TaskResponse.d.ts +7 -6
- package/response/TaskResponse.js +5 -12
- package/response/TaskResponse.js.map +1 -1
- package/response/abstractions/Response.d.ts +7 -7
- package/response/abstractions/Response.js +1 -5
- package/response/abstractions/Response.js.map +1 -1
- package/response/abstractions/ResponseAbortedResult.d.ts +3 -3
- package/response/abstractions/ResponseAbortedResult.js +1 -5
- package/response/abstractions/ResponseAbortedResult.js.map +1 -1
- package/response/abstractions/ResponseBaseResult.d.ts +2 -3
- package/response/abstractions/ResponseBaseResult.js +1 -5
- package/response/abstractions/ResponseBaseResult.js.map +1 -1
- package/response/abstractions/ResponseContinueResult.d.ts +4 -4
- package/response/abstractions/ResponseContinueResult.js +1 -5
- package/response/abstractions/ResponseContinueResult.js.map +1 -1
- package/response/abstractions/ResponseDoneResult.d.ts +5 -6
- package/response/abstractions/ResponseDoneResult.js +1 -5
- package/response/abstractions/ResponseDoneResult.js.map +1 -1
- package/response/abstractions/ResponseErrorResult.d.ts +4 -5
- package/response/abstractions/ResponseErrorResult.js +1 -5
- package/response/abstractions/ResponseErrorResult.js.map +1 -1
- package/response/abstractions/TaskResponse.d.ts +8 -30
- package/response/abstractions/TaskResponse.js +1 -5
- package/response/abstractions/TaskResponse.js.map +1 -1
- package/response/abstractions/index.d.ts +7 -7
- package/response/abstractions/index.js +7 -82
- package/response/abstractions/index.js.map +1 -1
- package/response/index.d.ts +7 -7
- package/response/index.js +7 -82
- package/response/index.js.map +1 -1
- package/runner/TaskControl.d.ts +4 -4
- package/runner/TaskControl.js +61 -39
- package/runner/TaskControl.js.map +1 -1
- package/runner/TaskEventValidation.d.ts +2 -2
- package/runner/TaskEventValidation.js +11 -20
- package/runner/TaskEventValidation.js.map +1 -1
- package/runner/TaskManager.d.ts +7 -10
- package/runner/TaskManager.js +19 -39
- package/runner/TaskManager.js.map +1 -1
- package/runner/TaskManagerStore.d.ts +7 -7
- package/runner/TaskManagerStore.js +16 -25
- package/runner/TaskManagerStore.js.map +1 -1
- package/runner/TaskRunner.d.ts +5 -6
- package/runner/TaskRunner.js +9 -31
- package/runner/TaskRunner.js.map +1 -1
- package/runner/abstractions/TaskControl.d.ts +4 -4
- package/runner/abstractions/TaskControl.js +1 -5
- package/runner/abstractions/TaskControl.js.map +1 -1
- package/runner/abstractions/TaskEventValidation.d.ts +1 -1
- package/runner/abstractions/TaskEventValidation.js +1 -5
- package/runner/abstractions/TaskEventValidation.js.map +1 -1
- package/runner/abstractions/TaskManager.d.ts +4 -4
- package/runner/abstractions/TaskManager.js +1 -5
- package/runner/abstractions/TaskManager.js.map +1 -1
- package/runner/abstractions/TaskManagerStore.d.ts +11 -11
- package/runner/abstractions/TaskManagerStore.js +1 -5
- package/runner/abstractions/TaskManagerStore.js.map +1 -1
- package/runner/abstractions/TaskRunner.d.ts +3 -3
- package/runner/abstractions/TaskRunner.js +1 -5
- package/runner/abstractions/TaskRunner.js.map +1 -1
- package/runner/abstractions/index.d.ts +5 -5
- package/runner/abstractions/index.js +5 -60
- package/runner/abstractions/index.js.map +1 -1
- package/runner/index.d.ts +1 -1
- package/runner/index.js +1 -16
- package/runner/index.js.map +1 -1
- package/service/EventBridgeEventTransportPlugin.d.ts +4 -5
- package/service/EventBridgeEventTransportPlugin.js +8 -17
- package/service/EventBridgeEventTransportPlugin.js.map +1 -1
- package/service/StepFunctionServicePlugin.d.ts +4 -5
- package/service/StepFunctionServicePlugin.js +11 -21
- package/service/StepFunctionServicePlugin.js.map +1 -1
- package/service/createService.d.ts +2 -2
- package/service/createService.js +7 -18
- package/service/createService.js.map +1 -1
- package/service/index.d.ts +3 -3
- package/service/index.js +6 -27
- package/service/index.js.map +1 -1
- package/tasks/testingRunTask.d.ts +10 -1
- package/tasks/testingRunTask.js +13 -18
- package/tasks/testingRunTask.js.map +1 -1
- package/types.d.ts +32 -214
- package/types.js +5 -56
- package/types.js.map +1 -1
- package/utils/ObjectUpdater.js +4 -11
- package/utils/ObjectUpdater.js.map +1 -1
- package/utils/getErrorProperties.d.ts +1 -1
- package/utils/getErrorProperties.js +3 -10
- package/utils/getErrorProperties.js.map +1 -1
- package/utils/getObjectProperties.js +1 -8
- package/utils/getObjectProperties.js.map +1 -1
- package/utils/index.d.ts +3 -3
- package/utils/index.js +3 -38
- package/utils/index.js.map +1 -1
- package/crud/model.d.ts +0 -5
- package/crud/model.js +0 -216
- package/crud/model.js.map +0 -1
- package/crud/where.d.ts +0 -1
- package/crud/where.js +0 -33
- package/crud/where.js.map +0 -1
- package/task/index.d.ts +0 -2
- package/task/index.js +0 -29
- package/task/index.js.map +0 -1
- package/task/input.d.ts +0 -15
- package/task/input.js +0 -21
- package/task/input.js.map +0 -1
- package/task/plugin.d.ts +0 -36
- package/task/plugin.js +0 -106
- package/task/plugin.js.map +0 -1
package/service/index.js
CHANGED
|
@@ -1,31 +1,10 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
});
|
|
6
|
-
var _exportNames = {
|
|
7
|
-
createServicePlugins: true
|
|
8
|
-
};
|
|
9
|
-
exports.createServicePlugins = void 0;
|
|
10
|
-
var _EventBridgeEventTransportPlugin = require("./EventBridgeEventTransportPlugin");
|
|
11
|
-
var _StepFunctionServicePlugin = require("./StepFunctionServicePlugin");
|
|
12
|
-
var _createService = require("./createService");
|
|
13
|
-
Object.keys(_createService).forEach(function (key) {
|
|
14
|
-
if (key === "default" || key === "__esModule") return;
|
|
15
|
-
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
|
|
16
|
-
if (key in exports && exports[key] === _createService[key]) return;
|
|
17
|
-
Object.defineProperty(exports, key, {
|
|
18
|
-
enumerable: true,
|
|
19
|
-
get: function () {
|
|
20
|
-
return _createService[key];
|
|
21
|
-
}
|
|
22
|
-
});
|
|
23
|
-
});
|
|
24
|
-
const createServicePlugins = () => {
|
|
25
|
-
return [new _StepFunctionServicePlugin.StepFunctionServicePlugin({
|
|
1
|
+
import { EventBridgeEventTransportPlugin } from "./EventBridgeEventTransportPlugin.js";
|
|
2
|
+
import { StepFunctionServicePlugin } from "./StepFunctionServicePlugin.js";
|
|
3
|
+
export const createServicePlugins = () => {
|
|
4
|
+
return [new StepFunctionServicePlugin({
|
|
26
5
|
default: true
|
|
27
|
-
}), new
|
|
6
|
+
}), new EventBridgeEventTransportPlugin()];
|
|
28
7
|
};
|
|
29
|
-
|
|
8
|
+
export * from "./createService.js";
|
|
30
9
|
|
|
31
10
|
//# sourceMappingURL=index.js.map
|
package/service/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["
|
|
1
|
+
{"version":3,"names":["EventBridgeEventTransportPlugin","StepFunctionServicePlugin","createServicePlugins","default"],"sources":["index.ts"],"sourcesContent":["import { EventBridgeEventTransportPlugin } from \"./EventBridgeEventTransportPlugin.js\";\nimport { StepFunctionServicePlugin } from \"./StepFunctionServicePlugin.js\";\n\nexport const createServicePlugins = () => {\n return [\n new StepFunctionServicePlugin({ default: true }),\n new EventBridgeEventTransportPlugin()\n ];\n};\n\nexport * from \"./createService.js\";\n"],"mappings":"AAAA,SAASA,+BAA+B;AACxC,SAASC,yBAAyB;AAElC,OAAO,MAAMC,oBAAoB,GAAGA,CAAA,KAAM;EACtC,OAAO,CACH,IAAID,yBAAyB,CAAC;IAAEE,OAAO,EAAE;EAAK,CAAC,CAAC,EAChD,IAAIH,+BAA+B,CAAC,CAAC,CACxC;AACL,CAAC;AAED","ignoreList":[]}
|
|
@@ -1 +1,10 @@
|
|
|
1
|
-
|
|
1
|
+
import { TaskDefinition } from "@webiny/api-core/features/task/TaskDefinition/index.js";
|
|
2
|
+
declare class TestingRunTask implements TaskDefinition.Interface {
|
|
3
|
+
id: string;
|
|
4
|
+
title: string;
|
|
5
|
+
run({ controller }: TaskDefinition.RunParams): Promise<TaskDefinition.ResultDone<import("@webiny/api-core/features/task/TaskDefinition/abstractions").ITaskOutput>>;
|
|
6
|
+
}
|
|
7
|
+
export declare const TestingRunTaskDefinition: typeof TestingRunTask & {
|
|
8
|
+
__abstraction: import("@webiny/di").Abstraction<import("@webiny/api-core/features/task/TaskDefinition/abstractions").ITaskDefinition<import("@webiny/api-core/features/task/TaskDefinition/abstractions").ITaskInput, import("@webiny/api-core/features/task/TaskDefinition/abstractions").ITaskOutput>>;
|
|
9
|
+
};
|
|
10
|
+
export {};
|
package/tasks/testingRunTask.js
CHANGED
|
@@ -1,21 +1,16 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
import { TaskDefinition } from "@webiny/api-core/features/task/TaskDefinition/index.js";
|
|
2
|
+
class TestingRunTask {
|
|
3
|
+
id = "testingRun";
|
|
4
|
+
title = "A mock task to test run the step function permissions.";
|
|
5
|
+
async run({
|
|
6
|
+
controller
|
|
7
|
+
}) {
|
|
8
|
+
return controller.response.done("Task successfully finished.");
|
|
9
|
+
}
|
|
10
|
+
}
|
|
11
|
+
export const TestingRunTaskDefinition = TaskDefinition.createImplementation({
|
|
12
|
+
implementation: TestingRunTask,
|
|
13
|
+
dependencies: []
|
|
5
14
|
});
|
|
6
|
-
exports.createTestingRunTask = void 0;
|
|
7
|
-
var _task = require("../task");
|
|
8
|
-
const createTestingRunTask = () => {
|
|
9
|
-
return (0, _task.createTaskDefinition)({
|
|
10
|
-
id: "testingRun",
|
|
11
|
-
title: "A mock task to test run the step function permissions.",
|
|
12
|
-
run: async ({
|
|
13
|
-
response
|
|
14
|
-
}) => {
|
|
15
|
-
return response.done("Task successfully finished.");
|
|
16
|
-
}
|
|
17
|
-
});
|
|
18
|
-
};
|
|
19
|
-
exports.createTestingRunTask = createTestingRunTask;
|
|
20
15
|
|
|
21
16
|
//# sourceMappingURL=testingRunTask.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["
|
|
1
|
+
{"version":3,"names":["TaskDefinition","TestingRunTask","id","title","run","controller","response","done","TestingRunTaskDefinition","createImplementation","implementation","dependencies"],"sources":["testingRunTask.ts"],"sourcesContent":["import { TaskDefinition } from \"@webiny/api-core/features/task/TaskDefinition/index.js\";\n\nclass TestingRunTask implements TaskDefinition.Interface {\n id = \"testingRun\";\n title = \"A mock task to test run the step function permissions.\";\n\n async run({ controller }: TaskDefinition.RunParams) {\n return controller.response.done(\"Task successfully finished.\");\n }\n}\n\nexport const TestingRunTaskDefinition = TaskDefinition.createImplementation({\n implementation: TestingRunTask,\n dependencies: []\n});\n"],"mappings":"AAAA,SAASA,cAAc,QAAQ,wDAAwD;AAEvF,MAAMC,cAAc,CAAqC;EACrDC,EAAE,GAAG,YAAY;EACjBC,KAAK,GAAG,wDAAwD;EAEhE,MAAMC,GAAGA,CAAC;IAAEC;EAAqC,CAAC,EAAE;IAChD,OAAOA,UAAU,CAACC,QAAQ,CAACC,IAAI,CAAC,6BAA6B,CAAC;EAClE;AACJ;AAEA,OAAO,MAAMC,wBAAwB,GAAGR,cAAc,CAACS,oBAAoB,CAAC;EACxEC,cAAc,EAAET,cAAc;EAC9BU,YAAY,EAAE;AAClB,CAAC,CAAC","ignoreList":[]}
|
package/types.d.ts
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
import type { CmsContext as BaseContext, CmsEntryListParams,
|
|
2
|
-
import type {
|
|
3
|
-
import type {
|
|
4
|
-
import type {
|
|
5
|
-
import type { SecurityPermission } from "@webiny/api-
|
|
6
|
-
import
|
|
7
|
-
import
|
|
8
|
-
import
|
|
9
|
-
import type
|
|
10
|
-
export * from "./handler/types";
|
|
11
|
-
export * from "./response/abstractions";
|
|
12
|
-
export * from "./runner/abstractions";
|
|
1
|
+
import type { CmsContext as BaseContext, CmsEntryListParams, CmsEntryMeta, CmsModel } from "@webiny/api-headless-cms/types/index.js";
|
|
2
|
+
import type { IResponseError } from "./response/abstractions/index.js";
|
|
3
|
+
import type { GenericRecord } from "@webiny/api/types.js";
|
|
4
|
+
import type { IStepFunctionServiceFetchResult } from "./service/StepFunctionServicePlugin.js";
|
|
5
|
+
import type { SecurityPermission } from "@webiny/api-core/types/security.js";
|
|
6
|
+
import { TaskDefinition } from "@webiny/api-core/features/task/TaskDefinition/index.js";
|
|
7
|
+
import { TaskService } from "@webiny/api-core/features/task/TaskService/index.js";
|
|
8
|
+
import { BaseError, Result } from "@webiny/feature/api";
|
|
9
|
+
import type { IdInterfaceGenerator, NumericInterfaceGenerator } from "@webiny/api";
|
|
10
|
+
export * from "./handler/types.js";
|
|
11
|
+
export * from "./response/abstractions/index.js";
|
|
12
|
+
export * from "./runner/abstractions/index.js";
|
|
13
13
|
export type ITaskDataInput = GenericRecord;
|
|
14
14
|
export declare enum TaskLogItemType {
|
|
15
15
|
INFO = "info",
|
|
@@ -53,31 +53,11 @@ export declare enum TaskDataStatus {
|
|
|
53
53
|
}
|
|
54
54
|
export interface ITaskIdentity {
|
|
55
55
|
id: string;
|
|
56
|
-
displayName: string
|
|
56
|
+
displayName: string;
|
|
57
57
|
type: string;
|
|
58
58
|
}
|
|
59
|
-
export
|
|
60
|
-
|
|
61
|
-
* ID without the revision number (for example: #0001).
|
|
62
|
-
*/
|
|
63
|
-
id: string;
|
|
64
|
-
name: string;
|
|
65
|
-
taskStatus: TaskDataStatus;
|
|
66
|
-
definitionId: string;
|
|
67
|
-
executionName: string;
|
|
68
|
-
input: T;
|
|
69
|
-
output?: O;
|
|
70
|
-
createdOn: string;
|
|
71
|
-
savedOn: string;
|
|
72
|
-
createdBy: ITaskIdentity;
|
|
73
|
-
startedOn?: string;
|
|
74
|
-
finishedOn?: string;
|
|
75
|
-
eventResponse: GenericRecord | undefined;
|
|
76
|
-
iterations: number;
|
|
77
|
-
parentId?: string;
|
|
78
|
-
}
|
|
79
|
-
export type IGetTaskResponse<T = any, O extends ITaskResponseDoneResultOutput = ITaskResponseDoneResultOutput> = ITask<T, O> | null;
|
|
80
|
-
export interface IListTasksResponse<T = any, O extends ITaskResponseDoneResultOutput = ITaskResponseDoneResultOutput> {
|
|
59
|
+
export type IGetTaskResponse<T extends TaskService.TaskInput = TaskService.TaskInput, O extends TaskService.GenericOutput = TaskService.GenericOutput> = ITask<T, O> | null;
|
|
60
|
+
export interface IListTasksResponse<T extends TaskService.TaskInput = TaskService.TaskInput, O extends TaskService.GenericOutput = TaskService.GenericOutput> {
|
|
81
61
|
items: ITask<T, O>[];
|
|
82
62
|
meta: CmsEntryMeta;
|
|
83
63
|
}
|
|
@@ -85,47 +65,26 @@ export interface IListTaskLogsResponse {
|
|
|
85
65
|
items: ITaskLog[];
|
|
86
66
|
meta: CmsEntryMeta;
|
|
87
67
|
}
|
|
88
|
-
export type ICreateTaskResponse<T =
|
|
89
|
-
export type IUpdateTaskResponse<T =
|
|
68
|
+
export type ICreateTaskResponse<T extends TaskService.TaskInput = TaskService.TaskInput, O extends TaskService.GenericOutput = TaskService.GenericOutput> = ITask<T, O>;
|
|
69
|
+
export type IUpdateTaskResponse<T extends TaskService.TaskInput = TaskService.TaskInput, O extends TaskService.GenericOutput = TaskService.GenericOutput> = ITask<T, O>;
|
|
90
70
|
export type IDeleteTaskResponse = boolean;
|
|
91
|
-
export interface IListTaskParamsWhere extends
|
|
92
|
-
parentId?: string;
|
|
93
|
-
parentId_not?: string;
|
|
94
|
-
parentId_in?: string[];
|
|
95
|
-
parentId_not_in?: string[];
|
|
96
|
-
definitionId?: string;
|
|
97
|
-
definitionId_not?: string;
|
|
98
|
-
definitionId_in?: string[];
|
|
99
|
-
definitionId_not_in?: string[];
|
|
100
|
-
taskStatus?: string;
|
|
101
|
-
taskStatus_not?: string;
|
|
102
|
-
taskStatus_in?: string[];
|
|
103
|
-
taskStatus_not_in?: string[];
|
|
71
|
+
export interface IListTaskParamsWhere extends IdInterfaceGenerator<"id">, IdInterfaceGenerator<"parentId">, IdInterfaceGenerator<"definitionId">, IdInterfaceGenerator<"taskStatus"> {
|
|
104
72
|
}
|
|
105
73
|
export interface IListTaskParams extends Omit<CmsEntryListParams, "fields" | "search"> {
|
|
106
74
|
where?: IListTaskParamsWhere;
|
|
107
75
|
}
|
|
108
|
-
export interface IListTaskLogParamsWhere extends
|
|
109
|
-
task?: string;
|
|
110
|
-
task_in?: string[];
|
|
111
|
-
task_not?: string;
|
|
112
|
-
iteration?: number;
|
|
113
|
-
iteration_not?: number;
|
|
114
|
-
iteration_gte?: number;
|
|
115
|
-
iteration_gt?: number;
|
|
116
|
-
iteration_lte?: number;
|
|
117
|
-
iteration_lt?: number;
|
|
76
|
+
export interface IListTaskLogParamsWhere extends IdInterfaceGenerator<"id">, IdInterfaceGenerator<"task">, NumericInterfaceGenerator<"iteration"> {
|
|
118
77
|
}
|
|
119
|
-
export interface IListTaskLogParams extends Omit<CmsEntryListParams, "fields" | "search"> {
|
|
78
|
+
export interface IListTaskLogParams extends Omit<CmsEntryListParams, "fields" | "search" | "where"> {
|
|
120
79
|
where?: IListTaskLogParamsWhere;
|
|
121
80
|
}
|
|
122
|
-
export interface ITaskCreateData<T =
|
|
81
|
+
export interface ITaskCreateData<T extends TaskDefinition.TaskInput = TaskDefinition.TaskInput> {
|
|
123
82
|
definitionId: string;
|
|
124
83
|
name: string;
|
|
125
84
|
input: T;
|
|
126
85
|
parentId?: string;
|
|
127
86
|
}
|
|
128
|
-
export interface ITaskUpdateData<I =
|
|
87
|
+
export interface ITaskUpdateData<I extends TaskDefinition.TaskInput = TaskDefinition.TaskInput, O extends TaskDefinition.TaskOutput = TaskDefinition.TaskOutput> {
|
|
129
88
|
name?: string;
|
|
130
89
|
input?: I;
|
|
131
90
|
output?: O;
|
|
@@ -136,27 +95,6 @@ export interface ITaskUpdateData<I = ITaskDataInput, O extends ITaskResponseDone
|
|
|
136
95
|
eventResponse?: GenericRecord;
|
|
137
96
|
iterations?: number;
|
|
138
97
|
}
|
|
139
|
-
export interface OnTaskBeforeCreateTopicParams {
|
|
140
|
-
input: ITaskCreateData;
|
|
141
|
-
}
|
|
142
|
-
export interface OnTaskAfterCreateTopicParams {
|
|
143
|
-
input: ITaskCreateData;
|
|
144
|
-
task: ITask;
|
|
145
|
-
}
|
|
146
|
-
export interface OnTaskBeforeUpdateTopicParams {
|
|
147
|
-
input: ITaskUpdateData;
|
|
148
|
-
original: ITask;
|
|
149
|
-
}
|
|
150
|
-
export interface OnTaskAfterUpdateTopicParams {
|
|
151
|
-
input: ITaskUpdateData;
|
|
152
|
-
task: ITask;
|
|
153
|
-
}
|
|
154
|
-
export interface OnTaskBeforeDeleteTopicParams {
|
|
155
|
-
task: ITask;
|
|
156
|
-
}
|
|
157
|
-
export interface OnTaskAfterDeleteTopicParams {
|
|
158
|
-
task: ITask;
|
|
159
|
-
}
|
|
160
98
|
export interface ITaskLogCreateInput {
|
|
161
99
|
executionName: string;
|
|
162
100
|
iteration: number;
|
|
@@ -173,10 +111,10 @@ export interface ITasksContextCrudObject {
|
|
|
173
111
|
/**
|
|
174
112
|
* Tasks
|
|
175
113
|
*/
|
|
176
|
-
getTask<T =
|
|
177
|
-
listTasks<T =
|
|
178
|
-
createTask<T =
|
|
179
|
-
updateTask<T =
|
|
114
|
+
getTask<T extends TaskService.TaskInput = TaskService.TaskInput, O extends TaskService.GenericOutput = TaskService.GenericOutput>(id: string): Promise<IGetTaskResponse<T, O> | null>;
|
|
115
|
+
listTasks<T extends TaskService.TaskInput = TaskService.TaskInput, O extends TaskService.GenericOutput = TaskService.GenericOutput>(params?: IListTaskParams): Promise<IListTasksResponse<T, O>>;
|
|
116
|
+
createTask<T extends TaskService.TaskInput = TaskService.TaskInput>(task: ITaskCreateData<T>): Promise<ICreateTaskResponse<T>>;
|
|
117
|
+
updateTask<T extends TaskService.TaskInput = TaskService.TaskInput, O extends TaskService.GenericOutput = TaskService.GenericOutput>(id: string, data: Partial<ITaskUpdateData<T, O>>): Promise<IUpdateTaskResponse<T, O>>;
|
|
180
118
|
deleteTask(id: string): Promise<IDeleteTaskResponse>;
|
|
181
119
|
/**
|
|
182
120
|
* Logs
|
|
@@ -187,19 +125,10 @@ export interface ITasksContextCrudObject {
|
|
|
187
125
|
getLog(id: string): Promise<ITaskLog | null>;
|
|
188
126
|
getLatestLog(taskId: string): Promise<ITaskLog>;
|
|
189
127
|
listLogs(params: IListTaskLogParams): Promise<IListTaskLogsResponse>;
|
|
190
|
-
/**
|
|
191
|
-
* Lifecycle events.
|
|
192
|
-
*/
|
|
193
|
-
onTaskBeforeCreate: Topic<OnTaskBeforeCreateTopicParams>;
|
|
194
|
-
onTaskAfterCreate: Topic<OnTaskAfterCreateTopicParams>;
|
|
195
|
-
onTaskBeforeUpdate: Topic<OnTaskBeforeUpdateTopicParams>;
|
|
196
|
-
onTaskAfterUpdate: Topic<OnTaskAfterUpdateTopicParams>;
|
|
197
|
-
onTaskBeforeDelete: Topic<OnTaskBeforeDeleteTopicParams>;
|
|
198
|
-
onTaskAfterDelete: Topic<OnTaskAfterDeleteTopicParams>;
|
|
199
128
|
}
|
|
200
129
|
export interface ITasksContextDefinitionObject {
|
|
201
|
-
getDefinition: <
|
|
202
|
-
listDefinitions: () =>
|
|
130
|
+
getDefinition: <I extends TaskDefinition.TaskInput = TaskDefinition.TaskInput, O extends TaskDefinition.TaskOutput = TaskDefinition.TaskOutput>(id: string) => TaskDefinition.Runnable<I, O> | null;
|
|
131
|
+
listDefinitions: () => TaskDefinition.Interface[];
|
|
203
132
|
}
|
|
204
133
|
export interface ITaskTriggerParams<I = ITaskDataInput> {
|
|
205
134
|
parent?: Pick<ITask, "id">;
|
|
@@ -213,128 +142,17 @@ export interface ITaskAbortParams {
|
|
|
213
142
|
message?: string;
|
|
214
143
|
}
|
|
215
144
|
export interface ITasksContextServiceObject {
|
|
216
|
-
trigger: <T =
|
|
217
|
-
abort: <T =
|
|
218
|
-
fetchServiceInfo: (input: ITask<any, any> | string) => Promise<IStepFunctionServiceFetchResult
|
|
145
|
+
trigger: <T extends TaskDefinition.TaskInput = TaskDefinition.TaskInput, O extends TaskService.GenericOutput = TaskService.GenericOutput>(params: ITaskTriggerParams<T>) => Promise<Result<ITask<T, O>, BaseError>>;
|
|
146
|
+
abort: <T extends TaskDefinition.TaskInput = TaskDefinition.TaskInput, O extends TaskService.GenericOutput = TaskService.GenericOutput>(params: ITaskAbortParams) => Promise<Result<ITask<T, O>, BaseError>>;
|
|
147
|
+
fetchServiceInfo: (input: ITask<any, any> | string) => Promise<Result<IStepFunctionServiceFetchResult, BaseError>>;
|
|
219
148
|
}
|
|
220
149
|
export interface ITasksContextObject extends ITasksContextCrudObject, ITasksContextDefinitionObject, ITasksContextServiceObject {
|
|
221
150
|
}
|
|
222
151
|
export interface Context extends BaseContext {
|
|
223
152
|
tasks: ITasksContextObject;
|
|
224
153
|
}
|
|
225
|
-
export interface ITaskRunParams<C extends Context, I = ITaskDataInput, O extends ITaskResponseDoneResultOutput = ITaskResponseDoneResultOutput> {
|
|
226
|
-
context: C;
|
|
227
|
-
response: ITaskResponse<I, O>;
|
|
228
|
-
isCloseToTimeout: IIsCloseToTimeoutCallable;
|
|
229
|
-
isAborted(): boolean;
|
|
230
|
-
input: I;
|
|
231
|
-
store: ITaskManagerStore<I>;
|
|
232
|
-
trigger<SI = ITaskDataInput>(params: Omit<ITaskTriggerParams<SI>, "parent">): Promise<ITask<SI>>;
|
|
233
|
-
timer: ITimer;
|
|
234
|
-
}
|
|
235
|
-
export interface ITaskOnSuccessParams<C extends Context, I = ITaskDataInput, O extends ITaskResponseDoneResultOutput = ITaskResponseDoneResultOutput> {
|
|
236
|
-
context: C;
|
|
237
|
-
task: ITask<I, O>;
|
|
238
|
-
}
|
|
239
|
-
export interface ITaskOnErrorParams<C extends Context, I = ITaskDataInput, O extends ITaskResponseDoneResultOutput = ITaskResponseDoneResultOutput> {
|
|
240
|
-
context: C;
|
|
241
|
-
task: ITask<I, O>;
|
|
242
|
-
}
|
|
243
|
-
export interface ITaskOnAbortParams<C extends Context, I = ITaskDataInput, O extends ITaskResponseDoneResultOutput = ITaskResponseDoneResultOutput> {
|
|
244
|
-
context: C;
|
|
245
|
-
task: ITask<I, O>;
|
|
246
|
-
}
|
|
247
|
-
export interface ITaskOnMaxIterationsParams<C extends Context> {
|
|
248
|
-
context: C;
|
|
249
|
-
task: ITask;
|
|
250
|
-
}
|
|
251
|
-
export declare enum TaskResponseStatus {
|
|
252
|
-
DONE = "done",
|
|
253
|
-
ERROR = "error",
|
|
254
|
-
CONTINUE = "continue",
|
|
255
|
-
ABORTED = "aborted"
|
|
256
|
-
}
|
|
257
|
-
export type ITaskDefinitionField = Pick<CmsModelField, "fieldId" | "type" | "label" | "renderer" | "helpText" | "placeholderText" | "predefinedValues" | "validation" | "listValidation" | "multipleValues" | "settings">;
|
|
258
|
-
export interface ITaskBeforeTriggerParams<C extends Context = Context, I = ITaskDataInput> {
|
|
259
|
-
context: C;
|
|
260
|
-
data: ITaskCreateData<I>;
|
|
261
|
-
}
|
|
262
|
-
export interface ITaskCreateInputValidationParams<C extends Context = Context> {
|
|
263
|
-
validator: typeof zod;
|
|
264
|
-
context: C;
|
|
265
|
-
}
|
|
266
|
-
export interface ITaskDefinition<C extends Context = Context, I = ITaskDataInput, O extends ITaskResponseDoneResultOutput = ITaskResponseDoneResultOutput> {
|
|
267
|
-
/**
|
|
268
|
-
* ID of the task must be unique in the system.
|
|
269
|
-
* It should be in camelCase format, for example: "myCustomTask".
|
|
270
|
-
*
|
|
271
|
-
* TODO: figure out a way to force camelCase in types.
|
|
272
|
-
* CamelCase from type-fest does not help with this.
|
|
273
|
-
*/
|
|
274
|
-
id: string;
|
|
275
|
-
/**
|
|
276
|
-
* Name should be unique, as it will get used to identify the task in the UI.
|
|
277
|
-
*/
|
|
278
|
-
title: string;
|
|
279
|
-
/**
|
|
280
|
-
* A description of the task, for the UI.
|
|
281
|
-
*/
|
|
282
|
-
description?: string;
|
|
283
|
-
/**
|
|
284
|
-
* Maximum number a step function can call the Lambda.
|
|
285
|
-
*/
|
|
286
|
-
maxIterations: number;
|
|
287
|
-
/**
|
|
288
|
-
* Disable storing logs in database for this task.
|
|
289
|
-
*/
|
|
290
|
-
disableDatabaseLogs?: boolean;
|
|
291
|
-
/**
|
|
292
|
-
* Task run method.
|
|
293
|
-
*/
|
|
294
|
-
run(params: ITaskRunParams<C, I, O>): Promise<ITaskResponseResult>;
|
|
295
|
-
/**
|
|
296
|
-
* When a new task is about to be triggered, we will run this method.
|
|
297
|
-
* For example, you can use this method to check if there is a task of the same type already running.
|
|
298
|
-
*/
|
|
299
|
-
onBeforeTrigger?<T = ITaskDataInput>(params: ITaskBeforeTriggerParams<C, T>): Promise<void>;
|
|
300
|
-
/**
|
|
301
|
-
* When task successfully finishes, this method will be called.
|
|
302
|
-
* This will be called during the run time of the task.
|
|
303
|
-
*/
|
|
304
|
-
onDone?(params: ITaskOnSuccessParams<C, I, O>): Promise<void>;
|
|
305
|
-
/**
|
|
306
|
-
* When task fails, this method will be called.
|
|
307
|
-
* This will be called during the run time of the task.
|
|
308
|
-
*/
|
|
309
|
-
onError?(params: ITaskOnErrorParams<C, I>): Promise<void>;
|
|
310
|
-
/**
|
|
311
|
-
* When task is aborted, this method will be called.
|
|
312
|
-
* This method will be called when user aborts the task.
|
|
313
|
-
*/
|
|
314
|
-
onAbort?(params: ITaskOnAbortParams<C, I, O>): Promise<void>;
|
|
315
|
-
/**
|
|
316
|
-
* When task hits max iterations, this method will be called.
|
|
317
|
-
* This will be called during the run time of the task.
|
|
318
|
-
*/
|
|
319
|
-
onMaxIterations?(params: ITaskOnMaxIterationsParams<C>): Promise<void>;
|
|
320
|
-
/**
|
|
321
|
-
* Create a validation schema for the task input.
|
|
322
|
-
* This will be used to validate the input before the task is triggered.
|
|
323
|
-
*
|
|
324
|
-
* By default, the input validation validates the input against the fields defined in the task definition.
|
|
325
|
-
* But it also passes through any fields which might not be defined in the task validation.
|
|
326
|
-
*/
|
|
327
|
-
createInputValidation?: (params: ITaskCreateInputValidationParams<C>) => GenericRecord<keyof I, zod.Schema> | zod.Schema;
|
|
328
|
-
/**
|
|
329
|
-
* Custom input fields and layout for the task input.
|
|
330
|
-
*/
|
|
331
|
-
fields?: ITaskDefinitionField[];
|
|
332
|
-
/**
|
|
333
|
-
* Is the task visible when listing?
|
|
334
|
-
*/
|
|
335
|
-
isPrivate?: boolean;
|
|
336
|
-
}
|
|
337
154
|
export interface TaskPermission extends SecurityPermission {
|
|
338
155
|
name: "task";
|
|
339
156
|
rwd?: string;
|
|
340
157
|
}
|
|
158
|
+
export type ITask<I extends TaskService.TaskInput = TaskService.TaskInput, O extends TaskService.GenericOutput = TaskService.GenericOutput> = TaskService.Task<I, O>;
|
package/types.js
CHANGED
|
@@ -1,56 +1,12 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
});
|
|
6
|
-
var _exportNames = {
|
|
7
|
-
TaskLogItemType: true,
|
|
8
|
-
TaskDataStatus: true,
|
|
9
|
-
TaskResponseStatus: true
|
|
10
|
-
};
|
|
11
|
-
exports.TaskResponseStatus = exports.TaskLogItemType = exports.TaskDataStatus = void 0;
|
|
12
|
-
var _types = require("./handler/types");
|
|
13
|
-
Object.keys(_types).forEach(function (key) {
|
|
14
|
-
if (key === "default" || key === "__esModule") return;
|
|
15
|
-
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
|
|
16
|
-
if (key in exports && exports[key] === _types[key]) return;
|
|
17
|
-
Object.defineProperty(exports, key, {
|
|
18
|
-
enumerable: true,
|
|
19
|
-
get: function () {
|
|
20
|
-
return _types[key];
|
|
21
|
-
}
|
|
22
|
-
});
|
|
23
|
-
});
|
|
24
|
-
var _abstractions = require("./response/abstractions");
|
|
25
|
-
Object.keys(_abstractions).forEach(function (key) {
|
|
26
|
-
if (key === "default" || key === "__esModule") return;
|
|
27
|
-
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
|
|
28
|
-
if (key in exports && exports[key] === _abstractions[key]) return;
|
|
29
|
-
Object.defineProperty(exports, key, {
|
|
30
|
-
enumerable: true,
|
|
31
|
-
get: function () {
|
|
32
|
-
return _abstractions[key];
|
|
33
|
-
}
|
|
34
|
-
});
|
|
35
|
-
});
|
|
36
|
-
var _abstractions2 = require("./runner/abstractions");
|
|
37
|
-
Object.keys(_abstractions2).forEach(function (key) {
|
|
38
|
-
if (key === "default" || key === "__esModule") return;
|
|
39
|
-
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
|
|
40
|
-
if (key in exports && exports[key] === _abstractions2[key]) return;
|
|
41
|
-
Object.defineProperty(exports, key, {
|
|
42
|
-
enumerable: true,
|
|
43
|
-
get: function () {
|
|
44
|
-
return _abstractions2[key];
|
|
45
|
-
}
|
|
46
|
-
});
|
|
47
|
-
});
|
|
48
|
-
let TaskLogItemType = exports.TaskLogItemType = /*#__PURE__*/function (TaskLogItemType) {
|
|
1
|
+
export * from "./handler/types.js";
|
|
2
|
+
export * from "./response/abstractions/index.js";
|
|
3
|
+
export * from "./runner/abstractions/index.js";
|
|
4
|
+
export let TaskLogItemType = /*#__PURE__*/function (TaskLogItemType) {
|
|
49
5
|
TaskLogItemType["INFO"] = "info";
|
|
50
6
|
TaskLogItemType["ERROR"] = "error";
|
|
51
7
|
return TaskLogItemType;
|
|
52
8
|
}({});
|
|
53
|
-
let TaskDataStatus =
|
|
9
|
+
export let TaskDataStatus = /*#__PURE__*/function (TaskDataStatus) {
|
|
54
10
|
TaskDataStatus["PENDING"] = "pending";
|
|
55
11
|
TaskDataStatus["RUNNING"] = "running";
|
|
56
12
|
TaskDataStatus["FAILED"] = "failed";
|
|
@@ -58,12 +14,5 @@ let TaskDataStatus = exports.TaskDataStatus = /*#__PURE__*/function (TaskDataSta
|
|
|
58
14
|
TaskDataStatus["ABORTED"] = "aborted";
|
|
59
15
|
return TaskDataStatus;
|
|
60
16
|
}({});
|
|
61
|
-
let TaskResponseStatus = exports.TaskResponseStatus = /*#__PURE__*/function (TaskResponseStatus) {
|
|
62
|
-
TaskResponseStatus["DONE"] = "done";
|
|
63
|
-
TaskResponseStatus["ERROR"] = "error";
|
|
64
|
-
TaskResponseStatus["CONTINUE"] = "continue";
|
|
65
|
-
TaskResponseStatus["ABORTED"] = "aborted";
|
|
66
|
-
return TaskResponseStatus;
|
|
67
|
-
}({});
|
|
68
17
|
|
|
69
18
|
//# sourceMappingURL=types.js.map
|
package/types.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_types","require","Object","keys","forEach","key","prototype","hasOwnProperty","call","_exportNames","exports","defineProperty","enumerable","get","_abstractions","_abstractions2","TaskLogItemType","TaskDataStatus","TaskResponseStatus"],"sources":["types.ts"],"sourcesContent":["import type {\n CmsContext as BaseContext,\n CmsEntryListParams,\n CmsEntryListWhere,\n CmsEntryMeta,\n CmsModel,\n CmsModelField\n} from \"@webiny/api-headless-cms/types\";\nimport type { Topic } from \"@webiny/pubsub/types\";\nimport type {\n IResponseError,\n ITaskResponse,\n ITaskResponseDoneResultOutput,\n ITaskResponseResult\n} from \"~/response/abstractions\";\nimport type { IIsCloseToTimeoutCallable, ITaskManagerStore } from \"./runner/abstractions\";\nimport type { SecurityPermission } from \"@webiny/api-security/types\";\nimport type { GenericRecord } from \"@webiny/api/types\";\nimport type { IStepFunctionServiceFetchResult } from \"~/service/StepFunctionServicePlugin\";\nimport type { ITimer } from \"@webiny/handler-aws\";\n\nimport type zod from \"zod\";\n\nexport * from \"./handler/types\";\nexport * from \"./response/abstractions\";\nexport * from \"./runner/abstractions\";\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 | null;\n type: string;\n}\n\nexport interface ITask<\n T = GenericRecord,\n O extends ITaskResponseDoneResultOutput = ITaskResponseDoneResultOutput\n> {\n /**\n * ID without the revision number (for example: #0001).\n */\n id: string;\n name: string;\n taskStatus: TaskDataStatus;\n definitionId: string;\n executionName: string;\n input: T;\n output?: O;\n createdOn: string;\n savedOn: string;\n createdBy: ITaskIdentity;\n startedOn?: string;\n finishedOn?: string;\n eventResponse: GenericRecord | undefined;\n iterations: number;\n parentId?: string;\n}\n\nexport type IGetTaskResponse<\n T = any,\n O extends ITaskResponseDoneResultOutput = ITaskResponseDoneResultOutput\n> = ITask<T, O> | null;\n\nexport interface IListTasksResponse<\n T = any,\n O extends ITaskResponseDoneResultOutput = ITaskResponseDoneResultOutput\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 = ITaskDataInput,\n O extends ITaskResponseDoneResultOutput = ITaskResponseDoneResultOutput\n> = ITask<T, O>;\nexport type IUpdateTaskResponse<\n T = ITaskDataInput,\n O extends ITaskResponseDoneResultOutput = ITaskResponseDoneResultOutput\n> = ITask<T, O>;\nexport type IDeleteTaskResponse = boolean;\n\nexport interface IListTaskParamsWhere extends CmsEntryListWhere {\n parentId?: string;\n parentId_not?: string;\n parentId_in?: string[];\n parentId_not_in?: string[];\n definitionId?: string;\n definitionId_not?: string;\n definitionId_in?: string[];\n definitionId_not_in?: string[];\n taskStatus?: string;\n taskStatus_not?: string;\n taskStatus_in?: string[];\n taskStatus_not_in?: string[];\n}\n\nexport interface IListTaskParams extends Omit<CmsEntryListParams, \"fields\" | \"search\"> {\n where?: IListTaskParamsWhere;\n}\n\nexport interface IListTaskLogParamsWhere extends CmsEntryListWhere {\n task?: string;\n task_in?: string[];\n task_not?: string;\n iteration?: number;\n iteration_not?: number;\n iteration_gte?: number;\n iteration_gt?: number;\n iteration_lte?: number;\n iteration_lt?: number;\n}\n\nexport interface IListTaskLogParams extends Omit<CmsEntryListParams, \"fields\" | \"search\"> {\n where?: IListTaskLogParamsWhere;\n}\n\nexport interface ITaskCreateData<T = ITaskDataInput> {\n definitionId: string;\n name: string;\n input: T;\n parentId?: string;\n}\n\nexport interface ITaskUpdateData<\n I = ITaskDataInput,\n O extends ITaskResponseDoneResultOutput = ITaskResponseDoneResultOutput\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 OnTaskBeforeCreateTopicParams {\n input: ITaskCreateData;\n}\n\nexport interface OnTaskAfterCreateTopicParams {\n input: ITaskCreateData;\n task: ITask;\n}\n\nexport interface OnTaskBeforeUpdateTopicParams {\n input: ITaskUpdateData;\n original: ITask;\n}\n\nexport interface OnTaskAfterUpdateTopicParams {\n input: ITaskUpdateData;\n task: ITask;\n}\n\nexport interface OnTaskBeforeDeleteTopicParams {\n task: ITask;\n}\n\nexport interface OnTaskAfterDeleteTopicParams {\n task: ITask;\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<T = any, O extends ITaskResponseDoneResultOutput = ITaskResponseDoneResultOutput>(\n id: string\n ): Promise<IGetTaskResponse<T, O> | null>;\n listTasks<T = any, O extends ITaskResponseDoneResultOutput = ITaskResponseDoneResultOutput>(\n params?: IListTaskParams\n ): Promise<IListTasksResponse<T, O>>;\n createTask<T = any>(task: ITaskCreateData<T>): Promise<ICreateTaskResponse<T>>;\n updateTask<\n T = ITaskDataInput,\n O extends ITaskResponseDoneResultOutput = ITaskResponseDoneResultOutput\n >(\n id: string,\n data: Partial<ITaskUpdateData<T, O>>\n ): Promise<IUpdateTaskResponse<T, O>>;\n deleteTask(id: string): Promise<IDeleteTaskResponse>;\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 * Lifecycle events.\n */\n onTaskBeforeCreate: Topic<OnTaskBeforeCreateTopicParams>;\n onTaskAfterCreate: Topic<OnTaskAfterCreateTopicParams>;\n onTaskBeforeUpdate: Topic<OnTaskBeforeUpdateTopicParams>;\n onTaskAfterUpdate: Topic<OnTaskAfterUpdateTopicParams>;\n onTaskBeforeDelete: Topic<OnTaskBeforeDeleteTopicParams>;\n onTaskAfterDelete: Topic<OnTaskAfterDeleteTopicParams>;\n}\n\nexport interface ITasksContextDefinitionObject {\n getDefinition: <\n C extends Context = Context,\n I = ITaskDataInput,\n O extends ITaskResponseDoneResultOutput = ITaskResponseDoneResultOutput\n >(\n id: string\n ) => ITaskDefinition<C, I, O> | null;\n listDefinitions: () => ITaskDefinition[];\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 = ITaskDataInput,\n O extends ITaskResponseDoneResultOutput = ITaskResponseDoneResultOutput\n >(\n params: ITaskTriggerParams<T>\n ) => Promise<ITask<T, O>>;\n abort: <\n T = ITaskDataInput,\n O extends ITaskResponseDoneResultOutput = ITaskResponseDoneResultOutput\n >(\n params: ITaskAbortParams\n ) => Promise<ITask<T, O>>;\n fetchServiceInfo: (\n input: ITask<any, any> | string\n ) => Promise<IStepFunctionServiceFetchResult | null>;\n}\n\nexport interface ITasksContextObject\n extends ITasksContextCrudObject,\n ITasksContextDefinitionObject,\n ITasksContextServiceObject {}\n\nexport interface Context extends BaseContext {\n tasks: ITasksContextObject;\n}\n\nexport interface ITaskRunParams<\n C extends Context,\n I = ITaskDataInput,\n O extends ITaskResponseDoneResultOutput = ITaskResponseDoneResultOutput\n> {\n context: C;\n response: ITaskResponse<I, O>;\n isCloseToTimeout: IIsCloseToTimeoutCallable;\n isAborted(): boolean;\n input: I;\n store: ITaskManagerStore<I>;\n trigger<SI = ITaskDataInput>(\n params: Omit<ITaskTriggerParams<SI>, \"parent\">\n ): Promise<ITask<SI>>;\n timer: ITimer;\n}\n\nexport interface ITaskOnSuccessParams<\n C extends Context,\n I = ITaskDataInput,\n O extends ITaskResponseDoneResultOutput = ITaskResponseDoneResultOutput\n> {\n context: C;\n task: ITask<I, O>;\n}\n\nexport interface ITaskOnErrorParams<\n C extends Context,\n I = ITaskDataInput,\n O extends ITaskResponseDoneResultOutput = ITaskResponseDoneResultOutput\n> {\n context: C;\n task: ITask<I, O>;\n}\n\nexport interface ITaskOnAbortParams<\n C extends Context,\n I = ITaskDataInput,\n O extends ITaskResponseDoneResultOutput = ITaskResponseDoneResultOutput\n> {\n context: C;\n task: ITask<I, O>;\n}\n\nexport interface ITaskOnMaxIterationsParams<C extends Context> {\n context: C;\n task: ITask;\n}\n\nexport enum TaskResponseStatus {\n DONE = \"done\",\n ERROR = \"error\",\n CONTINUE = \"continue\",\n ABORTED = \"aborted\"\n}\n\nexport type ITaskDefinitionField = Pick<\n CmsModelField,\n | \"fieldId\"\n | \"type\"\n | \"label\"\n | \"renderer\"\n | \"helpText\"\n | \"placeholderText\"\n | \"predefinedValues\"\n | \"validation\"\n | \"listValidation\"\n | \"multipleValues\"\n | \"settings\"\n>;\n\nexport interface ITaskBeforeTriggerParams<C extends Context = Context, I = ITaskDataInput> {\n context: C;\n data: ITaskCreateData<I>;\n}\n\nexport interface ITaskCreateInputValidationParams<C extends Context = Context> {\n validator: typeof zod;\n context: C;\n}\n\nexport interface ITaskDefinition<\n C extends Context = Context,\n I = ITaskDataInput,\n O extends ITaskResponseDoneResultOutput = ITaskResponseDoneResultOutput\n> {\n /**\n * ID of the task must be unique in the system.\n * It should be in camelCase format, for example: \"myCustomTask\".\n *\n * TODO: figure out a way to force camelCase in types.\n * CamelCase from type-fest does not help with this.\n */\n id: string;\n /**\n * Name should be unique, as it will get used to identify the task in the UI.\n */\n title: string;\n /**\n * A description of the task, for the UI.\n */\n description?: string;\n /**\n * Maximum number a step function can call the Lambda.\n */\n maxIterations: number;\n /**\n * Disable storing logs in database for this task.\n */\n disableDatabaseLogs?: boolean;\n /**\n * Task run method.\n */\n run(params: ITaskRunParams<C, I, O>): Promise<ITaskResponseResult>;\n /**\n * When a new task is about to be triggered, we will run this method.\n * For example, you can use this method to check if there is a task of the same type already running.\n */\n onBeforeTrigger?<T = ITaskDataInput>(params: ITaskBeforeTriggerParams<C, T>): Promise<void>;\n /**\n * When task successfully finishes, this method will be called.\n * This will be called during the run time of the task.\n */\n onDone?(params: ITaskOnSuccessParams<C, I, O>): Promise<void>;\n /**\n * When task fails, this method will be called.\n * This will be called during the run time of the task.\n */\n onError?(params: ITaskOnErrorParams<C, I>): Promise<void>;\n /**\n * When task is aborted, this method will be called.\n * This method will be called when user aborts the task.\n */\n onAbort?(params: ITaskOnAbortParams<C, I, O>): Promise<void>;\n /**\n * When task hits max iterations, this method will be called.\n * This will be called during the run time of the task.\n */\n onMaxIterations?(params: ITaskOnMaxIterationsParams<C>): Promise<void>;\n /**\n * Create a validation schema for the task input.\n * This will be used to validate the input before the task is triggered.\n *\n * By default, the input validation validates the input against the fields defined in the task definition.\n * But it also passes through any fields which might not be defined in the task validation.\n */\n createInputValidation?: (\n params: ITaskCreateInputValidationParams<C>\n ) => GenericRecord<keyof I, zod.Schema> | zod.Schema;\n /**\n * Custom input fields and layout for the task input.\n */\n fields?: ITaskDefinitionField[];\n /**\n * Is the task visible when listing?\n */\n isPrivate?: boolean;\n}\n\nexport interface TaskPermission extends SecurityPermission {\n name: \"task\";\n rwd?: string;\n}\n"],"mappings":";;;;;;;;;;;AAuBA,IAAAA,MAAA,GAAAC,OAAA;AAAAC,MAAA,CAAAC,IAAA,CAAAH,MAAA,EAAAI,OAAA,WAAAC,GAAA;EAAA,IAAAA,GAAA,kBAAAA,GAAA;EAAA,IAAAH,MAAA,CAAAI,SAAA,CAAAC,cAAA,CAAAC,IAAA,CAAAC,YAAA,EAAAJ,GAAA;EAAA,IAAAA,GAAA,IAAAK,OAAA,IAAAA,OAAA,CAAAL,GAAA,MAAAL,MAAA,CAAAK,GAAA;EAAAH,MAAA,CAAAS,cAAA,CAAAD,OAAA,EAAAL,GAAA;IAAAO,UAAA;IAAAC,GAAA,WAAAA,CAAA;MAAA,OAAAb,MAAA,CAAAK,GAAA;IAAA;EAAA;AAAA;AACA,IAAAS,aAAA,GAAAb,OAAA;AAAAC,MAAA,CAAAC,IAAA,CAAAW,aAAA,EAAAV,OAAA,WAAAC,GAAA;EAAA,IAAAA,GAAA,kBAAAA,GAAA;EAAA,IAAAH,MAAA,CAAAI,SAAA,CAAAC,cAAA,CAAAC,IAAA,CAAAC,YAAA,EAAAJ,GAAA;EAAA,IAAAA,GAAA,IAAAK,OAAA,IAAAA,OAAA,CAAAL,GAAA,MAAAS,aAAA,CAAAT,GAAA;EAAAH,MAAA,CAAAS,cAAA,CAAAD,OAAA,EAAAL,GAAA;IAAAO,UAAA;IAAAC,GAAA,WAAAA,CAAA;MAAA,OAAAC,aAAA,CAAAT,GAAA;IAAA;EAAA;AAAA;AACA,IAAAU,cAAA,GAAAd,OAAA;AAAAC,MAAA,CAAAC,IAAA,CAAAY,cAAA,EAAAX,OAAA,WAAAC,GAAA;EAAA,IAAAA,GAAA,kBAAAA,GAAA;EAAA,IAAAH,MAAA,CAAAI,SAAA,CAAAC,cAAA,CAAAC,IAAA,CAAAC,YAAA,EAAAJ,GAAA;EAAA,IAAAA,GAAA,IAAAK,OAAA,IAAAA,OAAA,CAAAL,GAAA,MAAAU,cAAA,CAAAV,GAAA;EAAAH,MAAA,CAAAS,cAAA,CAAAD,OAAA,EAAAL,GAAA;IAAAO,UAAA;IAAAC,GAAA,WAAAA,CAAA;MAAA,OAAAE,cAAA,CAAAV,GAAA;IAAA;EAAA;AAAA;AAAsC,IAI1BW,eAAe,GAAAN,OAAA,CAAAM,eAAA,0BAAfA,eAAe;EAAfA,eAAe;EAAfA,eAAe;EAAA,OAAfA,eAAe;AAAA;AAAA,IAwCfC,cAAc,GAAAP,OAAA,CAAAO,cAAA,0BAAdA,cAAc;EAAdA,cAAc;EAAdA,cAAc;EAAdA,cAAc;EAAdA,cAAc;EAAdA,cAAc;EAAA,OAAdA,cAAc;AAAA;AAAA,IA+SdC,kBAAkB,GAAAR,OAAA,CAAAQ,kBAAA,0BAAlBA,kBAAkB;EAAlBA,kBAAkB;EAAlBA,kBAAkB;EAAlBA,kBAAkB;EAAlBA,kBAAkB;EAAA,OAAlBA,kBAAkB;AAAA","ignoreList":[]}
|
|
1
|
+
{"version":3,"names":["TaskLogItemType","TaskDataStatus"],"sources":["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 { 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\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 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 IdInterfaceGenerator<\"id\">,\n IdInterfaceGenerator<\"task\">,\n NumericInterfaceGenerator<\"iteration\"> {}\n\nexport interface IListTaskLogParams\n extends Omit<CmsEntryListParams, \"fields\" | \"search\" | \"where\"> {\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 * 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,\n ITasksContextDefinitionObject,\n 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"],"mappings":"AAeA;AACA;AACA;AAIA,WAAYA,eAAe,0BAAfA,eAAe;EAAfA,eAAe;EAAfA,eAAe;EAAA,OAAfA,eAAe;AAAA;AAwC3B,WAAYC,cAAc,0BAAdA,cAAc;EAAdA,cAAc;EAAdA,cAAc;EAAdA,cAAc;EAAdA,cAAc;EAAdA,cAAc;EAAA,OAAdA,cAAc;AAAA","ignoreList":[]}
|
package/utils/ObjectUpdater.js
CHANGED
|
@@ -1,22 +1,16 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.ObjectUpdater = void 0;
|
|
7
|
-
var _objectMergeAdvanced = require("object-merge-advanced");
|
|
8
1
|
/**
|
|
9
2
|
* We need to use the object-merge-advanced library to merge array items properly.
|
|
10
3
|
* With plain assign or lodash merge, we will lose array items from the source object.
|
|
11
4
|
*/
|
|
12
5
|
|
|
6
|
+
import { mergeAdvanced } from "object-merge-advanced";
|
|
13
7
|
const mergeOptions = {
|
|
14
8
|
hardArrayConcat: true
|
|
15
9
|
};
|
|
16
|
-
class ObjectUpdater {
|
|
10
|
+
export class ObjectUpdater {
|
|
17
11
|
data = {};
|
|
18
12
|
merge(target, clear = true) {
|
|
19
|
-
const item =
|
|
13
|
+
const item = mergeAdvanced(target, this.data, mergeOptions);
|
|
20
14
|
if (!clear) {
|
|
21
15
|
return item;
|
|
22
16
|
}
|
|
@@ -32,7 +26,7 @@ class ObjectUpdater {
|
|
|
32
26
|
return values;
|
|
33
27
|
}
|
|
34
28
|
update(input) {
|
|
35
|
-
this.data =
|
|
29
|
+
this.data = mergeAdvanced(this.data, input, mergeOptions);
|
|
36
30
|
}
|
|
37
31
|
isDirty() {
|
|
38
32
|
return Object.keys(this.data).length > 0;
|
|
@@ -41,6 +35,5 @@ class ObjectUpdater {
|
|
|
41
35
|
this.data = {};
|
|
42
36
|
}
|
|
43
37
|
}
|
|
44
|
-
exports.ObjectUpdater = ObjectUpdater;
|
|
45
38
|
|
|
46
39
|
//# sourceMappingURL=ObjectUpdater.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["
|
|
1
|
+
{"version":3,"names":["mergeAdvanced","mergeOptions","hardArrayConcat","ObjectUpdater","data","merge","target","clear","item","fetch","values","structuredClone","update","input","isDirty","Object","keys","length"],"sources":["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"],"mappings":"AAAA;AACA;AACA;AACA;;AAEA,SAASA,aAAa,QAAQ,uBAAuB;AAErD,MAAMC,YAAsC,GAAG;EAC3CC,eAAe,EAAE;AACrB,CAAC;AAED,OAAO,MAAMC,aAAa,CAAI;EAClBC,IAAI,GAAe,CAAC,CAAC;EAEtBC,KAAKA,CAACC,MAAS,EAAEC,KAAK,GAAG,IAAI,EAAK;IACrC,MAAMC,IAAI,GAAGR,aAAa,CAACM,MAAM,EAAE,IAAI,CAACF,IAAI,EAAEH,YAAY,CAAC;IAC3D,IAAI,CAACM,KAAK,EAAE;MACR,OAAOC,IAAI;IACf;IACA,IAAI,CAACD,KAAK,CAAC,CAAC;IACZ,OAAOC,IAAI;EACf;EAEOC,KAAKA,CAACF,KAAK,GAAG,IAAI,EAAc;IACnC,MAAMG,MAAM,GAAGC,eAAe,CAAC,IAAI,CAACP,IAAI,CAAC;IACzC,IAAI,CAACG,KAAK,EAAE;MACR,OAAOG,MAAM;IACjB;IACA,IAAI,CAACH,KAAK,CAAC,CAAC;IACZ,OAAOG,MAAM;EACjB;EACOE,MAAMA,CAACC,KAAiB,EAAE;IAC7B,IAAI,CAACT,IAAI,GAAGJ,aAAa,CAAC,IAAI,CAACI,IAAI,EAAES,KAAK,EAAEZ,YAAY,CAAC;EAC7D;EAEOa,OAAOA,CAAA,EAAY;IACtB,OAAOC,MAAM,CAACC,IAAI,CAAC,IAAI,CAACZ,IAAI,CAAC,CAACa,MAAM,GAAG,CAAC;EAC5C;EAEQV,KAAKA,CAAA,EAAG;IACZ,IAAI,CAACH,IAAI,GAAG,CAAC,CAAC;EAClB;AACJ","ignoreList":[]}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import type { IResponseError } from "../response/abstractions";
|
|
1
|
+
import type { IResponseError } from "../response/abstractions/index.js";
|
|
2
2
|
export declare const getErrorProperties: (error: Error | IResponseError) => IResponseError;
|
|
@@ -1,15 +1,8 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.getErrorProperties = void 0;
|
|
7
|
-
var _getObjectProperties = require("./getObjectProperties");
|
|
8
|
-
const getErrorProperties = error => {
|
|
9
|
-
const value = (0, _getObjectProperties.getObjectProperties)(error);
|
|
1
|
+
import { getObjectProperties } from "./getObjectProperties.js";
|
|
2
|
+
export const getErrorProperties = error => {
|
|
3
|
+
const value = getObjectProperties(error);
|
|
10
4
|
delete value.stack;
|
|
11
5
|
return value;
|
|
12
6
|
};
|
|
13
|
-
exports.getErrorProperties = getErrorProperties;
|
|
14
7
|
|
|
15
8
|
//# sourceMappingURL=getErrorProperties.js.map
|