@versori/run 0.0.1-alpha.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/esm/_dnt.shims.d.ts +12 -0
- package/esm/_dnt.shims.d.ts.map +1 -0
- package/esm/_dnt.shims.js +69 -0
- package/esm/context/Context.d.ts +23 -0
- package/esm/context/Context.d.ts.map +1 -0
- package/esm/context/Context.js +47 -0
- package/esm/context/ContextFunc.d.ts +5 -0
- package/esm/context/ContextFunc.d.ts.map +1 -0
- package/esm/context/ContextFunc.js +1 -0
- package/esm/context/ContextProvider.d.ts +11 -0
- package/esm/context/ContextProvider.d.ts.map +1 -0
- package/esm/context/ContextProvider.js +17 -0
- package/esm/dsl/Task.d.ts +36 -0
- package/esm/dsl/Task.d.ts.map +1 -0
- package/esm/dsl/Task.js +1 -0
- package/esm/dsl/Trigger.d.ts +8 -0
- package/esm/dsl/Trigger.d.ts.map +1 -0
- package/esm/dsl/Trigger.js +1 -0
- package/esm/dsl/Workflow.d.ts +14 -0
- package/esm/dsl/Workflow.d.ts.map +1 -0
- package/esm/dsl/Workflow.js +24 -0
- package/esm/dsl/ensureTask.d.ts +3 -0
- package/esm/dsl/ensureTask.d.ts.map +1 -0
- package/esm/dsl/ensureTask.js +7 -0
- package/esm/dsl/tasks/BackgroundTask.d.ts +12 -0
- package/esm/dsl/tasks/BackgroundTask.d.ts.map +1 -0
- package/esm/dsl/tasks/BackgroundTask.js +39 -0
- package/esm/dsl/tasks/CatchTask.d.ts +13 -0
- package/esm/dsl/tasks/CatchTask.d.ts.map +1 -0
- package/esm/dsl/tasks/CatchTask.js +46 -0
- package/esm/dsl/tasks/ChainTask.d.ts +12 -0
- package/esm/dsl/tasks/ChainTask.d.ts.map +1 -0
- package/esm/dsl/tasks/ChainTask.js +39 -0
- package/esm/dsl/tasks/FnTask.d.ts +15 -0
- package/esm/dsl/tasks/FnTask.d.ts.map +1 -0
- package/esm/dsl/tasks/FnTask.js +50 -0
- package/esm/dsl/tasks/HttpTask.d.ts +30 -0
- package/esm/dsl/tasks/HttpTask.d.ts.map +1 -0
- package/esm/dsl/tasks/HttpTask.js +57 -0
- package/esm/dsl/tasks/ParallelTask.d.ts +18 -0
- package/esm/dsl/tasks/ParallelTask.d.ts.map +1 -0
- package/esm/dsl/tasks/ParallelTask.js +52 -0
- package/esm/dsl/tasks/SerialTask.d.ts +18 -0
- package/esm/dsl/tasks/SerialTask.d.ts.map +1 -0
- package/esm/dsl/tasks/SerialTask.js +52 -0
- package/esm/dsl/tasks/UnpackTask.d.ts +15 -0
- package/esm/dsl/tasks/UnpackTask.d.ts.map +1 -0
- package/esm/dsl/tasks/UnpackTask.js +54 -0
- package/esm/dsl/triggers/ScheduleTrigger.d.ts +14 -0
- package/esm/dsl/triggers/ScheduleTrigger.d.ts.map +1 -0
- package/esm/dsl/triggers/ScheduleTrigger.js +38 -0
- package/esm/interpreter/memory/ExecutionError.d.ts +6 -0
- package/esm/interpreter/memory/ExecutionError.d.ts.map +1 -0
- package/esm/interpreter/memory/ExecutionError.js +13 -0
- package/esm/interpreter/memory/MemoryInterpreter.d.ts +18 -0
- package/esm/interpreter/memory/MemoryInterpreter.d.ts.map +1 -0
- package/esm/interpreter/memory/MemoryInterpreter.js +83 -0
- package/esm/interpreter/memory/ObservableCompiler.d.ts +23 -0
- package/esm/interpreter/memory/ObservableCompiler.d.ts.map +1 -0
- package/esm/interpreter/memory/ObservableCompiler.js +65 -0
- package/esm/interpreter/memory/compilers/background.d.ts +4 -0
- package/esm/interpreter/memory/compilers/background.d.ts.map +1 -0
- package/esm/interpreter/memory/compilers/background.js +20 -0
- package/esm/interpreter/memory/compilers/catch.d.ts +4 -0
- package/esm/interpreter/memory/compilers/catch.d.ts.map +1 -0
- package/esm/interpreter/memory/compilers/catch.js +19 -0
- package/esm/interpreter/memory/compilers/chain.d.ts +3 -0
- package/esm/interpreter/memory/compilers/chain.d.ts.map +1 -0
- package/esm/interpreter/memory/compilers/chain.js +9 -0
- package/esm/interpreter/memory/compilers/fn.d.ts +4 -0
- package/esm/interpreter/memory/compilers/fn.d.ts.map +1 -0
- package/esm/interpreter/memory/compilers/fn.js +16 -0
- package/esm/interpreter/memory/compilers/http.d.ts +4 -0
- package/esm/interpreter/memory/compilers/http.d.ts.map +1 -0
- package/esm/interpreter/memory/compilers/http.js +24 -0
- package/esm/interpreter/memory/compilers/parallel.d.ts +4 -0
- package/esm/interpreter/memory/compilers/parallel.d.ts.map +1 -0
- package/esm/interpreter/memory/compilers/parallel.js +19 -0
- package/esm/interpreter/memory/compilers/schedule.d.ts +4 -0
- package/esm/interpreter/memory/compilers/schedule.d.ts.map +1 -0
- package/esm/interpreter/memory/compilers/schedule.js +47 -0
- package/esm/interpreter/memory/compilers/serial.d.ts +4 -0
- package/esm/interpreter/memory/compilers/serial.d.ts.map +1 -0
- package/esm/interpreter/memory/compilers/serial.js +16 -0
- package/esm/interpreter/memory/compilers/types.d.ts +15 -0
- package/esm/interpreter/memory/compilers/types.d.ts.map +1 -0
- package/esm/interpreter/memory/compilers/types.js +1 -0
- package/esm/interpreter/memory/compilers/unpack.d.ts +4 -0
- package/esm/interpreter/memory/compilers/unpack.d.ts.map +1 -0
- package/esm/interpreter/memory/compilers/unpack.js +22 -0
- package/esm/mod.d.ts +5 -0
- package/esm/mod.d.ts.map +1 -0
- package/esm/mod.js +4 -0
- package/esm/observability/logging/ConsoleLogger.d.ts +19 -0
- package/esm/observability/logging/ConsoleLogger.d.ts.map +1 -0
- package/esm/observability/logging/ConsoleLogger.js +85 -0
- package/esm/observability/logging/Logger.d.ts +12 -0
- package/esm/observability/logging/Logger.d.ts.map +1 -0
- package/esm/observability/logging/Logger.js +1 -0
- package/esm/package.json +3 -0
- package/package.json +34 -0
- package/script/_dnt.shims.d.ts +12 -0
- package/script/_dnt.shims.d.ts.map +1 -0
- package/script/_dnt.shims.js +77 -0
- package/script/context/Context.d.ts +23 -0
- package/script/context/Context.d.ts.map +1 -0
- package/script/context/Context.js +51 -0
- package/script/context/ContextFunc.d.ts +5 -0
- package/script/context/ContextFunc.d.ts.map +1 -0
- package/script/context/ContextFunc.js +2 -0
- package/script/context/ContextProvider.d.ts +11 -0
- package/script/context/ContextProvider.d.ts.map +1 -0
- package/script/context/ContextProvider.js +21 -0
- package/script/dsl/Task.d.ts +36 -0
- package/script/dsl/Task.d.ts.map +1 -0
- package/script/dsl/Task.js +4 -0
- package/script/dsl/Trigger.d.ts +8 -0
- package/script/dsl/Trigger.d.ts.map +1 -0
- package/script/dsl/Trigger.js +4 -0
- package/script/dsl/Workflow.d.ts +14 -0
- package/script/dsl/Workflow.d.ts.map +1 -0
- package/script/dsl/Workflow.js +28 -0
- package/script/dsl/ensureTask.d.ts +3 -0
- package/script/dsl/ensureTask.d.ts.map +1 -0
- package/script/dsl/ensureTask.js +10 -0
- package/script/dsl/tasks/BackgroundTask.d.ts +12 -0
- package/script/dsl/tasks/BackgroundTask.d.ts.map +1 -0
- package/script/dsl/tasks/BackgroundTask.js +43 -0
- package/script/dsl/tasks/CatchTask.d.ts +13 -0
- package/script/dsl/tasks/CatchTask.d.ts.map +1 -0
- package/script/dsl/tasks/CatchTask.js +50 -0
- package/script/dsl/tasks/ChainTask.d.ts +12 -0
- package/script/dsl/tasks/ChainTask.d.ts.map +1 -0
- package/script/dsl/tasks/ChainTask.js +43 -0
- package/script/dsl/tasks/FnTask.d.ts +15 -0
- package/script/dsl/tasks/FnTask.d.ts.map +1 -0
- package/script/dsl/tasks/FnTask.js +55 -0
- package/script/dsl/tasks/HttpTask.d.ts +30 -0
- package/script/dsl/tasks/HttpTask.d.ts.map +1 -0
- package/script/dsl/tasks/HttpTask.js +62 -0
- package/script/dsl/tasks/ParallelTask.d.ts +18 -0
- package/script/dsl/tasks/ParallelTask.d.ts.map +1 -0
- package/script/dsl/tasks/ParallelTask.js +56 -0
- package/script/dsl/tasks/SerialTask.d.ts +18 -0
- package/script/dsl/tasks/SerialTask.d.ts.map +1 -0
- package/script/dsl/tasks/SerialTask.js +56 -0
- package/script/dsl/tasks/UnpackTask.d.ts +15 -0
- package/script/dsl/tasks/UnpackTask.d.ts.map +1 -0
- package/script/dsl/tasks/UnpackTask.js +58 -0
- package/script/dsl/triggers/ScheduleTrigger.d.ts +14 -0
- package/script/dsl/triggers/ScheduleTrigger.d.ts.map +1 -0
- package/script/dsl/triggers/ScheduleTrigger.js +43 -0
- package/script/interpreter/memory/ExecutionError.d.ts +6 -0
- package/script/interpreter/memory/ExecutionError.d.ts.map +1 -0
- package/script/interpreter/memory/ExecutionError.js +17 -0
- package/script/interpreter/memory/MemoryInterpreter.d.ts +18 -0
- package/script/interpreter/memory/MemoryInterpreter.d.ts.map +1 -0
- package/script/interpreter/memory/MemoryInterpreter.js +110 -0
- package/script/interpreter/memory/ObservableCompiler.d.ts +23 -0
- package/script/interpreter/memory/ObservableCompiler.d.ts.map +1 -0
- package/script/interpreter/memory/ObservableCompiler.js +69 -0
- package/script/interpreter/memory/compilers/background.d.ts +4 -0
- package/script/interpreter/memory/compilers/background.d.ts.map +1 -0
- package/script/interpreter/memory/compilers/background.js +23 -0
- package/script/interpreter/memory/compilers/catch.d.ts +4 -0
- package/script/interpreter/memory/compilers/catch.d.ts.map +1 -0
- package/script/interpreter/memory/compilers/catch.js +22 -0
- package/script/interpreter/memory/compilers/chain.d.ts +3 -0
- package/script/interpreter/memory/compilers/chain.d.ts.map +1 -0
- package/script/interpreter/memory/compilers/chain.js +12 -0
- package/script/interpreter/memory/compilers/fn.d.ts +4 -0
- package/script/interpreter/memory/compilers/fn.d.ts.map +1 -0
- package/script/interpreter/memory/compilers/fn.js +19 -0
- package/script/interpreter/memory/compilers/http.d.ts +4 -0
- package/script/interpreter/memory/compilers/http.d.ts.map +1 -0
- package/script/interpreter/memory/compilers/http.js +27 -0
- package/script/interpreter/memory/compilers/parallel.d.ts +4 -0
- package/script/interpreter/memory/compilers/parallel.d.ts.map +1 -0
- package/script/interpreter/memory/compilers/parallel.js +22 -0
- package/script/interpreter/memory/compilers/schedule.d.ts +4 -0
- package/script/interpreter/memory/compilers/schedule.d.ts.map +1 -0
- package/script/interpreter/memory/compilers/schedule.js +50 -0
- package/script/interpreter/memory/compilers/serial.d.ts +4 -0
- package/script/interpreter/memory/compilers/serial.d.ts.map +1 -0
- package/script/interpreter/memory/compilers/serial.js +19 -0
- package/script/interpreter/memory/compilers/types.d.ts +15 -0
- package/script/interpreter/memory/compilers/types.d.ts.map +1 -0
- package/script/interpreter/memory/compilers/types.js +2 -0
- package/script/interpreter/memory/compilers/unpack.d.ts +4 -0
- package/script/interpreter/memory/compilers/unpack.d.ts.map +1 -0
- package/script/interpreter/memory/compilers/unpack.js +25 -0
- package/script/mod.d.ts +5 -0
- package/script/mod.d.ts.map +1 -0
- package/script/mod.js +11 -0
- package/script/observability/logging/ConsoleLogger.d.ts +19 -0
- package/script/observability/logging/ConsoleLogger.d.ts.map +1 -0
- package/script/observability/logging/ConsoleLogger.js +112 -0
- package/script/observability/logging/Logger.d.ts +12 -0
- package/script/observability/logging/Logger.d.ts.map +1 -0
- package/script/observability/logging/Logger.js +2 -0
- package/script/package.json +3 -0
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
var _a;
|
|
2
|
+
import { ensureTask } from '../ensureTask.js';
|
|
3
|
+
import { TaskType } from '../Task.js';
|
|
4
|
+
import { BackgroundTask } from './BackgroundTask.js';
|
|
5
|
+
import { CatchTask } from './CatchTask.js';
|
|
6
|
+
import { ChainTask } from './ChainTask.js';
|
|
7
|
+
import { UnpackTask } from './UnpackTask.js';
|
|
8
|
+
export class HttpTaskImpl {
|
|
9
|
+
constructor(id, opts, fn) {
|
|
10
|
+
Object.defineProperty(this, _a, {
|
|
11
|
+
enumerable: true,
|
|
12
|
+
configurable: true,
|
|
13
|
+
writable: true,
|
|
14
|
+
value: 'Http'
|
|
15
|
+
});
|
|
16
|
+
Object.defineProperty(this, "id", {
|
|
17
|
+
enumerable: true,
|
|
18
|
+
configurable: true,
|
|
19
|
+
writable: true,
|
|
20
|
+
value: void 0
|
|
21
|
+
});
|
|
22
|
+
Object.defineProperty(this, "fn", {
|
|
23
|
+
enumerable: true,
|
|
24
|
+
configurable: true,
|
|
25
|
+
writable: true,
|
|
26
|
+
value: void 0
|
|
27
|
+
});
|
|
28
|
+
Object.defineProperty(this, "opts", {
|
|
29
|
+
enumerable: true,
|
|
30
|
+
configurable: true,
|
|
31
|
+
writable: true,
|
|
32
|
+
value: void 0
|
|
33
|
+
});
|
|
34
|
+
this.id = id;
|
|
35
|
+
this.fn = fn;
|
|
36
|
+
this.opts = opts;
|
|
37
|
+
}
|
|
38
|
+
then(task) {
|
|
39
|
+
return new ChainTask(this.clone(), ensureTask(task));
|
|
40
|
+
}
|
|
41
|
+
catch(task) {
|
|
42
|
+
return new CatchTask(this.clone(), ensureTask(task));
|
|
43
|
+
}
|
|
44
|
+
background() {
|
|
45
|
+
return new BackgroundTask(this.clone());
|
|
46
|
+
}
|
|
47
|
+
unpack(mapper) {
|
|
48
|
+
return new UnpackTask(this.clone(), mapper);
|
|
49
|
+
}
|
|
50
|
+
clone() {
|
|
51
|
+
return new HttpTaskImpl(this.id, this.opts, this.fn);
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
_a = TaskType;
|
|
55
|
+
export function http(taskId, opts, fn) {
|
|
56
|
+
return new HttpTaskImpl(taskId, opts, fn);
|
|
57
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { ArrayTask, Task, Taskable, TaskType } from '../Task.js';
|
|
2
|
+
/**
|
|
3
|
+
* ParallelTask is a Task which expects an array of elements as input, and applies a Task to each element in parallel.
|
|
4
|
+
*
|
|
5
|
+
* The output of the ParallelTask is an array of the outputs of each element, maintaining the original order.
|
|
6
|
+
*/
|
|
7
|
+
export declare class ParallelTask<In, BaseOutElem, BaseOut extends Array<BaseOutElem>, OutElem> implements Task<In, OutElem[]> {
|
|
8
|
+
[TaskType]: string;
|
|
9
|
+
_base: Task<In, BaseOut>;
|
|
10
|
+
_each: Task<BaseOutElem, OutElem>;
|
|
11
|
+
constructor(base: Task<In, BaseOut>, task: Task<BaseOutElem, OutElem>);
|
|
12
|
+
then<NextOut>(task: Taskable<OutElem[], NextOut>): Task<In, NextOut>;
|
|
13
|
+
catch<NextOut>(task: Taskable<Error, NextOut>): Task<In, NextOut>;
|
|
14
|
+
background(): Task<In, void>;
|
|
15
|
+
unpack<NextOut2 = OutElem[]>(mapper?: (data: OutElem[]) => NextOut2[]): ArrayTask<In, NextOut2>;
|
|
16
|
+
clone(): Task<In, OutElem[]>;
|
|
17
|
+
}
|
|
18
|
+
//# sourceMappingURL=ParallelTask.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ParallelTask.d.ts","sourceRoot":"","sources":["../../../src/dsl/tasks/ParallelTask.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,SAAS,EAAE,IAAI,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAMjE;;;;GAIG;AACH,qBAAa,YAAY,CAAC,EAAE,EAAE,WAAW,EAAE,OAAO,SAAS,KAAK,CAAC,WAAW,CAAC,EAAE,OAAO,CAClF,YAAW,IAAI,CAAC,EAAE,EAAE,OAAO,EAAE,CAAC;IAE9B,CAAC,QAAQ,CAAC,EAAE,MAAM,CAAc;IAEhC,KAAK,EAAE,IAAI,CAAC,EAAE,EAAE,OAAO,CAAC,CAAC;IACzB,KAAK,EAAE,IAAI,CAAC,WAAW,EAAE,OAAO,CAAC,CAAC;gBAEtB,IAAI,EAAE,IAAI,CAAC,EAAE,EAAE,OAAO,CAAC,EAAE,IAAI,EAAE,IAAI,CAAC,WAAW,EAAE,OAAO,CAAC;IAKrE,IAAI,CAAC,OAAO,EAAE,IAAI,EAAE,QAAQ,CAAC,OAAO,EAAE,EAAE,OAAO,CAAC,GAAG,IAAI,CAAC,EAAE,EAAE,OAAO,CAAC;IAIpE,KAAK,CAAC,OAAO,EAAE,IAAI,EAAE,QAAQ,CAAC,KAAK,EAAE,OAAO,CAAC,GAAG,IAAI,CAAC,EAAE,EAAE,OAAO,CAAC;IAIjE,UAAU,IAAI,IAAI,CAAC,EAAE,EAAE,IAAI,CAAC;IAI5B,MAAM,CAAC,QAAQ,GAAG,OAAO,EAAE,EACvB,MAAM,CAAC,EAAE,CAAC,IAAI,EAAE,OAAO,EAAE,KAAK,QAAQ,EAAE,GACzC,SAAS,CAAC,EAAE,EAAE,QAAQ,CAAC;IAI1B,KAAK,IAAI,IAAI,CAAC,EAAE,EAAE,OAAO,EAAE,CAAC;CAG/B"}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
var _a;
|
|
2
|
+
import { ensureTask } from '../ensureTask.js';
|
|
3
|
+
import { TaskType } from '../Task.js';
|
|
4
|
+
import { BackgroundTask } from './BackgroundTask.js';
|
|
5
|
+
import { CatchTask } from './CatchTask.js';
|
|
6
|
+
import { ChainTask } from './ChainTask.js';
|
|
7
|
+
import { UnpackTask } from './UnpackTask.js';
|
|
8
|
+
/**
|
|
9
|
+
* ParallelTask is a Task which expects an array of elements as input, and applies a Task to each element in parallel.
|
|
10
|
+
*
|
|
11
|
+
* The output of the ParallelTask is an array of the outputs of each element, maintaining the original order.
|
|
12
|
+
*/
|
|
13
|
+
export class ParallelTask {
|
|
14
|
+
constructor(base, task) {
|
|
15
|
+
Object.defineProperty(this, _a, {
|
|
16
|
+
enumerable: true,
|
|
17
|
+
configurable: true,
|
|
18
|
+
writable: true,
|
|
19
|
+
value: 'Parallel'
|
|
20
|
+
});
|
|
21
|
+
Object.defineProperty(this, "_base", {
|
|
22
|
+
enumerable: true,
|
|
23
|
+
configurable: true,
|
|
24
|
+
writable: true,
|
|
25
|
+
value: void 0
|
|
26
|
+
});
|
|
27
|
+
Object.defineProperty(this, "_each", {
|
|
28
|
+
enumerable: true,
|
|
29
|
+
configurable: true,
|
|
30
|
+
writable: true,
|
|
31
|
+
value: void 0
|
|
32
|
+
});
|
|
33
|
+
this._base = base;
|
|
34
|
+
this._each = task;
|
|
35
|
+
}
|
|
36
|
+
then(task) {
|
|
37
|
+
return new ChainTask(this.clone(), ensureTask(task));
|
|
38
|
+
}
|
|
39
|
+
catch(task) {
|
|
40
|
+
return new CatchTask(this.clone(), ensureTask(task));
|
|
41
|
+
}
|
|
42
|
+
background() {
|
|
43
|
+
return new BackgroundTask(this.clone());
|
|
44
|
+
}
|
|
45
|
+
unpack(mapper) {
|
|
46
|
+
return new UnpackTask(this.clone(), mapper);
|
|
47
|
+
}
|
|
48
|
+
clone() {
|
|
49
|
+
return new ParallelTask(this._base.clone(), this._each.clone());
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
_a = TaskType;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { ArrayTask, Task, Taskable, TaskType } from '../Task.js';
|
|
2
|
+
/**
|
|
3
|
+
* SerialTask is a Task which expects an array of elements as input, and applies a Task to each element.
|
|
4
|
+
*
|
|
5
|
+
* The output of the SerialTask is an array of the outputs of the each element.
|
|
6
|
+
*/
|
|
7
|
+
export declare class SerialTask<In, BaseOutElem, BaseOut extends Array<BaseOutElem>, OutElem> implements Task<In, OutElem[]> {
|
|
8
|
+
[TaskType]: string;
|
|
9
|
+
_base: Task<In, BaseOut>;
|
|
10
|
+
_each: Task<BaseOutElem, OutElem>;
|
|
11
|
+
constructor(base: Task<In, BaseOut>, task: Task<BaseOutElem, OutElem>);
|
|
12
|
+
then<NextOut>(task: Taskable<OutElem[], NextOut>): Task<In, NextOut>;
|
|
13
|
+
catch<NextOut>(task: Taskable<Error, NextOut>): Task<In, NextOut>;
|
|
14
|
+
background(): Task<In, void>;
|
|
15
|
+
unpack<NextOut2 = OutElem[]>(mapper?: (data: OutElem[]) => NextOut2[]): ArrayTask<In, NextOut2>;
|
|
16
|
+
clone(): Task<In, OutElem[]>;
|
|
17
|
+
}
|
|
18
|
+
//# sourceMappingURL=SerialTask.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SerialTask.d.ts","sourceRoot":"","sources":["../../../src/dsl/tasks/SerialTask.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,SAAS,EAAE,IAAI,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAMjE;;;;GAIG;AACH,qBAAa,UAAU,CAAC,EAAE,EAAE,WAAW,EAAE,OAAO,SAAS,KAAK,CAAC,WAAW,CAAC,EAAE,OAAO,CAChF,YAAW,IAAI,CAAC,EAAE,EAAE,OAAO,EAAE,CAAC;IAE9B,CAAC,QAAQ,CAAC,EAAE,MAAM,CAAY;IAE9B,KAAK,EAAE,IAAI,CAAC,EAAE,EAAE,OAAO,CAAC,CAAC;IACzB,KAAK,EAAE,IAAI,CAAC,WAAW,EAAE,OAAO,CAAC,CAAC;gBAEtB,IAAI,EAAE,IAAI,CAAC,EAAE,EAAE,OAAO,CAAC,EAAE,IAAI,EAAE,IAAI,CAAC,WAAW,EAAE,OAAO,CAAC;IAKrE,IAAI,CAAC,OAAO,EAAE,IAAI,EAAE,QAAQ,CAAC,OAAO,EAAE,EAAE,OAAO,CAAC,GAAG,IAAI,CAAC,EAAE,EAAE,OAAO,CAAC;IAIpE,KAAK,CAAC,OAAO,EAAE,IAAI,EAAE,QAAQ,CAAC,KAAK,EAAE,OAAO,CAAC,GAAG,IAAI,CAAC,EAAE,EAAE,OAAO,CAAC;IAIjE,UAAU,IAAI,IAAI,CAAC,EAAE,EAAE,IAAI,CAAC;IAI5B,MAAM,CAAC,QAAQ,GAAG,OAAO,EAAE,EACvB,MAAM,CAAC,EAAE,CAAC,IAAI,EAAE,OAAO,EAAE,KAAK,QAAQ,EAAE,GACzC,SAAS,CAAC,EAAE,EAAE,QAAQ,CAAC;IAI1B,KAAK,IAAI,IAAI,CAAC,EAAE,EAAE,OAAO,EAAE,CAAC;CAG/B"}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
var _a;
|
|
2
|
+
import { ensureTask } from '../ensureTask.js';
|
|
3
|
+
import { TaskType } from '../Task.js';
|
|
4
|
+
import { BackgroundTask } from './BackgroundTask.js';
|
|
5
|
+
import { CatchTask } from './CatchTask.js';
|
|
6
|
+
import { ChainTask } from './ChainTask.js';
|
|
7
|
+
import { UnpackTask } from './UnpackTask.js';
|
|
8
|
+
/**
|
|
9
|
+
* SerialTask is a Task which expects an array of elements as input, and applies a Task to each element.
|
|
10
|
+
*
|
|
11
|
+
* The output of the SerialTask is an array of the outputs of the each element.
|
|
12
|
+
*/
|
|
13
|
+
export class SerialTask {
|
|
14
|
+
constructor(base, task) {
|
|
15
|
+
Object.defineProperty(this, _a, {
|
|
16
|
+
enumerable: true,
|
|
17
|
+
configurable: true,
|
|
18
|
+
writable: true,
|
|
19
|
+
value: 'Serial'
|
|
20
|
+
});
|
|
21
|
+
Object.defineProperty(this, "_base", {
|
|
22
|
+
enumerable: true,
|
|
23
|
+
configurable: true,
|
|
24
|
+
writable: true,
|
|
25
|
+
value: void 0
|
|
26
|
+
});
|
|
27
|
+
Object.defineProperty(this, "_each", {
|
|
28
|
+
enumerable: true,
|
|
29
|
+
configurable: true,
|
|
30
|
+
writable: true,
|
|
31
|
+
value: void 0
|
|
32
|
+
});
|
|
33
|
+
this._base = base;
|
|
34
|
+
this._each = task;
|
|
35
|
+
}
|
|
36
|
+
then(task) {
|
|
37
|
+
return new ChainTask(this.clone(), ensureTask(task));
|
|
38
|
+
}
|
|
39
|
+
catch(task) {
|
|
40
|
+
return new CatchTask(this.clone(), ensureTask(task));
|
|
41
|
+
}
|
|
42
|
+
background() {
|
|
43
|
+
return new BackgroundTask(this.clone());
|
|
44
|
+
}
|
|
45
|
+
unpack(mapper) {
|
|
46
|
+
return new UnpackTask(this.clone(), mapper);
|
|
47
|
+
}
|
|
48
|
+
clone() {
|
|
49
|
+
return new SerialTask(this._base.clone(), this._each.clone());
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
_a = TaskType;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { ArrayTask, Task, Taskable, TaskType } from '../Task.js';
|
|
2
|
+
export declare class UnpackTask<In, Out, UnpackedOut = Out> implements ArrayTask<In, UnpackedOut> {
|
|
3
|
+
[TaskType]: string;
|
|
4
|
+
_base: Task<In, Out>;
|
|
5
|
+
_mapper?: (data: Out) => UnpackedOut[];
|
|
6
|
+
constructor(base: Task<In, Out>, mapper?: (data: Out) => UnpackedOut[]);
|
|
7
|
+
parallel<NextOut>(task: Taskable<UnpackedOut, NextOut, number>): Task<In, NextOut[]>;
|
|
8
|
+
serial<NextOut>(task: Taskable<UnpackedOut, NextOut, number>): Task<In, NextOut[]>;
|
|
9
|
+
then<NextOut>(task: Taskable<UnpackedOut[], NextOut>): Task<In, NextOut>;
|
|
10
|
+
catch<NextOut>(task: Taskable<Error, NextOut>): Task<In, NextOut>;
|
|
11
|
+
background(): Task<In, void>;
|
|
12
|
+
unpack<NextOut>(mapper?: (data: UnpackedOut[]) => NextOut[]): ArrayTask<In, NextOut>;
|
|
13
|
+
clone(): Task<In, UnpackedOut[]>;
|
|
14
|
+
}
|
|
15
|
+
//# sourceMappingURL=UnpackTask.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"UnpackTask.d.ts","sourceRoot":"","sources":["../../../src/dsl/tasks/UnpackTask.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,SAAS,EAAE,IAAI,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAOjE,qBAAa,UAAU,CAAC,EAAE,EAAE,GAAG,EAAE,WAAW,GAAG,GAAG,CAC9C,YAAW,SAAS,CAAC,EAAE,EAAE,WAAW,CAAC;IAErC,CAAC,QAAQ,CAAC,EAAE,MAAM,CAAY;IAE9B,KAAK,EAAE,IAAI,CAAC,EAAE,EAAE,GAAG,CAAC,CAAC;IAErB,OAAO,CAAC,EAAE,CAAC,IAAI,EAAE,GAAG,KAAK,WAAW,EAAE,CAAC;gBAE3B,IAAI,EAAE,IAAI,CAAC,EAAE,EAAE,GAAG,CAAC,EAAE,MAAM,CAAC,EAAE,CAAC,IAAI,EAAE,GAAG,KAAK,WAAW,EAAE;IAKtE,QAAQ,CAAC,OAAO,EAAE,IAAI,EAAE,QAAQ,CAAC,WAAW,EAAE,OAAO,EAAE,MAAM,CAAC,GAAG,IAAI,CAAC,EAAE,EAAE,OAAO,EAAE,CAAC;IAIpF,MAAM,CAAC,OAAO,EAAE,IAAI,EAAE,QAAQ,CAAC,WAAW,EAAE,OAAO,EAAE,MAAM,CAAC,GAAG,IAAI,CAAC,EAAE,EAAE,OAAO,EAAE,CAAC;IAIlF,IAAI,CAAC,OAAO,EAAE,IAAI,EAAE,QAAQ,CAAC,WAAW,EAAE,EAAE,OAAO,CAAC,GAAG,IAAI,CAAC,EAAE,EAAE,OAAO,CAAC;IAIxE,KAAK,CAAC,OAAO,EAAE,IAAI,EAAE,QAAQ,CAAC,KAAK,EAAE,OAAO,CAAC,GAAG,IAAI,CAAC,EAAE,EAAE,OAAO,CAAC;IAIjE,UAAU,IAAI,IAAI,CAAC,EAAE,EAAE,IAAI,CAAC;IAI5B,MAAM,CAAC,OAAO,EAAE,MAAM,CAAC,EAAE,CAAC,IAAI,EAAE,WAAW,EAAE,KAAK,OAAO,EAAE,GAAG,SAAS,CAAC,EAAE,EAAE,OAAO,CAAC;IAIpF,KAAK,IAAI,IAAI,CAAC,EAAE,EAAE,WAAW,EAAE,CAAC;CAGnC"}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
var _a;
|
|
2
|
+
import { ensureTask } from '../ensureTask.js';
|
|
3
|
+
import { TaskType } from '../Task.js';
|
|
4
|
+
import { BackgroundTask } from './BackgroundTask.js';
|
|
5
|
+
import { CatchTask } from './CatchTask.js';
|
|
6
|
+
import { ChainTask } from './ChainTask.js';
|
|
7
|
+
import { SerialTask } from './SerialTask.js';
|
|
8
|
+
import { ParallelTask } from './ParallelTask.js';
|
|
9
|
+
export class UnpackTask {
|
|
10
|
+
constructor(base, mapper) {
|
|
11
|
+
Object.defineProperty(this, _a, {
|
|
12
|
+
enumerable: true,
|
|
13
|
+
configurable: true,
|
|
14
|
+
writable: true,
|
|
15
|
+
value: 'Unpack'
|
|
16
|
+
});
|
|
17
|
+
Object.defineProperty(this, "_base", {
|
|
18
|
+
enumerable: true,
|
|
19
|
+
configurable: true,
|
|
20
|
+
writable: true,
|
|
21
|
+
value: void 0
|
|
22
|
+
});
|
|
23
|
+
Object.defineProperty(this, "_mapper", {
|
|
24
|
+
enumerable: true,
|
|
25
|
+
configurable: true,
|
|
26
|
+
writable: true,
|
|
27
|
+
value: void 0
|
|
28
|
+
});
|
|
29
|
+
this._base = base;
|
|
30
|
+
this._mapper = mapper;
|
|
31
|
+
}
|
|
32
|
+
parallel(task) {
|
|
33
|
+
return new ParallelTask(this.clone(), ensureTask(task));
|
|
34
|
+
}
|
|
35
|
+
serial(task) {
|
|
36
|
+
return new SerialTask(this.clone(), ensureTask(task));
|
|
37
|
+
}
|
|
38
|
+
then(task) {
|
|
39
|
+
return new ChainTask(this.clone(), ensureTask(task));
|
|
40
|
+
}
|
|
41
|
+
catch(task) {
|
|
42
|
+
return new CatchTask(this.clone(), ensureTask(task));
|
|
43
|
+
}
|
|
44
|
+
background() {
|
|
45
|
+
return new BackgroundTask(this.clone());
|
|
46
|
+
}
|
|
47
|
+
unpack(mapper) {
|
|
48
|
+
return new UnpackTask(this.clone(), mapper);
|
|
49
|
+
}
|
|
50
|
+
clone() {
|
|
51
|
+
return new UnpackTask(this._base.clone(), this._mapper);
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
_a = TaskType;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { Taskable } from '../Task.js';
|
|
2
|
+
import { Trigger, TriggerType } from '../Trigger.js';
|
|
3
|
+
import { Workflow } from '../Workflow.js';
|
|
4
|
+
export type ScheduleData = Record<string, never>;
|
|
5
|
+
export declare class ScheduleTrigger implements Trigger<ScheduleData> {
|
|
6
|
+
id: string;
|
|
7
|
+
[TriggerType]: string;
|
|
8
|
+
schedule: string;
|
|
9
|
+
constructor(id: string, schedule: string);
|
|
10
|
+
then<OO>(task: Taskable<ScheduleData, OO>): Workflow<OO>;
|
|
11
|
+
catch<OO>(error: any): Workflow<OO>;
|
|
12
|
+
}
|
|
13
|
+
export declare function schedule(id: string, schedule: string): Workflow<ScheduleData>;
|
|
14
|
+
//# sourceMappingURL=ScheduleTrigger.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ScheduleTrigger.d.ts","sourceRoot":"","sources":["../../../src/dsl/triggers/ScheduleTrigger.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AACtC,OAAO,EAAE,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AACrD,OAAO,EAAE,QAAQ,EAAgB,MAAM,gBAAgB,CAAC;AAExD,MAAM,MAAM,YAAY,GAAG,MAAM,CAAC,MAAM,EAAE,KAAK,CAAC,CAAC;AAEjD,qBAAa,eAAgB,YAAW,OAAO,CAAC,YAAY,CAAC;IACzD,EAAE,EAAE,MAAM,CAAC;IAEX,CAAC,WAAW,CAAC,EAAE,MAAM,CAAc;IAEnC,QAAQ,EAAE,MAAM,CAAC;gBAEL,EAAE,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM;IAKxC,IAAI,CAAC,EAAE,EAAE,IAAI,EAAE,QAAQ,CAAC,YAAY,EAAE,EAAE,CAAC,GAAG,QAAQ,CAAC,EAAE,CAAC;IAIxD,KAAK,CAAC,EAAE,EAAE,KAAK,EAAE,GAAG,GAAG,QAAQ,CAAC,EAAE,CAAC;CAGtC;AAED,wBAAgB,QAAQ,CAAC,EAAE,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,QAAQ,CAAC,YAAY,CAAC,CAE7E"}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
var _a;
|
|
2
|
+
import { ensureTask } from "../ensureTask.js";
|
|
3
|
+
import { TriggerType } from '../Trigger.js';
|
|
4
|
+
import { WorkflowImpl } from '../Workflow.js';
|
|
5
|
+
export class ScheduleTrigger {
|
|
6
|
+
constructor(id, schedule) {
|
|
7
|
+
Object.defineProperty(this, "id", {
|
|
8
|
+
enumerable: true,
|
|
9
|
+
configurable: true,
|
|
10
|
+
writable: true,
|
|
11
|
+
value: void 0
|
|
12
|
+
});
|
|
13
|
+
Object.defineProperty(this, _a, {
|
|
14
|
+
enumerable: true,
|
|
15
|
+
configurable: true,
|
|
16
|
+
writable: true,
|
|
17
|
+
value: 'schedule'
|
|
18
|
+
});
|
|
19
|
+
Object.defineProperty(this, "schedule", {
|
|
20
|
+
enumerable: true,
|
|
21
|
+
configurable: true,
|
|
22
|
+
writable: true,
|
|
23
|
+
value: void 0
|
|
24
|
+
});
|
|
25
|
+
this.id = id;
|
|
26
|
+
this.schedule = schedule;
|
|
27
|
+
}
|
|
28
|
+
then(task) {
|
|
29
|
+
return new WorkflowImpl(this, ensureTask(task));
|
|
30
|
+
}
|
|
31
|
+
catch(error) {
|
|
32
|
+
return this;
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
_a = TriggerType;
|
|
36
|
+
export function schedule(id, schedule) {
|
|
37
|
+
return new ScheduleTrigger(id, schedule);
|
|
38
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ExecutionError.d.ts","sourceRoot":"","sources":["../../../src/interpreter/memory/ExecutionError.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,0BAA0B,CAAC;AAEnD,qBAAa,cAAe,SAAQ,KAAK;IACrC,GAAG,EAAE,OAAO,CAAC,GAAG,CAAC,CAAC;gBAEN,GAAG,EAAE,OAAO,CAAC,GAAG,CAAC,EAAE,OAAO,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,YAAY;CAMtE"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
export class ExecutionError extends Error {
|
|
2
|
+
constructor(ctx, message, opts) {
|
|
3
|
+
super(message, opts);
|
|
4
|
+
Object.defineProperty(this, "ctx", {
|
|
5
|
+
enumerable: true,
|
|
6
|
+
configurable: true,
|
|
7
|
+
writable: true,
|
|
8
|
+
value: void 0
|
|
9
|
+
});
|
|
10
|
+
this.name = 'ExecutionError';
|
|
11
|
+
this.ctx = ctx;
|
|
12
|
+
}
|
|
13
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { ContextProvider } from '../../context/ContextProvider.js';
|
|
2
|
+
import { Workflow } from '../../dsl/Workflow.js';
|
|
3
|
+
import { Logger } from '../../observability/logging/Logger.js';
|
|
4
|
+
import { ObservableCompiler } from './ObservableCompiler.js';
|
|
5
|
+
export type MemoryInterpreterOptions = {
|
|
6
|
+
logger?: Logger;
|
|
7
|
+
compiler?: ObservableCompiler;
|
|
8
|
+
contextProvider?: ContextProvider;
|
|
9
|
+
signal?: AbortSignal;
|
|
10
|
+
};
|
|
11
|
+
export declare class MemoryInterpreter {
|
|
12
|
+
private log;
|
|
13
|
+
private compiler;
|
|
14
|
+
private contextProvider;
|
|
15
|
+
constructor(options?: MemoryInterpreterOptions);
|
|
16
|
+
run<O>(workflow: Workflow<O>, options?: MemoryInterpreterOptions): Promise<void>;
|
|
17
|
+
}
|
|
18
|
+
//# sourceMappingURL=MemoryInterpreter.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"MemoryInterpreter.d.ts","sourceRoot":"","sources":["../../../src/interpreter/memory/MemoryInterpreter.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,eAAe,EAAuB,MAAM,kCAAkC,CAAC;AACxF,OAAO,EAAE,QAAQ,EAAgB,MAAM,uBAAuB,CAAC;AAC/D,OAAO,EAAE,MAAM,EAAE,MAAM,uCAAuC,CAAC;AAC/D,OAAO,EAAmB,kBAAkB,EAAE,MAAM,yBAAyB,CAAC;AAG9E,MAAM,MAAM,wBAAwB,GAAG;IACnC,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,QAAQ,CAAC,EAAE,kBAAkB,CAAC;IAC9B,eAAe,CAAC,EAAE,eAAe,CAAC;IAClC,MAAM,CAAC,EAAE,WAAW,CAAC;CACxB,CAAC;AAEF,qBAAa,iBAAiB;IAC1B,OAAO,CAAC,GAAG,CAAS;IACpB,OAAO,CAAC,QAAQ,CAAqB;IACrC,OAAO,CAAC,eAAe,CAAkB;gBAE7B,OAAO,GAAE,wBAA6B;IAMlD,GAAG,CAAC,CAAC,EAAE,QAAQ,EAAE,QAAQ,CAAC,CAAC,CAAC,EAAE,OAAO,CAAC,EAAE,wBAAwB,GAAG,OAAO,CAAC,IAAI,CAAC;CAyEnF"}
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
import * as dntShim from "../../_dnt.shims.js";
|
|
2
|
+
import { catchError, EMPTY, mergeMap, of, tap } from 'rxjs';
|
|
3
|
+
import { ContextProviderImpl } from '../../context/ContextProvider.js';
|
|
4
|
+
import { WorkflowImpl } from '../../dsl/Workflow.js';
|
|
5
|
+
import { ObservableCompiler } from './ObservableCompiler.js';
|
|
6
|
+
import { ConsoleLogger } from '../../observability/logging/ConsoleLogger.js';
|
|
7
|
+
export class MemoryInterpreter {
|
|
8
|
+
constructor(options = {}) {
|
|
9
|
+
Object.defineProperty(this, "log", {
|
|
10
|
+
enumerable: true,
|
|
11
|
+
configurable: true,
|
|
12
|
+
writable: true,
|
|
13
|
+
value: void 0
|
|
14
|
+
});
|
|
15
|
+
Object.defineProperty(this, "compiler", {
|
|
16
|
+
enumerable: true,
|
|
17
|
+
configurable: true,
|
|
18
|
+
writable: true,
|
|
19
|
+
value: void 0
|
|
20
|
+
});
|
|
21
|
+
Object.defineProperty(this, "contextProvider", {
|
|
22
|
+
enumerable: true,
|
|
23
|
+
configurable: true,
|
|
24
|
+
writable: true,
|
|
25
|
+
value: void 0
|
|
26
|
+
});
|
|
27
|
+
this.log = options.logger || new ConsoleLogger('debug');
|
|
28
|
+
this.compiler = options.compiler || new ObservableCompiler();
|
|
29
|
+
this.contextProvider = options.contextProvider || new ContextProviderImpl(this.log);
|
|
30
|
+
}
|
|
31
|
+
run(workflow, options) {
|
|
32
|
+
const localAbortController = new AbortController();
|
|
33
|
+
// Combine the local and passed-in abort signals
|
|
34
|
+
const combinedSignal = options?.signal
|
|
35
|
+
? AbortSignal.any([localAbortController.signal, options.signal])
|
|
36
|
+
: localAbortController.signal;
|
|
37
|
+
// TODO: test whether this is required once we can run outside of a Deno test.
|
|
38
|
+
const sigintListener = () => {
|
|
39
|
+
this.log.info('Received SIGINT, shutting down workflow');
|
|
40
|
+
localAbortController.abort();
|
|
41
|
+
};
|
|
42
|
+
dntShim.Deno.addSignalListener('SIGINT', sigintListener);
|
|
43
|
+
if (!(workflow instanceof WorkflowImpl)) {
|
|
44
|
+
throw new Error('workflow is not an instance of WorkflowImpl');
|
|
45
|
+
}
|
|
46
|
+
this.log.info('MemoryInterpreter.start', { workflow });
|
|
47
|
+
const compilerContext = {
|
|
48
|
+
compiler: this.compiler,
|
|
49
|
+
log: this.log,
|
|
50
|
+
contextProvider: this.contextProvider,
|
|
51
|
+
};
|
|
52
|
+
const trigger$ = this.compiler.compileTrigger(compilerContext, workflow.trigger, combinedSignal);
|
|
53
|
+
const task$ = this.compiler.compileTask(compilerContext, workflow.task);
|
|
54
|
+
return new Promise((resolve, reject) => {
|
|
55
|
+
trigger$
|
|
56
|
+
.pipe(tap((ctx) => {
|
|
57
|
+
ctx.log.info('MemoryInterpreter.executionStarted', { data: ctx.data });
|
|
58
|
+
}), mergeMap((ctx) => of(ctx).pipe(task$, catchError((error) => {
|
|
59
|
+
ctx.log.error('MemoryInterpreter.executionError', { error });
|
|
60
|
+
return EMPTY;
|
|
61
|
+
}))))
|
|
62
|
+
.subscribe({
|
|
63
|
+
next: (ctx) => {
|
|
64
|
+
const durationMs = Date.now() - ctx.startTime.getTime();
|
|
65
|
+
ctx.log.info('MemoryInterpreter.executionCompleted', {
|
|
66
|
+
durationMs,
|
|
67
|
+
data: ctx.data,
|
|
68
|
+
});
|
|
69
|
+
},
|
|
70
|
+
error: (err) => {
|
|
71
|
+
this.log.error('MemoryInterpreter.error', { error: err });
|
|
72
|
+
dntShim.Deno.removeSignalListener('SIGINT', sigintListener);
|
|
73
|
+
reject(err);
|
|
74
|
+
},
|
|
75
|
+
complete: () => {
|
|
76
|
+
this.log.info('MemoryInterpreter.workflowCompleted');
|
|
77
|
+
dntShim.Deno.removeSignalListener('SIGINT', sigintListener);
|
|
78
|
+
resolve();
|
|
79
|
+
},
|
|
80
|
+
});
|
|
81
|
+
});
|
|
82
|
+
}
|
|
83
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { Observable, OperatorFunction } from 'rxjs';
|
|
2
|
+
import { Task } from '../../dsl/Task.js';
|
|
3
|
+
import { Logger } from '../../observability/logging/Logger.js';
|
|
4
|
+
import { ContextOperatorFunction, TaskCompiler, TriggerCompiler } from './compilers/types.js';
|
|
5
|
+
import { Trigger } from '../../dsl/Trigger.js';
|
|
6
|
+
import { ContextProvider } from '../../context/ContextProvider.js';
|
|
7
|
+
import { ContextImpl } from '../../context/Context.js';
|
|
8
|
+
export type CompilerContext = {
|
|
9
|
+
compiler: ObservableCompiler;
|
|
10
|
+
log: Logger;
|
|
11
|
+
contextProvider: ContextProvider;
|
|
12
|
+
};
|
|
13
|
+
export type CompilerFunc<In = any, Out = any, T extends Task<In, Out> = Task<In, Out>> = (ctx: CompilerContext, task: T) => OperatorFunction<In, Out>;
|
|
14
|
+
export declare class ObservableCompiler {
|
|
15
|
+
private taskCompilers;
|
|
16
|
+
private triggerCompilers;
|
|
17
|
+
constructor();
|
|
18
|
+
compileTask<In = any, Out = any, Index = void>(ctx: CompilerContext, task: Task<In, Out>): ContextOperatorFunction<In, Out, Index>;
|
|
19
|
+
compileTrigger<Out = any, T extends Trigger<Out> = Trigger<Out>>(ctx: CompilerContext, trigger: T, signal: AbortSignal): Observable<ContextImpl<Out, void>>;
|
|
20
|
+
registerTask<In, Out, T extends Task<In, Out>>(compiler: TaskCompiler<In, Out, T>): void;
|
|
21
|
+
registerTrigger<Out, T extends Trigger<Out>>(compiler: TriggerCompiler<Out, T>): void;
|
|
22
|
+
}
|
|
23
|
+
//# sourceMappingURL=ObservableCompiler.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ObservableCompiler.d.ts","sourceRoot":"","sources":["../../../src/interpreter/memory/ObservableCompiler.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,gBAAgB,EAAE,MAAM,MAAM,CAAC;AACpD,OAAO,EAAE,IAAI,EAAY,MAAM,mBAAmB,CAAC;AACnD,OAAO,EAAE,MAAM,EAAE,MAAM,uCAAuC,CAAC;AAO/D,OAAO,EAAE,uBAAuB,EAAE,YAAY,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AAE9F,OAAO,EAAE,OAAO,EAAe,MAAM,sBAAsB,CAAC;AAE5D,OAAO,EAAE,eAAe,EAAE,MAAM,kCAAkC,CAAC;AACnE,OAAO,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAC;AAGvD,MAAM,MAAM,eAAe,GAAG;IAC1B,QAAQ,EAAE,kBAAkB,CAAC;IAC7B,GAAG,EAAE,MAAM,CAAC;IACZ,eAAe,EAAE,eAAe,CAAC;CACpC,CAAC;AAEF,MAAM,MAAM,YAAY,CAAC,EAAE,GAAG,GAAG,EAAE,GAAG,GAAG,GAAG,EAAE,CAAC,SAAS,IAAI,CAAC,EAAE,EAAE,GAAG,CAAC,GAAG,IAAI,CAAC,EAAE,EAAE,GAAG,CAAC,IAAI,CACrF,GAAG,EAAE,eAAe,EACpB,IAAI,EAAE,CAAC,KACN,gBAAgB,CAAC,EAAE,EAAE,GAAG,CAAC,CAAC;AAE/B,qBAAa,kBAAkB;IAC3B,OAAO,CAAC,aAAa,CAAkD;IACvE,OAAO,CAAC,gBAAgB,CAAgD;;IAexE,WAAW,CAAC,EAAE,GAAG,GAAG,EAAE,GAAG,GAAG,GAAG,EAAE,KAAK,GAAG,IAAI,EACzC,GAAG,EAAE,eAAe,EACpB,IAAI,EAAE,IAAI,CAAC,EAAE,EAAE,GAAG,CAAC,GACpB,uBAAuB,CAAC,EAAE,EAAE,GAAG,EAAE,KAAK,CAAC;IAa1C,cAAc,CAAC,GAAG,GAAG,GAAG,EAAE,CAAC,SAAS,OAAO,CAAC,GAAG,CAAC,GAAG,OAAO,CAAC,GAAG,CAAC,EAC3D,GAAG,EAAE,eAAe,EACpB,OAAO,EAAE,CAAC,EACV,MAAM,EAAE,WAAW,GACpB,UAAU,CAAC,WAAW,CAAC,GAAG,EAAE,IAAI,CAAC,CAAC;IAarC,YAAY,CAAC,EAAE,EAAE,GAAG,EAAE,CAAC,SAAS,IAAI,CAAC,EAAE,EAAE,GAAG,CAAC,EAAE,QAAQ,EAAE,YAAY,CAAC,EAAE,EAAE,GAAG,EAAE,CAAC,CAAC;IAKjF,eAAe,CAAC,GAAG,EAAE,CAAC,SAAS,OAAO,CAAC,GAAG,CAAC,EAAE,QAAQ,EAAE,eAAe,CAAC,GAAG,EAAE,CAAC,CAAC;CAIjF"}
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import { TaskType } from '../../dsl/Task.js';
|
|
2
|
+
import { backgroundCompiler } from './compilers/background.js';
|
|
3
|
+
import { catchCompiler } from './compilers/catch.js';
|
|
4
|
+
import { chainCompiler } from './compilers/chain.js';
|
|
5
|
+
import { fnCompiler } from './compilers/fn.js';
|
|
6
|
+
import { parallelCompiler } from './compilers/parallel.js';
|
|
7
|
+
import { serialCompiler } from './compilers/serial.js';
|
|
8
|
+
import { unpackCompiler } from './compilers/unpack.js';
|
|
9
|
+
import { TriggerType } from '../../dsl/Trigger.js';
|
|
10
|
+
import { scheduleCompiler } from './compilers/schedule.js';
|
|
11
|
+
import { httpCompiler } from './compilers/http.js';
|
|
12
|
+
export class ObservableCompiler {
|
|
13
|
+
constructor() {
|
|
14
|
+
Object.defineProperty(this, "taskCompilers", {
|
|
15
|
+
enumerable: true,
|
|
16
|
+
configurable: true,
|
|
17
|
+
writable: true,
|
|
18
|
+
value: new Map()
|
|
19
|
+
});
|
|
20
|
+
Object.defineProperty(this, "triggerCompilers", {
|
|
21
|
+
enumerable: true,
|
|
22
|
+
configurable: true,
|
|
23
|
+
writable: true,
|
|
24
|
+
value: new Map()
|
|
25
|
+
});
|
|
26
|
+
// Register all available compilers
|
|
27
|
+
this.registerTask(parallelCompiler);
|
|
28
|
+
this.registerTask(serialCompiler);
|
|
29
|
+
this.registerTask(catchCompiler);
|
|
30
|
+
this.registerTask(chainCompiler);
|
|
31
|
+
this.registerTask(fnCompiler);
|
|
32
|
+
this.registerTask(backgroundCompiler);
|
|
33
|
+
this.registerTask(unpackCompiler);
|
|
34
|
+
this.registerTask(httpCompiler);
|
|
35
|
+
this.registerTrigger(scheduleCompiler);
|
|
36
|
+
}
|
|
37
|
+
compileTask(ctx, task) {
|
|
38
|
+
const compiler = this.taskCompilers.get(task[TaskType]);
|
|
39
|
+
if (!compiler) {
|
|
40
|
+
throw new Error(`No compiler registered for task type: ${task[TaskType]}`);
|
|
41
|
+
}
|
|
42
|
+
if (!(task instanceof compiler.ctor)) {
|
|
43
|
+
throw new Error(`Task type mismatch: expected ${compiler.ctor.name}, got ${task.constructor.name}`);
|
|
44
|
+
}
|
|
45
|
+
return compiler.compile(ctx, task);
|
|
46
|
+
}
|
|
47
|
+
compileTrigger(ctx, trigger, signal) {
|
|
48
|
+
const compiler = this.triggerCompilers.get(trigger[TriggerType]);
|
|
49
|
+
if (!compiler) {
|
|
50
|
+
throw new Error(`No compiler registered for trigger type: ${trigger[TriggerType]}`);
|
|
51
|
+
}
|
|
52
|
+
if (!(trigger instanceof compiler.ctor)) {
|
|
53
|
+
throw new Error(`Trigger type mismatch: expected ${compiler.ctor.name}, got ${trigger.constructor.name}`);
|
|
54
|
+
}
|
|
55
|
+
return compiler.compile(ctx, trigger, signal);
|
|
56
|
+
}
|
|
57
|
+
registerTask(compiler) {
|
|
58
|
+
const task = new compiler.ctor();
|
|
59
|
+
this.taskCompilers.set(task[TaskType], compiler);
|
|
60
|
+
}
|
|
61
|
+
registerTrigger(compiler) {
|
|
62
|
+
const trigger = new compiler.ctor();
|
|
63
|
+
this.triggerCompilers.set(trigger[TriggerType], compiler);
|
|
64
|
+
}
|
|
65
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"background.d.ts","sourceRoot":"","sources":["../../../../src/interpreter/memory/compilers/background.ts"],"names":[],"mappings":"AAeA,OAAO,EAAE,cAAc,EAAE,MAAM,sCAAsC,CAAC;AAEtE,OAAO,EAA2B,YAAY,EAAE,MAAM,YAAY,CAAC;AAqCnE,eAAO,MAAM,kBAAkB,EAAE,YAAY,CAAC,GAAG,EAAE,GAAG,EAAE,cAAc,CAAC,GAAG,EAAE,GAAG,CAAC,CAG/E,CAAC"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { asyncScheduler, catchError, connect, EMPTY, ignoreElements, map, merge, mergeMap, of, subscribeOn, tap } from 'rxjs';
|
|
2
|
+
import { BackgroundTask } from '../../../dsl/tasks/BackgroundTask.js';
|
|
3
|
+
function compileBackground(ctx, task) {
|
|
4
|
+
const base = ctx.compiler.compileTask(ctx, task._base);
|
|
5
|
+
return (src) => src.pipe(connect((shared$) => merge(shared$.pipe(mergeMap((ctx) => base(of(ctx)).pipe(subscribeOn(asyncScheduler), tap({
|
|
6
|
+
next: (ctx) => ctx.log.debug('Background task emitted a value', { data: ctx.data }),
|
|
7
|
+
complete: () => ctx.log.debug('Background task completed'),
|
|
8
|
+
}), catchError((error) => {
|
|
9
|
+
ctx.log.error('Error in background task', {
|
|
10
|
+
error,
|
|
11
|
+
inputData: ctx.data,
|
|
12
|
+
executionId: ctx.executionId,
|
|
13
|
+
});
|
|
14
|
+
return EMPTY;
|
|
15
|
+
}), ignoreElements()))), shared$.pipe(map((ctx) => ctx.withData(void 0))))));
|
|
16
|
+
}
|
|
17
|
+
export const backgroundCompiler = {
|
|
18
|
+
ctor: BackgroundTask,
|
|
19
|
+
compile: compileBackground,
|
|
20
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"catch.d.ts","sourceRoot":"","sources":["../../../../src/interpreter/memory/compilers/catch.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,SAAS,EAAE,MAAM,iCAAiC,CAAC;AAG5D,OAAO,EAA2B,YAAY,EAAE,MAAM,YAAY,CAAC;AAwBnE,eAAO,MAAM,aAAa,EAAE,YAAY,CAAC,GAAG,EAAE,GAAG,EAAE,SAAS,CAAC,GAAG,EAAE,GAAG,CAAC,CAGrE,CAAC"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { catchError, mergeMap, of } from 'rxjs';
|
|
2
|
+
import { CatchTask } from '../../../dsl/tasks/CatchTask.js';
|
|
3
|
+
import { ExecutionError } from '../ExecutionError.js';
|
|
4
|
+
function compileCatch(ctx, task) {
|
|
5
|
+
const baseOperator = ctx.compiler.compileTask(ctx, task._base);
|
|
6
|
+
const errorOperator = ctx.compiler.compileTask(ctx, task._errorHandler);
|
|
7
|
+
return (src) => src.pipe(mergeMap((ctx) => {
|
|
8
|
+
return baseOperator(of(ctx)).pipe(catchError((error) => {
|
|
9
|
+
if (error instanceof Error) {
|
|
10
|
+
return errorOperator(of(ctx.withData(new ExecutionError(ctx, error.message, { cause: error }))));
|
|
11
|
+
}
|
|
12
|
+
return errorOperator(of(ctx.withData(new ExecutionError(ctx, `${error}`, { cause: error }))));
|
|
13
|
+
}));
|
|
14
|
+
}));
|
|
15
|
+
}
|
|
16
|
+
export const catchCompiler = {
|
|
17
|
+
ctor: CatchTask,
|
|
18
|
+
compile: compileCatch,
|
|
19
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"chain.d.ts","sourceRoot":"","sources":["../../../../src/interpreter/memory/compilers/chain.ts"],"names":[],"mappings":"AAIA,OAAO,EAA2B,YAAY,EAAE,MAAM,YAAY,CAAC;AAYnE,eAAO,MAAM,aAAa,EAAE,YAAY,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,CAGrD,CAAC"}
|