@kaleido-io/workflow-engine-sdk 0.9.3 → 0.9.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 (76) hide show
  1. package/README.md +486 -362
  2. package/bin/init.js +14 -15
  3. package/dist/src/client/client.d.ts +22 -0
  4. package/dist/src/client/client.d.ts.map +1 -1
  5. package/dist/src/client/client.js +1 -0
  6. package/dist/src/client/client.js.map +1 -1
  7. package/dist/src/client/client_factory.d.ts +14 -0
  8. package/dist/src/client/client_factory.d.ts.map +1 -0
  9. package/dist/src/client/client_factory.js +64 -0
  10. package/dist/src/client/client_factory.js.map +1 -0
  11. package/dist/src/client/rest-client.d.ts.map +1 -1
  12. package/dist/src/client/rest-client.js +1 -1
  13. package/dist/src/client/rest-client.js.map +1 -1
  14. package/dist/src/config/config.d.ts +81 -1
  15. package/dist/src/config/config.d.ts.map +1 -1
  16. package/dist/src/config/config.js +269 -24
  17. package/dist/src/config/config.js.map +1 -1
  18. package/dist/src/config/config_helpers.d.ts +44 -0
  19. package/dist/src/config/config_helpers.d.ts.map +1 -0
  20. package/dist/src/config/config_helpers.js +68 -0
  21. package/dist/src/config/config_helpers.js.map +1 -0
  22. package/dist/src/helpers/stage_director.js +2 -2
  23. package/dist/src/i18n/errors.d.ts +5 -0
  24. package/dist/src/i18n/errors.d.ts.map +1 -1
  25. package/dist/src/i18n/errors.js +8 -3
  26. package/dist/src/i18n/errors.js.map +1 -1
  27. package/dist/src/index.d.ts +3 -2
  28. package/dist/src/index.d.ts.map +1 -1
  29. package/dist/src/index.js +5 -1
  30. package/dist/src/index.js.map +1 -1
  31. package/dist/src/runtime/handler_runtime.d.ts +22 -0
  32. package/dist/src/runtime/handler_runtime.d.ts.map +1 -1
  33. package/dist/src/runtime/handler_runtime.js +43 -3
  34. package/dist/src/runtime/handler_runtime.js.map +1 -1
  35. package/dist/src/utils/patch.d.ts +1 -1
  36. package/dist-esm/src/client/client.js +2 -1
  37. package/dist-esm/src/client/client.js.map +1 -1
  38. package/dist-esm/src/client/client_factory.js +60 -0
  39. package/dist-esm/src/client/client_factory.js.map +1 -0
  40. package/dist-esm/src/client/rest-client.js +1 -1
  41. package/dist-esm/src/client/rest-client.js.map +1 -1
  42. package/dist-esm/src/config/config.js +235 -25
  43. package/dist-esm/src/config/config.js.map +1 -1
  44. package/dist-esm/src/config/config_helpers.js +61 -0
  45. package/dist-esm/src/config/config_helpers.js.map +1 -0
  46. package/dist-esm/src/helpers/stage_director.js +2 -2
  47. package/dist-esm/src/i18n/errors.js +8 -3
  48. package/dist-esm/src/i18n/errors.js.map +1 -1
  49. package/dist-esm/src/index.js +2 -1
  50. package/dist-esm/src/index.js.map +1 -1
  51. package/dist-esm/src/runtime/handler_runtime.js +38 -2
  52. package/dist-esm/src/runtime/handler_runtime.js.map +1 -1
  53. package/dist-esm/src/utils/patch.js +2 -2
  54. package/package.json +1 -1
  55. package/template/README.md +5 -8
  56. package/template/config/config.yaml +12 -0
  57. package/template/config/wfe-config.yaml +12 -0
  58. package/template/package-lock.json +1908 -0
  59. package/template/package.json +4 -2
  60. package/template/src/connect.ts +35 -37
  61. package/template/src/provider.ts +4 -4
  62. package/template/src/samples/event-source/echo-handler.ts +2 -2
  63. package/template/src/samples/event-source/event-processor.ts +1 -1
  64. package/template/src/samples/event-source/event-source.ts +1 -1
  65. package/template/src/samples/event-source/stream.ts +11 -11
  66. package/template/src/samples/hello/flow.ts +36 -36
  67. package/template/src/samples/hello/handlers.ts +2 -2
  68. package/template/src/samples/hello/transaction.ts +4 -4
  69. package/template/src/samples/http-invoke/flow.ts +29 -29
  70. package/template/src/samples/http-invoke/handlers.ts +88 -39
  71. package/template/src/samples/http-invoke/transaction.ts +3 -3
  72. package/template/src/samples/snap/event-source.ts +1 -1
  73. package/template/src/samples/snap/flow.ts +40 -40
  74. package/template/src/samples/snap/snap-handler.ts +2 -2
  75. package/template/src/samples/snap/transaction.ts +6 -6
  76. package/template/.env.sample +0 -14
@@ -16,6 +16,7 @@
16
16
  },
17
17
  "private": true,
18
18
  "devDependencies": {
19
+ "@types/js-yaml": "^4.0.9",
19
20
  "@vitest/coverage-v8": "^4.0.16",
20
21
  "tsx": "^4.21.0",
21
22
  "typescript": "^5.9.3",
@@ -28,9 +29,10 @@
28
29
  "README.md"
29
30
  ],
30
31
  "dependencies": {
31
- "@kaleido-io/workflow-engine-sdk": "^0.9.3",
32
+ "@kaleido-io/workflow-engine-sdk": "^0.9.4",
32
33
  "dotenv": "^17.2.3",
34
+ "js-yaml": "^4.1.1",
33
35
  "web3": "^4.16.0",
34
36
  "ws": "^8.18.0"
35
37
  }
36
- }
38
+ }
@@ -14,45 +14,43 @@
14
14
  // See the License for the specific language governing permissions and
15
15
  // limitations under the License.
16
16
 
17
-
18
17
  import {
19
18
  newDirectedTransactionHandler,
20
- WorkflowEngineClient,
21
- } from '@kaleido-io/workflow-engine-sdk';
22
- import dotenv from 'dotenv';
23
-
24
- import provider from './provider.js';
25
-
26
- import { actionMap as helloActionMap } from './samples/hello/handlers.js';
27
- import { actionMap as httpInvokeActionMap } from './samples/http-invoke/handlers.js';
28
- import { eventSource } from './samples/event-source/event-source.js';
29
- import { actionMap as snapActionMap } from './samples/snap/snap-handler.js';
30
- import { echoEventProcessor } from './samples/event-source/event-processor.js';
31
- import { eventSource as dealerEventSource } from './samples/snap/event-source.js';
19
+ NewWorkflowEngineClient,
20
+ HandlerSetFor,
21
+ } from "@kaleido-io/workflow-engine-sdk";
22
+ import dotenv from "dotenv";
23
+
24
+ import { actionMap as helloActionMap } from "./samples/hello/handlers.js";
25
+ import { actionMap as httpInvokeActionMap } from "./samples/http-invoke/handlers.js";
26
+ import { eventSource } from "./samples/event-source/event-source.js";
27
+ import { actionMap as snapActionMap } from "./samples/snap/snap-handler.js";
28
+ import { echoEventProcessor } from "./samples/event-source/event-processor.js";
29
+ import { eventSource as dealerEventSource } from "./samples/snap/event-source.js";
32
30
 
33
31
  dotenv.config();
34
- const wsUrl = `wss://${process.env.ACCOUNT}/endpoint/${process.env.ENVIRONMENT}/${process.env.WORKFLOW_ENGINE}/rest/ws`;
35
- const client = new WorkflowEngineClient({
36
- url: wsUrl,
37
- authHeaderName: 'Authorization',
38
- authToken: `basic ${Buffer.from(`${process.env.KEY_NAME}:${process.env.KEY_VALUE}`).toString("base64")}`,
39
- providerName: provider.name,
40
- providerMetadata: provider.metadata ?? {},
41
- reconnectDelay: 2000,
42
- });
43
-
44
- const helloHandler = newDirectedTransactionHandler('hello', helloActionMap);
45
- client.registerTransactionHandler('hello', helloHandler);
46
-
47
- const httpInvokeHandler = newDirectedTransactionHandler('http-invoke', httpInvokeActionMap);
48
- client.registerTransactionHandler('http-invoke', httpInvokeHandler);
49
-
50
- client.registerEventProcessor('echo', echoEventProcessor);
51
- client.registerEventSource('my-listener', eventSource);
52
-
53
- const snapHandler = newDirectedTransactionHandler('snap-watcher', snapActionMap);
54
- client.registerTransactionHandler('snap-watcher', snapHandler);
55
-
56
- client.registerEventSource('snap-dealer', dealerEventSource);
57
32
 
58
- await client.connect();
33
+ const helloHandler = newDirectedTransactionHandler("hello", helloActionMap);
34
+ const httpInvokeHandler = newDirectedTransactionHandler(
35
+ "http-invoke",
36
+ httpInvokeActionMap,
37
+ );
38
+ const snapHandler = newDirectedTransactionHandler(
39
+ "snap-watcher",
40
+ snapActionMap,
41
+ );
42
+
43
+ const client = await NewWorkflowEngineClient(
44
+ HandlerSetFor(
45
+ helloHandler,
46
+ httpInvokeHandler,
47
+ echoEventProcessor,
48
+ eventSource,
49
+ snapHandler,
50
+ dealerEventSource,
51
+ ),
52
+ process.env.WFE_CONFIG_FILE ?? "./config/wfe-config.yaml",
53
+ );
54
+
55
+ process.on("SIGINT", () => client.disconnect());
56
+ process.on("SIGTERM", () => client.disconnect());
@@ -16,9 +16,9 @@
16
16
 
17
17
 
18
18
  export default {
19
- "name": "example-provider",
20
- "metadata": {
21
- "displayName": "Example provider",
22
- "description": "An example provider for the Kaleido Workflow Engine"
19
+ 'name': 'example-provider',
20
+ 'metadata': {
21
+ 'displayName': 'Example provider',
22
+ 'description': 'An example provider for the Kaleido Workflow Engine'
23
23
  }
24
24
  }
@@ -15,7 +15,7 @@
15
15
  // limitations under the License.
16
16
 
17
17
 
18
- import { BasicStageDirector, DirectedActionConfig, EvalResult, InvocationMode, WithStageDirector, WSEvaluateTransaction } from "@kaleido-io/workflow-engine-sdk";
18
+ import { BasicStageDirector, DirectedActionConfig, EvalResult, InvocationMode, WithStageDirector, WSEvaluateTransaction } from '@kaleido-io/workflow-engine-sdk';
19
19
 
20
20
  class MyHandlerInput implements WithStageDirector {
21
21
  public stageDirector: BasicStageDirector;
@@ -43,7 +43,7 @@ class MyHandlerInput implements WithStageDirector {
43
43
  }
44
44
 
45
45
  const map: Map<string, DirectedActionConfig<MyHandlerInput>> = new Map([
46
- ["echo", {
46
+ ['echo', {
47
47
  invocationMode: InvocationMode.PARALLEL, handler: async (transaction: WSEvaluateTransaction) => {
48
48
  if (transaction.state?.input?.data === undefined || transaction.state?.input?.data?.message === undefined) {
49
49
  return {
@@ -14,7 +14,7 @@
14
14
  // See the License for the specific language governing permissions and
15
15
  // limitations under the License.
16
16
 
17
- import { EngineAPI, WSEventProcessorBatchRequest, WSEventProcessorBatchResult } from "@kaleido-io/workflow-engine-sdk";
17
+ import { EngineAPI, WSEventProcessorBatchRequest, WSEventProcessorBatchResult } from '@kaleido-io/workflow-engine-sdk';
18
18
 
19
19
  export class MyEventProcessor {
20
20
 
@@ -15,7 +15,7 @@
15
15
  // limitations under the License.
16
16
 
17
17
 
18
- import { EventSourceConf, EventSourceEvent, newEventSource, newLogger, WSEventStreamInfo } from "@kaleido-io/workflow-engine-sdk";
18
+ import { EventSourceConf, EventSourceEvent, newEventSource, newLogger, WSEventStreamInfo } from '@kaleido-io/workflow-engine-sdk';
19
19
 
20
20
  const log = newLogger('event-source');
21
21
 
@@ -18,17 +18,17 @@
18
18
  import provider from '../../provider.js';
19
19
 
20
20
  export const stream = {
21
- "name": "event-echo-stream",
22
- "description": "Listen for events from the custom event source and pass them to the echo event processor",
23
- "type": "event_stream",
24
- "config": {
25
- "pollingInterval": "2s"
21
+ 'name': 'event-echo-stream',
22
+ 'description': 'Listen for events from the custom event source and pass them to the echo event processor',
23
+ 'type': 'event_stream',
24
+ 'config': {
25
+ 'pollingInterval': '2s'
26
26
  },
27
- "listenerHandler": "my-listener",
28
- "listenerHandlerProvider": provider.name,
29
- "eventHandler": "echo",
30
- "eventHandlerProvider": provider.name,
31
- "postFilter": {
32
- "jsonata": "true"
27
+ 'listenerHandler': 'my-listener',
28
+ 'listenerHandlerProvider': provider.name,
29
+ 'eventHandler': 'echo',
30
+ 'eventHandlerProvider': provider.name,
31
+ 'postFilter': {
32
+ 'jsonata': 'true'
33
33
  }
34
34
  }
@@ -17,58 +17,58 @@
17
17
 
18
18
  import provider from '../../provider.js';
19
19
  export const flow = {
20
- "name": "hello-flow",
21
- "description": "",
22
- "labels": {},
23
- "handlerBindings": {
24
- "hello": {
25
- "provider": provider.name,
26
- "providerHandler": "hello"
20
+ 'name': 'hello-flow',
21
+ 'description': '',
22
+ 'labels': {},
23
+ 'handlerBindings': {
24
+ 'hello': {
25
+ 'provider': provider.name,
26
+ 'providerHandler': 'hello'
27
27
  }
28
28
  },
29
- "version": "1.0.0",
30
- "operations": [
29
+ 'version': '1.0.0',
30
+ 'operations': [
31
31
  {
32
- "name": "hello",
33
- "description": "Hello",
34
- "type": "asynchronous",
35
- "stage": "my-beginning-state",
36
- "stateUpdates": null,
37
- "inputSchema": {
38
- "type": "object",
39
- "properties": {
40
- "name": {
41
- "type": [
42
- "string"
32
+ 'name': 'hello',
33
+ 'description': 'Hello',
34
+ 'type': 'asynchronous',
35
+ 'stage': 'my-beginning-state',
36
+ 'stateUpdates': null,
37
+ 'inputSchema': {
38
+ 'type': 'object',
39
+ 'properties': {
40
+ 'name': {
41
+ 'type': [
42
+ 'string'
43
43
  ]
44
44
  }
45
45
  },
46
- "required": [
47
- "name"
46
+ 'required': [
47
+ 'name'
48
48
  ],
49
- "additionalProperties": false
49
+ 'additionalProperties': false
50
50
  }
51
51
  }
52
52
  ],
53
- "stages": [
53
+ 'stages': [
54
54
  {
55
- "name": "my-beginning-state",
56
- "type": "pending",
57
- "handler": "hello",
58
- "inputMap": {
59
- "jsonata": "{\n \"action\": \"hello\",\n \"invoke\": {\n \"input\": state.input\n },\n \"nextStage\": \"end\",\n \"failureStage\": \"failure\",\n \"outputPath\": \"/output\"\n}\n"
55
+ 'name': 'my-beginning-state',
56
+ 'type': 'pending',
57
+ 'handler': 'hello',
58
+ 'inputMap': {
59
+ 'jsonata': '{\n "action": "hello",\n "invoke": {\n "input": state.input\n },\n "nextStage": "end",\n "failureStage": "failure",\n "outputPath": "/output"\n}\n'
60
60
  },
61
- "fullState": true
61
+ 'fullState': true
62
62
  },
63
63
  {
64
- "name": "end",
65
- "type": "success",
66
- "handler": ""
64
+ 'name': 'end',
65
+ 'type': 'success',
66
+ 'handler': ''
67
67
  },
68
68
  {
69
- "name": "failure",
70
- "type": "failure",
71
- "handler": ""
69
+ 'name': 'failure',
70
+ 'type': 'failure',
71
+ 'handler': ''
72
72
  }
73
73
  ]
74
74
  }
@@ -15,7 +15,7 @@
15
15
  // limitations under the License.
16
16
 
17
17
 
18
- import { BasicStageDirector, DirectedActionConfig, EvalResult, InvocationMode, WithStageDirector, WSEvaluateTransaction } from "@kaleido-io/workflow-engine-sdk";
18
+ import { BasicStageDirector, DirectedActionConfig, EvalResult, InvocationMode, WithStageDirector, WSEvaluateTransaction } from '@kaleido-io/workflow-engine-sdk';
19
19
 
20
20
  class MyHandlerInput implements WithStageDirector {
21
21
  public stageDirector: BasicStageDirector;
@@ -43,7 +43,7 @@ class MyHandlerInput implements WithStageDirector {
43
43
  }
44
44
 
45
45
  const map: Map<string, DirectedActionConfig<MyHandlerInput>> = new Map([
46
- ["hello", {
46
+ ['hello', {
47
47
  invocationMode: InvocationMode.PARALLEL, handler: async (transaction: WSEvaluateTransaction) => {
48
48
  if (transaction.state?.input?.name === undefined) {
49
49
  return {
@@ -16,9 +16,9 @@
16
16
 
17
17
 
18
18
  export const transaction = {
19
- "input": {
20
- "name": "workflow engine developer"
19
+ 'input': {
20
+ 'name': 'workflow engine developer'
21
21
  },
22
- "operation": "hello",
23
- "workflow": "hello-flow"
22
+ 'operation': 'hello',
23
+ 'workflow': 'hello-flow'
24
24
  }
@@ -17,47 +17,47 @@
17
17
 
18
18
  import provider from '../../provider.js';
19
19
  export const flow = {
20
- "name": "http-invoke-flow",
21
- "description": "",
22
- "labels": {},
23
- "handlerBindings": {
24
- "http-invoke": {
25
- "provider": provider.name,
26
- "providerHandler": "http-invoke"
20
+ 'name': 'http-invoke-flow',
21
+ 'description': '',
22
+ 'labels': {},
23
+ 'handlerBindings': {
24
+ 'http-invoke': {
25
+ 'provider': provider.name,
26
+ 'providerHandler': 'http-invoke'
27
27
  }
28
28
  },
29
- "version": "1.0.0",
30
- "operations": [
29
+ 'version': '1.0.0',
30
+ 'operations': [
31
31
  {
32
- "name": "http-invoke",
33
- "description": "HTTP Invoke",
34
- "type": "asynchronous",
35
- "stage": "start",
36
- "inputSchema": {
37
- "type": "object",
38
- "additionalProperties": true
32
+ 'name': 'http-invoke',
33
+ 'description': 'HTTP Invoke',
34
+ 'type': 'asynchronous',
35
+ 'stage': 'start',
36
+ 'inputSchema': {
37
+ 'type': 'object',
38
+ 'additionalProperties': true
39
39
  }
40
40
  }
41
41
  ],
42
- "stages": [
42
+ 'stages': [
43
43
  {
44
- "name": "start",
45
- "type": "pending",
46
- "handler": "http-invoke",
47
- "inputMap": {
48
- "jsonata": "{\n \"action\": \"http-invoke\",\n \"invoke\": {\n \"input\": state.input\n },\n \"nextStage\": \"end\",\n \"failureStage\": \"failure\",\n \"outputPath\": \"/output\"\n}\n"
44
+ 'name': 'start',
45
+ 'type': 'pending',
46
+ 'handler': 'http-invoke',
47
+ 'inputMap': {
48
+ 'jsonata': '{\n "action": "http-invoke",\n "invoke": {\n "input": state.input\n },\n "nextStage": "end",\n "failureStage": "failure",\n "outputPath": "/output"\n}\n'
49
49
  },
50
- "fullState": true
50
+ 'fullState': true
51
51
  },
52
52
  {
53
- "name": "end",
54
- "type": "success",
55
- "handler": ""
53
+ 'name': 'end',
54
+ 'type': 'success',
55
+ 'handler': ''
56
56
  },
57
57
  {
58
- "name": "failure",
59
- "type": "failure",
60
- "handler": ""
58
+ 'name': 'failure',
59
+ 'type': 'failure',
60
+ 'handler': ''
61
61
  }
62
62
  ]
63
63
  }
@@ -14,53 +14,102 @@
14
14
  // See the License for the specific language governing permissions and
15
15
  // limitations under the License.
16
16
 
17
+ import * as fs from 'fs';
18
+ import * as path from 'path';
19
+ import yaml from 'js-yaml';
20
+ import {
21
+ BasicStageDirector,
22
+ DirectedActionConfig,
23
+ EvalResult,
24
+ InvocationMode,
25
+ WithStageDirector,
26
+ } from '@kaleido-io/workflow-engine-sdk';
17
27
 
18
- import { BasicStageDirector, DirectedActionConfig, EvalResult, InvocationMode, WithStageDirector } from "@kaleido-io/workflow-engine-sdk";
28
+ export interface HTTPInvokeConfig {
29
+ url: string;
30
+ invocationMode: keyof typeof InvocationMode;
31
+ apiKeyHeader: string;
32
+ }
33
+
34
+ function resolveAppConfigPath(): string | undefined {
35
+ const fromEnv = process.env.CONFIG_FILE?.trim();
36
+ const candidates = [
37
+ fromEnv,
38
+ path.join(process.cwd(), 'src', 'config', 'config.yaml'),
39
+ path.join(process.cwd(), 'config', 'config.yaml'),
40
+ ].filter(Boolean) as string[];
41
+ for (const p of candidates) {
42
+ if (fs.existsSync(p)) {
43
+ return p;
44
+ }
45
+ }
46
+ return undefined;
47
+ }
48
+
49
+ function loadAppConfig(): { httpInvoke?: HTTPInvokeConfig } {
50
+ const configPath = resolveAppConfigPath();
51
+ if (!configPath) {
52
+ return {};
53
+ }
54
+ const raw = fs.readFileSync(configPath, 'utf8');
55
+ return yaml.load(raw) as { httpInvoke?: HTTPInvokeConfig };
56
+ }
19
57
 
20
58
  class HTTPInvokeHandlerInput implements WithStageDirector {
21
- public stageDirector: BasicStageDirector;
22
- public action1?: { inputA: string };
23
- public action2?: { inputB: string };
24
- public customData?: any;
59
+ public stageDirector: BasicStageDirector;
60
+ public action1?: { inputA: string };
61
+ public action2?: { inputB: string };
62
+ public customData?: any;
25
63
 
26
- constructor(data: any) {
27
- this.stageDirector = new BasicStageDirector(
28
- data.action || 'http-invoke',
29
- data.outputPath || '/output',
30
- data.nextStage || 'end',
31
- data.failureStage || 'failed'
32
- );
33
- this.customData = data.customData;
34
- }
64
+ constructor(data: any) {
65
+ this.stageDirector = new BasicStageDirector(
66
+ data.action || 'http-invoke',
67
+ data.outputPath || '/output',
68
+ data.nextStage || 'end',
69
+ data.failureStage || 'failed',
70
+ );
71
+ this.customData = data.customData;
72
+ }
35
73
 
36
- getStageDirector(): BasicStageDirector {
37
- return this.stageDirector;
38
- }
74
+ getStageDirector(): BasicStageDirector {
75
+ return this.stageDirector;
76
+ }
39
77
 
40
- name(): string {
41
- return 'hello';
42
- }
78
+ name(): string {
79
+ return 'hello';
80
+ }
43
81
  }
44
82
 
45
- const url = 'https://httpbin.org/get';
83
+ const appConfig = loadAppConfig();
84
+ const httpInvoke = appConfig.httpInvoke ?? {
85
+ url: 'https://httpbin.org/get',
86
+ invocationMode: 'PARALLEL' as const,
87
+ apiKeyHeader: 'X-API-KEY',
88
+ };
89
+
46
90
  const map: Map<string, DirectedActionConfig<HTTPInvokeHandlerInput>> = new Map([
47
- ["http-invoke", {
48
- invocationMode: InvocationMode.PARALLEL, handler: async () => {
49
- const response = await fetch(url, {
50
- headers: {
51
- 'X-API-KEY': process.env.API_KEY ?? '',
52
- },
53
- });
54
- const body = await response.json();
55
- return {
56
- result: EvalResult.COMPLETE,
57
- output: {
58
- body,
59
- status: response.status,
60
- },
61
- }
62
- }
63
- }],
91
+ [
92
+ 'http-invoke',
93
+ {
94
+ invocationMode:
95
+ InvocationMode[httpInvoke.invocationMode] ?? InvocationMode.PARALLEL,
96
+ handler: async () => {
97
+ const response = await fetch(httpInvoke.url, {
98
+ headers: {
99
+ [httpInvoke.apiKeyHeader]: process.env.API_KEY ?? '',
100
+ },
101
+ });
102
+ const body = await response.json();
103
+ return {
104
+ result: EvalResult.COMPLETE,
105
+ output: {
106
+ body,
107
+ status: response.status,
108
+ },
109
+ };
110
+ },
111
+ },
112
+ ],
64
113
  ]);
65
114
 
66
- export const actionMap = map;
115
+ export const actionMap = map;
@@ -16,7 +16,7 @@
16
16
 
17
17
 
18
18
  export const transaction = {
19
- "input": {},
20
- "operation": "http-invoke",
21
- "workflow": "http-invoke-flow"
19
+ 'input': {},
20
+ 'operation': 'http-invoke',
21
+ 'workflow': 'http-invoke-flow'
22
22
  }
@@ -14,7 +14,7 @@
14
14
  // See the License for the specific language governing permissions and
15
15
  // limitations under the License.
16
16
 
17
- import { EventSourceConf, newEventSource, newLogger, WSEventStreamInfo } from "@kaleido-io/workflow-engine-sdk";
17
+ import { EventSourceConf, newEventSource, newLogger, WSEventStreamInfo } from '@kaleido-io/workflow-engine-sdk';
18
18
 
19
19
  const log = newLogger('dealer-event-source');
20
20