@versori/run 0.5.0 → 0.5.2
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/mod.d.ts +1 -1
- package/esm/mod.d.ts.map +1 -1
- package/esm/mod.js +1 -1
- package/esm/src/connection/VanillaConnectionFactory.d.ts +16 -0
- package/esm/src/connection/VanillaConnectionFactory.d.ts.map +1 -0
- package/esm/src/connection/VanillaConnectionFactory.js +35 -0
- package/esm/src/context/ActivationImpl.d.ts +2 -1
- package/esm/src/context/ActivationImpl.d.ts.map +1 -1
- package/esm/src/context/Context.d.ts +2 -1
- package/esm/src/context/Context.d.ts.map +1 -1
- package/esm/src/context/ContextProvider.d.ts +8 -8
- package/esm/src/context/ContextProvider.d.ts.map +1 -1
- package/esm/src/context/ContextProvider.js +1 -1
- package/esm/src/context/VanillaContext.d.ts +63 -0
- package/esm/src/context/VanillaContext.d.ts.map +1 -0
- package/esm/src/context/VanillaContext.js +313 -0
- package/esm/src/context/WorkflowClient.d.ts +2 -2
- package/esm/src/context/WorkflowClient.d.ts.map +1 -1
- package/esm/src/dsl/http/mod.d.ts +1 -1
- package/esm/src/dsl/http/mod.d.ts.map +1 -1
- package/esm/src/dsl/http/types.d.ts +20 -134
- package/esm/src/dsl/http/types.d.ts.map +1 -1
- package/esm/src/dsl/http/versori/configloader.d.ts.map +1 -1
- package/esm/src/dsl/http/versori/configloader.js +3 -0
- 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/tasks/HttpTask.d.ts +4 -4
- package/esm/src/dsl/tasks/HttpTask.d.ts.map +1 -1
- package/esm/src/dsl/triggers/ScheduleTrigger.d.ts +2 -2
- package/esm/src/dsl/triggers/ScheduleTrigger.d.ts.map +1 -1
- package/esm/src/interpreter/durable/DurableInterpreter.d.ts +1 -0
- package/esm/src/interpreter/durable/DurableInterpreter.d.ts.map +1 -1
- package/esm/src/interpreter/durable/DurableInterpreter.js +24 -7
- package/esm/src/interpreter/durable/Queue.d.ts +1 -1
- package/esm/src/interpreter/durable/Queue.js +1 -1
- package/esm/src/interpreter/durable/compilers/durableworkflow.d.ts.map +1 -1
- package/esm/src/interpreter/durable/compilers/durableworkflow.js +2 -1
- package/esm/src/interpreter/durable/compilers/fn.d.ts.map +1 -1
- package/esm/src/interpreter/durable/compilers/fn.js +7 -4
- package/esm/src/interpreter/durable/compilers/webhook.d.ts.map +1 -1
- package/esm/src/interpreter/durable/compilers/webhook.js +7 -6
- package/esm/src/interpreter/memory/MemoryInterpreter.d.ts +3 -2
- package/esm/src/interpreter/memory/MemoryInterpreter.d.ts.map +1 -1
- package/esm/src/interpreter/memory/MemoryInterpreter.js +24 -7
- package/esm/src/interpreter/memory/compilers/fn.d.ts.map +1 -1
- package/esm/src/interpreter/memory/compilers/fn.js +7 -4
- package/esm/src/interpreter/memory/compilers/schedule.d.ts.map +1 -1
- package/esm/src/interpreter/memory/compilers/webhook.d.ts.map +1 -1
- package/esm/src/interpreter/memory/compilers/webhook.js +7 -6
- package/esm/src/interpreter/mod.d.ts +1 -0
- package/esm/src/interpreter/mod.d.ts.map +1 -1
- package/esm/src/interpreter/mod.js +1 -0
- package/esm/src/interpreter/vanilla/ExecutionError.d.ts +25 -0
- package/esm/src/interpreter/vanilla/ExecutionError.d.ts.map +1 -0
- package/esm/src/interpreter/vanilla/ExecutionError.js +46 -0
- package/esm/src/interpreter/vanilla/ObservableCompiler.d.ts +38 -0
- package/esm/src/interpreter/vanilla/ObservableCompiler.d.ts.map +1 -0
- package/esm/src/interpreter/vanilla/ObservableCompiler.js +95 -0
- package/esm/src/interpreter/vanilla/VanillaInterpreter.d.ts +96 -0
- package/esm/src/interpreter/vanilla/VanillaInterpreter.d.ts.map +1 -0
- package/esm/src/interpreter/vanilla/VanillaInterpreter.js +435 -0
- package/esm/src/interpreter/vanilla/compilers/background.d.ts +4 -0
- package/esm/src/interpreter/vanilla/compilers/background.d.ts.map +1 -0
- package/esm/src/interpreter/vanilla/compilers/background.js +34 -0
- package/esm/src/interpreter/vanilla/compilers/catch.d.ts +4 -0
- package/esm/src/interpreter/vanilla/compilers/catch.d.ts.map +1 -0
- package/esm/src/interpreter/vanilla/compilers/catch.js +75 -0
- package/esm/src/interpreter/vanilla/compilers/chain.d.ts +3 -0
- package/esm/src/interpreter/vanilla/compilers/chain.d.ts.map +1 -0
- package/esm/src/interpreter/vanilla/compilers/chain.js +21 -0
- package/esm/src/interpreter/vanilla/compilers/durableworkflow.d.ts +8 -0
- package/esm/src/interpreter/vanilla/compilers/durableworkflow.d.ts.map +1 -0
- package/esm/src/interpreter/vanilla/compilers/durableworkflow.js +91 -0
- package/esm/src/interpreter/vanilla/compilers/fn.d.ts +4 -0
- package/esm/src/interpreter/vanilla/compilers/fn.d.ts.map +1 -0
- package/esm/src/interpreter/vanilla/compilers/fn.js +37 -0
- package/esm/src/interpreter/vanilla/compilers/http.d.ts +4 -0
- package/esm/src/interpreter/vanilla/compilers/http.d.ts.map +1 -0
- package/esm/src/interpreter/vanilla/compilers/http.js +54 -0
- package/esm/src/interpreter/vanilla/compilers/mod.d.ts +2 -0
- package/esm/src/interpreter/vanilla/compilers/mod.d.ts.map +1 -0
- package/esm/src/interpreter/vanilla/compilers/mod.js +13 -0
- package/esm/src/interpreter/vanilla/compilers/parallel.d.ts +4 -0
- package/esm/src/interpreter/vanilla/compilers/parallel.d.ts.map +1 -0
- package/esm/src/interpreter/vanilla/compilers/parallel.js +31 -0
- package/esm/src/interpreter/vanilla/compilers/schedule.d.ts +4 -0
- package/esm/src/interpreter/vanilla/compilers/schedule.d.ts.map +1 -0
- package/esm/src/interpreter/vanilla/compilers/schedule.js +76 -0
- package/esm/src/interpreter/vanilla/compilers/serial.d.ts +4 -0
- package/esm/src/interpreter/vanilla/compilers/serial.d.ts.map +1 -0
- package/esm/src/interpreter/vanilla/compilers/serial.js +28 -0
- package/esm/src/interpreter/vanilla/compilers/types.d.ts +15 -0
- package/esm/src/interpreter/vanilla/compilers/types.d.ts.map +1 -0
- package/esm/src/interpreter/vanilla/compilers/types.js +13 -0
- package/esm/src/interpreter/vanilla/compilers/unpack.d.ts +4 -0
- package/esm/src/interpreter/vanilla/compilers/unpack.d.ts.map +1 -0
- package/esm/src/interpreter/vanilla/compilers/unpack.js +34 -0
- package/esm/src/interpreter/vanilla/compilers/webhook.d.ts +4 -0
- package/esm/src/interpreter/vanilla/compilers/webhook.d.ts.map +1 -0
- package/esm/src/interpreter/vanilla/compilers/webhook.js +261 -0
- package/esm/src/interpreter/vanilla/mod.d.ts +3 -0
- package/esm/src/interpreter/vanilla/mod.d.ts.map +1 -0
- package/esm/src/interpreter/vanilla/mod.js +14 -0
- package/esm/src/issues/Issues.d.ts.map +1 -1
- package/esm/src/observability/logging/ConsoleLogger.d.ts +1 -1
- package/esm/src/observability/logging/ConsoleLogger.d.ts.map +1 -1
- package/esm/src/observability/logging/ConsoleLogger.js +11 -1
- package/esm/src/services/platform/generated/core/pathSerializer.gen.d.ts +2 -2
- package/package.json +1 -1
- package/script/mod.d.ts +1 -1
- package/script/mod.d.ts.map +1 -1
- package/script/mod.js +2 -1
- package/script/src/connection/VanillaConnectionFactory.d.ts +16 -0
- package/script/src/connection/VanillaConnectionFactory.d.ts.map +1 -0
- package/script/src/connection/VanillaConnectionFactory.js +40 -0
- package/script/src/context/ActivationImpl.d.ts +2 -1
- package/script/src/context/ActivationImpl.d.ts.map +1 -1
- package/script/src/context/Context.d.ts +2 -1
- package/script/src/context/Context.d.ts.map +1 -1
- package/script/src/context/ContextProvider.d.ts +8 -8
- package/script/src/context/ContextProvider.d.ts.map +1 -1
- package/script/src/context/ContextProvider.js +1 -1
- package/script/src/context/VanillaContext.d.ts +63 -0
- package/script/src/context/VanillaContext.d.ts.map +1 -0
- package/script/src/context/VanillaContext.js +319 -0
- package/script/src/context/WorkflowClient.d.ts +2 -2
- package/script/src/context/WorkflowClient.d.ts.map +1 -1
- package/script/src/dsl/http/mod.d.ts +1 -1
- package/script/src/dsl/http/mod.d.ts.map +1 -1
- package/script/src/dsl/http/types.d.ts +20 -134
- package/script/src/dsl/http/types.d.ts.map +1 -1
- package/script/src/dsl/http/versori/configloader.d.ts.map +1 -1
- package/script/src/dsl/http/versori/configloader.js +3 -0
- 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/tasks/HttpTask.d.ts +4 -4
- package/script/src/dsl/tasks/HttpTask.d.ts.map +1 -1
- package/script/src/dsl/triggers/ScheduleTrigger.d.ts +2 -2
- package/script/src/dsl/triggers/ScheduleTrigger.d.ts.map +1 -1
- package/script/src/interpreter/durable/DurableInterpreter.d.ts +1 -0
- package/script/src/interpreter/durable/DurableInterpreter.d.ts.map +1 -1
- package/script/src/interpreter/durable/DurableInterpreter.js +24 -7
- package/script/src/interpreter/durable/Queue.d.ts +1 -1
- package/script/src/interpreter/durable/Queue.js +1 -1
- package/script/src/interpreter/durable/compilers/durableworkflow.d.ts.map +1 -1
- package/script/src/interpreter/durable/compilers/durableworkflow.js +2 -1
- package/script/src/interpreter/durable/compilers/fn.d.ts.map +1 -1
- package/script/src/interpreter/durable/compilers/fn.js +7 -4
- package/script/src/interpreter/durable/compilers/webhook.d.ts.map +1 -1
- package/script/src/interpreter/durable/compilers/webhook.js +7 -6
- package/script/src/interpreter/memory/MemoryInterpreter.d.ts +3 -2
- package/script/src/interpreter/memory/MemoryInterpreter.d.ts.map +1 -1
- package/script/src/interpreter/memory/MemoryInterpreter.js +24 -7
- package/script/src/interpreter/memory/compilers/fn.d.ts.map +1 -1
- package/script/src/interpreter/memory/compilers/fn.js +7 -4
- package/script/src/interpreter/memory/compilers/schedule.d.ts.map +1 -1
- package/script/src/interpreter/memory/compilers/webhook.d.ts.map +1 -1
- package/script/src/interpreter/memory/compilers/webhook.js +7 -6
- package/script/src/interpreter/mod.d.ts +1 -0
- package/script/src/interpreter/mod.d.ts.map +1 -1
- package/script/src/interpreter/mod.js +2 -1
- package/script/src/interpreter/vanilla/ExecutionError.d.ts +25 -0
- package/script/src/interpreter/vanilla/ExecutionError.d.ts.map +1 -0
- package/script/src/interpreter/vanilla/ExecutionError.js +50 -0
- package/script/src/interpreter/vanilla/ObservableCompiler.d.ts +38 -0
- package/script/src/interpreter/vanilla/ObservableCompiler.d.ts.map +1 -0
- package/script/src/interpreter/vanilla/ObservableCompiler.js +99 -0
- package/script/src/interpreter/vanilla/VanillaInterpreter.d.ts +96 -0
- package/script/src/interpreter/vanilla/VanillaInterpreter.d.ts.map +1 -0
- package/script/src/interpreter/vanilla/VanillaInterpreter.js +442 -0
- package/script/src/interpreter/vanilla/compilers/background.d.ts +4 -0
- package/script/src/interpreter/vanilla/compilers/background.d.ts.map +1 -0
- package/script/src/interpreter/vanilla/compilers/background.js +37 -0
- package/script/src/interpreter/vanilla/compilers/catch.d.ts +4 -0
- package/script/src/interpreter/vanilla/compilers/catch.d.ts.map +1 -0
- package/script/src/interpreter/vanilla/compilers/catch.js +78 -0
- package/script/src/interpreter/vanilla/compilers/chain.d.ts +3 -0
- package/script/src/interpreter/vanilla/compilers/chain.d.ts.map +1 -0
- package/script/src/interpreter/vanilla/compilers/chain.js +24 -0
- package/script/src/interpreter/vanilla/compilers/durableworkflow.d.ts +8 -0
- package/script/src/interpreter/vanilla/compilers/durableworkflow.d.ts.map +1 -0
- package/script/src/interpreter/vanilla/compilers/durableworkflow.js +95 -0
- package/script/src/interpreter/vanilla/compilers/fn.d.ts +4 -0
- package/script/src/interpreter/vanilla/compilers/fn.d.ts.map +1 -0
- package/script/src/interpreter/vanilla/compilers/fn.js +40 -0
- package/script/src/interpreter/vanilla/compilers/http.d.ts +4 -0
- package/script/src/interpreter/vanilla/compilers/http.d.ts.map +1 -0
- package/script/src/interpreter/vanilla/compilers/http.js +57 -0
- package/script/src/interpreter/vanilla/compilers/mod.d.ts +2 -0
- package/script/src/interpreter/vanilla/compilers/mod.d.ts.map +1 -0
- package/script/src/interpreter/vanilla/compilers/mod.js +14 -0
- package/script/src/interpreter/vanilla/compilers/parallel.d.ts +4 -0
- package/script/src/interpreter/vanilla/compilers/parallel.d.ts.map +1 -0
- package/script/src/interpreter/vanilla/compilers/parallel.js +34 -0
- package/script/src/interpreter/vanilla/compilers/schedule.d.ts +4 -0
- package/script/src/interpreter/vanilla/compilers/schedule.d.ts.map +1 -0
- package/script/src/interpreter/vanilla/compilers/schedule.js +79 -0
- package/script/src/interpreter/vanilla/compilers/serial.d.ts +4 -0
- package/script/src/interpreter/vanilla/compilers/serial.d.ts.map +1 -0
- package/script/src/interpreter/vanilla/compilers/serial.js +31 -0
- package/script/src/interpreter/vanilla/compilers/types.d.ts +15 -0
- package/script/src/interpreter/vanilla/compilers/types.d.ts.map +1 -0
- package/script/src/interpreter/vanilla/compilers/types.js +14 -0
- package/script/src/interpreter/vanilla/compilers/unpack.d.ts +4 -0
- package/script/src/interpreter/vanilla/compilers/unpack.d.ts.map +1 -0
- package/script/src/interpreter/vanilla/compilers/unpack.js +37 -0
- package/script/src/interpreter/vanilla/compilers/webhook.d.ts +4 -0
- package/script/src/interpreter/vanilla/compilers/webhook.d.ts.map +1 -0
- package/script/src/interpreter/vanilla/compilers/webhook.js +267 -0
- package/script/src/interpreter/vanilla/mod.d.ts +3 -0
- package/script/src/interpreter/vanilla/mod.d.ts.map +1 -0
- package/script/src/interpreter/vanilla/mod.js +30 -0
- package/script/src/issues/Issues.d.ts.map +1 -1
- package/script/src/observability/logging/ConsoleLogger.d.ts +1 -1
- package/script/src/observability/logging/ConsoleLogger.d.ts.map +1 -1
- package/script/src/observability/logging/ConsoleLogger.js +11 -1
- package/script/src/services/platform/generated/core/pathSerializer.gen.d.ts +2 -2
|
@@ -0,0 +1,261 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright (c) 2025 Versori Group Inc
|
|
3
|
+
*
|
|
4
|
+
* Use of this software is governed by the Business Source License 1.1
|
|
5
|
+
* included in the LICENSE file at the root of this repository.
|
|
6
|
+
*
|
|
7
|
+
* Change Date: 2029-01-01
|
|
8
|
+
* Change License: Apache License, Version 2.0
|
|
9
|
+
*
|
|
10
|
+
* As of the Change Date, in accordance with the Business Source License,
|
|
11
|
+
* use of this software will be governed by the Apache License, Version 2.0.
|
|
12
|
+
*/
|
|
13
|
+
import cors from 'cors';
|
|
14
|
+
import express from 'express';
|
|
15
|
+
import xmlparser from 'express-xml-bodyparser';
|
|
16
|
+
import { pipeline } from 'node:stream/promises';
|
|
17
|
+
import { Observable } from 'rxjs';
|
|
18
|
+
import { WebhookTrigger } from '../../../dsl/triggers/WebhookTrigger.js';
|
|
19
|
+
import { VanillaActivation } from '../ObservableCompiler.js';
|
|
20
|
+
const xml2jsDefaults = {
|
|
21
|
+
explicitArray: false,
|
|
22
|
+
normalize: false,
|
|
23
|
+
normalizeTags: false,
|
|
24
|
+
trim: true,
|
|
25
|
+
};
|
|
26
|
+
const vanillaWebhookMiddleware = () => {
|
|
27
|
+
return (_, res, next) => {
|
|
28
|
+
res.locals.activation = VanillaActivation;
|
|
29
|
+
next();
|
|
30
|
+
};
|
|
31
|
+
};
|
|
32
|
+
const DEFAULT_SYNC_ON_SUCCESS = (ctx) => new Response(JSON.stringify(ctx.data), {
|
|
33
|
+
status: 200,
|
|
34
|
+
headers: {
|
|
35
|
+
'Content-Type': 'application/json',
|
|
36
|
+
'X-Execution-Id': ctx.executionId,
|
|
37
|
+
},
|
|
38
|
+
});
|
|
39
|
+
const DEFAULT_SYNC_ON_ERROR = (ctx) => new Response(JSON.stringify({ message: 'Internal server error', error: ctx.data }), {
|
|
40
|
+
status: 500,
|
|
41
|
+
headers: {
|
|
42
|
+
'Content-Type': 'application/json',
|
|
43
|
+
'X-Execution-Id': ctx.executionId,
|
|
44
|
+
},
|
|
45
|
+
});
|
|
46
|
+
const DEFAULT_ASYNC_ON_SUCCESS = (ctx) => new Response(JSON.stringify({
|
|
47
|
+
status: 'accepted',
|
|
48
|
+
executionId: ctx.executionId,
|
|
49
|
+
}), {
|
|
50
|
+
status: 202,
|
|
51
|
+
headers: {
|
|
52
|
+
'Content-Type': 'application/json',
|
|
53
|
+
'X-Execution-Id': ctx.executionId,
|
|
54
|
+
},
|
|
55
|
+
});
|
|
56
|
+
const DEFAULT_ASYNC_ON_ERROR = (ctx) => new Response(JSON.stringify({
|
|
57
|
+
message: 'Internal server error',
|
|
58
|
+
executionId: ctx.executionId,
|
|
59
|
+
}), {
|
|
60
|
+
status: 500,
|
|
61
|
+
headers: {
|
|
62
|
+
'Content-Type': 'application/json',
|
|
63
|
+
'X-Execution-Id': ctx.executionId,
|
|
64
|
+
},
|
|
65
|
+
});
|
|
66
|
+
export const webhookCompiler = {
|
|
67
|
+
ctor: WebhookTrigger,
|
|
68
|
+
compile: (ctx, trigger, signal) => {
|
|
69
|
+
const { response: { mode = 'async' } = {}, cors: corsOptions } = trigger.options;
|
|
70
|
+
const isSync = mode === 'sync';
|
|
71
|
+
const isAsync = mode === 'async';
|
|
72
|
+
if (!isSync && !isAsync) {
|
|
73
|
+
throw new Error('Invalid response mode, must be either "sync" or "async"');
|
|
74
|
+
}
|
|
75
|
+
const method = trigger.options.method || 'post';
|
|
76
|
+
const validMethods = ['get', 'post', 'put', 'delete', 'patch', 'options', 'head', 'all'];
|
|
77
|
+
if (method !== method.toLowerCase()) {
|
|
78
|
+
throw new Error(`HTTP method must be in lowercase: ${method} on webhook ${trigger.id}`);
|
|
79
|
+
}
|
|
80
|
+
if (!validMethods.includes(method)) {
|
|
81
|
+
throw new Error(`Unsupported HTTP method: ${method} on webhook ${trigger.id}. Must be one of: ${validMethods.join(', ')}`);
|
|
82
|
+
}
|
|
83
|
+
let onSuccess = isSync ? DEFAULT_SYNC_ON_SUCCESS : DEFAULT_ASYNC_ON_SUCCESS;
|
|
84
|
+
let onError = isSync ? DEFAULT_SYNC_ON_ERROR : DEFAULT_ASYNC_ON_ERROR;
|
|
85
|
+
if (trigger.options.response?.onSuccess) {
|
|
86
|
+
onSuccess = trigger.options.response.onSuccess;
|
|
87
|
+
}
|
|
88
|
+
if (trigger.options.response?.onError) {
|
|
89
|
+
onError = trigger.options.response.onError;
|
|
90
|
+
}
|
|
91
|
+
const ctxOptionsFn = (req, res) => ({
|
|
92
|
+
onSuccess: (ctx) => {
|
|
93
|
+
if (isSync) {
|
|
94
|
+
sendResponse(res, onSuccess(ctx));
|
|
95
|
+
}
|
|
96
|
+
},
|
|
97
|
+
onError: (ctx) => {
|
|
98
|
+
if (isSync) {
|
|
99
|
+
sendResponse(res, onError(ctx));
|
|
100
|
+
}
|
|
101
|
+
},
|
|
102
|
+
request: req,
|
|
103
|
+
});
|
|
104
|
+
const routeMiddleware = [];
|
|
105
|
+
if (!trigger.options.request?.rawBody) {
|
|
106
|
+
routeMiddleware.push(express.json({ limit: '50mb', type: ['application/json', '*/*+json'] }));
|
|
107
|
+
routeMiddleware.push(xmlparser(xml2jsDefaults));
|
|
108
|
+
}
|
|
109
|
+
else {
|
|
110
|
+
routeMiddleware.push(express.raw({ type: '*/*', limit: '50mb' }));
|
|
111
|
+
}
|
|
112
|
+
routeMiddleware.push(vanillaWebhookMiddleware());
|
|
113
|
+
return new Observable((subscriber) => {
|
|
114
|
+
if (!ctx.webhookRouter) {
|
|
115
|
+
throw new Error('Router not available in compiler context');
|
|
116
|
+
}
|
|
117
|
+
// add the webhook endpoint to the router
|
|
118
|
+
ctx.log.info('webhook endpoint added:', { trigger });
|
|
119
|
+
if (corsOptions) {
|
|
120
|
+
if (typeof corsOptions === 'boolean') {
|
|
121
|
+
ctx.webhookRouter.use(cors());
|
|
122
|
+
}
|
|
123
|
+
else {
|
|
124
|
+
ctx.webhookRouter.use(cors(corsOptions));
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
// endpoint for sans user because I'm not quite sure how the dynamic routing works
|
|
128
|
+
ctx.webhookRouter[method](`/${trigger.id}`, ...routeMiddleware, async (req, res) => {
|
|
129
|
+
await ctx.tracer.startActiveSpan(`webhook-${trigger.id}`, (span) => {
|
|
130
|
+
span.setAttribute('task.id', trigger.id);
|
|
131
|
+
span.setAttribute('task.type', 'webhook');
|
|
132
|
+
const staticActivation = res.locals.activation;
|
|
133
|
+
const executionCtx = ctx.contextProvider.create(staticActivation, req.body, ctxOptionsFn(req, res));
|
|
134
|
+
span.setAttribute('execution.id', executionCtx.executionId);
|
|
135
|
+
try {
|
|
136
|
+
subscriber.next(executionCtx);
|
|
137
|
+
if (isAsync) {
|
|
138
|
+
sendResponse(res, onSuccess(executionCtx));
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
catch (error) {
|
|
142
|
+
executionCtx.log.error('webhook execution error', {
|
|
143
|
+
error: JSON.stringify(error),
|
|
144
|
+
});
|
|
145
|
+
if (isAsync) {
|
|
146
|
+
sendResponse(res, onError(executionCtx.withData(error)));
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
finally {
|
|
150
|
+
span.end();
|
|
151
|
+
}
|
|
152
|
+
});
|
|
153
|
+
});
|
|
154
|
+
// this endpoint will trigger the workflow for each activation given by the external user ID
|
|
155
|
+
ctx.webhookRouter[method](`/${trigger.id}/users/:userId`, ...routeMiddleware, async (req, res) => {
|
|
156
|
+
await ctx.tracer.startActiveSpan(`webhook-${trigger.id}`, (span) => {
|
|
157
|
+
span.setAttribute('task.id', trigger.id);
|
|
158
|
+
span.setAttribute('task.type', 'webhook');
|
|
159
|
+
span.setAttribute('user.id', req.params.userId);
|
|
160
|
+
const userId = req.params.userId;
|
|
161
|
+
const activation = res.locals.activation;
|
|
162
|
+
// Right now we only support a user having one activation
|
|
163
|
+
// so this will need changing when we support multiple activations per user
|
|
164
|
+
// as will the middleware
|
|
165
|
+
if (!activation) {
|
|
166
|
+
res.status(404).json({
|
|
167
|
+
status: 'error',
|
|
168
|
+
message: `No activations found for user: ${userId}`,
|
|
169
|
+
});
|
|
170
|
+
span.setAttribute('error.message', `No activations found for user: ${userId}`);
|
|
171
|
+
span.setAttribute('http.status_code', '404');
|
|
172
|
+
span.end();
|
|
173
|
+
return;
|
|
174
|
+
}
|
|
175
|
+
const executionCtx = ctx.contextProvider.create(activation, req.body, ctxOptionsFn(req, res));
|
|
176
|
+
span.setAttribute('execution.id', executionCtx.executionId);
|
|
177
|
+
const errors = [];
|
|
178
|
+
try {
|
|
179
|
+
subscriber.next(executionCtx);
|
|
180
|
+
}
|
|
181
|
+
catch (error) {
|
|
182
|
+
executionCtx.log.error('webhook execution error', {
|
|
183
|
+
error: JSON.stringify(error),
|
|
184
|
+
});
|
|
185
|
+
errors.push({
|
|
186
|
+
activationId: activation.id,
|
|
187
|
+
error,
|
|
188
|
+
});
|
|
189
|
+
}
|
|
190
|
+
if (isAsync) {
|
|
191
|
+
if (errors.length === 0) {
|
|
192
|
+
sendResponse(res, onSuccess(executionCtx));
|
|
193
|
+
}
|
|
194
|
+
else {
|
|
195
|
+
sendResponse(res, onError(executionCtx.withData(errors)));
|
|
196
|
+
}
|
|
197
|
+
}
|
|
198
|
+
span.end();
|
|
199
|
+
});
|
|
200
|
+
});
|
|
201
|
+
// this endpoint will trigger the workflow only for the activation given by its ID
|
|
202
|
+
ctx.webhookRouter[method](`/${trigger.id}/activations/:activationId`, ...routeMiddleware, async (req, res) => {
|
|
203
|
+
await ctx.tracer.startActiveSpan(`webhook-${trigger.id}`, (span) => {
|
|
204
|
+
span.setAttribute('task.id', trigger.id);
|
|
205
|
+
span.setAttribute('task.type', 'webhook');
|
|
206
|
+
span.setAttribute('activation.id', req.params.activationId);
|
|
207
|
+
const activation = res.locals.activation;
|
|
208
|
+
const activationId = activation?.id ?? req.params.activationId;
|
|
209
|
+
if (!activation) {
|
|
210
|
+
// TODO report back actual errors
|
|
211
|
+
res.status(404).json({
|
|
212
|
+
status: 'error',
|
|
213
|
+
message: `No activation found for ID: ${activationId}`,
|
|
214
|
+
});
|
|
215
|
+
span.setAttribute('error.message', `No activation found for ID: ${activationId}`);
|
|
216
|
+
span.setAttribute('http.status_code', '404');
|
|
217
|
+
span.end();
|
|
218
|
+
return;
|
|
219
|
+
}
|
|
220
|
+
const activationCtx = ctx.contextProvider.create(activation, req.body, ctxOptionsFn(req, res));
|
|
221
|
+
span.setAttribute('execution.id', activationCtx.executionId);
|
|
222
|
+
try {
|
|
223
|
+
subscriber.next(activationCtx);
|
|
224
|
+
if (isAsync) {
|
|
225
|
+
sendResponse(res, onSuccess(activationCtx));
|
|
226
|
+
}
|
|
227
|
+
}
|
|
228
|
+
catch (error) {
|
|
229
|
+
activationCtx.log.error('webhook execution error', {
|
|
230
|
+
error: JSON.stringify(error),
|
|
231
|
+
});
|
|
232
|
+
if (isAsync) {
|
|
233
|
+
sendResponse(res, onError(activationCtx.withData(error)));
|
|
234
|
+
}
|
|
235
|
+
}
|
|
236
|
+
finally {
|
|
237
|
+
span.end();
|
|
238
|
+
}
|
|
239
|
+
});
|
|
240
|
+
});
|
|
241
|
+
function cleanup() {
|
|
242
|
+
ctx.log.debug('webhook trigger stopped');
|
|
243
|
+
subscriber.complete();
|
|
244
|
+
}
|
|
245
|
+
signal.addEventListener('abort', cleanup, { once: true });
|
|
246
|
+
return () => {
|
|
247
|
+
signal.removeEventListener('abort', cleanup);
|
|
248
|
+
ctx.log.debug('webhook execution unsubscribed');
|
|
249
|
+
};
|
|
250
|
+
});
|
|
251
|
+
},
|
|
252
|
+
};
|
|
253
|
+
function sendResponse(res, response) {
|
|
254
|
+
res.status(response.status);
|
|
255
|
+
response.headers.forEach((value, key) => {
|
|
256
|
+
res.setHeader(key, value);
|
|
257
|
+
});
|
|
258
|
+
if (response.body) {
|
|
259
|
+
pipeline(response.body, res);
|
|
260
|
+
}
|
|
261
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mod.d.ts","sourceRoot":"","sources":["../../../../src/src/interpreter/vanilla/mod.ts"],"names":[],"mappings":"AAaA,cAAc,yBAAyB,CAAC;AACxC,cAAc,qBAAqB,CAAC"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright (c) 2025 Versori Group Inc
|
|
3
|
+
*
|
|
4
|
+
* Use of this software is governed by the Business Source License 1.1
|
|
5
|
+
* included in the LICENSE file at the root of this repository.
|
|
6
|
+
*
|
|
7
|
+
* Change Date: 2029-01-01
|
|
8
|
+
* Change License: Apache License, Version 2.0
|
|
9
|
+
*
|
|
10
|
+
* As of the Change Date, in accordance with the Business Source License,
|
|
11
|
+
* use of this software will be governed by the Apache License, Version 2.0.
|
|
12
|
+
*/
|
|
13
|
+
export * from './VanillaInterpreter.js';
|
|
14
|
+
export * from './ExecutionError.js';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Issues.d.ts","sourceRoot":"","sources":["../../../src/src/issues/Issues.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"Issues.d.ts","sourceRoot":"","sources":["../../../src/src/issues/Issues.ts"],"names":[],"mappings":"AAaA,OAAO,EAAE,MAAM,EAAE,MAAM,yBAAyB,CAAC;AAWjD,MAAM,MAAM,WAAW,GAAG;IACtB,MAAM,EAAE,QAAQ,GAAG,OAAO,CAAC;IAC3B,QAAQ,EAAE,KAAK,GAAG,QAAQ,GAAG,MAAM,CAAC;IACpC,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,WAAW,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACrC,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;CACnC,CAAC;AAEF,MAAM,MAAM,KAAK,GAAG;IAChB,EAAE,EAAE,MAAM,CAAC;IACX,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,EAAE,MAAM,CAAC;IAChB,WAAW,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACpC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAC/B,SAAS,E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,cAAc,CAAC,EAAE,MAAM,CAAC;KAC3B,GAAG,OAAO,CAAC,KAAK,GAAG,IAAI,CAAC;YAWX,MAAM;CA2DvB;AAED,qBAAa,UAAW,YAAW,QAAQ;IACvC,WAAW,CAAC,CAAC,EAAE,WAAW,GAAG,OAAO,CAAC,IAAI,CAAC;IAI1C,WAAW,CAAC,CAAC,EAAE,WAAW,EAAE,QAAQ,CAAC,EAAE;QACnC,WAAW,CAAC,EAAE,OAAO,CAAC;QACtB,cAAc,CAAC,EAAE,MAAM,CAAC;KAC3B,GAAG,OAAO,CAAC,KAAK,GAAG,IAAI,CAAC;CAG5B"}
|
|
@@ -10,7 +10,7 @@ export declare class ConsoleLogger implements Logger {
|
|
|
10
10
|
log: log.Logger;
|
|
11
11
|
level: LogLevel;
|
|
12
12
|
fields: Record<string, unknown>;
|
|
13
|
-
constructor(level
|
|
13
|
+
constructor(level?: LogLevel, fields?: Record<string, unknown>);
|
|
14
14
|
debug(message: string, fields?: Record<string, unknown>): void;
|
|
15
15
|
warn(message: string, fields?: Record<string, unknown>): void;
|
|
16
16
|
info(message: string, fields?: Record<string, unknown>): void;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ConsoleLogger.d.ts","sourceRoot":"","sources":["../../../../src/src/observability/logging/ConsoleLogger.ts"],"names":[],"mappings":"AAaA,OAAO,KAAK,GAAG,MAAM,+CAA+C,CAAC;AACrE,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;
|
|
1
|
+
{"version":3,"file":"ConsoleLogger.d.ts","sourceRoot":"","sources":["../../../../src/src/observability/logging/ConsoleLogger.ts"],"names":[],"mappings":"AAaA,OAAO,KAAK,GAAG,MAAM,+CAA+C,CAAC;AACrE,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AAmN/C;;;;;GAKG;AACH,qBAAa,aAAc,YAAW,MAAM;IACxC,GAAG,EAAE,GAAG,CAAC,MAAM,CAAC;IAEhB,KAAK,EAAE,QAAQ,CAAC;IAEhB,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;gBAEpB,KAAK,GAAE,QAAqD,EAAE,MAAM,GAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAM;IAO9G,KAAK,CAAC,OAAO,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,IAAI;IAO9D,IAAI,CAAC,OAAO,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,IAAI;IAO7D,IAAI,CAAC,OAAO,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,IAAI;IAO7D,KAAK,CAAC,OAAO,EAAE,MAAM,EAAE,GAAG,CAAC,EAAE,KAAK,EAAE,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,IAAI;IAC3E,KAAK,CAAC,OAAO,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,IAAI;IAsB9D,KAAK,CAAC,MAAM,EAAE;QAAE,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAAA;KAAE,GAAG,aAAa;IAOvD,QAAQ,CAAC,KAAK,EAAE,QAAQ,GAAG,IAAI;CAIlC"}
|
|
@@ -11,9 +11,18 @@
|
|
|
11
11
|
* use of this software will be governed by the Apache License, Version 2.0.
|
|
12
12
|
*/
|
|
13
13
|
import * as log from '../../../deps/jsr.io/@std/log/0.224.14/mod.js';
|
|
14
|
+
const defaultLogLevel = 'info';
|
|
15
|
+
const validLogLevels = ['debug', 'warn', 'info', 'error'];
|
|
14
16
|
function isObjectLiteral(obj) {
|
|
15
17
|
return Object.getPrototypeOf(obj) === Object.prototype;
|
|
16
18
|
}
|
|
19
|
+
function resolveLogLevel(level) {
|
|
20
|
+
const normalized = level?.toLowerCase();
|
|
21
|
+
if (normalized && validLogLevels.includes(normalized)) {
|
|
22
|
+
return normalized;
|
|
23
|
+
}
|
|
24
|
+
return defaultLogLevel;
|
|
25
|
+
}
|
|
17
26
|
function formatError(err) {
|
|
18
27
|
if (Symbol.toPrimitive in err) {
|
|
19
28
|
const toPrimitive = err[Symbol.toPrimitive];
|
|
@@ -178,7 +187,7 @@ const levelMap = {
|
|
|
178
187
|
* and proper error serialization.
|
|
179
188
|
*/
|
|
180
189
|
export class ConsoleLogger {
|
|
181
|
-
constructor(level, fields = {}) {
|
|
190
|
+
constructor(level = resolveLogLevel(Deno.env.get('LOG_LEVEL')), fields = {}) {
|
|
182
191
|
Object.defineProperty(this, "log", {
|
|
183
192
|
enumerable: true,
|
|
184
193
|
configurable: true,
|
|
@@ -241,6 +250,7 @@ export class ConsoleLogger {
|
|
|
241
250
|
});
|
|
242
251
|
}
|
|
243
252
|
setLevel(level) {
|
|
253
|
+
this.level = level;
|
|
244
254
|
this.log.level = levelMap[level] ?? log.getLevelByName('INFO');
|
|
245
255
|
}
|
|
246
256
|
}
|
|
@@ -19,9 +19,9 @@ type ObjectSeparatorStyle = ObjectStyle | MatrixStyle;
|
|
|
19
19
|
interface SerializePrimitiveParam extends SerializePrimitiveOptions {
|
|
20
20
|
value: string;
|
|
21
21
|
}
|
|
22
|
-
export declare const separatorArrayExplode: (style: ArraySeparatorStyle) => "
|
|
22
|
+
export declare const separatorArrayExplode: (style: ArraySeparatorStyle) => "." | ";" | "," | "&";
|
|
23
23
|
export declare const separatorArrayNoExplode: (style: ArraySeparatorStyle) => "," | "|" | "%20";
|
|
24
|
-
export declare const separatorObjectExplode: (style: ObjectSeparatorStyle) => "
|
|
24
|
+
export declare const separatorObjectExplode: (style: ObjectSeparatorStyle) => "." | ";" | "," | "&";
|
|
25
25
|
export declare const serializeArrayParam: ({ allowReserved, explode, name, style, value, }: SerializeOptions<ArraySeparatorStyle> & {
|
|
26
26
|
value: unknown[];
|
|
27
27
|
}) => string;
|
package/package.json
CHANGED
package/script/mod.d.ts
CHANGED
|
@@ -63,6 +63,6 @@
|
|
|
63
63
|
*/
|
|
64
64
|
import "./_dnt.polyfills.js";
|
|
65
65
|
export * from './src/dsl/mod.js';
|
|
66
|
-
export { durable, ExecutionError, MemoryInterpreter, type MemoryInterpreterOptions, } from './src/interpreter/mod.js';
|
|
66
|
+
export { durable, vanilla, ExecutionError, MemoryInterpreter, type MemoryInterpreterOptions, } from './src/interpreter/mod.js';
|
|
67
67
|
export * from './src/context/mod.js';
|
|
68
68
|
//# sourceMappingURL=mod.d.ts.map
|
package/script/mod.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mod.d.ts","sourceRoot":"","sources":["../src/mod.ts"],"names":[],"mappings":"AAaA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8DG;AACH,OAAO,qBAAqB,CAAC;AAG7B,cAAc,kBAAkB,CAAC;AACjC,OAAO,EACH,OAAO,EACP,cAAc,EACd,iBAAiB,EACjB,KAAK,wBAAwB,GAChC,MAAM,0BAA0B,CAAC;AAClC,cAAc,sBAAsB,CAAC"}
|
|
1
|
+
{"version":3,"file":"mod.d.ts","sourceRoot":"","sources":["../src/mod.ts"],"names":[],"mappings":"AAaA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8DG;AACH,OAAO,qBAAqB,CAAC;AAG7B,cAAc,kBAAkB,CAAC;AACjC,OAAO,EACH,OAAO,EACP,OAAO,EACP,cAAc,EACd,iBAAiB,EACjB,KAAK,wBAAwB,GAChC,MAAM,0BAA0B,CAAC;AAClC,cAAc,sBAAsB,CAAC"}
|
package/script/mod.js
CHANGED
|
@@ -26,7 +26,7 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
26
26
|
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
27
27
|
};
|
|
28
28
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
29
|
-
exports.MemoryInterpreter = exports.ExecutionError = exports.durable = void 0;
|
|
29
|
+
exports.MemoryInterpreter = exports.ExecutionError = exports.vanilla = exports.durable = void 0;
|
|
30
30
|
/**
|
|
31
31
|
* The Versori Run SDK is the backbone of the Versori AI integration platform. It provides a set of tools and
|
|
32
32
|
* abstractions for building integrations which can run in the cloud on Versori's infrastructure.
|
|
@@ -94,6 +94,7 @@ require("./_dnt.polyfills.js");
|
|
|
94
94
|
__exportStar(require("./src/dsl/mod.js"), exports);
|
|
95
95
|
var mod_js_1 = require("./src/interpreter/mod.js");
|
|
96
96
|
Object.defineProperty(exports, "durable", { enumerable: true, get: function () { return mod_js_1.durable; } });
|
|
97
|
+
Object.defineProperty(exports, "vanilla", { enumerable: true, get: function () { return mod_js_1.vanilla; } });
|
|
97
98
|
Object.defineProperty(exports, "ExecutionError", { enumerable: true, get: function () { return mod_js_1.ExecutionError; } });
|
|
98
99
|
Object.defineProperty(exports, "MemoryInterpreter", { enumerable: true, get: function () { return mod_js_1.MemoryInterpreter; } });
|
|
99
100
|
__exportStar(require("./src/context/mod.js"), exports);
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { RequestHandler } from 'express';
|
|
2
|
+
import { Context } from '../context/Context.js';
|
|
3
|
+
import { Connection } from '../services/platform/generated/types.gen.js';
|
|
4
|
+
import { ConnectionFactory, FetchLike, RuntimeConnectionFactory } from './types.js';
|
|
5
|
+
export declare class DefaultConnectionFactory implements ConnectionFactory {
|
|
6
|
+
constructor();
|
|
7
|
+
handler(_: Connection): Promise<RequestHandler>;
|
|
8
|
+
fetcher(_: Connection): Promise<FetchLike>;
|
|
9
|
+
}
|
|
10
|
+
export declare class VanillaFetchFactory implements RuntimeConnectionFactory {
|
|
11
|
+
constructor();
|
|
12
|
+
fetcher(_: Context<unknown>): Promise<FetchLike>;
|
|
13
|
+
baseUrl(_: Context<unknown>): Promise<string>;
|
|
14
|
+
handler(_: Context<unknown>): Promise<RequestHandler>;
|
|
15
|
+
}
|
|
16
|
+
//# sourceMappingURL=VanillaConnectionFactory.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"VanillaConnectionFactory.d.ts","sourceRoot":"","sources":["../../../src/src/connection/VanillaConnectionFactory.ts"],"names":[],"mappings":"AAaA,OAAO,EAAE,cAAc,EAAE,MAAM,SAAS,CAAC;AACzC,OAAO,EAAE,OAAO,EAAE,MAAM,uBAAuB,CAAC;AAChD,OAAO,EAAE,UAAU,EAAE,MAAM,6CAA6C,CAAC;AACzE,OAAO,EAAE,iBAAiB,EAAE,SAAS,EAAE,wBAAwB,EAAE,MAAM,YAAY,CAAC;AAEpF,qBAAa,wBAAyB,YAAW,iBAAiB;;IAG9D,OAAO,CAAC,CAAC,EAAE,UAAU,GAAG,OAAO,CAAC,cAAc,CAAC;IAI/C,OAAO,CAAC,CAAC,EAAE,UAAU,GAAG,OAAO,CAAC,SAAS,CAAC;CAG7C;AAGD,qBAAa,mBAAoB,YAAW,wBAAwB;;IAGhE,OAAO,CAAC,CAAC,EAAE,OAAO,CAAC,OAAO,CAAC,GAAG,OAAO,CAAC,SAAS,CAAC;IAIhD,OAAO,CAAC,CAAC,EAAE,OAAO,CAAC,OAAO,CAAC,GAAG,OAAO,CAAC,MAAM,CAAC;IAI7C,OAAO,CAAC,CAAC,EAAE,OAAO,CAAC,OAAO,CAAC,GAAG,OAAO,CAAC,cAAc,CAAC;CAKxD"}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/*
|
|
3
|
+
* Copyright (c) 2025 Versori Group Inc
|
|
4
|
+
*
|
|
5
|
+
* Use of this software is governed by the Business Source License 1.1
|
|
6
|
+
* included in the LICENSE file at the root of this repository.
|
|
7
|
+
*
|
|
8
|
+
* Change Date: 2029-01-01
|
|
9
|
+
* Change License: Apache License, Version 2.0
|
|
10
|
+
*
|
|
11
|
+
* As of the Change Date, in accordance with the Business Source License,
|
|
12
|
+
* use of this software will be governed by the Apache License, Version 2.0.
|
|
13
|
+
*/
|
|
14
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
|
+
exports.VanillaFetchFactory = exports.DefaultConnectionFactory = void 0;
|
|
16
|
+
class DefaultConnectionFactory {
|
|
17
|
+
constructor() { }
|
|
18
|
+
handler(_) {
|
|
19
|
+
throw new Error('Method not implemented.');
|
|
20
|
+
}
|
|
21
|
+
fetcher(_) {
|
|
22
|
+
return Promise.resolve(globalThis.fetch);
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
exports.DefaultConnectionFactory = DefaultConnectionFactory;
|
|
26
|
+
class VanillaFetchFactory {
|
|
27
|
+
constructor() { }
|
|
28
|
+
fetcher(_) {
|
|
29
|
+
return Promise.resolve(globalThis.fetch);
|
|
30
|
+
}
|
|
31
|
+
baseUrl(_) {
|
|
32
|
+
return Promise.resolve('');
|
|
33
|
+
}
|
|
34
|
+
handler(_) {
|
|
35
|
+
return Promise.resolve((_req, _res, next) => {
|
|
36
|
+
next();
|
|
37
|
+
});
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
exports.VanillaFetchFactory = VanillaFetchFactory;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
+
import { ActivationInterface } from '../dsl/http/types.js';
|
|
1
2
|
import { Logger } from '../observability/mod.js';
|
|
2
3
|
import { Activation, Connection, DynamicVariables, EndUser, PlatformApi, ProjectEnvironment } from '../services/platform/mod.js';
|
|
3
|
-
export declare class ActivationImpl implements
|
|
4
|
+
export declare class ActivationImpl implements ActivationInterface {
|
|
4
5
|
private readonly activation;
|
|
5
6
|
private readonly platformApi;
|
|
6
7
|
private readonly organisationId;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ActivationImpl.d.ts","sourceRoot":"","sources":["../../../src/src/context/ActivationImpl.ts"],"names":[],"mappings":"AAaA,OAAO,EAAE,MAAM,EAAE,MAAM,yBAAyB,CAAC;AACjD,OAAO,EACH,UAAU,EACV,UAAU,EACV,gBAAgB,EAChB,OAAO,EACP,WAAW,EACX,kBAAkB,EACrB,MAAM,6BAA6B,CAAC;AAErC,qBAAa,cAAe,YAAW,
|
|
1
|
+
{"version":3,"file":"ActivationImpl.d.ts","sourceRoot":"","sources":["../../../src/src/context/ActivationImpl.ts"],"names":[],"mappings":"AAaA,OAAO,EAAE,mBAAmB,EAAE,MAAM,sBAAsB,CAAC;AAC3D,OAAO,EAAE,MAAM,EAAE,MAAM,yBAAyB,CAAC;AACjD,OAAO,EACH,UAAU,EACV,UAAU,EACV,gBAAgB,EAChB,OAAO,EACP,WAAW,EACX,kBAAkB,EACrB,MAAM,6BAA6B,CAAC;AAErC,qBAAa,cAAe,YAAW,mBAAmB;IAElD,OAAO,CAAC,QAAQ,CAAC,UAAU;IAC3B,OAAO,CAAC,QAAQ,CAAC,WAAW;IAC5B,OAAO,CAAC,QAAQ,CAAC,cAAc;IAC/B,OAAO,CAAC,QAAQ,CAAC,aAAa;IAC9B,OAAO,CAAC,QAAQ,CAAC,GAAG;gBAJH,UAAU,EAAE,UAAU,EACtB,WAAW,EAAE,WAAW,EACxB,cAAc,EAAE,MAAM,EACtB,aAAa,EAAE,MAAM,EACrB,GAAG,EAAE,MAAM;IAGhC,IAAI,EAAE,IAAI,MAAM,CAEf;IAED,IAAI,IAAI,IAAI,OAAO,CAElB;IAED,IAAI,WAAW,IAAI,kBAAkB,GAAG,SAAS,CAEhD;IAED,IAAI,WAAW,IAAI,KAAK,CAAC,UAAU,CAAC,GAAG,SAAS,CAE/C;IAED,IAAI,gBAAgB,IAAI,gBAAgB,GAAG,SAAS,CAEnD;IAED,WAAW,CAAC,CAAC,GAAG,OAAO,EAAE,IAAI,EAAE,MAAM,GAAG,CAAC,GAAG,SAAS;IAQ/C,WAAW,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,OAAO,GAAG,OAAO,CAAC,IAAI,CAAC;CA6BjE"}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type * as express from 'express';
|
|
2
|
+
import { ActivationInterface } from '../dsl/http/types.js';
|
|
2
3
|
import { CredentialsProvider } from '../dsl/http/versori/contextcredentials.js';
|
|
3
4
|
import { QueueAPI, Workflow } from '../interpreter/durable/Queue.js';
|
|
4
5
|
import { Issue, IssueAPI } from '../issues/Issues.js';
|
|
@@ -45,7 +46,7 @@ export interface Context<D> {
|
|
|
45
46
|
readonly executionId: string;
|
|
46
47
|
readonly startTime: Date;
|
|
47
48
|
readonly data: D;
|
|
48
|
-
activation:
|
|
49
|
+
activation: ActivationInterface;
|
|
49
50
|
workflow?: Workflow;
|
|
50
51
|
/**
|
|
51
52
|
* Opens a key value store for the given scope, defaulting to ':project:' if not provided.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Context.d.ts","sourceRoot":"","sources":["../../../src/src/context/Context.ts"],"names":[],"mappings":"AAaA,OAAO,KAAK,KAAK,OAAO,MAAM,SAAS,CAAC;AAExC,OAAO,EAAE,mBAAmB,EAAE,MAAM,2CAA2C,CAAC;AAChF,OAAO,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,iCAAiC,CAAC;AACrE,OAAO,EAAE,KAAK,EAAE,QAAQ,EAAE,MAAM,qBAAqB,CAAC;AACtD,OAAO,EAAE,QAAQ,EAAE,gBAAgB,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAC9E,OAAO,EAAE,MAAM,EAAE,MAAM,oCAAoC,CAAC;AAC5D,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AACrD,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AACnD,OAAO,EAAgB,iBAAiB,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;
|
|
1
|
+
{"version":3,"file":"Context.d.ts","sourceRoot":"","sources":["../../../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E,OAAO,CAAC;CAQlD"}
|
|
@@ -1,24 +1,24 @@
|
|
|
1
|
+
import { Activation, PlatformApi } from '../services/platform/mod.js';
|
|
1
2
|
import { CredentialsProvider } from '../dsl/http/versori/contextcredentials.js';
|
|
2
3
|
import { QueueAPI } from '../interpreter/durable/Queue.js';
|
|
3
4
|
import { IssueAPI } from '../issues/Issues.js';
|
|
4
5
|
import { KeyValueProvider } from '../kv/KeyValue.js';
|
|
5
6
|
import { Logger } from '../observability/logging/Logger.js';
|
|
6
7
|
import { Context, ContextImpl, ContextOptions } from './Context.js';
|
|
7
|
-
import { Activation, PlatformApi } from '../services/platform/mod.js';
|
|
8
8
|
export interface ContextProvider {
|
|
9
|
-
create<D>(activation: Activation, data: D, options?: ContextOptions):
|
|
10
|
-
createWithExecutionId<D>(activation: Activation, data: D, executionId: string, options?: ContextOptions):
|
|
9
|
+
create<D>(activation: Activation, data: D, options?: ContextOptions): Context<D>;
|
|
10
|
+
createWithExecutionId<D>(activation: Activation, data: D, executionId: string, options?: ContextOptions): Context<D>;
|
|
11
11
|
destroy(ctx: Context<any>): Promise<void>;
|
|
12
12
|
}
|
|
13
13
|
export declare class ContextProviderImpl implements ContextProvider {
|
|
14
14
|
private readonly platformApi;
|
|
15
15
|
private readonly organisationId;
|
|
16
16
|
private readonly environmentId;
|
|
17
|
-
log
|
|
18
|
-
kvp
|
|
19
|
-
creds
|
|
20
|
-
issues
|
|
21
|
-
queue
|
|
17
|
+
private log;
|
|
18
|
+
private kvp;
|
|
19
|
+
private creds;
|
|
20
|
+
private issues;
|
|
21
|
+
private queue?;
|
|
22
22
|
constructor(log: Logger, kvp: KeyValueProvider, creds: CredentialsProvider, platformApi: PlatformApi, organisationId: string, environmentId: string, issues: IssueAPI, queue?: QueueAPI | undefined);
|
|
23
23
|
createWithExecutionId<D>(activation: Activation, data: D, executionId: string, options?: ContextOptions): ContextImpl<D, void>;
|
|
24
24
|
create<D>(activation: Activation, data: D, options?: ContextOptions): ContextImpl<D>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ContextProvider.d.ts","sourceRoot":"","sources":["../../../src/src/context/ContextProvider.ts"],"names":[],"mappings":"AAcA,OAAO,EAAE,mBAAmB,EAAE,MAAM,2CAA2C,CAAC;AAChF,OAAO,EAAE,QAAQ,EAAE,MAAM,iCAAiC,CAAC;AAC3D,OAAO,EAAE,QAAQ,EAAE,MAAM,qBAAqB,CAAC;AAC/C,OAAO,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;AACrD,OAAO,EAAE,MAAM,EAAE,MAAM,oCAAoC,CAAC;
|
|
1
|
+
{"version":3,"file":"ContextProvider.d.ts","sourceRoot":"","sources":["../../../src/src/context/ContextProvider.ts"],"names":[],"mappings":"AAcA,OAAO,EAAE,UAAU,EAAE,WAAW,EAAE,MAAM,6BAA6B,CAAC;AACtE,OAAO,EAAE,mBAAmB,EAAE,MAAM,2CAA2C,CAAC;AAChF,OAAO,EAAE,QAAQ,EAAE,MAAM,iCAAiC,CAAC;AAC3D,OAAO,EAAE,QAAQ,EAAE,MAAM,qBAAqB,CAAC;AAC/C,OAAO,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;AACrD,OAAO,EAAE,MAAM,EAAE,MAAM,oCAAoC,CAAC;AAE5D,OAAO,EAAE,OAAO,EAAE,WAAW,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAEpE,MAAM,WAAW,eAAe;IAC5B,MAAM,CAAC,CAAC,EAAE,UAAU,EAAE,UAAU,EAAE,IAAI,EAAE,CAAC,EAAE,OAAO,CAAC,EAAE,cAAc,GAAG,OAAO,CAAC,CAAC,CAAC,CAAC;IACjF,qBAAqB,CAAC,CAAC,EAAE,UAAU,EAAE,UAAU,EAAE,IAAI,EAAE,CAAC,EAAE,WAAW,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,cAAc,GAAG,OAAO,CAAC,CAAC,CAAC,CAAC;IACrH,OAAO,CAAC,GAAG,EAAE,OAAO,CAAC,GAAG,CAAC,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;CAC7C;AAED,qBAAa,mBAAoB,YAAW,eAAe;IAWnD,OAAO,CAAC,QAAQ,CAAC,WAAW;IAC5B,OAAO,CAAC,QAAQ,CAAC,cAAc;IAC/B,OAAO,CAAC,QAAQ,CAAC,aAAa;IAZlC,OAAO,CAAC,GAAG,CAAS;IACpB,OAAO,CAAC,GAAG,CAAmB;IAC9B,OAAO,CAAC,KAAK,CAAsB;IACnC,OAAO,CAAC,MAAM,CAAW;IACzB,OAAO,CAAC,KAAK,CAAC,CAAW;gBAGrB,GAAG,EAAE,MAAM,EACX,GAAG,EAAE,gBAAgB,EACrB,KAAK,EAAE,mBAAmB,EACT,WAAW,EAAE,WAAW,EACxB,cAAc,EAAE,MAAM,EACtB,aAAa,EAAE,MAAM,EACtC,MAAM,EAAE,QAAQ,EAChB,KAAK,GAAE,QAAQ,GAAG,SAAqB;IAS3C,qBAAqB,CAAC,CAAC,EAAE,UAAU,EAAE,UAAU,EAAE,IAAI,EAAE,CAAC,EAAE,WAAW,EAAE,MAAM,EAAE,OAAO,GAAE,cAAmB,GAAG,WAAW,CAAC,CAAC,EAAE,IAAI,CAAC;IA6BlI,MAAM,CAAC,CAAC,EAAE,UAAU,EAAE,UAAU,EAAE,IAAI,EAAE,CAAC,EAAE,OAAO,GAAE,cAAmB,GAAG,WAAW,CAAC,CAAC,CAAC;IAMxF,OAAO,CAAC,CAAC,EAAE,OAAO,CAAC,GAAG,CAAC,GAAG,OAAO,CAAC,IAAI,CAAC;CAG1C"}
|
|
@@ -14,8 +14,8 @@
|
|
|
14
14
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
15
|
exports.ContextProviderImpl = void 0;
|
|
16
16
|
const mod_js_1 = require("../../deps/jsr.io/@std/ulid/1.0.0/mod.js");
|
|
17
|
-
const Context_js_1 = require("./Context.js");
|
|
18
17
|
const ActivationImpl_js_1 = require("./ActivationImpl.js");
|
|
18
|
+
const Context_js_1 = require("./Context.js");
|
|
19
19
|
class ContextProviderImpl {
|
|
20
20
|
constructor(log, kvp, creds, platformApi, organisationId, environmentId, issues, queue = undefined) {
|
|
21
21
|
Object.defineProperty(this, "platformApi", {
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import { Activation, Connection, DynamicVariables, EndUser, ProjectEnvironment } from '../services/platform/mod.js';
|
|
2
|
+
import type * as express from 'express';
|
|
3
|
+
import { ActivationInterface } from '../dsl/http/types.js';
|
|
4
|
+
import { QueueAPI, Workflow } from '../interpreter/durable/Queue.js';
|
|
5
|
+
import { Issue, IssueAPI } from '../issues/Issues.js';
|
|
6
|
+
import { CredentialsProvider, KeyValue, KeyValueProvider, KeyValueScope, Logger } from '../mod.js';
|
|
7
|
+
import { AsyncWorkflow } from './AsyncWorkflow.js';
|
|
8
|
+
import { Context, ContextOptions, CreateIssue } from './Context.js';
|
|
9
|
+
import { ContextProvider } from './ContextProvider.js';
|
|
10
|
+
import { WorkflowInterface, WorkflowOpts } from './WorkflowClient.js';
|
|
11
|
+
export declare class VanillaActivation implements ActivationInterface {
|
|
12
|
+
private readonly activation;
|
|
13
|
+
private readonly organisationId;
|
|
14
|
+
private readonly environmentId;
|
|
15
|
+
private readonly log;
|
|
16
|
+
constructor(activation: Activation, organisationId: string, environmentId: string, log: Logger);
|
|
17
|
+
get id(): string;
|
|
18
|
+
get user(): EndUser;
|
|
19
|
+
get environment(): ProjectEnvironment | undefined;
|
|
20
|
+
get connections(): Array<Connection> | undefined;
|
|
21
|
+
get dynamicVariables(): DynamicVariables | undefined;
|
|
22
|
+
getVariable<T = unknown>(name: string): T | undefined;
|
|
23
|
+
setVariable(_: string, __: unknown): Promise<void>;
|
|
24
|
+
}
|
|
25
|
+
export declare class VanillaContext<D, Index = void> implements Context<D> {
|
|
26
|
+
#private;
|
|
27
|
+
readonly log: Logger;
|
|
28
|
+
readonly executionId: string;
|
|
29
|
+
readonly startTime: Date;
|
|
30
|
+
readonly data: D;
|
|
31
|
+
idx: Index;
|
|
32
|
+
readonly kvp: KeyValueProvider;
|
|
33
|
+
readonly queue?: QueueAPI;
|
|
34
|
+
readonly options: ContextOptions;
|
|
35
|
+
constructor(log: Logger, kvp: KeyValueProvider, executionId: string, startTime: Date, data: D, activation: VanillaActivation, issues: IssueAPI, queue?: QueueAPI, options?: ContextOptions);
|
|
36
|
+
get activation(): ActivationInterface;
|
|
37
|
+
get workflow(): Workflow | undefined;
|
|
38
|
+
setIndex(idx: number): VanillaContext<D, number>;
|
|
39
|
+
withData<D2>(data: D2): VanillaContext<D2, Index>;
|
|
40
|
+
openKv(scope?: KeyValueScope): KeyValue;
|
|
41
|
+
request(): express.Request | undefined;
|
|
42
|
+
workflowClient(): WorkflowInterface;
|
|
43
|
+
start(group: string, opts: WorkflowOpts): Promise<AsyncWorkflow>;
|
|
44
|
+
createIssue(issue: CreateIssue, options?: {
|
|
45
|
+
deduplicate?: boolean;
|
|
46
|
+
}): Promise<Issue | null>;
|
|
47
|
+
credentials(): CredentialsProvider;
|
|
48
|
+
destroy(scope: KeyValueScope): Promise<void>;
|
|
49
|
+
[Symbol.toPrimitive](): Record<string, unknown>;
|
|
50
|
+
}
|
|
51
|
+
export declare class VanillaContextProvider implements ContextProvider {
|
|
52
|
+
private readonly organisationId;
|
|
53
|
+
private readonly environmentId;
|
|
54
|
+
log: Logger;
|
|
55
|
+
kvp: KeyValueProvider;
|
|
56
|
+
issues: IssueAPI;
|
|
57
|
+
queue?: QueueAPI;
|
|
58
|
+
constructor(log: Logger, kvp: KeyValueProvider, organisationId: string, environmentId: string, issues: IssueAPI, queue?: QueueAPI | undefined);
|
|
59
|
+
create<D>(activation: Activation, data: D, options?: ContextOptions): VanillaContext<D>;
|
|
60
|
+
createWithExecutionId<D>(activation: Activation, data: D, executionId: string, options?: ContextOptions): VanillaContext<D>;
|
|
61
|
+
destroy(_: Context<any>): Promise<void>;
|
|
62
|
+
}
|
|
63
|
+
//# sourceMappingURL=VanillaContext.d.ts.map
|