@onlineapps/conn-orch-orchestrator 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/API.md ADDED
@@ -0,0 +1,195 @@
1
+ ## Modules
2
+
3
+ <dl>
4
+ <dt><a href="#module_@onlineapps/conn-orch-orchestrator">@onlineapps/conn-orch-orchestrator</a></dt>
5
+ <dd><p>Workflow orchestration connector that handles message routing and workflow execution.
6
+ Coordinates all other connectors to process workflow messages.</p>
7
+ </dd>
8
+ </dl>
9
+
10
+ ## Classes
11
+
12
+ <dl>
13
+ <dt><a href="#WorkflowOrchestrator">WorkflowOrchestrator</a></dt>
14
+ <dd></dd>
15
+ <dt><a href="#WorkflowOrchestrator">WorkflowOrchestrator</a></dt>
16
+ <dd></dd>
17
+ </dl>
18
+
19
+ ## Functions
20
+
21
+ <dl>
22
+ <dt><a href="#processWorkflowMessage">processWorkflowMessage(message, serviceName)</a> ⇒ <code>Promise.&lt;Object&gt;</code></dt>
23
+ <dd><p>Process a workflow message</p>
24
+ </dd>
25
+ <dt><a href="#generateCookbook">generateCookbook(openApiSpec)</a> ⇒ <code>Object</code></dt>
26
+ <dd><p>Generate cookbook from OpenAPI spec (utility method)</p>
27
+ </dd>
28
+ <dt><a href="#transformResponse">transformResponse(response, mapping)</a> ⇒ <code>Object</code></dt>
29
+ <dd><p>Transform API response using cookbook mapping</p>
30
+ </dd>
31
+ </dl>
32
+
33
+ <a name="module_@onlineapps/conn-orch-orchestrator"></a>
34
+
35
+ ## @onlineapps/conn-orch-orchestrator
36
+ Workflow orchestration connector that handles message routing and workflow execution.
37
+ Coordinates all other connectors to process workflow messages.
38
+
39
+ **See**: [GitHub Repository](https://github.com/onlineapps/oa-drive/tree/main/shared/connector/conn-orch-orchestrator)
40
+ **Since**: 1.0.0
41
+ **Author**: OA Drive Team
42
+ **License**: MIT
43
+ <a name="module_@onlineapps/conn-orch-orchestrator..create"></a>
44
+
45
+ ### @onlineapps/conn-orch-orchestrator~create(config) ⇒ [<code>WorkflowOrchestrator</code>](#WorkflowOrchestrator)
46
+ Create orchestrator instance
47
+
48
+ **Kind**: inner method of [<code>@onlineapps/conn-orch-orchestrator</code>](#module_@onlineapps/conn-orch-orchestrator)
49
+ **Returns**: [<code>WorkflowOrchestrator</code>](#WorkflowOrchestrator) - New orchestrator instance
50
+
51
+ | Param | Type | Description |
52
+ | --- | --- | --- |
53
+ | config | <code>Object</code> | Configuration options |
54
+ | config.mqClient | <code>Object</code> | MQ client instance |
55
+ | config.registryClient | <code>Object</code> | Registry client instance |
56
+ | config.apiMapper | <code>Object</code> | API mapper instance |
57
+ | config.cookbook | <code>Object</code> | Cookbook connector instance |
58
+ | [config.logger] | <code>Object</code> | Logger instance |
59
+
60
+ **Example**
61
+ ```js
62
+ const orchestrator = create({
63
+ mqClient: new MQClient(),
64
+ registryClient: new RegistryClient(),
65
+ apiMapper: new ApiMapper(),
66
+ cookbook: new CookbookConnector()
67
+ });
68
+ ```
69
+ <a name="WorkflowOrchestrator"></a>
70
+
71
+ ## WorkflowOrchestrator
72
+ **Kind**: global class
73
+
74
+ * [WorkflowOrchestrator](#WorkflowOrchestrator)
75
+ * [new WorkflowOrchestrator()](#new_WorkflowOrchestrator_new)
76
+ * [new WorkflowOrchestrator(config)](#new_WorkflowOrchestrator_new)
77
+
78
+ <a name="new_WorkflowOrchestrator_new"></a>
79
+
80
+ ### new WorkflowOrchestrator()
81
+ Main orchestration class that coordinates all workflow execution.
82
+ Handles message routing, step execution, and workflow state management.
83
+
84
+ This is the core logic moved from service-wrapper's WorkflowProcessor to make
85
+ service-wrapper a true thin orchestration layer.
86
+
87
+ <a name="new_WorkflowOrchestrator_new"></a>
88
+
89
+ ### new WorkflowOrchestrator(config)
90
+ Create a new WorkflowOrchestrator instance
91
+
92
+
93
+ | Param | Type | Default | Description |
94
+ | --- | --- | --- | --- |
95
+ | config | <code>Object</code> | | Configuration object |
96
+ | config.mqClient | <code>Object</code> | | MQ client for message operations |
97
+ | config.registryClient | <code>Object</code> | | Registry client for service discovery |
98
+ | config.apiMapper | <code>Object</code> | | API mapper for cookbook to HTTP mapping |
99
+ | config.cookbook | <code>Object</code> | | Cookbook connector for validation and execution |
100
+ | [config.cache] | <code>Object</code> | | Cache connector for caching |
101
+ | [config.errorHandler] | <code>Object</code> | | Error handler connector |
102
+ | [config.logger] | <code>Object</code> | | Logger instance |
103
+ | [config.defaultTimeout] | <code>number</code> | <code>30000</code> | Default timeout for operations |
104
+
105
+ <a name="WorkflowOrchestrator"></a>
106
+
107
+ ## WorkflowOrchestrator
108
+ **Kind**: global class
109
+
110
+ * [WorkflowOrchestrator](#WorkflowOrchestrator)
111
+ * [new WorkflowOrchestrator()](#new_WorkflowOrchestrator_new)
112
+ * [new WorkflowOrchestrator(config)](#new_WorkflowOrchestrator_new)
113
+
114
+ <a name="new_WorkflowOrchestrator_new"></a>
115
+
116
+ ### new WorkflowOrchestrator()
117
+ Main orchestration class that coordinates all workflow execution.
118
+ Handles message routing, step execution, and workflow state management.
119
+
120
+ This is the core logic moved from service-wrapper's WorkflowProcessor to make
121
+ service-wrapper a true thin orchestration layer.
122
+
123
+ <a name="new_WorkflowOrchestrator_new"></a>
124
+
125
+ ### new WorkflowOrchestrator(config)
126
+ Create a new WorkflowOrchestrator instance
127
+
128
+
129
+ | Param | Type | Default | Description |
130
+ | --- | --- | --- | --- |
131
+ | config | <code>Object</code> | | Configuration object |
132
+ | config.mqClient | <code>Object</code> | | MQ client for message operations |
133
+ | config.registryClient | <code>Object</code> | | Registry client for service discovery |
134
+ | config.apiMapper | <code>Object</code> | | API mapper for cookbook to HTTP mapping |
135
+ | config.cookbook | <code>Object</code> | | Cookbook connector for validation and execution |
136
+ | [config.cache] | <code>Object</code> | | Cache connector for caching |
137
+ | [config.errorHandler] | <code>Object</code> | | Error handler connector |
138
+ | [config.logger] | <code>Object</code> | | Logger instance |
139
+ | [config.defaultTimeout] | <code>number</code> | <code>30000</code> | Default timeout for operations |
140
+
141
+ <a name="processWorkflowMessage"></a>
142
+
143
+ ## processWorkflowMessage(message, serviceName) ⇒ <code>Promise.&lt;Object&gt;</code>
144
+ Process a workflow message
145
+
146
+ **Kind**: global function
147
+ **Returns**: <code>Promise.&lt;Object&gt;</code> - Processing result
148
+
149
+ | Param | Type | Description |
150
+ | --- | --- | --- |
151
+ | message | <code>Object</code> | Workflow message from queue |
152
+ | message.workflow_id | <code>string</code> | Workflow ID |
153
+ | message.cookbook | <code>Object</code> | Cookbook definition |
154
+ | message.current_step | <code>string</code> | Current step ID |
155
+ | message.context | <code>Object</code> | Workflow context |
156
+ | serviceName | <code>string</code> | Name of the service processing this |
157
+
158
+ **Example**
159
+ ```js
160
+ const result = await orchestrator.processWorkflowMessage({
161
+ workflow_id: 'wf-123',
162
+ cookbook: cookbookDef,
163
+ current_step: 'step1',
164
+ context: {}
165
+ }, 'hello-service');
166
+ ```
167
+ <a name="generateCookbook"></a>
168
+
169
+ ## generateCookbook(openApiSpec) ⇒ <code>Object</code>
170
+ Generate cookbook from OpenAPI spec (utility method)
171
+
172
+ **Kind**: global function
173
+ **Returns**: <code>Object</code> - Generated cookbook
174
+
175
+ | Param | Type | Description |
176
+ | --- | --- | --- |
177
+ | openApiSpec | <code>Object</code> | OpenAPI specification |
178
+
179
+ **Example**
180
+ ```js
181
+ const cookbook = orchestrator.generateCookbook(openApiSpec);
182
+ ```
183
+ <a name="transformResponse"></a>
184
+
185
+ ## transformResponse(response, mapping) ⇒ <code>Object</code>
186
+ Transform API response using cookbook mapping
187
+
188
+ **Kind**: global function
189
+ **Returns**: <code>Object</code> - Transformed response
190
+
191
+ | Param | Type | Description |
192
+ | --- | --- | --- |
193
+ | response | <code>Object</code> | API response |
194
+ | mapping | <code>Object</code> | Output mapping |
195
+