@webiny/tasks 5.40.0-beta.2 → 5.40.0-beta.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/context.js.map +1 -1
- package/crud/EventBridgeEventTransport.js.map +1 -1
- package/crud/crud.tasks.js.map +1 -1
- package/crud/definition.tasks.js.map +1 -1
- package/crud/model.js +4 -8
- package/crud/model.js.map +1 -1
- package/crud/trigger.tasks.js.map +1 -1
- package/crud/where.js.map +1 -1
- package/graphql/checkPermissions.js.map +1 -1
- package/graphql/index.js.map +1 -1
- package/graphql/utils.js.map +1 -1
- package/handler/index.js.map +1 -1
- package/handler/register.js.map +1 -1
- package/handler/types.js.map +1 -1
- package/index.js.map +1 -1
- package/package.json +36 -26
- package/response/DatabaseResponse.js.map +1 -1
- package/response/Response.js.map +1 -1
- package/response/ResponseAbortedResult.js.map +1 -1
- package/response/ResponseContinueResult.js.map +1 -1
- package/response/ResponseDoneResult.js.map +1 -1
- package/response/ResponseErrorResult.js.map +1 -1
- package/response/TaskResponse.js.map +1 -1
- package/response/abstractions/Response.js.map +1 -1
- package/response/abstractions/ResponseAbortedResult.js.map +1 -1
- package/response/abstractions/ResponseBaseResult.js.map +1 -1
- package/response/abstractions/ResponseContinueResult.js.map +1 -1
- package/response/abstractions/ResponseDoneResult.js.map +1 -1
- package/response/abstractions/ResponseErrorResult.js.map +1 -1
- package/response/abstractions/TaskResponse.d.ts +1 -1
- package/response/abstractions/TaskResponse.js.map +1 -1
- package/response/abstractions/index.js.map +1 -1
- package/response/index.js.map +1 -1
- package/runner/TaskControl.js +0 -1
- package/runner/TaskControl.js.map +1 -1
- package/runner/TaskEventValidation.js.map +1 -1
- package/runner/TaskManager.js.map +1 -1
- package/runner/TaskManagerStore.js +3 -1
- package/runner/TaskManagerStore.js.map +1 -1
- package/runner/TaskRunner.d.ts +1 -0
- package/runner/TaskRunner.js +15 -0
- package/runner/TaskRunner.js.map +1 -1
- package/runner/abstractions/TaskControl.js.map +1 -1
- package/runner/abstractions/TaskEventValidation.js.map +1 -1
- package/runner/abstractions/TaskManager.js.map +1 -1
- package/runner/abstractions/TaskManagerStore.js.map +1 -1
- package/runner/abstractions/TaskRunner.js.map +1 -1
- package/runner/abstractions/index.js.map +1 -1
- package/runner/index.js.map +1 -1
- package/task/index.js.map +1 -1
- package/task/input.js.map +1 -1
- package/task/plugin.js.map +1 -1
- package/tasks/testingRunTask.js.map +1 -1
- package/timer/CustomTimer.js.map +1 -1
- package/timer/Timer.js.map +1 -1
- package/timer/abstractions/ITimer.js.map +1 -1
- package/timer/factory.js.map +1 -1
- package/timer/index.js.map +1 -1
- package/types.js +3 -6
- package/types.js.map +1 -1
- package/utils/ObjectUpdater.js.map +1 -1
- package/utils/getErrorProperties.js.map +1 -1
- package/utils/getObjectProperties.js.map +1 -1
package/runner/TaskRunner.js
CHANGED
|
@@ -55,6 +55,11 @@ class TaskRunner {
|
|
|
55
55
|
wait: rawEvent.delay
|
|
56
56
|
});
|
|
57
57
|
}
|
|
58
|
+
|
|
59
|
+
/**
|
|
60
|
+
* Here we set the context locale, using the value receive from the event.
|
|
61
|
+
*/
|
|
62
|
+
this.setLocale(event);
|
|
58
63
|
const control = new _TaskControl.TaskControl(this, response, this.context);
|
|
59
64
|
try {
|
|
60
65
|
return await control.run(event);
|
|
@@ -69,6 +74,16 @@ class TaskRunner {
|
|
|
69
74
|
const result = value > 0 ? value : DEFAULT_TASKS_TIMEOUT_CLOSE_MINUTES;
|
|
70
75
|
return transformMinutesIntoMilliseconds(result);
|
|
71
76
|
}
|
|
77
|
+
setLocale(event) {
|
|
78
|
+
const {
|
|
79
|
+
locale: localeCode
|
|
80
|
+
} = event;
|
|
81
|
+
const locale = this.context.i18n.getLocale(localeCode);
|
|
82
|
+
if (!locale) {
|
|
83
|
+
return;
|
|
84
|
+
}
|
|
85
|
+
this.context.i18n.setContentLocale(locale);
|
|
86
|
+
}
|
|
72
87
|
}
|
|
73
88
|
exports.TaskRunner = TaskRunner;
|
|
74
89
|
|
package/runner/TaskRunner.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_response","require","_TaskControl","_getErrorProperties","transformMinutesIntoMilliseconds","minutes","DEFAULT_TASKS_TIMEOUT_CLOSE_MINUTES","TaskRunner","constructor","context","timer","validation","isCloseToTimeout","seconds","milliseconds","getIsCloseToTimeoutMilliseconds","getRemainingMilliseconds","run","rawEvent","response","Response","event","validate","ex","error","getErrorProperties","setEvent","delay","continue","input","wait","control","TaskControl","value","parseInt","process","env","result","exports"],"sources":["TaskRunner.ts"],"sourcesContent":["import { ITaskEvent, ITaskRawEvent } from \"~/handler/types\";\nimport { ITaskEventValidation, ITaskRunner } from \"./abstractions\";\nimport { Context } from \"~/types\";\nimport { Response } from \"~/response\";\nimport { TaskControl } from \"./TaskControl\";\nimport { IResponseResult } from \"~/response/abstractions\";\nimport { getErrorProperties } from \"~/utils/getErrorProperties\";\nimport { ITimer } from \"~/timer\";\n\nconst transformMinutesIntoMilliseconds = (minutes: number) => {\n return minutes * 60000;\n};\n\nconst DEFAULT_TASKS_TIMEOUT_CLOSE_MINUTES = 3;\n\nexport class TaskRunner<C extends Context = Context> implements ITaskRunner<C> {\n /**\n * When DI is introduced, these will get injected.\n *\n * container.bind<Request>(\"Request\").toConstantValue(request);\n * @inject(\"Request\") public readonly request: Request;\n *\n * Follow the same example for the rest of the properties.\n */\n public readonly context: C;\n private readonly validation: ITaskEventValidation;\n private readonly timer: ITimer;\n\n /**\n * We take all required variables separately because they will get injected via DI - so less refactoring is required in the future.\n */\n public constructor(context: C, timer: ITimer, validation: ITaskEventValidation) {\n this.context = context;\n this.timer = timer;\n this.validation = validation;\n }\n\n public isCloseToTimeout(seconds?: number) {\n const milliseconds = seconds ? seconds * 1000 : this.getIsCloseToTimeoutMilliseconds();\n return this.timer.getRemainingMilliseconds() < milliseconds;\n }\n\n public async run(rawEvent: ITaskRawEvent): Promise<IResponseResult> {\n const response = new Response({\n ...rawEvent\n });\n\n let event: ITaskEvent;\n try {\n event = this.validation.validate(rawEvent);\n } catch (ex) {\n return response.error({\n error: getErrorProperties(ex)\n });\n }\n response.setEvent(event);\n /**\n * If we received a delay when initiating the task, we need to send the continue response immediately.\n */\n if (rawEvent.delay && rawEvent.delay > 0) {\n return response.continue({\n input: {},\n wait: rawEvent.delay\n });\n }\n\n const control = new TaskControl(this, response, this.context);\n\n try {\n return await control.run(event);\n } catch (ex) {\n return response.error({\n error: getErrorProperties(ex)\n });\n }\n }\n\n private getIsCloseToTimeoutMilliseconds() {\n const value = parseInt(process.env[\"WEBINY_TASKS_TIMEOUT_CLOSE_MINUTES\"] || \"\");\n const result = value > 0 ? value : DEFAULT_TASKS_TIMEOUT_CLOSE_MINUTES;\n return transformMinutesIntoMilliseconds(result);\n }\n}\n"],"mappings":";;;;;;AAGA,IAAAA,SAAA,GAAAC,OAAA;AACA,IAAAC,YAAA,GAAAD,OAAA;AAEA,IAAAE,mBAAA,GAAAF,OAAA;AAGA,MAAMG,gCAAgC,GAAIC,OAAe,IAAK;EAC1D,OAAOA,OAAO,GAAG,KAAK;AAC1B,CAAC;AAED,MAAMC,mCAAmC,GAAG,CAAC;AAEtC,MAAMC,UAAU,CAAwD;EAC3E;AACJ;AACA;AACA;AACA;AACA;AACA;AACA;;EAKI;AACJ;AACA;EACWC,WAAWA,CAACC,OAAU,EAAEC,KAAa,EAAEC,UAAgC,EAAE;IAC5E,IAAI,CAACF,OAAO,GAAGA,OAAO;IACtB,IAAI,CAACC,KAAK,GAAGA,KAAK;IAClB,IAAI,CAACC,UAAU,GAAGA,UAAU;EAChC;EAEOC,gBAAgBA,CAACC,OAAgB,EAAE;IACtC,MAAMC,YAAY,GAAGD,OAAO,GAAGA,OAAO,GAAG,IAAI,GAAG,IAAI,CAACE,+BAA+B,CAAC,CAAC;IACtF,OAAO,IAAI,CAACL,KAAK,CAACM,wBAAwB,CAAC,CAAC,GAAGF,YAAY;EAC/D;EAEA,MAAaG,GAAGA,CAACC,QAAuB,EAA4B;IAChE,MAAMC,QAAQ,GAAG,IAAIC,kBAAQ,CAAC;MAC1B,GAAGF;IACP,CAAC,CAAC;IAEF,IAAIG,KAAiB;IACrB,IAAI;MACAA,KAAK,GAAG,IAAI,CAACV,UAAU,CAACW,QAAQ,CAACJ,QAAQ,CAAC;IAC9C,CAAC,CAAC,OAAOK,EAAE,EAAE;MACT,OAAOJ,QAAQ,CAACK,KAAK,CAAC;QAClBA,KAAK,EAAE,IAAAC,sCAAkB,EAACF,EAAE;MAChC,CAAC,CAAC;IACN;IACAJ,QAAQ,CAACO,QAAQ,CAACL,KAAK,CAAC;IACxB;AACR;AACA;IACQ,IAAIH,QAAQ,CAACS,KAAK,IAAIT,QAAQ,CAACS,KAAK,GAAG,CAAC,EAAE;MACtC,OAAOR,QAAQ,CAACS,QAAQ,CAAC;QACrBC,KAAK,EAAE,CAAC,CAAC;QACTC,IAAI,EAAEZ,QAAQ,CAACS;MACnB,CAAC,CAAC;IACN;
|
|
1
|
+
{"version":3,"names":["_response","require","_TaskControl","_getErrorProperties","transformMinutesIntoMilliseconds","minutes","DEFAULT_TASKS_TIMEOUT_CLOSE_MINUTES","TaskRunner","constructor","context","timer","validation","isCloseToTimeout","seconds","milliseconds","getIsCloseToTimeoutMilliseconds","getRemainingMilliseconds","run","rawEvent","response","Response","event","validate","ex","error","getErrorProperties","setEvent","delay","continue","input","wait","setLocale","control","TaskControl","value","parseInt","process","env","result","locale","localeCode","i18n","getLocale","setContentLocale","exports"],"sources":["TaskRunner.ts"],"sourcesContent":["import { ITaskEvent, ITaskRawEvent } from \"~/handler/types\";\nimport { ITaskEventValidation, ITaskRunner } from \"./abstractions\";\nimport { Context } from \"~/types\";\nimport { Response } from \"~/response\";\nimport { TaskControl } from \"./TaskControl\";\nimport { IResponseResult } from \"~/response/abstractions\";\nimport { getErrorProperties } from \"~/utils/getErrorProperties\";\nimport { ITimer } from \"~/timer\";\n\nconst transformMinutesIntoMilliseconds = (minutes: number) => {\n return minutes * 60000;\n};\n\nconst DEFAULT_TASKS_TIMEOUT_CLOSE_MINUTES = 3;\n\nexport class TaskRunner<C extends Context = Context> implements ITaskRunner<C> {\n /**\n * When DI is introduced, these will get injected.\n *\n * container.bind<Request>(\"Request\").toConstantValue(request);\n * @inject(\"Request\") public readonly request: Request;\n *\n * Follow the same example for the rest of the properties.\n */\n public readonly context: C;\n private readonly validation: ITaskEventValidation;\n private readonly timer: ITimer;\n\n /**\n * We take all required variables separately because they will get injected via DI - so less refactoring is required in the future.\n */\n public constructor(context: C, timer: ITimer, validation: ITaskEventValidation) {\n this.context = context;\n this.timer = timer;\n this.validation = validation;\n }\n\n public isCloseToTimeout(seconds?: number) {\n const milliseconds = seconds ? seconds * 1000 : this.getIsCloseToTimeoutMilliseconds();\n return this.timer.getRemainingMilliseconds() < milliseconds;\n }\n\n public async run(rawEvent: ITaskRawEvent): Promise<IResponseResult> {\n const response = new Response({\n ...rawEvent\n });\n\n let event: ITaskEvent;\n try {\n event = this.validation.validate(rawEvent);\n } catch (ex) {\n return response.error({\n error: getErrorProperties(ex)\n });\n }\n response.setEvent(event);\n /**\n * If we received a delay when initiating the task, we need to send the continue response immediately.\n */\n if (rawEvent.delay && rawEvent.delay > 0) {\n return response.continue({\n input: {},\n wait: rawEvent.delay\n });\n }\n\n /**\n * Here we set the context locale, using the value receive from the event.\n */\n this.setLocale(event);\n\n const control = new TaskControl(this, response, this.context);\n\n try {\n return await control.run(event);\n } catch (ex) {\n return response.error({\n error: getErrorProperties(ex)\n });\n }\n }\n\n private getIsCloseToTimeoutMilliseconds() {\n const value = parseInt(process.env[\"WEBINY_TASKS_TIMEOUT_CLOSE_MINUTES\"] || \"\");\n const result = value > 0 ? value : DEFAULT_TASKS_TIMEOUT_CLOSE_MINUTES;\n return transformMinutesIntoMilliseconds(result);\n }\n\n private setLocale(event: ITaskEvent) {\n const { locale: localeCode } = event;\n const locale = this.context.i18n.getLocale(localeCode);\n\n if (!locale) {\n return;\n }\n\n this.context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AAC,EAAE;MACtC,OAAOR,QAAQ,CAACS,QAAQ,CAAC;QACrBC,KAAK,EAAE,CAAC,CAAC;QACTC,IAAI,EAAEZ,QAAQ,CAACS;MACnB,CAAC,CAAC;IACN;;IAEA;AACR;AACA;IACQ,IAAI,CAACI,SAAS,CAACV,KAAK,CAAC;IAErB,MAAMW,OAAO,GAAG,IAAIC,wBAAW,CAAC,IAAI,EAAEd,QAAQ,EAAE,IAAI,CAACV,OAAO,CAAC;IAE7D,IAAI;MACA,OAAO,MAAMuB,OAAO,CAACf,GAAG,CAACI,KAAK,CAAC;IACnC,CAAC,CAAC,OAAOE,EAAE,EAAE;MACT,OAAOJ,QAAQ,CAACK,KAAK,CAAC;QAClBA,KAAK,EAAE,IAAAC,sCAAkB,EAACF,EAAE;MAChC,CAAC,CAAC;IACN;EACJ;EAEQR,+BAA+BA,CAAA,EAAG;IACtC,MAAMmB,KAAK,GAAGC,QAAQ,CAACC,OAAO,CAACC,GAAG,CAAC,oCAAoC,CAAC,IAAI,EAAE,CAAC;IAC/E,MAAMC,MAAM,GAAGJ,KAAK,GAAG,CAAC,GAAGA,KAAK,GAAG5B,mCAAmC;IACtE,OAAOF,gCAAgC,CAACkC,MAAM,CAAC;EACnD;EAEQP,SAASA,CAACV,KAAiB,EAAE;IACjC,MAAM;MAAEkB,MAAM,EAAEC;IAAW,CAAC,GAAGnB,KAAK;IACpC,MAAMkB,MAAM,GAAG,IAAI,CAAC9B,OAAO,CAACgC,IAAI,CAACC,SAAS,CAACF,UAAU,CAAC;IAEtD,IAAI,CAACD,MAAM,EAAE;MACT;IACJ;IAEA,IAAI,CAAC9B,OAAO,CAACgC,IAAI,CAACE,gBAAgB,CAACJ,MAAM,CAAC;EAC9C;AACJ;AAACK,OAAA,CAAArC,UAAA,GAAAA,UAAA","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":[],"sources":["TaskControl.ts"],"sourcesContent":["import { ITaskRunner } from \"~/runner/abstractions\";\nimport { IResponse, IResponseResult } from \"~/response/abstractions\";\nimport { Context } from \"~/types\";\nimport { ITaskEvent } from \"~/handler/types\";\n\nexport interface ITaskControl {\n runner: ITaskRunner;\n response: IResponse;\n context: Context;\n\n run(event: ITaskEvent): Promise<IResponseResult>;\n}\n"],"mappings":""}
|
|
1
|
+
{"version":3,"names":[],"sources":["TaskControl.ts"],"sourcesContent":["import { ITaskRunner } from \"~/runner/abstractions\";\nimport { IResponse, IResponseResult } from \"~/response/abstractions\";\nimport { Context } from \"~/types\";\nimport { ITaskEvent } from \"~/handler/types\";\n\nexport interface ITaskControl {\n runner: ITaskRunner;\n response: IResponse;\n context: Context;\n\n run(event: ITaskEvent): Promise<IResponseResult>;\n}\n"],"mappings":"","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":[],"sources":["TaskEventValidation.ts"],"sourcesContent":["import { ITaskEvent } from \"~/handler/types\";\n\nexport type ITaskEventValidationResult = ITaskEvent;\n\nexport interface ITaskEventValidation {\n validate: (event: Partial<ITaskEvent>) => ITaskEventValidationResult;\n}\n"],"mappings":""}
|
|
1
|
+
{"version":3,"names":[],"sources":["TaskEventValidation.ts"],"sourcesContent":["import { ITaskEvent } from \"~/handler/types\";\n\nexport type ITaskEventValidationResult = ITaskEvent;\n\nexport interface ITaskEventValidation {\n validate: (event: Partial<ITaskEvent>) => ITaskEventValidationResult;\n}\n"],"mappings":"","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":[],"sources":["TaskManager.ts"],"sourcesContent":["import { IResponseResult } from \"~/response/abstractions\";\nimport { ITask, ITaskDataInput, ITaskDefinition } from \"~/types\";\n\nexport interface ITaskManager<T = ITaskDataInput> {\n run: (definition: ITaskDefinition, task: ITask<T>) => Promise<IResponseResult>;\n}\n"],"mappings":""}
|
|
1
|
+
{"version":3,"names":[],"sources":["TaskManager.ts"],"sourcesContent":["import { IResponseResult } from \"~/response/abstractions\";\nimport { ITask, ITaskDataInput, ITaskDefinition } from \"~/types\";\n\nexport interface ITaskManager<T = ITaskDataInput> {\n run: (definition: ITaskDefinition, task: ITask<T>) => Promise<IResponseResult>;\n}\n"],"mappings":"","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":[],"sources":["TaskManagerStore.ts"],"sourcesContent":["import {\n IResponseError,\n ITask,\n ITaskDataInput,\n ITaskLogItemData,\n ITaskResponseDoneResultOutput,\n ITaskUpdateData,\n TaskDataStatus\n} from \"~/types\";\n\nexport type ITaskManagerStoreUpdateTaskValues<T extends ITaskDataInput = ITaskDataInput> = T;\n\nexport interface ITaskManagerStoreUpdateTaskValuesCb<T extends ITaskDataInput = ITaskDataInput> {\n (input: T): T;\n}\n\nexport interface ITaskManagerStoreUpdateTaskInputOptions {\n save: boolean;\n}\n\nexport type ITaskManagerStoreUpdateTaskInputParam<T extends ITaskDataInput = ITaskDataInput> =\n | ITaskManagerStoreUpdateTaskValuesCb<T>\n | Partial<ITaskManagerStoreUpdateTaskValues<T>>;\n\nexport interface ITaskManagerStoreUpdateTaskParamCb<\n T extends ITaskDataInput = ITaskDataInput,\n O extends ITaskResponseDoneResultOutput = ITaskResponseDoneResultOutput\n> {\n (task: ITask<T, O>): ITaskUpdateData<T, O>;\n}\n\nexport type ITaskManagerStoreUpdateTask<\n T extends ITaskDataInput = ITaskDataInput,\n O extends ITaskResponseDoneResultOutput = ITaskResponseDoneResultOutput\n> = ITaskUpdateData<T, O>;\n\nexport type ITaskManagerStoreUpdateTaskParams<\n T extends ITaskDataInput = ITaskDataInput,\n O extends ITaskResponseDoneResultOutput = ITaskResponseDoneResultOutput\n> = ITaskManagerStoreUpdateTaskParamCb<T, O> | Partial<ITaskManagerStoreUpdateTask<T, O>>;\n\nexport interface ITaskManagerStoreInfoLog {\n message: string;\n data?: ITaskLogItemData;\n}\n\nexport interface ITaskManagerStoreErrorLog {\n message: string;\n data?: ITaskLogItemData;\n error: IResponseError | Error;\n}\n\nexport interface ITaskManagerStoreSetOutputOptions {\n /**\n * Default is true.\n */\n save?: boolean;\n}\n\nexport interface ITaskManagerStoreUpdateTaskOptions {\n /**\n * Default is true.\n */\n save?: boolean;\n}\n\nexport interface ITaskManagerStoreAddLogOptions {\n /**\n * Default is true.\n */\n save?: boolean;\n}\n\n/**\n * Interface should not be used outside the @webiny/tasks package.\n */\nexport interface ITaskManagerStorePrivate<\n T extends ITaskDataInput = ITaskDataInput,\n O extends ITaskResponseDoneResultOutput = ITaskResponseDoneResultOutput\n> {\n getTask: () => ITask<T, O>;\n getStatus: () => TaskDataStatus;\n /**\n * @throws {Error} If task not found or something goes wrong during the database update.\n */\n updateTask(\n params: ITaskManagerStoreUpdateTaskParams<T, O>,\n options?: ITaskManagerStoreUpdateTaskOptions\n ): Promise<void>;\n /**\n * Update the task input, which are used to store custom user data.\n * You can send partial input, and it will be merged with the existing input.\n *\n * @throws {Error} If task not found or something goes wrong during the database update.\n */\n updateInput: (\n params: ITaskManagerStoreUpdateTaskInputParam<T>,\n options?: ITaskManagerStoreUpdateTaskInputOptions\n ) => Promise<void>;\n getInput: () => T;\n /**\n * Update the task output, which are used to store the output data.\n * You can send partial output, and it will be merged with the existing output.\n *\n * Second parameter is optional options, and it contains a possibility not to store the task immediately.\n *\n * @throws {Error} If task not found or something goes wrong during the database update.\n */\n updateOutput: (\n values: Partial<O>,\n options?: ITaskManagerStoreSetOutputOptions\n ) => Promise<void>;\n getOutput: () => O;\n /**\n * @throws {Error} If task not found or something goes wrong during the database update.\n */\n addInfoLog: (log: ITaskManagerStoreInfoLog) => Promise<void>;\n /**\n * @throws {Error} If task not found or something goes wrong during the database update.\n *\n *\n */\n addErrorLog: (log: ITaskManagerStoreErrorLog) => Promise<void>;\n /**\n * Should store the task and logs into the database, if any.\n * If nothing to update, it should skip calling the internal store methods.\n */\n save(): Promise<void>;\n}\n\nexport type ITaskManagerStore<\n T extends ITaskDataInput = ITaskDataInput,\n O extends ITaskResponseDoneResultOutput = ITaskResponseDoneResultOutput\n> = Omit<ITaskManagerStorePrivate<T, O>, \"save\">;\n"],"mappings":""}
|
|
1
|
+
{"version":3,"names":[],"sources":["TaskManagerStore.ts"],"sourcesContent":["import {\n IResponseError,\n ITask,\n ITaskDataInput,\n ITaskLogItemData,\n ITaskResponseDoneResultOutput,\n ITaskUpdateData,\n TaskDataStatus\n} from \"~/types\";\n\nexport type ITaskManagerStoreUpdateTaskValues<T extends ITaskDataInput = ITaskDataInput> = T;\n\nexport interface ITaskManagerStoreUpdateTaskValuesCb<T extends ITaskDataInput = ITaskDataInput> {\n (input: T): T;\n}\n\nexport interface ITaskManagerStoreUpdateTaskInputOptions {\n save: boolean;\n}\n\nexport type ITaskManagerStoreUpdateTaskInputParam<T extends ITaskDataInput = ITaskDataInput> =\n | ITaskManagerStoreUpdateTaskValuesCb<T>\n | Partial<ITaskManagerStoreUpdateTaskValues<T>>;\n\nexport interface ITaskManagerStoreUpdateTaskParamCb<\n T extends ITaskDataInput = ITaskDataInput,\n O extends ITaskResponseDoneResultOutput = ITaskResponseDoneResultOutput\n> {\n (task: ITask<T, O>): ITaskUpdateData<T, O>;\n}\n\nexport type ITaskManagerStoreUpdateTask<\n T extends ITaskDataInput = ITaskDataInput,\n O extends ITaskResponseDoneResultOutput = ITaskResponseDoneResultOutput\n> = ITaskUpdateData<T, O>;\n\nexport type ITaskManagerStoreUpdateTaskParams<\n T extends ITaskDataInput = ITaskDataInput,\n O extends ITaskResponseDoneResultOutput = ITaskResponseDoneResultOutput\n> = ITaskManagerStoreUpdateTaskParamCb<T, O> | Partial<ITaskManagerStoreUpdateTask<T, O>>;\n\nexport interface ITaskManagerStoreInfoLog {\n message: string;\n data?: ITaskLogItemData;\n}\n\nexport interface ITaskManagerStoreErrorLog {\n message: string;\n data?: ITaskLogItemData;\n error: IResponseError | Error;\n}\n\nexport interface ITaskManagerStoreSetOutputOptions {\n /**\n * Default is true.\n */\n save?: boolean;\n}\n\nexport interface ITaskManagerStoreUpdateTaskOptions {\n /**\n * Default is true.\n */\n save?: boolean;\n}\n\nexport interface ITaskManagerStoreAddLogOptions {\n /**\n * Default is true.\n */\n save?: boolean;\n}\n\n/**\n * Interface should not be used outside the @webiny/tasks package.\n */\nexport interface ITaskManagerStorePrivate<\n T extends ITaskDataInput = ITaskDataInput,\n O extends ITaskResponseDoneResultOutput = ITaskResponseDoneResultOutput\n> {\n getTask: () => ITask<T, O>;\n getStatus: () => TaskDataStatus;\n /**\n * @throws {Error} If task not found or something goes wrong during the database update.\n */\n updateTask(\n params: ITaskManagerStoreUpdateTaskParams<T, O>,\n options?: ITaskManagerStoreUpdateTaskOptions\n ): Promise<void>;\n /**\n * Update the task input, which are used to store custom user data.\n * You can send partial input, and it will be merged with the existing input.\n *\n * @throws {Error} If task not found or something goes wrong during the database update.\n */\n updateInput: (\n params: ITaskManagerStoreUpdateTaskInputParam<T>,\n options?: ITaskManagerStoreUpdateTaskInputOptions\n ) => Promise<void>;\n getInput: () => T;\n /**\n * Update the task output, which are used to store the output data.\n * You can send partial output, and it will be merged with the existing output.\n *\n * Second parameter is optional options, and it contains a possibility not to store the task immediately.\n *\n * @throws {Error} If task not found or something goes wrong during the database update.\n */\n updateOutput: (\n values: Partial<O>,\n options?: ITaskManagerStoreSetOutputOptions\n ) => Promise<void>;\n getOutput: () => O;\n /**\n * @throws {Error} If task not found or something goes wrong during the database update.\n */\n addInfoLog: (log: ITaskManagerStoreInfoLog) => Promise<void>;\n /**\n * @throws {Error} If task not found or something goes wrong during the database update.\n *\n *\n */\n addErrorLog: (log: ITaskManagerStoreErrorLog) => Promise<void>;\n /**\n * Should store the task and logs into the database, if any.\n * If nothing to update, it should skip calling the internal store methods.\n */\n save(): Promise<void>;\n}\n\nexport type ITaskManagerStore<\n T extends ITaskDataInput = ITaskDataInput,\n O extends ITaskResponseDoneResultOutput = ITaskResponseDoneResultOutput\n> = Omit<ITaskManagerStorePrivate<T, O>, \"save\">;\n"],"mappings":"","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":[],"sources":["TaskRunner.ts"],"sourcesContent":["import { Context } from \"~/types\";\nimport { ITaskEvent } from \"~/handler/types\";\nimport { IResponseResult } from \"~/response/abstractions\";\n\nexport interface ITaskRunner<C extends Context = Context> {\n context: C;\n isCloseToTimeout(seconds?: number): boolean;\n run(event: ITaskEvent): Promise<IResponseResult>;\n}\n"],"mappings":""}
|
|
1
|
+
{"version":3,"names":[],"sources":["TaskRunner.ts"],"sourcesContent":["import { Context } from \"~/types\";\nimport { ITaskEvent } from \"~/handler/types\";\nimport { IResponseResult } from \"~/response/abstractions\";\n\nexport interface ITaskRunner<C extends Context = Context> {\n context: C;\n isCloseToTimeout(seconds?: number): boolean;\n run(event: ITaskEvent): Promise<IResponseResult>;\n}\n"],"mappings":"","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_TaskControl","require","Object","keys","forEach","key","exports","defineProperty","enumerable","get","_TaskEventValidation","_TaskManager","_TaskRunner","_TaskManagerStore"],"sources":["index.ts"],"sourcesContent":["export * from \"./TaskControl\";\nexport * from \"./TaskEventValidation\";\nexport * from \"./TaskManager\";\nexport * from \"./TaskRunner\";\nexport * from \"./TaskManagerStore\";\n"],"mappings":";;;;;AAAA,IAAAA,YAAA,GAAAC,OAAA;AAAAC,MAAA,CAAAC,IAAA,CAAAH,YAAA,EAAAI,OAAA,WAAAC,GAAA;EAAA,IAAAA,GAAA,kBAAAA,GAAA;EAAA,IAAAA,GAAA,IAAAC,OAAA,IAAAA,OAAA,CAAAD,GAAA,MAAAL,YAAA,CAAAK,GAAA;EAAAH,MAAA,CAAAK,cAAA,CAAAD,OAAA,EAAAD,GAAA;IAAAG,UAAA;IAAAC,GAAA,WAAAA,CAAA;MAAA,OAAAT,YAAA,CAAAK,GAAA;IAAA;EAAA;AAAA;AACA,IAAAK,oBAAA,GAAAT,OAAA;AAAAC,MAAA,CAAAC,IAAA,CAAAO,oBAAA,EAAAN,OAAA,WAAA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AAAK,cAAA,CAAAD,OAAA,EAAAD,GAAA;IAAAG,UAAA;IAAAC,GAAA,WAAAA,CAAA;MAAA,OAAAI,iBAAA,CAAAR,GAAA;IAAA;EAAA;AAAA"}
|
|
1
|
+
{"version":3,"names":["_TaskControl","require","Object","keys","forEach","key","exports","defineProperty","enumerable","get","_TaskEventValidation","_TaskManager","_TaskRunner","_TaskManagerStore"],"sources":["index.ts"],"sourcesContent":["export * from \"./TaskControl\";\nexport * from \"./TaskEventValidation\";\nexport * from \"./TaskManager\";\nexport * from \"./TaskRunner\";\nexport * from \"./TaskManagerStore\";\n"],"mappings":";;;;;AAAA,IAAAA,YAAA,GAAAC,OAAA;AAAAC,MAAA,CAAAC,IAAA,CAAAH,YAAA,EAAAI,OAAA,WAAAC,GAAA;EAAA,IAAAA,GAAA,kBAAAA,GAAA;EAAA,IAAAA,GAAA,IAAAC,OAAA,IAAAA,OAAA,CAAAD,GAAA,MAAAL,YAAA,CAAAK,GAAA;EAAAH,MAAA,CAAAK,cAAA,CAAAD,OAAA,EAAAD,GAAA;IAAAG,UAAA;IAAAC,GAAA,WAAAA,CAAA;MAAA,OAAAT,YAAA,CAAAK,GAAA;IAAA;EAAA;AAAA;AACA,IAAAK,oBAAA,GAAAT,OAAA;AAAAC,MAAA,CAAAC,IAAA,CAAAO,oBAAA,EAAAN,OAAA,WAAAC,GAAA;EAAA,IAAAA,GAAA,kBAAAA,GAAA;EAAA,IAAAA,GAAA,IAAAC,OAAA,IAAAA,OAAA,CAAAD,GAAA,MAAAK,oBAAA,CAAAL,GAAA;EAAAH,MAAA,CAAAK,cAAA,CAAAD,OAAA,EAAAD,GAAA;IAAAG,UAAA;IAAAC,GAAA,WAAAA,CAAA;MAAA,OAAAC,oBAAA,CAAAL,GAAA;IAAA;EAAA;AAAA;AACA,IAAAM,YAAA,GAAAV,OAAA;AAAAC,MAAA,CAAAC,IAAA,CAAAQ,YAAA,EAAAP,OAAA,WAAAC,GAAA;EAAA,IAAAA,GAAA,kBAAAA,GAAA;EAAA,IAAAA,GAAA,IAAAC,OAAA,IAAAA,OAAA,CAAAD,GAAA,MAAAM,YAAA,CAAAN,GAAA;EAAAH,MAAA,CAAAK,cAAA,CAAAD,OAAA,EAAAD,GAAA;IAAAG,UAAA;IAAAC,GAAA,WAAAA,CAAA;MAAA,OAAAE,YAAA,CAAAN,GAAA;IAAA;EAAA;AAAA;AACA,IAAAO,WAAA,GAAAX,OAAA;AAAAC,MAAA,CAAAC,IAAA,CAAAS,WAAA,EAAAR,OAAA,WAAAC,GAAA;EAAA,IAAAA,GAAA,kBAAAA,GAAA;EAAA,IAAAA,GAAA,IAAAC,OAAA,IAAAA,OAAA,CAAAD,GAAA,MAAAO,WAAA,CAAAP,GAAA;EAAAH,MAAA,CAAAK,cAAA,CAAAD,OAAA,EAAAD,GAAA;IAAAG,UAAA;IAAAC,GAAA,WAAAA,CAAA;MAAA,OAAAG,WAAA,CAAAP,GAAA;IAAA;EAAA;AAAA;AACA,IAAAQ,iBAAA,GAAAZ,OAAA;AAAAC,MAAA,CAAAC,IAAA,CAAAU,iBAAA,EAAAT,OAAA,WAAAC,GAAA;EAAA,IAAAA,GAAA,kBAAAA,GAAA;EAAA,IAAAA,GAAA,IAAAC,OAAA,IAAAA,OAAA,CAAAD,GAAA,MAAAQ,iBAAA,CAAAR,GAAA;EAAAH,MAAA,CAAAK,cAAA,CAAAD,OAAA,EAAAD,GAAA;IAAAG,UAAA;IAAAC,GAAA,WAAAA,CAAA;MAAA,OAAAI,iBAAA,CAAAR,GAAA;IAAA;EAAA;AAAA","ignoreList":[]}
|
package/runner/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_TaskRunner","require","Object","keys","forEach","key","exports","defineProperty","enumerable","get"],"sources":["index.ts"],"sourcesContent":["export * from \"./TaskRunner\";\n"],"mappings":";;;;;AAAA,IAAAA,WAAA,GAAAC,OAAA;AAAAC,MAAA,CAAAC,IAAA,CAAAH,WAAA,EAAAI,OAAA,WAAAC,GAAA;EAAA,IAAAA,GAAA,kBAAAA,GAAA;EAAA,IAAAA,GAAA,IAAAC,OAAA,IAAAA,OAAA,CAAAD,GAAA,MAAAL,WAAA,CAAAK,GAAA;EAAAH,MAAA,CAAAK,cAAA,CAAAD,OAAA,EAAAD,GAAA;IAAAG,UAAA;IAAAC,GAAA,WAAAA,CAAA;MAAA,OAAAT,WAAA,CAAAK,GAAA;IAAA;EAAA;AAAA"}
|
|
1
|
+
{"version":3,"names":["_TaskRunner","require","Object","keys","forEach","key","exports","defineProperty","enumerable","get"],"sources":["index.ts"],"sourcesContent":["export * from \"./TaskRunner\";\n"],"mappings":";;;;;AAAA,IAAAA,WAAA,GAAAC,OAAA;AAAAC,MAAA,CAAAC,IAAA,CAAAH,WAAA,EAAAI,OAAA,WAAAC,GAAA;EAAA,IAAAA,GAAA,kBAAAA,GAAA;EAAA,IAAAA,GAAA,IAAAC,OAAA,IAAAA,OAAA,CAAAD,GAAA,MAAAL,WAAA,CAAAK,GAAA;EAAAH,MAAA,CAAAK,cAAA,CAAAD,OAAA,EAAAD,GAAA;IAAAG,UAAA;IAAAC,GAAA,WAAAA,CAAA;MAAA,OAAAT,WAAA,CAAAK,GAAA;IAAA;EAAA;AAAA","ignoreList":[]}
|
package/task/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_input","require","Object","keys","forEach","key","exports","defineProperty","enumerable","get","_plugin"],"sources":["index.ts"],"sourcesContent":["export * from \"./input\";\nexport * from \"./plugin\";\n"],"mappings":";;;;;AAAA,IAAAA,MAAA,GAAAC,OAAA;AAAAC,MAAA,CAAAC,IAAA,CAAAH,MAAA,EAAAI,OAAA,WAAAC,GAAA;EAAA,IAAAA,GAAA,kBAAAA,GAAA;EAAA,IAAAA,GAAA,IAAAC,OAAA,IAAAA,OAAA,CAAAD,GAAA,MAAAL,MAAA,CAAAK,GAAA;EAAAH,MAAA,CAAAK,cAAA,CAAAD,OAAA,EAAAD,GAAA;IAAAG,UAAA;IAAAC,GAAA,WAAAA,CAAA;MAAA,OAAAT,MAAA,CAAAK,GAAA;IAAA;EAAA;AAAA;AACA,IAAAK,OAAA,GAAAT,OAAA;AAAAC,MAAA,CAAAC,IAAA,CAAAO,OAAA,EAAAN,OAAA,WAAAC,GAAA;EAAA,IAAAA,GAAA,kBAAAA,GAAA;EAAA,IAAAA,GAAA,IAAAC,OAAA,IAAAA,OAAA,CAAAD,GAAA,MAAAK,OAAA,CAAAL,GAAA;EAAAH,MAAA,CAAAK,cAAA,CAAAD,OAAA,EAAAD,GAAA;IAAAG,UAAA;IAAAC,GAAA,WAAAA,CAAA;MAAA,OAAAC,OAAA,CAAAL,GAAA;IAAA;EAAA;AAAA"}
|
|
1
|
+
{"version":3,"names":["_input","require","Object","keys","forEach","key","exports","defineProperty","enumerable","get","_plugin"],"sources":["index.ts"],"sourcesContent":["export * from \"./input\";\nexport * from \"./plugin\";\n"],"mappings":";;;;;AAAA,IAAAA,MAAA,GAAAC,OAAA;AAAAC,MAAA,CAAAC,IAAA,CAAAH,MAAA,EAAAI,OAAA,WAAAC,GAAA;EAAA,IAAAA,GAAA,kBAAAA,GAAA;EAAA,IAAAA,GAAA,IAAAC,OAAA,IAAAA,OAAA,CAAAD,GAAA,MAAAL,MAAA,CAAAK,GAAA;EAAAH,MAAA,CAAAK,cAAA,CAAAD,OAAA,EAAAD,GAAA;IAAAG,UAAA;IAAAC,GAAA,WAAAA,CAAA;MAAA,OAAAT,MAAA,CAAAK,GAAA;IAAA;EAAA;AAAA;AACA,IAAAK,OAAA,GAAAT,OAAA;AAAAC,MAAA,CAAAC,IAAA,CAAAO,OAAA,EAAAN,OAAA,WAAAC,GAAA;EAAA,IAAAA,GAAA,kBAAAA,GAAA;EAAA,IAAAA,GAAA,IAAAC,OAAA,IAAAA,OAAA,CAAAD,GAAA,MAAAK,OAAA,CAAAL,GAAA;EAAAH,MAAA,CAAAK,cAAA,CAAAD,OAAA,EAAAD,GAAA;IAAAG,UAAA;IAAAC,GAAA,WAAAA,CAAA;MAAA,OAAAC,OAAA,CAAAL,GAAA;IAAA;EAAA;AAAA","ignoreList":[]}
|
package/task/input.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["TaskInput","constructor","params","id","input","createTaskInput","exports"],"sources":["input.ts"],"sourcesContent":["export interface ITaskInputParams<T> {\n id: string;\n input: T;\n}\nclass TaskInput<T> {\n public id: string;\n public input: T;\n\n constructor(params: ITaskInputParams<T>) {\n this.id = params.id;\n this.input = params.input;\n }\n}\n\nexport type { TaskInput };\n\ninterface ICreateTaskInputParams<T> {\n id: string;\n input: T;\n}\n\nexport const createTaskInput = <T>(params: ICreateTaskInputParams<T>) => {\n return new TaskInput({\n id: params.id,\n input: params.input\n });\n};\n"],"mappings":";;;;;;AAIA,MAAMA,SAAS,CAAI;EAIfC,WAAWA,CAACC,MAA2B,EAAE;IACrC,IAAI,CAACC,EAAE,GAAGD,MAAM,CAACC,EAAE;IACnB,IAAI,CAACC,KAAK,GAAGF,MAAM,CAACE,KAAK;EAC7B;AACJ;AASO,MAAMC,eAAe,GAAOH,MAAiC,IAAK;EACrE,OAAO,IAAIF,SAAS,CAAC;IACjBG,EAAE,EAAED,MAAM,CAACC,EAAE;IACbC,KAAK,EAAEF,MAAM,CAACE;EAClB,CAAC,CAAC;AACN,CAAC;AAACE,OAAA,CAAAD,eAAA,GAAAA,eAAA"}
|
|
1
|
+
{"version":3,"names":["TaskInput","constructor","params","id","input","createTaskInput","exports"],"sources":["input.ts"],"sourcesContent":["export interface ITaskInputParams<T> {\n id: string;\n input: T;\n}\nclass TaskInput<T> {\n public id: string;\n public input: T;\n\n constructor(params: ITaskInputParams<T>) {\n this.id = params.id;\n this.input = params.input;\n }\n}\n\nexport type { TaskInput };\n\ninterface ICreateTaskInputParams<T> {\n id: string;\n input: T;\n}\n\nexport const createTaskInput = <T>(params: ICreateTaskInputParams<T>) => {\n return new TaskInput({\n id: params.id,\n input: params.input\n });\n};\n"],"mappings":";;;;;;AAIA,MAAMA,SAAS,CAAI;EAIfC,WAAWA,CAACC,MAA2B,EAAE;IACrC,IAAI,CAACC,EAAE,GAAGD,MAAM,CAACC,EAAE;IACnB,IAAI,CAACC,KAAK,GAAGF,MAAM,CAACE,KAAK;EAC7B;AACJ;AASO,MAAMC,eAAe,GAAOH,MAAiC,IAAK;EACrE,OAAO,IAAIF,SAAS,CAAC;IACjBG,EAAE,EAAED,MAAM,CAACC,EAAE;IACbC,KAAK,EAAEF,MAAM,CAACE;EAClB,CAAC,CAAC;AACN,CAAC;AAACE,OAAA,CAAAD,eAAA,GAAAA,eAAA","ignoreList":[]}
|
package/task/plugin.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_camelCase","_interopRequireDefault","require","_error","_plugins","DEFAULT_MAX_ITERATIONS","TaskDefinitionPlugin","Plugin","type","id","task","title","fields","run","onDone","onAbort","onError","onMaxIterations","maxIterations","constructor","isPrivate","config","validate","getTask","setFields","cb","Array","from","addField","field","concat","camelCase","message","console","log","WebinyError","exports","createTaskDefinition","params","createPrivateTaskDefinition","createTaskDefinitionField"],"sources":["plugin.ts"],"sourcesContent":["import camelCase from \"lodash/camelCase\";\nimport WebinyError from \"@webiny/error\";\nimport { Plugin } from \"@webiny/plugins\";\nimport {\n Context,\n ITaskDefinition,\n ITaskDefinitionField,\n ITaskResponseDoneResultOutput\n} from \"~/types\";\n\n/**\n * By default, we will stop iterating through the task after DEFAULT_MAX_ITERATIONS.\n *\n * This mechanism will prevent infinite loops in case of a bug in the task code.\n */\nconst DEFAULT_MAX_ITERATIONS = 50;\n\nexport interface ITaskPluginSetFieldsCallback {\n (fields: ITaskDefinitionField[]): ITaskDefinitionField[] | undefined;\n}\n\nexport interface ITaskDefinitionParams<\n C extends Context = Context,\n I = any,\n O extends ITaskResponseDoneResultOutput = ITaskResponseDoneResultOutput\n> extends Omit<ITaskDefinition<C, I, O>, \"fields\" | \"maxIterations\"> {\n config?: (task: Pick<TaskDefinitionPlugin<C, I, O>, \"addField\" | \"setFields\">) => void;\n maxIterations?: number;\n}\n\nexport class TaskDefinitionPlugin<\n C extends Context = Context,\n I = any,\n O extends ITaskResponseDoneResultOutput = ITaskResponseDoneResultOutput\n >\n extends Plugin\n implements ITaskDefinition<C, I, O>\n{\n public static override readonly type: string = \"webiny.backgroundTask\";\n\n public readonly isPrivate: boolean;\n\n private readonly task: ITaskDefinition<C, I, O>;\n\n public get id() {\n return this.task.id;\n }\n\n public get title() {\n return this.task.title;\n }\n\n public get fields() {\n return this.task.fields;\n }\n\n public get run() {\n return this.task.run;\n }\n\n public get onDone() {\n return this.task.onDone;\n }\n\n public get onAbort() {\n return this.task.onAbort;\n }\n\n public get onError() {\n return this.task.onError;\n }\n\n public get onMaxIterations() {\n return this.task.onMaxIterations;\n }\n\n public get maxIterations(): number {\n return this.task.maxIterations || DEFAULT_MAX_ITERATIONS;\n }\n\n public constructor(task: ITaskDefinitionParams<C, I, O>) {\n super();\n this.isPrivate = task.isPrivate || false;\n this.task = {\n ...task,\n maxIterations: task.maxIterations || DEFAULT_MAX_ITERATIONS,\n fields: []\n };\n if (typeof task.config === \"function\") {\n task.config(this);\n }\n this.validate();\n }\n\n public getTask() {\n return this.task;\n }\n\n public setFields(cb: ITaskPluginSetFieldsCallback) {\n const fields = Array.from(this.task.fields || []);\n this.task.fields = cb(fields);\n }\n\n public addField(field: ITaskDefinitionField) {\n this.task.fields = (this.task.fields || []).concat([field]);\n }\n /**\n * TODO implement zod validation if validation becomes too complex\n */\n private validate(): void {\n if (camelCase(this.task.id) !== this.task.id) {\n /**\n * We want to log and throw the message so it can be seen in the CloudWatch logs.\n */\n const message = `Task ID \"${this.task.id}\" is invalid. It must be in camelCase format, for example: \"myCustomTask\".`;\n console.log(message);\n throw new WebinyError(message);\n }\n }\n}\n\nexport const createTaskDefinition = <\n C extends Context = Context,\n I = any,\n O extends ITaskResponseDoneResultOutput = ITaskResponseDoneResultOutput\n>(\n params: ITaskDefinitionParams<C, I, O>\n) => {\n return new TaskDefinitionPlugin<C, I, O>(params);\n};\n\nexport const createPrivateTaskDefinition = <\n C extends Context = Context,\n I = any,\n O extends ITaskResponseDoneResultOutput = ITaskResponseDoneResultOutput\n>(\n params: ITaskDefinitionParams<C, I, O>\n) => {\n return new TaskDefinitionPlugin<C, I, O>({\n ...params,\n isPrivate: true\n });\n};\n\nexport const createTaskDefinitionField = (params: ITaskDefinitionField) => {\n return params;\n};\n"],"mappings":";;;;;;;AAAA,IAAAA,UAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,MAAA,GAAAF,sBAAA,CAAAC,OAAA;AACA,IAAAE,QAAA,GAAAF,OAAA;AAQA;AACA;AACA;AACA;AACA;AACA,MAAMG,sBAAsB,GAAG,EAAE;AAe1B,MAAMC,oBAAoB,SAKrBC,eAAM,CAElB;EACI,OAAgCC,IAAI,GAAW,uBAAuB;EAMtE,IAAWC,EAAEA,CAAA,EAAG;IACZ,OAAO,IAAI,CAACC,IAAI,CAACD,EAAE;EACvB;EAEA,IAAWE,KAAKA,CAAA,EAAG;IACf,OAAO,IAAI,CAACD,IAAI,CAACC,KAAK;EAC1B;EAEA,IAAWC,MAAMA,CAAA,EAAG;IAChB,OAAO,IAAI,CAACF,IAAI,CAACE,MAAM;EAC3B;EAEA,IAAWC,GAAGA,CAAA,EAAG;IACb,OAAO,IAAI,CAACH,IAAI,CAACG,GAAG;EACxB;EAEA,IAAWC,MAAMA,CAAA,EAAG;IAChB,OAAO,IAAI,CAACJ,IAAI,CAACI,MAAM;EAC3B;EAEA,IAAWC,OAAOA,CAAA,EAAG;IACjB,OAAO,IAAI,CAACL,IAAI,CAACK,OAAO;EAC5B;EAEA,IAAWC,OAAOA,CAAA,EAAG;IACjB,OAAO,IAAI,CAACN,IAAI,CAACM,OAAO;EAC5B;EAEA,IAAWC,eAAeA,CAAA,EAAG;IACzB,OAAO,IAAI,CAACP,IAAI,CAACO,eAAe;EACpC;EAEA,I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AM,IAAIG,cAAW,CAACH,OAAO,CAAC;IAClC;EACJ;AACJ;AAACI,OAAA,CAAA9B,oBAAA,GAAAA,oBAAA;AAEM,MAAM+B,oBAAoB,GAK7BC,MAAsC,IACrC;EACD,OAAO,IAAIhC,oBAAoB,CAAUgC,MAAM,CAAC;AACpD,CAAC;AAACF,OAAA,CAAAC,oBAAA,GAAAA,oBAAA;AAEK,MAAME,2BAA2B,GAKpCD,MAAsC,IACrC;EACD,OAAO,IAAIhC,oBAAoB,CAAU;IACrC,GAAGgC,MAAM;IACTlB,SAAS,EAAE;EACf,CAAC,CAAC;AACN,CAAC;AAACgB,OAAA,CAAAG,2BAAA,GAAAA,2BAAA;AAEK,MAAMC,yBAAyB,GAAIF,MAA4B,IAAK;EACvE,OAAOA,MAAM;AACjB,CAAC;AAACF,OAAA,CAAAI,yBAAA,GAAAA,yBAAA"}
|
|
1
|
+
{"version":3,"names":["_camelCase","_interopRequireDefault","require","_error","_plugins","DEFAULT_MAX_ITERATIONS","TaskDefinitionPlugin","Plugin","type","id","task","title","fields","run","onDone","onAbort","onError","onMaxIterations","maxIterations","constructor","isPrivate","config","validate","getTask","setFields","cb","Array","from","addField","field","concat","camelCase","message","console","log","WebinyError","exports","createTaskDefinition","params","createPrivateTaskDefinition","createTaskDefinitionField"],"sources":["plugin.ts"],"sourcesContent":["import camelCase from \"lodash/camelCase\";\nimport WebinyError from \"@webiny/error\";\nimport { Plugin } from \"@webiny/plugins\";\nimport {\n Context,\n ITaskDefinition,\n ITaskDefinitionField,\n ITaskResponseDoneResultOutput\n} from \"~/types\";\n\n/**\n * By default, we will stop iterating through the task after DEFAULT_MAX_ITERATIONS.\n *\n * This mechanism will prevent infinite loops in case of a bug in the task code.\n */\nconst DEFAULT_MAX_ITERATIONS = 50;\n\nexport interface ITaskPluginSetFieldsCallback {\n (fields: ITaskDefinitionField[]): ITaskDefinitionField[] | undefined;\n}\n\nexport interface ITaskDefinitionParams<\n C extends Context = Context,\n I = any,\n O extends ITaskResponseDoneResultOutput = ITaskResponseDoneResultOutput\n> extends Omit<ITaskDefinition<C, I, O>, \"fields\" | \"maxIterations\"> {\n config?: (task: Pick<TaskDefinitionPlugin<C, I, O>, \"addField\" | \"setFields\">) => void;\n maxIterations?: number;\n}\n\nexport class TaskDefinitionPlugin<\n C extends Context = Context,\n I = any,\n O extends ITaskResponseDoneResultOutput = ITaskResponseDoneResultOutput\n >\n extends Plugin\n implements ITaskDefinition<C, I, O>\n{\n public static override readonly type: string = \"webiny.backgroundTask\";\n\n public readonly isPrivate: boolean;\n\n private readonly task: ITaskDefinition<C, I, O>;\n\n public get id() {\n return this.task.id;\n }\n\n public get title() {\n return this.task.title;\n }\n\n public get fields() {\n return this.task.fields;\n }\n\n public get run() {\n return this.task.run;\n }\n\n public get onDone() {\n return this.task.onDone;\n }\n\n public get onAbort() {\n return this.task.onAbort;\n }\n\n public get onError() {\n return this.task.onError;\n }\n\n public get onMaxIterations() {\n return this.task.onMaxIterations;\n }\n\n public get maxIterations(): number {\n return this.task.maxIterations || DEFAULT_MAX_ITERATIONS;\n }\n\n public constructor(task: ITaskDefinitionParams<C, I, O>) {\n super();\n this.isPrivate = task.isPrivate || false;\n this.task = {\n ...task,\n maxIterations: task.maxIterations || DEFAULT_MAX_ITERATIONS,\n fields: []\n };\n if (typeof task.config === \"function\") {\n task.config(this);\n }\n this.validate();\n }\n\n public getTask() {\n return this.task;\n }\n\n public setFields(cb: ITaskPluginSetFieldsCallback) {\n const fields = Array.from(this.task.fields || []);\n this.task.fields = cb(fields);\n }\n\n public addField(field: ITaskDefinitionField) {\n this.task.fields = (this.task.fields || []).concat([field]);\n }\n /**\n * TODO implement zod validation if validation becomes too complex\n */\n private validate(): void {\n if (camelCase(this.task.id) !== this.task.id) {\n /**\n * We want to log and throw the message so it can be seen in the CloudWatch logs.\n */\n const message = `Task ID \"${this.task.id}\" is invalid. It must be in camelCase format, for example: \"myCustomTask\".`;\n console.log(message);\n throw new WebinyError(message);\n }\n }\n}\n\nexport const createTaskDefinition = <\n C extends Context = Context,\n I = any,\n O extends ITaskResponseDoneResultOutput = ITaskResponseDoneResultOutput\n>(\n params: ITaskDefinitionParams<C, I, O>\n) => {\n return new TaskDefinitionPlugin<C, I, O>(params);\n};\n\nexport const createPrivateTaskDefinition = <\n C extends Context = Context,\n I = any,\n O extends ITaskResponseDoneResultOutput = ITaskResponseDoneResultOutput\n>(\n params: ITaskDefinitionParams<C, I, O>\n) => {\n return new TaskDefinitionPlugin<C, I, O>({\n ...params,\n isPrivate: true\n });\n};\n\nexport const createTaskDefinitionField = (params: ITaskDefinitionField) => {\n return params;\n};\n"],"mappings":";;;;;;;AAAA,IAAAA,UAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,MAAA,GAAAF,sBAAA,CAAAC,OAAA;AACA,IAAAE,QAAA,GAAAF,OAAA;AAQA;AACA;AACA;AACA;AACA;AACA,MAAMG,sBAAsB,GAAG,EAAE;AAe1B,MAAMC,oBAAoB,SAKrBC,eAAM,CAElB;EACI,OAAgCC,IAAI,GAAW,uBAAuB;EAMtE,IAAWC,EAAEA,CAAA,EAAG;IACZ,OAAO,IAAI,CAACC,IAAI,CAACD,EAAE;EACvB;EAEA,IAAWE,KAAKA,CAAA,EAAG;IACf,OAAO,IAAI,CAACD,IAAI,CAACC,KAAK;EAC1B;EAEA,IAAWC,MAAMA,CAAA,EAAG;IAChB,OAAO,IAAI,CAACF,IAAI,CAACE,MAAM;EAC3B;EAEA,IAAWC,GAAGA,CAAA,EAAG;IACb,OAAO,IAAI,CAACH,IAAI,CAACG,GAAG;EACxB;EAEA,IAAWC,MAAMA,CAAA,EAAG;IAChB,OAAO,IAAI,CAACJ,IAAI,CAACI,MAAM;EAC3B;EAEA,IAAWC,OAAOA,CAAA,EAAG;IACjB,OAAO,IAAI,CAACL,IAAI,CAACK,OAAO;EAC5B;EAEA,IAAWC,OAAOA,CAAA,EAAG;IACjB,OAAO,IAAI,CAACN,IAAI,CAACM,OAAO;EAC5B;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,CAACtB,IAAI,CAACD,EAAG,4EAA2E;MACpHwB,OAAO,CAACC,GAAG,CAACF,OAAO,CAAC;MACpB,MAAM,IAAIG,cAAW,CAACH,OAAO,CAAC;IAClC;EACJ;AACJ;AAACI,OAAA,CAAA9B,oBAAA,GAAAA,oBAAA;AAEM,MAAM+B,oBAAoB,GAK7BC,MAAsC,IACrC;EACD,OAAO,IAAIhC,oBAAoB,CAAUgC,MAAM,CAAC;AACpD,CAAC;AAACF,OAAA,CAAAC,oBAAA,GAAAA,oBAAA;AAEK,MAAME,2BAA2B,GAKpCD,MAAsC,IACrC;EACD,OAAO,IAAIhC,oBAAoB,CAAU;IACrC,GAAGgC,MAAM;IACTlB,SAAS,EAAE;EACf,CAAC,CAAC;AACN,CAAC;AAACgB,OAAA,CAAAG,2BAAA,GAAAA,2BAAA;AAEK,MAAMC,yBAAyB,GAAIF,MAA4B,IAAK;EACvE,OAAOA,MAAM;AACjB,CAAC;AAACF,OAAA,CAAAI,yBAAA,GAAAA,yBAAA","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_task","require","createTestingRunTask","createTaskDefinition","id","title","run","response","done","exports"],"sources":["testingRunTask.ts"],"sourcesContent":["import { createTaskDefinition } from \"~/task\";\n\nexport const createTestingRunTask = () => {\n return createTaskDefinition({\n id: \"testingRun\",\n title: \"A mock task to test run the step function permissions.\",\n run: async ({ response }) => {\n return response.done(\"Task successfully finished.\");\n }\n });\n};\n"],"mappings":";;;;;;AAAA,IAAAA,KAAA,GAAAC,OAAA;AAEO,MAAMC,oBAAoB,GAAGA,CAAA,KAAM;EACtC,OAAO,IAAAC,0BAAoB,EAAC;IACxBC,EAAE,EAAE,YAAY;IAChBC,KAAK,EAAE,wDAAwD;IAC/DC,GAAG,EAAE,MAAAA,CAAO;MAAEC;IAAS,CAAC,KAAK;MACzB,OAAOA,QAAQ,CAACC,IAAI,CAAC,6BAA6B,CAAC;IACvD;EACJ,CAAC,CAAC;AACN,CAAC;AAACC,OAAA,CAAAP,oBAAA,GAAAA,oBAAA"}
|
|
1
|
+
{"version":3,"names":["_task","require","createTestingRunTask","createTaskDefinition","id","title","run","response","done","exports"],"sources":["testingRunTask.ts"],"sourcesContent":["import { createTaskDefinition } from \"~/task\";\n\nexport const createTestingRunTask = () => {\n return createTaskDefinition({\n id: \"testingRun\",\n title: \"A mock task to test run the step function permissions.\",\n run: async ({ response }) => {\n return response.done(\"Task successfully finished.\");\n }\n });\n};\n"],"mappings":";;;;;;AAAA,IAAAA,KAAA,GAAAC,OAAA;AAEO,MAAMC,oBAAoB,GAAGA,CAAA,KAAM;EACtC,OAAO,IAAAC,0BAAoB,EAAC;IACxBC,EAAE,EAAE,YAAY;IAChBC,KAAK,EAAE,wDAAwD;IAC/DC,GAAG,EAAE,MAAAA,CAAO;MAAEC;IAAS,CAAC,KAAK;MACzB,OAAOA,QAAQ,CAACC,IAAI,CAAC,6BAA6B,CAAC;IACvD;EACJ,CAAC,CAAC;AACN,CAAC;AAACC,OAAA,CAAAP,oBAAA,GAAAA,oBAAA","ignoreList":[]}
|
package/timer/CustomTimer.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["MAX_RUNNING_MINUTES","MAX_RUNNING_MILLISECONDS","CustomTimer","constructor","startTime","Date","now","getRemainingMilliseconds","result","console","log","exports"],"sources":["CustomTimer.ts"],"sourcesContent":["import { ITimer } from \"~/timer/abstractions/ITimer\";\n\nconst MAX_RUNNING_MINUTES = 14;\nconst MAX_RUNNING_MILLISECONDS = MAX_RUNNING_MINUTES * 60 * 1000;\n\nexport class CustomTimer implements ITimer {\n private readonly startTime: number;\n\n public constructor() {\n this.startTime = Date.now();\n }\n\n public getRemainingMilliseconds(): number {\n const result = this.startTime + MAX_RUNNING_MILLISECONDS - Date.now(); // 14 minutes\n console.log(\n \"It looks like the Lambda Context getRemainingTimeInMillis does not exist. Mocked remaining time:\",\n result\n );\n return result;\n }\n}\n"],"mappings":";;;;;;AAEA,MAAMA,mBAAmB,GAAG,EAAE;AAC9B,MAAMC,wBAAwB,GAAGD,mBAAmB,GAAG,EAAE,GAAG,IAAI;AAEzD,MAAME,WAAW,CAAmB;EAGhCC,WAAWA,CAAA,EAAG;IACjB,IAAI,CAACC,SAAS,GAAGC,IAAI,CAACC,GAAG,CAAC,CAAC;EAC/B;EAEOC,wBAAwBA,CAAA,EAAW;IACtC,MAAMC,MAAM,GAAG,IAAI,CAACJ,SAAS,GAAGH,wBAAwB,GAAGI,IAAI,CAACC,GAAG,CAAC,CAAC,CAAC,CAAC;IACvEG,OAAO,CAACC,GAAG,CACP,kGAAkG,EAClGF,MACJ,CAAC;IACD,OAAOA,MAAM;EACjB;AACJ;AAACG,OAAA,CAAAT,WAAA,GAAAA,WAAA"}
|
|
1
|
+
{"version":3,"names":["MAX_RUNNING_MINUTES","MAX_RUNNING_MILLISECONDS","CustomTimer","constructor","startTime","Date","now","getRemainingMilliseconds","result","console","log","exports"],"sources":["CustomTimer.ts"],"sourcesContent":["import { ITimer } from \"~/timer/abstractions/ITimer\";\n\nconst MAX_RUNNING_MINUTES = 14;\nconst MAX_RUNNING_MILLISECONDS = MAX_RUNNING_MINUTES * 60 * 1000;\n\nexport class CustomTimer implements ITimer {\n private readonly startTime: number;\n\n public constructor() {\n this.startTime = Date.now();\n }\n\n public getRemainingMilliseconds(): number {\n const result = this.startTime + MAX_RUNNING_MILLISECONDS - Date.now(); // 14 minutes\n console.log(\n \"It looks like the Lambda Context getRemainingTimeInMillis does not exist. Mocked remaining time:\",\n result\n );\n return result;\n }\n}\n"],"mappings":";;;;;;AAEA,MAAMA,mBAAmB,GAAG,EAAE;AAC9B,MAAMC,wBAAwB,GAAGD,mBAAmB,GAAG,EAAE,GAAG,IAAI;AAEzD,MAAME,WAAW,CAAmB;EAGhCC,WAAWA,CAAA,EAAG;IACjB,IAAI,CAACC,SAAS,GAAGC,IAAI,CAACC,GAAG,CAAC,CAAC;EAC/B;EAEOC,wBAAwBA,CAAA,EAAW;IACtC,MAAMC,MAAM,GAAG,IAAI,CAACJ,SAAS,GAAGH,wBAAwB,GAAGI,IAAI,CAACC,GAAG,CAAC,CAAC,CAAC,CAAC;IACvEG,OAAO,CAACC,GAAG,CACP,kGAAkG,EAClGF,MACJ,CAAC;IACD,OAAOA,MAAM;EACjB;AACJ;AAACG,OAAA,CAAAT,WAAA,GAAAA,WAAA","ignoreList":[]}
|
package/timer/Timer.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["Timer","constructor","cb","getRemainingMilliseconds","exports"],"sources":["Timer.ts"],"sourcesContent":["import { ITimer } from \"./abstractions/ITimer\";\n\nexport interface ITimerCb {\n (): number;\n}\n\nexport class Timer implements ITimer {\n private readonly cb: ITimerCb;\n\n public constructor(cb: ITimerCb) {\n this.cb = cb;\n }\n public getRemainingMilliseconds(): number {\n return this.cb();\n }\n}\n"],"mappings":";;;;;;AAMO,MAAMA,KAAK,CAAmB;EAG1BC,WAAWA,CAACC,EAAY,EAAE;IAC7B,IAAI,CAACA,EAAE,GAAGA,EAAE;EAChB;EACOC,wBAAwBA,CAAA,EAAW;IACtC,OAAO,IAAI,CAACD,EAAE,CAAC,CAAC;EACpB;AACJ;AAACE,OAAA,CAAAJ,KAAA,GAAAA,KAAA"}
|
|
1
|
+
{"version":3,"names":["Timer","constructor","cb","getRemainingMilliseconds","exports"],"sources":["Timer.ts"],"sourcesContent":["import { ITimer } from \"./abstractions/ITimer\";\n\nexport interface ITimerCb {\n (): number;\n}\n\nexport class Timer implements ITimer {\n private readonly cb: ITimerCb;\n\n public constructor(cb: ITimerCb) {\n this.cb = cb;\n }\n public getRemainingMilliseconds(): number {\n return this.cb();\n }\n}\n"],"mappings":";;;;;;AAMO,MAAMA,KAAK,CAAmB;EAG1BC,WAAWA,CAACC,EAAY,EAAE;IAC7B,IAAI,CAACA,EAAE,GAAGA,EAAE;EAChB;EACOC,wBAAwBA,CAAA,EAAW;IACtC,OAAO,IAAI,CAACD,EAAE,CAAC,CAAC;EACpB;AACJ;AAACE,OAAA,CAAAJ,KAAA,GAAAA,KAAA","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":[],"sources":["ITimer.ts"],"sourcesContent":["export interface ITimer {\n /**\n * Return value must be in milliseconds.\n */\n getRemainingMilliseconds(): number;\n}\n"],"mappings":""}
|
|
1
|
+
{"version":3,"names":[],"sources":["ITimer.ts"],"sourcesContent":["export interface ITimer {\n /**\n * Return value must be in milliseconds.\n */\n getRemainingMilliseconds(): number;\n}\n"],"mappings":"","ignoreList":[]}
|
package/timer/factory.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_CustomTimer","require","_Timer","timerFactory","params","customTimer","CustomTimer","Timer","getRemainingTimeInMillis","getRemainingMilliseconds","exports"],"sources":["factory.ts"],"sourcesContent":["import { ITimer } from \"~/timer/abstractions/ITimer\";\nimport { CustomTimer } from \"./CustomTimer\";\nimport { Context as LambdaContext } from \"aws-lambda/handler\";\nimport { Timer } from \"./Timer\";\n\nexport type ITimerFactoryParams = Pick<LambdaContext, \"getRemainingTimeInMillis\">;\n\nexport const timerFactory = (params?: Partial<ITimerFactoryParams>): ITimer => {\n const customTimer = new CustomTimer();\n\n return new Timer(() => {\n if (params?.getRemainingTimeInMillis) {\n return params.getRemainingTimeInMillis();\n }\n return customTimer.getRemainingMilliseconds();\n });\n};\n"],"mappings":";;;;;;AACA,IAAAA,YAAA,GAAAC,OAAA;AAEA,IAAAC,MAAA,GAAAD,OAAA;AAIO,MAAME,YAAY,GAAIC,MAAqC,IAAa;EAC3E,MAAMC,WAAW,GAAG,IAAIC,wBAAW,CAAC,CAAC;EAErC,OAAO,IAAIC,YAAK,CAAC,MAAM;IACnB,IAAIH,MAAM,EAAEI,wBAAwB,EAAE;MAClC,OAAOJ,MAAM,CAACI,wBAAwB,CAAC,CAAC;IAC5C;IACA,OAAOH,WAAW,CAACI,wBAAwB,CAAC,CAAC;EACjD,CAAC,CAAC;AACN,CAAC;AAACC,OAAA,CAAAP,YAAA,GAAAA,YAAA"}
|
|
1
|
+
{"version":3,"names":["_CustomTimer","require","_Timer","timerFactory","params","customTimer","CustomTimer","Timer","getRemainingTimeInMillis","getRemainingMilliseconds","exports"],"sources":["factory.ts"],"sourcesContent":["import { ITimer } from \"~/timer/abstractions/ITimer\";\nimport { CustomTimer } from \"./CustomTimer\";\nimport { Context as LambdaContext } from \"aws-lambda/handler\";\nimport { Timer } from \"./Timer\";\n\nexport type ITimerFactoryParams = Pick<LambdaContext, \"getRemainingTimeInMillis\">;\n\nexport const timerFactory = (params?: Partial<ITimerFactoryParams>): ITimer => {\n const customTimer = new CustomTimer();\n\n return new Timer(() => {\n if (params?.getRemainingTimeInMillis) {\n return params.getRemainingTimeInMillis();\n }\n return customTimer.getRemainingMilliseconds();\n });\n};\n"],"mappings":";;;;;;AACA,IAAAA,YAAA,GAAAC,OAAA;AAEA,IAAAC,MAAA,GAAAD,OAAA;AAIO,MAAME,YAAY,GAAIC,MAAqC,IAAa;EAC3E,MAAMC,WAAW,GAAG,IAAIC,wBAAW,CAAC,CAAC;EAErC,OAAO,IAAIC,YAAK,CAAC,MAAM;IACnB,IAAIH,MAAM,EAAEI,wBAAwB,EAAE;MAClC,OAAOJ,MAAM,CAACI,wBAAwB,CAAC,CAAC;IAC5C;IACA,OAAOH,WAAW,CAACI,wBAAwB,CAAC,CAAC;EACjD,CAAC,CAAC;AACN,CAAC;AAACC,OAAA,CAAAP,YAAA,GAAAA,YAAA","ignoreList":[]}
|
package/timer/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_ITimer","require","Object","keys","forEach","key","exports","defineProperty","enumerable","get","_CustomTimer","_factory","_Timer"],"sources":["index.ts"],"sourcesContent":["export * from \"./abstractions/ITimer\";\nexport * from \"./CustomTimer\";\nexport * from \"./factory\";\nexport * from \"./Timer\";\n"],"mappings":";;;;;AAAA,IAAAA,OAAA,GA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AAA,CAAAD,GAAA,MAAAO,MAAA,CAAAP,GAAA;EAAAH,MAAA,CAAAK,cAAA,CAAAD,OAAA,EAAAD,GAAA;IAAAG,UAAA;IAAAC,GAAA,WAAAA,CAAA;MAAA,OAAAG,MAAA,CAAAP,GAAA;IAAA;EAAA;AAAA"}
|
|
1
|
+
{"version":3,"names":["_ITimer","require","Object","keys","forEach","key","exports","defineProperty","enumerable","get","_CustomTimer","_factory","_Timer"],"sources":["index.ts"],"sourcesContent":["export * from \"./abstractions/ITimer\";\nexport * from \"./CustomTimer\";\nexport * from \"./factory\";\nexport * from \"./Timer\";\n"],"mappings":";;;;;AAAA,IAAAA,OAAA,GAAAC,OAAA;AAAAC,MAAA,CAAAC,IAAA,CAAAH,OAAA,EAAAI,OAAA,WAAAC,GAAA;EAAA,IAAAA,GAAA,kBAAAA,GAAA;EAAA,IAAAA,GAAA,IAAAC,OAAA,IAAAA,OAAA,CAAAD,GAAA,MAAAL,OAAA,CAAAK,GAAA;EAAAH,MAAA,CAAAK,cAAA,CAAAD,OAAA,EAAAD,GAAA;IAAAG,UAAA;IAAAC,GAAA,WAAAA,CAAA;MAAA,OAAAT,OAAA,CAAAK,GAAA;IAAA;EAAA;AAAA;AACA,IAAAK,YAAA,GAAAT,OAAA;AAAAC,MAAA,CAAAC,IAAA,CAAAO,YAAA,EAAAN,OAAA,WAAAC,GAAA;EAAA,IAAAA,GAAA,kBAAAA,GAAA;EAAA,IAAAA,GAAA,IAAAC,OAAA,IAAAA,OAAA,CAAAD,GAAA,MAAAK,YAAA,CAAAL,GAAA;EAAAH,MAAA,CAAAK,cAAA,CAAAD,OAAA,EAAAD,GAAA;IAAAG,UAAA;IAAAC,GAAA,WAAAA,CAAA;MAAA,OAAAC,YAAA,CAAAL,GAAA;IAAA;EAAA;AAAA;AACA,IAAAM,QAAA,GAAAV,OAAA;AAAAC,MAAA,CAAAC,IAAA,CAAAQ,QAAA,EAAAP,OAAA,WAAAC,GAAA;EAAA,IAAAA,GAAA,kBAAAA,GAAA;EAAA,IAAAA,GAAA,IAAAC,OAAA,IAAAA,OAAA,CAAAD,GAAA,MAAAM,QAAA,CAAAN,GAAA;EAAAH,MAAA,CAAAK,cAAA,CAAAD,OAAA,EAAAD,GAAA;IAAAG,UAAA;IAAAC,GAAA,WAAAA,CAAA;MAAA,OAAAE,QAAA,CAAAN,GAAA;IAAA;EAAA;AAAA;AACA,IAAAO,MAAA,GAAAX,OAAA;AAAAC,MAAA,CAAAC,IAAA,CAAAS,MAAA,EAAAR,OAAA,WAAAC,GAAA;EAAA,IAAAA,GAAA,kBAAAA,GAAA;EAAA,IAAAA,GAAA,IAAAC,OAAA,IAAAA,OAAA,CAAAD,GAAA,MAAAO,MAAA,CAAAP,GAAA;EAAAH,MAAA,CAAAK,cAAA,CAAAD,OAAA,EAAAD,GAAA;IAAAG,UAAA;IAAAC,GAAA,WAAAA,CAAA;MAAA,OAAAG,MAAA,CAAAP,GAAA;IAAA;EAAA;AAAA","ignoreList":[]}
|
package/types.js
CHANGED
|
@@ -54,13 +54,12 @@ Object.keys(_abstractions2).forEach(function (key) {
|
|
|
54
54
|
}
|
|
55
55
|
});
|
|
56
56
|
});
|
|
57
|
-
let ITaskLogItemType = /*#__PURE__*/function (ITaskLogItemType) {
|
|
57
|
+
let ITaskLogItemType = exports.ITaskLogItemType = /*#__PURE__*/function (ITaskLogItemType) {
|
|
58
58
|
ITaskLogItemType["INFO"] = "info";
|
|
59
59
|
ITaskLogItemType["ERROR"] = "error";
|
|
60
60
|
return ITaskLogItemType;
|
|
61
61
|
}({});
|
|
62
|
-
exports.
|
|
63
|
-
let TaskDataStatus = /*#__PURE__*/function (TaskDataStatus) {
|
|
62
|
+
let TaskDataStatus = exports.TaskDataStatus = /*#__PURE__*/function (TaskDataStatus) {
|
|
64
63
|
TaskDataStatus["PENDING"] = "pending";
|
|
65
64
|
TaskDataStatus["RUNNING"] = "running";
|
|
66
65
|
TaskDataStatus["FAILED"] = "failed";
|
|
@@ -68,14 +67,12 @@ let TaskDataStatus = /*#__PURE__*/function (TaskDataStatus) {
|
|
|
68
67
|
TaskDataStatus["ABORTED"] = "aborted";
|
|
69
68
|
return TaskDataStatus;
|
|
70
69
|
}({});
|
|
71
|
-
exports.
|
|
72
|
-
let TaskResponseStatus = /*#__PURE__*/function (TaskResponseStatus) {
|
|
70
|
+
let TaskResponseStatus = exports.TaskResponseStatus = /*#__PURE__*/function (TaskResponseStatus) {
|
|
73
71
|
TaskResponseStatus["DONE"] = "done";
|
|
74
72
|
TaskResponseStatus["ERROR"] = "error";
|
|
75
73
|
TaskResponseStatus["CONTINUE"] = "continue";
|
|
76
74
|
TaskResponseStatus["ABORTED"] = "aborted";
|
|
77
75
|
return TaskResponseStatus;
|
|
78
76
|
}({});
|
|
79
|
-
exports.TaskResponseStatus = TaskResponseStatus;
|
|
80
77
|
|
|
81
78
|
//# sourceMappingURL=types.js.map
|
package/types.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_clientEventbridge","require","_types","Object","keys","forEach","key","prototype","hasOwnProperty","call","_exportNames","exports","defineProperty","enumerable","get","_abstractions","_abstractions2","ITaskLogItemType","TaskDataStatus","TaskResponseStatus"],"sources":["types.ts"],"sourcesContent":["import {\n CmsContext as BaseContext,\n CmsEntryListParams,\n CmsEntryListWhere,\n CmsEntryMeta,\n CmsModel,\n CmsModelField\n} from \"@webiny/api-headless-cms/types\";\nimport { Topic } from \"@webiny/pubsub/types\";\nimport {\n IResponseError,\n ITaskResponse,\n ITaskResponseDoneResultOutput,\n ITaskResponseResult\n} from \"~/response/abstractions\";\nimport { ITaskManagerStore } from \"./runner/abstractions\";\nimport { PutEventsCommandOutput } from \"@webiny/aws-sdk/client-eventbridge\";\nimport { SecurityPermission } from \"@webiny/api-security/types\";\n\nexport { PutEventsCommandOutput };\n\nexport * from \"./handler/types\";\nexport * from \"./response/abstractions\";\nexport * from \"./runner/abstractions\";\n\nexport interface ITaskConfig {\n readonly eventBusName: string;\n}\n\nexport interface ITaskDataInput {\n [key: string]: any;\n}\n\nexport enum ITaskLogItemType {\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: ITaskLogItemType;\n data?: ITaskLogItemData;\n}\n\nexport interface ITaskLogItemInfo extends ITaskLogItemBase {\n type: ITaskLogItemType.INFO;\n}\n\nexport interface ITaskLogItemError extends ITaskLogItemBase {\n type: ITaskLogItemType.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 = any,\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: PutEventsCommandOutput | 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 IListTaskParams extends Omit<CmsEntryListParams, \"fields\" | \"search\"> {\n where?: 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 IListTaskLogParams extends Omit<CmsEntryListParams, \"fields\" | \"search\"> {\n where?: 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}\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?: PutEventsCommandOutput;\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 ITasksContextConfigObject {\n config: ITaskConfig;\n}\n\nexport interface ITasksContextDefinitionObject {\n getDefinition: <T = ITaskDataInput>(id: string) => ITaskDefinition<Context, T> | null;\n listDefinitions: () => ITaskDefinition[];\n}\n\nexport interface ITaskTriggerParams<I = ITaskDataInput> {\n parent?: ITask;\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 ITasksContextTriggerObject {\n trigger: <T = ITaskDataInput>(params: ITaskTriggerParams<T>) => Promise<ITask<T>>;\n abort: <T = ITaskDataInput>(params: ITaskAbortParams) => Promise<ITask<T>>;\n}\n\nexport interface ITasksContextObject\n extends ITasksContextCrudObject,\n ITasksContextDefinitionObject,\n ITasksContextTriggerObject,\n ITasksContextConfigObject {}\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(seconds?: number): boolean;\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}\n\nexport interface ITaskOnSuccessParams<C extends Context, I = ITaskDataInput> {\n context: C;\n task: ITask<I>;\n}\n\nexport interface ITaskOnErrorParams<C extends Context, I = ITaskDataInput> {\n context: C;\n task: ITask<I>;\n}\n\nexport interface ITaskOnAbortParams<C extends Context> {\n context: C;\n task: ITask;\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 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 * 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>): 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>): 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 * 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":";;;;;;;;;;;;;;;;;;;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A;EAAAH,MAAA,CAAAS,cAAA,CAAAD,OAAA,EAAAL,GAAA;IAAAO,UAAA;IAAAC,GAAA,WAAAA,CAAA;MAAA,OAAAE,cAAA,CAAAV,GAAA;IAAA;EAAA;AAAA;AAAsC,IAU1BW,gBAAgB,0BAAhBA,gBAAgB;EAAhBA,gBAAgB;EAAhBA,gBAAgB;EAAA,OAAhBA,gBAAgB;AAAA;AAAAN,OAAA,CAAAM,gBAAA,GAAAA,gBAAA;AAAA,IAwChBC,cAAc,0BAAdA,cAAc;EAAdA,cAAc;EAAdA,cAAc;EAAdA,cAAc;EAAdA,cAAc;EAAdA,cAAc;EAAA,OAAdA,cAAc;AAAA;AAAAP,OAAA,CAAAO,cAAA,GAAAA,cAAA;AAAA,IA+QdC,kBAAkB,0BAAlBA,kBAAkB;EAAlBA,kBAAkB;EAAlBA,kBAAkB;EAAlBA,kBAAkB;EAAlBA,kBAAkB;EAAA,OAAlBA,kBAAkB;AAAA;AAAAR,OAAA,CAAAQ,kBAAA,GAAAA,kBAAA"}
|
|
1
|
+
{"version":3,"names":["_clientEventbridge","require","_types","Object","keys","forEach","key","prototype","hasOwnProperty","call","_exportNames","exports","defineProperty","enumerable","get","_abstractions","_abstractions2","ITaskLogItemType","TaskDataStatus","TaskResponseStatus"],"sources":["types.ts"],"sourcesContent":["import {\n CmsContext as BaseContext,\n CmsEntryListParams,\n CmsEntryListWhere,\n CmsEntryMeta,\n CmsModel,\n CmsModelField\n} from \"@webiny/api-headless-cms/types\";\nimport { Topic } from \"@webiny/pubsub/types\";\nimport {\n IResponseError,\n ITaskResponse,\n ITaskResponseDoneResultOutput,\n ITaskResponseResult\n} from \"~/response/abstractions\";\nimport { ITaskManagerStore } from \"./runner/abstractions\";\nimport { PutEventsCommandOutput } from \"@webiny/aws-sdk/client-eventbridge\";\nimport { SecurityPermission } from \"@webiny/api-security/types\";\n\nexport { PutEventsCommandOutput };\n\nexport * from \"./handler/types\";\nexport * from \"./response/abstractions\";\nexport * from \"./runner/abstractions\";\n\nexport interface ITaskConfig {\n readonly eventBusName: string;\n}\n\nexport interface ITaskDataInput {\n [key: string]: any;\n}\n\nexport enum ITaskLogItemType {\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: ITaskLogItemType;\n data?: ITaskLogItemData;\n}\n\nexport interface ITaskLogItemInfo extends ITaskLogItemBase {\n type: ITaskLogItemType.INFO;\n}\n\nexport interface ITaskLogItemError extends ITaskLogItemBase {\n type: ITaskLogItemType.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 = any,\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: PutEventsCommandOutput | 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 IListTaskParams extends Omit<CmsEntryListParams, \"fields\" | \"search\"> {\n where?: 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 IListTaskLogParams extends Omit<CmsEntryListParams, \"fields\" | \"search\"> {\n where?: 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}\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?: PutEventsCommandOutput;\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 ITasksContextConfigObject {\n config: ITaskConfig;\n}\n\nexport interface ITasksContextDefinitionObject {\n getDefinition: <T = ITaskDataInput>(id: string) => ITaskDefinition<Context, T> | null;\n listDefinitions: () => ITaskDefinition[];\n}\n\nexport interface ITaskTriggerParams<I = ITaskDataInput> {\n parent?: ITask;\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 ITasksContextTriggerObject {\n trigger: <T = ITaskDataInput>(params: ITaskTriggerParams<T>) => Promise<ITask<T>>;\n abort: <T = ITaskDataInput>(params: ITaskAbortParams) => Promise<ITask<T>>;\n}\n\nexport interface ITasksContextObject\n extends ITasksContextCrudObject,\n ITasksContextDefinitionObject,\n ITasksContextTriggerObject,\n ITasksContextConfigObject {}\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(seconds?: number): boolean;\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}\n\nexport interface ITaskOnSuccessParams<C extends Context, I = ITaskDataInput> {\n context: C;\n task: ITask<I>;\n}\n\nexport interface ITaskOnErrorParams<C extends Context, I = ITaskDataInput> {\n context: C;\n task: ITask<I>;\n}\n\nexport interface ITaskOnAbortParams<C extends Context> {\n context: C;\n task: ITask;\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 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 * 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>): 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>): 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 * 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\";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AAA,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,IAU1BW,gBAAgB,GAAAN,OAAA,CAAAM,gBAAA,0BAAhBA,gBAAgB;EAAhBA,gBAAgB;EAAhBA,gBAAgB;EAAA,OAAhBA,gBAAgB;AAAA;AAAA,IAwChBC,cAAc,GAAAP,OAAA,CAAAO,cAAA,0BAAdA,cAAc;EAAdA,cAAc;EAAdA,cAAc;EAAdA,cAAc;EAAdA,cAAc;EAAdA,cAAc;EAAA,OAAdA,cAAc;AAAA;AAAA,IA+QdC,kBAAkB,GAAAR,OAAA,CAAAQ,kBAAA,0BAAlBA,kBAAkB;EAAlBA,kBAAkB;EAAlBA,kBAAkB;EAAlBA,kBAAkB;EAAlBA,kBAAkB;EAAA,OAAlBA,kBAAkB;AAAA","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_objectMergeAdvanced","require","mergeOptions","hardArrayConcat","ObjectUpdater","data","merge","target","clear","item","mergeAdvanced","fetch","values","structuredClone","update","input","isDirty","Object","keys","length","exports"],"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 { defaults, 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":";;;;;;AAIA,IAAAA,oBAAA,GAAAC,OAAA;AAJA;AACA;AACA;AACA;;AAGA,MAAMC,YAAsC,GAAG;EAC3CC,eAAe,EAAE;AACrB,CAAC;AAEM,MAAMC,aAAa,CAAI;EAClBC,IAAI,GAAe,CAAC,CAAC;EAEtBC,KAAKA,CAACC,MAAS,EAAEC,KAAK,GAAG,IAAI,EAAK;IACrC,MAAMC,IAAI,GAAG,IAAAC,kCAAa,EAACH,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;EAEOE,KAAKA,CAACH,KAAK,GAAG,IAAI,EAAc;IACnC,MAAMI,MAAM,GAAGC,eAAe,CAAC,IAAI,CAACR,IAAI,CAAC;IACzC,IAAI,CAACG,KAAK,EAAE;MACR,OAAOI,MAAM;IACjB;IACA,IAAI,CAACJ,KAAK,CAAC,CAAC;IACZ,OAAOI,MAAM;EACjB;EACOE,MAAMA,CAACC,KAAiB,EAAE;IAC7B,IAAI,CAACV,IAAI,GAAG,IAAAK,kCAAa,EAAC,IAAI,CAACL,IAAI,EAAEU,KAAK,EAAEb,YAAY,CAAC;EAC7D;EAEOc,OAAOA,CAAA,EAAY;IACtB,OAAOC,MAAM,CAACC,IAAI,CAAC,IAAI,CAACb,IAAI,CAAC,CAACc,MAAM,GAAG,CAAC;EAC5C;EAEQX,KAAKA,CAAA,EAAG;IACZ,IAAI,CAACH,IAAI,GAAG,CAAC,CAAC;EAClB;AACJ;AAACe,OAAA,CAAAhB,aAAA,GAAAA,aAAA"}
|
|
1
|
+
{"version":3,"names":["_objectMergeAdvanced","require","mergeOptions","hardArrayConcat","ObjectUpdater","data","merge","target","clear","item","mergeAdvanced","fetch","values","structuredClone","update","input","isDirty","Object","keys","length","exports"],"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 { defaults, 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":";;;;;;AAIA,IAAAA,oBAAA,GAAAC,OAAA;AAJA;AACA;AACA;AACA;;AAGA,MAAMC,YAAsC,GAAG;EAC3CC,eAAe,EAAE;AACrB,CAAC;AAEM,MAAMC,aAAa,CAAI;EAClBC,IAAI,GAAe,CAAC,CAAC;EAEtBC,KAAKA,CAACC,MAAS,EAAEC,KAAK,GAAG,IAAI,EAAK;IACrC,MAAMC,IAAI,GAAG,IAAAC,kCAAa,EAACH,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;EAEOE,KAAKA,CAACH,KAAK,GAAG,IAAI,EAAc;IACnC,MAAMI,MAAM,GAAGC,eAAe,CAAC,IAAI,CAACR,IAAI,CAAC;IACzC,IAAI,CAACG,KAAK,EAAE;MACR,OAAOI,MAAM;IACjB;IACA,IAAI,CAACJ,KAAK,CAAC,CAAC;IACZ,OAAOI,MAAM;EACjB;EACOE,MAAMA,CAACC,KAAiB,EAAE;IAC7B,IAAI,CAACV,IAAI,GAAG,IAAAK,kCAAa,EAAC,IAAI,CAACL,IAAI,EAAEU,KAAK,EAAEb,YAAY,CAAC;EAC7D;EAEOc,OAAOA,CAAA,EAAY;IACtB,OAAOC,MAAM,CAACC,IAAI,CAAC,IAAI,CAACb,IAAI,CAAC,CAACc,MAAM,GAAG,CAAC;EAC5C;EAEQX,KAAKA,CAAA,EAAG;IACZ,IAAI,CAACH,IAAI,GAAG,CAAC,CAAC;EAClB;AACJ;AAACe,OAAA,CAAAhB,aAAA,GAAAA,aAAA","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_getObjectProperties","require","getErrorProperties","error","getObjectProperties","exports"],"sources":["getErrorProperties.ts"],"sourcesContent":["import { IResponseError } from \"~/response/abstractions\";\nimport { getObjectProperties } from \"~/utils/getObjectProperties\";\n\nexport const getErrorProperties = (error: Error): IResponseError => {\n return getObjectProperties<IResponseError>(error);\n};\n"],"mappings":";;;;;;AACA,IAAAA,oBAAA,GAAAC,OAAA;AAEO,MAAMC,kBAAkB,GAAIC,KAAY,IAAqB;EAChE,OAAO,IAAAC,wCAAmB,EAAiBD,KAAK,CAAC;AACrD,CAAC;AAACE,OAAA,CAAAH,kBAAA,GAAAA,kBAAA"}
|
|
1
|
+
{"version":3,"names":["_getObjectProperties","require","getErrorProperties","error","getObjectProperties","exports"],"sources":["getErrorProperties.ts"],"sourcesContent":["import { IResponseError } from \"~/response/abstractions\";\nimport { getObjectProperties } from \"~/utils/getObjectProperties\";\n\nexport const getErrorProperties = (error: Error): IResponseError => {\n return getObjectProperties<IResponseError>(error);\n};\n"],"mappings":";;;;;;AACA,IAAAA,oBAAA,GAAAC,OAAA;AAEO,MAAMC,kBAAkB,GAAIC,KAAY,IAAqB;EAChE,OAAO,IAAAC,wCAAmB,EAAiBD,KAAK,CAAC;AACrD,CAAC;AAACE,OAAA,CAAAH,kBAAA,GAAAA,kBAAA","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["getObjectProperties","input","Object","getOwnPropertyNames","reduce","acc","key","exports"],"sources":["getObjectProperties.ts"],"sourcesContent":["/**\n * Unfortunately we need some casting as we do not know which properties are available on the object.\n */\ninterface GenericRecord {\n [key: string]: any;\n}\n\nexport const getObjectProperties = <T = GenericRecord>(input: unknown): T => {\n if (!input || typeof input !== \"object\") {\n return {} as unknown as T;\n }\n return Object.getOwnPropertyNames(input).reduce<T>((acc, key) => {\n acc[key as keyof T] = (input as unknown as T)[key as keyof T];\n return acc;\n }, {} as T) as unknown as T;\n};\n"],"mappings":";;;;;;AAAA;AACA;AACA;;AAKO,MAAMA,mBAAmB,GAAuBC,KAAc,IAAQ;EACzE,IAAI,CAACA,KAAK,IAAI,OAAOA,KAAK,KAAK,QAAQ,EAAE;IACrC,OAAO,CAAC,CAAC;EACb;EACA,OAAOC,MAAM,CAACC,mBAAmB,CAACF,KAAK,CAAC,CAACG,MAAM,CAAI,CAACC,GAAG,EAAEC,GAAG,KAAK;IAC7DD,GAAG,CAACC,GAAG,CAAY,GAAIL,KAAK,CAAkBK,GAAG,CAAY;IAC7D,OAAOD,GAAG;EACd,CAAC,EAAE,CAAC,CAAM,CAAC;AACf,CAAC;AAACE,OAAA,CAAAP,mBAAA,GAAAA,mBAAA"}
|
|
1
|
+
{"version":3,"names":["getObjectProperties","input","Object","getOwnPropertyNames","reduce","acc","key","exports"],"sources":["getObjectProperties.ts"],"sourcesContent":["/**\n * Unfortunately we need some casting as we do not know which properties are available on the object.\n */\ninterface GenericRecord {\n [key: string]: any;\n}\n\nexport const getObjectProperties = <T = GenericRecord>(input: unknown): T => {\n if (!input || typeof input !== \"object\") {\n return {} as unknown as T;\n }\n return Object.getOwnPropertyNames(input).reduce<T>((acc, key) => {\n acc[key as keyof T] = (input as unknown as T)[key as keyof T];\n return acc;\n }, {} as T) as unknown as T;\n};\n"],"mappings":";;;;;;AAAA;AACA;AACA;;AAKO,MAAMA,mBAAmB,GAAuBC,KAAc,IAAQ;EACzE,IAAI,CAACA,KAAK,IAAI,OAAOA,KAAK,KAAK,QAAQ,EAAE;IACrC,OAAO,CAAC,CAAC;EACb;EACA,OAAOC,MAAM,CAACC,mBAAmB,CAACF,KAAK,CAAC,CAACG,MAAM,CAAI,CAACC,GAAG,EAAEC,GAAG,KAAK;IAC7DD,GAAG,CAACC,GAAG,CAAY,GAAIL,KAAK,CAAkBK,GAAG,CAAY;IAC7D,OAAOD,GAAG;EACd,CAAC,EAAE,CAAC,CAAM,CAAC;AACf,CAAC;AAACE,OAAA,CAAAP,mBAAA,GAAAA,mBAAA","ignoreList":[]}
|