@versori/run 0.5.0-alpha.3 → 0.5.0-alpha.4
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/internal/FetchBuilder.d.ts.map +1 -1
- package/esm/src/connection/internal/FetchBuilder.js +8 -9
- package/esm/src/dsl/http/versori/webhookmiddleware.js +3 -3
- package/esm/src/internal/supervisor.d.ts +6 -10
- package/esm/src/internal/supervisor.d.ts.map +1 -1
- package/esm/src/internal/supervisor.js +106 -46
- 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 +17 -4
- package/esm/src/interpreter/durable/compilers/catch.d.ts.map +1 -1
- package/esm/src/interpreter/durable/compilers/catch.js +2 -1
- package/esm/src/interpreter/durable/compilers/fn.d.ts.map +1 -1
- package/esm/src/interpreter/durable/compilers/fn.js +14 -1
- package/esm/src/interpreter/durable/compilers/http.d.ts.map +1 -1
- package/esm/src/interpreter/durable/compilers/http.js +5 -1
- package/esm/src/interpreter/durable/compilers/schedule.d.ts.map +1 -1
- package/esm/src/interpreter/durable/compilers/schedule.js +2 -2
- package/esm/src/interpreter/durable/compilers/webhook.d.ts.map +1 -1
- package/esm/src/interpreter/durable/compilers/webhook.js +5 -2
- package/esm/src/interpreter/memory/MemoryInterpreter.d.ts +1 -0
- package/esm/src/interpreter/memory/MemoryInterpreter.d.ts.map +1 -1
- package/esm/src/interpreter/memory/MemoryInterpreter.js +17 -4
- package/esm/src/interpreter/memory/compilers/catch.d.ts.map +1 -1
- package/esm/src/interpreter/memory/compilers/catch.js +2 -0
- package/esm/src/interpreter/memory/compilers/fn.d.ts.map +1 -1
- package/esm/src/interpreter/memory/compilers/fn.js +13 -1
- package/esm/src/interpreter/memory/compilers/http.d.ts.map +1 -1
- package/esm/src/interpreter/memory/compilers/http.js +4 -1
- package/esm/src/interpreter/memory/compilers/schedule.d.ts.map +1 -1
- package/esm/src/interpreter/memory/compilers/schedule.js +4 -3
- package/esm/src/interpreter/memory/compilers/webhook.d.ts.map +1 -1
- package/esm/src/interpreter/memory/compilers/webhook.js +11 -6
- package/esm/src/issues/Issues.d.ts.map +1 -1
- package/esm/src/issues/Issues.js +5 -0
- package/package.json +1 -1
- package/script/src/connection/internal/FetchBuilder.d.ts.map +1 -1
- package/script/src/connection/internal/FetchBuilder.js +8 -9
- package/script/src/dsl/http/versori/webhookmiddleware.js +3 -3
- package/script/src/internal/supervisor.d.ts +6 -10
- package/script/src/internal/supervisor.d.ts.map +1 -1
- package/script/src/internal/supervisor.js +107 -47
- 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 +16 -3
- package/script/src/interpreter/durable/compilers/catch.d.ts.map +1 -1
- package/script/src/interpreter/durable/compilers/catch.js +2 -1
- package/script/src/interpreter/durable/compilers/fn.d.ts.map +1 -1
- package/script/src/interpreter/durable/compilers/fn.js +13 -0
- package/script/src/interpreter/durable/compilers/http.d.ts.map +1 -1
- package/script/src/interpreter/durable/compilers/http.js +4 -0
- package/script/src/interpreter/durable/compilers/schedule.d.ts.map +1 -1
- package/script/src/interpreter/durable/compilers/schedule.js +2 -2
- package/script/src/interpreter/durable/compilers/webhook.d.ts.map +1 -1
- package/script/src/interpreter/durable/compilers/webhook.js +5 -2
- package/script/src/interpreter/memory/MemoryInterpreter.d.ts +1 -0
- package/script/src/interpreter/memory/MemoryInterpreter.d.ts.map +1 -1
- package/script/src/interpreter/memory/MemoryInterpreter.js +16 -3
- package/script/src/interpreter/memory/compilers/catch.d.ts.map +1 -1
- package/script/src/interpreter/memory/compilers/catch.js +2 -0
- package/script/src/interpreter/memory/compilers/fn.d.ts.map +1 -1
- package/script/src/interpreter/memory/compilers/fn.js +13 -1
- package/script/src/interpreter/memory/compilers/http.d.ts.map +1 -1
- package/script/src/interpreter/memory/compilers/http.js +4 -1
- package/script/src/interpreter/memory/compilers/schedule.d.ts.map +1 -1
- package/script/src/interpreter/memory/compilers/schedule.js +4 -3
- package/script/src/interpreter/memory/compilers/webhook.d.ts.map +1 -1
- package/script/src/interpreter/memory/compilers/webhook.js +11 -6
- package/script/src/issues/Issues.d.ts.map +1 -1
- package/script/src/issues/Issues.js +5 -0
|
@@ -76,22 +76,25 @@ function compileHttp(compilerCtx, task) {
|
|
|
76
76
|
complete: () => compilerCtx.log.debug('http.complete'),
|
|
77
77
|
}), (0, rxjs_1.mergeMap)((ctx) => {
|
|
78
78
|
return compilerCtx.tracer.startActiveSpan(`http-${task.id}`, async (span) => {
|
|
79
|
-
await (0, supervisor_js_1.sendTaskStartEvent)(task.id, span);
|
|
79
|
+
ctx = await (0, supervisor_js_1.sendTaskStartEvent)(task.id, ctx, span);
|
|
80
80
|
span.setAttribute('task.id', task.id);
|
|
81
81
|
span.setAttribute('task.type', 'http');
|
|
82
82
|
span.setAttribute('type', 'task');
|
|
83
83
|
span.setAttribute('execution.id', ctx.executionId);
|
|
84
84
|
span.setAttribute('connection.name', task.opts.connection);
|
|
85
|
+
span.setAttribute('workflow.id', ctx.options.workflowId || 'unknown-workflow');
|
|
85
86
|
const spanContext = span.spanContext();
|
|
86
87
|
try {
|
|
87
88
|
const newCtx = await http(ctx.withLogger(ctx.log.child({ spanId: spanContext.spanId, traceId: spanContext.traceId })));
|
|
88
89
|
if (supervisor_js_1.enabled) {
|
|
89
90
|
span.setAttribute('response.body', JSON.stringify(newCtx.data));
|
|
90
91
|
}
|
|
92
|
+
span.setAttribute('status', 'pass');
|
|
91
93
|
return newCtx;
|
|
92
94
|
}
|
|
93
95
|
catch (error) {
|
|
94
96
|
if (error instanceof Error) {
|
|
97
|
+
span.setAttribute('status', 'fail');
|
|
95
98
|
span.recordException(error);
|
|
96
99
|
}
|
|
97
100
|
else {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"schedule.d.ts","sourceRoot":"","sources":["../../../../../src/src/interpreter/memory/compilers/schedule.ts"],"names":[],"mappings":"AAiBA,OAAO,EAAE,YAAY,EAAE,eAAe,EAAE,MAAM,0CAA0C,CAAC;AAQzF,OAAO,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;
|
|
1
|
+
{"version":3,"file":"schedule.d.ts","sourceRoot":"","sources":["../../../../../src/src/interpreter/memory/compilers/schedule.ts"],"names":[],"mappings":"AAiBA,OAAO,EAAE,YAAY,EAAE,eAAe,EAAE,MAAM,0CAA0C,CAAC;AAQzF,OAAO,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;AA+I7C,eAAO,MAAM,gBAAgB,EAAE,eAAe,CAAC,YAAY,EAAE,eAAe,CAG3E,CAAC"}
|
|
@@ -49,8 +49,9 @@ function compileSchedule(ctx, trigger, signal) {
|
|
|
49
49
|
});
|
|
50
50
|
return;
|
|
51
51
|
}
|
|
52
|
-
const executionCtx = ctx.contextProvider.create(activation[0], {});
|
|
52
|
+
const executionCtx = ctx.contextProvider.create(activation[0], {}, { workflowId: trigger.id });
|
|
53
53
|
span.setAttribute('execution.id', executionCtx.executionId);
|
|
54
|
+
await (0, supervisor_js_1.sendTaskStartEvent)(trigger.id, executionCtx, span);
|
|
54
55
|
try {
|
|
55
56
|
subscriber.next(executionCtx);
|
|
56
57
|
}
|
|
@@ -81,7 +82,7 @@ function compileSchedule(ctx, trigger, signal) {
|
|
|
81
82
|
return;
|
|
82
83
|
}
|
|
83
84
|
activations.forEach((activation) => {
|
|
84
|
-
const executionCtx = ctx.contextProvider.create(activation, {});
|
|
85
|
+
const executionCtx = ctx.contextProvider.create(activation, {}, { workflowId: trigger.id });
|
|
85
86
|
try {
|
|
86
87
|
subscriber.next(executionCtx);
|
|
87
88
|
}
|
|
@@ -98,7 +99,6 @@ function compileSchedule(ctx, trigger, signal) {
|
|
|
98
99
|
}
|
|
99
100
|
ctx.cronRouter.post(`/cron/${trigger.id}`, async (req, res) => {
|
|
100
101
|
await ctx.tracer.startActiveSpan(`schedule-${trigger.id}`, async (span) => {
|
|
101
|
-
await (0, supervisor_js_1.sendTaskStartEvent)(trigger.id, span);
|
|
102
102
|
span.setAttribute('task.id', trigger.id);
|
|
103
103
|
span.setAttribute('task.type', 'schedule');
|
|
104
104
|
span.setAttribute('type', 'task');
|
|
@@ -107,6 +107,7 @@ function compileSchedule(ctx, trigger, signal) {
|
|
|
107
107
|
span.setAttribute('environment.id', environmentId);
|
|
108
108
|
span.setAttribute('environment.name', environmentName);
|
|
109
109
|
span.setAttribute('org.id', orgId);
|
|
110
|
+
span.setAttribute('workflow.id', trigger.id);
|
|
110
111
|
await handleSchedule(req, res, span);
|
|
111
112
|
span.end();
|
|
112
113
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"webhook.d.ts","sourceRoot":"","sources":["../../../../../src/src/interpreter/memory/compilers/webhook.ts"],"names":[],"mappings":"AA2BA,OAAO,EAAE,WAAW,EAAE,cAAc,EAAE,MAAM,yCAAyC,CAAC;
|
|
1
|
+
{"version":3,"file":"webhook.d.ts","sourceRoot":"","sources":["../../../../../src/src/interpreter/memory/compilers/webhook.ts"],"names":[],"mappings":"AA2BA,OAAO,EAAE,WAAW,EAAE,cAAc,EAAE,MAAM,yCAAyC,CAAC;AAItF,OAAO,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;AAuD7C,eAAO,MAAM,eAAe,EAAE,eAAe,CAAC,WAAW,EAAE,cAAc,CAsUxE,CAAC"}
|
|
@@ -91,6 +91,7 @@ exports.webhookCompiler = {
|
|
|
91
91
|
onError = trigger.options.response.onError;
|
|
92
92
|
}
|
|
93
93
|
const ctxOptionsFn = (req, res) => ({
|
|
94
|
+
workflowId: trigger.id,
|
|
94
95
|
onSuccess: (ctx) => {
|
|
95
96
|
if (isSync) {
|
|
96
97
|
sendResponse(res, onSuccess(ctx));
|
|
@@ -114,8 +115,10 @@ exports.webhookCompiler = {
|
|
|
114
115
|
if (!ctx.webhookRouter) {
|
|
115
116
|
throw new Error('Router not available in compiler context');
|
|
116
117
|
}
|
|
117
|
-
|
|
118
|
-
|
|
118
|
+
ctx.log.info('webhook endpoint added', {
|
|
119
|
+
id: trigger.id,
|
|
120
|
+
method,
|
|
121
|
+
});
|
|
119
122
|
if (corsOptions) {
|
|
120
123
|
if (typeof corsOptions === 'boolean') {
|
|
121
124
|
ctx.webhookRouter.use((0, cors_1.default)());
|
|
@@ -137,16 +140,16 @@ exports.webhookCompiler = {
|
|
|
137
140
|
log: ctx.log,
|
|
138
141
|
}), async (req, res) => {
|
|
139
142
|
await ctx.tracer.startActiveSpan(`webhook-${trigger.id}`, async (span) => {
|
|
140
|
-
await (0, supervisor_js_1.sendTaskStartEvent)(trigger.id, span);
|
|
141
143
|
span.setAttribute('task.id', trigger.id);
|
|
144
|
+
span.setAttribute('workflow.id', trigger.id);
|
|
142
145
|
span.setAttribute('task.type', 'webhook');
|
|
143
146
|
span.setAttribute('type', 'task');
|
|
144
147
|
const staticActivation = res.locals.activation;
|
|
145
148
|
let executionCtx = ctx.contextProvider.create(staticActivation, req.body, ctxOptionsFn(req, res));
|
|
146
149
|
const spanContext = span.spanContext();
|
|
147
150
|
executionCtx = executionCtx.withLogger(executionCtx.log.child({ spanId: spanContext.spanId, traceId: spanContext.traceId }));
|
|
148
|
-
executionCtx.log.info("stack", { stack: new Error().stack });
|
|
149
151
|
span.setAttribute('execution.id', executionCtx.executionId);
|
|
152
|
+
await (0, supervisor_js_1.sendTaskStartEvent)(trigger.id, executionCtx, span);
|
|
150
153
|
try {
|
|
151
154
|
subscriber.next(executionCtx);
|
|
152
155
|
if (isAsync) {
|
|
@@ -178,8 +181,8 @@ exports.webhookCompiler = {
|
|
|
178
181
|
log: ctx.log,
|
|
179
182
|
}), async (req, res) => {
|
|
180
183
|
await ctx.tracer.startActiveSpan(`webhook-${trigger.id}`, async (span) => {
|
|
181
|
-
await (0, supervisor_js_1.sendTaskStartEvent)(trigger.id, span);
|
|
182
184
|
span.setAttribute('task.id', trigger.id);
|
|
185
|
+
span.setAttribute('workflow.id', trigger.id);
|
|
183
186
|
span.setAttribute('task.type', 'webhook');
|
|
184
187
|
span.setAttribute('type', 'task');
|
|
185
188
|
span.setAttribute('user.id', req.params.userId);
|
|
@@ -199,6 +202,7 @@ exports.webhookCompiler = {
|
|
|
199
202
|
return;
|
|
200
203
|
}
|
|
201
204
|
let executionCtx = ctx.contextProvider.create(activation, req.body, ctxOptionsFn(req, res));
|
|
205
|
+
await (0, supervisor_js_1.sendTaskStartEvent)(trigger.id, executionCtx, span);
|
|
202
206
|
const spanContext = span.spanContext();
|
|
203
207
|
executionCtx = executionCtx.withLogger(executionCtx.log.child({ spanId: spanContext.spanId, traceId: spanContext.traceId }));
|
|
204
208
|
span.setAttribute('execution.id', executionCtx.executionId);
|
|
@@ -238,8 +242,8 @@ exports.webhookCompiler = {
|
|
|
238
242
|
log: ctx.log,
|
|
239
243
|
}), async (req, res) => {
|
|
240
244
|
await ctx.tracer.startActiveSpan(`webhook-${trigger.id}`, async (span) => {
|
|
241
|
-
await (0, supervisor_js_1.sendTaskStartEvent)(trigger.id, span);
|
|
242
245
|
span.setAttribute('task.id', trigger.id);
|
|
246
|
+
span.setAttribute('workflow.id', trigger.id);
|
|
243
247
|
span.setAttribute('task.type', 'webhook');
|
|
244
248
|
span.setAttribute('type', 'task');
|
|
245
249
|
span.setAttribute('activation.id', req.params.activationId);
|
|
@@ -260,6 +264,7 @@ exports.webhookCompiler = {
|
|
|
260
264
|
const spanContext = span.spanContext();
|
|
261
265
|
activationCtx = activationCtx.withLogger(activationCtx.log.child({ spanId: spanContext.spanId, traceId: spanContext.traceId }));
|
|
262
266
|
span.setAttribute('execution.id', activationCtx.executionId);
|
|
267
|
+
await (0, supervisor_js_1.sendTaskStartEvent)(trigger.id, activationCtx, span);
|
|
263
268
|
try {
|
|
264
269
|
subscriber.next(activationCtx);
|
|
265
270
|
if (isAsync) {
|
|
@@ -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":"AAwBA,OAAO,EAAE,MAAM,EAAE,MAAM,yBAAyB,CAAC;AAEjD,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,EAAE,MAAM,CAAC;IAClB,UAAU,EAAE,MAAM,CAAC;IACnB,UAAU,EAAE,MAAM,GAAG,IAAI,CAAC;IAC1B,gBAAgB,EAAE,MAAM,GAAG,IAAI,CAAC;IAChC,aAAa,EAAE,MAAM,CAAC;IACtB,cAAc,EAAE,MAAM,CAAC;IACvB,SAAS,EAAE,MAAM,CAAC;IAClB,MAAM,EAAE,MAAM,CAAC;IACf,SAAS,EAAE,MAAM,CAAC;IAClB,QAAQ,EAAE,MAAM,CAAC;IACjB,MAAM,EAAE,MAAM,CAAC;CAClB,CAAC;AAEF,MAAM,WAAW,QAAQ;IACrB,WAAW,CAAC,KAAK,EAAE,W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@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
15
15
|
exports.MockIssues = exports.IssueImpl = void 0;
|
|
16
16
|
const node_crypto_1 = require("node:crypto");
|
|
17
17
|
const constants_js_1 = require("../internal/constants.js");
|
|
18
|
+
const supervisor_js_1 = require("../internal/supervisor.js");
|
|
18
19
|
class IssueImpl {
|
|
19
20
|
constructor(log) {
|
|
20
21
|
Object.defineProperty(this, "baseUrl", {
|
|
@@ -110,6 +111,10 @@ class IssueImpl {
|
|
|
110
111
|
issue.annotations['environmentId'] = this.environmentId;
|
|
111
112
|
issue.annotations['organisationId'] = this.organisationId;
|
|
112
113
|
try {
|
|
114
|
+
if (supervisor_js_1.enabled) {
|
|
115
|
+
this.log.info('Issue to be submitted', { issue: issue });
|
|
116
|
+
return Promise.resolve(null);
|
|
117
|
+
}
|
|
113
118
|
const response = await fetch(`${this.baseUrl}/v1/issues/submit`, {
|
|
114
119
|
method: 'POST',
|
|
115
120
|
headers: {
|