@versori/run 0.0.1-alpha.7 → 0.1.0-alpha.8
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/src/context/Context.d.ts +6 -1
- package/esm/src/context/Context.d.ts.map +1 -1
- package/esm/src/context/Context.js +17 -3
- package/esm/src/context/ContextProvider.d.ts +3 -2
- package/esm/src/context/ContextProvider.d.ts.map +1 -1
- package/esm/src/context/ContextProvider.js +2 -2
- package/esm/src/dsl/http/default.d.ts.map +1 -1
- package/esm/src/dsl/http/default.js +3 -1
- package/esm/src/dsl/http/types.d.ts +122 -16
- package/esm/src/dsl/http/types.d.ts.map +1 -1
- package/esm/src/dsl/http/types.js +6 -2
- package/esm/src/dsl/http/versori/configloader.d.ts +2 -2
- package/esm/src/dsl/http/versori/configloader.d.ts.map +1 -1
- package/esm/src/dsl/http/versori/configloader.js +9 -3
- package/esm/src/dsl/http/versori/constants.d.ts +10 -0
- package/esm/src/dsl/http/versori/constants.d.ts.map +1 -0
- package/esm/src/dsl/http/versori/constants.js +12 -0
- package/esm/src/dsl/http/versori/internalauth.d.ts.map +1 -1
- package/esm/src/dsl/http/versori/internalauth.js +10 -9
- package/esm/src/dsl/http/versori/platformapi.d.ts +14 -0
- package/esm/src/dsl/http/versori/platformapi.d.ts.map +1 -0
- package/esm/src/dsl/http/versori/platformapi.js +91 -0
- package/esm/src/dsl/http/versori/roundtripper.d.ts +13 -6
- package/esm/src/dsl/http/versori/roundtripper.d.ts.map +1 -1
- package/esm/src/dsl/http/versori/roundtripper.js +171 -54
- package/esm/src/dsl/tasks/HttpTask.d.ts +18 -2
- package/esm/src/dsl/tasks/HttpTask.d.ts.map +1 -1
- package/esm/src/dsl/tasks/HttpTask.js +82 -0
- package/esm/src/dsl/triggers/ScheduleTrigger.d.ts +6 -2
- package/esm/src/dsl/triggers/ScheduleTrigger.d.ts.map +1 -1
- package/esm/src/dsl/triggers/ScheduleTrigger.js +10 -3
- package/esm/src/interpreter/memory/MemoryInterpreter.d.ts +1 -0
- package/esm/src/interpreter/memory/MemoryInterpreter.d.ts.map +1 -1
- package/esm/src/interpreter/memory/MemoryInterpreter.js +12 -3
- package/esm/src/interpreter/memory/ObservableCompiler.d.ts +2 -1
- package/esm/src/interpreter/memory/ObservableCompiler.d.ts.map +1 -1
- package/esm/src/interpreter/memory/compilers/background.d.ts.map +1 -1
- package/esm/src/interpreter/memory/compilers/background.js +4 -2
- package/esm/src/interpreter/memory/compilers/http.d.ts.map +1 -1
- package/esm/src/interpreter/memory/compilers/http.js +6 -12
- package/esm/src/interpreter/memory/compilers/schedule.d.ts.map +1 -1
- package/esm/src/interpreter/memory/compilers/schedule.js +32 -6
- package/esm/src/interpreter/memory/compilers/serial.js +1 -1
- package/esm/src/interpreter/memory/compilers/webhook.d.ts.map +1 -1
- package/esm/src/interpreter/memory/compilers/webhook.js +20 -4
- package/package.json +2 -1
- package/script/src/context/Context.d.ts +6 -1
- package/script/src/context/Context.d.ts.map +1 -1
- package/script/src/context/Context.js +17 -3
- package/script/src/context/ContextProvider.d.ts +3 -2
- package/script/src/context/ContextProvider.d.ts.map +1 -1
- package/script/src/context/ContextProvider.js +2 -2
- package/script/src/dsl/http/default.d.ts.map +1 -1
- package/script/src/dsl/http/default.js +3 -1
- package/script/src/dsl/http/types.d.ts +122 -16
- package/script/src/dsl/http/types.d.ts.map +1 -1
- package/script/src/dsl/http/types.js +7 -1
- package/script/src/dsl/http/versori/configloader.d.ts +2 -2
- package/script/src/dsl/http/versori/configloader.d.ts.map +1 -1
- package/script/src/dsl/http/versori/configloader.js +10 -4
- package/script/src/dsl/http/versori/constants.d.ts +10 -0
- package/script/src/dsl/http/versori/constants.d.ts.map +1 -0
- package/script/src/dsl/http/versori/constants.js +15 -0
- package/script/src/dsl/http/versori/internalauth.d.ts.map +1 -1
- package/script/src/dsl/http/versori/internalauth.js +10 -9
- package/script/src/dsl/http/versori/platformapi.d.ts +14 -0
- package/script/src/dsl/http/versori/platformapi.d.ts.map +1 -0
- package/script/src/dsl/http/versori/platformapi.js +118 -0
- package/script/src/dsl/http/versori/roundtripper.d.ts +13 -6
- package/script/src/dsl/http/versori/roundtripper.d.ts.map +1 -1
- package/script/src/dsl/http/versori/roundtripper.js +170 -54
- package/script/src/dsl/tasks/HttpTask.d.ts +18 -2
- package/script/src/dsl/tasks/HttpTask.d.ts.map +1 -1
- package/script/src/dsl/tasks/HttpTask.js +84 -1
- package/script/src/dsl/triggers/ScheduleTrigger.d.ts +6 -2
- package/script/src/dsl/triggers/ScheduleTrigger.d.ts.map +1 -1
- package/script/src/dsl/triggers/ScheduleTrigger.js +10 -3
- package/script/src/interpreter/memory/MemoryInterpreter.d.ts +1 -0
- package/script/src/interpreter/memory/MemoryInterpreter.d.ts.map +1 -1
- package/script/src/interpreter/memory/MemoryInterpreter.js +12 -3
- package/script/src/interpreter/memory/ObservableCompiler.d.ts +2 -1
- package/script/src/interpreter/memory/ObservableCompiler.d.ts.map +1 -1
- package/script/src/interpreter/memory/compilers/background.d.ts.map +1 -1
- package/script/src/interpreter/memory/compilers/background.js +3 -1
- package/script/src/interpreter/memory/compilers/http.d.ts.map +1 -1
- package/script/src/interpreter/memory/compilers/http.js +5 -11
- package/script/src/interpreter/memory/compilers/schedule.d.ts.map +1 -1
- package/script/src/interpreter/memory/compilers/schedule.js +32 -6
- package/script/src/interpreter/memory/compilers/serial.js +1 -1
- package/script/src/interpreter/memory/compilers/webhook.d.ts.map +1 -1
- package/script/src/interpreter/memory/compilers/webhook.js +20 -4
- package/esm/src/dsl/http/versori/connectapi.d.ts +0 -11
- package/esm/src/dsl/http/versori/connectapi.d.ts.map +0 -1
- package/esm/src/dsl/http/versori/connectapi.js +0 -57
- package/script/src/dsl/http/versori/connectapi.d.ts +0 -11
- package/script/src/dsl/http/versori/connectapi.d.ts.map +0 -1
- package/script/src/dsl/http/versori/connectapi.js +0 -61
|
@@ -1,14 +1,18 @@
|
|
|
1
|
+
import { Activation } from '../http/types.js';
|
|
1
2
|
import { Taskable } from '../Task.js';
|
|
2
3
|
import { Trigger, TriggerType } from '../Trigger.js';
|
|
3
4
|
import { Workflow } from '../Workflow.js';
|
|
4
5
|
export type ScheduleData = Record<string, never>;
|
|
6
|
+
export type PrebuiltPredicate = 'all';
|
|
7
|
+
export type ActivationPredicate = PrebuiltPredicate | ((a?: Activation) => boolean);
|
|
5
8
|
export declare class ScheduleTrigger implements Trigger<ScheduleData> {
|
|
6
9
|
id: string;
|
|
7
10
|
[TriggerType]: string;
|
|
8
11
|
schedule: string;
|
|
9
|
-
|
|
12
|
+
activationPredicate?: ActivationPredicate;
|
|
13
|
+
constructor(id: string, schedule: string, activationPredicate?: ActivationPredicate);
|
|
10
14
|
then<OO>(task: Taskable<ScheduleData, OO>): Workflow<OO>;
|
|
11
15
|
catch<OO>(error: any): Workflow<OO>;
|
|
12
16
|
}
|
|
13
|
-
export declare function schedule(id: string, schedule: string): Workflow<ScheduleData>;
|
|
17
|
+
export declare function schedule(id: string, schedule: string, activationPredicate?: ActivationPredicate): Workflow<ScheduleData>;
|
|
14
18
|
//# sourceMappingURL=ScheduleTrigger.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ScheduleTrigger.d.ts","sourceRoot":"","sources":["../../../../src/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;
|
|
1
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
|
const Trigger_js_1 = require("../Trigger.js");
|
|
8
8
|
const Workflow_js_1 = require("../Workflow.js");
|
|
9
9
|
class ScheduleTrigger {
|
|
10
|
-
constructor(id, schedule) {
|
|
10
|
+
constructor(id, schedule, activationPredicate) {
|
|
11
11
|
Object.defineProperty(this, "id", {
|
|
12
12
|
enumerable: true,
|
|
13
13
|
configurable: true,
|
|
@@ -26,8 +26,15 @@ class ScheduleTrigger {
|
|
|
26
26
|
writable: true,
|
|
27
27
|
value: void 0
|
|
28
28
|
});
|
|
29
|
+
Object.defineProperty(this, "activationPredicate", {
|
|
30
|
+
enumerable: true,
|
|
31
|
+
configurable: true,
|
|
32
|
+
writable: true,
|
|
33
|
+
value: void 0
|
|
34
|
+
});
|
|
29
35
|
this.id = id;
|
|
30
36
|
this.schedule = schedule;
|
|
37
|
+
this.activationPredicate = activationPredicate;
|
|
31
38
|
}
|
|
32
39
|
then(task) {
|
|
33
40
|
return new Workflow_js_1.WorkflowImpl(this, (0, ensureTask_js_1.ensureTask)(task));
|
|
@@ -38,6 +45,6 @@ class ScheduleTrigger {
|
|
|
38
45
|
}
|
|
39
46
|
exports.ScheduleTrigger = ScheduleTrigger;
|
|
40
47
|
_a = Trigger_js_1.TriggerType;
|
|
41
|
-
function schedule(id, schedule) {
|
|
42
|
-
return new ScheduleTrigger(id, schedule);
|
|
48
|
+
function schedule(id, schedule, activationPredicate) {
|
|
49
|
+
return new ScheduleTrigger(id, schedule, activationPredicate);
|
|
43
50
|
}
|
|
@@ -15,6 +15,7 @@ export declare class MemoryInterpreter {
|
|
|
15
15
|
private contextProvider;
|
|
16
16
|
private roundTripperFactory;
|
|
17
17
|
private router;
|
|
18
|
+
private connectionProvider;
|
|
18
19
|
private registeredWorkflows;
|
|
19
20
|
constructor(options?: MemoryInterpreterOptions);
|
|
20
21
|
register<O>(workflow: Workflow<O>, options?: MemoryInterpreterOptions): {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MemoryInterpreter.d.ts","sourceRoot":"","sources":["../../../../src/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;
|
|
1
|
+
{"version":3,"file":"MemoryInterpreter.d.ts","sourceRoot":"","sources":["../../../../src/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;AAQ9E,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;IACrB,sBAAsB,CAAC,EAAE,OAAO,CAAC;CACpC,CAAC;AAEF,qBAAa,iBAAiB;IAC1B,OAAO,CAAC,GAAG,CAAS;IACpB,OAAO,CAAC,QAAQ,CAAqB;IACrC,OAAO,CAAC,eAAe,CAAkB;IACzC,OAAO,CAAC,mBAAmB,CAAsB;IACjD,OAAO,CAAC,MAAM,CAAS;IACvB,OAAO,CAAC,kBAAkB,CAAqB;IAE/C,OAAO,CAAC,mBAAmB,CAKnB;gBAEI,OAAO,GAAE,wBAA6B;IASlD,QAAQ,CAAC,CAAC,EAAE,QAAQ,EAAE,QAAQ,CAAC,CAAC,CAAC,EAAE,OAAO,CAAC,EAAE,wBAAwB;kBAE3C,GAAG;eACN,GAAG;;;;IAuCpB,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC;CAwD/B"}
|
|
@@ -34,8 +34,9 @@ const Workflow_js_1 = require("../../dsl/Workflow.js");
|
|
|
34
34
|
const ObservableCompiler_js_1 = require("./ObservableCompiler.js");
|
|
35
35
|
const ConsoleLogger_js_1 = require("../../observability/logging/ConsoleLogger.js");
|
|
36
36
|
const default_js_1 = require("../../dsl/http/default.js");
|
|
37
|
-
const roundtripper_js_1 = require("../../dsl/http/versori/roundtripper.js");
|
|
38
37
|
const express_1 = __importDefault(require("express"));
|
|
38
|
+
const platformapi_js_1 = require("../../dsl/http/versori/platformapi.js");
|
|
39
|
+
const roundtripper_js_1 = require("../../dsl/http/versori/roundtripper.js");
|
|
39
40
|
class MemoryInterpreter {
|
|
40
41
|
constructor(options = {}) {
|
|
41
42
|
Object.defineProperty(this, "log", {
|
|
@@ -68,6 +69,12 @@ class MemoryInterpreter {
|
|
|
68
69
|
writable: true,
|
|
69
70
|
value: void 0
|
|
70
71
|
});
|
|
72
|
+
Object.defineProperty(this, "connectionProvider", {
|
|
73
|
+
enumerable: true,
|
|
74
|
+
configurable: true,
|
|
75
|
+
writable: true,
|
|
76
|
+
value: void 0
|
|
77
|
+
});
|
|
71
78
|
Object.defineProperty(this, "registeredWorkflows", {
|
|
72
79
|
enumerable: true,
|
|
73
80
|
configurable: true,
|
|
@@ -77,8 +84,9 @@ class MemoryInterpreter {
|
|
|
77
84
|
this.log = options.logger || new ConsoleLogger_js_1.ConsoleLogger('debug');
|
|
78
85
|
this.compiler = options.compiler || new ObservableCompiler_js_1.ObservableCompiler();
|
|
79
86
|
this.contextProvider = options.contextProvider || new ContextProvider_js_1.ContextProviderImpl(this.log);
|
|
80
|
-
this.roundTripperFactory = options.skipVersoriCredentials ? new default_js_1.DefaultRoundTripperFactory() :
|
|
87
|
+
this.roundTripperFactory = options.skipVersoriCredentials ? new default_js_1.DefaultRoundTripperFactory() : roundtripper_js_1.VersoriRoundTripperFactory.fromEnv(this.log);
|
|
81
88
|
this.router = express_1.default.Router();
|
|
89
|
+
this.connectionProvider = platformapi_js_1.PlatformAPIClient.fromEnv();
|
|
82
90
|
}
|
|
83
91
|
register(workflow, options) {
|
|
84
92
|
const registration = {
|
|
@@ -102,7 +110,8 @@ class MemoryInterpreter {
|
|
|
102
110
|
log: this.log,
|
|
103
111
|
contextProvider: this.contextProvider,
|
|
104
112
|
roundTripperFactory: this.roundTripperFactory,
|
|
105
|
-
router: this.router
|
|
113
|
+
router: this.router,
|
|
114
|
+
connectionProvider: this.connectionProvider
|
|
106
115
|
};
|
|
107
116
|
registration.trigger$ = this.compiler.compileTrigger(compilerContext, workflow.trigger, combinedSignal);
|
|
108
117
|
registration.task$ = this.compiler.compileTask(compilerContext, workflow.task);
|
|
@@ -5,13 +5,14 @@ import { ContextOperatorFunction, TaskCompiler, TriggerCompiler } from './compil
|
|
|
5
5
|
import { Trigger } from '../../dsl/Trigger.js';
|
|
6
6
|
import { ContextProvider } from '../../context/ContextProvider.js';
|
|
7
7
|
import { ContextImpl } from '../../context/Context.js';
|
|
8
|
-
import { RoundTripperFactory } from '../../dsl/http/types.js';
|
|
8
|
+
import { ConnectionProvider, RoundTripperFactory } from '../../dsl/http/types.js';
|
|
9
9
|
import { Router } from 'express';
|
|
10
10
|
export type CompilerContext = {
|
|
11
11
|
compiler: ObservableCompiler;
|
|
12
12
|
log: Logger;
|
|
13
13
|
contextProvider: ContextProvider;
|
|
14
14
|
roundTripperFactory: RoundTripperFactory;
|
|
15
|
+
connectionProvider: ConnectionProvider;
|
|
15
16
|
router: Router;
|
|
16
17
|
};
|
|
17
18
|
export type CompilerFunc<In = any, Out = any, T extends Task<In, Out> = Task<In, Out>> = (ctx: CompilerContext, task: T) => OperatorFunction<In, Out>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ObservableCompiler.d.ts","sourceRoot":"","sources":["../../../../src/src/interpreter/memory/ObservableCompiler.ts"],"names":[],"mappings":"AAAA,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.d.ts","sourceRoot":"","sources":["../../../../../src/src/interpreter/memory/compilers/background.ts"],"names":[],"mappings":"AAeA,OAAO,EAAE,cAAc,EAAE,MAAM,sCAAsC,CAAC;AAEtE,OAAO,EAA2B,YAAY,EAAE,MAAM,YAAY,CAAC;
|
|
1
|
+
{"version":3,"file":"background.d.ts","sourceRoot":"","sources":["../../../../../src/src/interpreter/memory/compilers/background.ts"],"names":[],"mappings":"AAeA,OAAO,EAAE,cAAc,EAAE,MAAM,sCAAsC,CAAC;AAEtE,OAAO,EAA2B,YAAY,EAAE,MAAM,YAAY,CAAC;AA0CnE,eAAO,MAAM,kBAAkB,EAAE,YAAY,CAAC,GAAG,EAAE,GAAG,EAAE,cAAc,CAAC,GAAG,EAAE,GAAG,CAAC,CAG/E,CAAC"}
|
|
@@ -6,7 +6,9 @@ const BackgroundTask_js_1 = require("../../../dsl/tasks/BackgroundTask.js");
|
|
|
6
6
|
function compileBackground(ctx, task) {
|
|
7
7
|
const base = ctx.compiler.compileTask(ctx, task._base);
|
|
8
8
|
return (src) => src.pipe((0, rxjs_1.connect)((shared$) => (0, rxjs_1.merge)(shared$.pipe((0, rxjs_1.mergeMap)((ctx) => base((0, rxjs_1.of)(ctx)).pipe((0, rxjs_1.subscribeOn)(rxjs_1.asyncScheduler), (0, rxjs_1.tap)({
|
|
9
|
-
next: (ctx) => ctx.log.debug('Background task emitted a value', {
|
|
9
|
+
next: (ctx) => ctx.log.debug('Background task emitted a value', {
|
|
10
|
+
data: ctx.data,
|
|
11
|
+
}),
|
|
10
12
|
complete: () => ctx.log.debug('Background task completed'),
|
|
11
13
|
}), (0, rxjs_1.catchError)((error) => {
|
|
12
14
|
ctx.log.error('Error in background task', {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"http.d.ts","sourceRoot":"","sources":["../../../../../src/src/interpreter/memory/compilers/http.ts"],"names":[],"mappings":"AAGA,OAAO,
|
|
1
|
+
{"version":3,"file":"http.d.ts","sourceRoot":"","sources":["../../../../../src/src/interpreter/memory/compilers/http.ts"],"names":[],"mappings":"AAGA,OAAO,EAAmB,YAAY,EAAE,MAAM,gCAAgC,CAAC;AAE/E,OAAO,EAA2B,YAAY,EAAE,MAAM,YAAY,CAAC;AAkCnE,eAAO,MAAM,YAAY,EAAE,YAAY,CAAC,GAAG,EAAE,GAAG,EAAE,YAAY,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,CAAC,CAG5E,CAAC"}
|
|
@@ -5,20 +5,14 @@ const rxjs_1 = require("rxjs");
|
|
|
5
5
|
const operators_1 = require("rxjs/operators");
|
|
6
6
|
const HttpTask_js_1 = require("../../../dsl/tasks/HttpTask.js");
|
|
7
7
|
function compileHttp(ctx, task) {
|
|
8
|
-
const roundtripper = ctx.roundTripperFactory.create(task.opts.connection, fetch);
|
|
8
|
+
const roundtripper = ctx.roundTripperFactory.create(task.opts.connection, globalThis.fetch);
|
|
9
|
+
const dynamicFetcher = ctx.roundTripperFactory.createDynamic(task.opts.connection, globalThis.fetch);
|
|
9
10
|
return (src) => src.pipe((0, operators_1.tap)({
|
|
10
|
-
complete: () => ctx.log.debug('http.complete')
|
|
11
|
+
complete: () => ctx.log.debug('http.complete'),
|
|
11
12
|
}), (0, rxjs_1.mergeMap)(async (ctx) => {
|
|
12
13
|
const _fetch = await roundtripper;
|
|
13
|
-
const
|
|
14
|
-
|
|
15
|
-
fetch: _fetch,
|
|
16
|
-
connectionVariables: {}, // TODO: Implement connection variables
|
|
17
|
-
pageParams: undefined,
|
|
18
|
-
nextPage: () => {
|
|
19
|
-
throw new Error('Pagination not yet implemented');
|
|
20
|
-
},
|
|
21
|
-
};
|
|
14
|
+
const _dynamicFetcher = await dynamicFetcher;
|
|
15
|
+
const httpContext = new HttpTask_js_1.HttpContextImpl(ctx, {}, _fetch, _dynamicFetcher);
|
|
22
16
|
const result = await task.fn(httpContext);
|
|
23
17
|
return ctx.withData(result);
|
|
24
18
|
}));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"schedule.d.ts","sourceRoot":"","sources":["../../../../../src/src/interpreter/memory/compilers/schedule.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,YAAY,EAAE,eAAe,EAAE,MAAM,0CAA0C,CAAC;AAEzF,OAAO,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;
|
|
1
|
+
{"version":3,"file":"schedule.d.ts","sourceRoot":"","sources":["../../../../../src/src/interpreter/memory/compilers/schedule.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,YAAY,EAAE,eAAe,EAAE,MAAM,0CAA0C,CAAC;AAEzF,OAAO,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;AA6F7C,eAAO,MAAM,gBAAgB,EAAE,eAAe,CAAC,YAAY,EAAE,eAAe,CAG3E,CAAC"}
|
|
@@ -6,16 +6,42 @@ const rxjs_1 = require("rxjs");
|
|
|
6
6
|
const ScheduleTrigger_js_1 = require("../../../dsl/triggers/ScheduleTrigger.js");
|
|
7
7
|
function compileSchedule(ctx, trigger, signal) {
|
|
8
8
|
return new rxjs_1.Observable((subscriber) => {
|
|
9
|
+
const client = ctx.connectionProvider;
|
|
9
10
|
const job = cron_1.CronJob.from({
|
|
10
11
|
cronTime: trigger.schedule,
|
|
11
|
-
onTick: () => {
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
12
|
+
onTick: async () => {
|
|
13
|
+
if (trigger.activationPredicate === undefined) {
|
|
14
|
+
const executionCtx = ctx.contextProvider.create({}, undefined);
|
|
15
|
+
try {
|
|
16
|
+
subscriber.next(executionCtx);
|
|
17
|
+
}
|
|
18
|
+
catch (error) {
|
|
19
|
+
executionCtx.log.error('execution error inside schedule', { error });
|
|
20
|
+
}
|
|
21
|
+
return;
|
|
15
22
|
}
|
|
16
|
-
|
|
17
|
-
|
|
23
|
+
const activations = await client.listActivations();
|
|
24
|
+
if (!activations || activations.length === 0) {
|
|
25
|
+
const executionCtx = ctx.contextProvider.create({}, undefined);
|
|
26
|
+
executionCtx.log.info('no activations found, continuing');
|
|
27
|
+
try {
|
|
28
|
+
subscriber.next(executionCtx);
|
|
29
|
+
}
|
|
30
|
+
catch (error) {
|
|
31
|
+
executionCtx.log.error('execution error inside schedule', { error });
|
|
32
|
+
}
|
|
33
|
+
return;
|
|
18
34
|
}
|
|
35
|
+
activations.forEach((activation) => {
|
|
36
|
+
const executionCtx = ctx.contextProvider.create({}, activation);
|
|
37
|
+
executionCtx.log.info('no activations found, continuing');
|
|
38
|
+
try {
|
|
39
|
+
subscriber.next(executionCtx);
|
|
40
|
+
}
|
|
41
|
+
catch (error) {
|
|
42
|
+
executionCtx.log.error('execution error inside schedule', { error });
|
|
43
|
+
}
|
|
44
|
+
});
|
|
19
45
|
},
|
|
20
46
|
onComplete: () => {
|
|
21
47
|
if (subscriber.closed) {
|
|
@@ -7,7 +7,7 @@ function compileSerial(ctx, task) {
|
|
|
7
7
|
const baseOperator = ctx.compiler.compileTask(ctx, task._base);
|
|
8
8
|
const eachOperator = ctx.compiler.compileTask(ctx, task._each);
|
|
9
9
|
return (src) => src.pipe((0, rxjs_1.tap)({
|
|
10
|
-
complete: () => ctx.log.debug('serial.complete')
|
|
10
|
+
complete: () => ctx.log.debug('serial.complete'),
|
|
11
11
|
}), baseOperator, (0, rxjs_1.mergeMap)((ctx) => {
|
|
12
12
|
const tasks = ctx.data.map((d, idx) => eachOperator((0, rxjs_1.of)(ctx.withData(d).setIndex(idx))));
|
|
13
13
|
return (0, rxjs_1.concat)(...tasks).pipe((0, rxjs_1.map)((result) => result.data), (0, rxjs_1.toArray)(), (0, rxjs_1.map)((results) => ctx.withData(results)));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"webhook.d.ts","sourceRoot":"","sources":["../../../../../src/src/interpreter/memory/compilers/webhook.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,WAAW,EAAE,cAAc,EAAE,MAAM,yCAAyC,CAAC;AACtF,OAAO,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;
|
|
1
|
+
{"version":3,"file":"webhook.d.ts","sourceRoot":"","sources":["../../../../../src/src/interpreter/memory/compilers/webhook.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,WAAW,EAAE,cAAc,EAAE,MAAM,yCAAyC,CAAC;AACtF,OAAO,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;AAM7C,eAAO,MAAM,eAAe,EAAE,eAAe,CAAC,WAAW,EAAE,cAAc,CA6DxE,CAAC"}
|
|
@@ -13,10 +13,26 @@ exports.webhookCompiler = {
|
|
|
13
13
|
}
|
|
14
14
|
// add the webhook endpoint to the router
|
|
15
15
|
ctx.log.info('webhook endpoint added:', { trigger });
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
ctx.
|
|
19
|
-
|
|
16
|
+
// endpoint for sans user because I'm not quite sure how the dynamic routing works
|
|
17
|
+
ctx.router.post(`/${trigger.id}`, (req, res) => {
|
|
18
|
+
const executionCtx = ctx.contextProvider.create(req.body, undefined);
|
|
19
|
+
try {
|
|
20
|
+
subscriber.next(executionCtx);
|
|
21
|
+
res.status(200).json({ status: "accepted" });
|
|
22
|
+
}
|
|
23
|
+
catch (error) {
|
|
24
|
+
const message = error instanceof Error ? error.message : 'Unknown error';
|
|
25
|
+
executionCtx.log.error('webhook execution error', { error });
|
|
26
|
+
res.status(500).json({ status: "error", message });
|
|
27
|
+
}
|
|
28
|
+
});
|
|
29
|
+
ctx.router.post(`/${trigger.id}/:activationId`, (req, res) => {
|
|
30
|
+
const activationId = req.params.activationId || undefined;
|
|
31
|
+
let activation = undefined;
|
|
32
|
+
if (activationId) {
|
|
33
|
+
activation = { id: activationId };
|
|
34
|
+
}
|
|
35
|
+
const executionCtx = ctx.contextProvider.create(req.body, activation);
|
|
20
36
|
try {
|
|
21
37
|
subscriber.next(executionCtx);
|
|
22
38
|
res.status(200).json({ status: "accepted" });
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import { Connection } from '../types.js';
|
|
2
|
-
export declare class ConnectAPIClient {
|
|
3
|
-
private baseUrl;
|
|
4
|
-
private orgId;
|
|
5
|
-
private serviceConnId;
|
|
6
|
-
private internalAuth;
|
|
7
|
-
private cache;
|
|
8
|
-
constructor(baseUrl: string, orgId: string, serviceConnId: string, cache?: Record<string, Connection>);
|
|
9
|
-
getConnection(cnxId: string): Promise<Connection | undefined>;
|
|
10
|
-
}
|
|
11
|
-
//# sourceMappingURL=connectapi.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"connectapi.d.ts","sourceRoot":"","sources":["../../../../../src/src/dsl/http/versori/connectapi.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAGzC,qBAAa,gBAAgB;IACzB,OAAO,CAAC,OAAO,CAAS;IAExB,OAAO,CAAC,KAAK,CAAS;IAEtB,OAAO,CAAC,aAAa,CAAS;IAE9B,OAAO,CAAC,YAAY,CAAe;IAEnC,OAAO,CAAC,KAAK,CAA6B;gBAGtC,OAAO,EAAE,MAAM,EACf,KAAK,EAAE,MAAM,EACb,aAAa,EAAE,MAAM,EACrB,KAAK,GAAE,MAAM,CAAC,MAAM,EAAE,UAAU,CAAM;IASpC,aAAa,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,UAAU,GAAG,SAAS,CAAC;CAwBtE"}
|
|
@@ -1,57 +0,0 @@
|
|
|
1
|
-
import { InternalAuth } from './internalauth.js';
|
|
2
|
-
export class ConnectAPIClient {
|
|
3
|
-
constructor(baseUrl, orgId, serviceConnId, cache = {} // for now this is an in-memory cache
|
|
4
|
-
) {
|
|
5
|
-
Object.defineProperty(this, "baseUrl", {
|
|
6
|
-
enumerable: true,
|
|
7
|
-
configurable: true,
|
|
8
|
-
writable: true,
|
|
9
|
-
value: void 0
|
|
10
|
-
});
|
|
11
|
-
Object.defineProperty(this, "orgId", {
|
|
12
|
-
enumerable: true,
|
|
13
|
-
configurable: true,
|
|
14
|
-
writable: true,
|
|
15
|
-
value: void 0
|
|
16
|
-
});
|
|
17
|
-
Object.defineProperty(this, "serviceConnId", {
|
|
18
|
-
enumerable: true,
|
|
19
|
-
configurable: true,
|
|
20
|
-
writable: true,
|
|
21
|
-
value: void 0
|
|
22
|
-
});
|
|
23
|
-
Object.defineProperty(this, "internalAuth", {
|
|
24
|
-
enumerable: true,
|
|
25
|
-
configurable: true,
|
|
26
|
-
writable: true,
|
|
27
|
-
value: void 0
|
|
28
|
-
});
|
|
29
|
-
Object.defineProperty(this, "cache", {
|
|
30
|
-
enumerable: true,
|
|
31
|
-
configurable: true,
|
|
32
|
-
writable: true,
|
|
33
|
-
value: void 0
|
|
34
|
-
});
|
|
35
|
-
this.baseUrl = baseUrl;
|
|
36
|
-
this.orgId = orgId;
|
|
37
|
-
this.cache = cache;
|
|
38
|
-
this.serviceConnId = serviceConnId;
|
|
39
|
-
this.internalAuth = new InternalAuth();
|
|
40
|
-
}
|
|
41
|
-
async getConnection(cnxId) {
|
|
42
|
-
if (this.cache[cnxId]) {
|
|
43
|
-
return this.cache[cnxId];
|
|
44
|
-
}
|
|
45
|
-
const resp = await fetch(`${this.baseUrl}/connect/v1/o/${this.orgId}/connectors/${this.serviceConnId}/connections/${cnxId}`, {
|
|
46
|
-
headers: {
|
|
47
|
-
'x-versori-internal-token': await this.internalAuth.getToken(),
|
|
48
|
-
},
|
|
49
|
-
});
|
|
50
|
-
if (!resp.ok) {
|
|
51
|
-
return undefined;
|
|
52
|
-
}
|
|
53
|
-
const result = (await resp.json());
|
|
54
|
-
this.cache[cnxId] = result;
|
|
55
|
-
return result;
|
|
56
|
-
}
|
|
57
|
-
}
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import { Connection } from '../types.js';
|
|
2
|
-
export declare class ConnectAPIClient {
|
|
3
|
-
private baseUrl;
|
|
4
|
-
private orgId;
|
|
5
|
-
private serviceConnId;
|
|
6
|
-
private internalAuth;
|
|
7
|
-
private cache;
|
|
8
|
-
constructor(baseUrl: string, orgId: string, serviceConnId: string, cache?: Record<string, Connection>);
|
|
9
|
-
getConnection(cnxId: string): Promise<Connection | undefined>;
|
|
10
|
-
}
|
|
11
|
-
//# sourceMappingURL=connectapi.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"connectapi.d.ts","sourceRoot":"","sources":["../../../../../src/src/dsl/http/versori/connectapi.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAGzC,qBAAa,gBAAgB;IACzB,OAAO,CAAC,OAAO,CAAS;IAExB,OAAO,CAAC,KAAK,CAAS;IAEtB,OAAO,CAAC,aAAa,CAAS;IAE9B,OAAO,CAAC,YAAY,CAAe;IAEnC,OAAO,CAAC,KAAK,CAA6B;gBAGtC,OAAO,EAAE,MAAM,EACf,KAAK,EAAE,MAAM,EACb,aAAa,EAAE,MAAM,EACrB,KAAK,GAAE,MAAM,CAAC,MAAM,EAAE,UAAU,CAAM;IASpC,aAAa,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,UAAU,GAAG,SAAS,CAAC;CAwBtE"}
|
|
@@ -1,61 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.ConnectAPIClient = void 0;
|
|
4
|
-
const internalauth_js_1 = require("./internalauth.js");
|
|
5
|
-
class ConnectAPIClient {
|
|
6
|
-
constructor(baseUrl, orgId, serviceConnId, cache = {} // for now this is an in-memory cache
|
|
7
|
-
) {
|
|
8
|
-
Object.defineProperty(this, "baseUrl", {
|
|
9
|
-
enumerable: true,
|
|
10
|
-
configurable: true,
|
|
11
|
-
writable: true,
|
|
12
|
-
value: void 0
|
|
13
|
-
});
|
|
14
|
-
Object.defineProperty(this, "orgId", {
|
|
15
|
-
enumerable: true,
|
|
16
|
-
configurable: true,
|
|
17
|
-
writable: true,
|
|
18
|
-
value: void 0
|
|
19
|
-
});
|
|
20
|
-
Object.defineProperty(this, "serviceConnId", {
|
|
21
|
-
enumerable: true,
|
|
22
|
-
configurable: true,
|
|
23
|
-
writable: true,
|
|
24
|
-
value: void 0
|
|
25
|
-
});
|
|
26
|
-
Object.defineProperty(this, "internalAuth", {
|
|
27
|
-
enumerable: true,
|
|
28
|
-
configurable: true,
|
|
29
|
-
writable: true,
|
|
30
|
-
value: void 0
|
|
31
|
-
});
|
|
32
|
-
Object.defineProperty(this, "cache", {
|
|
33
|
-
enumerable: true,
|
|
34
|
-
configurable: true,
|
|
35
|
-
writable: true,
|
|
36
|
-
value: void 0
|
|
37
|
-
});
|
|
38
|
-
this.baseUrl = baseUrl;
|
|
39
|
-
this.orgId = orgId;
|
|
40
|
-
this.cache = cache;
|
|
41
|
-
this.serviceConnId = serviceConnId;
|
|
42
|
-
this.internalAuth = new internalauth_js_1.InternalAuth();
|
|
43
|
-
}
|
|
44
|
-
async getConnection(cnxId) {
|
|
45
|
-
if (this.cache[cnxId]) {
|
|
46
|
-
return this.cache[cnxId];
|
|
47
|
-
}
|
|
48
|
-
const resp = await fetch(`${this.baseUrl}/connect/v1/o/${this.orgId}/connectors/${this.serviceConnId}/connections/${cnxId}`, {
|
|
49
|
-
headers: {
|
|
50
|
-
'x-versori-internal-token': await this.internalAuth.getToken(),
|
|
51
|
-
},
|
|
52
|
-
});
|
|
53
|
-
if (!resp.ok) {
|
|
54
|
-
return undefined;
|
|
55
|
-
}
|
|
56
|
-
const result = (await resp.json());
|
|
57
|
-
this.cache[cnxId] = result;
|
|
58
|
-
return result;
|
|
59
|
-
}
|
|
60
|
-
}
|
|
61
|
-
exports.ConnectAPIClient = ConnectAPIClient;
|