@versori/run 0.3.0-veta.2 → 0.4.0-alpha.1
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/connection/DirectConnectionFactory.d.ts +1 -1
- package/esm/src/connection/DirectConnectionFactory.d.ts.map +1 -1
- package/esm/src/connection/DirectConnectionFactory.js +6 -9
- package/esm/src/connection/StaticFetchFactory.d.ts.map +1 -1
- package/esm/src/connection/internal/CredentialHolder.d.ts.map +1 -1
- package/esm/src/connection/internal/CredentialHolder.js +11 -2
- package/esm/src/connection/internal/FetchBuilder.d.ts +3 -2
- package/esm/src/connection/internal/FetchBuilder.d.ts.map +1 -1
- package/esm/src/connection/internal/FetchBuilder.js +103 -4
- package/esm/src/connection/internal/OutboundConnectionFactory.d.ts +1 -1
- package/esm/src/connection/internal/OutboundConnectionFactory.d.ts.map +1 -1
- package/esm/src/connection/internal/OutboundConnectionFactory.js +2 -3
- package/esm/src/context/AsyncWorkflow.js +1 -1
- package/esm/src/context/Context.d.ts +7 -6
- package/esm/src/context/Context.d.ts.map +1 -1
- package/esm/src/context/Context.js +3 -13
- package/esm/src/context/ContextProvider.d.ts +1 -3
- package/esm/src/context/ContextProvider.d.ts.map +1 -1
- package/esm/src/context/ContextProvider.js +3 -6
- package/esm/src/dsl/Workflow.d.ts.map +1 -1
- package/esm/src/dsl/Workflow.js +2 -0
- package/esm/src/dsl/http/versori/configloader.js +1 -1
- package/esm/src/dsl/http/versori/cronapi.d.ts +2 -3
- package/esm/src/dsl/http/versori/cronapi.d.ts.map +1 -1
- package/esm/src/dsl/http/versori/cronapi.js +14 -14
- package/esm/src/dsl/http/versori/kvapi/core/OpenAPI.js +1 -1
- package/esm/src/dsl/http/versori/webhookmiddleware.d.ts +1 -1
- package/esm/src/dsl/http/versori/webhookmiddleware.d.ts.map +1 -1
- package/esm/src/dsl/http/versori/webhookmiddleware.js +24 -19
- package/esm/src/dsl/tasks/HttpTask.d.ts +1 -2
- package/esm/src/dsl/tasks/HttpTask.d.ts.map +1 -1
- package/esm/src/dsl/tasks/HttpTask.js +0 -3
- package/esm/src/dsl/triggers/DurableTrigger.d.ts +1 -0
- package/esm/src/dsl/triggers/DurableTrigger.d.ts.map +1 -1
- package/esm/src/dsl/triggers/WebhookTrigger.d.ts.map +1 -1
- package/esm/src/dsl/triggers/WebhookTrigger.js +3 -1
- package/esm/src/internal/constants.d.ts +3 -1
- package/esm/src/internal/constants.d.ts.map +1 -1
- package/esm/src/internal/constants.js +4 -1
- package/esm/src/internal/supervisor.d.ts +21 -0
- package/esm/src/internal/supervisor.d.ts.map +1 -0
- package/esm/src/internal/supervisor.js +113 -0
- package/esm/src/interpreter/durable/DurableInterpreter.d.ts +8 -2
- package/esm/src/interpreter/durable/DurableInterpreter.d.ts.map +1 -1
- package/esm/src/interpreter/durable/DurableInterpreter.js +62 -22
- package/esm/src/interpreter/durable/ObservableCompiler.d.ts +6 -1
- package/esm/src/interpreter/durable/ObservableCompiler.d.ts.map +1 -1
- package/esm/src/interpreter/durable/Queue.d.ts +16 -24
- package/esm/src/interpreter/durable/Queue.d.ts.map +1 -1
- package/esm/src/interpreter/durable/Queue.js +5 -4
- package/esm/src/interpreter/durable/compilers/catch.d.ts.map +1 -1
- package/esm/src/interpreter/durable/compilers/catch.js +3 -2
- package/esm/src/interpreter/durable/compilers/durableworkflow.d.ts.map +1 -1
- package/esm/src/interpreter/durable/compilers/durableworkflow.js +19 -19
- package/esm/src/interpreter/durable/compilers/fn.d.ts.map +1 -1
- package/esm/src/interpreter/durable/compilers/fn.js +17 -4
- package/esm/src/interpreter/durable/compilers/http.d.ts.map +1 -1
- package/esm/src/interpreter/durable/compilers/http.js +8 -2
- package/esm/src/interpreter/durable/compilers/schedule.d.ts.map +1 -1
- package/esm/src/interpreter/durable/compilers/schedule.js +2 -1
- package/esm/src/interpreter/durable/compilers/webhook.d.ts.map +1 -1
- package/esm/src/interpreter/durable/compilers/webhook.js +4 -1
- package/esm/src/interpreter/memory/MemoryInterpreter.d.ts +8 -2
- package/esm/src/interpreter/memory/MemoryInterpreter.d.ts.map +1 -1
- package/esm/src/interpreter/memory/MemoryInterpreter.js +46 -18
- package/esm/src/interpreter/memory/ObservableCompiler.d.ts +6 -1
- package/esm/src/interpreter/memory/ObservableCompiler.d.ts.map +1 -1
- package/esm/src/interpreter/memory/compilers/catch.d.ts.map +1 -1
- package/esm/src/interpreter/memory/compilers/catch.js +3 -2
- package/esm/src/interpreter/memory/compilers/fn.d.ts.map +1 -1
- package/esm/src/interpreter/memory/compilers/fn.js +17 -4
- package/esm/src/interpreter/memory/compilers/http.d.ts.map +1 -1
- package/esm/src/interpreter/memory/compilers/http.js +33 -3
- package/esm/src/interpreter/memory/compilers/schedule.d.ts.map +1 -1
- package/esm/src/interpreter/memory/compilers/schedule.js +2 -1
- package/esm/src/interpreter/memory/compilers/webhook.d.ts.map +1 -1
- package/esm/src/interpreter/memory/compilers/webhook.js +5 -1
- package/esm/src/issues/Issues.js +1 -1
- package/esm/src/kv/sdk/SDKKeyValue.d.ts.map +1 -1
- package/esm/src/kv/sdk/SDKKeyValue.js +3 -9
- package/esm/src/services/createConnectRpcClient.d.ts +16 -0
- package/esm/src/services/createConnectRpcClient.d.ts.map +1 -0
- package/esm/src/services/createConnectRpcClient.js +63 -0
- package/package.json +4 -1
- package/script/src/connection/DirectConnectionFactory.d.ts +1 -1
- package/script/src/connection/DirectConnectionFactory.d.ts.map +1 -1
- package/script/src/connection/DirectConnectionFactory.js +5 -8
- package/script/src/connection/StaticFetchFactory.d.ts.map +1 -1
- package/script/src/connection/internal/CredentialHolder.d.ts.map +1 -1
- package/script/src/connection/internal/CredentialHolder.js +11 -2
- package/script/src/connection/internal/FetchBuilder.d.ts +3 -2
- package/script/src/connection/internal/FetchBuilder.d.ts.map +1 -1
- package/script/src/connection/internal/FetchBuilder.js +126 -4
- package/script/src/connection/internal/OutboundConnectionFactory.d.ts +1 -1
- package/script/src/connection/internal/OutboundConnectionFactory.d.ts.map +1 -1
- package/script/src/connection/internal/OutboundConnectionFactory.js +2 -3
- package/script/src/context/AsyncWorkflow.js +1 -1
- package/script/src/context/Context.d.ts +7 -6
- package/script/src/context/Context.d.ts.map +1 -1
- package/script/src/context/Context.js +3 -13
- package/script/src/context/ContextProvider.d.ts +1 -3
- package/script/src/context/ContextProvider.d.ts.map +1 -1
- package/script/src/context/ContextProvider.js +3 -6
- package/script/src/dsl/Workflow.d.ts.map +1 -1
- package/script/src/dsl/Workflow.js +2 -0
- package/script/src/dsl/http/versori/configloader.js +1 -1
- package/script/src/dsl/http/versori/cronapi.d.ts +2 -3
- package/script/src/dsl/http/versori/cronapi.d.ts.map +1 -1
- package/script/src/dsl/http/versori/cronapi.js +14 -14
- package/script/src/dsl/http/versori/kvapi/core/OpenAPI.js +1 -1
- package/script/src/dsl/http/versori/webhookmiddleware.d.ts +1 -1
- package/script/src/dsl/http/versori/webhookmiddleware.d.ts.map +1 -1
- package/script/src/dsl/http/versori/webhookmiddleware.js +24 -19
- package/script/src/dsl/tasks/HttpTask.d.ts +1 -2
- package/script/src/dsl/tasks/HttpTask.d.ts.map +1 -1
- package/script/src/dsl/tasks/HttpTask.js +0 -3
- package/script/src/dsl/triggers/DurableTrigger.d.ts +1 -0
- package/script/src/dsl/triggers/DurableTrigger.d.ts.map +1 -1
- package/script/src/dsl/triggers/WebhookTrigger.d.ts.map +1 -1
- package/script/src/dsl/triggers/WebhookTrigger.js +3 -1
- package/script/src/internal/constants.d.ts +3 -1
- package/script/src/internal/constants.d.ts.map +1 -1
- package/script/src/internal/constants.js +5 -2
- package/script/src/internal/supervisor.d.ts +21 -0
- package/script/src/internal/supervisor.d.ts.map +1 -0
- package/script/src/internal/supervisor.js +120 -0
- package/script/src/interpreter/durable/DurableInterpreter.d.ts +8 -2
- package/script/src/interpreter/durable/DurableInterpreter.d.ts.map +1 -1
- package/script/src/interpreter/durable/DurableInterpreter.js +62 -22
- package/script/src/interpreter/durable/ObservableCompiler.d.ts +6 -1
- package/script/src/interpreter/durable/ObservableCompiler.d.ts.map +1 -1
- package/script/src/interpreter/durable/Queue.d.ts +16 -24
- package/script/src/interpreter/durable/Queue.d.ts.map +1 -1
- package/script/src/interpreter/durable/Queue.js +5 -4
- package/script/src/interpreter/durable/compilers/catch.d.ts.map +1 -1
- package/script/src/interpreter/durable/compilers/catch.js +3 -2
- package/script/src/interpreter/durable/compilers/durableworkflow.d.ts.map +1 -1
- package/script/src/interpreter/durable/compilers/durableworkflow.js +19 -19
- package/script/src/interpreter/durable/compilers/fn.d.ts.map +1 -1
- package/script/src/interpreter/durable/compilers/fn.js +17 -4
- package/script/src/interpreter/durable/compilers/http.d.ts.map +1 -1
- package/script/src/interpreter/durable/compilers/http.js +8 -2
- package/script/src/interpreter/durable/compilers/schedule.d.ts.map +1 -1
- package/script/src/interpreter/durable/compilers/schedule.js +2 -1
- package/script/src/interpreter/durable/compilers/webhook.d.ts.map +1 -1
- package/script/src/interpreter/durable/compilers/webhook.js +4 -1
- package/script/src/interpreter/memory/MemoryInterpreter.d.ts +8 -2
- package/script/src/interpreter/memory/MemoryInterpreter.d.ts.map +1 -1
- package/script/src/interpreter/memory/MemoryInterpreter.js +46 -18
- package/script/src/interpreter/memory/ObservableCompiler.d.ts +6 -1
- package/script/src/interpreter/memory/ObservableCompiler.d.ts.map +1 -1
- package/script/src/interpreter/memory/compilers/catch.d.ts.map +1 -1
- package/script/src/interpreter/memory/compilers/catch.js +3 -2
- package/script/src/interpreter/memory/compilers/fn.d.ts.map +1 -1
- package/script/src/interpreter/memory/compilers/fn.js +17 -4
- package/script/src/interpreter/memory/compilers/http.d.ts.map +1 -1
- package/script/src/interpreter/memory/compilers/http.js +33 -3
- package/script/src/interpreter/memory/compilers/schedule.d.ts.map +1 -1
- package/script/src/interpreter/memory/compilers/schedule.js +2 -1
- package/script/src/interpreter/memory/compilers/webhook.d.ts.map +1 -1
- package/script/src/interpreter/memory/compilers/webhook.js +5 -1
- package/script/src/issues/Issues.js +1 -1
- package/script/src/kv/sdk/SDKKeyValue.d.ts.map +1 -1
- package/script/src/kv/sdk/SDKKeyValue.js +3 -9
- package/script/src/services/createConnectRpcClient.d.ts +16 -0
- package/script/src/services/createConnectRpcClient.d.ts.map +1 -0
- package/script/src/services/createConnectRpcClient.js +66 -0
- package/esm/src/context/WorkflowClient.d.ts +0 -29
- package/esm/src/context/WorkflowClient.d.ts.map +0 -1
- package/esm/src/context/WorkflowClient.js +0 -95
- package/esm/src/dsl/http/versori/activation.d.ts +0 -13
- package/esm/src/dsl/http/versori/activation.d.ts.map +0 -1
- package/esm/src/dsl/http/versori/activation.js +0 -65
- package/esm/src/dsl/http/versori/cli.d.ts +0 -2
- package/esm/src/dsl/http/versori/cli.d.ts.map +0 -1
- package/esm/src/dsl/http/versori/cli.js +0 -20
- package/esm/src/dsl/http/versori/constants.d.ts +0 -20
- package/esm/src/dsl/http/versori/constants.d.ts.map +0 -1
- package/esm/src/dsl/http/versori/constants.js +0 -25
- package/esm/src/dsl/http/versori/internalauth.d.ts +0 -15
- package/esm/src/dsl/http/versori/internalauth.d.ts.map +0 -1
- package/esm/src/dsl/http/versori/internalauth.js +0 -90
- package/esm/src/dsl/http/versori/platformapi.d.ts +0 -19
- package/esm/src/dsl/http/versori/platformapi.d.ts.map +0 -1
- package/esm/src/dsl/http/versori/platformapi.js +0 -148
- package/esm/src/dsl/http/versori/proxyroundtripper.d.ts +0 -23
- package/esm/src/dsl/http/versori/proxyroundtripper.d.ts.map +0 -1
- package/esm/src/dsl/http/versori/proxyroundtripper.js +0 -196
- package/script/src/context/WorkflowClient.d.ts +0 -29
- package/script/src/context/WorkflowClient.d.ts.map +0 -1
- package/script/src/context/WorkflowClient.js +0 -99
- package/script/src/dsl/http/versori/activation.d.ts +0 -13
- package/script/src/dsl/http/versori/activation.d.ts.map +0 -1
- package/script/src/dsl/http/versori/activation.js +0 -69
- package/script/src/dsl/http/versori/cli.d.ts +0 -2
- package/script/src/dsl/http/versori/cli.d.ts.map +0 -1
- package/script/src/dsl/http/versori/cli.js +0 -23
- package/script/src/dsl/http/versori/constants.d.ts +0 -20
- package/script/src/dsl/http/versori/constants.d.ts.map +0 -1
- package/script/src/dsl/http/versori/constants.js +0 -28
- package/script/src/dsl/http/versori/internalauth.d.ts +0 -15
- package/script/src/dsl/http/versori/internalauth.d.ts.map +0 -1
- package/script/src/dsl/http/versori/internalauth.js +0 -94
- package/script/src/dsl/http/versori/platformapi.d.ts +0 -19
- package/script/src/dsl/http/versori/platformapi.d.ts.map +0 -1
- package/script/src/dsl/http/versori/platformapi.js +0 -152
- package/script/src/dsl/http/versori/proxyroundtripper.d.ts +0 -23
- package/script/src/dsl/http/versori/proxyroundtripper.d.ts.map +0 -1
- package/script/src/dsl/http/versori/proxyroundtripper.js +0 -200
|
@@ -3,19 +3,32 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.fnCompiler = void 0;
|
|
4
4
|
const rxjs_1 = require("rxjs");
|
|
5
5
|
const FnTask_js_1 = require("../../../dsl/tasks/FnTask.js");
|
|
6
|
+
const supervisor_js_1 = require("../../../internal/supervisor.js");
|
|
6
7
|
function compileFn(compilerCtx, task) {
|
|
7
8
|
return (src) => src.pipe((0, rxjs_1.tap)({
|
|
8
9
|
complete: () => compilerCtx.log.debug('fn.complete')
|
|
9
10
|
}), (0, rxjs_1.mergeMap)(async (ctx) => {
|
|
10
11
|
return await compilerCtx.tracer.startActiveSpan(`fn-${task.id}`, async (span) => {
|
|
11
12
|
span.setAttribute('task.id', task.id);
|
|
13
|
+
span.setAttribute('type', 'task');
|
|
14
|
+
span.setAttribute('task.type', 'fn');
|
|
12
15
|
span.setAttribute('execution.id', ctx.executionId);
|
|
13
|
-
|
|
16
|
+
try {
|
|
17
|
+
let result;
|
|
18
|
+
if (typeof ctx.idx === 'number') {
|
|
19
|
+
result = ctx.withData(await task._fn(ctx, ctx.idx));
|
|
20
|
+
}
|
|
21
|
+
else {
|
|
22
|
+
result = ctx.withData(await task._fn(ctx));
|
|
23
|
+
}
|
|
24
|
+
if (supervisor_js_1.enabled) {
|
|
25
|
+
span.setAttribute('response.body', JSON.stringify(result.data));
|
|
26
|
+
}
|
|
27
|
+
return result;
|
|
28
|
+
}
|
|
29
|
+
finally {
|
|
14
30
|
span.end();
|
|
15
|
-
return ctx.withData(await task._fn(ctx, ctx.idx));
|
|
16
31
|
}
|
|
17
|
-
span.end();
|
|
18
|
-
return ctx.withData(await task._fn(ctx));
|
|
19
32
|
});
|
|
20
33
|
}));
|
|
21
34
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"http.d.ts","sourceRoot":"","sources":["../../../../../src/src/interpreter/memory/compilers/http.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"http.d.ts","sourceRoot":"","sources":["../../../../../src/src/interpreter/memory/compilers/http.ts"],"names":[],"mappings":"AAQA,OAAO,EAAmB,YAAY,EAAE,MAAM,gCAAgC,CAAC;AAG/E,OAAO,EAA2B,YAAY,EAAE,MAAM,YAAY,CAAC;AAuGnE,eAAO,MAAM,YAAY,EAAE,YAAY,CAAC,GAAG,EAAE,GAAG,EAAE,YAAY,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,CAAC,CAG5E,CAAC"}
|
|
@@ -4,14 +4,21 @@ exports.httpCompiler = void 0;
|
|
|
4
4
|
const rxjs_1 = require("rxjs");
|
|
5
5
|
const operators_1 = require("rxjs/operators");
|
|
6
6
|
const DynamicFetchFactory_js_1 = require("../../../connection/DynamicFetchFactory.js");
|
|
7
|
+
const FetchBuilder_js_1 = require("../../../connection/internal/FetchBuilder.js");
|
|
7
8
|
const StaticFetchFactory_js_1 = require("../../../connection/StaticFetchFactory.js");
|
|
8
9
|
const HttpTask_js_1 = require("../../../dsl/tasks/HttpTask.js");
|
|
10
|
+
const supervisor_js_1 = require("../../../internal/supervisor.js");
|
|
9
11
|
function compileHttp(compilerCtx, task) {
|
|
10
12
|
const cnxMap = compilerCtx.configReader.getCnxMapping(task.opts.connection);
|
|
11
13
|
let fetchFactory;
|
|
12
14
|
if (!cnxMap) {
|
|
13
15
|
compilerCtx.log.error(`Connection ${task.opts.connection} not found, using default fetch with no credentials`);
|
|
14
|
-
|
|
16
|
+
if (supervisor_js_1.enabled) {
|
|
17
|
+
fetchFactory = Promise.resolve(new StaticFetchFactory_js_1.StaticFetchFactory(new FetchBuilder_js_1.FetchBuilder(globalThis.fetch).build()));
|
|
18
|
+
}
|
|
19
|
+
else {
|
|
20
|
+
fetchFactory = Promise.resolve(new StaticFetchFactory_js_1.StaticFetchFactory(globalThis.fetch));
|
|
21
|
+
}
|
|
15
22
|
}
|
|
16
23
|
else if (cnxMap.dynamic) {
|
|
17
24
|
fetchFactory = Promise.resolve(new DynamicFetchFactory_js_1.DynamicFetchFactory(compilerCtx.cnxFactory, compilerCtx.platformApi, compilerCtx.organisationId, cnxMap.templateId));
|
|
@@ -25,7 +32,14 @@ function compileHttp(compilerCtx, task) {
|
|
|
25
32
|
throwOnError: true,
|
|
26
33
|
})
|
|
27
34
|
.then(({ data }) => Promise.all([compilerCtx.cnxFactory.fetcher(data), data.baseUrl ?? '']))
|
|
28
|
-
.then(([fetcher, baseUrl]) => new StaticFetchFactory_js_1.StaticFetchFactory(fetcher, baseUrl))
|
|
35
|
+
.then(([fetcher, baseUrl]) => new StaticFetchFactory_js_1.StaticFetchFactory(fetcher, baseUrl))
|
|
36
|
+
.catch((err) => {
|
|
37
|
+
compilerCtx.log.error(`Failed to get connection ${task.opts.connection}`, err);
|
|
38
|
+
if (supervisor_js_1.enabled) {
|
|
39
|
+
return new StaticFetchFactory_js_1.StaticFetchFactory(new FetchBuilder_js_1.FetchBuilder(globalThis.fetch).build());
|
|
40
|
+
}
|
|
41
|
+
throw err;
|
|
42
|
+
});
|
|
29
43
|
}
|
|
30
44
|
async function http(ctx) {
|
|
31
45
|
const [fetch, baseUrl] = await fetchFactory.then(ff => Promise.all([ff.fetcher(ctx), ff.baseUrl(ctx)]));
|
|
@@ -39,10 +53,15 @@ function compileHttp(compilerCtx, task) {
|
|
|
39
53
|
return compilerCtx.tracer.startActiveSpan(`http-${task.id}`, async (span) => {
|
|
40
54
|
span.setAttribute('task.id', task.id);
|
|
41
55
|
span.setAttribute('task.type', 'http');
|
|
56
|
+
span.setAttribute('type', 'task');
|
|
42
57
|
span.setAttribute('execution.id', ctx.executionId);
|
|
43
58
|
span.setAttribute('connection.name', task.opts.connection);
|
|
44
59
|
try {
|
|
45
|
-
|
|
60
|
+
let newCtx = await http(ctx);
|
|
61
|
+
if (supervisor_js_1.enabled) {
|
|
62
|
+
span.setAttribute('response.body', JSON.stringify(newCtx.data));
|
|
63
|
+
}
|
|
64
|
+
return newCtx;
|
|
46
65
|
}
|
|
47
66
|
catch (error) {
|
|
48
67
|
if (error instanceof Error) {
|
|
@@ -63,3 +82,14 @@ exports.httpCompiler = {
|
|
|
63
82
|
ctor: HttpTask_js_1.HttpTaskImpl,
|
|
64
83
|
compile: compileHttp,
|
|
65
84
|
};
|
|
85
|
+
// `TypeError: Invalid URL: '/api/v1/echo/loca-test'
|
|
86
|
+
// at getSerialization (ext:deno_url/00_url.js:98:11)
|
|
87
|
+
// at new URL (ext:deno_url/00_url.js:405:27)
|
|
88
|
+
// at new Request (ext:deno_fetch/23_request.js:344:25)
|
|
89
|
+
// at ext:deno_fetch/26_fetch.js:374:29
|
|
90
|
+
// at new Promise (<anonymous>)
|
|
91
|
+
// at fetch (ext:deno_fetch/26_fetch.js:370:20)
|
|
92
|
+
// at HttpTaskImpl.fn (file:///Users/teodor/Documents/sdk-node/examples/webhook/local_wh.ts:6:31)
|
|
93
|
+
// at http (file:///Users/teodor/Documents/sdk-node/src/interpreter/memory/compilers/http.ts:66:35)
|
|
94
|
+
// at eventLoopTick (ext:core/01_core.js:179:7)
|
|
95
|
+
// at async file:///Users/teodor/Documents/sdk-node/src/interpreter/memory/compilers/http.ts:85:38`
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"schedule.d.ts","sourceRoot":"","sources":["../../../../../src/src/interpreter/memory/compilers/schedule.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"schedule.d.ts","sourceRoot":"","sources":["../../../../../src/src/interpreter/memory/compilers/schedule.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,YAAY,EAAE,eAAe,EAAE,MAAM,0CAA0C,CAAC;AAQzF,OAAO,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;AAyI7C,eAAO,MAAM,gBAAgB,EAAE,eAAe,CAAC,YAAY,EAAE,eAAe,CAG3E,CAAC"}
|
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.scheduleCompiler = void 0;
|
|
4
4
|
const rxjs_1 = require("rxjs");
|
|
5
|
-
const constants_js_1 = require("../../../dsl/http/versori/constants.js");
|
|
6
5
|
const ScheduleTrigger_js_1 = require("../../../dsl/triggers/ScheduleTrigger.js");
|
|
6
|
+
const constants_js_1 = require("../../../internal/constants.js");
|
|
7
7
|
function compileSchedule(ctx, trigger, signal) {
|
|
8
8
|
return new rxjs_1.Observable((subscriber) => {
|
|
9
9
|
// Add HTTP endpoint for manual triggering
|
|
@@ -87,6 +87,7 @@ function compileSchedule(ctx, trigger, signal) {
|
|
|
87
87
|
await ctx.tracer.startActiveSpan(`schedule-${trigger.id}`, async (span) => {
|
|
88
88
|
span.setAttribute('task.id', trigger.id);
|
|
89
89
|
span.setAttribute('task.type', 'schedule');
|
|
90
|
+
span.setAttribute('type', 'task');
|
|
90
91
|
span.setAttribute('schedule', trigger.schedule);
|
|
91
92
|
span.setAttribute('project.id', projectId);
|
|
92
93
|
span.setAttribute('environment.id', environmentId);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"webhook.d.ts","sourceRoot":"","sources":["../../../../../src/src/interpreter/memory/compilers/webhook.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"webhook.d.ts","sourceRoot":"","sources":["../../../../../src/src/interpreter/memory/compilers/webhook.ts"],"names":[],"mappings":"AAcA,OAAO,EAAE,WAAW,EAAE,cAAc,EAAE,MAAM,yCAAyC,CAAC;AAGtF,OAAO,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;AAuD7C,eAAO,MAAM,eAAe,EAAE,eAAe,CAAC,WAAW,EAAE,cAAc,CA6SxE,CAAC"}
|
|
@@ -6,12 +6,12 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
6
6
|
exports.webhookCompiler = void 0;
|
|
7
7
|
const cors_1 = __importDefault(require("cors"));
|
|
8
8
|
const express_1 = __importDefault(require("express"));
|
|
9
|
+
const express_xml_bodyparser_1 = __importDefault(require("express-xml-bodyparser"));
|
|
9
10
|
const promises_1 = require("node:stream/promises");
|
|
10
11
|
const rxjs_1 = require("rxjs");
|
|
11
12
|
const webhookmiddleware_js_1 = require("../../../dsl/http/versori/webhookmiddleware.js");
|
|
12
13
|
const WebhookTrigger_js_1 = require("../../../dsl/triggers/WebhookTrigger.js");
|
|
13
14
|
const constants_js_1 = require("../../../internal/constants.js");
|
|
14
|
-
const express_xml_bodyparser_1 = __importDefault(require("express-xml-bodyparser"));
|
|
15
15
|
const xml2jsDefaults = {
|
|
16
16
|
explicitArray: false,
|
|
17
17
|
normalize: false,
|
|
@@ -111,6 +111,7 @@ exports.webhookCompiler = {
|
|
|
111
111
|
ctx.webhookRouter.use((0, cors_1.default)(corsOptions));
|
|
112
112
|
}
|
|
113
113
|
}
|
|
114
|
+
ctx.webhookRegistry.set(trigger.id, { method, path: `/${trigger.id}`, options: trigger.options });
|
|
114
115
|
// endpoint for sans user because I'm not quite sure how the dynamic routing works
|
|
115
116
|
ctx.webhookRouter[method](`/${trigger.id}`, (0, webhookmiddleware_js_1.createStaticWebhookMiddleware)({
|
|
116
117
|
id: trigger.id,
|
|
@@ -125,6 +126,7 @@ exports.webhookCompiler = {
|
|
|
125
126
|
await ctx.tracer.startActiveSpan(`webhook-${trigger.id}`, async (span) => {
|
|
126
127
|
span.setAttribute('task.id', trigger.id);
|
|
127
128
|
span.setAttribute('task.type', 'webhook');
|
|
129
|
+
span.setAttribute('type', 'task');
|
|
128
130
|
const staticActivation = res.locals.activation;
|
|
129
131
|
const executionCtx = ctx.contextProvider.create(staticActivation, req.body, ctxOptionsFn(req, res));
|
|
130
132
|
span.setAttribute('execution.id', executionCtx.executionId);
|
|
@@ -161,6 +163,7 @@ exports.webhookCompiler = {
|
|
|
161
163
|
await ctx.tracer.startActiveSpan(`webhook-${trigger.id}`, async (span) => {
|
|
162
164
|
span.setAttribute('task.id', trigger.id);
|
|
163
165
|
span.setAttribute('task.type', 'webhook');
|
|
166
|
+
span.setAttribute('type', 'task');
|
|
164
167
|
span.setAttribute('user.id', req.params.userId);
|
|
165
168
|
const userId = req.params.userId;
|
|
166
169
|
// Right now we only support a user having one activation
|
|
@@ -217,6 +220,7 @@ exports.webhookCompiler = {
|
|
|
217
220
|
await ctx.tracer.startActiveSpan(`webhook-${trigger.id}`, async (span) => {
|
|
218
221
|
span.setAttribute('task.id', trigger.id);
|
|
219
222
|
span.setAttribute('task.type', 'webhook');
|
|
223
|
+
span.setAttribute('type', 'task');
|
|
220
224
|
span.setAttribute('activation.id', req.params.activationId);
|
|
221
225
|
const activation = res.locals.activation;
|
|
222
226
|
const activationId = activation?.id ?? req.params.activationId;
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.MockIssues = exports.IssueImpl = void 0;
|
|
4
4
|
const node_crypto_1 = require("node:crypto");
|
|
5
|
-
const constants_js_1 = require("../
|
|
5
|
+
const constants_js_1 = require("../internal/constants.js");
|
|
6
6
|
class IssueImpl {
|
|
7
7
|
constructor(log) {
|
|
8
8
|
Object.defineProperty(this, "baseUrl", {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SDKKeyValue.d.ts","sourceRoot":"","sources":["../../../../src/src/kv/sdk/SDKKeyValue.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AACtD,OAAO,EAAE,mBAAmB,EAAE,MAAM,4DAA4D,CAAC;AAGjG,OAAO,EAAE,aAAa,EAAE,MAAM,sDAAsD,CAAC;AACrF,OAAO,EAAE,cAAc,EAAE,MAAM,uDAAuD,CAAC;AACvF,OAAO,EAAE,eAAe,EAAE,MAAM,wDAAwD,CAAC;AAEzF,qBAAa,WAAY,YAAW,QAAQ;IAC5B,OAAO,CAAC,QAAQ,CAAC,KAAK;IAAuB,OAAO,CAAC,QAAQ,CAAC,MAAM;gBAAnD,KAAK,EAAE,mBAAmB,EAAmB,MAAM,EAAE,MAAM;IAElF,GAAG,CAAC,CAAC,EAAE,GAAG,EAAE,MAAM,GAAG,MAAM,EAAE,EAAE,OAAO,GAAE,UAAU,CAAC,CAAC,CAAM,GAAG,OAAO,CAAC,CAAC,GAAG,SAAS,CAAC;
|
|
1
|
+
{"version":3,"file":"SDKKeyValue.d.ts","sourceRoot":"","sources":["../../../../src/src/kv/sdk/SDKKeyValue.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AACtD,OAAO,EAAE,mBAAmB,EAAE,MAAM,4DAA4D,CAAC;AAGjG,OAAO,EAAE,aAAa,EAAE,MAAM,sDAAsD,CAAC;AACrF,OAAO,EAAE,cAAc,EAAE,MAAM,uDAAuD,CAAC;AACvF,OAAO,EAAE,eAAe,EAAE,MAAM,wDAAwD,CAAC;AAEzF,qBAAa,WAAY,YAAW,QAAQ;IAC5B,OAAO,CAAC,QAAQ,CAAC,KAAK;IAAuB,OAAO,CAAC,QAAQ,CAAC,MAAM;gBAAnD,KAAK,EAAE,mBAAmB,EAAmB,MAAM,EAAE,MAAM;IAElF,GAAG,CAAC,CAAC,EAAE,GAAG,EAAE,MAAM,GAAG,MAAM,EAAE,EAAE,OAAO,GAAE,UAAU,CAAC,CAAC,CAAM,GAAG,OAAO,CAAC,CAAC,GAAG,SAAS,CAAC;IAoBnF,GAAG,CAAC,CAAC,EAAE,GAAG,EAAE,MAAM,GAAG,MAAM,EAAE,EAAE,KAAK,EAAE,CAAC,GAAG,OAAO,CAAC,IAAI,CAAC;IAYvD,MAAM,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC;IAU7C,KAAK,CAAC,MAAM,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,eAAe,CAAC;IAUjD,IAAI,CAAC,MAAM,EAAE,MAAM,EAAE,EAAE,OAAO,CAAC,EAAE,aAAa,GAAG,OAAO,CAAC,cAAc,CAAC;IAY9E,OAAO,CAAC,WAAW;CAGtB"}
|
|
@@ -22,13 +22,7 @@ class SDKKeyValue {
|
|
|
22
22
|
try {
|
|
23
23
|
const k = this.generateKey(key instanceof Array ? key.join('/') : key);
|
|
24
24
|
const entry = await KvOperationsService_js_1.KvOperationsService.getKv(this.store.id, k);
|
|
25
|
-
|
|
26
|
-
if (options.throwOnNotFound) {
|
|
27
|
-
throw new Error('Key not found');
|
|
28
|
-
}
|
|
29
|
-
return undefined;
|
|
30
|
-
}
|
|
31
|
-
return JSON.parse(String(entry.value));
|
|
25
|
+
return entry.value;
|
|
32
26
|
}
|
|
33
27
|
catch (error) {
|
|
34
28
|
if (options.throwOnNotFound && error instanceof Error && error.message === 'Key not found') {
|
|
@@ -42,10 +36,10 @@ class SDKKeyValue {
|
|
|
42
36
|
}
|
|
43
37
|
}
|
|
44
38
|
async set(key, value) {
|
|
45
|
-
const payload = JSON.stringify(value);
|
|
39
|
+
// const payload = JSON.stringify(value);
|
|
46
40
|
const k = this.generateKey(key instanceof Array ? key.join('/') : key);
|
|
47
41
|
await KvOperationsService_js_1.KvOperationsService.setKv(this.store.id, k, {
|
|
48
|
-
value:
|
|
42
|
+
value: value,
|
|
49
43
|
options: {}
|
|
50
44
|
});
|
|
51
45
|
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { DescService } from '@bufbuild/protobuf';
|
|
2
|
+
import { Client, Transport } from '@connectrpc/connect';
|
|
3
|
+
/**
|
|
4
|
+
* Create a gRPC client with retry logic for Deno's unsupported GOAWAY issue.
|
|
5
|
+
*
|
|
6
|
+
* This function makes use of ES6 Proxy classes to intercept method calls and retry on connection
|
|
7
|
+
* errors. Users must not mess with the returned client object or change the receiver (i.e. by
|
|
8
|
+
* using this client as the prototype for another object).
|
|
9
|
+
*
|
|
10
|
+
* This will also not work with gRPC streams, but could be extended to do so.
|
|
11
|
+
*
|
|
12
|
+
* @param service - The service descriptor.
|
|
13
|
+
* @returns A gRPC client with retry logic for connection errors.
|
|
14
|
+
*/
|
|
15
|
+
export declare function createConnectRpcClient<T extends DescService>(service: T, transportFn: () => Transport): Client<T>;
|
|
16
|
+
//# sourceMappingURL=createConnectRpcClient.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"createConnectRpcClient.d.ts","sourceRoot":"","sources":["../../../src/src/services/createConnectRpcClient.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AACjD,OAAO,EACH,MAAM,EAIN,SAAS,EACZ,MAAM,qBAAqB,CAAC;AAM7B;;;;;;;;;;;GAWG;AACH,wBAAgB,sBAAsB,CAAC,CAAC,SAAS,WAAW,EACxD,OAAO,EAAE,CAAC,EACV,WAAW,EAAE,MAAM,SAAS,GAC7B,MAAM,CAAC,CAAC,CAAC,CAsEX"}
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.createConnectRpcClient = createConnectRpcClient;
|
|
4
|
+
const connect_1 = require("@connectrpc/connect");
|
|
5
|
+
/**
|
|
6
|
+
* Create a gRPC client with retry logic for Deno's unsupported GOAWAY issue.
|
|
7
|
+
*
|
|
8
|
+
* This function makes use of ES6 Proxy classes to intercept method calls and retry on connection
|
|
9
|
+
* errors. Users must not mess with the returned client object or change the receiver (i.e. by
|
|
10
|
+
* using this client as the prototype for another object).
|
|
11
|
+
*
|
|
12
|
+
* This will also not work with gRPC streams, but could be extended to do so.
|
|
13
|
+
*
|
|
14
|
+
* @param service - The service descriptor.
|
|
15
|
+
* @returns A gRPC client with retry logic for connection errors.
|
|
16
|
+
*/
|
|
17
|
+
function createConnectRpcClient(service, transportFn) {
|
|
18
|
+
function createClientInner() {
|
|
19
|
+
return (0, connect_1.createClient)(service, transportFn());
|
|
20
|
+
}
|
|
21
|
+
const handler = {
|
|
22
|
+
get(target, prop, receiver) {
|
|
23
|
+
const original = Reflect.get(target.value, prop, receiver);
|
|
24
|
+
if (typeof original !== 'function') {
|
|
25
|
+
return original;
|
|
26
|
+
}
|
|
27
|
+
return (...args) => {
|
|
28
|
+
try {
|
|
29
|
+
const result = Reflect.apply(original, receiver, args);
|
|
30
|
+
// If promise-like, attach retry-once logic
|
|
31
|
+
if (result && typeof result.then === 'function') {
|
|
32
|
+
return result.catch((error) => {
|
|
33
|
+
if (!(error instanceof connect_1.ConnectError)) {
|
|
34
|
+
throw error;
|
|
35
|
+
}
|
|
36
|
+
if (error.rawMessage.includes('connection error received: not a result of an error') &&
|
|
37
|
+
error.code === connect_1.Code.Internal) {
|
|
38
|
+
// Recreate client and retry once
|
|
39
|
+
target.value = createClientInner();
|
|
40
|
+
const rebound = Reflect.get(target.value, prop, receiver);
|
|
41
|
+
return Reflect.apply(rebound, receiver, args);
|
|
42
|
+
}
|
|
43
|
+
throw error;
|
|
44
|
+
});
|
|
45
|
+
}
|
|
46
|
+
// Non-promise results (e.g., streaming iterables) are returned as-is
|
|
47
|
+
return result;
|
|
48
|
+
}
|
|
49
|
+
catch (error) {
|
|
50
|
+
if (!(error instanceof connect_1.ConnectError)) {
|
|
51
|
+
throw error;
|
|
52
|
+
}
|
|
53
|
+
if (error.rawMessage.includes('connection error received: not a result of an error') && error.code === connect_1.Code.Internal) {
|
|
54
|
+
target.value = createClientInner();
|
|
55
|
+
const rebound = Reflect.get(target.value, prop, receiver);
|
|
56
|
+
return Reflect.apply(rebound, receiver, args);
|
|
57
|
+
}
|
|
58
|
+
throw error;
|
|
59
|
+
}
|
|
60
|
+
};
|
|
61
|
+
},
|
|
62
|
+
};
|
|
63
|
+
return new Proxy({
|
|
64
|
+
value: createClientInner(),
|
|
65
|
+
}, handler);
|
|
66
|
+
}
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
import { QueueAPI } from '../interpreter/durable/Queue.js';
|
|
2
|
-
import { Workflow } from '../interpreter/durable/Queue.js';
|
|
3
|
-
import { ActivationImpl } from './ActivationImpl.js';
|
|
4
|
-
export type WorkflowOpts = {
|
|
5
|
-
maxAttempts?: number;
|
|
6
|
-
data?: unknown;
|
|
7
|
-
dataRaw?: string;
|
|
8
|
-
};
|
|
9
|
-
export interface WorkflowInterface {
|
|
10
|
-
startWorkflow(group: string, opts: WorkflowOpts): Promise<Workflow>;
|
|
11
|
-
getWorkflow(wfs: Workflow): Promise<Workflow>;
|
|
12
|
-
getWorkflowById(id: string): Promise<Workflow>;
|
|
13
|
-
waitForCompletion(wf: Workflow): Promise<Workflow>;
|
|
14
|
-
rescheduleWorkflow(wf: Workflow, after: string): Promise<void>;
|
|
15
|
-
completeWorkflow(wf: Workflow, status: 'completed' | 'failed', output?: any): Promise<void>;
|
|
16
|
-
}
|
|
17
|
-
export declare class WorkflowImpl implements WorkflowInterface {
|
|
18
|
-
private queue;
|
|
19
|
-
private executionId;
|
|
20
|
-
private activation;
|
|
21
|
-
constructor(queue: QueueAPI, executionId: string, activation: ActivationImpl);
|
|
22
|
-
startWorkflow(group: string, opts: WorkflowOpts): Promise<Workflow>;
|
|
23
|
-
getWorkflow(wf: Workflow): Promise<Workflow>;
|
|
24
|
-
getWorkflowById(id: string): Promise<Workflow>;
|
|
25
|
-
waitForCompletion(wf: Workflow): Promise<Workflow>;
|
|
26
|
-
rescheduleWorkflow(wf: Workflow, after: string): Promise<void>;
|
|
27
|
-
completeWorkflow(wf: Workflow, status: 'completed' | 'failed', output?: any): Promise<void>;
|
|
28
|
-
}
|
|
29
|
-
//# sourceMappingURL=WorkflowClient.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"WorkflowClient.d.ts","sourceRoot":"","sources":["../../../src/src/context/WorkflowClient.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,iCAAiC,CAAC;AAC3D,OAAO,EAAE,QAAQ,EAAE,MAAM,iCAAiC,CAAC;AAC3D,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AAKrD,MAAM,MAAM,YAAY,GAAG;IACvB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,OAAO,CAAC,EAAE,MAAM,CAAC;CACpB,CAAC;AAEF,MAAM,WAAW,iBAAiB;IAC9B,aAAa,CAAC,KAAK,EAAE,MAAM,EAAE,IAAI,EAAE,YAAY,GAAG,OAAO,CAAC,QAAQ,CAAC,CAAC;IACpE,WAAW,CAAC,GAAG,EAAE,QAAQ,GAAG,OAAO,CAAC,QAAQ,CAAC,CAAC;IAC9C,eAAe,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,QAAQ,CAAC,CAAC;IAC/C,iBAAiB,CAAC,EAAE,EAAE,QAAQ,GAAG,OAAO,CAAC,QAAQ,CAAC,CAAC;IACnD,kBAAkB,CAAC,EAAE,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAC/D,gBAAgB,CAAC,EAAE,EAAE,QAAQ,EAAE,MAAM,EAAE,WAAW,GAAG,QAAQ,EAAE,MAAM,CAAC,EAAE,GAAG,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;CAC/F;AAED,qBAAa,YAAa,YAAW,iBAAiB;IAClD,OAAO,CAAC,KAAK,CAAW;IACxB,OAAO,CAAC,WAAW,CAAS;IAC5B,OAAO,CAAC,UAAU,CAAiB;gBAEvB,KAAK,EAAE,QAAQ,EAAE,WAAW,EAAE,MAAM,EAAE,UAAU,EAAE,cAAc;IActE,aAAa,CAAC,KAAK,EAAE,MAAM,EAAE,IAAI,EAAE,YAAY,GAAG,OAAO,CAAC,QAAQ,CAAC;IAmBnE,WAAW,CAAC,EAAE,EAAE,QAAQ,GAAG,OAAO,CAAC,QAAQ,CAAC;IAI5C,eAAe,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,QAAQ,CAAC;IAI9C,iBAAiB,CAAC,EAAE,EAAE,QAAQ,GAAG,OAAO,CAAC,QAAQ,CAAC;IASlD,kBAAkB,CAAC,EAAE,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IA0B9D,gBAAgB,CAAC,EAAE,EAAE,QAAQ,EAAE,MAAM,EAAE,WAAW,GAAG,QAAQ,EAAE,MAAM,CAAC,EAAE,GAAG,GAAG,OAAO,CAAC,IAAI,CAAC;CAYpG"}
|
|
@@ -1,95 +0,0 @@
|
|
|
1
|
-
export class WorkflowImpl {
|
|
2
|
-
constructor(queue, executionId, activation) {
|
|
3
|
-
Object.defineProperty(this, "queue", {
|
|
4
|
-
enumerable: true,
|
|
5
|
-
configurable: true,
|
|
6
|
-
writable: true,
|
|
7
|
-
value: void 0
|
|
8
|
-
});
|
|
9
|
-
Object.defineProperty(this, "executionId", {
|
|
10
|
-
enumerable: true,
|
|
11
|
-
configurable: true,
|
|
12
|
-
writable: true,
|
|
13
|
-
value: void 0
|
|
14
|
-
});
|
|
15
|
-
Object.defineProperty(this, "activation", {
|
|
16
|
-
enumerable: true,
|
|
17
|
-
configurable: true,
|
|
18
|
-
writable: true,
|
|
19
|
-
value: void 0
|
|
20
|
-
});
|
|
21
|
-
this.queue = queue;
|
|
22
|
-
this.executionId = executionId;
|
|
23
|
-
this.activation = activation;
|
|
24
|
-
// I have no idea if I need this but I have suffered from it in the past
|
|
25
|
-
this.startWorkflow = this.startWorkflow.bind(this);
|
|
26
|
-
this.getWorkflow = this.getWorkflow.bind(this);
|
|
27
|
-
this.waitForCompletion = this.waitForCompletion.bind(this);
|
|
28
|
-
this.rescheduleWorkflow = this.rescheduleWorkflow.bind(this);
|
|
29
|
-
this.completeWorkflow = this.completeWorkflow.bind(this);
|
|
30
|
-
this.getWorkflowById = this.getWorkflowById.bind(this);
|
|
31
|
-
}
|
|
32
|
-
async startWorkflow(group, opts) {
|
|
33
|
-
const workflows = await this.queue.submit({
|
|
34
|
-
workflows: [
|
|
35
|
-
{
|
|
36
|
-
group,
|
|
37
|
-
metadata: {
|
|
38
|
-
executionId: this.executionId,
|
|
39
|
-
activationId: this.activation?.id,
|
|
40
|
-
userId: this.activation?.user?.externalId,
|
|
41
|
-
},
|
|
42
|
-
payload: opts.data ? btoa(JSON.stringify(opts.data)) : btoa("{}"),
|
|
43
|
-
maxAttempts: opts.maxAttempts,
|
|
44
|
-
},
|
|
45
|
-
],
|
|
46
|
-
});
|
|
47
|
-
return workflows.workflows[0];
|
|
48
|
-
}
|
|
49
|
-
async getWorkflow(wf) {
|
|
50
|
-
return await this.queue.getWorkflow(wf.id);
|
|
51
|
-
}
|
|
52
|
-
async getWorkflowById(id) {
|
|
53
|
-
return await this.queue.getWorkflow(id);
|
|
54
|
-
}
|
|
55
|
-
async waitForCompletion(wf) {
|
|
56
|
-
while (wf.status !== 'completed' && wf.status !== 'failed') {
|
|
57
|
-
await new Promise(resolve => setTimeout(resolve, 1000));
|
|
58
|
-
wf = await this.queue.getWorkflow(wf.id);
|
|
59
|
-
}
|
|
60
|
-
return wf;
|
|
61
|
-
}
|
|
62
|
-
async rescheduleWorkflow(wf, after) {
|
|
63
|
-
await this.queue.reschedule({
|
|
64
|
-
id: wf.id,
|
|
65
|
-
after,
|
|
66
|
-
});
|
|
67
|
-
// TODO: Is this a hack?
|
|
68
|
-
// In the durableworkflow taks I have this piece of code
|
|
69
|
-
//
|
|
70
|
-
// onSuccess: (completedContext: ContextImpl<unknown>) => {
|
|
71
|
-
// // locked status means we own the workflow and it's not completed yet
|
|
72
|
-
// if (wf.status === 'locked') {
|
|
73
|
-
// return;
|
|
74
|
-
// }
|
|
75
|
-
// ctx.queueProvider.complete({
|
|
76
|
-
// id: wf.id,
|
|
77
|
-
// output: btoa(JSON.stringify(completedContext.data)),
|
|
78
|
-
// status: 'completed',
|
|
79
|
-
// });
|
|
80
|
-
// },
|
|
81
|
-
//
|
|
82
|
-
// it basically ignores completing the workflow if it's not locked.
|
|
83
|
-
// the line bellow triggers this
|
|
84
|
-
wf.status = 'available';
|
|
85
|
-
}
|
|
86
|
-
async completeWorkflow(wf, status, output) {
|
|
87
|
-
const outputRaw = output ? btoa(JSON.stringify(output)) : undefined;
|
|
88
|
-
await this.queue.complete({
|
|
89
|
-
id: wf.id,
|
|
90
|
-
output: outputRaw,
|
|
91
|
-
status: status,
|
|
92
|
-
});
|
|
93
|
-
wf.status = status;
|
|
94
|
-
}
|
|
95
|
-
}
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import { Logger } from '../../../observability/logging/Logger.js';
|
|
2
|
-
import { Activation, ConnectionProvider, User } from '../types.js';
|
|
3
|
-
export declare class ActivationImpl implements Activation {
|
|
4
|
-
id: string;
|
|
5
|
-
user: User;
|
|
6
|
-
private variables?;
|
|
7
|
-
private connectionProvider;
|
|
8
|
-
private log;
|
|
9
|
-
constructor(id: string, user: User, connectionProvider: ConnectionProvider, log: Logger, variables: Record<string, unknown>);
|
|
10
|
-
getVariable(name: string): unknown;
|
|
11
|
-
setVariable(name: string, value: unknown): Promise<void>;
|
|
12
|
-
}
|
|
13
|
-
//# sourceMappingURL=activation.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"activation.d.ts","sourceRoot":"","sources":["../../../../../src/src/dsl/http/versori/activation.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,0CAA0C,CAAC;AAClE,OAAO,EAAE,UAAU,EAAE,kBAAkB,EAAE,IAAI,EAAE,MAAM,aAAa,CAAC;AAEnE,qBAAa,cAAe,YAAW,UAAU;IACtC,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,IAAI,CAAC;IAElB,OAAO,CAAC,SAAS,CAAC,CAA0B;IAC5C,OAAO,CAAC,kBAAkB,CAAqB;IAC/C,OAAO,CAAC,GAAG,CAAS;gBAGhB,EAAE,EAAE,MAAM,EACV,IAAI,EAAE,IAAI,EACV,kBAAkB,EAAE,kBAAkB,EACtC,GAAG,EAAE,MAAM,EACX,SAAS,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC;IAWtC,WAAW,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO;IAQ5B,WAAW,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,OAAO,GAAG,OAAO,CAAC,IAAI,CAAC;CAkBjE"}
|
|
@@ -1,65 +0,0 @@
|
|
|
1
|
-
export class ActivationImpl {
|
|
2
|
-
constructor(id, user, connectionProvider, log, variables) {
|
|
3
|
-
Object.defineProperty(this, "id", {
|
|
4
|
-
enumerable: true,
|
|
5
|
-
configurable: true,
|
|
6
|
-
writable: true,
|
|
7
|
-
value: void 0
|
|
8
|
-
});
|
|
9
|
-
Object.defineProperty(this, "user", {
|
|
10
|
-
enumerable: true,
|
|
11
|
-
configurable: true,
|
|
12
|
-
writable: true,
|
|
13
|
-
value: void 0
|
|
14
|
-
});
|
|
15
|
-
Object.defineProperty(this, "variables", {
|
|
16
|
-
enumerable: true,
|
|
17
|
-
configurable: true,
|
|
18
|
-
writable: true,
|
|
19
|
-
value: void 0
|
|
20
|
-
});
|
|
21
|
-
Object.defineProperty(this, "connectionProvider", {
|
|
22
|
-
enumerable: true,
|
|
23
|
-
configurable: true,
|
|
24
|
-
writable: true,
|
|
25
|
-
value: void 0
|
|
26
|
-
});
|
|
27
|
-
Object.defineProperty(this, "log", {
|
|
28
|
-
enumerable: true,
|
|
29
|
-
configurable: true,
|
|
30
|
-
writable: true,
|
|
31
|
-
value: void 0
|
|
32
|
-
});
|
|
33
|
-
this.id = id;
|
|
34
|
-
this.user = user;
|
|
35
|
-
this.connectionProvider = connectionProvider;
|
|
36
|
-
this.variables = variables;
|
|
37
|
-
this.log = log.child({
|
|
38
|
-
activationId: id,
|
|
39
|
-
});
|
|
40
|
-
}
|
|
41
|
-
getVariable(name) {
|
|
42
|
-
if (!this.variables) {
|
|
43
|
-
this.log.error(`No variables found for activation`);
|
|
44
|
-
return undefined;
|
|
45
|
-
}
|
|
46
|
-
return this.variables[name];
|
|
47
|
-
}
|
|
48
|
-
async setVariable(name, value) {
|
|
49
|
-
if (!this.variables) {
|
|
50
|
-
this.log.error(`No variables found for activation`);
|
|
51
|
-
return;
|
|
52
|
-
}
|
|
53
|
-
try {
|
|
54
|
-
await this.connectionProvider.updateDynamicVariable(this.id, name, value);
|
|
55
|
-
}
|
|
56
|
-
catch (err) {
|
|
57
|
-
this.log.error(`Failed to set variable`, {
|
|
58
|
-
error: err,
|
|
59
|
-
variableName: name,
|
|
60
|
-
});
|
|
61
|
-
return;
|
|
62
|
-
}
|
|
63
|
-
this.variables[name] = value;
|
|
64
|
-
}
|
|
65
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"cli.d.ts","sourceRoot":"","sources":["../../../../../src/src/dsl/http/versori/cli.ts"],"names":[],"mappings":"AAiBA,wBAAgB,gBAAgB,IAAI,MAAM,CAoBzC"}
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
// This file contains functions that can read stuff generated by the Versori CLI. This is used when running locally.
|
|
2
|
-
import { homedir } from 'node:os';
|
|
3
|
-
const cookiesFileName = 'cookies.json';
|
|
4
|
-
const versoriCookieName = 'versori_sess';
|
|
5
|
-
export function getVersoriCookie() {
|
|
6
|
-
const cookiesFilePath = `${homedir()}/.config/versori/${cookiesFileName}`;
|
|
7
|
-
let cookiesFile;
|
|
8
|
-
try {
|
|
9
|
-
cookiesFile = JSON.parse(Deno.readTextFileSync(cookiesFilePath));
|
|
10
|
-
}
|
|
11
|
-
catch (e) {
|
|
12
|
-
console.error('Error reading file, have you run the Versori CLI to log in?');
|
|
13
|
-
throw new Error(`Failed to read or parse cookies file at ${cookiesFilePath}: ${e}`);
|
|
14
|
-
}
|
|
15
|
-
const versoriCookie = cookiesFile.cookies.find(cookie => cookie.Name === versoriCookieName);
|
|
16
|
-
if (!versoriCookie) {
|
|
17
|
-
throw new Error(`Cookie 'versori_sess' not found in ${cookiesFilePath}`);
|
|
18
|
-
}
|
|
19
|
-
return `${versoriCookieName}=${versoriCookie.Value}`;
|
|
20
|
-
}
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
export declare const envVarOrgId = "RUN_ORGANISATION_ID";
|
|
2
|
-
export declare const envVarEnvId = "RUN_ENVIRONMENT_ID";
|
|
3
|
-
export declare const envVarEnvironmentName = "RUN_ENVIRONMENT";
|
|
4
|
-
export declare const envVarProjectId = "RUN_SERVICE_ID";
|
|
5
|
-
export declare const envVarOrgSlug = "RUN_ORGANISATION_SLUG";
|
|
6
|
-
export declare const envVarPlatformApiBaseURL = "RUN_PLATFORM_API_INTERNAL_URL";
|
|
7
|
-
export declare const envVarCronApiBaseURL = "RUN_CRON_API_INTERNAL_URL";
|
|
8
|
-
export declare const envVarSDKApiBaseURL = "RUN_SDK_API_URL";
|
|
9
|
-
export declare const envVarSelfRefURL = "RUN_SELF_REF_URL";
|
|
10
|
-
export declare const envVarCredsBaseURL = "RUN_CREDENTIALS_SERVICE_INTERNAL_URL";
|
|
11
|
-
export declare const envVarOtelTracesURL = "RUN_OTEL_TRACES_URL";
|
|
12
|
-
export declare const envVarVersion = "RUN_SERVICE_VERSION";
|
|
13
|
-
export declare const envVarConfigFile = "RUN_CONFIG_FILE";
|
|
14
|
-
export declare const envVarClientId = "RUN_CLIENT_ID";
|
|
15
|
-
export declare const envVarClientSecret = "RUN_CLIENT_SECRET";
|
|
16
|
-
export declare const envVarTokenEndpoint = "RUN_TOKEN_ENDPOINT";
|
|
17
|
-
export declare const envVarInternalToken = "RUN_INTERNAL_TOKEN";
|
|
18
|
-
export declare const envVarLocalRun = "RUN_LOCAL";
|
|
19
|
-
export declare const cronPort = 3001;
|
|
20
|
-
//# sourceMappingURL=constants.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../../../../src/src/dsl/http/versori/constants.ts"],"names":[],"mappings":"AAGA,eAAO,MAAM,WAAW,wBAAwB,CAAC;AACjD,eAAO,MAAM,WAAW,uBAAuB,CAAC;AAChD,eAAO,MAAM,qBAAqB,oBAAoB,CAAC;AACvD,eAAO,MAAM,eAAe,mBAAmB,CAAC;AAChD,eAAO,MAAM,aAAa,0BAA0B,CAAC;AACrD,eAAO,MAAM,wBAAwB,kCAAkC,CAAC;AACxE,eAAO,MAAM,oBAAoB,8BAA8B,CAAC;AAChE,eAAO,MAAM,mBAAmB,oBAAoB,CAAC;AACrD,eAAO,MAAM,gBAAgB,qBAAqB,CAAC;AACnD,eAAO,MAAM,kBAAkB,yCAAyC,CAAC;AACzE,eAAO,MAAM,mBAAmB,wBAAwB,CAAC;AACzD,eAAO,MAAM,aAAa,wBAAwB,CAAC;AAEnD,eAAO,MAAM,gBAAgB,oBAAoB,CAAC;AAGlD,eAAO,MAAM,cAAc,kBAAkB,CAAC;AAC9C,eAAO,MAAM,kBAAkB,sBAAsB,CAAC;AACtD,eAAO,MAAM,mBAAmB,uBAAuB,CAAC;AACxD,eAAO,MAAM,mBAAmB,uBAAuB,CAAC;AAGxD,eAAO,MAAM,cAAc,cAAc,CAAC;AAG1C,eAAO,MAAM,QAAQ,OAAO,CAAC"}
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
//TODO(@teo): remove this file, it is implemented in the src/internal/constants.ts directory now.
|
|
2
|
-
// This file contains constants used in the Versori DSL HTTP client.
|
|
3
|
-
export const envVarOrgId = 'RUN_ORGANISATION_ID';
|
|
4
|
-
export const envVarEnvId = 'RUN_ENVIRONMENT_ID';
|
|
5
|
-
export const envVarEnvironmentName = 'RUN_ENVIRONMENT';
|
|
6
|
-
export const envVarProjectId = 'RUN_SERVICE_ID';
|
|
7
|
-
export const envVarOrgSlug = 'RUN_ORGANISATION_SLUG';
|
|
8
|
-
export const envVarPlatformApiBaseURL = 'RUN_PLATFORM_API_INTERNAL_URL';
|
|
9
|
-
export const envVarCronApiBaseURL = 'RUN_CRON_API_INTERNAL_URL';
|
|
10
|
-
export const envVarSDKApiBaseURL = 'RUN_SDK_API_URL';
|
|
11
|
-
export const envVarSelfRefURL = 'RUN_SELF_REF_URL';
|
|
12
|
-
export const envVarCredsBaseURL = 'RUN_CREDENTIALS_SERVICE_INTERNAL_URL';
|
|
13
|
-
export const envVarOtelTracesURL = 'RUN_OTEL_TRACES_URL';
|
|
14
|
-
export const envVarVersion = 'RUN_SERVICE_VERSION';
|
|
15
|
-
// The following environment variables are used for the config file
|
|
16
|
-
export const envVarConfigFile = 'RUN_CONFIG_FILE';
|
|
17
|
-
// The following environment variables are used for internal authentication
|
|
18
|
-
export const envVarClientId = 'RUN_CLIENT_ID';
|
|
19
|
-
export const envVarClientSecret = 'RUN_CLIENT_SECRET';
|
|
20
|
-
export const envVarTokenEndpoint = 'RUN_TOKEN_ENDPOINT';
|
|
21
|
-
export const envVarInternalToken = 'RUN_INTERNAL_TOKEN';
|
|
22
|
-
// The following are for running locally
|
|
23
|
-
export const envVarLocalRun = 'RUN_LOCAL';
|
|
24
|
-
// please no changerino
|
|
25
|
-
export const cronPort = 3001; // The port on which the cron API communicates with the service
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
type internalAuthHeader = {
|
|
2
|
-
[key: string]: string;
|
|
3
|
-
};
|
|
4
|
-
export declare class InternalAuth {
|
|
5
|
-
private clientId;
|
|
6
|
-
private clientSecret;
|
|
7
|
-
private tokenEndpoint;
|
|
8
|
-
private runLocal;
|
|
9
|
-
private accessToken;
|
|
10
|
-
private expiresAt;
|
|
11
|
-
constructor();
|
|
12
|
-
getAuthHeader(): Promise<internalAuthHeader>;
|
|
13
|
-
}
|
|
14
|
-
export {};
|
|
15
|
-
//# sourceMappingURL=internalauth.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"internalauth.d.ts","sourceRoot":"","sources":["../../../../../src/src/dsl/http/versori/internalauth.ts"],"names":[],"mappings":"AASA,KAAK,kBAAkB,GAAG;IAAE,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAAA;CAAE,CAAC;AAEpD,qBAAa,YAAY;IACrB,OAAO,CAAC,QAAQ,CAAS;IACzB,OAAO,CAAC,YAAY,CAAS;IAC7B,OAAO,CAAC,aAAa,CAAS;IAC9B,OAAO,CAAC,QAAQ,CAAU;IAE1B,OAAO,CAAC,WAAW,CAAS;IAC5B,OAAO,CAAC,SAAS,CAAS;;IAkCpB,aAAa,IAAI,OAAO,CAAC,kBAAkB,CAAC;CA0BrD"}
|