@versori/run 0.3.0-veta.2 → 0.4.0-alpha.1

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 (209) hide show
  1. package/esm/src/connection/DirectConnectionFactory.d.ts +1 -1
  2. package/esm/src/connection/DirectConnectionFactory.d.ts.map +1 -1
  3. package/esm/src/connection/DirectConnectionFactory.js +6 -9
  4. package/esm/src/connection/StaticFetchFactory.d.ts.map +1 -1
  5. package/esm/src/connection/internal/CredentialHolder.d.ts.map +1 -1
  6. package/esm/src/connection/internal/CredentialHolder.js +11 -2
  7. package/esm/src/connection/internal/FetchBuilder.d.ts +3 -2
  8. package/esm/src/connection/internal/FetchBuilder.d.ts.map +1 -1
  9. package/esm/src/connection/internal/FetchBuilder.js +103 -4
  10. package/esm/src/connection/internal/OutboundConnectionFactory.d.ts +1 -1
  11. package/esm/src/connection/internal/OutboundConnectionFactory.d.ts.map +1 -1
  12. package/esm/src/connection/internal/OutboundConnectionFactory.js +2 -3
  13. package/esm/src/context/AsyncWorkflow.js +1 -1
  14. package/esm/src/context/Context.d.ts +7 -6
  15. package/esm/src/context/Context.d.ts.map +1 -1
  16. package/esm/src/context/Context.js +3 -13
  17. package/esm/src/context/ContextProvider.d.ts +1 -3
  18. package/esm/src/context/ContextProvider.d.ts.map +1 -1
  19. package/esm/src/context/ContextProvider.js +3 -6
  20. package/esm/src/dsl/Workflow.d.ts.map +1 -1
  21. package/esm/src/dsl/Workflow.js +2 -0
  22. package/esm/src/dsl/http/versori/configloader.js +1 -1
  23. package/esm/src/dsl/http/versori/cronapi.d.ts +2 -3
  24. package/esm/src/dsl/http/versori/cronapi.d.ts.map +1 -1
  25. package/esm/src/dsl/http/versori/cronapi.js +14 -14
  26. package/esm/src/dsl/http/versori/kvapi/core/OpenAPI.js +1 -1
  27. package/esm/src/dsl/http/versori/webhookmiddleware.d.ts +1 -1
  28. package/esm/src/dsl/http/versori/webhookmiddleware.d.ts.map +1 -1
  29. package/esm/src/dsl/http/versori/webhookmiddleware.js +24 -19
  30. package/esm/src/dsl/tasks/HttpTask.d.ts +1 -2
  31. package/esm/src/dsl/tasks/HttpTask.d.ts.map +1 -1
  32. package/esm/src/dsl/tasks/HttpTask.js +0 -3
  33. package/esm/src/dsl/triggers/DurableTrigger.d.ts +1 -0
  34. package/esm/src/dsl/triggers/DurableTrigger.d.ts.map +1 -1
  35. package/esm/src/dsl/triggers/WebhookTrigger.d.ts.map +1 -1
  36. package/esm/src/dsl/triggers/WebhookTrigger.js +3 -1
  37. package/esm/src/internal/constants.d.ts +3 -1
  38. package/esm/src/internal/constants.d.ts.map +1 -1
  39. package/esm/src/internal/constants.js +4 -1
  40. package/esm/src/internal/supervisor.d.ts +21 -0
  41. package/esm/src/internal/supervisor.d.ts.map +1 -0
  42. package/esm/src/internal/supervisor.js +113 -0
  43. package/esm/src/interpreter/durable/DurableInterpreter.d.ts +8 -2
  44. package/esm/src/interpreter/durable/DurableInterpreter.d.ts.map +1 -1
  45. package/esm/src/interpreter/durable/DurableInterpreter.js +62 -22
  46. package/esm/src/interpreter/durable/ObservableCompiler.d.ts +6 -1
  47. package/esm/src/interpreter/durable/ObservableCompiler.d.ts.map +1 -1
  48. package/esm/src/interpreter/durable/Queue.d.ts +16 -24
  49. package/esm/src/interpreter/durable/Queue.d.ts.map +1 -1
  50. package/esm/src/interpreter/durable/Queue.js +5 -4
  51. package/esm/src/interpreter/durable/compilers/catch.d.ts.map +1 -1
  52. package/esm/src/interpreter/durable/compilers/catch.js +3 -2
  53. package/esm/src/interpreter/durable/compilers/durableworkflow.d.ts.map +1 -1
  54. package/esm/src/interpreter/durable/compilers/durableworkflow.js +19 -19
  55. package/esm/src/interpreter/durable/compilers/fn.d.ts.map +1 -1
  56. package/esm/src/interpreter/durable/compilers/fn.js +17 -4
  57. package/esm/src/interpreter/durable/compilers/http.d.ts.map +1 -1
  58. package/esm/src/interpreter/durable/compilers/http.js +8 -2
  59. package/esm/src/interpreter/durable/compilers/schedule.d.ts.map +1 -1
  60. package/esm/src/interpreter/durable/compilers/schedule.js +2 -1
  61. package/esm/src/interpreter/durable/compilers/webhook.d.ts.map +1 -1
  62. package/esm/src/interpreter/durable/compilers/webhook.js +4 -1
  63. package/esm/src/interpreter/memory/MemoryInterpreter.d.ts +8 -2
  64. package/esm/src/interpreter/memory/MemoryInterpreter.d.ts.map +1 -1
  65. package/esm/src/interpreter/memory/MemoryInterpreter.js +46 -18
  66. package/esm/src/interpreter/memory/ObservableCompiler.d.ts +6 -1
  67. package/esm/src/interpreter/memory/ObservableCompiler.d.ts.map +1 -1
  68. package/esm/src/interpreter/memory/compilers/catch.d.ts.map +1 -1
  69. package/esm/src/interpreter/memory/compilers/catch.js +3 -2
  70. package/esm/src/interpreter/memory/compilers/fn.d.ts.map +1 -1
  71. package/esm/src/interpreter/memory/compilers/fn.js +17 -4
  72. package/esm/src/interpreter/memory/compilers/http.d.ts.map +1 -1
  73. package/esm/src/interpreter/memory/compilers/http.js +33 -3
  74. package/esm/src/interpreter/memory/compilers/schedule.d.ts.map +1 -1
  75. package/esm/src/interpreter/memory/compilers/schedule.js +2 -1
  76. package/esm/src/interpreter/memory/compilers/webhook.d.ts.map +1 -1
  77. package/esm/src/interpreter/memory/compilers/webhook.js +5 -1
  78. package/esm/src/issues/Issues.js +1 -1
  79. package/esm/src/kv/sdk/SDKKeyValue.d.ts.map +1 -1
  80. package/esm/src/kv/sdk/SDKKeyValue.js +3 -9
  81. package/esm/src/services/createConnectRpcClient.d.ts +16 -0
  82. package/esm/src/services/createConnectRpcClient.d.ts.map +1 -0
  83. package/esm/src/services/createConnectRpcClient.js +63 -0
  84. package/package.json +4 -1
  85. package/script/src/connection/DirectConnectionFactory.d.ts +1 -1
  86. package/script/src/connection/DirectConnectionFactory.d.ts.map +1 -1
  87. package/script/src/connection/DirectConnectionFactory.js +5 -8
  88. package/script/src/connection/StaticFetchFactory.d.ts.map +1 -1
  89. package/script/src/connection/internal/CredentialHolder.d.ts.map +1 -1
  90. package/script/src/connection/internal/CredentialHolder.js +11 -2
  91. package/script/src/connection/internal/FetchBuilder.d.ts +3 -2
  92. package/script/src/connection/internal/FetchBuilder.d.ts.map +1 -1
  93. package/script/src/connection/internal/FetchBuilder.js +126 -4
  94. package/script/src/connection/internal/OutboundConnectionFactory.d.ts +1 -1
  95. package/script/src/connection/internal/OutboundConnectionFactory.d.ts.map +1 -1
  96. package/script/src/connection/internal/OutboundConnectionFactory.js +2 -3
  97. package/script/src/context/AsyncWorkflow.js +1 -1
  98. package/script/src/context/Context.d.ts +7 -6
  99. package/script/src/context/Context.d.ts.map +1 -1
  100. package/script/src/context/Context.js +3 -13
  101. package/script/src/context/ContextProvider.d.ts +1 -3
  102. package/script/src/context/ContextProvider.d.ts.map +1 -1
  103. package/script/src/context/ContextProvider.js +3 -6
  104. package/script/src/dsl/Workflow.d.ts.map +1 -1
  105. package/script/src/dsl/Workflow.js +2 -0
  106. package/script/src/dsl/http/versori/configloader.js +1 -1
  107. package/script/src/dsl/http/versori/cronapi.d.ts +2 -3
  108. package/script/src/dsl/http/versori/cronapi.d.ts.map +1 -1
  109. package/script/src/dsl/http/versori/cronapi.js +14 -14
  110. package/script/src/dsl/http/versori/kvapi/core/OpenAPI.js +1 -1
  111. package/script/src/dsl/http/versori/webhookmiddleware.d.ts +1 -1
  112. package/script/src/dsl/http/versori/webhookmiddleware.d.ts.map +1 -1
  113. package/script/src/dsl/http/versori/webhookmiddleware.js +24 -19
  114. package/script/src/dsl/tasks/HttpTask.d.ts +1 -2
  115. package/script/src/dsl/tasks/HttpTask.d.ts.map +1 -1
  116. package/script/src/dsl/tasks/HttpTask.js +0 -3
  117. package/script/src/dsl/triggers/DurableTrigger.d.ts +1 -0
  118. package/script/src/dsl/triggers/DurableTrigger.d.ts.map +1 -1
  119. package/script/src/dsl/triggers/WebhookTrigger.d.ts.map +1 -1
  120. package/script/src/dsl/triggers/WebhookTrigger.js +3 -1
  121. package/script/src/internal/constants.d.ts +3 -1
  122. package/script/src/internal/constants.d.ts.map +1 -1
  123. package/script/src/internal/constants.js +5 -2
  124. package/script/src/internal/supervisor.d.ts +21 -0
  125. package/script/src/internal/supervisor.d.ts.map +1 -0
  126. package/script/src/internal/supervisor.js +120 -0
  127. package/script/src/interpreter/durable/DurableInterpreter.d.ts +8 -2
  128. package/script/src/interpreter/durable/DurableInterpreter.d.ts.map +1 -1
  129. package/script/src/interpreter/durable/DurableInterpreter.js +62 -22
  130. package/script/src/interpreter/durable/ObservableCompiler.d.ts +6 -1
  131. package/script/src/interpreter/durable/ObservableCompiler.d.ts.map +1 -1
  132. package/script/src/interpreter/durable/Queue.d.ts +16 -24
  133. package/script/src/interpreter/durable/Queue.d.ts.map +1 -1
  134. package/script/src/interpreter/durable/Queue.js +5 -4
  135. package/script/src/interpreter/durable/compilers/catch.d.ts.map +1 -1
  136. package/script/src/interpreter/durable/compilers/catch.js +3 -2
  137. package/script/src/interpreter/durable/compilers/durableworkflow.d.ts.map +1 -1
  138. package/script/src/interpreter/durable/compilers/durableworkflow.js +19 -19
  139. package/script/src/interpreter/durable/compilers/fn.d.ts.map +1 -1
  140. package/script/src/interpreter/durable/compilers/fn.js +17 -4
  141. package/script/src/interpreter/durable/compilers/http.d.ts.map +1 -1
  142. package/script/src/interpreter/durable/compilers/http.js +8 -2
  143. package/script/src/interpreter/durable/compilers/schedule.d.ts.map +1 -1
  144. package/script/src/interpreter/durable/compilers/schedule.js +2 -1
  145. package/script/src/interpreter/durable/compilers/webhook.d.ts.map +1 -1
  146. package/script/src/interpreter/durable/compilers/webhook.js +4 -1
  147. package/script/src/interpreter/memory/MemoryInterpreter.d.ts +8 -2
  148. package/script/src/interpreter/memory/MemoryInterpreter.d.ts.map +1 -1
  149. package/script/src/interpreter/memory/MemoryInterpreter.js +46 -18
  150. package/script/src/interpreter/memory/ObservableCompiler.d.ts +6 -1
  151. package/script/src/interpreter/memory/ObservableCompiler.d.ts.map +1 -1
  152. package/script/src/interpreter/memory/compilers/catch.d.ts.map +1 -1
  153. package/script/src/interpreter/memory/compilers/catch.js +3 -2
  154. package/script/src/interpreter/memory/compilers/fn.d.ts.map +1 -1
  155. package/script/src/interpreter/memory/compilers/fn.js +17 -4
  156. package/script/src/interpreter/memory/compilers/http.d.ts.map +1 -1
  157. package/script/src/interpreter/memory/compilers/http.js +33 -3
  158. package/script/src/interpreter/memory/compilers/schedule.d.ts.map +1 -1
  159. package/script/src/interpreter/memory/compilers/schedule.js +2 -1
  160. package/script/src/interpreter/memory/compilers/webhook.d.ts.map +1 -1
  161. package/script/src/interpreter/memory/compilers/webhook.js +5 -1
  162. package/script/src/issues/Issues.js +1 -1
  163. package/script/src/kv/sdk/SDKKeyValue.d.ts.map +1 -1
  164. package/script/src/kv/sdk/SDKKeyValue.js +3 -9
  165. package/script/src/services/createConnectRpcClient.d.ts +16 -0
  166. package/script/src/services/createConnectRpcClient.d.ts.map +1 -0
  167. package/script/src/services/createConnectRpcClient.js +66 -0
  168. package/esm/src/context/WorkflowClient.d.ts +0 -29
  169. package/esm/src/context/WorkflowClient.d.ts.map +0 -1
  170. package/esm/src/context/WorkflowClient.js +0 -95
  171. package/esm/src/dsl/http/versori/activation.d.ts +0 -13
  172. package/esm/src/dsl/http/versori/activation.d.ts.map +0 -1
  173. package/esm/src/dsl/http/versori/activation.js +0 -65
  174. package/esm/src/dsl/http/versori/cli.d.ts +0 -2
  175. package/esm/src/dsl/http/versori/cli.d.ts.map +0 -1
  176. package/esm/src/dsl/http/versori/cli.js +0 -20
  177. package/esm/src/dsl/http/versori/constants.d.ts +0 -20
  178. package/esm/src/dsl/http/versori/constants.d.ts.map +0 -1
  179. package/esm/src/dsl/http/versori/constants.js +0 -25
  180. package/esm/src/dsl/http/versori/internalauth.d.ts +0 -15
  181. package/esm/src/dsl/http/versori/internalauth.d.ts.map +0 -1
  182. package/esm/src/dsl/http/versori/internalauth.js +0 -90
  183. package/esm/src/dsl/http/versori/platformapi.d.ts +0 -19
  184. package/esm/src/dsl/http/versori/platformapi.d.ts.map +0 -1
  185. package/esm/src/dsl/http/versori/platformapi.js +0 -148
  186. package/esm/src/dsl/http/versori/proxyroundtripper.d.ts +0 -23
  187. package/esm/src/dsl/http/versori/proxyroundtripper.d.ts.map +0 -1
  188. package/esm/src/dsl/http/versori/proxyroundtripper.js +0 -196
  189. package/script/src/context/WorkflowClient.d.ts +0 -29
  190. package/script/src/context/WorkflowClient.d.ts.map +0 -1
  191. package/script/src/context/WorkflowClient.js +0 -99
  192. package/script/src/dsl/http/versori/activation.d.ts +0 -13
  193. package/script/src/dsl/http/versori/activation.d.ts.map +0 -1
  194. package/script/src/dsl/http/versori/activation.js +0 -69
  195. package/script/src/dsl/http/versori/cli.d.ts +0 -2
  196. package/script/src/dsl/http/versori/cli.d.ts.map +0 -1
  197. package/script/src/dsl/http/versori/cli.js +0 -23
  198. package/script/src/dsl/http/versori/constants.d.ts +0 -20
  199. package/script/src/dsl/http/versori/constants.d.ts.map +0 -1
  200. package/script/src/dsl/http/versori/constants.js +0 -28
  201. package/script/src/dsl/http/versori/internalauth.d.ts +0 -15
  202. package/script/src/dsl/http/versori/internalauth.d.ts.map +0 -1
  203. package/script/src/dsl/http/versori/internalauth.js +0 -94
  204. package/script/src/dsl/http/versori/platformapi.d.ts +0 -19
  205. package/script/src/dsl/http/versori/platformapi.d.ts.map +0 -1
  206. package/script/src/dsl/http/versori/platformapi.js +0 -152
  207. package/script/src/dsl/http/versori/proxyroundtripper.d.ts +0 -23
  208. package/script/src/dsl/http/versori/proxyroundtripper.d.ts.map +0 -1
  209. package/script/src/dsl/http/versori/proxyroundtripper.js +0 -200
@@ -1,7 +1,7 @@
1
1
  import { Client } from '@connectrpc/connect';
2
2
  import { RequestHandler } from 'express';
3
3
  import { Logger } from '../observability/mod.js';
4
- import { credentialv1alpha1, tokensv1, oauth1v1 } from '../services/credentials/mod.js';
4
+ import { credentialv1alpha1, oauth1v1, tokensv1 } from '../services/credentials/mod.js';
5
5
  import { Connection } from '../services/platform/mod.js';
6
6
  import { HttpClientFactory } from './internal/HttpClientFactory.js';
7
7
  import { ConnectionFactory, FetchLike } from './types.js';
@@ -1 +1 @@
1
- {"version":3,"file":"DirectConnectionFactory.d.ts","sourceRoot":"","sources":["../../../src/src/connection/DirectConnectionFactory.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAgB,MAAM,qBAAqB,CAAC;AAE3D,OAAO,EAAE,cAAc,EAAE,MAAM,SAAS,CAAC;AACzC,OAAO,EAAE,MAAM,EAAE,MAAM,yBAAyB,CAAC;AACjD,OAAO,EAAE,kBAAkB,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,gCAAgC,CAAC;AACxF,OAAO,EAAE,UAAU,EAAE,MAAM,6BAA6B,CAAC;AACzD,OAAO,EAAE,iBAAiB,EAAE,MAAM,iCAAiC,CAAC;AAGpE,OAAO,EAAE,iBAAiB,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AAG1D;;;;;;;GAOG;AACH,qBAAa,uBAAwB,YAAW,iBAAiB;IAKzD,OAAO,CAAC,QAAQ,CAAC,iBAAiB;IAClC,OAAO,CAAC,QAAQ,CAAC,WAAW;IAC5B,OAAO,CAAC,QAAQ,CAAC,MAAM;IACvB,OAAO,CAAC,QAAQ,CAAC,MAAM;IACvB,OAAO,CAAC,QAAQ,CAAC,MAAM;IAR3B,OAAO,CAAC,QAAQ,CAAC,yBAAyB,CAA4B;IACtE,OAAO,CAAC,QAAQ,CAAC,+BAA+B,CAA2B;gBAGtD,iBAAiB,EAAE,iBAAiB,EACpC,WAAW,EAAE,MAAM,CAAC,OAAO,kBAAkB,CAAC,iBAAiB,CAAC,EAChE,MAAM,EAAE,MAAM,CAAC,OAAO,QAAQ,CAAC,YAAY,CAAC,EAC5C,MAAM,EAAE,MAAM,CAAC,OAAO,QAAQ,CAAC,oBAAoB,CAAC,EACpD,MAAM,EAAE,MAAM;IAkBnC,OAAO,CAAC,GAAG,EAAE,UAAU,GAAG,OAAO,CAAC,SAAS,C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kBnC,OAAO,CAAC,GAAG,EAAE,UAAU,GAAG,OAAO,CAAC,SAAS,CAAC;IAI5C,OAAO,CAAC,GAAG,EAAE,UAAU,GAAG,OAAO,CAAC,cAAc,CAAC;IAIjD,MAAM,CAAC,OAAO,CAAC,MAAM,EAAE,MAAM,GAAG,uBAAuB;CAiB1D"}
@@ -1,10 +1,10 @@
1
- import { createClient } from '@connectrpc/connect';
2
1
  import { createGrpcTransport } from '@connectrpc/connect-node';
3
- import { credentialv1alpha1, tokensv1, oauth1v1 } from '../services/credentials/mod.js';
2
+ import { envVarCredsBaseURL } from '../internal/constants.js';
3
+ import { createConnectRpcClient } from '../services/createConnectRpcClient.js';
4
+ import { credentialv1alpha1, oauth1v1, tokensv1 } from '../services/credentials/mod.js';
4
5
  import { HttpClientFactory } from './internal/HttpClientFactory.js';
5
6
  import { ExpressInboundConnectionFactory as InboundConnectionFactory } from './internal/InboundConnectionFactory.js';
6
7
  import { OutboundConnectionFactory } from './internal/OutboundConnectionFactory.js';
7
- import { envVarCredsBaseURL } from '../internal/constants.js';
8
8
  /**
9
9
  * DirectConnectionFactory is used by actual {@link FetchFactory} and {@link ExpressHandlers} implementations to build a
10
10
  * fetchers and handlers for a given connection.
@@ -70,12 +70,9 @@ export class DirectConnectionFactory {
70
70
  }
71
71
  static fromEnv(logger) {
72
72
  const baseUrl = Deno.env.get(envVarCredsBaseURL) || 'http://localhost:9000';
73
- const transport = createGrpcTransport({
74
- baseUrl,
75
- });
76
- const credentials = createClient(credentialv1alpha1.CredentialService, transport);
77
- const tokens = createClient(tokensv1.TokenService, transport);
78
- const oauth1 = createClient(oauth1v1.AuthorizationService, transport);
73
+ const credentials = createConnectRpcClient(credentialv1alpha1.CredentialService, () => { return createGrpcTransport({ baseUrl }); });
74
+ const tokens = createConnectRpcClient(tokensv1.TokenService, () => { return createGrpcTransport({ baseUrl }); });
75
+ const oauth1 = createConnectRpcClient(oauth1v1.AuthorizationService, () => { return createGrpcTransport({ baseUrl }); });
79
76
  const httpClientFactory = new HttpClientFactory();
80
77
  return new DirectConnectionFactory(httpClientFactory, credentials, tokens, oauth1, logger);
81
78
  }
@@ -1 +1 @@
1
- {"version":3,"file":"StaticFetchFactory.d.ts","sourceRoot":"","sources":["../../../src/src/connection/StaticFetchFactory.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAmC,cAAc,EAAE,MAAM,SAAS,CAAC;AAC/E,OAAO,EAAE,OAAO,EAAE,MAAM,uBAAuB,CAAC;AAChD,OAAO,EAAE,SAAS,EAAE,wBAAwB,EAAE,MAAM,YAAY,CAAC;AAMjE,qBAAa,kBAAmB,YAAW,wBAAwB;;gBAKnD,KAAK,EAAE,SAAS,EAAE,OAAO,GAAE,MAAW,EAAE,OAAO,CAAC,EAAE,cAAc;IAM5E,OAAO,CAAC,IAAI,EAAE,OAAO,CAAC,OAAO,CAAC,GAAG,OAAO,CAAC,SAAS,CAAC;IAInD,OAAO,CAAC,IAAI,EAAE,OAAO,CAAC,OAAO,CAAC,GAAG,OAAO,CAAC,MAAM,CAAC;IAIhD,OAAO,CAAC,IAAI,EAAE,OAAO,CAAC,OAAO,CAAC,GAAG,OAAO,CAAC,cAAc,CAAC;CAG3D"}
1
+ {"version":3,"file":"StaticFetchFactory.d.ts","sourceRoot":"","sources":["../../../src/src/connection/StaticFetchFactory.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAyB,cAAc,EAAY,MAAM,SAAS,CAAC;AAC/E,OAAO,EAAE,OAAO,EAAE,MAAM,uBAAuB,CAAC;AAChD,OAAO,EAAE,SAAS,EAAE,wBAAwB,EAAE,MAAM,YAAY,CAAC;AAMjE,qBAAa,kBAAmB,YAAW,wBAAwB;;gBAKnD,KAAK,EAAE,SAAS,EAAE,OAAO,GAAE,MAAW,EAAE,OAAO,CAAC,EAAE,cAAc;IAM5E,OAAO,CAAC,IAAI,EAAE,OAAO,CAAC,OAAO,CAAC,GAAG,OAAO,CAAC,SAAS,CAAC;IAInD,OAAO,CAAC,IAAI,EAAE,OAAO,CAAC,OAAO,CAAC,GAAG,OAAO,CAAC,MAAM,CAAC;IAIhD,OAAO,CAAC,IAAI,EAAE,OAAO,CAAC,OAAO,CAAC,GAAG,OAAO,CAAC,cAAc,CAAC;CAG3D"}
@@ -1 +1 @@
1
- {"version":3,"file":"CredentialHolder.d.ts","sourceRoot":"","sources":["../../../../src/src/connection/internal/CredentialHolder.ts"],"names":[],"mappings":"AAAA,wBAAgB,WAAW,IAAI,OAAO,CAErC;AAED;;GAEG;AACH,qBAAa,gBAAgB,CAAC,CAAC;;gBAOf,YAAY,EAAE,CAAC,EAAE,OAAO,EAAE,CAAC,CAAC,EAAE,CAAC,KAAK,OAAO,EAAE,OAAO,EAAE,MAAM,OAAO,CAAC,CAAC,GAAG,SAAS,CAAC;IAMxF,GAAG,CAAC,OAAO,GAAE,OAAe,GAAG,OAAO,CAAC,CAAC,CAAC;IAkB/C,OAAO,IAAI,IAAI;CAgClB"}
1
+ {"version":3,"file":"CredentialHolder.d.ts","sourceRoot":"","sources":["../../../../src/src/connection/internal/CredentialHolder.ts"],"names":[],"mappings":"AAEA,wBAAgB,WAAW,IAAI,OAAO,CAErC;AAED;;GAEG;AACH,qBAAa,gBAAgB,CAAC,CAAC;;gBAOf,YAAY,EAAE,CAAC,EAAE,OAAO,EAAE,CAAC,CAAC,EAAE,CAAC,KAAK,OAAO,EAAE,OAAO,EAAE,MAAM,OAAO,CAAC,CAAC,GAAG,SAAS,CAAC;IAMxF,GAAG,CAAC,OAAO,GAAE,OAAe,GAAG,OAAO,CAAC,CAAC,CAAC;IA0B/C,OAAO,IAAI,IAAI;CAgClB"}
@@ -31,8 +31,17 @@ export class CredentialHolder {
31
31
  this.refresh();
32
32
  return __classPrivateFieldGet(this, _CredentialHolder_value, "f");
33
33
  }
34
- const value = await __classPrivateFieldGet(this, _CredentialHolder_value, "f");
35
- if (!__classPrivateFieldGet(this, _CredentialHolder_isValid, "f").call(this, value)) {
34
+ // if this.refresh returns a rejected promise we are stuck with it until a restart.
35
+ // the try/catch bellow just keeps on trying to refresh the token if this.#value is rejected.
36
+ //
37
+ // We might have to change this because if credentials has an issue we might just make that issue worse by pamming more requests
38
+ try {
39
+ const value = await __classPrivateFieldGet(this, _CredentialHolder_value, "f");
40
+ if (!__classPrivateFieldGet(this, _CredentialHolder_isValid, "f").call(this, value)) {
41
+ this.refresh();
42
+ }
43
+ }
44
+ catch {
36
45
  this.refresh();
37
46
  }
38
47
  // must return this.#value and not value, since calling `this.refresh()` above will replace
@@ -1,5 +1,5 @@
1
- import { OutboundMiddleware, FetchLike } from '../types.js';
2
1
  import { Connection } from '../../services/platform/mod.js';
2
+ import { FetchLike, OutboundMiddleware } from '../types.js';
3
3
  /**
4
4
  * FetchBuilder is used to build a fetch function which can be composed by multiple middlewares for
5
5
  * modifying the request/response and makes the implementation of {@link ConnectionFetchFactory}
@@ -8,8 +8,9 @@ import { Connection } from '../../services/platform/mod.js';
8
8
  export declare class FetchBuilder {
9
9
  #private;
10
10
  middlewares: OutboundMiddleware[];
11
- constructor(fetch: FetchLike, cnx: Connection);
11
+ constructor(fetch: FetchLike, cnx?: Connection);
12
12
  use(fn: OutboundMiddleware): void;
13
13
  build(): FetchLike;
14
+ private wrapWithTracing;
14
15
  }
15
16
  //# sourceMappingURL=FetchBuilder.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"FetchBuilder.d.ts","sourceRoot":"","sources":["../../../../src/src/connection/internal/FetchBuilder.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAC5D,OAAO,EAAE,UAAU,EAAE,MAAM,gCAAgC,CAAC;AAI5D;;;;GAIG;AACH,qBAAa,YAAY;;IACrB,WAAW,EAAE,kBAAkB,EAAE,CAAC;gBAKtB,KAAK,EAAE,SAAS,EAAE,GAAG,EAAE,UAAU;IAM7C,GAAG,CAAC,EAAE,EAAE,kBAAkB;IAI1B,KAAK,IAAI,SAAS;CAWrB"}
1
+ {"version":3,"file":"FetchBuilder.d.ts","sourceRoot":"","sources":["../../../../src/src/connection/internal/FetchBuilder.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,UAAU,EAAE,MAAM,gCAAgC,CAAC;AAC5D,OAAO,EAAE,SAAS,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAC;AAG5D;;;;GAIG;AACH,qBAAa,YAAY;;IACrB,WAAW,EAAE,kBAAkB,EAAE,CAAC;gBAMtB,KAAK,EAAE,SAAS,EAAE,GAAG,CAAC,EAAE,UAAU;IAW9C,GAAG,CAAC,EAAE,EAAE,kBAAkB;IAI1B,KAAK,IAAI,SAAS;IAmBlB,OAAO,CAAC,eAAe;CAsE1B"}
@@ -9,8 +9,10 @@ var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (
9
9
  if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
10
10
  return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
11
11
  };
12
- var _FetchBuilder_base, _FetchBuilder_cnx;
12
+ var _FetchBuilder_base, _FetchBuilder_cnx, _FetchBuilder_tracer;
13
+ import opentelemetry, { SpanStatusCode } from '@opentelemetry/api';
13
14
  import { isValidURL } from '../../dsl/http/versori/helpers.js';
15
+ import { mockAPIRequest, enabled as supervisorEnabled } from '../../internal/supervisor.js';
14
16
  /**
15
17
  * FetchBuilder is used to build a fetch function which can be composed by multiple middlewares for
16
18
  * modifying the request/response and makes the implementation of {@link ConnectionFetchFactory}
@@ -26,24 +28,104 @@ export class FetchBuilder {
26
28
  });
27
29
  _FetchBuilder_base.set(this, void 0);
28
30
  _FetchBuilder_cnx.set(this, void 0);
31
+ _FetchBuilder_tracer.set(this, void 0);
29
32
  __classPrivateFieldSet(this, _FetchBuilder_base, fetch, "f");
30
33
  __classPrivateFieldSet(this, _FetchBuilder_cnx, cnx, "f");
31
- this.middlewares = [changeRequestbaseURLMiddleware(cnx)];
34
+ __classPrivateFieldSet(this, _FetchBuilder_tracer, opentelemetry.trace.getTracer('fetch-builder', '1.0.0'), "f");
35
+ if (cnx) {
36
+ this.middlewares = [changeRequestbaseURLMiddleware(cnx)];
37
+ }
38
+ else {
39
+ this.middlewares = [];
40
+ }
32
41
  }
33
42
  use(fn) {
34
43
  this.middlewares.push(fn);
35
44
  }
36
45
  build() {
37
46
  let fetch = __classPrivateFieldGet(this, _FetchBuilder_base, "f");
47
+ if (supervisorEnabled) {
48
+ // create fake fetcher that calls the supervisor to generate a mock reponse
49
+ fetch = (async (info, options) => {
50
+ return await mockAPIRequest(info, __classPrivateFieldGet(this, _FetchBuilder_cnx, "f"), options);
51
+ }).bind(this);
52
+ }
38
53
  for (let i = this.middlewares.length - 1; i >= 0; i--) {
39
54
  // apply middlewares in reverse order so that the actual middleware executes in the
40
55
  // order they were added
41
56
  fetch = this.middlewares[i](fetch);
42
57
  }
43
- return fetch;
58
+ // Wrap the final fetch with OpenTelemetry tracing
59
+ return this.wrapWithTracing(fetch);
60
+ }
61
+ wrapWithTracing(fetch) {
62
+ const connectionId = __classPrivateFieldGet(this, _FetchBuilder_cnx, "f")?.id || '';
63
+ const connectionName = __classPrivateFieldGet(this, _FetchBuilder_cnx, "f")?.name || '';
64
+ return (input, init) => {
65
+ const url = getUrl(input);
66
+ return __classPrivateFieldGet(this, _FetchBuilder_tracer, "f").startActiveSpan(`fetch ${url}`, async (span) => {
67
+ // Set span attributes
68
+ span.setAttribute('http.url', url);
69
+ span.setAttribute('type', 'fetch');
70
+ span.setAttribute('connection.id', connectionId);
71
+ span.setAttribute('connection.name', connectionName);
72
+ if (init?.method) {
73
+ span.setAttribute('http.method', init.method);
74
+ }
75
+ try {
76
+ const response = await fetch(input, init);
77
+ if (supervisorEnabled) {
78
+ // when we are in supervisor mode, we need to store the response body in the span attribute
79
+ // this will be shown the end-user in some Ui in the future
80
+ const body = await response.clone().arrayBuffer();
81
+ // if response is text/* pr json we store the body as a string, otherwise we store it as a base64 string
82
+ const contentType = response.headers.get('Content-Type');
83
+ if (contentType && (contentType.startsWith('text/') || contentType.startsWith('application/json'))) {
84
+ span.setAttribute('response.body', new TextDecoder().decode(body));
85
+ }
86
+ else {
87
+ span.setAttribute('response.body', btoa(String.fromCharCode(...new Uint8Array(body))));
88
+ }
89
+ }
90
+ // Record response status
91
+ span.setAttribute('http.status_code', response.status);
92
+ if (response.status >= 400) {
93
+ span.setStatus({
94
+ code: SpanStatusCode.ERROR,
95
+ message: `HTTP ${response.status}`,
96
+ });
97
+ }
98
+ else {
99
+ span.setStatus({ code: SpanStatusCode.OK });
100
+ }
101
+ return response;
102
+ }
103
+ catch (error) {
104
+ // Record exception
105
+ if (error instanceof Error) {
106
+ span.recordException(error);
107
+ span.setStatus({
108
+ code: SpanStatusCode.ERROR,
109
+ message: error.message,
110
+ });
111
+ }
112
+ else {
113
+ span.recordException(new Error(String(error)));
114
+ span.setStatus({
115
+ code: SpanStatusCode.ERROR,
116
+ message: String(error),
117
+ });
118
+ }
119
+ throw error;
120
+ }
121
+ finally {
122
+ span.end();
123
+ }
124
+ });
125
+ };
44
126
  }
45
127
  }
46
- _FetchBuilder_base = new WeakMap(), _FetchBuilder_cnx = new WeakMap();
128
+ _FetchBuilder_base = new WeakMap(), _FetchBuilder_cnx = new WeakMap(), _FetchBuilder_tracer = new WeakMap();
47
129
  function changeBaseUrl(pathname, conn) {
48
130
  const connBaseURL = conn.baseUrl;
49
131
  // if the connection has no baseUrl set, but the pathname is a valid URL, return it as is
@@ -87,3 +169,20 @@ function changeRequestbaseURLMiddleware(conn) {
87
169
  };
88
170
  };
89
171
  }
172
+ function getUrl(input) {
173
+ // Extract URL for span naming
174
+ let url;
175
+ if (typeof input === 'string') {
176
+ url = input;
177
+ }
178
+ else if (input instanceof URL) {
179
+ url = input.toString();
180
+ }
181
+ else if (input instanceof Request) {
182
+ url = input.url;
183
+ }
184
+ else {
185
+ url = 'unknown';
186
+ }
187
+ return url;
188
+ }
@@ -1,6 +1,6 @@
1
1
  import { Client } from '@connectrpc/connect';
2
2
  import { Logger } from '../../mod.js';
3
- import { credentialv1alpha1, tokensv1, oauth1v1 } from '../../services/credentials/mod.js';
3
+ import { credentialv1alpha1, oauth1v1, tokensv1 } from '../../services/credentials/mod.js';
4
4
  import { Connection } from '../../services/platform/mod.js';
5
5
  import { FetchLike } from '../types.js';
6
6
  import { HttpClientFactory } from './HttpClientFactory.js';
@@ -1 +1 @@
1
- {"version":3,"file":"OutboundConnectionFactory.d.ts","sourceRoot":"","sources":["../../../../src/src/connection/internal/OutboundConnectionFactory.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAC;AAE7C,OAAO,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AAEtC,OAAO,EAAE,kBAAkB,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,mCAAmC,CAAC;AAC3F,OAAO,EAGH,UAAU,EAGb,MAAM,gCAAgC,CAAC;AACxC,OAAO,EAAE,SAAS,EAAsB,MAAM,aAAa,CAAC;AAG5D,OAAO,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AAI3D,qBAAa,yBAAyB;IAI9B,OAAO,CAAC,QAAQ,CAAC,iBAAiB;IAClC,OAAO,CAAC,QAAQ,CAAC,WAAW;IAC5B,OAAO,CAAC,QAAQ,CAAC,MAAM;IACvB,OAAO,CAAC,QAAQ,CAAC,MAAM;IACvB,OAAO,CAAC,QAAQ,CAAC,MAAM;IAP3B,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAuC;gBAGxC,iBAAiB,EAAE,iBAAiB,EACpC,WAAW,EAAE,MAAM,CAAC,OAAO,kBAAkB,CAAC,iBAAiB,CAAC,EAChE,MAAM,EAAE,MAAM,CAAC,OAAO,QAAQ,CAAC,YAAY,CAAC,EAC5C,MAAM,EAAE,MAAM,CAAC,OAAO,QAAQ,CAAC,oBAAoB,CAAC,EACpD,MAAM,EAAE,MAAM;IAKnC,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Y,CAAC,EAC5C,MAAM,EAAE,MAAM,CAAC,OAAO,QAAQ,CAAC,oBAAoB,CAAC,EACpD,MAAM,EAAE,MAAM;IAKnC,OAAO,CAAC,GAAG,EAAE,UAAU,GAAG,OAAO,CAAC,SAAS,CAAC;YAkB9B,YAAY;IAmB1B,OAAO,CAAC,eAAe;YAiDT,0BAA0B;YAwB1B,qBAAqB;IA4DnC,OAAO,CAAC,2BAA2B;IAuBnC,OAAO,CAAC,0BAA0B;IAkDlC,OAAO,CAAC,2BAA2B;YA0BrB,wBAAwB;YAkCxB,qBAAqB;IAiCnC,OAAO,CAAC,8BAA8B;IAuBtC,OAAO,CAAC,2BAA2B;YA2ErB,wBAAwB;YAkCxB,qBAAqB;IA6CnC,OAAO,CAAC,kCAAkC;CAsB7C"}
@@ -1,9 +1,9 @@
1
1
  import { LRUCache } from 'lru-cache';
2
+ import { createHmac } from 'node:crypto';
3
+ import OAuth from 'oauth-1.0a';
2
4
  import { isTokenValid } from '../../services/credentials/isTokenValid.js';
3
5
  import { CredentialHolder } from './CredentialHolder.js';
4
6
  import { FetchBuilder } from './FetchBuilder.js';
5
- import OAuth from 'oauth-1.0a';
6
- import { createHmac } from 'node:crypto';
7
7
  export class OutboundConnectionFactory {
8
8
  constructor(httpClientFactory, credentials, tokens, oauth1, logger) {
9
9
  Object.defineProperty(this, "httpClientFactory", {
@@ -413,7 +413,6 @@ export class OutboundConnectionFactory {
413
413
  const token = await tokenHolder.get();
414
414
  const headers = new Headers(init?.headers);
415
415
  headers.set('Authorization', `${tokenType} ${token.accessToken}`);
416
- console.log('headers', input);
417
416
  return fetch(input, {
418
417
  ...init,
419
418
  headers,
@@ -60,7 +60,7 @@ export class AsyncWorkflow {
60
60
  this.isWaiting = false;
61
61
  throw new Error('wait timed out');
62
62
  }
63
- const workflow = await this.queue.getWorkflow(this.workflowId);
63
+ const workflow = await this.queue.poll(this.workflowId);
64
64
  if (workflow.status === 'completed') {
65
65
  // workflow is completed, parse the output and set the data and completed to true
66
66
  const stringData = workflow.output;
@@ -5,17 +5,20 @@ import { Issue, IssueAPI } from '../issues/Issues.js';
5
5
  import { KeyValue, KeyValueProvider, KeyValueScope } from '../kv/KeyValue.js';
6
6
  import { Logger } from '../observability/logging/Logger.js';
7
7
  import { AsyncWorkflow } from './AsyncWorkflow.js';
8
- import { Workflow } from '../interpreter/durable/Queue.js';
9
8
  import { ActivationImpl } from './ActivationImpl.js';
10
- import { WorkflowInterface, WorkflowOpts } from './WorkflowClient.js';
11
9
  export type OnSuccessFn = (ctx: Context<any>) => void;
12
10
  export type OnErrorFn = (ctx: Context<any>) => void;
13
11
  export type ContextOptions = {
14
- workflow?: Workflow;
12
+ workflowId?: string;
15
13
  request?: express.Request;
16
14
  onSuccess?: OnSuccessFn;
17
15
  onError?: OnErrorFn;
18
16
  };
17
+ export type WorkflowOpts = {
18
+ maxAttempts?: number;
19
+ data?: unknown;
20
+ dataRaw?: string;
21
+ };
19
22
  export type CreateIssue = {
20
23
  severity: 'low' | 'medium' | 'high';
21
24
  title: string;
@@ -40,7 +43,6 @@ export interface Context<D> {
40
43
  deduplicate?: boolean;
41
44
  }): Promise<Issue | null>;
42
45
  request(): express.Request | undefined;
43
- workflowClient(): WorkflowInterface;
44
46
  }
45
47
  export declare class ContextImpl<D, Index = void> implements Context<D> {
46
48
  #private;
@@ -54,12 +56,11 @@ export declare class ContextImpl<D, Index = void> implements Context<D> {
54
56
  readonly options: ContextOptions;
55
57
  constructor(log: Logger, kvp: KeyValueProvider, creds: CredentialsProvider, executionId: string, startTime: Date, data: D, activation: ActivationImpl, issues: IssueAPI, queue?: QueueAPI, options?: ContextOptions);
56
58
  get activation(): ActivationImpl;
57
- get workflow(): Workflow | undefined;
59
+ get workflowId(): string | undefined;
58
60
  setIndex(idx: number): ContextImpl<D, number>;
59
61
  withData<D2>(data: D2): ContextImpl<D2, Index>;
60
62
  openKv(scope?: KeyValueScope): KeyValue;
61
63
  request(): express.Request | undefined;
62
- workflowClient(): WorkflowInterface;
63
64
  start(group: string, opts: WorkflowOpts): Promise<AsyncWorkflow>;
64
65
  createIssue(issue: CreateIssue, options?: {
65
66
  deduplicate?: boolean;
@@ -1 +1 @@
1
- {"version":3,"file":"Context.d.ts","sourceRoot":"","sources":["../../../src/src/context/Context.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,OAAO,MAAM,SAAS,CAAC;AACxC,OAAO,EAAE,mBAAmB,EAAE,MAAM,2CAA2C,CAAC;AAChF,OAAO,EAAE,QAAQ,EAAE,MAAM,iCAAiC,CAAC;AAC3D,OAAO,EAAE,KAAK,EAAE,QAAQ,EAAE,MAAM,qBAAqB,CAAC;AACtD,OAAO,EAAE,QAAQ,EAAE,gBAAgB,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAC9E,OAAO,EAAE,MAAM,EAAE,MAAM,oCAAoC,CAAC;AAC5D,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AACnD,OAAO,EAAE,QAAQ,EAAE,MAAM,iCAAiC,CAAC;AAC3D,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AACrD,OAAO,EAAE,iBAAiB,EAAE,YAAY,EAAgB,MAAM,qBAAqB,CAAC;AAEpF,MAAM,MAAM,WAAW,GAAG,CAAC,GAAG,EAAE,OAAO,CAAC,GAAG,CAAC,KAAK,IAAI,CAAC;AACtD,MAAM,MAAM,SAAS,GAAG,CAAC,GAAG,EAAE,OAAO,CAAC,GAAG,CAAC,KAAK,IAAI,CAAC;AAEpD,MAAM,MAAM,cAAc,GAAG;IACzB,QAAQ,CAAC,EAAE,QAAQ,CAAC;IACpB,OAAO,CAAC,EAAE,OAAO,CAAC,OAAO,CAAC;IAC1B,SAAS,CAAC,EAAE,WAAW,CAAC;IACxB,OAAO,CAAC,EAAE,SAAS,CAAC;CACvB,CAAC;AAEF,MAAM,MAAM,WAAW,GAAG;IACtB,QAAQ,EAAE,KAAK,GAAG,QAAQ,GAAG,MAAM,CAAC;IACp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mB,EAC1B,WAAW,EAAE,MAAM,EACnB,SAAS,EAAE,IAAI,EACf,IAAI,EAAE,CAAC,EACP,UAAU,EAAE,cAAc,EAC1B,MAAM,EAAE,QAAQ,EAChB,KAAK,CAAC,EAAE,QAAQ,EAChB,OAAO,GAAE,cAAmB;IA0BhC,IAAI,UAAU,IAAI,cAAc,CAE/B;IAED,IAAI,UAAU,IAAI,MAAM,GAAG,SAAS,CAEnC;IAED,QAAQ,CAAC,GAAG,EAAE,MAAM,GAAG,WAAW,CAAC,CAAC,EAAE,MAAM,CAAC;IAkB7C,QAAQ,CAAC,EAAE,EAAE,IAAI,EAAE,EAAE,GAAG,WAAW,CAAC,EAAE,EAAE,KAAK,CAAC;IAe9C,MAAM,CAAC,KAAK,GAAE,aAA2B,GAAG,QAAQ;IAepD,OAAO,IAAI,OAAO,CAAC,OAAO,GAAG,SAAS;IAIhC,KAAK,CAAC,KAAK,EAAE,MAAM,EAAE,IAAI,EAAE,YAAY,GAAG,OAAO,CAAC,aAAa,CAAC;IAgCtE,WAAW,CAAC,KAAK,EAAE,WAAW,EAAE,OAAO,CAAC,EAAE;QAAE,WAAW,CAAC,EAAE,OAAO,CAAA;KAAE,GAAG,OAAO,CAAC,KAAK,GAAG,IAAI,CAAC;IAO3F,WAAW,IAAI,mBAAmB;IAUlC,OAAO,CAAC,KAAK,EAAE,aAAa,GAAG,OAAO,CAAC,IAAI,CAAC;IAe5C,CAAC,MAAM,CAAC,WAAW,CAAC,IAAI,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC;CAQlD"}
@@ -11,7 +11,6 @@ var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (
11
11
  };
12
12
  var _ContextImpl_activation, _ContextImpl_issues, _ContextImpl_creds;
13
13
  import { AsyncWorkflow } from './AsyncWorkflow.js';
14
- import { WorkflowImpl } from './WorkflowClient.js';
15
14
  export class ContextImpl {
16
15
  constructor(log, kvp, creds, executionId, startTime, data, activation, issues, queue, options = {}) {
17
16
  Object.defineProperty(this, "log", {
@@ -85,13 +84,12 @@ export class ContextImpl {
85
84
  this.request = this.request.bind(this);
86
85
  this.createIssue = this.createIssue.bind(this);
87
86
  this.destroy = this.destroy.bind(this);
88
- this.workflowClient = this.workflowClient.bind(this);
89
87
  }
90
88
  get activation() {
91
89
  return __classPrivateFieldGet(this, _ContextImpl_activation, "f");
92
90
  }
93
- get workflow() {
94
- return this.options.workflow;
91
+ get workflowId() {
92
+ return this.options.workflowId;
95
93
  }
96
94
  setIndex(idx) {
97
95
  const next = new ContextImpl(this.log, this.kvp, __classPrivateFieldGet(this, _ContextImpl_creds, "f"), this.executionId, this.startTime, this.data, __classPrivateFieldGet(this, _ContextImpl_activation, "f"), __classPrivateFieldGet(this, _ContextImpl_issues, "f"), this.queue, this.options);
@@ -117,12 +115,6 @@ export class ContextImpl {
117
115
  request() {
118
116
  return this.options.request;
119
117
  }
120
- workflowClient() {
121
- if (!this.queue) {
122
- throw new Error('Queue is not available for this context, cannot start workflow');
123
- }
124
- return new WorkflowImpl(this.queue, this.executionId, this.activation);
125
- }
126
118
  async start(group, opts) {
127
119
  // this makes a post request to the endpoint sending a message and schedule the workflow to run
128
120
  if (!this.queue) {
@@ -139,14 +131,12 @@ export class ContextImpl {
139
131
  workflows: [
140
132
  {
141
133
  group,
142
- projectId: Deno.env.get('VERSORI_PROJECT_ID') ?? 'unknown',
143
- environmentId: Deno.env.get('VERSORI_ENVIRONMENT_ID') ?? 'unknown',
144
134
  metadata: {
145
135
  executionId: this.executionId,
146
136
  activationId: this.activation?.id,
147
137
  userId: this.activation?.user?.externalId,
148
138
  },
149
- payload: payload ?? btoa("{}"),
139
+ payload,
150
140
  maxAttempts: opts.maxAttempts,
151
141
  },
152
142
  ],
@@ -3,11 +3,10 @@ import { QueueAPI } from '../interpreter/durable/Queue.js';
3
3
  import { IssueAPI } from '../issues/Issues.js';
4
4
  import { KeyValueProvider } from '../kv/KeyValue.js';
5
5
  import { Logger } from '../observability/logging/Logger.js';
6
- import { Context, ContextImpl, ContextOptions } from './Context.js';
7
6
  import { Activation, PlatformApi } from '../services/platform/mod.js';
7
+ import { Context, ContextImpl, ContextOptions } from './Context.js';
8
8
  export interface ContextProvider {
9
9
  create<D>(activation: Activation, data: D, options?: ContextOptions): ContextImpl<D, void>;
10
- createWithExecutionId<D>(activation: Activation, data: D, executionId: string, options?: ContextOptions): ContextImpl<D, void>;
11
10
  destroy(ctx: Context<any>): Promise<void>;
12
11
  }
13
12
  export declare class ContextProviderImpl implements ContextProvider {
@@ -20,7 +19,6 @@ export declare class ContextProviderImpl implements ContextProvider {
20
19
  issues: IssueAPI;
21
20
  queue?: QueueAPI;
22
21
  constructor(log: Logger, kvp: KeyValueProvider, creds: CredentialsProvider, platformApi: PlatformApi, organisationId: string, environmentId: string, issues: IssueAPI, queue?: QueueAPI | undefined);
23
- createWithExecutionId<D>(activation: Activation, data: D, executionId: string, options?: ContextOptions): ContextImpl<D, void>;
24
22
  create<D>(activation: Activation, data: D, options?: ContextOptions): ContextImpl<D>;
25
23
  destroy(_: Context<any>): Promise<void>;
26
24
  }
@@ -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,OAAO,EAAE,WAAW,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AACpE,OAAO,EAAE,UAAU,EAAE,WAAW,EAAE,MAAM,6BAA6B,CAAC;AAGtE,MAAM,WAAW,eAAe;IAC5B,MAAM,CAAC,CAAC,EAAE,UAAU,EAAE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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;IAyBxF,OAAO,CAAC,CAAC,EAAE,OAAO,CAAC,GAAG,CAAC,GAAG,OAAO,CAAC,IAAI,CAAC;CAG1C"}
@@ -1,6 +1,6 @@
1
1
  import { ulid } from '../../deps/jsr.io/@std/ulid/1.0.0/mod.js';
2
- import { ContextImpl } from './Context.js';
3
2
  import { ActivationImpl } from './ActivationImpl.js';
3
+ import { ContextImpl } from './Context.js';
4
4
  export class ContextProviderImpl {
5
5
  constructor(log, kvp, creds, platformApi, organisationId, environmentId, issues, queue = undefined) {
6
6
  Object.defineProperty(this, "platformApi", {
@@ -57,7 +57,8 @@ export class ContextProviderImpl {
57
57
  this.issues = issues;
58
58
  this.queue = queue;
59
59
  }
60
- createWithExecutionId(activation, data, executionId, options = {}) {
60
+ create(activation, data, options = {}) {
61
+ const executionId = ulid();
61
62
  const logger = this.log.child({
62
63
  executionId,
63
64
  activationId: activation.id,
@@ -66,10 +67,6 @@ export class ContextProviderImpl {
66
67
  const activationImpl = new ActivationImpl(activation, this.platformApi, this.organisationId, this.environmentId, logger);
67
68
  return new ContextImpl(logger, this.kvp, this.creds, executionId, new Date(), data, activationImpl, this.issues, this.queue, options);
68
69
  }
69
- create(activation, data, options = {}) {
70
- const executionId = ulid();
71
- return this.createWithExecutionId(activation, data, executionId, options);
72
- }
73
70
  destroy(_) {
74
71
  return Promise.resolve();
75
72
  }
@@ -1 +1 @@
1
- {"version":3,"file":"Workflow.d.ts","sourceRoot":"","sources":["../../../src/src/dsl/Workflow.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAE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AAC;CACvC;AAGD,qBAAa,YAAY,CAAC,CAAC,EAAE,CAAC,CAAE,YAAW,QAAQ,CAAC,CAAC,CAAC;IAClD,OAAO,EAAE,OAAO,CAAC,CAAC,CAAC,CAAC;IACpB,IAAI,EAAE,IAAI,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;gBAEL,OAAO,EAAE,OAAO,CAAC,CAAC,CAAC,EAAE,IAAI,EAAE,IAAI,CAAC,CAAC,EAAE,CAAC,CAAC;IAQjD,IAAI,CAAC,EAAE,EAAE,IAAI,EAAE,QAAQ,CAAC,CAAC,EAAE,EAAE,CAAC,GAAG,QAAQ,CAAC,EAAE,CAAC;IAI7C,KAAK,CAAC,EAAE,EAAE,KAAK,EAAE,GAAG,GAAG,QAAQ,CAAC,EAAE,CAAC;CAGtC"}
@@ -14,6 +14,8 @@ export class WorkflowImpl {
14
14
  });
15
15
  this.trigger = trigger;
16
16
  this.task = task;
17
+ this.then = this.then.bind(this);
18
+ this.catch = this.catch.bind(this);
17
19
  }
18
20
  then(task) {
19
21
  return new WorkflowImpl(this.trigger, this.task.then(task));
@@ -1,4 +1,4 @@
1
- import { envVarConfigFile } from './constants.js';
1
+ import { envVarConfigFile } from '../../../internal/constants.js';
2
2
  //TODO(@teo): remove this file, it is implemented in the src/config directory now.
3
3
  /**
4
4
  * Loads the Versori SDK configuration from a JSON file.
@@ -5,11 +5,10 @@ type Cron = {
5
5
  url: string;
6
6
  };
7
7
  export declare class CronAPIClient implements CronProvider {
8
- private baseUrl;
8
+ private baseUrl?;
9
9
  private envId;
10
10
  private integrationUrl;
11
- private runLocal;
12
- constructor(baseUrl: string, envId: string, integrationUrl: string);
11
+ constructor(envId: string, integrationUrl: string, baseUrl?: string);
13
12
  static fromEnv(): CronAPIClient;
14
13
  static addDefaultCronPort(url: string): string;
15
14
  makeCronPath(name: string): string;
@@ -1 +1 @@
1
- {"version":3,"file":"cronapi.d.ts","sourceRoot":"","sources":["../../../../../src/src/dsl/http/versori/cronapi.ts"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AmB/B,MAAM,CAAC,kBAAkB,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM;IAU9C,YAAY,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM;IAM5B,WAAW,CAAC,KAAK,EAAE,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,OAAO,CAAC,IAAI,CAAC;IAgC5D,UAAU,CAAC,KAAK,EAAE,IAAI,EAAE;CAsB3B"}
@@ -1,6 +1,7 @@
1
- import { envVarEnvId, envVarCronApiBaseURL, envVarProjectId, envVarOrgSlug, envVarEnvironmentName, envVarSelfRefURL, cronPort, envVarLocalRun, } from './constants.js';
1
+ import { cronPort, envCronPort, envVarCronApiBaseURL, envVarEnvId, envVarEnvironmentName, envVarOrgSlug, envVarProjectId, envVarSelfRefURL } from '../../../internal/constants.js';
2
+ import { enabled as supervisorEnabled } from '../../../internal/supervisor.js';
2
3
  export class CronAPIClient {
3
- constructor(baseUrl, envId, integrationUrl) {
4
+ constructor(envId, integrationUrl, baseUrl) {
4
5
  Object.defineProperty(this, "baseUrl", {
5
6
  enumerable: true,
6
7
  configurable: true,
@@ -19,29 +20,22 @@ export class CronAPIClient {
19
20
  writable: true,
20
21
  value: void 0
21
22
  });
22
- Object.defineProperty(this, "runLocal", {
23
- enumerable: true,
24
- configurable: true,
25
- writable: true,
26
- value: void 0
27
- });
28
23
  this.baseUrl = baseUrl;
29
24
  this.envId = envId;
30
25
  this.integrationUrl = integrationUrl;
31
- this.runLocal = Deno.env.get(envVarLocalRun) === 'true';
32
26
  }
33
27
  static fromEnv() {
34
- const baseUrl = Deno.env.get(envVarCronApiBaseURL) || 'http://cron-api.platform.svc.cluster.local';
28
+ const baseUrl = Deno.env.get(envVarCronApiBaseURL);
35
29
  const envId = Deno.env.get(envVarEnvId);
36
30
  const projectId = Deno.env.get(envVarProjectId);
37
31
  const orgSlug = Deno.env.get(envVarOrgSlug);
38
32
  const envName = Deno.env.get(envVarEnvironmentName);
39
- if (!baseUrl || !envId || !projectId || !orgSlug || !envName) {
33
+ if (!envId || !projectId || !orgSlug || !envName) {
40
34
  throw new Error('Missing required environment variables');
41
35
  }
42
36
  const integrationUrl = Deno.env.get(envVarSelfRefURL) ||
43
37
  `http://svc-${projectId.toLowerCase()}-${envName.toLowerCase()}.sb-${orgSlug.toLowerCase()}.svc.cluster.local:${cronPort}`;
44
- return new CronAPIClient(baseUrl, envId, this.addDefaultCronPort(integrationUrl));
38
+ return new CronAPIClient(envId, this.addDefaultCronPort(integrationUrl), baseUrl);
45
39
  }
46
40
  // Check if the URL has a port, if not, add the default cron port.
47
41
  static addDefaultCronPort(url) {
@@ -62,7 +56,13 @@ export class CronAPIClient {
62
56
  schedule,
63
57
  url: this.makeCronPath(name),
64
58
  }));
65
- if (this.runLocal) {
59
+ if (supervisorEnabled) {
60
+ // if we are in supervised mode we don't want to do run crons automatically
61
+ return;
62
+ }
63
+ if (!this.baseUrl) {
64
+ // we are no in supervised mode and there is no base URL
65
+ // run for local dev
66
66
  this.runLocalFn(cronsArray);
67
67
  return;
68
68
  }
@@ -81,7 +81,7 @@ export class CronAPIClient {
81
81
  if (crons.length === 0) {
82
82
  return;
83
83
  }
84
- const cronPort = Deno.env.get('CRON_PORT') || '3001';
84
+ const cronPort = Deno.env.get(envCronPort) || '3001';
85
85
  console.log('----------------------------------------');
86
86
  console.log('Running in local mode, your scheduler workflows will not trigger automatically.');
87
87
  console.log('Instead you can trigger them by sending a request to the following URLs:');
@@ -1,7 +1,7 @@
1
1
  /* istanbul ignore file */
2
2
  /* tslint:disable */
3
3
  /* eslint-disable */
4
- import { envVarSDKApiBaseURL } from '../../constants.js';
4
+ import { envVarSDKApiBaseURL } from '../../../../../internal/constants.js';
5
5
  export const OpenAPI = {
6
6
  BASE: Deno.env.get(envVarSDKApiBaseURL) || 'http://localhost:8902',
7
7
  VERSION: '1.0.0',
@@ -1,8 +1,8 @@
1
1
  import { NextFunction, Request, Response } from 'express';
2
2
  import { ConnectionFactory } from '../../../connection/types.js';
3
3
  import { Logger } from '../../../observability/mod.js';
4
- import { ConfigReader } from '../types.js';
5
4
  import { PlatformApi } from '../../../services/platform/mod.js';
5
+ import { ConfigReader } from '../types.js';
6
6
  export type CreateWebhookMiddleWareOpts = {
7
7
  id: string;
8
8
  organisationId: string;
@@ -1 +1 @@
1
- {"version":3,"file":"webhookmiddleware.d.ts","sourceRoot":"","sources":["../../../../../src/src/dsl/http/versori/webhookmiddleware.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AAC1D,OAAO,EAAE,iBAAiB,EAAE,MAAM,8BAA8B,CAAC;AACjE,OAAO,EAAE,MAAM,EAAE,MAAM,+BAA+B,CAAC;AACvD,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAC3C,OAAO,EAAc,WAAW,EAAE,MAAM,mCAAmC,CAAC;AAU5E,MAAM,MAAM,2BAA2B,GAAG;IACtC,EAAE,EAAE,MAAM,CAAC;IACX,cAAc,EAAE,MAAM,CAAC;IACvB,aAAa,EAAE,MAAM,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;AAyCF,wBAAgB,6BAA6B,CACzC,IAAI,EAAE,2BAA2B,GAClC,CAAC,GAAG,EAAE,OAAO,EAAE,GAAG,EAAE,QAAQ,EAAE,IAAI,EAAE,YAAY,KAAK,OAAO,CAAC,IAAI,CAAC,CAqEpE;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,CA6DpE;AAED,wBAAgB,oCAAoC,CAChD,IAAI,EAAE,2B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