@walkeros/core 4.0.0 → 4.1.0-next-1778155282668

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 CHANGED
@@ -51,57 +51,64 @@ import { assign, anonymizeIP, getMappingValue } from '@walkeros/core';
51
51
 
52
52
  ## Flow Configuration Syntax
53
53
 
54
- Flow configurations support three dynamic patterns for reusable,
55
- environment-aware configs:
54
+ Flow configurations support two dynamic patterns for reusable, environment-aware
55
+ configs:
56
56
 
57
- ### `$def.name` - Definition References
57
+ ### `$var.name` - Variable References
58
58
 
59
- Reference reusable configuration blocks defined in `definitions`:
59
+ Reference values defined in `variables`. Values can be scalars (string, number,
60
+ boolean), objects, arrays, or whole mapping templates. The reference may include
61
+ a deep path that walks the value:
60
62
 
61
63
  ```json
62
64
  {
63
- "definitions": {
65
+ "variables": {
66
+ "currency": "EUR",
67
+ "apiVersion": "v2",
64
68
  "itemsLoop": {
65
69
  "loop": ["nested", { "map": { "item_id": "data.id" } }]
66
- }
70
+ },
71
+ "api": { "version": "v2", "url": "https://api.example.com" }
67
72
  },
68
73
  "destinations": {
74
+ "api": {
75
+ "config": {
76
+ "endpoint": "https://api.example.com/$var.apiVersion/collect",
77
+ "defaultCurrency": "$var.currency"
78
+ }
79
+ },
69
80
  "ga4": {
70
81
  "config": {
71
82
  "mapping": {
72
83
  "order": {
73
84
  "complete": {
74
- "data": { "map": { "items": "$def.itemsLoop" } }
85
+ "data": { "map": { "items": "$var.itemsLoop" } }
75
86
  }
76
87
  }
77
88
  }
78
89
  }
79
- }
80
- }
81
- }
82
- ```
83
-
84
- ### `$var.name` - Variable References
85
-
86
- Reference variables defined in `variables` for config-level values:
87
-
88
- ```json
89
- {
90
- "variables": {
91
- "currency": "EUR",
92
- "apiVersion": "v2"
93
- },
94
- "destinations": {
95
- "api": {
90
+ },
91
+ "split": {
96
92
  "config": {
97
- "endpoint": "https://api.example.com/$var.apiVersion/collect",
98
- "defaultCurrency": "$var.currency"
93
+ "endpoint": "$var.api.url",
94
+ "version": "$var.api.version"
99
95
  }
100
96
  }
101
97
  }
102
98
  }
103
99
  ```
104
100
 
101
+ **Resolution rules:**
102
+
103
+ - A whole-string reference (`"$var.itemsLoop"`) replaces the value with the
104
+ variable's native type. Object, array, number, and boolean values are
105
+ preserved.
106
+ - An inline reference (`"Bearer $var.token"`) substitutes a scalar mid-string.
107
+ If the referenced variable resolves to an object or array, resolution throws;
108
+ only scalars (string, number, boolean) may be substituted inline.
109
+ - Variables may reference other variables. Resolution is recursive with cycle
110
+ detection, mirroring the `$flow` reference resolver.
111
+
105
112
  Variables can be defined at setup, flow, or source/destination level (higher
106
113
  specificity wins).
107
114