@versori/run 0.5.0-alpha.2 → 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/context/ContextProvider.d.ts.map +1 -1
- package/esm/src/context/ContextProvider.js +0 -1
- package/esm/src/dsl/http/versori/webhookmiddleware.d.ts.map +1 -1
- package/esm/src/dsl/http/versori/webhookmiddleware.js +3 -4
- package/esm/src/internal/supervisor.d.ts +5 -9
- package/esm/src/internal/supervisor.d.ts.map +1 -1
- package/esm/src/internal/supervisor.js +108 -48
- 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 +9 -6
- 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 +9 -5
- 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/context/ContextProvider.d.ts.map +1 -1
- package/script/src/context/ContextProvider.js +0 -1
- package/script/src/dsl/http/versori/webhookmiddleware.d.ts.map +1 -1
- package/script/src/dsl/http/versori/webhookmiddleware.js +3 -4
- package/script/src/internal/supervisor.d.ts +5 -9
- package/script/src/internal/supervisor.d.ts.map +1 -1
- package/script/src/internal/supervisor.js +109 -49
- 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 +9 -6
- 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 +9 -5
- 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
|
@@ -52,7 +52,7 @@ function compileSchedule(ctx, trigger, signal) {
|
|
|
52
52
|
});
|
|
53
53
|
return;
|
|
54
54
|
}
|
|
55
|
-
const executionCtx = ctx.contextProvider.create(activation[0], {});
|
|
55
|
+
const executionCtx = ctx.contextProvider.create(activation[0], {}, { workflowId: trigger.id });
|
|
56
56
|
span.setAttribute('execution.id', executionCtx.executionId);
|
|
57
57
|
try {
|
|
58
58
|
subscriber.next(executionCtx);
|
|
@@ -84,7 +84,7 @@ function compileSchedule(ctx, trigger, signal) {
|
|
|
84
84
|
return;
|
|
85
85
|
}
|
|
86
86
|
activations.forEach((activation) => {
|
|
87
|
-
const executionCtx = ctx.contextProvider.create(activation, {});
|
|
87
|
+
const executionCtx = ctx.contextProvider.create(activation, {}, { workflowId: trigger.id });
|
|
88
88
|
try {
|
|
89
89
|
subscriber.next(executionCtx);
|
|
90
90
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"webhook.d.ts","sourceRoot":"","sources":["../../../../../src/src/interpreter/durable/compilers/webhook.ts"],"names":[],"mappings":"AA2BA,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,
|
|
1
|
+
{"version":3,"file":"webhook.d.ts","sourceRoot":"","sources":["../../../../../src/src/interpreter/durable/compilers/webhook.ts"],"names":[],"mappings":"AA2BA,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,CA2TxE,CAAC"}
|
|
@@ -84,6 +84,7 @@ export const webhookCompiler = {
|
|
|
84
84
|
onError = trigger.options.response.onError;
|
|
85
85
|
}
|
|
86
86
|
const ctxOptionsFn = (req, res) => ({
|
|
87
|
+
workflowId: trigger.id,
|
|
87
88
|
onSuccess: (ctx) => {
|
|
88
89
|
if (isSync) {
|
|
89
90
|
sendResponse(res, onSuccess(ctx));
|
|
@@ -108,8 +109,10 @@ export const webhookCompiler = {
|
|
|
108
109
|
if (!ctx.webhookRouter) {
|
|
109
110
|
throw new Error('Router not available in compiler context');
|
|
110
111
|
}
|
|
111
|
-
|
|
112
|
-
|
|
112
|
+
ctx.log.info('webhook endpoint added', {
|
|
113
|
+
id: trigger.id,
|
|
114
|
+
method,
|
|
115
|
+
});
|
|
113
116
|
if (corsOptions) {
|
|
114
117
|
if (typeof corsOptions === 'boolean') {
|
|
115
118
|
ctx.webhookRouter.use(cors());
|
|
@@ -88,6 +88,7 @@ export declare class MemoryInterpreter {
|
|
|
88
88
|
private cronServer?;
|
|
89
89
|
private shutdownServer?;
|
|
90
90
|
private isShuttingDown;
|
|
91
|
+
private wfRegistration;
|
|
91
92
|
constructor(log: Logger, compiler: ObservableCompiler, contextProvider: ContextProvider, webhookRouter: Router, cronRouter: Router, cronRegistry: Map<string, string>, webhookRegistry: WebhookRegistry, cnxFactory: DirectConnectionFactory, cronProvider: CronProvider, tracer: Tracer, issuesProvider: IssueAPI, cfgReader: ConfigReader, otelSDK?: NodeSDK | undefined);
|
|
92
93
|
static newInstance(options?: MemoryInterpreterOptions): Promise<MemoryInterpreter>;
|
|
93
94
|
register<O>(workflow: Workflow<O>, options?: MemoryInterpreterOptions): Registration;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MemoryInterpreter.d.ts","sourceRoot":"","sources":["../../../../src/src/interpreter/memory/MemoryInterpreter.ts"],"names":[],"mappings":"AAaA,OAAsB,EAAQ,MAAM,EAAE,MAAM,oBAAoB,CAAC;AAGjE,OAAO,EAAE,OAAO,EAAE,MAAM,yBAAyB,CAAC;AAClD,OAAgB,EAAqB,MAAM,EAAE,MAAM,SAAS,CAAC;AAE7D,OAAO,EAA+B,UAAU,EAAM,YAAY,EAAO,MAAM,MAAM,CAAC;AAEtF,OAAO,EAAE,uBAAuB,EAAE,MAAM,6CAA6C,CAAC;AACtF,OAAO,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAC;AACvD,OAAO,EAAE,eAAe,EAAuB,MAAM,kCAAkC,CAAC;AACxF,OAAO,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAC;AAGrE,OAAO,EAAE,QAAQ,EAAgB,MAAM,uBAAuB,CAAC;AAc/D,OAAO,EAAE,QAAQ,EAAa,MAAM,wBAAwB,CAAC;AAK7D,OAAO,EAAE,MAAM,EAAE,MAAM,uCAAuC,CAAC;AAE/D,OAAO,EAAE,uBAAuB,EAAE,MAAM,sBAAsB,CAAC;AAC/D,OAAO,EAAmB,kBAAkB,EAAE,MAAM,yBAAyB,CAAC;AAE9E;;GAEG;AACH,MAAM,MAAM,wBAAwB,GAAG;IACnC;;OAEG;IACH,MAAM,CAAC,EAAE,MAAM,CAAC;IAEhB;;OAEG;IACH,QAAQ,CAAC,EAAE,kBAAkB,CAAC;IAE9B;;OAEG;IACH,eAAe,CAAC,EAAE,eAAe,CAAC;IAElC;;OAEG;IACH,MAAM,CAAC,EAAE,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,OAAO,CAAC,QAAQ,CAAC,UAAU;IAC3B,OAAO,CAAC,QAAQ,CAAC,YAAY;IAC7B,OAAO,CAAC,QAAQ,CAAC,MAAM;IACvB,OAAO,CAAC,QAAQ,CAAC,cAAc;IAC/B,OAAO,CAAC,QAAQ,CAAC,SAAS;IAC1B,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAC;IAtB7B,OAAO,CAAC,mBAAmB,CAA2B;IACtD,OAAO,CAAC,aAAa,CAAC,CAAS;IAC/B,OAAO,CAAC,UAAU,CAAC,CAAS;IAC5B,OAAO,CAAC,cAAc,CAAC,CAAa;IACpC,OAAO,CAAC,cAAc,CAAS;IAG/B,OAAO,CAAC,cAAc,CAAuB;gBAGxB,GAAG,EAAE,MAAM,EACX,QAAQ,EAAE,kBAAkB,EAC5B,eAAe,EAAE,eAAe,EAChC,aAAa,EAAE,MAAM,EACrB,UAAU,EAAE,MAAM,EAC3B,YAAY,EAAE,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,EACjC,eAAe,EAAE,eAAe,EACvB,UAAU,EAAE,uBAAuB,EACnC,YAAY,EAAE,YAAY,EAC1B,MAAM,EAAE,MAAM,EACd,cAAc,EAAE,QAAQ,EACxB,SAAS,EAAE,YAAY,EACvB,OAAO,CAAC,EAAE,OAAO,YAAA;WAWzB,WAAW,CAAC,OAAO,GAAE,wBAA6B,GAAG,OAAO,CAAC,iBAAiB,CAAC;IA8G5F,QAAQ,CAAC,CAAC,EAAE,QAAQ,EAAE,QAAQ,CAAC,CAAC,CAAC,EAAE,OAAO,CAAC,EAAE,wBAAwB;IAwD/D,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC;IAuN5B,IAAI,IAAI,OAAO,CAAC,IAAI,CAAC;CASxB"}
|
|
@@ -23,7 +23,7 @@ import { VersoriConfigReader } from '../../dsl/http/versori/configloader.js';
|
|
|
23
23
|
import { CronAPIClient } from '../../dsl/http/versori/cronapi.js';
|
|
24
24
|
import { WorkflowImpl } from '../../dsl/Workflow.js';
|
|
25
25
|
import { envCronPort, envPort, envReadyCheckURL, envVarEnvId, envVarEnvironmentName, envVarOrgId, envVarOrgSlug, envVarOtelTracesURL, envVarProjectId, envVarVersion } from '../../internal/constants.js';
|
|
26
|
-
import { Fake,
|
|
26
|
+
import { Fake, registerWorkflow, signalReady, enabled as supervisorEnabled } from '../../internal/supervisor.js';
|
|
27
27
|
import { IssueImpl } from '../../issues/Issues.js';
|
|
28
28
|
import { MemoryKeyValueProvider } from '../../kv/memory/MemoryKeyValueProvider.js';
|
|
29
29
|
import { NatsKeyValueProvider } from '../../kv/nats/NatsKeyValueProvider.js';
|
|
@@ -167,6 +167,13 @@ export class MemoryInterpreter {
|
|
|
167
167
|
writable: true,
|
|
168
168
|
value: false
|
|
169
169
|
});
|
|
170
|
+
// Workflow registration promises only used when supervisor is enabled
|
|
171
|
+
Object.defineProperty(this, "wfRegistration", {
|
|
172
|
+
enumerable: true,
|
|
173
|
+
configurable: true,
|
|
174
|
+
writable: true,
|
|
175
|
+
value: []
|
|
176
|
+
});
|
|
170
177
|
if (typeof this.log === 'undefined') {
|
|
171
178
|
// this captures the old way of instantiating the MemoryInterpreter and provides an
|
|
172
179
|
// error message back to the user to let them know they should use the new way.
|
|
@@ -266,6 +273,9 @@ export class MemoryInterpreter {
|
|
|
266
273
|
},
|
|
267
274
|
};
|
|
268
275
|
this.registeredWorkflows.push(registration);
|
|
276
|
+
if (supervisorEnabled) {
|
|
277
|
+
this.wfRegistration.push(registerWorkflow(workflow));
|
|
278
|
+
}
|
|
269
279
|
return registration;
|
|
270
280
|
}
|
|
271
281
|
async start() {
|
|
@@ -298,6 +308,7 @@ export class MemoryInterpreter {
|
|
|
298
308
|
span.setAttribute('error.message', err instanceof Error ? err.toString() : err);
|
|
299
309
|
span.setAttribute('execution.id', ctx.executionId);
|
|
300
310
|
span.setAttribute('result', 'fail');
|
|
311
|
+
span.setAttribute('workflow.id', ctx.workflowId || 'unknown-workflow');
|
|
301
312
|
span.end();
|
|
302
313
|
});
|
|
303
314
|
try {
|
|
@@ -322,6 +333,7 @@ export class MemoryInterpreter {
|
|
|
322
333
|
this.tracer.startActiveSpan('done', (span) => {
|
|
323
334
|
span.setAttribute('execution.id', ctx.executionId);
|
|
324
335
|
span.setAttribute('result', 'pass');
|
|
336
|
+
span.setAttribute('workflow.id', ctx.workflowId || 'unknown-workflow');
|
|
325
337
|
span.end();
|
|
326
338
|
});
|
|
327
339
|
try {
|
|
@@ -360,9 +372,6 @@ export class MemoryInterpreter {
|
|
|
360
372
|
});
|
|
361
373
|
throw new Error('Unable to register scheduler tasks with central cron provider');
|
|
362
374
|
}
|
|
363
|
-
// register with suopervisor
|
|
364
|
-
await registerCrons(this.cronRegistry);
|
|
365
|
-
await registerWebhooks(this.webhookRegistry);
|
|
366
375
|
this.webhookServer = webhookApp.listen(port, () => {
|
|
367
376
|
this.log.info(`Express server listening on port ${port}`);
|
|
368
377
|
});
|
|
@@ -399,6 +408,10 @@ export class MemoryInterpreter {
|
|
|
399
408
|
}
|
|
400
409
|
};
|
|
401
410
|
Deno.addSignalListener('SIGINT', this.shutdownServer);
|
|
411
|
+
if (supervisorEnabled) {
|
|
412
|
+
await Promise.all(this.wfRegistration);
|
|
413
|
+
await signalReady();
|
|
414
|
+
}
|
|
402
415
|
return new Promise((resolve) => {
|
|
403
416
|
let serversClosed = 0;
|
|
404
417
|
const totalServers = [this.webhookServer, this.cronServer].filter(Boolean).length;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"catch.d.ts","sourceRoot":"","sources":["../../../../../src/src/interpreter/memory/compilers/catch.ts"],"names":[],"mappings":"AAgBA,OAAO,EAAE,SAAS,EAAE,MAAM,iCAAiC,CAAC;AAG5D,OAAO,EAA2B,YAAY,EAAE,MAAM,YAAY,CAAC;
|
|
1
|
+
{"version":3,"file":"catch.d.ts","sourceRoot":"","sources":["../../../../../src/src/interpreter/memory/compilers/catch.ts"],"names":[],"mappings":"AAgBA,OAAO,EAAE,SAAS,EAAE,MAAM,iCAAiC,CAAC;AAG5D,OAAO,EAA2B,YAAY,EAAE,MAAM,YAAY,CAAC;AA0FnE,eAAO,MAAM,aAAa,EAAE,YAAY,CAAC,GAAG,EAAE,GAAG,EAAE,SAAS,CAAC,GAAG,EAAE,GAAG,CAAC,CAGrE,CAAC"}
|
|
@@ -25,6 +25,7 @@ function compileCatch(compilerCtx, task) {
|
|
|
25
25
|
span.setAttribute('task.type', 'catch');
|
|
26
26
|
span.setAttribute('type', 'task');
|
|
27
27
|
if (error instanceof Error) {
|
|
28
|
+
span.setAttribute('status', 'fail');
|
|
28
29
|
span.recordException(error);
|
|
29
30
|
span.setAttribute('error.message', error.message);
|
|
30
31
|
span.setAttribute('error.stack', error.stack ?? '');
|
|
@@ -37,9 +38,10 @@ function compileCatch(compilerCtx, task) {
|
|
|
37
38
|
annotations: {
|
|
38
39
|
'error': error.message,
|
|
39
40
|
'stack': error.stack || '',
|
|
40
|
-
'workflowId': ctx.options.workflowId || ctx.workflowId ||
|
|
41
|
-
'',
|
|
41
|
+
'workflowId': ctx.options.workflowId || ctx.workflowId || '',
|
|
42
42
|
'executionId': ctx.executionId,
|
|
43
|
+
'activationId': ctx.activation.id,
|
|
44
|
+
'activationExternalId': ctx.activation?.user.externalId,
|
|
43
45
|
},
|
|
44
46
|
reason: 'error',
|
|
45
47
|
severity: 'high',
|
|
@@ -48,11 +50,12 @@ function compileCatch(compilerCtx, task) {
|
|
|
48
50
|
}
|
|
49
51
|
compilerCtx.issueProvider.submitIssue({
|
|
50
52
|
annotations: {
|
|
51
|
-
'error': error.message
|
|
53
|
+
'error': error.message,
|
|
52
54
|
'stack': error.stack || '',
|
|
53
|
-
'workflowId': ctx.options.workflowId || ctx.workflowId ||
|
|
54
|
-
'',
|
|
55
|
+
'workflowId': ctx.options.workflowId || ctx.workflowId || '',
|
|
55
56
|
'executionId': ctx.executionId,
|
|
57
|
+
'activationId': ctx.activation.id,
|
|
58
|
+
'activationExternalId': ctx.activation?.user.externalId,
|
|
56
59
|
},
|
|
57
60
|
reason: 'error',
|
|
58
61
|
severity: 'low',
|
|
@@ -60,6 +63,7 @@ function compileCatch(compilerCtx, task) {
|
|
|
60
63
|
ctx.log.error('execution has encountered an error', {
|
|
61
64
|
error: error,
|
|
62
65
|
});
|
|
66
|
+
span.setAttribute('status', 'fail');
|
|
63
67
|
span.setAttribute('error', `${error}`);
|
|
64
68
|
span.end();
|
|
65
69
|
return errorOperator(of(ctx.withData(new ExecutionError(ctx, `${error}`, { cause: error }))));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fn.d.ts","sourceRoot":"","sources":["../../../../../src/src/interpreter/memory/compilers/fn.ts"],"names":[],"mappings":"AAgBA,OAAO,EAAE,MAAM,EAAE,MAAM,8BAA8B,CAAC;AAGtD,OAAO,EAA2B,YAAY,EAAE,MAAM,YAAY,CAAC;
|
|
1
|
+
{"version":3,"file":"fn.d.ts","sourceRoot":"","sources":["../../../../../src/src/interpreter/memory/compilers/fn.ts"],"names":[],"mappings":"AAgBA,OAAO,EAAE,MAAM,EAAE,MAAM,8BAA8B,CAAC;AAGtD,OAAO,EAA2B,YAAY,EAAE,MAAM,YAAY,CAAC;AAuDnE,eAAO,MAAM,UAAU,EAAE,YAAY,CAAC,GAAG,EAAE,GAAG,EAAE,MAAM,CAAC,GAAG,EAAE,GAAG,CAAC,CAG/D,CAAC"}
|
|
@@ -6,11 +6,12 @@ function compileFn(compilerCtx, task) {
|
|
|
6
6
|
complete: () => compilerCtx.log.debug('fn.complete'),
|
|
7
7
|
}), mergeMap(async (ctx) => {
|
|
8
8
|
return await compilerCtx.tracer.startActiveSpan(`fn-${task.id}`, async (span) => {
|
|
9
|
-
await sendTaskStartEvent(task.id, span);
|
|
9
|
+
ctx = await sendTaskStartEvent(task.id, ctx, span);
|
|
10
10
|
span.setAttribute('task.id', task.id);
|
|
11
11
|
span.setAttribute('type', 'task');
|
|
12
12
|
span.setAttribute('task.type', 'fn');
|
|
13
13
|
span.setAttribute('execution.id', ctx.executionId);
|
|
14
|
+
span.setAttribute('workflow.id', ctx.options.workflowId || 'unknown-workflow');
|
|
14
15
|
try {
|
|
15
16
|
let result;
|
|
16
17
|
const spanContext = span.spanContext();
|
|
@@ -24,8 +25,19 @@ function compileFn(compilerCtx, task) {
|
|
|
24
25
|
if (supervisorEnabled) {
|
|
25
26
|
span.setAttribute('response.body', JSON.stringify(result.data));
|
|
26
27
|
}
|
|
28
|
+
span.setAttribute('status', 'pass');
|
|
27
29
|
return result;
|
|
28
30
|
}
|
|
31
|
+
catch (error) {
|
|
32
|
+
if (error instanceof Error) {
|
|
33
|
+
span.setAttribute('status', 'fail');
|
|
34
|
+
span.recordException(error);
|
|
35
|
+
}
|
|
36
|
+
else {
|
|
37
|
+
span.recordException(new Error(String(error)));
|
|
38
|
+
}
|
|
39
|
+
throw error;
|
|
40
|
+
}
|
|
29
41
|
finally {
|
|
30
42
|
span.end();
|
|
31
43
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"http.d.ts","sourceRoot":"","sources":["../../../../../src/src/interpreter/memory/compilers/http.ts"],"names":[],"mappings":"AAqBA,OAAO,EAAmB,YAAY,EAAE,MAAM,gCAAgC,CAAC;AAG/E,OAAO,EAA2B,YAAY,EAAE,MAAM,YAAY,CAAC;
|
|
1
|
+
{"version":3,"file":"http.d.ts","sourceRoot":"","sources":["../../../../../src/src/interpreter/memory/compilers/http.ts"],"names":[],"mappings":"AAqBA,OAAO,EAAmB,YAAY,EAAE,MAAM,gCAAgC,CAAC;AAG/E,OAAO,EAA2B,YAAY,EAAE,MAAM,YAAY,CAAC;AA4HnE,eAAO,MAAM,YAAY,EAAE,YAAY,CAAC,GAAG,EAAE,GAAG,EAAE,YAAY,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,CAAC,CAG5E,CAAC"}
|
|
@@ -73,22 +73,25 @@ function compileHttp(compilerCtx, task) {
|
|
|
73
73
|
complete: () => compilerCtx.log.debug('http.complete'),
|
|
74
74
|
}), mergeMap((ctx) => {
|
|
75
75
|
return compilerCtx.tracer.startActiveSpan(`http-${task.id}`, async (span) => {
|
|
76
|
-
await sendTaskStartEvent(task.id, span);
|
|
76
|
+
ctx = await sendTaskStartEvent(task.id, ctx, span);
|
|
77
77
|
span.setAttribute('task.id', task.id);
|
|
78
78
|
span.setAttribute('task.type', 'http');
|
|
79
79
|
span.setAttribute('type', 'task');
|
|
80
80
|
span.setAttribute('execution.id', ctx.executionId);
|
|
81
81
|
span.setAttribute('connection.name', task.opts.connection);
|
|
82
|
+
span.setAttribute('workflow.id', ctx.options.workflowId || 'unknown-workflow');
|
|
82
83
|
const spanContext = span.spanContext();
|
|
83
84
|
try {
|
|
84
85
|
const newCtx = await http(ctx.withLogger(ctx.log.child({ spanId: spanContext.spanId, traceId: spanContext.traceId })));
|
|
85
86
|
if (supervisorEnabled) {
|
|
86
87
|
span.setAttribute('response.body', JSON.stringify(newCtx.data));
|
|
87
88
|
}
|
|
89
|
+
span.setAttribute('status', 'pass');
|
|
88
90
|
return newCtx;
|
|
89
91
|
}
|
|
90
92
|
catch (error) {
|
|
91
93
|
if (error instanceof Error) {
|
|
94
|
+
span.setAttribute('status', 'fail');
|
|
92
95
|
span.recordException(error);
|
|
93
96
|
}
|
|
94
97
|
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"}
|
|
@@ -46,8 +46,9 @@ function compileSchedule(ctx, trigger, signal) {
|
|
|
46
46
|
});
|
|
47
47
|
return;
|
|
48
48
|
}
|
|
49
|
-
const executionCtx = ctx.contextProvider.create(activation[0], {});
|
|
49
|
+
const executionCtx = ctx.contextProvider.create(activation[0], {}, { workflowId: trigger.id });
|
|
50
50
|
span.setAttribute('execution.id', executionCtx.executionId);
|
|
51
|
+
await sendTaskStartEvent(trigger.id, executionCtx, span);
|
|
51
52
|
try {
|
|
52
53
|
subscriber.next(executionCtx);
|
|
53
54
|
}
|
|
@@ -78,7 +79,7 @@ function compileSchedule(ctx, trigger, signal) {
|
|
|
78
79
|
return;
|
|
79
80
|
}
|
|
80
81
|
activations.forEach((activation) => {
|
|
81
|
-
const executionCtx = ctx.contextProvider.create(activation, {});
|
|
82
|
+
const executionCtx = ctx.contextProvider.create(activation, {}, { workflowId: trigger.id });
|
|
82
83
|
try {
|
|
83
84
|
subscriber.next(executionCtx);
|
|
84
85
|
}
|
|
@@ -95,7 +96,6 @@ function compileSchedule(ctx, trigger, signal) {
|
|
|
95
96
|
}
|
|
96
97
|
ctx.cronRouter.post(`/cron/${trigger.id}`, async (req, res) => {
|
|
97
98
|
await ctx.tracer.startActiveSpan(`schedule-${trigger.id}`, async (span) => {
|
|
98
|
-
await sendTaskStartEvent(trigger.id, span);
|
|
99
99
|
span.setAttribute('task.id', trigger.id);
|
|
100
100
|
span.setAttribute('task.type', 'schedule');
|
|
101
101
|
span.setAttribute('type', 'task');
|
|
@@ -104,6 +104,7 @@ function compileSchedule(ctx, trigger, signal) {
|
|
|
104
104
|
span.setAttribute('environment.id', environmentId);
|
|
105
105
|
span.setAttribute('environment.name', environmentName);
|
|
106
106
|
span.setAttribute('org.id', orgId);
|
|
107
|
+
span.setAttribute('workflow.id', trigger.id);
|
|
107
108
|
await handleSchedule(req, res, span);
|
|
108
109
|
span.end();
|
|
109
110
|
});
|
|
@@ -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"}
|
|
@@ -85,6 +85,7 @@ export const webhookCompiler = {
|
|
|
85
85
|
onError = trigger.options.response.onError;
|
|
86
86
|
}
|
|
87
87
|
const ctxOptionsFn = (req, res) => ({
|
|
88
|
+
workflowId: trigger.id,
|
|
88
89
|
onSuccess: (ctx) => {
|
|
89
90
|
if (isSync) {
|
|
90
91
|
sendResponse(res, onSuccess(ctx));
|
|
@@ -108,8 +109,10 @@ export const webhookCompiler = {
|
|
|
108
109
|
if (!ctx.webhookRouter) {
|
|
109
110
|
throw new Error('Router not available in compiler context');
|
|
110
111
|
}
|
|
111
|
-
|
|
112
|
-
|
|
112
|
+
ctx.log.info('webhook endpoint added', {
|
|
113
|
+
id: trigger.id,
|
|
114
|
+
method,
|
|
115
|
+
});
|
|
113
116
|
if (corsOptions) {
|
|
114
117
|
if (typeof corsOptions === 'boolean') {
|
|
115
118
|
ctx.webhookRouter.use(cors());
|
|
@@ -131,16 +134,16 @@ export const webhookCompiler = {
|
|
|
131
134
|
log: ctx.log,
|
|
132
135
|
}), async (req, res) => {
|
|
133
136
|
await ctx.tracer.startActiveSpan(`webhook-${trigger.id}`, async (span) => {
|
|
134
|
-
await sendTaskStartEvent(trigger.id, span);
|
|
135
137
|
span.setAttribute('task.id', trigger.id);
|
|
138
|
+
span.setAttribute('workflow.id', trigger.id);
|
|
136
139
|
span.setAttribute('task.type', 'webhook');
|
|
137
140
|
span.setAttribute('type', 'task');
|
|
138
141
|
const staticActivation = res.locals.activation;
|
|
139
142
|
let executionCtx = ctx.contextProvider.create(staticActivation, req.body, ctxOptionsFn(req, res));
|
|
140
143
|
const spanContext = span.spanContext();
|
|
141
144
|
executionCtx = executionCtx.withLogger(executionCtx.log.child({ spanId: spanContext.spanId, traceId: spanContext.traceId }));
|
|
142
|
-
executionCtx.log.info("stack", { stack: new Error().stack });
|
|
143
145
|
span.setAttribute('execution.id', executionCtx.executionId);
|
|
146
|
+
await sendTaskStartEvent(trigger.id, executionCtx, span);
|
|
144
147
|
try {
|
|
145
148
|
subscriber.next(executionCtx);
|
|
146
149
|
if (isAsync) {
|
|
@@ -172,8 +175,8 @@ export const webhookCompiler = {
|
|
|
172
175
|
log: ctx.log,
|
|
173
176
|
}), async (req, res) => {
|
|
174
177
|
await ctx.tracer.startActiveSpan(`webhook-${trigger.id}`, async (span) => {
|
|
175
|
-
await sendTaskStartEvent(trigger.id, span);
|
|
176
178
|
span.setAttribute('task.id', trigger.id);
|
|
179
|
+
span.setAttribute('workflow.id', trigger.id);
|
|
177
180
|
span.setAttribute('task.type', 'webhook');
|
|
178
181
|
span.setAttribute('type', 'task');
|
|
179
182
|
span.setAttribute('user.id', req.params.userId);
|
|
@@ -193,6 +196,7 @@ export const webhookCompiler = {
|
|
|
193
196
|
return;
|
|
194
197
|
}
|
|
195
198
|
let executionCtx = ctx.contextProvider.create(activation, req.body, ctxOptionsFn(req, res));
|
|
199
|
+
await sendTaskStartEvent(trigger.id, executionCtx, span);
|
|
196
200
|
const spanContext = span.spanContext();
|
|
197
201
|
executionCtx = executionCtx.withLogger(executionCtx.log.child({ spanId: spanContext.spanId, traceId: spanContext.traceId }));
|
|
198
202
|
span.setAttribute('execution.id', executionCtx.executionId);
|
|
@@ -232,8 +236,8 @@ export const webhookCompiler = {
|
|
|
232
236
|
log: ctx.log,
|
|
233
237
|
}), async (req, res) => {
|
|
234
238
|
await ctx.tracer.startActiveSpan(`webhook-${trigger.id}`, async (span) => {
|
|
235
|
-
await sendTaskStartEvent(trigger.id, span);
|
|
236
239
|
span.setAttribute('task.id', trigger.id);
|
|
240
|
+
span.setAttribute('workflow.id', trigger.id);
|
|
237
241
|
span.setAttribute('task.type', 'webhook');
|
|
238
242
|
span.setAttribute('type', 'task');
|
|
239
243
|
span.setAttribute('activation.id', req.params.activationId);
|
|
@@ -254,6 +258,7 @@ export const webhookCompiler = {
|
|
|
254
258
|
const spanContext = span.spanContext();
|
|
255
259
|
activationCtx = activationCtx.withLogger(activationCtx.log.child({ spanId: spanContext.spanId, traceId: spanContext.traceId }));
|
|
256
260
|
span.setAttribute('execution.id', activationCtx.executionId);
|
|
261
|
+
await sendTaskStartEvent(trigger.id, activationCtx, span);
|
|
257
262
|
try {
|
|
258
263
|
subscriber.next(activationCtx);
|
|
259
264
|
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,M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,OAAO,CAAC,CAAS;IAClC,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAS;IAClC,OAAO,CAAC,GAAG,CAAS;gBAER,GAAG,EAAE,MAAM;IA2BjB,WAAW,CAAC,KAAK,EAAE,WAAW,GAAG,OAAO,CAAC,IAAI,CAAC;IAQpD,WAAW,CAAC,KAAK,EAAE,WAAW,EAAE,OAAO,CAAC,EAAE;QACtC,WAAW,CAAC,EAAE,OAAO,CAAC;QACtB,cAAc,CAAC,EAAE,MAAM,CAAC;KAC3B,GAAG,OAAO,CAAC,KAAK,GAAG,IAAI,CAAC;YAWX,MAAM;CAiEvB;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"}
|
package/esm/src/issues/Issues.js
CHANGED
|
@@ -12,6 +12,7 @@
|
|
|
12
12
|
*/
|
|
13
13
|
import { createHash } from 'node:crypto';
|
|
14
14
|
import { envVarEnvId, envVarEnvironmentName, envVarOrgId, envVarOrgSlug, envVarProjectId, envVarSDKApiBaseURL, envVarVersion, } from '../internal/constants.js';
|
|
15
|
+
import { enabled as supervisorEnabled } from '../internal/supervisor.js';
|
|
15
16
|
export class IssueImpl {
|
|
16
17
|
constructor(log) {
|
|
17
18
|
Object.defineProperty(this, "baseUrl", {
|
|
@@ -107,6 +108,10 @@ export class IssueImpl {
|
|
|
107
108
|
issue.annotations['environmentId'] = this.environmentId;
|
|
108
109
|
issue.annotations['organisationId'] = this.organisationId;
|
|
109
110
|
try {
|
|
111
|
+
if (supervisorEnabled) {
|
|
112
|
+
this.log.info('Issue to be submitted', { issue: issue });
|
|
113
|
+
return Promise.resolve(null);
|
|
114
|
+
}
|
|
110
115
|
const response = await fetch(`${this.baseUrl}/v1/issues/submit`, {
|
|
111
116
|
method: 'POST',
|
|
112
117
|
headers: {
|
package/package.json
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FetchBuilder.d.ts","sourceRoot":"","sources":["../../../../src/src/connection/internal/FetchBuilder.ts"],"names":[],"mappings":"AAgBA,OAAO,EAAE,SAAS,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAC;AAE5D,MAAM,MAAM,eAAe,GAAG;IAC1B,IAAI,EAAE,MAAM,CAAC;IACb,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,OAAO,CAAC,EAAE,MAAM,CAAC;CACpB,CAAA;AAED;;;;GAIG;AACH,qBAAa,YAAY;;IACrB,WAAW,EAAE,kBAAkB,EAAE,CAAC;gBAMtB,KAAK,EAAE,SAAS,EAAE,GAAG,EAAE,eAAe;
|
|
1
|
+
{"version":3,"file":"FetchBuilder.d.ts","sourceRoot":"","sources":["../../../../src/src/connection/internal/FetchBuilder.ts"],"names":[],"mappings":"AAgBA,OAAO,EAAE,SAAS,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAC;AAE5D,MAAM,MAAM,eAAe,GAAG;IAC1B,IAAI,EAAE,MAAM,CAAC;IACb,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,OAAO,CAAC,EAAE,MAAM,CAAC;CACpB,CAAA;AAED;;;;GAIG;AACH,qBAAa,YAAY;;IACrB,WAAW,EAAE,kBAAkB,EAAE,CAAC;gBAMtB,KAAK,EAAE,SAAS,EAAE,GAAG,EAAE,eAAe;IAelD,GAAG,CAAC,EAAE,EAAE,kBAAkB;IAI1B,KAAK,IAAI,SAAS;IAYlB,oBAAoB,IAAI,SAAS;IAOjC,OAAO,CAAC,eAAe;IAevB,OAAO,CAAC,eAAe;CAyE1B"}
|
|
@@ -70,11 +70,12 @@ class FetchBuilder {
|
|
|
70
70
|
__classPrivateFieldSet(this, _FetchBuilder_base, fetch, "f");
|
|
71
71
|
__classPrivateFieldSet(this, _FetchBuilder_cnx, cnx, "f");
|
|
72
72
|
__classPrivateFieldSet(this, _FetchBuilder_tracer, api_1.default.trace.getTracer('fetch-builder', '1.0.0'), "f");
|
|
73
|
+
const traceMiddleware = this.wrapWithTracing.bind(this);
|
|
73
74
|
if (cnx.baseUrl) {
|
|
74
|
-
this.middlewares = [changeRequestbaseURLMiddleware(cnx)];
|
|
75
|
+
this.middlewares = [changeRequestbaseURLMiddleware(cnx), traceMiddleware];
|
|
75
76
|
}
|
|
76
77
|
else {
|
|
77
|
-
this.middlewares = [];
|
|
78
|
+
this.middlewares = [traceMiddleware];
|
|
78
79
|
}
|
|
79
80
|
this.supervisedFetch = this.supervisedFetch.bind(this);
|
|
80
81
|
}
|
|
@@ -88,8 +89,7 @@ class FetchBuilder {
|
|
|
88
89
|
// order they were added
|
|
89
90
|
fetch = this.middlewares[i](fetch);
|
|
90
91
|
}
|
|
91
|
-
|
|
92
|
-
return this.wrapWithTracing(fetch, false);
|
|
92
|
+
return fetch;
|
|
93
93
|
}
|
|
94
94
|
buildSupervisedFetch() {
|
|
95
95
|
return this.supervisedFetch();
|
|
@@ -107,22 +107,21 @@ class FetchBuilder {
|
|
|
107
107
|
// order they were added
|
|
108
108
|
fetch = this.middlewares[i](fetch);
|
|
109
109
|
}
|
|
110
|
-
|
|
111
|
-
return traced(input, init);
|
|
110
|
+
return fetch(input, init);
|
|
112
111
|
};
|
|
113
112
|
}
|
|
114
|
-
wrapWithTracing(fetch
|
|
113
|
+
wrapWithTracing(fetch) {
|
|
115
114
|
const connectionId = __classPrivateFieldGet(this, _FetchBuilder_cnx, "f")?.id || '';
|
|
116
115
|
const connectionName = __classPrivateFieldGet(this, _FetchBuilder_cnx, "f")?.name || '';
|
|
117
116
|
return (input, init) => {
|
|
118
117
|
const url = getUrl(input);
|
|
119
|
-
return __classPrivateFieldGet(this, _FetchBuilder_tracer, "f").startActiveSpan(`fetch ${
|
|
118
|
+
return __classPrivateFieldGet(this, _FetchBuilder_tracer, "f").startActiveSpan(`fetch ${connectionName}/${connectionId}`, async (span) => {
|
|
120
119
|
// Set span attributes
|
|
121
120
|
span.setAttribute('http.url', url);
|
|
122
121
|
span.setAttribute('type', 'fetch');
|
|
123
122
|
span.setAttribute('connection.id', connectionId);
|
|
124
123
|
span.setAttribute('connection.name', connectionName);
|
|
125
|
-
span.setAttribute('
|
|
124
|
+
span.setAttribute('isConnected', connectionId !== '');
|
|
126
125
|
if (init?.method) {
|
|
127
126
|
span.setAttribute('http.method', init.method);
|
|
128
127
|
}
|
|
@@ -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;AAC5D,OAAO,EAAE,UAAU,EAAE,WAAW,EAAE,MAAM,6BAA6B,CAAC;AAEtE,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,WAAW,CAAC,CAAC,EAAE,IAAI,CAAC,CAAC;IAC3F,OAAO,CAAC,GAAG,EAAE,OAAO,CAAC,GAAG,CAAC,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;CAC7C;AAED,qBAAa,mBAAoB,YAAW,eAAe;IAWnD,OAAO,CAAC,QAAQ,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C,CAAC,EAAE,IAAI,CAAC,CAAC;IAC3F,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,GAAG,EAAE,MAAM,CAAC;IACZ,GAAG,EAAE,gBAAgB,CAAC;IACtB,KAAK,EAAE,mBAAmB,CAAC;IAC3B,MAAM,EAAE,QAAQ,CAAC;IACjB,KAAK,CAAC,EAAE,QAAQ,CAAC;gBAGb,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,MAAM,CAAC,CAAC,EAAE,UAAU,EAAE,UAAU,EAAE,IAAI,EAAE,CAAC,EAAE,OAAO,GAAE,cAAmB,GAAG,WAAW,CAAC,CAAC,CAAC;IA+BxF,OAAO,CAAC,CAAC,EAAE,OAAO,CAAC,GAAG,CAAC,GAAG,OAAO,CAAC,IAAI,CAAC;CAG1C"}
|
|
@@ -74,7 +74,6 @@ class ContextProviderImpl {
|
|
|
74
74
|
}
|
|
75
75
|
create(activation, data, options = {}) {
|
|
76
76
|
const executionId = (0, mod_js_1.ulid)();
|
|
77
|
-
console.log('Creating context for activation', activation);
|
|
78
77
|
const logger = this.log.child({
|
|
79
78
|
executionId,
|
|
80
79
|
activationId: activation.id,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"webhookmiddleware.d.ts","sourceRoot":"","sources":["../../../../../src/src/dsl/http/versori/webhookmiddleware.ts"],"names":[],"mappings":"A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AAM,CAAC;IACtB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,WAAW,EAAE,WAAW,CAAC;IACzB,UAAU,EAAE,iBAAiB,CAAC;IAC9B,SAAS,EAAE,YAAY,CAAC;IACxB,GAAG,EAAE,MAAM,CAAC;CACf,CAAC;AAmCF,wBAAgB,6BAA6B,CACzC,IAAI,EAAE,2BAA2B,GAClC,CAAC,GAAG,EAAE,OAAO,EAAE,GAAG,EAAE,QAAQ,EAAE,IAAI,EAAE,YAAY,KAAK,OAAO,CAAC,IAAI,CAAC,CAqGpE;AAED,wBAAgB,mCAAmC,CAC/C,IAAI,EAAE,2BAA2B,GAClC,CAAC,GAAG,EAAE,OAAO,EAAE,GAAG,EAAE,QAAQ,EAAE,IAAI,EAAE,YAAY,KAAK,OAAO,CAAC,IAAI,CAAC,CAyEpE;AAED,wBAAgB,oCAAoC,CAChD,IAAI,EAAE,2BAA2B,GAClC,CAAC,GAAG,EAAE,OAAO,EAAE,GAAG,EAAE,QAAQ,EAAE,IAAI,EAAE,YAAY,KAAK,OAAO,CAAC,IAAI,CAAC,CA2FpE"}
|
|
@@ -48,7 +48,6 @@ function createStaticWebhookMiddleware(opts) {
|
|
|
48
48
|
const staticMiddleware = async (_req, res, next) => {
|
|
49
49
|
try {
|
|
50
50
|
res.locals.activation = await getStaticActivation(opts);
|
|
51
|
-
console.log("activation", res.locals.activation);
|
|
52
51
|
}
|
|
53
52
|
catch (err) {
|
|
54
53
|
// when working in mocks users might not be connected so there might not be an activation
|
|
@@ -69,7 +68,7 @@ function createStaticWebhookMiddleware(opts) {
|
|
|
69
68
|
next();
|
|
70
69
|
};
|
|
71
70
|
if (opts.connName === undefined) {
|
|
72
|
-
opts.log.warn(`No connection ID found for webhook, accepting any requests which is
|
|
71
|
+
opts.log.warn(`No connection ID found for webhook, accepting any requests which is insecure!`, { webhookId: opts.id });
|
|
73
72
|
return staticMiddleware;
|
|
74
73
|
}
|
|
75
74
|
// TODO(@teo): move db access to outside of the middleware??? (genuine question - not instruction)
|
|
@@ -137,7 +136,7 @@ function createActIdDynamicWebhookMiddleware(opts) {
|
|
|
137
136
|
next();
|
|
138
137
|
};
|
|
139
138
|
if (!opts.connName) {
|
|
140
|
-
opts.log.warn(`No template ID found for webhook, accepting any requests which is
|
|
139
|
+
opts.log.warn(`No template ID found for webhook, accepting any requests which is insecure!`, { webhookId: opts.id });
|
|
141
140
|
return staticMiddleware;
|
|
142
141
|
}
|
|
143
142
|
return async (req, res, next) => {
|
|
@@ -201,7 +200,7 @@ function createUserIdDynamicWebhookMiddleware(opts) {
|
|
|
201
200
|
next();
|
|
202
201
|
};
|
|
203
202
|
if (!opts.connName) {
|
|
204
|
-
opts.log.warn(`No template ID found for webhook, accepting any requests which is
|
|
203
|
+
opts.log.warn(`No template ID found for webhook, accepting any requests which is insecure!`, { webhookId: opts.id });
|
|
205
204
|
return staticMiddleware;
|
|
206
205
|
}
|
|
207
206
|
return async (req, res, next) => {
|
|
@@ -1,21 +1,17 @@
|
|
|
1
1
|
import { ExportResult } from '@opentelemetry/core';
|
|
2
2
|
import { ReadableSpan, SpanExporter } from '@opentelemetry/sdk-trace-node';
|
|
3
3
|
import { Span } from '@opentelemetry/api';
|
|
4
|
+
import { ContextImpl } from '../context/Context.js';
|
|
5
|
+
import { WorkflowImpl } from '../dsl/Workflow.js';
|
|
4
6
|
export declare const enabled: boolean;
|
|
5
|
-
type Webhooks = Map<string, {
|
|
6
|
-
method: string;
|
|
7
|
-
path: string;
|
|
8
|
-
options: any;
|
|
9
|
-
}>;
|
|
10
|
-
type Crons = Map<string, string>;
|
|
11
7
|
type MockConnection = {
|
|
12
8
|
name: string;
|
|
13
9
|
id?: string;
|
|
14
10
|
baseUrl?: string;
|
|
15
11
|
};
|
|
16
|
-
export declare function
|
|
17
|
-
export declare function
|
|
18
|
-
export declare function
|
|
12
|
+
export declare function signalReady(): Promise<void>;
|
|
13
|
+
export declare function registerWorkflow<I, O>(workflow: WorkflowImpl<I, O>): Promise<void>;
|
|
14
|
+
export declare function sendTaskStartEvent<I, O>(taskId: string, ctx: ContextImpl<I, O>, span: Span): Promise<ContextImpl<I, O>>;
|
|
19
15
|
export declare function mockAPIRequest(info: RequestInfo | URL, cnx?: MockConnection, options?: RequestInit): Promise<Response>;
|
|
20
16
|
export declare class Fake implements SpanExporter {
|
|
21
17
|
constructor();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"supervisor.d.ts","sourceRoot":"","sources":["../../../src/src/internal/supervisor.ts"],"names":[],"mappings":"AAaA,OAAO,
|
|
1
|
+
{"version":3,"file":"supervisor.d.ts","sourceRoot":"","sources":["../../../src/src/internal/supervisor.ts"],"names":[],"mappings":"AAaA,OAAO,EACH,YAAY,EAIf,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,+BAA+B,CAAC;AAE3E,OAAO,EAAE,IAAI,EAAE,MAAM,oBAAoB,CAAC;AAC1C,OAAO,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;AACpD,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAuClD,eAAO,MAAM,OAAO,SAEhB,CAAC;AA0BL,KAAK,cAAc,GAAG;IAClB,IAAI,EAAE,MAAM,CAAC;IACb,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,OAAO,CAAC,EAAE,MAAM,CAAC;CACpB,CAAC;AAqCF,wBAAsB,WAAW,IAAI,OAAO,CAAC,IAAI,CAAC,CAYjD;AAED,wBAAsB,gBAAgB,CAAC,CAAC,EAAE,CAAC,EAAE,QAAQ,EAAE,YAAY,CAAC,CAAC,EAAE,CAAC,CAAC,GAAG,OAAO,CAAC,IAAI,CAAC,CAgCxF;AAED,wBAAsB,kBAAkB,CAAC,CAAC,EAAE,CAAC,EACzC,MAAM,EAAE,MAAM,EACd,GAAG,EAAE,WAAW,CAAC,CAAC,EAAE,CAAC,CAAC,EACtB,IAAI,EAAE,IAAI,GACX,OAAO,CAA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