@onlineapps/cookbook-template-helpers 1.0.13 → 1.0.15
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/README.md +25 -20
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -65,34 +65,39 @@ Helpers jsou k dispozici při resolvování template proměnných:
|
|
|
65
65
|
|
|
66
66
|
## Integration
|
|
67
67
|
|
|
68
|
-
|
|
68
|
+
Tenhle balíček se do běhu nezapojuje sám a nikdo ho v běhové cestě nevyžaduje
|
|
69
|
+
přímo. Cesta je tříčlánková a jde vždy stejně:
|
|
70
|
+
|
|
71
|
+
1. balíček je závislostí `@onlineapps/conn-orch-cookbook`, který ho re-exportuje
|
|
72
|
+
jako plochý klíč `templateHelpers`
|
|
73
|
+
(`shared/connector/conn-orch-cookbook/src/index.js`);
|
|
74
|
+
2. `ServiceWrapper` injektuje **celý modul** `conn-orch-cookbook` do
|
|
75
|
+
orchestrátoru jako `config.cookbook`
|
|
76
|
+
(`shared/connector/service-wrapper/src/ServiceWrapper.js:1818`);
|
|
77
|
+
3. `WorkflowOrchestrator` si helper vyzvedne při rozvíjení `{{helper(...)}}`
|
|
78
|
+
ve vstupu kroku:
|
|
69
79
|
|
|
70
80
|
```javascript
|
|
71
|
-
|
|
72
|
-
const
|
|
81
|
+
// shared/connector/conn-orch-orchestrator/src/WorkflowOrchestrator.js:786
|
|
82
|
+
const helpers = this.cookbook?.templateHelpers || {};
|
|
83
|
+
const helperFn = helpers[helperName];
|
|
73
84
|
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
}
|
|
85
|
+
if (typeof helperFn !== 'function') {
|
|
86
|
+
throw new Error(`[WorkflowOrchestrator] Unknown template helper '${helperName}' - Expected helper to exist in cookbook.templateHelpers`);
|
|
87
|
+
}
|
|
77
88
|
```
|
|
78
89
|
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
You can combine global helpers with custom helpers:
|
|
90
|
+
Žádná volba `helpers` a žádný override neexistují: platí přesně to, co tenhle
|
|
91
|
+
balíček exportuje. Neznámý helper je tvrdá chyba, ne prázdná hodnota.
|
|
82
92
|
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
93
|
+
Živý cookbook, který touhle cestou prochází:
|
|
94
|
+
[`infra/api_doorman/cookbooks/tester-helpers.json`](../../../infra/api_doorman/cookbooks/tester-helpers.json)
|
|
95
|
+
— volá `normalizeString`, `webalizeString`, `string2file` i `file2string`.
|
|
86
96
|
|
|
87
|
-
|
|
88
|
-
...templateHelpers,
|
|
89
|
-
...customHelpers
|
|
90
|
-
};
|
|
97
|
+
## Adding a Helper
|
|
91
98
|
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
});
|
|
95
|
-
```
|
|
99
|
+
Nový helper se přidá **do tohoto balíčku** (a vydá se nová verze) — jinak se
|
|
100
|
+
k orchestrátoru nedostane, protože ten čte výhradně `cookbook.templateHelpers`.
|
|
96
101
|
|
|
97
102
|
## Helper Function Requirements
|
|
98
103
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@onlineapps/cookbook-template-helpers",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.15",
|
|
4
4
|
"description": "Template helper functions for cookbook variable resolution - string2file, file2string, and more",
|
|
5
5
|
"main": "src/index.js",
|
|
6
6
|
"scripts": {
|
|
@@ -19,7 +19,7 @@
|
|
|
19
19
|
"author": "OnlineApps",
|
|
20
20
|
"license": "PROPRIETARY",
|
|
21
21
|
"dependencies": {
|
|
22
|
-
"@onlineapps/content-resolver": "
|
|
22
|
+
"@onlineapps/content-resolver": "2.0.1"
|
|
23
23
|
},
|
|
24
24
|
"devDependencies": {
|
|
25
25
|
"jest": "29.7.0"
|