@webiny/tasks 0.0.0-unstable.06b2ede40f
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +10 -0
- package/context.d.ts +2 -0
- package/context.js +33 -0
- package/context.js.map +1 -0
- package/crud/crud.tasks.d.ts +2 -0
- package/crud/crud.tasks.js +273 -0
- package/crud/crud.tasks.js.map +1 -0
- package/crud/definition.tasks.d.ts +2 -0
- package/crud/definition.tasks.js +29 -0
- package/crud/definition.tasks.js.map +1 -0
- package/crud/model.d.ts +5 -0
- package/crud/model.js +216 -0
- package/crud/model.js.map +1 -0
- package/crud/service.tasks.d.ts +2 -0
- package/crud/service.tasks.js +171 -0
- package/crud/service.tasks.js.map +1 -0
- package/crud/where.d.ts +1 -0
- package/crud/where.js +33 -0
- package/crud/where.js.map +1 -0
- package/graphql/checkPermissions.d.ts +7 -0
- package/graphql/checkPermissions.js +46 -0
- package/graphql/checkPermissions.js.map +1 -0
- package/graphql/index.d.ts +2 -0
- package/graphql/index.js +351 -0
- package/graphql/index.js.map +1 -0
- package/graphql/utils.d.ts +9 -0
- package/graphql/utils.js +28 -0
- package/graphql/utils.js.map +1 -0
- package/handler/index.d.ts +6 -0
- package/handler/index.js +69 -0
- package/handler/index.js.map +1 -0
- package/handler/register.d.ts +1 -0
- package/handler/register.js +25 -0
- package/handler/register.js.map +1 -0
- package/handler/types.d.ts +25 -0
- package/handler/types.js +7 -0
- package/handler/types.js.map +1 -0
- package/index.d.ts +6 -0
- package/index.js +62 -0
- package/index.js.map +1 -0
- package/package.json +50 -0
- package/plugins/TaskServicePlugin.d.ts +20 -0
- package/plugins/TaskServicePlugin.js +17 -0
- package/plugins/TaskServicePlugin.js.map +1 -0
- package/plugins/index.d.ts +1 -0
- package/plugins/index.js +18 -0
- package/plugins/index.js.map +1 -0
- package/response/DatabaseResponse.d.ts +12 -0
- package/response/DatabaseResponse.js +152 -0
- package/response/DatabaseResponse.js.map +1 -0
- package/response/Response.d.ts +13 -0
- package/response/Response.js +120 -0
- package/response/Response.js.map +1 -0
- package/response/ResponseAbortedResult.d.ts +10 -0
- package/response/ResponseAbortedResult.js +19 -0
- package/response/ResponseAbortedResult.js.map +1 -0
- package/response/ResponseContinueResult.d.ts +18 -0
- package/response/ResponseContinueResult.js +26 -0
- package/response/ResponseContinueResult.js.map +1 -0
- package/response/ResponseDoneResult.d.ts +13 -0
- package/response/ResponseDoneResult.js +21 -0
- package/response/ResponseDoneResult.js.map +1 -0
- package/response/ResponseErrorResult.d.ts +11 -0
- package/response/ResponseErrorResult.js +20 -0
- package/response/ResponseErrorResult.js.map +1 -0
- package/response/TaskResponse.d.ts +11 -0
- package/response/TaskResponse.js +80 -0
- package/response/TaskResponse.js.map +1 -0
- package/response/abstractions/Response.d.ts +25 -0
- package/response/abstractions/Response.js +7 -0
- package/response/abstractions/Response.js.map +1 -0
- package/response/abstractions/ResponseAbortedResult.d.ts +5 -0
- package/response/abstractions/ResponseAbortedResult.js +7 -0
- package/response/abstractions/ResponseAbortedResult.js.map +1 -0
- package/response/abstractions/ResponseBaseResult.d.ts +8 -0
- package/response/abstractions/ResponseBaseResult.js +7 -0
- package/response/abstractions/ResponseBaseResult.js.map +1 -0
- package/response/abstractions/ResponseContinueResult.d.ts +21 -0
- package/response/abstractions/ResponseContinueResult.js +7 -0
- package/response/abstractions/ResponseContinueResult.js.map +1 -0
- package/response/abstractions/ResponseDoneResult.d.ts +14 -0
- package/response/abstractions/ResponseDoneResult.js +7 -0
- package/response/abstractions/ResponseDoneResult.js.map +1 -0
- package/response/abstractions/ResponseErrorResult.d.ts +19 -0
- package/response/abstractions/ResponseErrorResult.js +7 -0
- package/response/abstractions/ResponseErrorResult.js.map +1 -0
- package/response/abstractions/TaskResponse.d.ts +38 -0
- package/response/abstractions/TaskResponse.js +7 -0
- package/response/abstractions/TaskResponse.js.map +1 -0
- package/response/abstractions/index.d.ts +7 -0
- package/response/abstractions/index.js +84 -0
- package/response/abstractions/index.js.map +1 -0
- package/response/index.d.ts +7 -0
- package/response/index.js +84 -0
- package/response/index.js.map +1 -0
- package/runner/TaskControl.d.ts +14 -0
- package/runner/TaskControl.js +222 -0
- package/runner/TaskControl.js.map +1 -0
- package/runner/TaskEventValidation.d.ts +5 -0
- package/runner/TaskEventValidation.js +30 -0
- package/runner/TaskEventValidation.js.map +1 -0
- package/runner/TaskManager.d.ts +14 -0
- package/runner/TaskManager.js +139 -0
- package/runner/TaskManager.js.map +1 -0
- package/runner/TaskManagerStore.d.ts +40 -0
- package/runner/TaskManagerStore.js +167 -0
- package/runner/TaskManagerStore.js.map +1 -0
- package/runner/TaskRunner.d.ts +26 -0
- package/runner/TaskRunner.js +97 -0
- package/runner/TaskRunner.js.map +1 -0
- package/runner/abstractions/TaskControl.d.ts +10 -0
- package/runner/abstractions/TaskControl.js +7 -0
- package/runner/abstractions/TaskControl.js.map +1 -0
- package/runner/abstractions/TaskEventValidation.d.ts +5 -0
- package/runner/abstractions/TaskEventValidation.js +7 -0
- package/runner/abstractions/TaskEventValidation.js.map +1 -0
- package/runner/abstractions/TaskManager.d.ts +5 -0
- package/runner/abstractions/TaskManager.js +7 -0
- package/runner/abstractions/TaskManager.js.map +1 -0
- package/runner/abstractions/TaskManagerStore.d.ts +92 -0
- package/runner/abstractions/TaskManagerStore.js +7 -0
- package/runner/abstractions/TaskManagerStore.js.map +1 -0
- package/runner/abstractions/TaskRunner.d.ts +13 -0
- package/runner/abstractions/TaskRunner.js +7 -0
- package/runner/abstractions/TaskRunner.js.map +1 -0
- package/runner/abstractions/index.d.ts +5 -0
- package/runner/abstractions/index.js +62 -0
- package/runner/abstractions/index.js.map +1 -0
- package/runner/index.d.ts +1 -0
- package/runner/index.js +18 -0
- package/runner/index.js.map +1 -0
- package/service/EventBridgeEventTransportPlugin.d.ts +17 -0
- package/service/EventBridgeEventTransportPlugin.js +60 -0
- package/service/EventBridgeEventTransportPlugin.js.map +1 -0
- package/service/StepFunctionServicePlugin.d.ts +26 -0
- package/service/StepFunctionServicePlugin.js +88 -0
- package/service/StepFunctionServicePlugin.js.map +1 -0
- package/service/createService.d.ts +6 -0
- package/service/createService.js +30 -0
- package/service/createService.js.map +1 -0
- package/service/index.d.ts +4 -0
- package/service/index.js +31 -0
- package/service/index.js.map +1 -0
- package/task/index.d.ts +2 -0
- package/task/index.js +29 -0
- package/task/index.js.map +1 -0
- package/task/input.d.ts +15 -0
- package/task/input.js +21 -0
- package/task/input.js.map +1 -0
- package/task/plugin.d.ts +36 -0
- package/task/plugin.js +106 -0
- package/task/plugin.js.map +1 -0
- package/tasks/testingRunTask.d.ts +1 -0
- package/tasks/testingRunTask.js +21 -0
- package/tasks/testingRunTask.js.map +1 -0
- package/types.d.ts +340 -0
- package/types.js +69 -0
- package/types.js.map +1 -0
- package/utils/ObjectUpdater.d.ts +8 -0
- package/utils/ObjectUpdater.js +46 -0
- package/utils/ObjectUpdater.js.map +1 -0
- package/utils/getErrorProperties.d.ts +2 -0
- package/utils/getErrorProperties.js +15 -0
- package/utils/getErrorProperties.js.map +1 -0
- package/utils/getObjectProperties.d.ts +8 -0
- package/utils/getObjectProperties.js +25 -0
- package/utils/getObjectProperties.js.map +1 -0
- package/utils/index.d.ts +3 -0
- package/utils/index.js +40 -0
- package/utils/index.js.map +1 -0
package/index.js
ADDED
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
var _exportNames = {
|
|
7
|
+
createBackgroundTaskGraphQL: true,
|
|
8
|
+
createBackgroundTaskContext: true
|
|
9
|
+
};
|
|
10
|
+
Object.defineProperty(exports, "createBackgroundTaskContext", {
|
|
11
|
+
enumerable: true,
|
|
12
|
+
get: function () {
|
|
13
|
+
return _context.createBackgroundTaskContext;
|
|
14
|
+
}
|
|
15
|
+
});
|
|
16
|
+
Object.defineProperty(exports, "createBackgroundTaskGraphQL", {
|
|
17
|
+
enumerable: true,
|
|
18
|
+
get: function () {
|
|
19
|
+
return _graphql.createBackgroundTaskGraphQL;
|
|
20
|
+
}
|
|
21
|
+
});
|
|
22
|
+
require("./handler/register");
|
|
23
|
+
var _graphql = require("./graphql");
|
|
24
|
+
var _context = require("./context");
|
|
25
|
+
var _task = require("./task");
|
|
26
|
+
Object.keys(_task).forEach(function (key) {
|
|
27
|
+
if (key === "default" || key === "__esModule") return;
|
|
28
|
+
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
|
|
29
|
+
if (key in exports && exports[key] === _task[key]) return;
|
|
30
|
+
Object.defineProperty(exports, key, {
|
|
31
|
+
enumerable: true,
|
|
32
|
+
get: function () {
|
|
33
|
+
return _task[key];
|
|
34
|
+
}
|
|
35
|
+
});
|
|
36
|
+
});
|
|
37
|
+
var _response = require("./response");
|
|
38
|
+
Object.keys(_response).forEach(function (key) {
|
|
39
|
+
if (key === "default" || key === "__esModule") return;
|
|
40
|
+
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
|
|
41
|
+
if (key in exports && exports[key] === _response[key]) return;
|
|
42
|
+
Object.defineProperty(exports, key, {
|
|
43
|
+
enumerable: true,
|
|
44
|
+
get: function () {
|
|
45
|
+
return _response[key];
|
|
46
|
+
}
|
|
47
|
+
});
|
|
48
|
+
});
|
|
49
|
+
var _types = require("./types");
|
|
50
|
+
Object.keys(_types).forEach(function (key) {
|
|
51
|
+
if (key === "default" || key === "__esModule") return;
|
|
52
|
+
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
|
|
53
|
+
if (key in exports && exports[key] === _types[key]) return;
|
|
54
|
+
Object.defineProperty(exports, key, {
|
|
55
|
+
enumerable: true,
|
|
56
|
+
get: function () {
|
|
57
|
+
return _types[key];
|
|
58
|
+
}
|
|
59
|
+
});
|
|
60
|
+
});
|
|
61
|
+
|
|
62
|
+
//# sourceMappingURL=index.js.map
|
package/index.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["require","_graphql","_context","_task","Object","keys","forEach","key","prototype","hasOwnProperty","call","_exportNames","exports","defineProperty","enumerable","get","_response","_types"],"sources":["index.ts"],"sourcesContent":["import \"./handler/register\";\n\nexport { createBackgroundTaskGraphQL } from \"./graphql\";\nexport { createBackgroundTaskContext } from \"./context\";\n\nexport * from \"./task\";\nexport * from \"./response\";\nexport * from \"./types\";\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAAAA,OAAA;AAEA,IAAAC,QAAA,GAAAD,OAAA;AACA,IAAAE,QAAA,GAAAF,OAAA;AAEA,IAAAG,KAAA,GAAAH,OAAA;AAAAI,MAAA,CAAAC,IAAA,CAAAF,KAAA,EAAAG,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,MAAAJ,KAAA,CAAAI,GAAA;EAAAH,MAAA,CAAAS,cAAA,CAAAD,OAAA,EAAAL,GAAA;IAAAO,UAAA;IAAAC,GAAA,WAAAA,CAAA;MAAA,OAAAZ,KAAA,CAAAI,GAAA;IAAA;EAAA;AAAA;AACA,IAAAS,SAAA,GAAAhB,OAAA;AAAAI,MAAA,CAAAC,IAAA,CAAAW,SAAA,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,SAAA,CAAAT,GAAA;EAAAH,MAAA,CAAAS,cAAA,CAAAD,OAAA,EAAAL,GAAA;IAAAO,UAAA;IAAAC,GAAA,WAAAA,CAAA;MAAA,OAAAC,SAAA,CAAAT,GAAA;IAAA;EAAA;AAAA;AACA,IAAAU,MAAA,GAAAjB,OAAA;AAAAI,MAAA,CAAAC,IAAA,CAAAY,MAAA,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,MAAA,CAAAV,GAAA;EAAAH,MAAA,CAAAS,cAAA,CAAAD,OAAA,EAAAL,GAAA;IAAAO,UAAA;IAAAC,GAAA,WAAAA,CAAA;MAAA,OAAAE,MAAA,CAAAV,GAAA;IAAA;EAAA;AAAA","ignoreList":[]}
|
package/package.json
ADDED
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@webiny/tasks",
|
|
3
|
+
"version": "0.0.0-unstable.06b2ede40f",
|
|
4
|
+
"main": "index.js",
|
|
5
|
+
"repository": {
|
|
6
|
+
"type": "git",
|
|
7
|
+
"url": "https://github.com/webiny/webiny-js.git"
|
|
8
|
+
},
|
|
9
|
+
"description": "Tasks",
|
|
10
|
+
"contributors": [
|
|
11
|
+
"Bruno Zorić <bruno@webiny.com>"
|
|
12
|
+
],
|
|
13
|
+
"license": "MIT",
|
|
14
|
+
"dependencies": {
|
|
15
|
+
"@webiny/api": "0.0.0-unstable.06b2ede40f",
|
|
16
|
+
"@webiny/api-headless-cms": "0.0.0-unstable.06b2ede40f",
|
|
17
|
+
"@webiny/aws-sdk": "0.0.0-unstable.06b2ede40f",
|
|
18
|
+
"@webiny/error": "0.0.0-unstable.06b2ede40f",
|
|
19
|
+
"@webiny/handler": "0.0.0-unstable.06b2ede40f",
|
|
20
|
+
"@webiny/handler-aws": "0.0.0-unstable.06b2ede40f",
|
|
21
|
+
"@webiny/handler-graphql": "0.0.0-unstable.06b2ede40f",
|
|
22
|
+
"@webiny/plugins": "0.0.0-unstable.06b2ede40f",
|
|
23
|
+
"@webiny/pubsub": "0.0.0-unstable.06b2ede40f",
|
|
24
|
+
"@webiny/utils": "0.0.0-unstable.06b2ede40f",
|
|
25
|
+
"deep-equal": "2.2.3",
|
|
26
|
+
"lodash": "4.17.21",
|
|
27
|
+
"object-merge-advanced": "12.1.0",
|
|
28
|
+
"object-sizeof": "2.6.5",
|
|
29
|
+
"zod": "3.23.8"
|
|
30
|
+
},
|
|
31
|
+
"devDependencies": {
|
|
32
|
+
"@webiny/api-i18n": "0.0.0-unstable.06b2ede40f",
|
|
33
|
+
"@webiny/api-security": "0.0.0-unstable.06b2ede40f",
|
|
34
|
+
"@webiny/api-tenancy": "0.0.0-unstable.06b2ede40f",
|
|
35
|
+
"@webiny/api-wcp": "0.0.0-unstable.06b2ede40f",
|
|
36
|
+
"@webiny/project-utils": "0.0.0-unstable.06b2ede40f",
|
|
37
|
+
"rimraf": "6.0.1",
|
|
38
|
+
"type-fest": "4.14.0",
|
|
39
|
+
"typescript": "5.3.3"
|
|
40
|
+
},
|
|
41
|
+
"publishConfig": {
|
|
42
|
+
"access": "public",
|
|
43
|
+
"directory": "dist"
|
|
44
|
+
},
|
|
45
|
+
"scripts": {
|
|
46
|
+
"build": "node ../cli/bin.js run build",
|
|
47
|
+
"watch": "node ../cli/bin.js run watch"
|
|
48
|
+
},
|
|
49
|
+
"gitHead": "06b2ede40fc2212a70eeafd74afd50b56fb0ce82"
|
|
50
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { Plugin } from "@webiny/plugins";
|
|
2
|
+
import type { ITask } from "../types";
|
|
3
|
+
export interface ITaskServiceCreatePluginParams {
|
|
4
|
+
getTenant(): string;
|
|
5
|
+
getLocale(): string;
|
|
6
|
+
}
|
|
7
|
+
export type ITaskServiceTask = Pick<ITask, "id" | "definitionId">;
|
|
8
|
+
export interface ITaskService {
|
|
9
|
+
send(task: ITaskServiceTask, delay: number): Promise<unknown | null>;
|
|
10
|
+
fetch(task: ITask): Promise<unknown | null>;
|
|
11
|
+
}
|
|
12
|
+
export interface ITaskServicePluginParams {
|
|
13
|
+
default?: boolean;
|
|
14
|
+
}
|
|
15
|
+
export declare abstract class TaskServicePlugin extends Plugin {
|
|
16
|
+
static readonly type: string;
|
|
17
|
+
readonly default: boolean;
|
|
18
|
+
constructor(params?: ITaskServicePluginParams);
|
|
19
|
+
abstract createService(params: ITaskServiceCreatePluginParams): ITaskService;
|
|
20
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.TaskServicePlugin = void 0;
|
|
7
|
+
var _plugins = require("@webiny/plugins");
|
|
8
|
+
class TaskServicePlugin extends _plugins.Plugin {
|
|
9
|
+
static type = "tasks.taskService";
|
|
10
|
+
constructor(params) {
|
|
11
|
+
super();
|
|
12
|
+
this.default = !!params?.default;
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
exports.TaskServicePlugin = TaskServicePlugin;
|
|
16
|
+
|
|
17
|
+
//# sourceMappingURL=TaskServicePlugin.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["_plugins","require","TaskServicePlugin","Plugin","type","constructor","params","default","exports"],"sources":["TaskServicePlugin.ts"],"sourcesContent":["import { Plugin } from \"@webiny/plugins\";\nimport type { ITask } from \"~/types\";\n\nexport interface ITaskServiceCreatePluginParams {\n getTenant(): string;\n getLocale(): string;\n}\n\nexport type ITaskServiceTask = Pick<ITask, \"id\" | \"definitionId\">;\n\nexport interface ITaskService {\n send(task: ITaskServiceTask, delay: number): Promise<unknown | null>;\n fetch(task: ITask): Promise<unknown | null>;\n}\n\nexport interface ITaskServicePluginParams {\n default?: boolean;\n}\n\nexport abstract class TaskServicePlugin extends Plugin {\n public static override readonly type: string = \"tasks.taskService\";\n public readonly default: boolean;\n\n public constructor(params?: ITaskServicePluginParams) {\n super();\n this.default = !!params?.default;\n }\n\n public abstract createService(params: ITaskServiceCreatePluginParams): ITaskService;\n}\n"],"mappings":";;;;;;AAAA,IAAAA,QAAA,GAAAC,OAAA;AAmBO,MAAeC,iBAAiB,SAASC,eAAM,CAAC;EACnD,OAAgCC,IAAI,GAAW,mBAAmB;EAG3DC,WAAWA,CAACC,MAAiC,EAAE;IAClD,KAAK,CAAC,CAAC;IACP,IAAI,CAACC,OAAO,GAAG,CAAC,CAACD,MAAM,EAAEC,OAAO;EACpC;AAGJ;AAACC,OAAA,CAAAN,iBAAA,GAAAA,iBAAA","ignoreList":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./TaskServicePlugin";
|
package/plugins/index.js
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
var _TaskServicePlugin = require("./TaskServicePlugin");
|
|
7
|
+
Object.keys(_TaskServicePlugin).forEach(function (key) {
|
|
8
|
+
if (key === "default" || key === "__esModule") return;
|
|
9
|
+
if (key in exports && exports[key] === _TaskServicePlugin[key]) return;
|
|
10
|
+
Object.defineProperty(exports, key, {
|
|
11
|
+
enumerable: true,
|
|
12
|
+
get: function () {
|
|
13
|
+
return _TaskServicePlugin[key];
|
|
14
|
+
}
|
|
15
|
+
});
|
|
16
|
+
});
|
|
17
|
+
|
|
18
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["_TaskServicePlugin","require","Object","keys","forEach","key","exports","defineProperty","enumerable","get"],"sources":["index.ts"],"sourcesContent":["export * from \"./TaskServicePlugin\";\n"],"mappings":";;;;;AAAA,IAAAA,kBAAA,GAAAC,OAAA;AAAAC,MAAA,CAAAC,IAAA,CAAAH,kBAAA,EAAAI,OAAA,WAAAC,GAAA;EAAA,IAAAA,GAAA,kBAAAA,GAAA;EAAA,IAAAA,GAAA,IAAAC,OAAA,IAAAA,OAAA,CAAAD,GAAA,MAAAL,kBAAA,CAAAK,GAAA;EAAAH,MAAA,CAAAK,cAAA,CAAAD,OAAA,EAAAD,GAAA;IAAAG,UAAA;IAAAC,GAAA,WAAAA,CAAA;MAAA,OAAAT,kBAAA,CAAAK,GAAA;IAAA;EAAA;AAAA","ignoreList":[]}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { IResponse, IResponseAsync, IResponseContinueParams, IResponseContinueResult, IResponseDoneParams, IResponseDoneResult, IResponseErrorParams, IResponseErrorResult, IResponseResult } from "./abstractions";
|
|
2
|
+
import type { ITaskManagerStorePrivate } from "../runner/abstractions";
|
|
3
|
+
export declare class DatabaseResponse implements IResponseAsync {
|
|
4
|
+
readonly response: IResponse;
|
|
5
|
+
private readonly store;
|
|
6
|
+
constructor(response: IResponse, store: ITaskManagerStorePrivate);
|
|
7
|
+
from(result: IResponseResult): Promise<IResponseResult>;
|
|
8
|
+
done(params: IResponseDoneParams): Promise<IResponseDoneResult>;
|
|
9
|
+
aborted(): Promise<import("../types").IResponseAbortedResult>;
|
|
10
|
+
continue(params: IResponseContinueParams): Promise<IResponseContinueResult | IResponseErrorResult>;
|
|
11
|
+
error(params: IResponseErrorParams): Promise<IResponseErrorResult>;
|
|
12
|
+
}
|
|
@@ -0,0 +1,152 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.DatabaseResponse = void 0;
|
|
7
|
+
var _types = require("../types");
|
|
8
|
+
var _handlerGraphql = require("@webiny/handler-graphql");
|
|
9
|
+
var _getErrorProperties = require("../utils/getErrorProperties");
|
|
10
|
+
class DatabaseResponse {
|
|
11
|
+
constructor(response, store) {
|
|
12
|
+
this.response = response;
|
|
13
|
+
this.store = store;
|
|
14
|
+
}
|
|
15
|
+
from(result) {
|
|
16
|
+
switch (result.status) {
|
|
17
|
+
case _types.TaskResponseStatus.DONE:
|
|
18
|
+
return this.done(result);
|
|
19
|
+
case _types.TaskResponseStatus.CONTINUE:
|
|
20
|
+
return this.continue(result);
|
|
21
|
+
case _types.TaskResponseStatus.ERROR:
|
|
22
|
+
return this.error(result);
|
|
23
|
+
case _types.TaskResponseStatus.ABORTED:
|
|
24
|
+
return this.aborted();
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
async done(params) {
|
|
28
|
+
const {
|
|
29
|
+
output,
|
|
30
|
+
...rest
|
|
31
|
+
} = params;
|
|
32
|
+
let message = params.message;
|
|
33
|
+
try {
|
|
34
|
+
await this.store.updateTask({
|
|
35
|
+
taskStatus: _types.TaskDataStatus.SUCCESS,
|
|
36
|
+
finishedOn: new Date().toISOString(),
|
|
37
|
+
output
|
|
38
|
+
});
|
|
39
|
+
await this.store.addInfoLog({
|
|
40
|
+
message: message || "Task done."
|
|
41
|
+
});
|
|
42
|
+
await this.store.save();
|
|
43
|
+
} catch (ex) {
|
|
44
|
+
message = `Task done, but failed to update task log. (${ex.message || "unknown"})`;
|
|
45
|
+
}
|
|
46
|
+
/**
|
|
47
|
+
* Default behavior is to return the done response.
|
|
48
|
+
*/
|
|
49
|
+
return this.response.done({
|
|
50
|
+
...rest,
|
|
51
|
+
message,
|
|
52
|
+
output
|
|
53
|
+
});
|
|
54
|
+
}
|
|
55
|
+
async aborted() {
|
|
56
|
+
return this.response.aborted();
|
|
57
|
+
}
|
|
58
|
+
async continue(params) {
|
|
59
|
+
try {
|
|
60
|
+
const task = this.store.getTask();
|
|
61
|
+
await this.store.updateTask({
|
|
62
|
+
input: {
|
|
63
|
+
...task.input,
|
|
64
|
+
...params.input
|
|
65
|
+
},
|
|
66
|
+
taskStatus: _types.TaskDataStatus.RUNNING
|
|
67
|
+
});
|
|
68
|
+
await this.store.addInfoLog({
|
|
69
|
+
message: "Task continuing.",
|
|
70
|
+
data: params.input
|
|
71
|
+
});
|
|
72
|
+
await this.store.save();
|
|
73
|
+
} catch (ex) {
|
|
74
|
+
/**
|
|
75
|
+
* If task was not found, we just return the error.
|
|
76
|
+
*/
|
|
77
|
+
if (ex instanceof _handlerGraphql.NotFoundError) {
|
|
78
|
+
return this.response.error({
|
|
79
|
+
error: {
|
|
80
|
+
message: ex.message || `Task not found.`,
|
|
81
|
+
code: ex.code || "TASK_NOT_FOUND",
|
|
82
|
+
data: {
|
|
83
|
+
...ex.data,
|
|
84
|
+
input: this.store.getInput()
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
});
|
|
88
|
+
}
|
|
89
|
+
/**
|
|
90
|
+
* Otherwise, we store the error and return it...
|
|
91
|
+
*/
|
|
92
|
+
return this.error({
|
|
93
|
+
error: {
|
|
94
|
+
message: `Failed to update task input: ${ex.message || "unknown error"}`,
|
|
95
|
+
code: ex.code || "TASK_UPDATE_ERROR"
|
|
96
|
+
}
|
|
97
|
+
});
|
|
98
|
+
}
|
|
99
|
+
/**
|
|
100
|
+
* Default behavior is to return the continue response.
|
|
101
|
+
*/
|
|
102
|
+
return this.response.continue(params);
|
|
103
|
+
}
|
|
104
|
+
async error(params) {
|
|
105
|
+
const error = params.error instanceof Error ? (0, _getErrorProperties.getErrorProperties)(params.error) : params.error;
|
|
106
|
+
try {
|
|
107
|
+
await this.store.updateTask({
|
|
108
|
+
taskStatus: _types.TaskDataStatus.FAILED,
|
|
109
|
+
finishedOn: new Date().toISOString(),
|
|
110
|
+
output: {
|
|
111
|
+
error
|
|
112
|
+
}
|
|
113
|
+
});
|
|
114
|
+
await this.store.addErrorLog({
|
|
115
|
+
message: params.error.message,
|
|
116
|
+
data: this.store.getInput(),
|
|
117
|
+
error
|
|
118
|
+
});
|
|
119
|
+
await this.store.save();
|
|
120
|
+
} catch (ex) {
|
|
121
|
+
return this.response.error({
|
|
122
|
+
...params,
|
|
123
|
+
error: {
|
|
124
|
+
...error,
|
|
125
|
+
message: ex.message || error.message,
|
|
126
|
+
code: ex.code || error.code,
|
|
127
|
+
data: {
|
|
128
|
+
...error.data,
|
|
129
|
+
...ex.data,
|
|
130
|
+
input: this.store.getInput()
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
});
|
|
134
|
+
}
|
|
135
|
+
/**
|
|
136
|
+
* Default behavior is to return the error response.
|
|
137
|
+
*/
|
|
138
|
+
return this.response.error({
|
|
139
|
+
...params,
|
|
140
|
+
error: {
|
|
141
|
+
...params.error,
|
|
142
|
+
data: {
|
|
143
|
+
...error.data,
|
|
144
|
+
input: this.store.getInput()
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
});
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
exports.DatabaseResponse = DatabaseResponse;
|
|
151
|
+
|
|
152
|
+
//# sourceMappingURL=DatabaseResponse.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["_types","require","_handlerGraphql","_getErrorProperties","DatabaseResponse","constructor","response","store","from","result","status","TaskResponseStatus","DONE","done","CONTINUE","continue","ERROR","error","ABORTED","aborted","params","output","rest","message","updateTask","taskStatus","TaskDataStatus","SUCCESS","finishedOn","Date","toISOString","addInfoLog","save","ex","task","getTask","input","RUNNING","data","NotFoundError","code","getInput","Error","getErrorProperties","FAILED","addErrorLog","exports"],"sources":["DatabaseResponse.ts"],"sourcesContent":["import { TaskDataStatus, TaskResponseStatus } from \"~/types\";\nimport { NotFoundError } from \"@webiny/handler-graphql\";\nimport type {\n IResponse,\n IResponseAsync,\n IResponseContinueParams,\n IResponseContinueResult,\n IResponseDoneParams,\n IResponseDoneResult,\n IResponseErrorParams,\n IResponseErrorResult,\n IResponseResult\n} from \"./abstractions\";\nimport type { ITaskManagerStorePrivate } from \"~/runner/abstractions\";\nimport { getErrorProperties } from \"~/utils/getErrorProperties\";\n\nexport class DatabaseResponse implements IResponseAsync {\n public readonly response: IResponse;\n\n private readonly store: ITaskManagerStorePrivate;\n\n public constructor(response: IResponse, store: ITaskManagerStorePrivate) {\n this.response = response;\n this.store = store;\n }\n\n public from(result: IResponseResult): Promise<IResponseResult> {\n switch (result.status) {\n case TaskResponseStatus.DONE:\n return this.done(result);\n case TaskResponseStatus.CONTINUE:\n return this.continue(result);\n case TaskResponseStatus.ERROR:\n return this.error(result);\n case TaskResponseStatus.ABORTED:\n return this.aborted();\n }\n }\n\n public async done(params: IResponseDoneParams): Promise<IResponseDoneResult> {\n const { output, ...rest } = params;\n let message = params.message;\n try {\n await this.store.updateTask({\n taskStatus: TaskDataStatus.SUCCESS,\n finishedOn: new Date().toISOString(),\n output\n });\n await this.store.addInfoLog({\n message: message || \"Task done.\"\n });\n await this.store.save();\n } catch (ex) {\n message = `Task done, but failed to update task log. (${ex.message || \"unknown\"})`;\n }\n /**\n * Default behavior is to return the done response.\n */\n return this.response.done({\n ...rest,\n message,\n output\n });\n }\n\n public async aborted() {\n return this.response.aborted();\n }\n\n public async continue(\n params: IResponseContinueParams\n ): Promise<IResponseContinueResult | IResponseErrorResult> {\n try {\n const task = this.store.getTask();\n await this.store.updateTask({\n input: {\n ...task.input,\n ...params.input\n },\n taskStatus: TaskDataStatus.RUNNING\n });\n await this.store.addInfoLog({\n message: \"Task continuing.\",\n data: params.input\n });\n await this.store.save();\n } catch (ex) {\n /**\n * If task was not found, we just return the error.\n */\n if (ex instanceof NotFoundError) {\n return this.response.error({\n error: {\n message: ex.message || `Task not found.`,\n code: ex.code || \"TASK_NOT_FOUND\",\n data: {\n ...ex.data,\n input: this.store.getInput()\n }\n }\n });\n }\n /**\n * Otherwise, we store the error and return it...\n */\n return this.error({\n error: {\n message: `Failed to update task input: ${ex.message || \"unknown error\"}`,\n code: ex.code || \"TASK_UPDATE_ERROR\"\n }\n });\n }\n /**\n * Default behavior is to return the continue response.\n */\n return this.response.continue(params);\n }\n\n public async error(params: IResponseErrorParams): Promise<IResponseErrorResult> {\n const error =\n params.error instanceof Error ? getErrorProperties(params.error) : params.error;\n try {\n await this.store.updateTask({\n taskStatus: TaskDataStatus.FAILED,\n finishedOn: new Date().toISOString(),\n output: {\n error\n }\n });\n await this.store.addErrorLog({\n message: params.error.message,\n data: this.store.getInput(),\n error\n });\n await this.store.save();\n } catch (ex) {\n return this.response.error({\n ...params,\n error: {\n ...error,\n message: ex.message || error.message,\n code: ex.code || error.code,\n data: {\n ...error.data,\n ...ex.data,\n input: this.store.getInput()\n }\n }\n });\n }\n /**\n * Default behavior is to return the error response.\n */\n return this.response.error({\n ...params,\n error: {\n ...params.error,\n data: {\n ...error.data,\n input: this.store.getInput()\n }\n }\n });\n }\n}\n"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,OAAA;AACA,IAAAC,eAAA,GAAAD,OAAA;AAaA,IAAAE,mBAAA,GAAAF,OAAA;AAEO,MAAMG,gBAAgB,CAA2B;EAK7CC,WAAWA,CAACC,QAAmB,EAAEC,KAA+B,EAAE;IACrE,IAAI,CAACD,QAAQ,GAAGA,QAAQ;IACxB,IAAI,CAACC,KAAK,GAAGA,KAAK;EACtB;EAEOC,IAAIA,CAACC,MAAuB,EAA4B;IAC3D,QAAQA,MAAM,CAACC,MAAM;MACjB,KAAKC,yBAAkB,CAACC,IAAI;QACxB,OAAO,IAAI,CAACC,IAAI,CAACJ,MAAM,CAAC;MAC5B,KAAKE,yBAAkB,CAACG,QAAQ;QAC5B,OAAO,IAAI,CAACC,QAAQ,CAACN,MAAM,CAAC;MAChC,KAAKE,yBAAkB,CAACK,KAAK;QACzB,OAAO,IAAI,CAACC,KAAK,CAACR,MAAM,CAAC;MAC7B,KAAKE,yBAAkB,CAACO,OAAO;QAC3B,OAAO,IAAI,CAACC,OAAO,CAAC,CAAC;IAC7B;EACJ;EAEA,MAAaN,IAAIA,CAACO,MAA2B,EAAgC;IACzE,MAAM;MAAEC,MAAM;MAAE,GAAGC;IAAK,CAAC,GAAGF,MAAM;IAClC,IAAIG,OAAO,GAAGH,MAAM,CAACG,OAAO;IAC5B,IAAI;MACA,MAAM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AM,IAAI,CAACV,KAAK,CAACyB,IAAI,CAAC,CAAC;IAC3B,CAAC,CAAC,OAAOC,EAAE,EAAE;MACT,OAAO,IAAI,CAAC3B,QAAQ,CAACW,KAAK,CAAC;QACvB,GAAGG,MAAM;QACTH,KAAK,EAAE;UACH,GAAGA,KAAK;UACRM,OAAO,EAAEU,EAAE,CAACV,OAAO,IAAIN,KAAK,CAACM,OAAO;UACpCiB,IAAI,EAAEP,EAAE,CAACO,IAAI,IAAIvB,KAAK,CAACuB,IAAI;UAC3BF,IAAI,EAAE;YACF,GAAGrB,KAAK,CAACqB,IAAI;YACb,GAAGL,EAAE,CAACK,IAAI;YACVF,KAAK,EAAE,IAAI,CAAC7B,KAAK,CAACkC,QAAQ,CAAC;UAC/B;QACJ;MACJ,CAAC,CAAC;IACN;IACA;AACR;AACA;IACQ,OAAO,IAAI,CAACnC,QAAQ,CAACW,KAAK,CAAC;MACvB,GAAGG,MAAM;MACTH,KAAK,EAAE;QACH,GAAGG,MAAM,CAACH,KAAK;QACfqB,IAAI,EAAE;UACF,GAAGrB,KAAK,CAACqB,IAAI;UACbF,KAAK,EAAE,IAAI,CAAC7B,KAAK,CAACkC,QAAQ,CAAC;QAC/B;MACJ;IACJ,CAAC,CAAC;EACN;AACJ;AAACK,OAAA,CAAA1C,gBAAA,GAAAA,gBAAA","ignoreList":[]}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { ITaskEvent } from "../handler/types";
|
|
2
|
+
import type { IResponse, IResponseAbortedResult, IResponseContinueParams, IResponseContinueResult, IResponseDoneParams, IResponseDoneResult, IResponseErrorParams, IResponseErrorResult, IResponseFromParams, IResponseResult, ITaskResponseDoneResultOutput } from "./abstractions";
|
|
3
|
+
export declare class Response implements IResponse {
|
|
4
|
+
private _event;
|
|
5
|
+
get event(): ITaskEvent;
|
|
6
|
+
constructor(event: ITaskEvent);
|
|
7
|
+
setEvent(event: ITaskEvent): void;
|
|
8
|
+
from(params: IResponseFromParams): IResponseResult;
|
|
9
|
+
continue(params: IResponseContinueParams): IResponseContinueResult;
|
|
10
|
+
done<O extends ITaskResponseDoneResultOutput = ITaskResponseDoneResultOutput>(params?: IResponseDoneParams<O>): IResponseDoneResult<O>;
|
|
11
|
+
aborted(): IResponseAbortedResult;
|
|
12
|
+
error(params: IResponseErrorParams): IResponseErrorResult;
|
|
13
|
+
}
|
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
exports.Response = void 0;
|
|
8
|
+
var _objectSizeof = _interopRequireDefault(require("object-sizeof"));
|
|
9
|
+
var _types = require("../types");
|
|
10
|
+
var _ResponseContinueResult = require("./ResponseContinueResult");
|
|
11
|
+
var _ResponseDoneResult = require("./ResponseDoneResult");
|
|
12
|
+
var _ResponseErrorResult = require("./ResponseErrorResult");
|
|
13
|
+
var _ResponseAbortedResult = require("./ResponseAbortedResult");
|
|
14
|
+
var _getErrorProperties = require("../utils/getErrorProperties");
|
|
15
|
+
/**
|
|
16
|
+
* Step Functions has a limit of 256KB for the output size.
|
|
17
|
+
* We will set the max output to be 232KB to leave some room for the rest of the data.
|
|
18
|
+
*/
|
|
19
|
+
const MAX_SIZE_BYTES = 232 * 1024;
|
|
20
|
+
const createMaxSizeOutput = ({
|
|
21
|
+
size
|
|
22
|
+
}) => {
|
|
23
|
+
return {
|
|
24
|
+
message: `Output size exceeds the maximum allowed size.`,
|
|
25
|
+
size,
|
|
26
|
+
max: MAX_SIZE_BYTES
|
|
27
|
+
};
|
|
28
|
+
};
|
|
29
|
+
/**
|
|
30
|
+
* Figure out the size of the output object and remove the stack trace if the size exceeds the maximum allowed size.
|
|
31
|
+
* If the size is still greater than the maximum allowed size, just return the message that the output size exceeds the maximum allowed size.
|
|
32
|
+
*/
|
|
33
|
+
const getOutput = output => {
|
|
34
|
+
if (!output || Object.keys(output).length === 0) {
|
|
35
|
+
return undefined;
|
|
36
|
+
}
|
|
37
|
+
let size = (0, _objectSizeof.default)(output);
|
|
38
|
+
if (size > MAX_SIZE_BYTES) {
|
|
39
|
+
if (output.stack) {
|
|
40
|
+
delete output.stack;
|
|
41
|
+
size = (0, _objectSizeof.default)(output);
|
|
42
|
+
if (size <= MAX_SIZE_BYTES) {
|
|
43
|
+
return output;
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
if (output.error?.stack) {
|
|
47
|
+
delete output.error.stack;
|
|
48
|
+
size = (0, _objectSizeof.default)(output);
|
|
49
|
+
if (size <= MAX_SIZE_BYTES) {
|
|
50
|
+
return output;
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
return createMaxSizeOutput({
|
|
54
|
+
size
|
|
55
|
+
});
|
|
56
|
+
}
|
|
57
|
+
return output;
|
|
58
|
+
};
|
|
59
|
+
class Response {
|
|
60
|
+
get event() {
|
|
61
|
+
return this._event;
|
|
62
|
+
}
|
|
63
|
+
constructor(event) {
|
|
64
|
+
this._event = event;
|
|
65
|
+
}
|
|
66
|
+
setEvent(event) {
|
|
67
|
+
this._event = event;
|
|
68
|
+
}
|
|
69
|
+
from(params) {
|
|
70
|
+
switch (params.status) {
|
|
71
|
+
case _types.TaskResponseStatus.DONE:
|
|
72
|
+
return this.done(params);
|
|
73
|
+
case _types.TaskResponseStatus.CONTINUE:
|
|
74
|
+
return this.continue(params);
|
|
75
|
+
case _types.TaskResponseStatus.ERROR:
|
|
76
|
+
return this.error(params);
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
continue(params) {
|
|
80
|
+
return new _ResponseContinueResult.ResponseContinueResult({
|
|
81
|
+
message: params.message,
|
|
82
|
+
input: params.input,
|
|
83
|
+
webinyTaskId: params?.webinyTaskId || this.event.webinyTaskId,
|
|
84
|
+
webinyTaskDefinitionId: this.event.webinyTaskDefinitionId,
|
|
85
|
+
tenant: params?.tenant || this.event.tenant,
|
|
86
|
+
locale: params?.locale || this.event.locale,
|
|
87
|
+
wait: params.wait
|
|
88
|
+
});
|
|
89
|
+
}
|
|
90
|
+
done(params) {
|
|
91
|
+
return new _ResponseDoneResult.ResponseDoneResult({
|
|
92
|
+
webinyTaskId: params?.webinyTaskId || this.event.webinyTaskId,
|
|
93
|
+
webinyTaskDefinitionId: this.event.webinyTaskDefinitionId,
|
|
94
|
+
tenant: params?.tenant || this.event.tenant,
|
|
95
|
+
locale: params?.locale || this.event.locale,
|
|
96
|
+
message: params?.message,
|
|
97
|
+
output: getOutput(params?.output)
|
|
98
|
+
});
|
|
99
|
+
}
|
|
100
|
+
aborted() {
|
|
101
|
+
return new _ResponseAbortedResult.ResponseAbortedResult({
|
|
102
|
+
webinyTaskId: this.event.webinyTaskId,
|
|
103
|
+
webinyTaskDefinitionId: this.event.webinyTaskDefinitionId,
|
|
104
|
+
tenant: this.event.tenant,
|
|
105
|
+
locale: this.event.locale
|
|
106
|
+
});
|
|
107
|
+
}
|
|
108
|
+
error(params) {
|
|
109
|
+
return new _ResponseErrorResult.ResponseErrorResult({
|
|
110
|
+
webinyTaskId: params.webinyTaskId || this.event.webinyTaskId,
|
|
111
|
+
webinyTaskDefinitionId: this.event.webinyTaskDefinitionId,
|
|
112
|
+
tenant: params.tenant || this.event.tenant,
|
|
113
|
+
locale: params.locale || this.event.locale,
|
|
114
|
+
error: params.error instanceof Error ? (0, _getErrorProperties.getErrorProperties)(params.error) : params.error
|
|
115
|
+
});
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
exports.Response = Response;
|
|
119
|
+
|
|
120
|
+
//# sourceMappingURL=Response.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["_objectSizeof","_interopRequireDefault","require","_types","_ResponseContinueResult","_ResponseDoneResult","_ResponseErrorResult","_ResponseAbortedResult","_getErrorProperties","MAX_SIZE_BYTES","createMaxSizeOutput","size","message","max","getOutput","output","Object","keys","length","undefined","sizeOfObject","stack","error","Response","event","_event","constructor","setEvent","from","params","status","TaskResponseStatus","DONE","done","CONTINUE","continue","ERROR","ResponseContinueResult","input","webinyTaskId","webinyTaskDefinitionId","tenant","locale","wait","ResponseDoneResult","aborted","ResponseAbortedResult","ResponseErrorResult","Error","getErrorProperties","exports"],"sources":["Response.ts"],"sourcesContent":["import sizeOfObject from \"object-sizeof\";\n\nimport type { ITaskEvent } from \"~/handler/types\";\nimport { TaskResponseStatus } from \"~/types\";\nimport type {\n IResponse,\n IResponseAbortedResult,\n IResponseContinueParams,\n IResponseContinueResult,\n IResponseDoneParams,\n IResponseDoneResult,\n IResponseErrorParams,\n IResponseErrorResult,\n IResponseFromParams,\n IResponseResult,\n ITaskResponseDoneResultOutput\n} from \"./abstractions\";\nimport { ResponseContinueResult } from \"~/response/ResponseContinueResult\";\nimport { ResponseDoneResult } from \"~/response/ResponseDoneResult\";\nimport { ResponseErrorResult } from \"~/response/ResponseErrorResult\";\nimport { ResponseAbortedResult } from \"./ResponseAbortedResult\";\nimport { getErrorProperties } from \"~/utils/getErrorProperties\";\n\n/**\n * Step Functions has a limit of 256KB for the output size.\n * We will set the max output to be 232KB to leave some room for the rest of the data.\n */\nconst MAX_SIZE_BYTES: number = 232 * 1024;\n\ninterface ICreateMaxSizeOutputParams {\n size: number;\n}\n\nconst createMaxSizeOutput = <O extends ITaskResponseDoneResultOutput>({\n size\n}: ICreateMaxSizeOutputParams): O => {\n return {\n message: `Output size exceeds the maximum allowed size.`,\n size,\n max: MAX_SIZE_BYTES\n } as unknown as O;\n};\n/**\n * Figure out the size of the output object and remove the stack trace if the size exceeds the maximum allowed size.\n * If the size is still greater than the maximum allowed size, just return the message that the output size exceeds the maximum allowed size.\n */\nconst getOutput = <O extends ITaskResponseDoneResultOutput>(output?: O): O | undefined => {\n if (!output || Object.keys(output).length === 0) {\n return undefined;\n }\n let size = sizeOfObject(output);\n if (size > MAX_SIZE_BYTES) {\n if (output.stack) {\n delete output.stack;\n size = sizeOfObject(output);\n if (size <= MAX_SIZE_BYTES) {\n return output;\n }\n }\n if (output.error?.stack) {\n delete output.error.stack;\n size = sizeOfObject(output);\n if (size <= MAX_SIZE_BYTES) {\n return output;\n }\n }\n return createMaxSizeOutput<O>({ size });\n }\n return output;\n};\n\nexport class Response implements IResponse {\n private _event: ITaskEvent;\n\n public get event(): ITaskEvent {\n return this._event;\n }\n\n public constructor(event: ITaskEvent) {\n this._event = event;\n }\n\n public setEvent(event: ITaskEvent) {\n this._event = event;\n }\n\n public from(params: IResponseFromParams): IResponseResult {\n switch (params.status) {\n case TaskResponseStatus.DONE:\n return this.done(params);\n case TaskResponseStatus.CONTINUE:\n return this.continue(params);\n case TaskResponseStatus.ERROR:\n return this.error(params);\n }\n }\n\n public continue(params: IResponseContinueParams): IResponseContinueResult {\n return new ResponseContinueResult({\n message: params.message,\n input: params.input,\n webinyTaskId: params?.webinyTaskId || this.event.webinyTaskId,\n webinyTaskDefinitionId: this.event.webinyTaskDefinitionId,\n tenant: params?.tenant || this.event.tenant,\n locale: params?.locale || this.event.locale,\n wait: params.wait\n });\n }\n\n public done<O extends ITaskResponseDoneResultOutput = ITaskResponseDoneResultOutput>(\n params?: IResponseDoneParams<O>\n ): IResponseDoneResult<O> {\n return new ResponseDoneResult<O>({\n webinyTaskId: params?.webinyTaskId || this.event.webinyTaskId,\n webinyTaskDefinitionId: this.event.webinyTaskDefinitionId,\n tenant: params?.tenant || this.event.tenant,\n locale: params?.locale || this.event.locale,\n message: params?.message,\n output: getOutput<O>(params?.output)\n });\n }\n\n public aborted(): IResponseAbortedResult {\n return new ResponseAbortedResult({\n webinyTaskId: this.event.webinyTaskId,\n webinyTaskDefinitionId: this.event.webinyTaskDefinitionId,\n tenant: this.event.tenant,\n locale: this.event.locale\n });\n }\n\n public error(params: IResponseErrorParams): IResponseErrorResult {\n return new ResponseErrorResult({\n webinyTaskId: params.webinyTaskId || this.event.webinyTaskId,\n webinyTaskDefinitionId: this.event.webinyTaskDefinitionId,\n tenant: params.tenant || this.event.tenant,\n locale: params.locale || this.event.locale,\n error: params.error instanceof Error ? getErrorProperties(params.error) : params.error\n });\n }\n}\n"],"mappings":";;;;;;;AAAA,IAAAA,aAAA,GAAAC,sBAAA,CAAAC,OAAA;AAGA,IAAAC,MAAA,GAAAD,OAAA;AAcA,IAAAE,uBAAA,GAAAF,OAAA;AACA,IAAAG,mBAAA,GAAAH,OAAA;AACA,IAAAI,oBAAA,GAAAJ,OAAA;AACA,IAAAK,sBAAA,GAAAL,OAAA;AACA,IAAAM,mBAAA,GAAAN,OAAA;AAEA;AACA;AACA;AACA;AACA,MAAMO,cAAsB,GAAG,GAAG,GAAG,IAAI;AAMzC,MAAMC,mBAAmB,GAAGA,CAA0C;EAClEC;AACwB,CAAC,KAAQ;EACjC,OAAO;IACHC,OAAO,EAAE,+CAA+C;IACxDD,IAAI;IACJE,GAAG,EAAEJ;EACT,CAAC;AACL,CAAC;AACD;AACA;AACA;AACA;AACA,MAAMK,SAAS,GAA6CC,MAAU,IAAoB;EACtF,IAAI,CAACA,MAAM,IAAIC,MAAM,CAACC,IAAI,CAACF,MAAM,CAAC,CAACG,MAAM,KAAK,CAAC,EAAE;IAC7C,OAAOC,SAAS;EACpB;EACA,IAAIR,IAAI,GAAG,IAAAS,qBAAY,EAACL,MAAM,CAAC;EAC/B,IAAIJ,IAAI,GAAGF,cAAc,EAAE;IACvB,IAAIM,MAAM,CAACM,KAAK,EAAE;MACd,OAAON,MAAM,CAACM,KAAK;MACnBV,IAAI,GAAG,IAAAS,qBAAY,EAACL,MAAM,CAAC;MAC3B,IAAIJ,IAAI,IAAIF,cAAc,EAAE;QACxB,OAAOM,MAAM;MACjB;IACJ;IACA,IAAIA,MAAM,CAACO,KAAK,EAAED,KAAK,EAAE;MACrB,OAAON,MAAM,CAACO,KAAK,CAACD,KAAK;MACzBV,IAAI,GAAG,IAAAS,qBAAY,EAACL,MAAM,CAAC;MAC3B,IAAIJ,IAAI,IAAIF,cAA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AM,CAACP;IACrF,CAAC,CAAC;EACN;AACJ;AAAC4B,OAAA,CAAA3B,QAAA,GAAAA,QAAA","ignoreList":[]}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { TaskResponseStatus } from "../types";
|
|
2
|
+
import type { IResponseAbortedResult } from "./abstractions";
|
|
3
|
+
export declare class ResponseAbortedResult implements IResponseAbortedResult {
|
|
4
|
+
readonly webinyTaskId: string;
|
|
5
|
+
readonly webinyTaskDefinitionId: string;
|
|
6
|
+
readonly tenant: string;
|
|
7
|
+
readonly locale: string;
|
|
8
|
+
readonly status: TaskResponseStatus.ABORTED;
|
|
9
|
+
constructor(params: Omit<IResponseAbortedResult, "status">);
|
|
10
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.ResponseAbortedResult = void 0;
|
|
7
|
+
var _types = require("../types");
|
|
8
|
+
class ResponseAbortedResult {
|
|
9
|
+
status = _types.TaskResponseStatus.ABORTED;
|
|
10
|
+
constructor(params) {
|
|
11
|
+
this.webinyTaskId = params.webinyTaskId;
|
|
12
|
+
this.webinyTaskDefinitionId = params.webinyTaskDefinitionId;
|
|
13
|
+
this.tenant = params.tenant;
|
|
14
|
+
this.locale = params.locale;
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
exports.ResponseAbortedResult = ResponseAbortedResult;
|
|
18
|
+
|
|
19
|
+
//# sourceMappingURL=ResponseAbortedResult.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["_types","require","ResponseAbortedResult","status","TaskResponseStatus","ABORTED","constructor","params","webinyTaskId","webinyTaskDefinitionId","tenant","locale","exports"],"sources":["ResponseAbortedResult.ts"],"sourcesContent":["import { TaskResponseStatus } from \"~/types\";\nimport type { IResponseAbortedResult } from \"./abstractions\";\n\nexport class ResponseAbortedResult implements IResponseAbortedResult {\n public readonly webinyTaskId: string;\n public readonly webinyTaskDefinitionId: string;\n public readonly tenant: string;\n public readonly locale: string;\n public readonly status: TaskResponseStatus.ABORTED = TaskResponseStatus.ABORTED;\n\n public constructor(params: Omit<IResponseAbortedResult, \"status\">) {\n this.webinyTaskId = params.webinyTaskId;\n this.webinyTaskDefinitionId = params.webinyTaskDefinitionId;\n this.tenant = params.tenant;\n this.locale = params.locale;\n }\n}\n"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,OAAA;AAGO,MAAMC,qBAAqB,CAAmC;EAKjDC,MAAM,GAA+BC,yBAAkB,CAACC,OAAO;EAExEC,WAAWA,CAACC,MAA8C,EAAE;IAC/D,IAAI,CAACC,YAAY,GAAGD,MAAM,CAACC,YAAY;IACvC,IAAI,CAACC,sBAAsB,GAAGF,MAAM,CAACE,sBAAsB;IAC3D,IAAI,CAACC,MAAM,GAAGH,MAAM,CAACG,MAAM;IAC3B,IAAI,CAACC,MAAM,GAAGJ,MAAM,CAACI,MAAM;EAC/B;AACJ;AAACC,OAAA,CAAAV,qBAAA,GAAAA,qBAAA","ignoreList":[]}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import type { ITaskDataInput } from "../types";
|
|
2
|
+
import { TaskResponseStatus } from "../types";
|
|
3
|
+
import type { IResponseContinueResult } from "./abstractions";
|
|
4
|
+
export declare class ResponseContinueResult<T = ITaskDataInput> implements IResponseContinueResult<T> {
|
|
5
|
+
readonly message?: string | undefined;
|
|
6
|
+
readonly webinyTaskId: string;
|
|
7
|
+
readonly webinyTaskDefinitionId: string;
|
|
8
|
+
readonly tenant: string;
|
|
9
|
+
readonly locale: string;
|
|
10
|
+
readonly status: TaskResponseStatus.CONTINUE;
|
|
11
|
+
readonly input: T;
|
|
12
|
+
/**
|
|
13
|
+
* We need this to make sure that the task will not use the delay from the previous iteration.
|
|
14
|
+
*/
|
|
15
|
+
readonly delay = -1;
|
|
16
|
+
readonly wait?: number;
|
|
17
|
+
constructor(params: Omit<IResponseContinueResult<T>, "delay" | "status">);
|
|
18
|
+
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.ResponseContinueResult = void 0;
|
|
7
|
+
var _types = require("../types");
|
|
8
|
+
class ResponseContinueResult {
|
|
9
|
+
status = _types.TaskResponseStatus.CONTINUE;
|
|
10
|
+
/**
|
|
11
|
+
* We need this to make sure that the task will not use the delay from the previous iteration.
|
|
12
|
+
*/
|
|
13
|
+
delay = -1;
|
|
14
|
+
constructor(params) {
|
|
15
|
+
this.message = params.message;
|
|
16
|
+
this.webinyTaskId = params.webinyTaskId;
|
|
17
|
+
this.webinyTaskDefinitionId = params.webinyTaskDefinitionId;
|
|
18
|
+
this.tenant = params.tenant;
|
|
19
|
+
this.locale = params.locale;
|
|
20
|
+
this.input = params.input;
|
|
21
|
+
this.wait = params.wait;
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
exports.ResponseContinueResult = ResponseContinueResult;
|
|
25
|
+
|
|
26
|
+
//# sourceMappingURL=ResponseContinueResult.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["_types","require","ResponseContinueResult","status","TaskResponseStatus","CONTINUE","delay","constructor","params","message","webinyTaskId","webinyTaskDefinitionId","tenant","locale","input","wait","exports"],"sources":["ResponseContinueResult.ts"],"sourcesContent":["import type { ITaskDataInput } from \"~/types\";\nimport { TaskResponseStatus } from \"~/types\";\nimport type { IResponseContinueResult } from \"./abstractions\";\n\nexport class ResponseContinueResult<T = ITaskDataInput> implements IResponseContinueResult<T> {\n public readonly message?: string | undefined;\n public readonly webinyTaskId: string;\n public readonly webinyTaskDefinitionId: string;\n public readonly tenant: string;\n public readonly locale: string;\n public readonly status: TaskResponseStatus.CONTINUE = TaskResponseStatus.CONTINUE;\n public readonly input: T;\n /**\n * We need this to make sure that the task will not use the delay from the previous iteration.\n */\n public readonly delay = -1;\n public readonly wait?: number;\n\n public constructor(params: Omit<IResponseContinueResult<T>, \"delay\" | \"status\">) {\n this.message = params.message;\n this.webinyTaskId = params.webinyTaskId;\n this.webinyTaskDefinitionId = params.webinyTaskDefinitionId;\n this.tenant = params.tenant;\n this.locale = params.locale;\n this.input = params.input;\n this.wait = params.wait;\n }\n}\n"],"mappings":";;;;;;AACA,IAAAA,MAAA,GAAAC,OAAA;AAGO,MAAMC,sBAAsB,CAA2D;EAM1EC,MAAM,GAAgCC,yBAAkB,CAACC,QAAQ;EAEjF;AACJ;AACA;EACoBC,KAAK,GAAG,CAAC,CAAC;EAGnBC,WAAWA,CAACC,MAA4D,EAAE;IAC7E,IAAI,CAACC,OAAO,GAAGD,MAAM,CAACC,OAAO;IAC7B,IAAI,CAACC,YAAY,GAAGF,MAAM,CAACE,YAAY;IACvC,IAAI,CAACC,sBAAsB,GAAGH,MAAM,CAACG,sBAAsB;IAC3D,IAAI,CAACC,MAAM,GAAGJ,MAAM,CAACI,MAAM;IAC3B,IAAI,CAACC,MAAM,GAAGL,MAAM,CAACK,MAAM;IAC3B,IAAI,CAACC,KAAK,GAAGN,MAAM,CAACM,KAAK;IACzB,IAAI,CAACC,IAAI,GAAGP,MAAM,CAACO,IAAI;EAC3B;AACJ;AAACC,OAAA,CAAAd,sBAAA,GAAAA,sBAAA","ignoreList":[]}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { ITaskResponseDoneResultOutput } from "../types";
|
|
2
|
+
import { TaskResponseStatus } from "../types";
|
|
3
|
+
import type { IResponseDoneResult } from "./abstractions";
|
|
4
|
+
export declare class ResponseDoneResult<O extends ITaskResponseDoneResultOutput = ITaskResponseDoneResultOutput> implements IResponseDoneResult<O> {
|
|
5
|
+
readonly message?: string | undefined;
|
|
6
|
+
readonly webinyTaskId: string;
|
|
7
|
+
readonly webinyTaskDefinitionId: string;
|
|
8
|
+
readonly tenant: string;
|
|
9
|
+
readonly locale: string;
|
|
10
|
+
readonly output?: O;
|
|
11
|
+
readonly status: TaskResponseStatus.DONE;
|
|
12
|
+
constructor(params: Omit<IResponseDoneResult<O>, "status">);
|
|
13
|
+
}
|