@onlineapps/conn-orch-cookbook 2.0.2 → 2.0.3

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/LICENSE CHANGED
File without changes
package/README.md CHANGED
@@ -1,10 +1,10 @@
1
- # @onlineapps/connector-cookbook
1
+ # @onlineapps/conn-orch-cookbook
2
2
 
3
3
  > Complete cookbook toolkit for ALL services - unified wrapper including core, executor, transformer, and router functionality
4
4
 
5
5
  ## 🚀 Version 2.0 - Major Update
6
6
 
7
- The `connector-cookbook` package (v2.0) is now a complete toolkit that combines all cookbook functionality in one unified package. This ensures architectural consistency across ALL services including infrastructure components like workflow_launcher.
7
+ The `conn-orch-cookbook` package (v2.0) is now a complete toolkit that combines all cookbook functionality in one unified package. This ensures architectural consistency across ALL services including infrastructure components like workflow_launcher.
8
8
 
9
9
  ### What's New in v2.0
10
10
 
@@ -24,9 +24,9 @@ Per architectural decision, ALL services including workflow_launcher use this si
24
24
  ## 📦 Installation
25
25
 
26
26
  ```bash
27
- npm install @onlineapps/connector-cookbook
27
+ npm install @onlineapps/conn-orch-cookbook
28
28
  # or
29
- yarn add @onlineapps/connector-cookbook
29
+ yarn add @onlineapps/conn-orch-cookbook
30
30
  ```
31
31
 
32
32
  ## 🔧 Quick Start
@@ -37,7 +37,7 @@ yarn add @onlineapps/connector-cookbook
37
37
  const {
38
38
  parseCookbookFromFile,
39
39
  validateCookbook
40
- } = require('@onlineapps/connector-cookbook');
40
+ } = require('@onlineapps/conn-orch-cookbook');
41
41
 
42
42
  // Works exactly as before
43
43
  const cookbook = await parseCookbookFromFile('./workflow.json');
@@ -47,7 +47,7 @@ validateCookbook(cookbook);
47
47
  ### New Modular Approach (v2.0)
48
48
 
49
49
  ```javascript
50
- const cookbook = require('@onlineapps/connector-cookbook');
50
+ const cookbook = require('@onlineapps/conn-orch-cookbook');
51
51
 
52
52
  // Use specific modules
53
53
  const { CookbookExecutor } = cookbook.executor;
@@ -92,9 +92,9 @@ const processor = cookbook.createProcessor({
92
92
  ### Complete Service Implementation
93
93
 
94
94
  ```javascript
95
- const cookbook = require('@onlineapps/connector-cookbook');
96
- const MQClient = require('@onlineapps/connector-mq-client');
97
- const RegistryClient = require('@onlineapps/connector-registry-client');
95
+ const cookbook = require('@onlineapps/conn-orch-cookbook');
96
+ const MQClient = require('@onlineapps/conn-infra-mq');
97
+ const RegistryClient = require('@onlineapps/conn-orch-registry');
98
98
 
99
99
  class MyService {
100
100
  constructor() {
@@ -133,7 +133,7 @@ class MyService {
133
133
 
134
134
  ```javascript
135
135
  // workflow_launcher uses the SAME package
136
- const cookbook = require('@onlineapps/connector-cookbook');
136
+ const cookbook = require('@onlineapps/conn-orch-cookbook');
137
137
 
138
138
  class WorkflowLauncher {
139
139
  async handleWorkflowInit(message) {
@@ -152,7 +152,7 @@ class WorkflowLauncher {
152
152
  ### OpenAPI Integration
153
153
 
154
154
  ```javascript
155
- const { CookbookGenerator } = require('@onlineapps/connector-cookbook');
155
+ const { CookbookGenerator } = require('@onlineapps/conn-orch-cookbook');
156
156
 
157
157
  const generator = new CookbookGenerator({
158
158
  defaultTimeout: 10000,
@@ -208,13 +208,54 @@ All 7 step types are fully supported:
208
208
  - **wait** - Time delays
209
209
  - **dispatch** - Webhook dispatching
210
210
 
211
+ ## 📤 Delivery Block (v2.1)
212
+
213
+ Cookbook nově může definovat top-level sekci `delivery`, která popisuje způsob
214
+ doručení výsledku klientovi:
215
+
216
+ ```json
217
+ "delivery": {
218
+ "handler": "dispatcher",
219
+ "allow_skip": false,
220
+ "destinations": [
221
+ {
222
+ "type": "webhook",
223
+ "url": "https://client.example.com/api/callback",
224
+ "method": "POST",
225
+ "retry": {
226
+ "max_attempts": 5,
227
+ "delay_ms": 3000
228
+ }
229
+ },
230
+ {
231
+ "type": "public_url",
232
+ "path": "result/${context.workflow_id}/invoice.pdf",
233
+ "ttl_seconds": 86400,
234
+ "access": "signed"
235
+ }
236
+ ],
237
+ "output": {
238
+ "workflow_id": "${context.workflow_id}",
239
+ "invoice_id": "${steps.invoice_step.output.invoice_id}"
240
+ }
241
+ }
242
+ ```
243
+
244
+ - `handler`: `dispatcher` (výchozí), `service_step`, nebo `none`.
245
+ - `destinations`: konkrétní výstupy (`webhook`, `websocket`, `public_url`).
246
+ - `output`: mapování hodnot, které se mají doručit.
247
+
248
+ Detailní specifikace viz
249
+ [Schema Final Specification](/shared/cookbook/cookbook-core/docs/SCHEMA_FINAL_SPECIFICATION.md#11-delivery-blok)
250
+ nebo [API Delivery Dispatcher](../../../docs/architecture/api-delivery-dispatcher.md).
251
+
211
252
  ## 🔄 Migration from v1.x
212
253
 
213
254
  Version 2.0 maintains full backward compatibility. Existing code continues to work without changes:
214
255
 
215
256
  ```javascript
216
257
  // This still works exactly as before
217
- const { parseCookbookFromFile } = require('@onlineapps/connector-cookbook');
258
+ const { parseCookbookFromFile } = require('@onlineapps/conn-orch-cookbook');
218
259
  const cookbook = await parseCookbookFromFile('./workflow.json');
219
260
  ```
220
261
 
@@ -222,7 +263,7 @@ To access new features, use the modular exports:
222
263
 
223
264
  ```javascript
224
265
  // New modular approach
225
- const { executor, router, transformer } = require('@onlineapps/connector-cookbook');
266
+ const { executor, router, transformer } = require('@onlineapps/conn-orch-cookbook');
226
267
  ```
227
268
 
228
269
  ## 📋 API Reference
@@ -0,0 +1,117 @@
1
+ # Cookbook Connector - Detailed API Documentation
2
+
3
+ ## API Methods
4
+
5
+ ### CookbookConnector Class
6
+
7
+ ```javascript
8
+ class CookbookConnector {
9
+ validateCookbook(cookbook) // Validates entire cookbook
10
+ getCurrentStep(cookbook, stepIndex) // Returns current step details
11
+ getNextStepIndex(cookbook, currentIndex, results) // Determines next step
12
+ evaluateCondition(condition, context) // For conditional flows
13
+ expandForeach(foreachStep, items) // Expands foreach into steps
14
+ }
15
+ ```
16
+
17
+ ## What it DOES
18
+
19
+ - Parses cookbook JSON structure
20
+ - Validates cookbook schema
21
+ - Extracts step information (service, operation, params)
22
+ - Determines step sequence (next, previous)
23
+ - Handles control flow logic (if, foreach, fork_join)
24
+
25
+ ## What it DOES NOT do
26
+
27
+ - Does NOT execute operations
28
+ - Does NOT make HTTP calls
29
+ - Does NOT route messages
30
+ - Does NOT handle errors
31
+
32
+ ## Usage Example
33
+
34
+ ```javascript
35
+ const { CookbookConnector } = require('@onlineapps/conn-orch-cookbook');
36
+
37
+ const connector = new CookbookConnector();
38
+
39
+ // Validate cookbook
40
+ const isValid = await connector.validateCookbook(cookbook);
41
+
42
+ // Get current step
43
+ const step = connector.getCurrentStep(cookbook, 0);
44
+ // Returns: { service: 'hello-service', operation: 'greet', params: {...} }
45
+
46
+ // Determine next step based on results
47
+ const nextIndex = connector.getNextStepIndex(cookbook, 0, stepResults);
48
+ // Returns: 1 (or -1 if workflow complete)
49
+
50
+ // Evaluate conditional logic
51
+ const shouldProceed = connector.evaluateCondition(
52
+ step.condition,
53
+ { result: stepResults }
54
+ );
55
+
56
+ // Expand foreach into multiple steps
57
+ const expandedSteps = connector.expandForeach(foreachStep, itemArray);
58
+ ```
59
+
60
+ ## Control Flow Patterns
61
+
62
+ ### Sequential Execution
63
+ ```javascript
64
+ steps: [
65
+ { service: 'service1', operation: 'op1' },
66
+ { service: 'service2', operation: 'op2' },
67
+ { service: 'service3', operation: 'op3' }
68
+ ]
69
+ ```
70
+
71
+ ### Conditional Execution
72
+ ```javascript
73
+ {
74
+ service: 'service1',
75
+ operation: 'check',
76
+ condition: 'result.status === "approved"',
77
+ next_if_true: 'approve_step',
78
+ next_if_false: 'reject_step'
79
+ }
80
+ ```
81
+
82
+ ### Parallel Execution (Fork-Join)
83
+ ```javascript
84
+ {
85
+ type: 'fork_join',
86
+ parallel_steps: [
87
+ { service: 'service1', operation: 'op1' },
88
+ { service: 'service2', operation: 'op2' },
89
+ { service: 'service3', operation: 'op3' }
90
+ ],
91
+ join_strategy: 'all' // or 'any', 'threshold'
92
+ }
93
+ ```
94
+
95
+ ### Iteration (Foreach)
96
+ ```javascript
97
+ {
98
+ type: 'foreach',
99
+ items: 'context.items',
100
+ step_template: {
101
+ service: 'processor',
102
+ operation: 'process_item',
103
+ params: { item: '{{current_item}}' }
104
+ }
105
+ }
106
+ ```
107
+
108
+ ## Error Handling
109
+
110
+ The connector validates but does NOT handle errors. Error handling is done by:
111
+ - `conn-infra-error-handler` for error classification
112
+ - Service wrapper for retry logic
113
+ - MQ connector for DLQ routing
114
+
115
+ ## Testing
116
+
117
+ See test examples in `/test/unit/` and `/test/integration/` directories.
File without changes
File without changes
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@onlineapps/conn-orch-cookbook",
3
- "version": "2.0.2",
3
+ "version": "2.0.3",
4
4
  "description": "Complete cookbook toolkit for all services - unified wrapper including core, executor, transformer, and router functionality",
5
5
  "main": "src/index.js",
6
6
  "repository": {
@@ -20,8 +20,8 @@
20
20
  "test:unit": "jest --testPathPattern=unit --coverage",
21
21
  "test:component": "jest --testPathPattern=component --coverage",
22
22
  "test:integration": "jest --testPathPattern=integration --coverage",
23
- "test:fixtures": "jest test/integration/cookbook-fixtures.test.js",
24
- "test:smoke": "jest test/smoke.test.js",
23
+ "test:fixtures": "jest tests/integration/cookbook-fixtures.test.js",
24
+ "test:smoke": "jest tests/smoke.test.js",
25
25
  "test:watch": "jest --watch",
26
26
  "test:coverage": "jest --coverage --coverageReporters=text-lcov html",
27
27
  "lint": "eslint \"src/**/*.js\" \"tests/**/*.js\"",
@@ -49,7 +49,7 @@
49
49
  "@onlineapps/cookbook-core": "^2.0.0",
50
50
  "@onlineapps/cookbook-executor": "^1.0.0",
51
51
  "@onlineapps/cookbook-router": "^1.0.0",
52
- "@onlineapps/cookbook-transformer": "^1.0.0",
52
+ "@onlineapps/cookbook-transformer": "1.1.0",
53
53
  "jsonpath": "^1.1.1"
54
54
  },
55
55
  "devDependencies": {
package/src/index.js CHANGED
File without changes