@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.
Files changed (75) hide show
  1. package/esm/src/connection/internal/FetchBuilder.d.ts.map +1 -1
  2. package/esm/src/connection/internal/FetchBuilder.js +8 -9
  3. package/esm/src/context/ContextProvider.d.ts.map +1 -1
  4. package/esm/src/context/ContextProvider.js +0 -1
  5. package/esm/src/dsl/http/versori/webhookmiddleware.d.ts.map +1 -1
  6. package/esm/src/dsl/http/versori/webhookmiddleware.js +3 -4
  7. package/esm/src/internal/supervisor.d.ts +5 -9
  8. package/esm/src/internal/supervisor.d.ts.map +1 -1
  9. package/esm/src/internal/supervisor.js +108 -48
  10. package/esm/src/interpreter/durable/DurableInterpreter.d.ts +1 -0
  11. package/esm/src/interpreter/durable/DurableInterpreter.d.ts.map +1 -1
  12. package/esm/src/interpreter/durable/DurableInterpreter.js +17 -4
  13. package/esm/src/interpreter/durable/compilers/catch.d.ts.map +1 -1
  14. package/esm/src/interpreter/durable/compilers/catch.js +9 -6
  15. package/esm/src/interpreter/durable/compilers/fn.d.ts.map +1 -1
  16. package/esm/src/interpreter/durable/compilers/fn.js +14 -1
  17. package/esm/src/interpreter/durable/compilers/http.d.ts.map +1 -1
  18. package/esm/src/interpreter/durable/compilers/http.js +5 -1
  19. package/esm/src/interpreter/durable/compilers/schedule.d.ts.map +1 -1
  20. package/esm/src/interpreter/durable/compilers/schedule.js +2 -2
  21. package/esm/src/interpreter/durable/compilers/webhook.d.ts.map +1 -1
  22. package/esm/src/interpreter/durable/compilers/webhook.js +5 -2
  23. package/esm/src/interpreter/memory/MemoryInterpreter.d.ts +1 -0
  24. package/esm/src/interpreter/memory/MemoryInterpreter.d.ts.map +1 -1
  25. package/esm/src/interpreter/memory/MemoryInterpreter.js +17 -4
  26. package/esm/src/interpreter/memory/compilers/catch.d.ts.map +1 -1
  27. package/esm/src/interpreter/memory/compilers/catch.js +9 -5
  28. package/esm/src/interpreter/memory/compilers/fn.d.ts.map +1 -1
  29. package/esm/src/interpreter/memory/compilers/fn.js +13 -1
  30. package/esm/src/interpreter/memory/compilers/http.d.ts.map +1 -1
  31. package/esm/src/interpreter/memory/compilers/http.js +4 -1
  32. package/esm/src/interpreter/memory/compilers/schedule.d.ts.map +1 -1
  33. package/esm/src/interpreter/memory/compilers/schedule.js +4 -3
  34. package/esm/src/interpreter/memory/compilers/webhook.d.ts.map +1 -1
  35. package/esm/src/interpreter/memory/compilers/webhook.js +11 -6
  36. package/esm/src/issues/Issues.d.ts.map +1 -1
  37. package/esm/src/issues/Issues.js +5 -0
  38. package/package.json +1 -1
  39. package/script/src/connection/internal/FetchBuilder.d.ts.map +1 -1
  40. package/script/src/connection/internal/FetchBuilder.js +8 -9
  41. package/script/src/context/ContextProvider.d.ts.map +1 -1
  42. package/script/src/context/ContextProvider.js +0 -1
  43. package/script/src/dsl/http/versori/webhookmiddleware.d.ts.map +1 -1
  44. package/script/src/dsl/http/versori/webhookmiddleware.js +3 -4
  45. package/script/src/internal/supervisor.d.ts +5 -9
  46. package/script/src/internal/supervisor.d.ts.map +1 -1
  47. package/script/src/internal/supervisor.js +109 -49
  48. package/script/src/interpreter/durable/DurableInterpreter.d.ts +1 -0
  49. package/script/src/interpreter/durable/DurableInterpreter.d.ts.map +1 -1
  50. package/script/src/interpreter/durable/DurableInterpreter.js +16 -3
  51. package/script/src/interpreter/durable/compilers/catch.d.ts.map +1 -1
  52. package/script/src/interpreter/durable/compilers/catch.js +9 -6
  53. package/script/src/interpreter/durable/compilers/fn.d.ts.map +1 -1
  54. package/script/src/interpreter/durable/compilers/fn.js +13 -0
  55. package/script/src/interpreter/durable/compilers/http.d.ts.map +1 -1
  56. package/script/src/interpreter/durable/compilers/http.js +4 -0
  57. package/script/src/interpreter/durable/compilers/schedule.d.ts.map +1 -1
  58. package/script/src/interpreter/durable/compilers/schedule.js +2 -2
  59. package/script/src/interpreter/durable/compilers/webhook.d.ts.map +1 -1
  60. package/script/src/interpreter/durable/compilers/webhook.js +5 -2
  61. package/script/src/interpreter/memory/MemoryInterpreter.d.ts +1 -0
  62. package/script/src/interpreter/memory/MemoryInterpreter.d.ts.map +1 -1
  63. package/script/src/interpreter/memory/MemoryInterpreter.js +16 -3
  64. package/script/src/interpreter/memory/compilers/catch.d.ts.map +1 -1
  65. package/script/src/interpreter/memory/compilers/catch.js +9 -5
  66. package/script/src/interpreter/memory/compilers/fn.d.ts.map +1 -1
  67. package/script/src/interpreter/memory/compilers/fn.js +13 -1
  68. package/script/src/interpreter/memory/compilers/http.d.ts.map +1 -1
  69. package/script/src/interpreter/memory/compilers/http.js +4 -1
  70. package/script/src/interpreter/memory/compilers/schedule.d.ts.map +1 -1
  71. package/script/src/interpreter/memory/compilers/schedule.js +4 -3
  72. package/script/src/interpreter/memory/compilers/webhook.d.ts.map +1 -1
  73. package/script/src/interpreter/memory/compilers/webhook.js +11 -6
  74. package/script/src/issues/Issues.d.ts.map +1 -1
  75. package/script/src/issues/Issues.js +5 -0
@@ -13,19 +13,24 @@
13
13
  */
14
14
  Object.defineProperty(exports, "__esModule", { value: true });
15
15
  exports.Fake = exports.enabled = void 0;
16
- exports.registerWebhooks = registerWebhooks;
16
+ exports.signalReady = signalReady;
17
+ exports.registerWorkflow = registerWorkflow;
17
18
  exports.sendTaskStartEvent = sendTaskStartEvent;
18
- exports.registerCrons = registerCrons;
19
19
  exports.mockAPIRequest = mockAPIRequest;
20
20
  const core_1 = require("@opentelemetry/core");
21
21
  const ConsoleLogger_js_1 = require("../observability/logging/ConsoleLogger.js");
22
- const supervisorURL = function () {
22
+ const ChainTask_js_1 = require("../dsl/tasks/ChainTask.js");
23
+ const ScheduleTrigger_js_1 = require("../dsl/triggers/ScheduleTrigger.js");
24
+ const WebhookTrigger_js_1 = require("../dsl/triggers/WebhookTrigger.js");
25
+ const DurableTrigger_js_1 = require("../dsl/triggers/DurableTrigger.js");
26
+ const Task_js_1 = require("../dsl/Task.js");
27
+ const supervisorURL = (function () {
23
28
  return Deno.env.get('RUN_SUPERVISOR_URL') || '';
24
- }();
25
- exports.enabled = function () {
29
+ })();
30
+ exports.enabled = (function () {
26
31
  return Deno.env.get('RUN_SUPERVISOR_URL') ? true : false;
27
- }();
28
- const flows = function () {
32
+ })();
33
+ const flows = (function () {
29
34
  try {
30
35
  const _cwd = Deno.cwd();
31
36
  const flowsFile = Deno.readTextFileSync(_cwd + '/versori-flow.json');
@@ -33,73 +38,127 @@ const flows = function () {
33
38
  const nodes = {};
34
39
  for (const node of flows.nodes) {
35
40
  nodes[node.id] = {
36
- description: node.data.description,
37
- steps: node.data.steps,
41
+ description: node?.data?.description,
42
+ steps: node?.data?.steps,
43
+ files: node?.data?.files[0]
38
44
  };
39
45
  }
40
46
  return nodes;
41
47
  }
42
- catch (err) {
48
+ catch {
43
49
  return {};
44
50
  }
45
- }();
51
+ })();
46
52
  const logger = new ConsoleLogger_js_1.ConsoleLogger('debug');
47
- async function registerWebhooks(webhooks) {
53
+ function getTriggerData(workflow) {
54
+ if (workflow.trigger instanceof WebhookTrigger_js_1.WebhookTrigger) {
55
+ return {
56
+ id: workflow.trigger.id,
57
+ type: 'webhook',
58
+ method: workflow.trigger.options.method || 'post',
59
+ };
60
+ }
61
+ else if (workflow.trigger instanceof ScheduleTrigger_js_1.ScheduleTrigger) {
62
+ return {
63
+ id: workflow.trigger.id,
64
+ type: 'schedule',
65
+ schedule: workflow.trigger.schedule,
66
+ };
67
+ }
68
+ else if (workflow.trigger instanceof DurableTrigger_js_1.DurableWorkflowTrigger) {
69
+ return {
70
+ id: workflow.trigger.id,
71
+ type: 'durable',
72
+ };
73
+ }
74
+ return null;
75
+ }
76
+ function getTaskData(task) {
77
+ const rawType = task[Task_js_1.TaskType] ?? 'unknown';
78
+ const type = String(rawType).toLowerCase();
79
+ const taskId = String(task.id) ?? 'unknown';
80
+ return {
81
+ taskId,
82
+ type,
83
+ };
84
+ }
85
+ async function signalReady() {
48
86
  if (!exports.enabled) {
49
87
  return;
50
88
  }
51
89
  try {
52
- await fetch(`${supervisorURL}/register-webhooks`, {
53
- method: "POST",
54
- body: JSON.stringify(Object.fromEntries(webhooks)),
55
- headers: {
56
- "Content-Type": "application/json",
57
- },
90
+ await fetch(`${supervisorURL}/ready`, {
91
+ method: 'POST',
58
92
  });
59
93
  }
60
94
  catch (err) {
61
- logger.error('Failed to register webhooks with supervisor', { error: err });
95
+ logger.error('Failed to signal ready to supervisor', { error: err });
62
96
  }
63
97
  }
64
- async function sendTaskStartEvent(taskId, span) {
98
+ async function registerWorkflow(workflow) {
65
99
  if (!exports.enabled) {
66
100
  return;
67
101
  }
102
+ if (workflow.task instanceof ChainTask_js_1.ChainTask) {
103
+ const triggerData = getTriggerData(workflow);
104
+ if (!triggerData) {
105
+ logger.error('Unable to determine trigger data for workflow');
106
+ return;
107
+ }
108
+ const tasks = workflow.task.tasks.map((t) => getTaskData(t));
109
+ const data = {
110
+ workflowId: triggerData.id,
111
+ trigger: triggerData,
112
+ tasks,
113
+ };
114
+ try {
115
+ await fetch(`${supervisorURL}/register-workflow`, {
116
+ method: 'POST',
117
+ body: JSON.stringify(data),
118
+ headers: {
119
+ 'Content-Type': 'application/json',
120
+ },
121
+ });
122
+ }
123
+ catch (err) {
124
+ logger.error('Failed to register workflow with supervisor', { error: err });
125
+ }
126
+ }
127
+ }
128
+ async function sendTaskStartEvent(taskId, ctx, span) {
129
+ if (!exports.enabled) {
130
+ return ctx;
131
+ }
68
132
  const data = {
69
133
  taskId,
70
134
  spanId: span.spanContext().spanId,
71
135
  traceId: span.spanContext().traceId,
72
136
  startTime: new Date().toISOString(), // assuming current time as start time
137
+ executionId: ctx.executionId,
138
+ workflowId: ctx.workflowId || '',
73
139
  };
74
140
  try {
75
- await fetch(`${supervisorURL}/tasks/start`, {
76
- method: "POST",
141
+ const resp = await fetch(`${supervisorURL}/tasks/start`, {
142
+ method: 'POST',
77
143
  body: JSON.stringify(data),
78
144
  headers: {
79
- "Content-Type": "application/json",
145
+ 'Content-Type': 'application/json',
80
146
  },
81
147
  });
148
+ if (resp.ok) {
149
+ const bodyString = await resp.text();
150
+ if (!bodyString) {
151
+ return ctx;
152
+ }
153
+ // TODO: XML, CSV yada yada
154
+ const respData = JSON.parse(bodyString);
155
+ return ctx.withData(respData);
156
+ }
82
157
  }
83
158
  catch (err) {
84
159
  logger.error('Failed to send task start event to supervisor', { error: err });
85
160
  }
86
- }
87
- async function registerCrons(crons) {
88
- if (!exports.enabled) {
89
- return;
90
- }
91
- try {
92
- await fetch(`${supervisorURL}/register-schedulers`, {
93
- method: "POST",
94
- body: JSON.stringify(Object.fromEntries(crons)),
95
- headers: {
96
- "Content-Type": "application/json",
97
- },
98
- });
99
- }
100
- catch (err) {
101
- logger.error('Failed to register crons with supervisor', { error: err });
102
- }
161
+ return ctx;
103
162
  }
104
163
  async function mockAPIRequest(info, cnx, options) {
105
164
  if (!exports.enabled) {
@@ -108,17 +167,17 @@ async function mockAPIRequest(info, cnx, options) {
108
167
  const mockRequest = {
109
168
  url: info.toString(),
110
169
  payload: options?.body || '',
111
- method: options?.method || "GET",
170
+ method: options?.method || 'GET',
112
171
  headers: options?.headers,
113
172
  connection: cnx?.name,
114
173
  connectionId: cnx?.id,
115
174
  };
116
175
  try {
117
176
  const response = await fetch(`${supervisorURL}/ai/fake-fetch-call`, {
118
- method: "POST",
177
+ method: 'POST',
119
178
  body: JSON.stringify(mockRequest),
120
179
  headers: {
121
- "Content-Type": "application/json",
180
+ 'Content-Type': 'application/json',
122
181
  },
123
182
  });
124
183
  if (!response.ok) {
@@ -134,7 +193,7 @@ async function mockAPIRequest(info, cnx, options) {
134
193
  }
135
194
  }
136
195
  function printableSpan(s) {
137
- let span = {
196
+ const span = {
138
197
  name: s.name,
139
198
  startTime: (0, core_1.hrTimeToTimeStamp)(s.startTime),
140
199
  endTime: (0, core_1.hrTimeToTimeStamp)(s.endTime),
@@ -146,10 +205,11 @@ function printableSpan(s) {
146
205
  parentSpanContext: s.parentSpanContext,
147
206
  spanContext: s.spanContext(),
148
207
  };
149
- const nodeDetail = flows[span.attributes['task.id']]; // I know I have coded all of those as string
208
+ const nodeDetail = flows[span.attributes['task.id']]; // I know I have coded all of those as string
150
209
  if (nodeDetail) {
151
- span.attributes['description'] = nodeDetail.description;
152
- span.attributes['steps'] = nodeDetail.steps;
210
+ span.attributes['description'] = nodeDetail?.description || '';
211
+ span.attributes['steps'] = nodeDetail?.steps || '';
212
+ span.attributes['files'] = nodeDetail?.files || '';
153
213
  }
154
214
  return span;
155
215
  }
@@ -163,10 +223,10 @@ class Fake {
163
223
  const ss = spans.map(printableSpan);
164
224
  try {
165
225
  fetch(`${supervisorURL}/receive-spans`, {
166
- method: "POST",
226
+ method: 'POST',
167
227
  body: JSON.stringify({ spans: ss }),
168
228
  headers: {
169
- "Content-Type": "application/json",
229
+ 'Content-Type': 'application/json',
170
230
  },
171
231
  }).catch((err) => {
172
232
  logger.error('Failed to send spans to supervisor', { error: err });
@@ -95,6 +95,7 @@ export declare class DurableInterpreter {
95
95
  private cronServer?;
96
96
  private shutdownServer?;
97
97
  private isShuttingDown;
98
+ private wfRegistration;
98
99
  constructor(log: Logger, compiler: ObservableCompiler, contextProvider: ContextProvider, webhookRouter: Router, cronRouter: Router, cronRegistry: Map<string, string>, webhookRegistry: WebhookRegistry, platformApi: PlatformApi, cnxFetchFactory: DirectConnectionFactory, cronProvider: CronProvider, tracer: Tracer, issue: IssueAPI, cfgReader: ConfigReader, queueProvider: QueueAPI, otelSDK?: NodeSDK | undefined);
99
100
  static newInstance(options?: DurableInterpreterOptions): Promise<DurableInterpreter>;
100
101
  register<O>(workflow: Workflow<O>, options?: DurableInterpreterOptions): Registration;
@@ -1 +1 @@
1
- {"version":3,"file":"DurableInterpreter.d.ts","sourceRoot":"","sources":["../../../../src/src/interpreter/durable/DurableInterpreter.ts"],"names":[],"mappings":"AAYA,OAAsB,EAAQ,MAAM,EAAE,MAAM,oBAAoB,CAAC;AAGjE,OAA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 +189,13 @@ class DurableInterpreter {
189
189
  writable: true,
190
190
  value: false
191
191
  });
192
+ // Workflow registration promises only used when supervisor is enabled
193
+ Object.defineProperty(this, "wfRegistration", {
194
+ enumerable: true,
195
+ configurable: true,
196
+ writable: true,
197
+ value: []
198
+ });
192
199
  if (typeof this.log === 'undefined') {
193
200
  // this captures the old way of instantiating the DurableInterpreter and provides an
194
201
  // error message back to the user to let them know they should use the new way.
@@ -292,6 +299,9 @@ class DurableInterpreter {
292
299
  },
293
300
  };
294
301
  this.registeredWorkflows.push(registration);
302
+ if (supervisor_js_1.enabled) {
303
+ this.wfRegistration.push((0, supervisor_js_1.registerWorkflow)(workflow));
304
+ }
295
305
  return registration;
296
306
  }
297
307
  async start() {
@@ -324,6 +334,7 @@ class DurableInterpreter {
324
334
  span.setAttribute('error.message', err instanceof Error ? err.toString() : err);
325
335
  span.setAttribute('execution.id', ctx.executionId);
326
336
  span.setAttribute('result', 'fail');
337
+ span.setAttribute('workflow.id', ctx.workflowId || 'unknown-workflow');
327
338
  span.end();
328
339
  });
329
340
  try {
@@ -348,6 +359,7 @@ class DurableInterpreter {
348
359
  this.tracer.startActiveSpan('done', (span) => {
349
360
  span.setAttribute('execution.id', ctx.executionId);
350
361
  span.setAttribute('result', 'pass');
362
+ span.setAttribute('workflow.id', ctx.workflowId || 'unknown-workflow');
351
363
  span.end();
352
364
  });
353
365
  try {
@@ -397,9 +409,6 @@ class DurableInterpreter {
397
409
  });
398
410
  throw new Error('Unable to register scheduler tasks with central cron provider');
399
411
  }
400
- // register with supervisor
401
- await (0, supervisor_js_1.registerCrons)(this.cronRegistry);
402
- await (0, supervisor_js_1.registerWebhooks)(this.webhookRegistry);
403
412
  this.webhookServer = webhookApp.listen(port, () => {
404
413
  this.log.info(`Express server listening on port ${port}`);
405
414
  });
@@ -436,6 +445,10 @@ class DurableInterpreter {
436
445
  }
437
446
  };
438
447
  Deno.addSignalListener('SIGINT', this.shutdownServer);
448
+ if (supervisor_js_1.enabled) {
449
+ await Promise.all(this.wfRegistration);
450
+ await (0, supervisor_js_1.signalReady)();
451
+ }
439
452
  return new Promise((resolve) => {
440
453
  let serversClosed = 0;
441
454
  const totalServers = [this.webhookServer, this.cronServer].filter(Boolean).length;
@@ -1 +1 @@
1
- {"version":3,"file":"catch.d.ts","sourceRoot":"","sources":["../../../../../src/src/interpreter/durable/compilers/catch.ts"],"names":[],"mappings":"AAgBA,OAAO,EAAE,SAAS,EAAE,MAAM,iCAAiC,CAAC;AAG5D,OAAO,EAA2B,YAAY,EAAE,MAAM,YAAY,CAAC;AAoFnE,eAAO,MAAM,aAAa,EAAE,YAAY,CAAC,GAAG,EAAE,GAAG,EAAE,SAAS,CAAC,GAAG,EAAE,GAAG,CAAC,CAGrE,CAAC"}
1
+ {"version":3,"file":"catch.d.ts","sourceRoot":"","sources":["../../../../../src/src/interpreter/durable/compilers/catch.ts"],"names":[],"mappings":"AAgBA,OAAO,EAAE,SAAS,EAAE,MAAM,iCAAiC,CAAC;AAG5D,OAAO,EAA2B,YAAY,EAAE,MAAM,YAAY,CAAC;AAuFnE,eAAO,MAAM,aAAa,EAAE,YAAY,CAAC,GAAG,EAAE,GAAG,EAAE,SAAS,CAAC,GAAG,EAAE,GAAG,CAAC,CAGrE,CAAC"}
@@ -27,6 +27,7 @@ function compileCatch(compilerCtx, task) {
27
27
  span.setAttribute('task.type', 'catch');
28
28
  span.setAttribute('type', 'task');
29
29
  if (error instanceof Error) {
30
+ span.setAttribute('status', 'fail');
30
31
  span.recordException(error);
31
32
  span.setAttribute('error.message', error.message);
32
33
  span.setAttribute('error.stack', error.stack ?? '');
@@ -39,9 +40,10 @@ function compileCatch(compilerCtx, task) {
39
40
  annotations: {
40
41
  'error': error.message,
41
42
  'stack': error.stack || '',
42
- 'workflowId': ctx.options.workflowId || ctx.workflowId ||
43
- '',
43
+ 'workflowId': ctx.options.workflowId || ctx.workflowId || '',
44
44
  'executionId': ctx.executionId,
45
+ 'activationId': ctx.activation.id,
46
+ 'activationExternalId': ctx.activation?.user.externalId,
45
47
  },
46
48
  reason: 'error',
47
49
  severity: 'high',
@@ -53,16 +55,17 @@ function compileCatch(compilerCtx, task) {
53
55
  });
54
56
  compilerCtx.issueProvider.submitIssue({
55
57
  annotations: {
56
- 'error': error.message || '',
58
+ 'error': error.message,
57
59
  'stack': error.stack || '',
58
- 'workflowId': ctx.options.workflowId || ctx.workflowId ||
59
- '',
60
+ 'workflowId': ctx.options.workflowId || ctx.workflowId || '',
60
61
  'executionId': ctx.executionId,
62
+ 'activationId': ctx.activation.id,
63
+ 'activationExternalId': ctx.activation?.user.externalId,
61
64
  },
62
65
  reason: 'error',
63
66
  severity: 'low',
64
67
  });
65
- span.setAttribute('error', `${error}`);
68
+ span.setAttribute('status', 'fail');
66
69
  span.end();
67
70
  return errorOperator((0, rxjs_1.of)(ctx.withData(new ExecutionError_js_1.ExecutionError(ctx, `${error}`, { cause: error }))));
68
71
  });
@@ -1 +1 @@
1
- {"version":3,"file":"fn.d.ts","sourceRoot":"","sources":["../../../../../src/src/interpreter/durable/compilers/fn.ts"],"names":[],"mappings":"AA+BA,OAAO,EAAE,MAAM,EAAE,MAAM,8BAA8B,CAAC;AAGtD,OAAO,EAA2B,YAAY,EAAE,MAAM,YAAY,CAAC;AA0CnE,eAAO,MAAM,UAAU,EAAE,YAAY,CAAC,GAAG,EAAE,GAAG,EAAE,MAAM,CAAC,GAAG,EAAE,GAAG,CAAC,CAG/D,CAAC"}
1
+ {"version":3,"file":"fn.d.ts","sourceRoot":"","sources":["../../../../../src/src/interpreter/durable/compilers/fn.ts"],"names":[],"mappings":"AA+BA,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"}
@@ -21,10 +21,12 @@ function compileFn(compilerCtx, task) {
21
21
  complete: () => compilerCtx.log.debug('fn.complete'),
22
22
  }), (0, rxjs_1.mergeMap)(async (ctx) => {
23
23
  return await compilerCtx.tracer.startActiveSpan(`fn-${task.id}`, async (span) => {
24
+ await (0, supervisor_js_1.sendTaskStartEvent)(task.id, span);
24
25
  span.setAttribute('task.id', task.id);
25
26
  span.setAttribute('type', 'task');
26
27
  span.setAttribute('task.type', 'fn');
27
28
  span.setAttribute('execution.id', ctx.executionId);
29
+ span.setAttribute('workflow.id', ctx.options.workflowId || 'unknown-workflow');
28
30
  try {
29
31
  const spanContext = span.spanContext();
30
32
  const ctxWithLogger = ctx.withLogger(ctx.log.child({ spanId: spanContext.spanId, traceId: spanContext.traceId }));
@@ -38,8 +40,19 @@ function compileFn(compilerCtx, task) {
38
40
  if (supervisor_js_1.enabled) {
39
41
  span.setAttribute('response.body', JSON.stringify(result.data));
40
42
  }
43
+ span.setAttribute('status', 'pass');
41
44
  return result;
42
45
  }
46
+ catch (error) {
47
+ if (error instanceof Error) {
48
+ span.setAttribute('status', 'fail');
49
+ span.recordException(error);
50
+ }
51
+ else {
52
+ span.recordException(new Error(String(error)));
53
+ }
54
+ throw error;
55
+ }
43
56
  finally {
44
57
  span.end();
45
58
  }
@@ -1 +1 @@
1
- {"version":3,"file":"http.d.ts","sourceRoot":"","sources":["../../../../../src/src/interpreter/durable/compilers/http.ts"],"names":[],"mappings":"AAqBA,OAAO,EAAmB,YAAY,EAAE,MAAM,gCAAgC,CAAC;AAG/E,OAAO,EAA2B,YAAY,EAAE,MAAM,YAAY,CAAC;AAuHnE,eAAO,MAAM,YAAY,EAAE,YAAY,CAAC,GAAG,EAAE,GAAG,EAAE,YAAY,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,CAAC,CAG5E,CAAC"}
1
+ {"version":3,"file":"http.d.ts","sourceRoot":"","sources":["../../../../../src/src/interpreter/durable/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"}
@@ -76,21 +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
80
  span.setAttribute('task.id', task.id);
80
81
  span.setAttribute('task.type', 'http');
81
82
  span.setAttribute('type', 'task');
82
83
  span.setAttribute('execution.id', ctx.executionId);
83
84
  span.setAttribute('connection.name', task.opts.connection);
85
+ span.setAttribute('workflow.id', ctx.options.workflowId || 'unknown-workflow');
84
86
  const spanContext = span.spanContext();
85
87
  try {
86
88
  const result = await http(ctx.withLogger(ctx.log.child({ spanId: spanContext.spanId, traceId: spanContext.traceId })));
87
89
  if (supervisor_js_1.enabled) {
88
90
  span.setAttribute('response.body', JSON.stringify(result.data));
89
91
  }
92
+ span.setAttribute('status', 'pass');
90
93
  return result;
91
94
  }
92
95
  catch (error) {
93
96
  if (error instanceof Error) {
97
+ span.setAttribute('status', 'fail');
94
98
  span.recordException(error);
95
99
  }
96
100
  else {
@@ -1 +1 @@
1
- {"version":3,"file":"schedule.d.ts","sourceRoot":"","sources":["../../../../../src/src/interpreter/durable/compilers/schedule.ts"],"names":[],"mappings":"AAiBA,OAAO,EAAE,YAAY,EAAE,eAAe,EAAE,MAAM,0CAA0C,CAAC;AAQzF,OAAO,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;AAmJ7C,eAAO,MAAM,gBAAgB,EAAE,eAAe,CAAC,YAAY,EAAE,eAAe,CAG3E,CAAC"}
1
+ {"version":3,"file":"schedule.d.ts","sourceRoot":"","sources":["../../../../../src/src/interpreter/durable/compilers/schedule.ts"],"names":[],"mappings":"AAiBA,OAAO,EAAE,YAAY,EAAE,eAAe,EAAE,MAAM,0CAA0C,CAAC;AAQzF,OAAO,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;AAqJ7C,eAAO,MAAM,gBAAgB,EAAE,eAAe,CAAC,YAAY,EAAE,eAAe,CAG3E,CAAC"}
@@ -55,7 +55,7 @@ function compileSchedule(ctx, trigger, signal) {
55
55
  });
56
56
  return;
57
57
  }
58
- const executionCtx = ctx.contextProvider.create(activation[0], {});
58
+ const executionCtx = ctx.contextProvider.create(activation[0], {}, { workflowId: trigger.id });
59
59
  span.setAttribute('execution.id', executionCtx.executionId);
60
60
  try {
61
61
  subscriber.next(executionCtx);
@@ -87,7 +87,7 @@ function compileSchedule(ctx, trigger, signal) {
87
87
  return;
88
88
  }
89
89
  activations.forEach((activation) => {
90
- const executionCtx = ctx.contextProvider.create(activation, {});
90
+ const executionCtx = ctx.contextProvider.create(activation, {}, { workflowId: trigger.id });
91
91
  try {
92
92
  subscriber.next(executionCtx);
93
93
  }
@@ -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,CAwTxE,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"}
@@ -90,6 +90,7 @@ exports.webhookCompiler = {
90
90
  onError = trigger.options.response.onError;
91
91
  }
92
92
  const ctxOptionsFn = (req, res) => ({
93
+ workflowId: trigger.id,
93
94
  onSuccess: (ctx) => {
94
95
  if (isSync) {
95
96
  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
- // add the webhook endpoint to the router
118
- ctx.log.info('webhook endpoint added:', { trigger });
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)());
@@ -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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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"}
@@ -173,6 +173,13 @@ class MemoryInterpreter {
173
173
  writable: true,
174
174
  value: false
175
175
  });
176
+ // Workflow registration promises only used when supervisor is enabled
177
+ Object.defineProperty(this, "wfRegistration", {
178
+ enumerable: true,
179
+ configurable: true,
180
+ writable: true,
181
+ value: []
182
+ });
176
183
  if (typeof this.log === 'undefined') {
177
184
  // this captures the old way of instantiating the MemoryInterpreter and provides an
178
185
  // error message back to the user to let them know they should use the new way.
@@ -272,6 +279,9 @@ class MemoryInterpreter {
272
279
  },
273
280
  };
274
281
  this.registeredWorkflows.push(registration);
282
+ if (supervisor_js_1.enabled) {
283
+ this.wfRegistration.push((0, supervisor_js_1.registerWorkflow)(workflow));
284
+ }
275
285
  return registration;
276
286
  }
277
287
  async start() {
@@ -304,6 +314,7 @@ class MemoryInterpreter {
304
314
  span.setAttribute('error.message', err instanceof Error ? err.toString() : err);
305
315
  span.setAttribute('execution.id', ctx.executionId);
306
316
  span.setAttribute('result', 'fail');
317
+ span.setAttribute('workflow.id', ctx.workflowId || 'unknown-workflow');
307
318
  span.end();
308
319
  });
309
320
  try {
@@ -328,6 +339,7 @@ class MemoryInterpreter {
328
339
  this.tracer.startActiveSpan('done', (span) => {
329
340
  span.setAttribute('execution.id', ctx.executionId);
330
341
  span.setAttribute('result', 'pass');
342
+ span.setAttribute('workflow.id', ctx.workflowId || 'unknown-workflow');
331
343
  span.end();
332
344
  });
333
345
  try {
@@ -366,9 +378,6 @@ class MemoryInterpreter {
366
378
  });
367
379
  throw new Error('Unable to register scheduler tasks with central cron provider');
368
380
  }
369
- // register with suopervisor
370
- await (0, supervisor_js_1.registerCrons)(this.cronRegistry);
371
- await (0, supervisor_js_1.registerWebhooks)(this.webhookRegistry);
372
381
  this.webhookServer = webhookApp.listen(port, () => {
373
382
  this.log.info(`Express server listening on port ${port}`);
374
383
  });
@@ -405,6 +414,10 @@ class MemoryInterpreter {
405
414
  }
406
415
  };
407
416
  Deno.addSignalListener('SIGINT', this.shutdownServer);
417
+ if (supervisor_js_1.enabled) {
418
+ await Promise.all(this.wfRegistration);
419
+ await (0, supervisor_js_1.signalReady)();
420
+ }
408
421
  return new Promise((resolve) => {
409
422
  let serversClosed = 0;
410
423
  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;AAsFnE,eAAO,MAAM,aAAa,EAAE,YAAY,CAAC,GAAG,EAAE,GAAG,EAAE,SAAS,CAAC,GAAG,EAAE,GAAG,CAAC,CAGrE,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"}
@@ -28,6 +28,7 @@ function compileCatch(compilerCtx, task) {
28
28
  span.setAttribute('task.type', 'catch');
29
29
  span.setAttribute('type', 'task');
30
30
  if (error instanceof Error) {
31
+ span.setAttribute('status', 'fail');
31
32
  span.recordException(error);
32
33
  span.setAttribute('error.message', error.message);
33
34
  span.setAttribute('error.stack', error.stack ?? '');
@@ -40,9 +41,10 @@ function compileCatch(compilerCtx, task) {
40
41
  annotations: {
41
42
  'error': error.message,
42
43
  'stack': error.stack || '',
43
- 'workflowId': ctx.options.workflowId || ctx.workflowId ||
44
- '',
44
+ 'workflowId': ctx.options.workflowId || ctx.workflowId || '',
45
45
  'executionId': ctx.executionId,
46
+ 'activationId': ctx.activation.id,
47
+ 'activationExternalId': ctx.activation?.user.externalId,
46
48
  },
47
49
  reason: 'error',
48
50
  severity: 'high',
@@ -51,11 +53,12 @@ function compileCatch(compilerCtx, task) {
51
53
  }
52
54
  compilerCtx.issueProvider.submitIssue({
53
55
  annotations: {
54
- 'error': error.message || '',
56
+ 'error': error.message,
55
57
  'stack': error.stack || '',
56
- 'workflowId': ctx.options.workflowId || ctx.workflowId ||
57
- '',
58
+ 'workflowId': ctx.options.workflowId || ctx.workflowId || '',
58
59
  'executionId': ctx.executionId,
60
+ 'activationId': ctx.activation.id,
61
+ 'activationExternalId': ctx.activation?.user.externalId,
59
62
  },
60
63
  reason: 'error',
61
64
  severity: 'low',
@@ -63,6 +66,7 @@ function compileCatch(compilerCtx, task) {
63
66
  ctx.log.error('execution has encountered an error', {
64
67
  error: error,
65
68
  });
69
+ span.setAttribute('status', 'fail');
66
70
  span.setAttribute('error', `${error}`);
67
71
  span.end();
68
72
  return errorOperator((0, rxjs_1.of)(ctx.withData(new ExecutionError_js_1.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;AA6CnE,eAAO,MAAM,UAAU,EAAE,YAAY,CAAC,GAAG,EAAE,GAAG,EAAE,MAAM,CAAC,GAAG,EAAE,GAAG,CAAC,CAG/D,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"}