@versori/run 0.7.0-alpha.3 → 0.7.0-alpha.5

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 (169) hide show
  1. package/esm/src/connection/VanillaConnectionFactory.d.ts +16 -0
  2. package/esm/src/connection/VanillaConnectionFactory.d.ts.map +1 -0
  3. package/esm/src/connection/VanillaConnectionFactory.js +23 -0
  4. package/esm/src/context/ActivationImpl.d.ts +2 -1
  5. package/esm/src/context/ActivationImpl.d.ts.map +1 -1
  6. package/esm/src/context/Context.d.ts +4 -2
  7. package/esm/src/context/Context.d.ts.map +1 -1
  8. package/esm/src/context/ContextProvider.d.ts +6 -6
  9. package/esm/src/context/ContextProvider.d.ts.map +1 -1
  10. package/esm/src/context/VanillaContext.d.ts +60 -0
  11. package/esm/src/context/VanillaContext.d.ts.map +1 -0
  12. package/esm/src/context/VanillaContext.js +296 -0
  13. package/esm/src/dsl/http/mod.d.ts +1 -1
  14. package/esm/src/dsl/http/mod.d.ts.map +1 -1
  15. package/esm/src/dsl/http/types.d.ts +19 -134
  16. package/esm/src/dsl/http/types.d.ts.map +1 -1
  17. package/esm/src/dsl/http/versori/configloader.d.ts.map +1 -1
  18. package/esm/src/dsl/http/versori/configloader.js +3 -0
  19. package/esm/src/dsl/tasks/HttpTask.d.ts +5 -5
  20. package/esm/src/dsl/tasks/HttpTask.d.ts.map +1 -1
  21. package/esm/src/dsl/triggers/ScheduleTrigger.d.ts +2 -2
  22. package/esm/src/dsl/triggers/ScheduleTrigger.d.ts.map +1 -1
  23. package/esm/src/interpreter/memory/MemoryInterpreter.d.ts +2 -2
  24. package/esm/src/interpreter/memory/MemoryInterpreter.d.ts.map +1 -1
  25. package/esm/src/interpreter/memory/compilers/schedule.d.ts.map +1 -1
  26. package/esm/src/interpreter/mod.d.ts +1 -0
  27. package/esm/src/interpreter/mod.d.ts.map +1 -1
  28. package/esm/src/interpreter/mod.js +1 -0
  29. package/esm/src/interpreter/vanilla/ExecutionError.d.ts +27 -0
  30. package/esm/src/interpreter/vanilla/ExecutionError.d.ts.map +1 -0
  31. package/esm/src/interpreter/vanilla/ExecutionError.js +48 -0
  32. package/esm/src/interpreter/vanilla/ObservableCompiler.d.ts +38 -0
  33. package/esm/src/interpreter/vanilla/ObservableCompiler.d.ts.map +1 -0
  34. package/esm/src/interpreter/vanilla/ObservableCompiler.js +95 -0
  35. package/esm/src/interpreter/vanilla/Queue.d.ts +72 -0
  36. package/esm/src/interpreter/vanilla/Queue.d.ts.map +1 -0
  37. package/esm/src/interpreter/vanilla/Queue.js +176 -0
  38. package/esm/src/interpreter/vanilla/VanillaInterpreter.d.ts +95 -0
  39. package/esm/src/interpreter/vanilla/VanillaInterpreter.d.ts.map +1 -0
  40. package/esm/src/interpreter/vanilla/VanillaInterpreter.js +428 -0
  41. package/esm/src/interpreter/vanilla/compilers/background.d.ts +4 -0
  42. package/esm/src/interpreter/vanilla/compilers/background.d.ts.map +1 -0
  43. package/esm/src/interpreter/vanilla/compilers/background.js +34 -0
  44. package/esm/src/interpreter/vanilla/compilers/catch.d.ts +4 -0
  45. package/esm/src/interpreter/vanilla/compilers/catch.d.ts.map +1 -0
  46. package/esm/src/interpreter/vanilla/compilers/catch.js +75 -0
  47. package/esm/src/interpreter/vanilla/compilers/chain.d.ts +3 -0
  48. package/esm/src/interpreter/vanilla/compilers/chain.d.ts.map +1 -0
  49. package/esm/src/interpreter/vanilla/compilers/chain.js +21 -0
  50. package/esm/src/interpreter/vanilla/compilers/durableworkflow.d.ts +8 -0
  51. package/esm/src/interpreter/vanilla/compilers/durableworkflow.d.ts.map +1 -0
  52. package/esm/src/interpreter/vanilla/compilers/durableworkflow.js +90 -0
  53. package/esm/src/interpreter/vanilla/compilers/fn.d.ts +4 -0
  54. package/esm/src/interpreter/vanilla/compilers/fn.d.ts.map +1 -0
  55. package/esm/src/interpreter/vanilla/compilers/fn.js +34 -0
  56. package/esm/src/interpreter/vanilla/compilers/http.d.ts +4 -0
  57. package/esm/src/interpreter/vanilla/compilers/http.d.ts.map +1 -0
  58. package/esm/src/interpreter/vanilla/compilers/http.js +54 -0
  59. package/esm/src/interpreter/vanilla/compilers/mod.d.ts +2 -0
  60. package/esm/src/interpreter/vanilla/compilers/mod.d.ts.map +1 -0
  61. package/esm/src/interpreter/vanilla/compilers/mod.js +13 -0
  62. package/esm/src/interpreter/vanilla/compilers/parallel.d.ts +4 -0
  63. package/esm/src/interpreter/vanilla/compilers/parallel.d.ts.map +1 -0
  64. package/esm/src/interpreter/vanilla/compilers/parallel.js +31 -0
  65. package/esm/src/interpreter/vanilla/compilers/schedule.d.ts +4 -0
  66. package/esm/src/interpreter/vanilla/compilers/schedule.d.ts.map +1 -0
  67. package/esm/src/interpreter/vanilla/compilers/schedule.js +76 -0
  68. package/esm/src/interpreter/vanilla/compilers/serial.d.ts +4 -0
  69. package/esm/src/interpreter/vanilla/compilers/serial.d.ts.map +1 -0
  70. package/esm/src/interpreter/vanilla/compilers/serial.js +28 -0
  71. package/esm/src/interpreter/vanilla/compilers/types.d.ts +15 -0
  72. package/esm/src/interpreter/vanilla/compilers/types.d.ts.map +1 -0
  73. package/esm/src/interpreter/vanilla/compilers/types.js +13 -0
  74. package/esm/src/interpreter/vanilla/compilers/unpack.d.ts +4 -0
  75. package/esm/src/interpreter/vanilla/compilers/unpack.d.ts.map +1 -0
  76. package/esm/src/interpreter/vanilla/compilers/unpack.js +34 -0
  77. package/esm/src/interpreter/vanilla/compilers/webhook.d.ts +4 -0
  78. package/esm/src/interpreter/vanilla/compilers/webhook.d.ts.map +1 -0
  79. package/esm/src/interpreter/vanilla/compilers/webhook.js +259 -0
  80. package/esm/src/interpreter/vanilla/mod.d.ts +3 -0
  81. package/esm/src/interpreter/vanilla/mod.d.ts.map +1 -0
  82. package/esm/src/interpreter/vanilla/mod.js +14 -0
  83. package/esm/src/issues/Issues.d.ts +1 -18
  84. package/esm/src/issues/Issues.d.ts.map +1 -1
  85. package/package.json +1 -1
  86. package/script/src/connection/VanillaConnectionFactory.d.ts +16 -0
  87. package/script/src/connection/VanillaConnectionFactory.d.ts.map +1 -0
  88. package/script/src/connection/VanillaConnectionFactory.js +28 -0
  89. package/script/src/context/ActivationImpl.d.ts +2 -1
  90. package/script/src/context/ActivationImpl.d.ts.map +1 -1
  91. package/script/src/context/Context.d.ts +4 -2
  92. package/script/src/context/Context.d.ts.map +1 -1
  93. package/script/src/context/ContextProvider.d.ts +6 -6
  94. package/script/src/context/ContextProvider.d.ts.map +1 -1
  95. package/script/src/context/VanillaContext.d.ts +60 -0
  96. package/script/src/context/VanillaContext.d.ts.map +1 -0
  97. package/script/src/context/VanillaContext.js +302 -0
  98. package/script/src/dsl/http/mod.d.ts +1 -1
  99. package/script/src/dsl/http/mod.d.ts.map +1 -1
  100. package/script/src/dsl/http/types.d.ts +19 -134
  101. package/script/src/dsl/http/types.d.ts.map +1 -1
  102. package/script/src/dsl/http/versori/configloader.d.ts.map +1 -1
  103. package/script/src/dsl/http/versori/configloader.js +3 -0
  104. package/script/src/dsl/tasks/HttpTask.d.ts +5 -5
  105. package/script/src/dsl/tasks/HttpTask.d.ts.map +1 -1
  106. package/script/src/dsl/triggers/ScheduleTrigger.d.ts +2 -2
  107. package/script/src/dsl/triggers/ScheduleTrigger.d.ts.map +1 -1
  108. package/script/src/interpreter/memory/MemoryInterpreter.d.ts +2 -2
  109. package/script/src/interpreter/memory/MemoryInterpreter.d.ts.map +1 -1
  110. package/script/src/interpreter/memory/compilers/schedule.d.ts.map +1 -1
  111. package/script/src/interpreter/mod.d.ts +1 -0
  112. package/script/src/interpreter/mod.d.ts.map +1 -1
  113. package/script/src/interpreter/mod.js +2 -1
  114. package/script/src/interpreter/vanilla/ExecutionError.d.ts +27 -0
  115. package/script/src/interpreter/vanilla/ExecutionError.d.ts.map +1 -0
  116. package/script/src/interpreter/vanilla/ExecutionError.js +52 -0
  117. package/script/src/interpreter/vanilla/ObservableCompiler.d.ts +38 -0
  118. package/script/src/interpreter/vanilla/ObservableCompiler.d.ts.map +1 -0
  119. package/script/src/interpreter/vanilla/ObservableCompiler.js +99 -0
  120. package/script/src/interpreter/vanilla/Queue.d.ts +72 -0
  121. package/script/src/interpreter/vanilla/Queue.d.ts.map +1 -0
  122. package/script/src/interpreter/vanilla/Queue.js +181 -0
  123. package/script/src/interpreter/vanilla/VanillaInterpreter.d.ts +95 -0
  124. package/script/src/interpreter/vanilla/VanillaInterpreter.d.ts.map +1 -0
  125. package/script/src/interpreter/vanilla/VanillaInterpreter.js +435 -0
  126. package/script/src/interpreter/vanilla/compilers/background.d.ts +4 -0
  127. package/script/src/interpreter/vanilla/compilers/background.d.ts.map +1 -0
  128. package/script/src/interpreter/vanilla/compilers/background.js +37 -0
  129. package/script/src/interpreter/vanilla/compilers/catch.d.ts +4 -0
  130. package/script/src/interpreter/vanilla/compilers/catch.d.ts.map +1 -0
  131. package/script/src/interpreter/vanilla/compilers/catch.js +78 -0
  132. package/script/src/interpreter/vanilla/compilers/chain.d.ts +3 -0
  133. package/script/src/interpreter/vanilla/compilers/chain.d.ts.map +1 -0
  134. package/script/src/interpreter/vanilla/compilers/chain.js +24 -0
  135. package/script/src/interpreter/vanilla/compilers/durableworkflow.d.ts +8 -0
  136. package/script/src/interpreter/vanilla/compilers/durableworkflow.d.ts.map +1 -0
  137. package/script/src/interpreter/vanilla/compilers/durableworkflow.js +94 -0
  138. package/script/src/interpreter/vanilla/compilers/fn.d.ts +4 -0
  139. package/script/src/interpreter/vanilla/compilers/fn.d.ts.map +1 -0
  140. package/script/src/interpreter/vanilla/compilers/fn.js +37 -0
  141. package/script/src/interpreter/vanilla/compilers/http.d.ts +4 -0
  142. package/script/src/interpreter/vanilla/compilers/http.d.ts.map +1 -0
  143. package/script/src/interpreter/vanilla/compilers/http.js +57 -0
  144. package/script/src/interpreter/vanilla/compilers/mod.d.ts +2 -0
  145. package/script/src/interpreter/vanilla/compilers/mod.d.ts.map +1 -0
  146. package/script/src/interpreter/vanilla/compilers/mod.js +14 -0
  147. package/script/src/interpreter/vanilla/compilers/parallel.d.ts +4 -0
  148. package/script/src/interpreter/vanilla/compilers/parallel.d.ts.map +1 -0
  149. package/script/src/interpreter/vanilla/compilers/parallel.js +34 -0
  150. package/script/src/interpreter/vanilla/compilers/schedule.d.ts +4 -0
  151. package/script/src/interpreter/vanilla/compilers/schedule.d.ts.map +1 -0
  152. package/script/src/interpreter/vanilla/compilers/schedule.js +79 -0
  153. package/script/src/interpreter/vanilla/compilers/serial.d.ts +4 -0
  154. package/script/src/interpreter/vanilla/compilers/serial.d.ts.map +1 -0
  155. package/script/src/interpreter/vanilla/compilers/serial.js +31 -0
  156. package/script/src/interpreter/vanilla/compilers/types.d.ts +15 -0
  157. package/script/src/interpreter/vanilla/compilers/types.d.ts.map +1 -0
  158. package/script/src/interpreter/vanilla/compilers/types.js +14 -0
  159. package/script/src/interpreter/vanilla/compilers/unpack.d.ts +4 -0
  160. package/script/src/interpreter/vanilla/compilers/unpack.d.ts.map +1 -0
  161. package/script/src/interpreter/vanilla/compilers/unpack.js +37 -0
  162. package/script/src/interpreter/vanilla/compilers/webhook.d.ts +4 -0
  163. package/script/src/interpreter/vanilla/compilers/webhook.d.ts.map +1 -0
  164. package/script/src/interpreter/vanilla/compilers/webhook.js +265 -0
  165. package/script/src/interpreter/vanilla/mod.d.ts +3 -0
  166. package/script/src/interpreter/vanilla/mod.d.ts.map +1 -0
  167. package/script/src/interpreter/vanilla/mod.js +30 -0
  168. package/script/src/issues/Issues.d.ts +1 -18
  169. package/script/src/issues/Issues.d.ts.map +1 -1
@@ -0,0 +1,90 @@
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 { Observable } from 'rxjs';
14
+ import { DurableWorkflowTrigger, } from '../../../dsl/triggers/DurableTrigger.js';
15
+ import { VanillaActivation } from '../ObservableCompiler.js';
16
+ export function compileDurableWorkflow(ctx, trigger, signal) {
17
+ return new Observable((subscriber) => {
18
+ function cleanup() {
19
+ ctx.log.debug('webhook trigger stopped');
20
+ subscriber.complete();
21
+ }
22
+ signal.addEventListener('abort', cleanup, { once: true });
23
+ let consecutiveErrors = 0;
24
+ const maxConsecutiveErrors = 5;
25
+ (async () => {
26
+ while (true) {
27
+ if (signal.aborted) {
28
+ cleanup();
29
+ break;
30
+ }
31
+ if (consecutiveErrors >= maxConsecutiveErrors) {
32
+ ctx.log.error('reached too many consecutive errors stopping trigger', {
33
+ 'triggerId': trigger.id,
34
+ });
35
+ cleanup();
36
+ break;
37
+ }
38
+ try {
39
+ // Right now the API itself will hang for a period of time if no workflows are available.
40
+ // so we don't need to add a delay here.
41
+ const wfs = await ctx.queueProvider.fetchWorkflows({
42
+ group: trigger.id,
43
+ ttl: trigger.options.ttl,
44
+ limit: trigger.options.limit,
45
+ });
46
+ if (!wfs) {
47
+ continue;
48
+ }
49
+ for (const wf of wfs.workflows) {
50
+ if (wf.id &&
51
+ wf.attempt !== undefined &&
52
+ trigger.options.maxAttempts &&
53
+ wf.attempt > trigger.options.maxAttempts) {
54
+ ctx.log.error('Workflow exceeded max attempts failing', {
55
+ workflowId: wf.id,
56
+ attempts: wf.attempt,
57
+ });
58
+ await ctx.queueProvider.complete({
59
+ id: wf.id,
60
+ output: wf.output,
61
+ status: 'failed',
62
+ });
63
+ continue;
64
+ }
65
+ const data = JSON.parse(atob(wf.payload ?? '{}'));
66
+ const activation = VanillaActivation;
67
+ const newContext = ctx.contextProvider.create(data, {
68
+ activation: activation,
69
+ workflowId: wf.id,
70
+ });
71
+ consecutiveErrors = 0;
72
+ subscriber.next(newContext);
73
+ }
74
+ }
75
+ catch (error) {
76
+ ctx.log.error('Error fetching workflows', { error });
77
+ consecutiveErrors++;
78
+ }
79
+ }
80
+ })();
81
+ return () => {
82
+ signal.removeEventListener('abort', cleanup);
83
+ ctx.log.debug('durable workflow cleanup');
84
+ };
85
+ });
86
+ }
87
+ export const durableWorkflowCompiler = {
88
+ ctor: DurableWorkflowTrigger,
89
+ compile: compileDurableWorkflow,
90
+ };
@@ -0,0 +1,4 @@
1
+ import { FnTask } from '../../../dsl/tasks/FnTask.js';
2
+ import { TaskCompiler } from './types.js';
3
+ export declare const fnCompiler: TaskCompiler<any, any, FnTask<any, any>>;
4
+ //# sourceMappingURL=fn.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"fn.d.ts","sourceRoot":"","sources":["../../../../../src/src/interpreter/vanilla/compilers/fn.ts"],"names":[],"mappings":"AAeA,OAAO,EAAE,MAAM,EAAE,MAAM,8BAA8B,CAAC;AAEtD,OAAO,EAA2B,YAAY,EAAE,MAAM,YAAY,CAAC;AAgCnE,eAAO,MAAM,UAAU,EAAE,YAAY,CAAC,GAAG,EAAE,GAAG,EAAE,MAAM,CAAC,GAAG,EAAE,GAAG,CAAC,CAG/D,CAAC"}
@@ -0,0 +1,34 @@
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 { mergeMap, tap } from 'rxjs';
14
+ import { FnTask } from '../../../dsl/tasks/FnTask.js';
15
+ function compileFn(compilerCtx, task) {
16
+ return (src) => src.pipe(tap({
17
+ complete: () => compilerCtx.log.debug('fn.complete'),
18
+ }), mergeMap(async (ctx) => {
19
+ return await compilerCtx.tracer.startActiveSpan(`fn-${task.id}`, async (span) => {
20
+ span.setAttribute('task.id', task.id);
21
+ span.setAttribute('execution.id', ctx.executionId);
22
+ if (typeof ctx.idx === 'number') {
23
+ span.end();
24
+ return ctx.withData(await task._fn(ctx, ctx.idx));
25
+ }
26
+ span.end();
27
+ return ctx.withData(await task._fn(ctx));
28
+ });
29
+ }));
30
+ }
31
+ export const fnCompiler = {
32
+ ctor: FnTask,
33
+ compile: compileFn,
34
+ };
@@ -0,0 +1,4 @@
1
+ import { HttpTaskImpl } from '../../../dsl/tasks/HttpTask.js';
2
+ import { TaskCompiler } from './types.js';
3
+ export declare const httpCompiler: TaskCompiler<any, any, HttpTaskImpl<any, any, any>>;
4
+ //# sourceMappingURL=http.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"http.d.ts","sourceRoot":"","sources":["../../../../../src/src/interpreter/vanilla/compilers/http.ts"],"names":[],"mappings":"AAgBA,OAAO,EAAmB,YAAY,EAAE,MAAM,gCAAgC,CAAC;AAE/E,OAAO,EAA2B,YAAY,EAAE,MAAM,YAAY,CAAC;AAwDnE,eAAO,MAAM,YAAY,EAAE,YAAY,CAAC,GAAG,EAAE,GAAG,EAAE,YAAY,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,CAAC,CAG5E,CAAC"}
@@ -0,0 +1,54 @@
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 { mergeMap } from 'rxjs';
14
+ import { tap } from 'rxjs/operators';
15
+ import { HttpContextImpl, HttpTaskImpl } from '../../../dsl/tasks/HttpTask.js';
16
+ import { VanillaFetchFactory } from '../../../connection/VanillaConnectionFactory.js';
17
+ function compileHttp(compilerCtx, task) {
18
+ const fetchFactory = new VanillaFetchFactory();
19
+ async function http(ctx) {
20
+ const fetch = await fetchFactory.fetcher(ctx);
21
+ const httpContext = new HttpContextImpl(ctx, {}, fetch, 'unavailable with VanillaInterpreter');
22
+ const result = await task.fn(httpContext);
23
+ return ctx.withData(result);
24
+ }
25
+ return (src) => src.pipe(tap({
26
+ complete: () => compilerCtx.log.debug('http.complete'),
27
+ }), mergeMap((ctx) => {
28
+ return compilerCtx.tracer.startActiveSpan(`http-${task.id}`, async (span) => {
29
+ span.setAttribute('task.id', task.id);
30
+ span.setAttribute('task.type', 'http');
31
+ span.setAttribute('execution.id', ctx.executionId);
32
+ span.setAttribute('connection.name', task.opts.connection);
33
+ try {
34
+ return await http(ctx);
35
+ }
36
+ catch (error) {
37
+ if (error instanceof Error) {
38
+ span.recordException(error);
39
+ }
40
+ else {
41
+ span.recordException(new Error(String(error)));
42
+ }
43
+ throw error;
44
+ }
45
+ finally {
46
+ span.end();
47
+ }
48
+ });
49
+ }));
50
+ }
51
+ export const httpCompiler = {
52
+ ctor: HttpTaskImpl,
53
+ compile: compileHttp,
54
+ };
@@ -0,0 +1,2 @@
1
+ export type * from './types.js';
2
+ //# sourceMappingURL=mod.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"mod.d.ts","sourceRoot":"","sources":["../../../../../src/src/interpreter/vanilla/compilers/mod.ts"],"names":[],"mappings":"AAaA,mBAAmB,YAAY,CAAC"}
@@ -0,0 +1,13 @@
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 {};
@@ -0,0 +1,4 @@
1
+ import { ParallelTask } from '../../../dsl/tasks/ParallelTask.js';
2
+ import { TaskCompiler } from './types.js';
3
+ export declare const parallelCompiler: TaskCompiler<any, any, ParallelTask<any, any, any, any>>;
4
+ //# sourceMappingURL=parallel.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"parallel.d.ts","sourceRoot":"","sources":["../../../../../src/src/interpreter/vanilla/compilers/parallel.ts"],"names":[],"mappings":"AAcA,OAAO,EAAE,YAAY,EAAE,MAAM,oCAAoC,CAAC;AAElE,OAAO,EAA2B,YAAY,EAAE,MAAM,YAAY,CAAC;AAsCnE,eAAO,MAAM,gBAAgB,EAAE,YAAY,CAAC,GAAG,EAAE,GAAG,EAAE,YAAY,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,CAAC,CAGrF,CAAC"}
@@ -0,0 +1,31 @@
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 { from, map, mergeMap, of, toArray } from 'rxjs';
14
+ import { ParallelTask } from '../../../dsl/tasks/ParallelTask.js';
15
+ function compileParallel(ctx, task) {
16
+ const baseOperator = ctx.compiler.compileTask(ctx, task._base);
17
+ const eachOperator = ctx.compiler.compileTask(ctx, task._each);
18
+ return (src) => src.pipe(baseOperator, mergeMap((ctx) => {
19
+ return from(ctx.data).pipe(map((data, idx) => ctx.withData(data).setIndex(idx)),
20
+ // Process items in parallel using mergeMap
21
+ mergeMap((item) => eachOperator(of(item)).pipe(map((result) => result.setIndex(item.idx)))), toArray(), map((results) => {
22
+ // Sort by original index to maintain order
23
+ results.sort((a, b) => a.idx - b.idx);
24
+ return ctx.withData(results.map((r) => r.data));
25
+ }));
26
+ }));
27
+ }
28
+ export const parallelCompiler = {
29
+ ctor: ParallelTask,
30
+ compile: compileParallel,
31
+ };
@@ -0,0 +1,4 @@
1
+ import { ScheduleData, ScheduleTrigger } from '../../../dsl/triggers/ScheduleTrigger.js';
2
+ import { TriggerCompiler } from './types.js';
3
+ export declare const scheduleCompiler: TriggerCompiler<ScheduleData, ScheduleTrigger>;
4
+ //# sourceMappingURL=schedule.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"schedule.d.ts","sourceRoot":"","sources":["../../../../../src/src/interpreter/vanilla/compilers/schedule.ts"],"names":[],"mappings":"AAsBA,OAAO,EAAE,YAAY,EAAE,eAAe,EAAE,MAAM,0CAA0C,CAAC;AAEzF,OAAO,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;AAgF7C,eAAO,MAAM,gBAAgB,EAAE,eAAe,CAAC,YAAY,EAAE,eAAe,CAG3E,CAAC"}
@@ -0,0 +1,76 @@
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 { Observable } from 'rxjs';
14
+ import { envVarEnvId, envVarEnvironmentName, envVarOrgId, envVarProjectId, } from '../../../dsl/http/versori/constants.js';
15
+ import { ScheduleTrigger } from '../../../dsl/triggers/ScheduleTrigger.js';
16
+ import { VanillaActivation } from '../ObservableCompiler.js';
17
+ function compileSchedule(ctx, trigger, signal) {
18
+ return new Observable((subscriber) => {
19
+ // Add HTTP endpoint for manual triggering
20
+ if (!ctx.cronRouter) {
21
+ throw new Error('Router not available in compiler context');
22
+ }
23
+ const projectId = Deno.env.get(envVarProjectId) || 'example-service';
24
+ const environmentId = Deno.env.get(envVarEnvId) || 'example-environment';
25
+ const environmentName = Deno.env.get(envVarEnvironmentName) || 'example-environment';
26
+ const orgId = Deno.env.get(envVarOrgId) || 'example-org';
27
+ ctx.cronRegistry.set(trigger.id, trigger.schedule);
28
+ async function handleSchedule(_req, res, span) {
29
+ try {
30
+ const executionCtx = ctx.contextProvider.create(VanillaActivation, {});
31
+ span.setAttribute('execution.id', executionCtx.executionId);
32
+ try {
33
+ subscriber.next(executionCtx);
34
+ }
35
+ catch (error) {
36
+ executionCtx.log.error('execution error inside schedule', { error });
37
+ }
38
+ res.status(200).json({
39
+ status: 'triggered',
40
+ executionId: executionCtx.executionId,
41
+ });
42
+ return;
43
+ }
44
+ catch (error) {
45
+ ctx.log.error('execution error inside schedule', { error });
46
+ res.status(500).json({ error: 'Failed to trigger schedule' });
47
+ }
48
+ }
49
+ ctx.cronRouter.post(`/cron/${trigger.id}`, async (req, res) => {
50
+ await ctx.tracer.startActiveSpan(`schedule-${trigger.id}`, async (span) => {
51
+ span.setAttribute('task.id', trigger.id);
52
+ span.setAttribute('task.type', 'schedule');
53
+ span.setAttribute('schedule', trigger.schedule);
54
+ span.setAttribute('project.id', projectId);
55
+ span.setAttribute('environment.id', environmentId);
56
+ span.setAttribute('environment.name', environmentName);
57
+ span.setAttribute('org.id', orgId);
58
+ await handleSchedule(req, res, span);
59
+ span.end();
60
+ });
61
+ });
62
+ function cleanup() {
63
+ ctx.log.debug('scheduler trigger stopped');
64
+ subscriber.complete();
65
+ }
66
+ signal.addEventListener('abort', cleanup, { once: true });
67
+ return () => {
68
+ signal.removeEventListener('abort', cleanup);
69
+ ctx.log.debug('scheduler execution unsubscribed');
70
+ };
71
+ });
72
+ }
73
+ export const scheduleCompiler = {
74
+ ctor: ScheduleTrigger,
75
+ compile: compileSchedule,
76
+ };
@@ -0,0 +1,4 @@
1
+ import { SerialTask } from '../../../dsl/tasks/SerialTask.js';
2
+ import { TaskCompiler } from './types.js';
3
+ export declare const serialCompiler: TaskCompiler<any, any, SerialTask<any, any, any, any>>;
4
+ //# sourceMappingURL=serial.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"serial.d.ts","sourceRoot":"","sources":["../../../../../src/src/interpreter/vanilla/compilers/serial.ts"],"names":[],"mappings":"AAcA,OAAO,EAAE,UAAU,EAAE,MAAM,kCAAkC,CAAC;AAE9D,OAAO,EAA2B,YAAY,EAAE,MAAM,YAAY,CAAC;AA6BnE,eAAO,MAAM,cAAc,EAAE,YAAY,CAAC,GAAG,EAAE,GAAG,EAAE,UAAU,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,CAAC,CAGjF,CAAC"}
@@ -0,0 +1,28 @@
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 { concat, map, mergeMap, of, tap, toArray } from 'rxjs';
14
+ import { SerialTask } from '../../../dsl/tasks/SerialTask.js';
15
+ function compileSerial(ctx, task) {
16
+ const baseOperator = ctx.compiler.compileTask(ctx, task._base);
17
+ const eachOperator = ctx.compiler.compileTask(ctx, task._each);
18
+ return (src) => src.pipe(tap({
19
+ complete: () => ctx.log.debug('serial.complete'),
20
+ }), baseOperator, mergeMap((ctx) => {
21
+ const tasks = ctx.data.map((d, idx) => eachOperator(of(ctx.withData(d).setIndex(idx))));
22
+ return concat(...tasks).pipe(map((result) => result.data), toArray(), map((results) => ctx.withData(results)));
23
+ }));
24
+ }
25
+ export const serialCompiler = {
26
+ ctor: SerialTask,
27
+ compile: compileSerial,
28
+ };
@@ -0,0 +1,15 @@
1
+ import { Observable, OperatorFunction } from 'rxjs';
2
+ import { Task } from '../../../dsl/Task.js';
3
+ import { Trigger } from '../../../dsl/Trigger.js';
4
+ import { VanillaCompilerContext } from '../ObservableCompiler.js';
5
+ import { VanillaContext } from '../../../context/VanillaContext.js';
6
+ export interface TaskCompiler<In, Out, T extends Task<In, Out>> {
7
+ ctor: new (...args: any[]) => T;
8
+ compile: <Index = void>(ctx: VanillaCompilerContext, task: T) => ContextOperatorFunction<In, Out, Index>;
9
+ }
10
+ export interface TriggerCompiler<Out, T extends Trigger<Out>> {
11
+ compile: (ctx: VanillaCompilerContext, trigger: T, signal: AbortSignal) => Observable<VanillaContext<Out, void>>;
12
+ ctor: new (...args: any[]) => T;
13
+ }
14
+ export type ContextOperatorFunction<In, Out, Index = void> = OperatorFunction<VanillaContext<In, Index>, VanillaContext<Out, Index>>;
15
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../../src/src/interpreter/vanilla/compilers/types.ts"],"names":[],"mappings":"AAaA,OAAO,EAAE,UAAU,EAAE,gBAAgB,EAAE,MAAM,MAAM,CAAC;AACpD,OAAO,EAAE,IAAI,EAAE,MAAM,sBAAsB,CAAC;AAC5C,OAAO,EAAE,OAAO,EAAE,MAAM,yBAAyB,CAAC;AAClD,OAAO,EAAE,sBAAsB,EAAE,MAAM,0BAA0B,CAAC;AAClE,OAAO,EAAE,cAAc,EAAE,MAAM,oCAAoC,CAAC;AAEpE,MAAM,WAAW,YAAY,CAAC,EAAE,EAAE,GAAG,EAAE,CAAC,SAAS,IAAI,CAAC,EAAE,EAAE,GAAG,CAAC;IAC1D,IAAI,EAAE,KAAK,GAAG,IAAI,EAAE,GAAG,EAAE,KAAK,CAAC,CAAC;IAChC,OAAO,EAAE,CAAC,KAAK,GAAG,IAAI,EAClB,GAAG,EAAE,sBAAsB,EAC3B,IAAI,EAAE,CAAC,KACN,uBAAuB,CAAC,EAAE,EAAE,GAAG,EAAE,KAAK,CAAC,CAAC;CAChD;AAED,MAAM,WAAW,eAAe,CAAC,GAAG,EAAE,CAAC,SAAS,OAAO,CAAC,GAAG,CAAC;IACxD,OAAO,EAAE,CACL,GAAG,EAAE,sBAAsB,EAC3B,OAAO,EAAE,CAAC,EACV,MAAM,EAAE,WAAW,KAClB,UAAU,CAAC,cAAc,CAAC,GAAG,EAAE,IAAI,CAAC,CAAC,CAAC;IAC3C,IAAI,EAAE,KAAK,GAAG,IAAI,EAAE,GAAG,EAAE,KAAK,CAAC,CAAC;CACnC;AAED,MAAM,MAAM,uBAAuB,CAAC,EAAE,EAAE,GAAG,EAAE,KAAK,GAAG,IAAI,IAAI,gBAAgB,CACzE,cAAc,CAAC,EAAE,EAAE,KAAK,CAAC,EACzB,cAAc,CAAC,GAAG,EAAE,KAAK,CAAC,CAC7B,CAAC"}
@@ -0,0 +1,13 @@
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 {};
@@ -0,0 +1,4 @@
1
+ import { UnpackTask } from '../../../dsl/tasks/UnpackTask.js';
2
+ import { TaskCompiler } from './types.js';
3
+ export declare const unpackCompiler: TaskCompiler<any, any, UnpackTask<any, any, any>>;
4
+ //# sourceMappingURL=unpack.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"unpack.d.ts","sourceRoot":"","sources":["../../../../../src/src/interpreter/vanilla/compilers/unpack.ts"],"names":[],"mappings":"AAcA,OAAO,EAAE,UAAU,EAAE,MAAM,kCAAkC,CAAC;AAE9D,OAAO,EAA2B,YAAY,EAAE,MAAM,YAAY,CAAC;AAgCnE,eAAO,MAAM,cAAc,EAAE,YAAY,CAAC,GAAG,EAAE,GAAG,EAAE,UAAU,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,CAAC,CAG5E,CAAC"}
@@ -0,0 +1,34 @@
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 { map, tap } from 'rxjs';
14
+ import { UnpackTask } from '../../../dsl/tasks/UnpackTask.js';
15
+ function ensureArray(data) {
16
+ if (Array.isArray(data)) {
17
+ return data;
18
+ }
19
+ return [data];
20
+ }
21
+ function compileUnpack(ctx, task) {
22
+ const baseOperator = ctx.compiler.compileTask(ctx, task._base);
23
+ const mapper = task._mapper;
24
+ return (src) => src.pipe(tap({
25
+ complete: () => ctx.log.debug('unpack.complete'),
26
+ }), baseOperator, map((ctx) => {
27
+ const result = mapper?.(ctx.data) ?? ctx.data;
28
+ return ctx.withData(ensureArray(result));
29
+ }));
30
+ }
31
+ export const unpackCompiler = {
32
+ ctor: UnpackTask,
33
+ compile: compileUnpack,
34
+ };
@@ -0,0 +1,4 @@
1
+ import { WebhookData, WebhookTrigger } from '../../../dsl/triggers/WebhookTrigger.js';
2
+ import { TriggerCompiler } from './types.js';
3
+ export declare const webhookCompiler: TriggerCompiler<WebhookData, WebhookTrigger>;
4
+ //# sourceMappingURL=webhook.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"webhook.d.ts","sourceRoot":"","sources":["../../../../../src/src/interpreter/vanilla/compilers/webhook.ts"],"names":[],"mappings":"AAqBA,OAAO,EAAE,WAAW,EAAE,cAAc,EAAE,MAAM,yCAAyC,CAAC;AAEtF,OAAO,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;AAiE7C,eAAO,MAAM,eAAe,EAAE,eAAe,CAAC,WAAW,EAAE,cAAc,CAgRxE,CAAC"}