@onlineapps/cookbook-template-helpers 1.0.14 → 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.
Files changed (2) hide show
  1. package/README.md +25 -24
  2. package/package.json +2 -2
package/README.md CHANGED
@@ -65,38 +65,39 @@ Helpers jsou k dispozici při resolvování template proměnných:
65
65
 
66
66
  ## Integration
67
67
 
68
- Tyto helpery jsou v `@onlineapps/cookbook-executor` zapojené **jako výchozí**
69
- executor si je vyžádá sám a nic se předávat nemusí:
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:
70
79
 
71
80
  ```javascript
72
- const { CookbookExecutor } = require('@onlineapps/cookbook-executor');
81
+ // shared/connector/conn-orch-orchestrator/src/WorkflowOrchestrator.js:786
82
+ const helpers = this.cookbook?.templateHelpers || {};
83
+ const helperFn = helpers[helperName];
73
84
 
74
- // helpers se neuvádí executor použije tento balíček automaticky
75
- const executor = new CookbookExecutor(cookbook);
85
+ if (typeof helperFn !== 'function') {
86
+ throw new Error(`[WorkflowOrchestrator] Unknown template helper '${helperName}' - Expected helper to exist in cookbook.templateHelpers`);
87
+ }
76
88
  ```
77
89
 
78
- Volba `helpers` existuje jen jako **override** když ji předáš, výchozí sada se
79
- nepoužije a platí výhradně to, co jsi předal (viz `cookbook-executor/src/executor.js`,
80
- `const helpers = options.helpers || templateHelpers`). Pokud chceš výchozí helpery
81
- zachovat a jen přidat vlastní, musíš je do override sady zahrnout — viz níže.
82
-
83
- ## Adding 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.
84
92
 
85
- You can combine global helpers with custom helpers:
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
- ```javascript
88
- const templateHelpers = require('@onlineapps/cookbook-template-helpers');
89
- const customHelpers = require('./customHelpers');
97
+ ## Adding a Helper
90
98
 
91
- const allHelpers = {
92
- ...templateHelpers,
93
- ...customHelpers
94
- };
95
-
96
- const executor = new CookbookExecutor(cookbook, {
97
- helpers: allHelpers
98
- });
99
- ```
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`.
100
101
 
101
102
  ## Helper Function Requirements
102
103
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@onlineapps/cookbook-template-helpers",
3
- "version": "1.0.14",
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": "2.0.0"
22
+ "@onlineapps/content-resolver": "2.0.1"
23
23
  },
24
24
  "devDependencies": {
25
25
  "jest": "29.7.0"