@walkeros/cli 2.2.0-next-1773136823705 → 3.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/dist/cli.js CHANGED
@@ -10,151 +10,196 @@ var __export = (target, all) => {
10
10
  };
11
11
 
12
12
  // ../core/dist/index.mjs
13
- function O(e4, t2) {
13
+ function O(e4) {
14
+ throw new Error(String(e4));
15
+ }
16
+ function S(e4) {
17
+ const t2 = {}, n3 = /* @__PURE__ */ new Set();
18
+ function o2(r2) {
19
+ if (t2[r2]) return t2[r2];
20
+ n3.has(r2) && O(`Circular extends chain detected: ${[...n3, r2].join(" \u2192 ")}`);
21
+ const s3 = e4[r2];
22
+ s3 || O(`Contract "${r2}" not found`), n3.add(r2);
23
+ let i2 = {};
24
+ if (s3.extends) {
25
+ i2 = (function(e5, t3) {
26
+ const n4 = {};
27
+ void 0 === e5.tagging && void 0 === t3.tagging || (n4.tagging = t3.tagging ?? e5.tagging);
28
+ void 0 === e5.description && void 0 === t3.description || (n4.description = t3.description ?? e5.description);
29
+ for (const o3 of x) {
30
+ const r3 = e5[o3], s4 = t3[o3];
31
+ r3 && s4 ? n4[o3] = A(r3, s4) : (r3 || s4) && (n4[o3] = { ...r3 || s4 });
32
+ }
33
+ if (e5.events || t3.events) {
34
+ const o3 = {}, r3 = /* @__PURE__ */ new Set([...Object.keys(e5.events || {}), ...Object.keys(t3.events || {})]);
35
+ for (const n5 of r3) {
36
+ const r4 = e5.events?.[n5] || {}, s4 = t3.events?.[n5] || {}, i3 = /* @__PURE__ */ new Set([...Object.keys(r4), ...Object.keys(s4)]);
37
+ o3[n5] = {};
38
+ for (const e6 of i3) {
39
+ const t4 = r4[e6], i4 = s4[e6];
40
+ o3[n5][e6] = t4 && i4 ? A(t4, i4) : { ...t4 || i4 };
41
+ }
42
+ }
43
+ n4.events = o3;
44
+ }
45
+ return n4;
46
+ })(o2(s3.extends), s3);
47
+ } else i2 = { ...s3 };
48
+ if (delete i2.extends, i2.events && (i2.events = (function(e5) {
49
+ const t3 = {};
50
+ for (const n4 of Object.keys(e5)) if ("*" !== n4) {
51
+ t3[n4] = {};
52
+ for (const o3 of Object.keys(e5[n4] || {})) {
53
+ let r3 = {};
54
+ const s4 = e5["*"]?.["*"];
55
+ s4 && (r3 = A(r3, s4));
56
+ const i3 = e5["*"]?.[o3];
57
+ i3 && "*" !== o3 && (r3 = A(r3, i3));
58
+ const c3 = e5[n4]?.["*"];
59
+ c3 && "*" !== o3 && (r3 = A(r3, c3));
60
+ const a3 = e5[n4]?.[o3];
61
+ a3 && (r3 = A(r3, a3)), t3[n4][o3] = r3;
62
+ }
63
+ }
64
+ e5["*"] && (t3["*"] = { ...e5["*"] });
65
+ return t3;
66
+ })(i2.events)), i2.events) {
67
+ const e5 = {};
68
+ for (const [t3, n4] of Object.entries(i2.events)) {
69
+ e5[t3] = {};
70
+ for (const [o3, r3] of Object.entries(n4)) e5[t3][o3] = E(r3);
71
+ }
72
+ i2.events = e5;
73
+ }
74
+ return n3.delete(r2), t2[r2] = i2, i2;
75
+ }
76
+ for (const t3 of Object.keys(e4)) o2(t3);
77
+ return t2;
78
+ }
79
+ function A(e4, t2) {
14
80
  const n3 = { ...e4 };
15
81
  for (const o2 of Object.keys(t2)) {
16
- const r2 = e4[o2], i2 = t2[o2];
17
- "required" === o2 && Array.isArray(r2) && Array.isArray(i2) ? n3[o2] = [.../* @__PURE__ */ new Set([...r2, ...i2])] : S(r2) && S(i2) ? n3[o2] = O(r2, i2) : n3[o2] = i2;
82
+ const r2 = e4[o2], s3 = t2[o2];
83
+ "required" === o2 && Array.isArray(r2) && Array.isArray(s3) ? n3[o2] = [.../* @__PURE__ */ new Set([...r2, ...s3])] : N(r2) && N(s3) ? n3[o2] = A(r2, s3) : n3[o2] = s3;
18
84
  }
19
85
  return n3;
20
86
  }
21
- function $(e4, t2, n3, o2) {
22
- let r2 = {};
23
- for (const i2 of [e4, o2]) {
24
- if (!i2) continue;
25
- const e5 = [x(i2, "*", "*"), x(i2, "*", n3), x(i2, t2, "*"), x(i2, t2, n3)];
26
- for (const t3 of e5) t3 && (r2 = O(r2, t3));
27
- }
28
- return r2;
29
- }
30
- function x(e4, t2, n3) {
31
- const o2 = e4[t2];
32
- if (!o2 || "object" != typeof o2) return;
33
- const r2 = o2[n3];
34
- return r2 && "object" == typeof r2 ? r2 : void 0;
87
+ function E(e4) {
88
+ const t2 = {};
89
+ for (const [n3, o2] of Object.entries(e4)) $.has(n3) || (null === o2 || "object" != typeof o2 || Array.isArray(o2) ? t2[n3] = o2 : t2[n3] = E(o2));
90
+ return t2;
35
91
  }
36
- function S(e4) {
92
+ function N(e4) {
37
93
  return "object" == typeof e4 && null !== e4 && !Array.isArray(e4);
38
94
  }
39
- function E(e4) {
40
- throw new Error(String(e4));
41
- }
42
- function A(...e4) {
95
+ function P(...e4) {
43
96
  const t2 = {};
44
97
  for (const n3 of e4) n3 && Object.assign(t2, n3);
45
98
  return t2;
46
99
  }
47
- function N(...e4) {
100
+ function _(...e4) {
48
101
  const t2 = {};
49
102
  for (const n3 of e4) n3 && Object.assign(t2, n3);
50
103
  return t2;
51
104
  }
52
- function P(e4, t2, n3, o2) {
53
- if ("string" == typeof e4) {
54
- const r2 = e4.match(/^\$def\.([a-zA-Z_][a-zA-Z0-9_]*)$/);
55
- if (r2) {
56
- const e5 = r2[1];
57
- return void 0 === n3[e5] && E(`Definition "${e5}" not found`), P(n3[e5], t2, n3, o2);
105
+ function C(e4, t2, n3) {
106
+ const o2 = t2.split(".");
107
+ let r2 = e4;
108
+ for (let e5 = 0; e5 < o2.length; e5++) {
109
+ const s3 = o2[e5];
110
+ if (null == r2 || "object" != typeof r2) {
111
+ const r3 = o2.slice(0, e5).join(".");
112
+ O(`Path "${t2}" not found in "${n3}": "${s3}" does not exist${r3 ? ` in "${r3}"` : ""}`);
113
+ }
114
+ const i2 = r2;
115
+ if (!(s3 in i2)) {
116
+ const r3 = o2.slice(0, e5).join(".");
117
+ O(`Path "${t2}" not found in "${n3}": "${s3}" does not exist${r3 ? ` in "${r3}"` : ""}`);
58
118
  }
59
- let i2 = e4.replace(/\$var\.([a-zA-Z_][a-zA-Z0-9_]*)/g, (e5, n4) => {
119
+ r2 = i2[s3];
120
+ }
121
+ return r2;
122
+ }
123
+ function R(e4, t2, n3, o2, r2) {
124
+ if ("string" == typeof e4) {
125
+ const s3 = e4.match(/^\$def\.([a-zA-Z_][a-zA-Z0-9_]*)(?:\.(.+))?$/);
126
+ if (s3) {
127
+ const e5 = s3[1], i3 = s3[2];
128
+ void 0 === n3[e5] && O(`Definition "${e5}" not found`);
129
+ let c4 = R(n3[e5], t2, n3, o2, r2);
130
+ return i3 && (c4 = C(c4, i3, `$def.${e5}`)), c4;
131
+ }
132
+ const i2 = e4.match(/^\$contract\.([a-zA-Z_][a-zA-Z0-9_]*)(?:\.(.+))?$/);
133
+ if (i2 && r2) {
134
+ const e5 = i2[1], t3 = i2[2];
135
+ e5 in r2 || O(`Contract "${e5}" not found`);
136
+ let n4 = r2[e5];
137
+ return t3 && (n4 = C(n4, t3, `$contract.${e5}`)), n4;
138
+ }
139
+ let c3 = e4.replace(/\$var\.([a-zA-Z_][a-zA-Z0-9_]*)/g, (e5, n4) => {
60
140
  if (void 0 !== t2[n4]) return String(t2[n4]);
61
- E(`Variable "${n4}" not found`);
141
+ O(`Variable "${n4}" not found`);
62
142
  });
63
- return i2 = i2.replace(/\$env\.([a-zA-Z_][a-zA-Z0-9_]*)(?::([^"}\s]*))?/g, (e5, t3, n4) => o2?.deferred ? void 0 !== n4 ? `${T}${t3}:${n4}` : `${T}${t3}` : "undefined" != typeof process && void 0 !== process.env?.[t3] ? process.env[t3] : void 0 !== n4 ? n4 : void E(`Environment variable "${t3}" not found and no default provided`)), i2;
143
+ return c3 = c3.replace(/\$env\.([a-zA-Z_][a-zA-Z0-9_]*)(?::([^"}\s]*))?/g, (e5, t3, n4) => o2?.deferred ? void 0 !== n4 ? `${T}${t3}:${n4}` : `${T}${t3}` : "undefined" != typeof process && void 0 !== process.env?.[t3] ? process.env[t3] : void 0 !== n4 ? n4 : void O(`Environment variable "${t3}" not found and no default provided`)), c3;
64
144
  }
65
- if (Array.isArray(e4)) return e4.map((e5) => P(e5, t2, n3, o2));
145
+ if (Array.isArray(e4)) return e4.map((e5) => R(e5, t2, n3, o2, r2));
66
146
  if (null !== e4 && "object" == typeof e4) {
67
- const r2 = {};
68
- for (const [i2, s3] of Object.entries(e4)) r2[i2] = P(s3, t2, n3, o2);
69
- return r2;
147
+ const s3 = {};
148
+ for (const [i2, c3] of Object.entries(e4)) s3[i2] = R(c3, t2, n3, o2, r2);
149
+ return s3;
70
150
  }
71
151
  return e4;
72
152
  }
73
- function _(e4) {
153
+ function M(e4) {
74
154
  const t2 = e4.startsWith("@"), n3 = e4.replace("@", "").replace(/[/-]/g, "_").split("_").filter((e5) => e5.length > 0).map((e5, t3) => 0 === t3 ? e5 : e5.charAt(0).toUpperCase() + e5.slice(1)).join("");
75
155
  return t2 ? "_" + n3 : n3;
76
156
  }
77
- function R(e4, t2, n3) {
157
+ function z(e4, t2, n3) {
78
158
  if (t2) return t2;
79
159
  if (!e4 || !n3) return;
80
- return n3[e4] ? _(e4) : void 0;
160
+ return n3[e4] ? M(e4) : void 0;
81
161
  }
82
- function C(e4, t2, n3) {
162
+ function H(e4, t2, n3) {
83
163
  const o2 = Object.keys(e4.flows);
84
- t2 || (1 === o2.length ? t2 = o2[0] : E(`Multiple flows found (${o2.join(", ")}). Please specify a flow.`));
164
+ t2 || (1 === o2.length ? t2 = o2[0] : O(`Multiple flows found (${o2.join(", ")}). Please specify a flow.`));
85
165
  const r2 = e4.flows[t2];
86
- r2 || E(`Flow "${t2}" not found. Available: ${o2.join(", ")}`);
87
- const i2 = JSON.parse(JSON.stringify(r2));
88
- if (i2.sources) for (const [t3, o3] of Object.entries(i2.sources)) {
89
- const s4 = A(e4.variables, r2.variables, o3.variables), c3 = N(e4.definitions, r2.definitions, o3.definitions), a3 = P(o3.config, s4, c3, n3), u4 = P(o3.env, s4, c3, n3), f2 = R(o3.package, o3.code, i2.packages), l2 = "string" == typeof o3.code || "object" == typeof o3.code ? o3.code : void 0, p2 = f2 || l2;
90
- i2.sources[t3] = { package: o3.package, config: a3, env: u4, primary: o3.primary, variables: o3.variables, definitions: o3.definitions, next: o3.next, code: p2 };
91
- }
92
- if (i2.destinations) for (const [t3, o3] of Object.entries(i2.destinations)) {
93
- const s4 = A(e4.variables, r2.variables, o3.variables), c3 = N(e4.definitions, r2.definitions, o3.definitions), a3 = P(o3.config, s4, c3, n3), u4 = P(o3.env, s4, c3, n3), f2 = R(o3.package, o3.code, i2.packages), l2 = "string" == typeof o3.code || "object" == typeof o3.code ? o3.code : void 0, p2 = f2 || l2;
94
- i2.destinations[t3] = { package: o3.package, config: a3, env: u4, variables: o3.variables, definitions: o3.definitions, before: o3.before, code: p2 };
95
- }
96
- if (i2.stores) for (const [t3, o3] of Object.entries(i2.stores)) {
97
- const s4 = A(e4.variables, r2.variables, o3.variables), c3 = N(e4.definitions, r2.definitions, o3.definitions), a3 = P(o3.config, s4, c3, n3), u4 = P(o3.env, s4, c3, n3), f2 = R(o3.package, o3.code, i2.packages), l2 = "string" == typeof o3.code || "object" == typeof o3.code ? o3.code : void 0, p2 = f2 || l2;
98
- i2.stores[t3] = { package: o3.package, config: a3, env: u4, variables: o3.variables, definitions: o3.definitions, code: p2 };
99
- }
100
- if (i2.transformers) for (const [t3, o3] of Object.entries(i2.transformers)) {
101
- const s4 = A(e4.variables, r2.variables, o3.variables), c3 = N(e4.definitions, r2.definitions, o3.definitions), a3 = P(o3.config, s4, c3, n3), u4 = P(o3.env, s4, c3, n3), f2 = R(o3.package, o3.code, i2.packages), l2 = "string" == typeof o3.code || "object" == typeof o3.code ? o3.code : void 0, p2 = f2 || l2;
102
- i2.transformers[t3] = { package: o3.package, config: a3, env: u4, variables: o3.variables, definitions: o3.definitions, next: o3.next, code: p2 };
103
- }
104
- if (i2.collector) {
105
- const t3 = A(e4.variables, r2.variables), o3 = N(e4.definitions, r2.definitions), s4 = P(i2.collector, t3, o3, n3);
106
- i2.collector = s4;
107
- }
108
- const s3 = e4.contract, c2 = r2.contract;
109
- if (s3 || c2) {
110
- const e5 = (function(...e6) {
111
- const t4 = /* @__PURE__ */ new Set();
112
- for (const n6 of e6) if (n6) for (const e7 of Object.keys(n6)) {
113
- if (e7.startsWith("$")) continue;
114
- const o4 = n6[e7];
115
- if (o4 && "object" == typeof o4) for (const n7 of Object.keys(o4)) "*" !== n7 && t4.add(`${e7}\0${n7}`);
116
- }
117
- const n5 = /* @__PURE__ */ new Set(), o3 = /* @__PURE__ */ new Set();
118
- for (const t5 of e6) if (t5) for (const e7 of Object.keys(t5)) {
119
- if (e7.startsWith("$") || "*" === e7) continue;
120
- n5.add(e7);
121
- const r3 = t5[e7];
122
- if (r3 && "object" == typeof r3) for (const e8 of Object.keys(r3)) "*" !== e8 && o3.add(e8);
123
- }
124
- for (const e7 of n5) for (const n6 of o3) t4.add(`${e7}\0${n6}`);
125
- return [...t4].map((e7) => e7.split("\0"));
126
- })(s3, c2), t3 = {};
127
- for (const [n5, o3] of e5) {
128
- const e6 = $(s3 || {}, n5, o3, c2);
129
- Object.keys(e6).length > 0 && (t3[n5] || (t3[n5] = {}), t3[n5][o3] = { schema: W(e6) });
130
- }
131
- if (i2.transformers) for (const [, e6] of Object.entries(i2.transformers)) z(e6.config, t3);
132
- const n4 = s3?.$tagging ?? c2?.$tagging;
133
- if ("number" == typeof n4) {
134
- const e6 = i2.collector || {};
135
- void 0 === e6.tagging && (e6.tagging = n4), i2.collector = e6;
136
- }
166
+ r2 || O(`Flow "${t2}" not found. Available: ${o2.join(", ")}`);
167
+ const s3 = JSON.parse(JSON.stringify(r2));
168
+ let i2;
169
+ if (e4.contract) {
170
+ const t3 = P(e4.variables, r2.variables), o3 = _(e4.definitions, r2.definitions);
171
+ i2 = S(R(e4.contract, t3, o3, n3));
137
172
  }
138
- return i2;
139
- }
140
- function W(e4) {
141
- const t2 = {};
142
- for (const [n3, o2] of Object.entries(e4)) M.has(n3) || (null === o2 || "object" != typeof o2 || Array.isArray(o2) ? t2[n3] = o2 : t2[n3] = W(o2));
143
- return t2;
144
- }
145
- function z(e4, t2) {
146
- if (!e4 || "object" != typeof e4) return;
147
- const n3 = e4;
148
- for (const e5 of Object.keys(n3)) "$contract" === n3[e5] ? n3[e5] = t2 : "object" == typeof n3[e5] && null !== n3[e5] && z(n3[e5], t2);
173
+ if (s3.sources) for (const [t3, o3] of Object.entries(s3.sources)) {
174
+ const c3 = P(e4.variables, r2.variables, o3.variables), a3 = _(e4.definitions, r2.definitions, o3.definitions), u3 = R(o3.config, c3, a3, n3, i2), f2 = R(o3.env, c3, a3, n3, i2), l2 = z(o3.package, o3.code, s3.packages), p2 = "string" == typeof o3.code || "object" == typeof o3.code ? o3.code : void 0, d2 = l2 || p2;
175
+ s3.sources[t3] = { package: o3.package, config: u3, env: f2, primary: o3.primary, variables: o3.variables, definitions: o3.definitions, next: o3.next, code: d2 };
176
+ }
177
+ if (s3.destinations) for (const [t3, o3] of Object.entries(s3.destinations)) {
178
+ const c3 = P(e4.variables, r2.variables, o3.variables), a3 = _(e4.definitions, r2.definitions, o3.definitions), u3 = R(o3.config, c3, a3, n3, i2), f2 = R(o3.env, c3, a3, n3, i2), l2 = z(o3.package, o3.code, s3.packages), p2 = "string" == typeof o3.code || "object" == typeof o3.code ? o3.code : void 0, d2 = l2 || p2;
179
+ s3.destinations[t3] = { package: o3.package, config: u3, env: f2, variables: o3.variables, definitions: o3.definitions, before: o3.before, code: d2 };
180
+ }
181
+ if (s3.stores) for (const [t3, o3] of Object.entries(s3.stores)) {
182
+ const c3 = P(e4.variables, r2.variables, o3.variables), a3 = _(e4.definitions, r2.definitions, o3.definitions), u3 = R(o3.config, c3, a3, n3, i2), f2 = R(o3.env, c3, a3, n3, i2), l2 = z(o3.package, o3.code, s3.packages), p2 = "string" == typeof o3.code || "object" == typeof o3.code ? o3.code : void 0, d2 = l2 || p2;
183
+ s3.stores[t3] = { package: o3.package, config: u3, env: f2, variables: o3.variables, definitions: o3.definitions, code: d2 };
184
+ }
185
+ if (s3.transformers) for (const [t3, o3] of Object.entries(s3.transformers)) {
186
+ const c3 = P(e4.variables, r2.variables, o3.variables), a3 = _(e4.definitions, r2.definitions, o3.definitions), u3 = R(o3.config, c3, a3, n3, i2), f2 = R(o3.env, c3, a3, n3, i2), l2 = z(o3.package, o3.code, s3.packages), p2 = "string" == typeof o3.code || "object" == typeof o3.code ? o3.code : void 0, d2 = l2 || p2;
187
+ s3.transformers[t3] = { package: o3.package, config: u3, env: f2, variables: o3.variables, definitions: o3.definitions, next: o3.next, code: d2 };
188
+ }
189
+ if (s3.collector) {
190
+ const t3 = P(e4.variables, r2.variables), o3 = _(e4.definitions, r2.definitions), c3 = R(s3.collector, t3, o3, n3, i2);
191
+ s3.collector = c3;
192
+ }
193
+ return s3;
149
194
  }
150
195
  function D(e4) {
151
- return void 0 !== e4.web ? "web" : void 0 !== e4.server ? "server" : void E("Settings must have web or server key");
196
+ return void 0 !== e4.web ? "web" : void 0 !== e4.server ? "server" : void O("Settings must have web or server key");
152
197
  }
153
- function I(e4, t2 = {}, n3 = {}) {
154
- n3 = { ...H, ...n3 };
198
+ function W(e4, t2 = {}, n3 = {}) {
199
+ n3 = { ...I, ...n3 };
155
200
  const o2 = Object.entries(t2).reduce((t3, [o3, r2]) => {
156
- const i2 = e4[o3];
157
- return n3.merge && Array.isArray(i2) && Array.isArray(r2) ? t3[o3] = r2.reduce((e5, t4) => e5.includes(t4) ? e5 : [...e5, t4], [...i2]) : (n3.extend || o3 in e4) && (t3[o3] = r2), t3;
201
+ const s3 = e4[o3];
202
+ return n3.merge && Array.isArray(s3) && Array.isArray(r2) ? t3[o3] = r2.reduce((e5, t4) => e5.includes(t4) ? e5 : [...e5, t4], [...s3]) : (n3.extend || o3 in e4) && (t3[o3] = r2), t3;
158
203
  }, {});
159
204
  return n3.shallow ? { ...e4, ...o2 } : (Object.assign(e4, o2), e4);
160
205
  }
@@ -164,10 +209,10 @@ function U(e4) {
164
209
  function L(e4) {
165
210
  return "boolean" == typeof e4;
166
211
  }
167
- function B(e4) {
212
+ function V(e4) {
168
213
  return void 0 !== e4;
169
214
  }
170
- function Z(e4) {
215
+ function J(e4) {
171
216
  return "function" == typeof e4;
172
217
  }
173
218
  function K(e4) {
@@ -208,46 +253,46 @@ function Y(e4, t2 = "", n3) {
208
253
  for (let e5 = 0; e5 < o2.length; e5++) {
209
254
  const t3 = o2[e5];
210
255
  if ("*" === t3 && U(r2)) {
211
- const t4 = o2.slice(e5 + 1).join("."), i2 = [];
256
+ const t4 = o2.slice(e5 + 1).join("."), s3 = [];
212
257
  for (const e6 of r2) {
213
258
  const o3 = Y(e6, t4, n3);
214
- i2.push(o3);
259
+ s3.push(o3);
215
260
  }
216
- return i2;
261
+ return s3;
217
262
  }
218
263
  if (r2 = r2 instanceof Object ? r2[t3] : void 0, void 0 === r2) break;
219
264
  }
220
- return B(r2) ? r2 : n3;
265
+ return V(r2) ? r2 : n3;
221
266
  }
222
267
  function ee(e4, t2, n3) {
223
268
  if (!q(e4)) return e4;
224
269
  const o2 = Q(e4), r2 = t2.split(".");
225
- let i2 = o2;
270
+ let s3 = o2;
226
271
  for (let e5 = 0; e5 < r2.length; e5++) {
227
272
  const t3 = r2[e5];
228
- e5 === r2.length - 1 ? i2[t3] = n3 : (t3 in i2 && "object" == typeof i2[t3] && null !== i2[t3] || (i2[t3] = {}), i2 = i2[t3]);
273
+ e5 === r2.length - 1 ? s3[t3] = n3 : (t3 in s3 && "object" == typeof s3[t3] && null !== s3[t3] || (s3[t3] = {}), s3 = s3[t3]);
229
274
  }
230
275
  return o2;
231
276
  }
232
277
  function ne(e4, t2 = {}, n3 = {}) {
233
278
  const o2 = { ...t2, ...n3 }, r2 = {};
234
- let i2 = void 0 === e4;
279
+ let s3 = !e4 || 0 === Object.keys(e4).length;
235
280
  return Object.keys(o2).forEach((t3) => {
236
- o2[t3] && (r2[t3] = true, e4 && e4[t3] && (i2 = true));
237
- }), !!i2 && r2;
281
+ o2[t3] && (r2[t3] = true, e4 && e4[t3] && (s3 = true));
282
+ }), !!s3 && r2;
238
283
  }
239
- function se(e4 = 6) {
284
+ function ie(e4 = 6) {
240
285
  let t2 = "";
241
286
  for (let n3 = 36; t2.length < e4; ) t2 += (Math.random() * n3 | 0).toString(n3);
242
287
  return t2;
243
288
  }
244
289
  function ae(e4, t2 = 1e3, n3 = false) {
245
- let o2, r2 = null, i2 = false;
246
- return (...s3) => new Promise((c2) => {
247
- const a3 = n3 && !i2;
290
+ let o2, r2 = null, s3 = false;
291
+ return (...i2) => new Promise((c3) => {
292
+ const a3 = n3 && !s3;
248
293
  r2 && clearTimeout(r2), r2 = setTimeout(() => {
249
- r2 = null, n3 && !i2 || (o2 = e4(...s3), c2(o2));
250
- }, t2), a3 && (i2 = true, o2 = e4(...s3), c2(o2));
294
+ r2 = null, n3 && !s3 || (o2 = e4(...i2), c3(o2));
295
+ }, t2), a3 && (s3 = true, o2 = e4(...i2), c3(o2));
251
296
  });
252
297
  }
253
298
  function fe(e4) {
@@ -259,17 +304,17 @@ function le(e4, t2) {
259
304
  }
260
305
  function de(e4 = {}) {
261
306
  return ge({ level: void 0 !== e4.level ? (function(e5) {
262
- return "string" == typeof e5 ? u[e5] : e5;
307
+ return "string" == typeof e5 ? a[e5] : e5;
263
308
  })(e4.level) : 0, handler: e4.handler, jsonHandler: e4.jsonHandler, scope: [] });
264
309
  }
265
310
  function ge(e4) {
266
- const { level: t2, handler: n3, jsonHandler: o2, scope: r2 } = e4, i2 = (e5, o3, i3) => {
311
+ const { level: t2, handler: n3, jsonHandler: o2, scope: r2 } = e4, s3 = (e5, o3, s4) => {
267
312
  if (e5 <= t2) {
268
- const t3 = le(o3, i3);
313
+ const t3 = le(o3, s4);
269
314
  n3 ? n3(e5, t3.message, t3.context, r2, pe) : pe(e5, t3.message, t3.context, r2);
270
315
  }
271
316
  };
272
- return { error: (e5, t3) => i2(0, e5, t3), warn: (e5, t3) => i2(1, e5, t3), info: (e5, t3) => i2(2, e5, t3), debug: (e5, t3) => i2(3, e5, t3), throw: (e5, t3) => {
317
+ return { error: (e5, t3) => s3(0, e5, t3), warn: (e5, t3) => s3(1, e5, t3), info: (e5, t3) => s3(2, e5, t3), debug: (e5, t3) => s3(3, e5, t3), throw: (e5, t3) => {
273
318
  const o3 = le(e5, t3);
274
319
  throw n3 ? n3(0, o3.message, o3.context, r2, pe) : pe(0, o3.message, o3.context, r2), new Error(o3.message);
275
320
  }, json: (e5) => {
@@ -277,7 +322,7 @@ function ge(e4) {
277
322
  }, scope: (e5) => ge({ level: t2, handler: n3, jsonHandler: o2, scope: [...r2, e5] }) };
278
323
  }
279
324
  function me(e4) {
280
- return L(e4) || X(e4) || K(e4) || !B(e4) || U(e4) && e4.every(me) || q(e4) && Object.values(e4).every(me);
325
+ return L(e4) || X(e4) || K(e4) || !V(e4) || U(e4) && e4.every(me) || q(e4) && Object.values(e4).every(me);
281
326
  }
282
327
  function ye(e4) {
283
328
  return me(e4) ? e4 : void 0;
@@ -309,43 +354,43 @@ function he(e4, t2, n3) {
309
354
  async function we(e4, t2) {
310
355
  const [n3, o2] = (e4.name || "").split(" ");
311
356
  if (!t2 || !n3 || !o2) return {};
312
- let r2, i2 = "", s3 = n3, c2 = o2;
357
+ let r2, s3 = "", i2 = n3, c3 = o2;
313
358
  const a3 = (t3) => {
314
359
  if (t3) return (t3 = U(t3) ? t3 : [t3]).find((t4) => !t4.condition || t4.condition(e4));
315
360
  };
316
- t2[s3] || (s3 = "*");
317
- const u4 = t2[s3];
318
- return u4 && (u4[c2] || (c2 = "*"), r2 = a3(u4[c2])), r2 || (s3 = "*", c2 = "*", r2 = a3(t2[s3]?.[c2])), r2 && (i2 = `${s3} ${c2}`), { eventMapping: r2, mappingKey: i2 };
361
+ t2[i2] || (i2 = "*");
362
+ const u3 = t2[i2];
363
+ return u3 && (u3[c3] || (c3 = "*"), r2 = a3(u3[c3])), r2 || (i2 = "*", c3 = "*", r2 = a3(t2[i2]?.[c3])), r2 && (s3 = `${i2} ${c3}`), { eventMapping: r2, mappingKey: s3 };
319
364
  }
320
365
  async function je(e4, t2 = {}, n3 = {}) {
321
- if (!B(e4)) return;
366
+ if (!V(e4)) return;
322
367
  const o2 = q(e4) && e4.consent || n3.consent || n3.collector?.consent, r2 = U(t2) ? t2 : [t2];
323
368
  for (const t3 of r2) {
324
369
  const r3 = await he(ke)(e4, t3, { ...n3, consent: o2 });
325
- if (B(r3)) return r3;
370
+ if (V(r3)) return r3;
326
371
  }
327
372
  }
328
373
  async function ke(e4, t2, n3 = {}) {
329
374
  const { collector: o2, consent: r2 } = n3;
330
- return (U(t2) ? t2 : [t2]).reduce(async (t3, i2) => {
331
- const s3 = await t3;
332
- if (s3) return s3;
333
- const c2 = X(i2) ? { key: i2 } : i2;
334
- if (!Object.keys(c2).length) return;
335
- const { condition: a3, consent: u4, fn: f2, key: l2, loop: p2, map: d2, set: g2, validate: m2, value: b2 } = c2;
336
- if (a3 && !await he(a3)(e4, i2, o2)) return;
337
- if (u4 && !ne(u4, r2)) return b2;
338
- let y2 = B(b2) ? b2 : e4;
339
- if (f2 && (y2 = await he(f2)(e4, i2, n3)), l2 && (y2 = Y(e4, l2, b2)), p2) {
375
+ return (U(t2) ? t2 : [t2]).reduce(async (t3, s3) => {
376
+ const i2 = await t3;
377
+ if (i2) return i2;
378
+ const c3 = X(s3) ? { key: s3 } : s3;
379
+ if (!Object.keys(c3).length) return;
380
+ const { condition: a3, consent: u3, fn: f2, key: l2, loop: p2, map: d2, set: g2, validate: m2, value: b2 } = c3;
381
+ if (a3 && !await he(a3)(e4, s3, o2)) return;
382
+ if (u3 && !ne(u3, r2)) return b2;
383
+ let y2 = V(b2) ? b2 : e4;
384
+ if (f2 && (y2 = await he(f2)(e4, s3, n3)), l2 && (y2 = Y(e4, l2, b2)), p2) {
340
385
  const [t4, o3] = p2, r3 = "this" === t4 ? [e4] : await je(e4, t4, n3);
341
- U(r3) && (y2 = (await Promise.all(r3.map((e5) => je(e5, o3, n3)))).filter(B));
386
+ U(r3) && (y2 = (await Promise.all(r3.map((e5) => je(e5, o3, n3)))).filter(V));
342
387
  } else d2 ? y2 = await Object.entries(d2).reduce(async (t4, [o3, r3]) => {
343
- const i3 = await t4, s4 = await je(e4, r3, n3);
344
- return B(s4) && (i3[o3] = s4), i3;
388
+ const s4 = await t4, i3 = await je(e4, r3, n3);
389
+ return V(i3) && (s4[o3] = i3), s4;
345
390
  }, Promise.resolve({})) : g2 && (y2 = await Promise.all(g2.map((t4) => ke(e4, t4, n3))));
346
391
  m2 && !await he(m2)(y2) && (y2 = void 0);
347
392
  const v2 = ye(y2);
348
- return B(v2) ? v2 : ye(b2);
393
+ return V(v2) ? v2 : ye(b2);
349
394
  }, Promise.resolve(void 0));
350
395
  }
351
396
  async function Oe(e4, t2, n3) {
@@ -358,55 +403,64 @@ async function Oe(e4, t2, n3) {
358
403
  const r3 = await je(e4, o3, { collector: n3 });
359
404
  e4 = ee(e4, t3, r3);
360
405
  }));
361
- let i2 = t2.data && await je(e4, t2.data, { collector: n3 });
406
+ let s3 = t2.data && await je(e4, t2.data, { collector: n3 });
362
407
  if (o2) {
363
- if (o2.ignore) return { event: e4, data: i2, mapping: o2, mappingKey: r2, ignore: true };
408
+ if (o2.ignore) return { event: e4, data: s3, mapping: o2, mappingKey: r2, ignore: true };
364
409
  if (o2.name && (e4.name = o2.name), o2.data) {
365
410
  const t3 = o2.data && await je(e4, o2.data, { collector: n3 });
366
- i2 = q(i2) && q(t3) ? I(i2, t3) : t3;
411
+ s3 = q(s3) && q(t3) ? W(s3, t3) : t3;
367
412
  }
368
413
  }
369
- return { event: e4, data: i2, mapping: o2, mappingKey: r2, ignore: false };
414
+ return { event: e4, data: s3, mapping: o2, mappingKey: r2, ignore: false };
370
415
  }
371
- function _e(e4, t2, n3) {
416
+ function Te(e4, t2, n3) {
372
417
  return function(...o2) {
373
418
  let r2;
374
- const i2 = "post" + t2, s3 = n3["pre" + t2], c2 = n3[i2];
375
- return r2 = s3 ? s3({ fn: e4 }, ...o2) : e4(...o2), c2 && (r2 = c2({ fn: e4, result: r2 }, ...o2)), r2;
419
+ const s3 = "post" + t2, i2 = n3["pre" + t2], c3 = n3[s3];
420
+ return r2 = i2 ? i2({ fn: e4 }, ...o2) : e4(...o2), c3 && (r2 = c3({ fn: e4, result: r2 }, ...o2)), r2;
376
421
  };
377
422
  }
378
- async function Be(e4, t2) {
379
- const n3 = t2?.version || "latest", o2 = `${Le}/${e4}@${n3}`, r2 = new AbortController(), i2 = setTimeout(() => r2.abort(), t2?.timeout || 1e4);
423
+ async function Ze(e4, t2) {
424
+ const n3 = t2?.version || "latest", o2 = `https://cdn.jsdelivr.net/npm/${e4}@${n3}`, r2 = new AbortController(), s3 = setTimeout(() => r2.abort(), t2?.timeout || 1e4);
380
425
  try {
381
426
  const t3 = await fetch(`${o2}/package.json`, { signal: r2.signal });
382
427
  if (!t3.ok) throw new Error(`Package "${e4}" not found on npm (HTTP ${t3.status})`);
383
- const i3 = await t3.json(), s3 = await fetch(`${o2}/${Ve}`, { signal: r2.signal });
384
- if (!s3.ok) throw new Error(`walkerOS.json not found at ${Ve} (HTTP ${s3.status}). This package may not support the walkerOS.json convention yet.`);
385
- const c2 = await s3.json(), a3 = c2.$meta || {};
386
- return { packageName: e4, version: i3.version || n3, type: a3.type, platform: a3.platform, schemas: c2.schemas || {}, examples: c2.examples || {} };
428
+ const s4 = await t3.json(), i2 = await fetch(`${o2}/${Le}`, { signal: r2.signal });
429
+ if (!i2.ok) throw new Error(`walkerOS.json not found at ${Le} (HTTP ${i2.status}). This package may not support the walkerOS.json convention yet.`);
430
+ const c3 = await i2.json(), a3 = c3.$meta || {}, u3 = c3.schemas || {}, f2 = c3.examples || {}, l2 = c3.hints, p2 = l2 ? Object.keys(l2) : [], d2 = [], g2 = f2.step || {};
431
+ for (const [e5, t4] of Object.entries(g2)) {
432
+ const n4 = t4, o3 = { name: e5 };
433
+ n4?.description && (o3.description = n4.description), d2.push(o3);
434
+ }
435
+ const m2 = a3.docs, b2 = a3.source;
436
+ return { packageName: e4, version: s4.version || n3, description: s4.description, type: a3.type, platform: a3.platform, schemas: u3, examples: f2, ...m2 ? { docs: m2 } : {}, ...b2 ? { source: b2 } : {}, ...l2 && Object.keys(l2).length > 0 ? { hints: l2 } : {}, hintKeys: p2, exampleSummaries: d2 };
387
437
  } finally {
388
- clearTimeout(i2);
438
+ clearTimeout(s3);
389
439
  }
390
440
  }
391
- var e, a, u, T, M, H, pe, Le, Ve;
441
+ async function Ve(e4, t2) {
442
+ const n3 = await Ze(e4, t2);
443
+ return { packageName: n3.packageName, version: n3.version, type: n3.type, platform: n3.platform, schemas: n3.schemas, examples: n3.examples, ...n3.hints ? { hints: n3.hints } : {} };
444
+ }
445
+ var e, c, a, x, $, T, I, pe, Le;
392
446
  var init_dist = __esm({
393
447
  "../core/dist/index.mjs"() {
394
448
  "use strict";
395
449
  e = Object.defineProperty;
396
- a = {};
450
+ c = {};
397
451
  ((t2, n3) => {
398
452
  for (var o2 in n3) e(t2, o2, { get: n3[o2], enumerable: true });
399
- })(a, { Level: () => u });
400
- u = ((e4) => (e4[e4.ERROR = 0] = "ERROR", e4[e4.WARN = 1] = "WARN", e4[e4.INFO = 2] = "INFO", e4[e4.DEBUG = 3] = "DEBUG", e4))(u || {});
453
+ })(c, { Level: () => a });
454
+ a = ((e4) => (e4[e4.ERROR = 0] = "ERROR", e4[e4.WARN = 1] = "WARN", e4[e4.INFO = 2] = "INFO", e4[e4.DEBUG = 3] = "DEBUG", e4))(a || {});
455
+ x = ["globals", "context", "custom", "user", "consent"];
456
+ $ = /* @__PURE__ */ new Set(["description", "examples", "title", "$comment"]);
401
457
  T = "__WALKEROS_ENV:";
402
- M = /* @__PURE__ */ new Set(["description", "examples", "title", "$comment"]);
403
- H = { merge: true, shallow: true, extend: true };
458
+ I = { merge: true, shallow: true, extend: true };
404
459
  pe = (e4, t2, n3, o2) => {
405
- const r2 = `${u[e4]}${o2.length > 0 ? ` [${o2.join(":")}]` : ""}`, i2 = Object.keys(n3).length > 0, s3 = 0 === e4 ? console.error : 1 === e4 ? console.warn : console.log;
406
- i2 ? s3(r2, t2, n3) : s3(r2, t2);
460
+ const r2 = `${a[e4]}${o2.length > 0 ? ` [${o2.join(":")}]` : ""}`, s3 = Object.keys(n3).length > 0, i2 = 0 === e4 ? console.error : 1 === e4 ? console.warn : console.log;
461
+ s3 ? i2(r2, t2, n3) : i2(r2, t2);
407
462
  };
408
- Le = "https://cdn.jsdelivr.net/npm";
409
- Ve = "dist/walkerOS.json";
463
+ Le = "dist/walkerOS.json";
410
464
  }
411
465
  });
412
466
 
@@ -422,16 +476,16 @@ function createCLILogger(options = {}) {
422
476
  const out = stderr ? console.error : console.log;
423
477
  return de({
424
478
  // Let handler control visibility — pass everything through
425
- level: u.DEBUG,
479
+ level: a.DEBUG,
426
480
  handler: (level, message, _context, scope) => {
427
481
  const scopePath = scope.length > 0 ? `[${scope.join(":")}] ` : "";
428
482
  const fullMessage = `${scopePath}${message}`;
429
- if (level === u.ERROR) {
483
+ if (level === a.ERROR) {
430
484
  if (!json2) console.error(chalk2.red(fullMessage));
431
485
  return;
432
486
  }
433
487
  if (silent || json2) return;
434
- if (level === u.DEBUG) {
488
+ if (level === a.DEBUG) {
435
489
  if (!verbose) return;
436
490
  out(` ${fullMessage}`);
437
491
  return;
@@ -962,6 +1016,8 @@ var init_core = __esm({
962
1016
  init_local_packages();
963
1017
  init_input_detector();
964
1018
  init_stdin();
1019
+ init_auth();
1020
+ init_sse();
965
1021
  }
966
1022
  });
967
1023
 
@@ -2764,7 +2820,7 @@ function isValidBase64(data) {
2764
2820
  function isValidBase64URL(data) {
2765
2821
  if (!base64url.test(data))
2766
2822
  return false;
2767
- const base643 = data.replace(/[-_]/g, (c2) => c2 === "-" ? "+" : "/");
2823
+ const base643 = data.replace(/[-_]/g, (c3) => c3 === "-" ? "+" : "/");
2768
2824
  const padded = base643.padEnd(Math.ceil(base643.length / 4) * 4, "=");
2769
2825
  return isValidBase64(padded);
2770
2826
  }
@@ -14238,9 +14294,9 @@ var init_schemas2 = __esm({
14238
14294
  inst._zod.processJSONSchema = (ctx, json2, params) => dateProcessor(inst, ctx, json2, params);
14239
14295
  inst.min = (value, params) => inst.check(_gte(value, params));
14240
14296
  inst.max = (value, params) => inst.check(_lte(value, params));
14241
- const c2 = inst._zod.bag;
14242
- inst.minDate = c2.minimum ? new Date(c2.minimum) : null;
14243
- inst.maxDate = c2.maximum ? new Date(c2.maximum) : null;
14297
+ const c3 = inst._zod.bag;
14298
+ inst.minDate = c3.minimum ? new Date(c3.minimum) : null;
14299
+ inst.maxDate = c3.maximum ? new Date(c3.maximum) : null;
14244
14300
  });
14245
14301
  ZodArray = /* @__PURE__ */ $constructor("ZodArray", (inst, def) => {
14246
14302
  $ZodArray.init(inst, def);
@@ -15360,31 +15416,31 @@ var init_zod = __esm({
15360
15416
  function o(e4, n3, i2 = "draft-7") {
15361
15417
  return external_exports.toJSONSchema(e4, { target: i2 });
15362
15418
  }
15363
- function L2(e4, n3) {
15419
+ function N2(e4, n3) {
15364
15420
  return external_exports.object({ data: external_exports.union([e4, n3]).optional().describe("Data transformation rules") }).partial();
15365
15421
  }
15366
15422
  function z3(e4) {
15367
15423
  return external_exports.object({ mapping: e4.optional().describe("Event mapping rules") }).partial();
15368
15424
  }
15369
- function N2(e4) {
15425
+ function L2(e4) {
15370
15426
  return external_exports.object({ policy: e4.optional().describe("Pre-processing policy rules") }).partial();
15371
15427
  }
15372
15428
  function q2(e4) {
15373
15429
  return external_exports.object({ consent: e4.optional().describe("Required consent states") }).partial();
15374
15430
  }
15431
+ function ti(e4) {
15432
+ return ii.parse(e4);
15433
+ }
15375
15434
  function oi(e4) {
15376
- return ti.parse(e4);
15435
+ return ii.safeParse(e4);
15377
15436
  }
15378
15437
  function ri(e4) {
15379
- return ti.safeParse(e4);
15438
+ return ni.parse(e4);
15380
15439
  }
15381
15440
  function ai(e4) {
15382
- return Zn.parse(e4);
15383
- }
15384
- function si(e4) {
15385
- return Zn.safeParse(e4);
15441
+ return ni.safeParse(e4);
15386
15442
  }
15387
- function fi(e4) {
15443
+ function Si(e4) {
15388
15444
  let n3;
15389
15445
  try {
15390
15446
  n3 = JSON.parse(e4);
@@ -15393,7 +15449,7 @@ function fi(e4) {
15393
15449
  if (e5 instanceof SyntaxError) {
15394
15450
  const i4 = e5.message.match(/position\s+(\d+)/);
15395
15451
  if (i4) {
15396
- return gi(n5, parseInt(i4[1], 10));
15452
+ return yi(n5, parseInt(i4[1], 10));
15397
15453
  }
15398
15454
  const t4 = e5.message.match(/line\s+(\d+)\s+column\s+(\d+)/);
15399
15455
  if (t4) return { line: parseInt(t4[1], 10), column: parseInt(t4[2], 10) };
@@ -15402,25 +15458,37 @@ function fi(e4) {
15402
15458
  })(n4, e4);
15403
15459
  return { valid: false, errors: [{ message: n4 instanceof Error ? n4.message : "Invalid JSON", severity: "error", line: i3, column: t3 }], warnings: [] };
15404
15460
  }
15405
- const i2 = [], t2 = [], o2 = ti.safeParse(n3);
15461
+ const i2 = [], t2 = [], o2 = ii.safeParse(n3);
15406
15462
  if (!o2.success) for (const n4 of o2.error.issues) {
15407
- const t3 = n4.path.join("."), o3 = vi(e4, n4.path);
15463
+ const t3 = n4.path.join("."), o3 = ki(e4, n4.path);
15408
15464
  i2.push({ message: n4.message, severity: "error", path: t3 || "root", ...o3 });
15409
15465
  }
15410
15466
  const r2 = (function(e5) {
15411
- if (!(Si(e5) && "version" in e5 && "flows" in e5 && Si(e5.flows))) return;
15467
+ if (!(Ci(e5) && "version" in e5 && "flows" in e5 && Ci(e5.flows))) return;
15412
15468
  const n4 = {}, i3 = {}, t3 = [], o3 = [], r3 = [], a3 = [], s3 = [];
15413
- let c2;
15414
- wi(n4, e5.variables), ki(i3, e5.definitions), Ci(s3, e5.contract);
15415
- for (const l3 of Object.values(e5.flows)) if (Si(l3)) {
15416
- c2 || ("web" in l3 ? c2 = "web" : "server" in l3 && (c2 = "server")), wi(n4, l3.variables), ki(i3, l3.definitions), Ci(s3, l3.contract);
15469
+ let c3;
15470
+ xi(n4, e5.variables), Ji(i3, e5.definitions), (function(e6, n5) {
15471
+ if (!Ci(n5)) return;
15472
+ for (const [, i4] of Object.entries(n5)) {
15473
+ if (!Ci(i4)) continue;
15474
+ const n6 = i4.events;
15475
+ if (Ci(n6)) for (const [i5, t4] of Object.entries(n6)) {
15476
+ if (!Ci(t4)) continue;
15477
+ const n7 = e6.find((e7) => e7.entity === i5), o4 = Object.keys(t4);
15478
+ if (n7) for (const e7 of o4) n7.actions.includes(e7) || n7.actions.push(e7);
15479
+ else e6.push({ entity: i5, actions: o4 });
15480
+ }
15481
+ }
15482
+ })(s3, e5.contract);
15483
+ for (const s4 of Object.values(e5.flows)) if (Ci(s4)) {
15484
+ c3 || ("web" in s4 ? c3 = "web" : "server" in s4 && (c3 = "server")), xi(n4, s4.variables), Ji(i3, s4.definitions);
15417
15485
  for (const e6 of ["sources", "destinations", "transformers"]) {
15418
- const s4 = "sources" === e6 ? "source" : "destinations" === e6 ? "destination" : "transformer", d2 = "sources" === e6 ? t3 : "destinations" === e6 ? o3 : r3;
15419
- if (Si(l3[e6])) for (const [t4, o4] of Object.entries(l3[e6])) d2.push(t4), Si(o4) && (wi(n4, o4.variables), ki(i3, o4.definitions), "string" == typeof o4.package && a3.push({ package: o4.package, shortName: t4, type: s4, platform: c2 || "web" }));
15486
+ const l3 = "sources" === e6 ? "source" : "destinations" === e6 ? "destination" : "transformer", d2 = "sources" === e6 ? t3 : "destinations" === e6 ? o3 : r3;
15487
+ if (Ci(s4[e6])) for (const [t4, o4] of Object.entries(s4[e6])) d2.push(t4), Ci(o4) && (xi(n4, o4.variables), Ji(i3, o4.definitions), "string" == typeof o4.package && a3.push({ package: o4.package, shortName: t4, type: l3, platform: c3 || "web" }));
15420
15488
  }
15421
15489
  }
15422
15490
  const l2 = { variables: n4, definitions: i3, stepNames: { sources: t3, destinations: o3, transformers: r3 } };
15423
- c2 && (l2.platform = c2);
15491
+ c3 && (l2.platform = c3);
15424
15492
  a3.length > 0 && (l2.packages = a3);
15425
15493
  s3.length > 0 && (l2.contract = s3);
15426
15494
  return l2;
@@ -15432,7 +15500,7 @@ function fi(e4) {
15432
15500
  const t3 = /\$var\.(\w+)/g;
15433
15501
  let o3;
15434
15502
  for (; null !== (o3 = t3.exec(e5)); ) if (!(o3[1] in n5.variables)) {
15435
- const t4 = hi(e5, o3.index, o3[0].length);
15503
+ const t4 = wi(e5, o3.index, o3[0].length);
15436
15504
  i3.push({ message: `Unknown variable "$var.${o3[1]}". Defined: ${Object.keys(n5.variables).join(", ") || "none"}`, severity: "warning", path: `$var.${o3[1]}`, ...t4 });
15437
15505
  }
15438
15506
  }
@@ -15440,7 +15508,7 @@ function fi(e4) {
15440
15508
  const t3 = /\$def\.(\w+)/g;
15441
15509
  let o3;
15442
15510
  for (; null !== (o3 = t3.exec(e5)); ) if (!(o3[1] in n5.definitions)) {
15443
- const t4 = hi(e5, o3.index, o3[0].length);
15511
+ const t4 = wi(e5, o3.index, o3[0].length);
15444
15512
  i3.push({ message: `Unknown definition "$def.${o3[1]}". Defined: ${Object.keys(n5.definitions).join(", ") || "none"}`, severity: "warning", path: `$def.${o3[1]}`, ...t4 });
15445
15513
  }
15446
15514
  }
@@ -15450,102 +15518,95 @@ function fi(e4) {
15450
15518
  }
15451
15519
  return { valid: 0 === i2.length, errors: i2, warnings: t2, context: r2 };
15452
15520
  }
15453
- function gi(e4, n3) {
15521
+ function yi(e4, n3) {
15454
15522
  let i2 = 1, t2 = 1;
15455
15523
  for (let o2 = 0; o2 < n3 && o2 < e4.length; o2++) "\n" === e4[o2] ? (i2++, t2 = 1) : t2++;
15456
15524
  return { line: i2, column: t2 };
15457
15525
  }
15458
- function hi(e4, n3, i2) {
15459
- const t2 = gi(e4, n3), o2 = gi(e4, n3 + i2);
15526
+ function wi(e4, n3, i2) {
15527
+ const t2 = yi(e4, n3), o2 = yi(e4, n3 + i2);
15460
15528
  return { line: t2.line, column: t2.column, endLine: o2.line, endColumn: o2.column };
15461
15529
  }
15462
- function vi(e4, n3) {
15530
+ function ki(e4, n3) {
15463
15531
  if (0 === n3.length) return { line: 1, column: 1 };
15464
15532
  const i2 = n3[n3.length - 1];
15465
15533
  if ("string" == typeof i2) {
15466
15534
  const n4 = `"${i2}"`, t2 = e4.lastIndexOf(n4);
15467
- if (-1 !== t2) return gi(e4, t2);
15535
+ if (-1 !== t2) return yi(e4, t2);
15468
15536
  }
15469
15537
  return { line: 1, column: 1 };
15470
15538
  }
15471
- function Si(e4) {
15539
+ function Ci(e4) {
15472
15540
  return "object" == typeof e4 && null !== e4 && !Array.isArray(e4);
15473
15541
  }
15474
- function yi(e4) {
15542
+ function ji(e4) {
15475
15543
  return "string" == typeof e4 || "number" == typeof e4 || "boolean" == typeof e4;
15476
15544
  }
15477
- function wi(e4, n3) {
15478
- if (Si(n3)) for (const [i2, t2] of Object.entries(n3)) yi(t2) && (e4[i2] = t2);
15479
- }
15480
- function ki(e4, n3) {
15481
- if (Si(n3)) for (const [i2, t2] of Object.entries(n3)) e4[i2] = t2;
15545
+ function xi(e4, n3) {
15546
+ if (Ci(n3)) for (const [i2, t2] of Object.entries(n3)) ji(t2) && (e4[i2] = t2);
15482
15547
  }
15483
- function Ci(e4, n3) {
15484
- if (Si(n3)) for (const [i2, t2] of Object.entries(n3)) {
15485
- if (i2.startsWith("$") || !Si(t2)) continue;
15486
- const n4 = e4.find((e5) => e5.entity === i2), o2 = Object.keys(t2);
15487
- if (n4) for (const e5 of o2) n4.actions.includes(e5) || n4.actions.push(e5);
15488
- else e4.push({ entity: i2, actions: o2 });
15489
- }
15548
+ function Ji(e4, n3) {
15549
+ if (Ci(n3)) for (const [i2, t2] of Object.entries(n3)) e4[i2] = t2;
15490
15550
  }
15491
- function ji(e4, n3) {
15551
+ function Ei(e4, n3) {
15492
15552
  const i2 = [], t2 = {};
15493
15553
  for (const [n4, o3] of Object.entries(e4)) {
15494
15554
  o3.required && i2.push(n4);
15495
15555
  const e5 = { type: o3.type };
15496
15556
  if (o3.description && (e5.description = o3.description), o3.pattern && (e5.pattern = o3.pattern), void 0 !== o3.minLength && (e5.minLength = o3.minLength), void 0 !== o3.maxLength && (e5.maxLength = o3.maxLength), void 0 !== o3.minimum && (e5.minimum = o3.minimum), void 0 !== o3.maximum && (e5.maximum = o3.maximum), o3.enum && (e5.enum = [...o3.enum]), void 0 !== o3.default && (e5.default = o3.default), "object" === o3.type && o3.properties) {
15497
15557
  const n5 = {};
15498
- for (const [e6, i3] of Object.entries(o3.properties)) n5[e6] = xi(i3);
15558
+ for (const [e6, i3] of Object.entries(o3.properties)) n5[e6] = Pi(i3);
15499
15559
  e5.properties = n5;
15500
15560
  }
15501
- "array" === o3.type && o3.items && (e5.items = xi(o3.items)), t2[n4] = e5;
15561
+ "array" === o3.type && o3.items && (e5.items = Pi(o3.items)), t2[n4] = e5;
15502
15562
  }
15503
15563
  const o2 = { type: "object", properties: t2 };
15504
15564
  return n3 && (o2.title = n3), i2.length > 0 && (o2.required = i2), o2;
15505
15565
  }
15506
- function xi(e4) {
15566
+ function Pi(e4) {
15507
15567
  const n3 = { type: e4.type };
15508
15568
  if (e4.description && (n3.description = e4.description), e4.pattern && (n3.pattern = e4.pattern), void 0 !== e4.minLength && (n3.minLength = e4.minLength), void 0 !== e4.maxLength && (n3.maxLength = e4.maxLength), void 0 !== e4.minimum && (n3.minimum = e4.minimum), void 0 !== e4.maximum && (n3.maximum = e4.maximum), e4.enum && (n3.enum = [...e4.enum]), void 0 !== e4.default && (n3.default = e4.default), "object" === e4.type && e4.properties) {
15509
15569
  const i2 = {};
15510
- for (const [n4, t2] of Object.entries(e4.properties)) i2[n4] = xi(t2);
15570
+ for (const [n4, t2] of Object.entries(e4.properties)) i2[n4] = Pi(t2);
15511
15571
  n3.properties = i2;
15512
15572
  }
15513
- return "array" === e4.type && e4.items && (n3.items = xi(e4.items)), n3;
15573
+ return "array" === e4.type && e4.items && (n3.items = Pi(e4.items)), n3;
15514
15574
  }
15515
- function Ji(e4, n3) {
15516
- const i2 = { type: "array", items: xi(e4) };
15575
+ function Ii(e4, n3) {
15576
+ const i2 = { type: "array", items: Pi(e4) };
15517
15577
  return void 0 !== n3?.minItems && (i2.minItems = n3.minItems), void 0 !== n3?.maxItems && (i2.maxItems = n3.maxItems), n3?.description && (i2.description = n3.description), n3?.title && (i2.title = n3.title), i2;
15518
15578
  }
15519
- function Pi(e4, n3 = "string", i2) {
15579
+ function Di(e4, n3 = "string", i2) {
15520
15580
  const t2 = { type: n3, enum: [...e4] };
15521
15581
  return i2?.description && (t2.description = i2.description), i2?.title && (t2.title = i2.title), t2;
15522
15582
  }
15523
- function Ei(e4, n3, i2) {
15524
- return Ji({ type: "object" }, { minItems: 2, maxItems: 2, description: i2 || "Tuple with exactly 2 elements [source, transform]" });
15583
+ function Ri(e4, n3, i2) {
15584
+ return Ii({ type: "object" }, { minItems: 2, maxItems: 2, description: i2 || "Tuple with exactly 2 elements [source, transform]" });
15525
15585
  }
15526
- function Di(e4) {
15586
+ function Oi(e4) {
15527
15587
  return external_exports.toJSONSchema(e4, { target: "draft-7" });
15528
15588
  }
15529
- var e2, n, i, r, a2, s, c, l, d, p, u2, m, b, f, g, h, v, S2, y, w, k, C2, j, x2, J, P2, E2, D2, I2, R2, O2, T2, M2, U2, V, W2, $2, B2, A2, F, H2, G, Q2, _2, K2, X2, Y2, Z2, ee2, ne2, ie, te, oe, re, ae2, se2, ce, le2, de2, pe2, ue, me2, be, fe2, ge2, he2, ve2, Se, ye2, we2, ke2, Ce, je2, xe, Je, Pe, Ee, De, Ie, Re, Oe2, Le2, ze, Ne, qe, Te, Me, Ue, Ve2, We, $e, Be2, Ae, Fe, He, Ge, Qe, _e2, Ke, Xe, Ye, Ze, en, nn, tn, on, rn, an, sn, cn, ln, dn, pn, un, mn, bn, fn, gn, hn, vn, Sn, yn, wn, kn, Cn, jn, xn, Jn, Pn, En, Dn, In, Rn, On, Ln, zn, Nn, qn, Tn, Mn, Un, Vn, Wn, $n, Bn, An, Fn, Hn, Gn, Qn, _n, Kn, Xn, Yn, Zn, ei, ni, ii, ti, ci, li, di, pi, ui, mi, bi;
15589
+ var e2, n, i, r, a2, s, c2, l, d, p, u, m, b, f, g, h, v, S2, y, w, k, C2, j, x2, J2, E2, P2, I2, D2, R2, O2, T2, M2, U2, W2, $2, B, V2, A2, H2, F, G, Q2, _2, K2, X2, Y2, Z, ee2, ne2, ie2, te, oe, re, ae2, se, ce, le2, de2, pe2, ue, me2, be, fe2, ge2, he2, ve2, Se, ye2, we2, ke2, Ce, je2, xe, Je, Ee, Pe, Ie, De, Re, Oe2, Ne, ze, Le2, qe, Te2, Me, Ue, We, $e, Be, Ve2, Ae, He, Fe, Ge, Qe, _e, Ke, Xe, Ye, Ze2, en, nn, tn, on, rn, an, sn, cn, ln, dn, pn, un, mn, bn, fn, gn, hn, vn, Sn, yn, wn, kn, Cn, jn, xn, Jn, En, Pn, In, Dn, Rn, On, Nn, zn, Ln, qn, Tn, Mn, Un, Wn, $n, Bn, Vn, An, Hn, Fn, Gn, Qn, _n, Kn, Xn, Yn, Zn, ei, ni, ii, si, ci, li, di, pi, ui, mi, bi, gi, hi, vi;
15530
15590
  var init_dev = __esm({
15531
15591
  "../core/dist/dev.mjs"() {
15532
15592
  "use strict";
15533
15593
  init_zod();
15594
+ init_zod();
15534
15595
  e2 = Object.defineProperty;
15535
15596
  n = (n3, i2) => {
15536
15597
  for (var t2 in i2) e2(n3, t2, { get: i2[t2], enumerable: true });
15537
15598
  };
15538
15599
  i = {};
15539
- n(i, { BaseContextConfig: () => M2, BatchConfig: () => U2, CollectorSchemas: () => sn, ConsentSchema: () => K2, ContractActionsSchema: () => Xn, ContractSchema: () => Yn, ContractSchemaEntry: () => Kn, Counter: () => d, DeepPartialEventSchema: () => oe, DestinationReferenceSchema: () => Qn, DestinationSchemas: () => ze, DestinationsMapConfig: () => $2, EntitiesSchema: () => ne2, EntitySchema: () => ee2, EventSchema: () => ie, FlowConfigSchema: () => ti, FlowConfigV2Schema: () => ii, FlowSchemas: () => qn, FlowSettingsSchema: () => Zn, GenericEnvConfig: () => O2, GenericSettingsConfig: () => R2, HandlersConfig: () => x2, IdConfig: () => E2, Identifier: () => c, InitConfig: () => D2, LoopSchema: () => ge2, MapSchema: () => ve2, MappingResultSchema: () => je2, MappingSchemas: () => me2, OptionalPrimitiveValue: () => m, OrderedPropertiesSchema: () => Q2, PartialEventSchema: () => te, PolicySchema: () => ye2, PrimaryConfig: () => I2, PrimitiveSchema: () => Tn, PrimitiveValue: () => u2, ProcessingControlConfig: () => V, PropertiesSchema: () => G, PropertySchema: () => H2, PropertyTypeSchema: () => F, QueueConfig: () => P2, RequiredBoolean: () => s, RequiredNumber: () => a2, RequiredString: () => r, RuleSchema: () => we2, RulesSchema: () => ke2, RuntimeInstanceConfig: () => T2, SetSchema: () => he2, SourceReferenceSchema: () => Hn, SourceSchema: () => Z2, SourceSchemas: () => kn, SourceTypeSchema: () => _2, SourcesMapConfig: () => W2, StoreReferenceSchema: () => _n, TaggingVersion: () => p, Timestamp: () => l, UserSchema: () => X2, UtilitySchemas: () => b, ValueConfigSchema: () => Se, ValueSchema: () => be, ValuesSchema: () => fe2, VerboseConfig: () => J, VersionSchema: () => Y2, WalkerOSSchemas: () => B2, configJsonSchema: () => ci, configV2JsonSchema: () => li, consentJsonSchema: () => ue, createArraySchema: () => Ji, createConsentConfig: () => q2, createDataTransformationConfig: () => L2, createEnumSchema: () => Pi, createMappingRulesConfig: () => z3, createObjectSchema: () => ji, createPolicyConfig: () => N2, createTupleSchema: () => Ei, destinationReferenceJsonSchema: () => ui, entityJsonSchema: () => de2, eventJsonSchema: () => re, loopJsonSchema: () => Pe, mapJsonSchema: () => De, orderedPropertiesJsonSchema: () => le2, parseConfig: () => oi, parseSettings: () => ai, partialEventJsonSchema: () => ae2, policyJsonSchema: () => Ie, propertiesJsonSchema: () => ce, ruleJsonSchema: () => Re, rulesJsonSchema: () => Oe2, safeParseConfig: () => ri, safeParseSettings: () => si, setJsonSchema: () => Ee, settingsJsonSchema: () => di, sourceReferenceJsonSchema: () => pi, sourceTypeJsonSchema: () => pe2, storeReferenceJsonSchema: () => bi, userJsonSchema: () => se2, validateFlowConfig: () => fi, valueConfigJsonSchema: () => Je, valueJsonSchema: () => xe, z: () => external_exports, zodToSchema: () => Di });
15600
+ n(i, { BaseContextConfig: () => M2, BatchConfig: () => U2, CodeSchema: () => gi, CollectorSchemas: () => sn, ConsentSchema: () => K2, ContractActionsSchema: () => Xn, ContractSchema: () => ei, ContractSchemaEntry: () => Kn, Counter: () => d, DeepPartialEventSchema: () => oe, DestinationReferenceSchema: () => Qn, DestinationSchemas: () => ze, DestinationsMapConfig: () => B, EntitiesSchema: () => ne2, EntitySchema: () => ee2, EventSchema: () => ie2, FlowConfigSchema: () => ii, FlowSchemas: () => qn, FlowSettingsSchema: () => ni, GenericEnvConfig: () => O2, GenericSettingsConfig: () => R2, HandlersConfig: () => x2, HintSchema: () => hi, HintsSchema: () => vi, IdConfig: () => P2, Identifier: () => c2, InitConfig: () => I2, LoopSchema: () => ge2, MapSchema: () => ve2, MappingResultSchema: () => je2, MappingSchemas: () => me2, OptionalPrimitiveValue: () => m, OrderedPropertiesSchema: () => Q2, PartialEventSchema: () => te, PolicySchema: () => ye2, PrimaryConfig: () => D2, PrimitiveSchema: () => Tn, PrimitiveValue: () => u, ProcessingControlConfig: () => W2, PropertiesSchema: () => G, PropertySchema: () => F, PropertyTypeSchema: () => H2, QueueConfig: () => E2, RequiredBoolean: () => s, RequiredNumber: () => a2, RequiredString: () => r, RuleSchema: () => we2, RulesSchema: () => ke2, RuntimeInstanceConfig: () => T2, SetSchema: () => he2, SourceReferenceSchema: () => Fn, SourceSchema: () => Z, SourceSchemas: () => kn, SourceTypeSchema: () => _2, SourcesMapConfig: () => $2, StoreReferenceSchema: () => _n, TaggingVersion: () => p, Timestamp: () => l, TransformerReferenceSchema: () => Gn, UserSchema: () => X2, UtilitySchemas: () => b, ValueConfigSchema: () => Se, ValueSchema: () => be, ValuesSchema: () => fe2, VerboseConfig: () => J2, VersionSchema: () => Y2, WalkerOSSchemas: () => V2, configJsonSchema: () => si, consentJsonSchema: () => ue, contractEntryJsonSchema: () => mi, contractJsonSchema: () => bi, createArraySchema: () => Ii, createConsentConfig: () => q2, createDataTransformationConfig: () => N2, createEnumSchema: () => Di, createMappingRulesConfig: () => z3, createObjectSchema: () => Ei, createPolicyConfig: () => L2, createTupleSchema: () => Ri, destinationReferenceJsonSchema: () => di, entityJsonSchema: () => de2, eventJsonSchema: () => re, loopJsonSchema: () => Ee, mapJsonSchema: () => Ie, orderedPropertiesJsonSchema: () => le2, parseConfig: () => ti, parseSettings: () => ri, partialEventJsonSchema: () => ae2, policyJsonSchema: () => De, propertiesJsonSchema: () => ce, ruleJsonSchema: () => Re, rulesJsonSchema: () => Oe2, safeParseConfig: () => oi, safeParseSettings: () => ai, setJsonSchema: () => Pe, settingsJsonSchema: () => ci, sourceReferenceJsonSchema: () => li, sourceTypeJsonSchema: () => pe2, storeReferenceJsonSchema: () => ui, transformerReferenceJsonSchema: () => pi, userJsonSchema: () => se, validateFlowConfig: () => Si, valueConfigJsonSchema: () => Je, valueJsonSchema: () => xe, z: () => external_exports, zodToSchema: () => Oi });
15540
15601
  r = external_exports.string();
15541
15602
  a2 = external_exports.number();
15542
15603
  s = external_exports.boolean();
15543
- c = external_exports.string().min(1);
15604
+ c2 = external_exports.string().min(1);
15544
15605
  l = external_exports.number().int().positive();
15545
15606
  d = external_exports.number().int().nonnegative();
15546
15607
  p = external_exports.number().describe("Tagging version number");
15547
- u2 = external_exports.union([external_exports.string(), external_exports.number(), external_exports.boolean()]);
15548
- m = u2.optional();
15608
+ u = external_exports.union([external_exports.string(), external_exports.number(), external_exports.boolean()]);
15609
+ m = u.optional();
15549
15610
  b = {};
15550
15611
  n(b, { ErrorHandlerSchema: () => h, HandlerSchema: () => S2, LogHandlerSchema: () => v, StorageSchema: () => g, StorageTypeSchema: () => f, errorHandlerJsonSchema: () => k, handlerJsonSchema: () => j, logHandlerJsonSchema: () => C2, storageJsonSchema: () => w, storageTypeJsonSchema: () => y });
15551
15612
  f = external_exports.enum(["local", "session", "cookie"]).describe("Storage mechanism: local, session, or cookie");
@@ -15559,45 +15620,45 @@ var init_dev = __esm({
15559
15620
  C2 = o(v);
15560
15621
  j = o(S2);
15561
15622
  x2 = external_exports.object({ onError: h.optional().describe("Error handler function: (error, state?) => void"), onLog: v.optional().describe("Log handler function: (message, verbose?) => void") }).partial();
15562
- J = external_exports.object({ verbose: external_exports.boolean().describe("Enable verbose logging for debugging").optional() }).partial();
15563
- P2 = external_exports.object({ queue: external_exports.boolean().describe("Whether to queue events when consent is not granted").optional() }).partial();
15564
- E2 = external_exports.object({}).partial();
15565
- D2 = external_exports.object({ init: external_exports.boolean().describe("Whether to initialize immediately").optional(), loadScript: external_exports.boolean().describe("Whether to load external script (for web destinations)").optional() }).partial();
15566
- I2 = external_exports.object({ primary: external_exports.boolean().describe("Mark as primary (only one can be primary)").optional() }).partial();
15623
+ J2 = external_exports.object({ verbose: external_exports.boolean().describe("Enable verbose logging for debugging").optional() }).partial();
15624
+ E2 = external_exports.object({ queue: external_exports.boolean().describe("Whether to queue events when consent is not granted").optional() }).partial();
15625
+ P2 = external_exports.object({}).partial();
15626
+ I2 = external_exports.object({ init: external_exports.boolean().describe("Whether to initialize immediately").optional(), loadScript: external_exports.boolean().describe("Whether to load external script (for web destinations)").optional() }).partial();
15627
+ D2 = external_exports.object({ primary: external_exports.boolean().describe("Mark as primary (only one can be primary)").optional() }).partial();
15567
15628
  R2 = external_exports.object({ settings: external_exports.any().optional().describe("Implementation-specific configuration") }).partial();
15568
15629
  O2 = external_exports.object({ env: external_exports.any().optional().describe("Environment dependencies (platform-specific)") }).partial();
15569
15630
  T2 = external_exports.object({ type: external_exports.string().optional().describe("Instance type identifier"), config: external_exports.unknown().describe("Instance configuration") }).partial();
15570
15631
  M2 = external_exports.object({ collector: external_exports.unknown().describe("Collector instance (runtime object)"), config: external_exports.unknown().describe("Configuration"), env: external_exports.unknown().describe("Environment dependencies") }).partial();
15571
15632
  U2 = external_exports.object({ batch: external_exports.number().optional().describe("Batch size: bundle N events for batch processing"), batched: external_exports.unknown().optional().describe("Batch of events to be processed") }).partial();
15572
- V = external_exports.object({ ignore: external_exports.boolean().describe("Set to true to skip processing").optional(), condition: external_exports.string().optional().describe("Condition function: return true to process") }).partial();
15573
- W2 = external_exports.object({ sources: external_exports.record(external_exports.string(), external_exports.unknown()).describe("Map of source instances") }).partial();
15574
- $2 = external_exports.object({ destinations: external_exports.record(external_exports.string(), external_exports.unknown()).describe("Map of destination instances") }).partial();
15575
- B2 = {};
15576
- n(B2, { ConsentSchema: () => K2, DeepPartialEventSchema: () => oe, EntitiesSchema: () => ne2, EntitySchema: () => ee2, EventSchema: () => ie, OrderedPropertiesSchema: () => Q2, PartialEventSchema: () => te, PropertiesSchema: () => G, PropertySchema: () => H2, PropertyTypeSchema: () => F, SourceSchema: () => Z2, SourceTypeSchema: () => _2, UserSchema: () => X2, VersionSchema: () => Y2, consentJsonSchema: () => ue, entityJsonSchema: () => de2, eventJsonSchema: () => re, orderedPropertiesJsonSchema: () => le2, partialEventJsonSchema: () => ae2, propertiesJsonSchema: () => ce, sourceTypeJsonSchema: () => pe2, userJsonSchema: () => se2 });
15577
- F = external_exports.lazy(() => external_exports.union([external_exports.boolean(), external_exports.string(), external_exports.number(), external_exports.record(external_exports.string(), H2)]));
15578
- H2 = external_exports.lazy(() => external_exports.union([F, external_exports.array(F)]));
15579
- G = external_exports.record(external_exports.string(), H2.optional()).describe("Flexible property collection with optional values");
15580
- Q2 = external_exports.record(external_exports.string(), external_exports.tuple([H2, external_exports.number()]).optional()).describe("Ordered properties with [value, order] tuples for priority control");
15633
+ W2 = external_exports.object({ ignore: external_exports.boolean().describe("Set to true to skip processing").optional(), condition: external_exports.string().optional().describe("Condition function: return true to process") }).partial();
15634
+ $2 = external_exports.object({ sources: external_exports.record(external_exports.string(), external_exports.unknown()).describe("Map of source instances") }).partial();
15635
+ B = external_exports.object({ destinations: external_exports.record(external_exports.string(), external_exports.unknown()).describe("Map of destination instances") }).partial();
15636
+ V2 = {};
15637
+ n(V2, { ConsentSchema: () => K2, DeepPartialEventSchema: () => oe, EntitiesSchema: () => ne2, EntitySchema: () => ee2, EventSchema: () => ie2, OrderedPropertiesSchema: () => Q2, PartialEventSchema: () => te, PropertiesSchema: () => G, PropertySchema: () => F, PropertyTypeSchema: () => H2, SourceSchema: () => Z, SourceTypeSchema: () => _2, UserSchema: () => X2, VersionSchema: () => Y2, consentJsonSchema: () => ue, entityJsonSchema: () => de2, eventJsonSchema: () => re, orderedPropertiesJsonSchema: () => le2, partialEventJsonSchema: () => ae2, propertiesJsonSchema: () => ce, sourceTypeJsonSchema: () => pe2, userJsonSchema: () => se });
15638
+ H2 = external_exports.lazy(() => external_exports.union([external_exports.boolean(), external_exports.string(), external_exports.number(), external_exports.record(external_exports.string(), F)]));
15639
+ F = external_exports.lazy(() => external_exports.union([H2, external_exports.array(H2)]));
15640
+ G = external_exports.record(external_exports.string(), F.optional()).describe("Flexible property collection with optional values");
15641
+ Q2 = external_exports.record(external_exports.string(), external_exports.tuple([F, external_exports.number()]).optional()).describe("Ordered properties with [value, order] tuples for priority control");
15581
15642
  _2 = external_exports.union([external_exports.enum(["web", "server", "app", "other"]), external_exports.string()]).describe("Source type: web, server, app, other, or custom");
15582
15643
  K2 = external_exports.record(external_exports.string(), external_exports.boolean()).describe("Consent requirement mapping (group name \u2192 state)");
15583
15644
  X2 = G.and(external_exports.object({ id: external_exports.string().optional().describe("User identifier"), device: external_exports.string().optional().describe("Device identifier"), session: external_exports.string().optional().describe("Session identifier"), hash: external_exports.string().optional().describe("Hashed identifier"), address: external_exports.string().optional().describe("User address"), email: external_exports.string().email().optional().describe("User email address"), phone: external_exports.string().optional().describe("User phone number"), userAgent: external_exports.string().optional().describe("Browser user agent string"), browser: external_exports.string().optional().describe("Browser name"), browserVersion: external_exports.string().optional().describe("Browser version"), deviceType: external_exports.string().optional().describe("Device type (mobile, desktop, tablet)"), os: external_exports.string().optional().describe("Operating system"), osVersion: external_exports.string().optional().describe("Operating system version"), screenSize: external_exports.string().optional().describe("Screen dimensions"), language: external_exports.string().optional().describe("User language"), country: external_exports.string().optional().describe("User country"), region: external_exports.string().optional().describe("User region/state"), city: external_exports.string().optional().describe("User city"), zip: external_exports.string().optional().describe("User postal code"), timezone: external_exports.string().optional().describe("User timezone"), ip: external_exports.string().optional().describe("User IP address"), internal: external_exports.boolean().optional().describe("Internal user flag (employee, test user)") })).describe("User identification and properties");
15584
15645
  Y2 = G.and(external_exports.object({ source: r.describe('Walker implementation version (e.g., "2.0.0")'), tagging: p })).describe("Walker version information");
15585
- Z2 = G.and(external_exports.object({ type: _2.describe("Source type identifier"), id: r.describe("Source identifier (typically URL on web)"), previous_id: r.describe("Previous source identifier (typically referrer on web)") })).describe("Event source information");
15646
+ Z = G.and(external_exports.object({ type: _2.describe("Source type identifier"), id: r.describe("Source identifier (typically URL on web)"), previous_id: r.describe("Previous source identifier (typically referrer on web)") })).describe("Event source information");
15586
15647
  ee2 = external_exports.lazy(() => external_exports.object({ entity: external_exports.string().describe("Entity name"), data: G.describe("Entity-specific properties"), nested: external_exports.array(ee2).describe("Nested child entities"), context: Q2.describe("Entity context data") })).describe("Nested entity structure with recursive nesting support");
15587
15648
  ne2 = external_exports.array(ee2).describe("Array of nested entities");
15588
- ie = external_exports.object({ name: external_exports.string().describe('Event name in "entity action" format (e.g., "page view", "product add")'), data: G.describe("Event-specific properties"), context: Q2.describe("Ordered context properties with priorities"), globals: G.describe("Global properties shared across events"), custom: G.describe("Custom implementation-specific properties"), user: X2.describe("User identification and attributes"), nested: ne2.describe("Related nested entities"), consent: K2.describe("Consent states at event time"), id: c.describe("Unique event identifier (timestamp-based)"), trigger: r.describe("Event trigger identifier"), entity: r.describe("Parsed entity from event name"), action: r.describe("Parsed action from event name"), timestamp: l.describe("Unix timestamp in milliseconds since epoch"), timing: a2.describe("Event processing timing information"), group: r.describe("Event grouping identifier"), count: d.describe("Event count in session"), version: Y2.describe("Walker version information"), source: Z2.describe("Event source information") }).describe("Complete walkerOS event structure");
15589
- te = ie.partial().describe("Partial event structure with all fields optional");
15590
- oe = ie.partial().describe("Partial event structure with all top-level fields optional");
15591
- re = o(ie);
15649
+ ie2 = external_exports.object({ name: external_exports.string().describe('Event name in "entity action" format (e.g., "page view", "product add")'), data: G.describe("Event-specific properties"), context: Q2.describe("Ordered context properties with priorities"), globals: G.describe("Global properties shared across events"), custom: G.describe("Custom implementation-specific properties"), user: X2.describe("User identification and attributes"), nested: ne2.describe("Related nested entities"), consent: K2.describe("Consent states at event time"), id: c2.describe("Unique event identifier (timestamp-based)"), trigger: r.describe("Event trigger identifier"), entity: r.describe("Parsed entity from event name"), action: r.describe("Parsed action from event name"), timestamp: l.describe("Unix timestamp in milliseconds since epoch"), timing: a2.describe("Event processing timing information"), group: r.describe("Event grouping identifier"), count: d.describe("Event count in session"), version: Y2.describe("Walker version information"), source: Z.describe("Event source information") }).describe("Complete walkerOS event structure");
15650
+ te = ie2.partial().describe("Partial event structure with all fields optional");
15651
+ oe = ie2.partial().describe("Partial event structure with all top-level fields optional");
15652
+ re = o(ie2);
15592
15653
  ae2 = o(te);
15593
- se2 = o(X2);
15654
+ se = o(X2);
15594
15655
  ce = o(G);
15595
15656
  le2 = o(Q2);
15596
15657
  de2 = o(ee2);
15597
15658
  pe2 = o(_2);
15598
15659
  ue = o(K2);
15599
15660
  me2 = {};
15600
- n(me2, { ConfigSchema: () => Ce, LoopSchema: () => ge2, MapSchema: () => ve2, PolicySchema: () => ye2, ResultSchema: () => je2, RuleSchema: () => we2, RulesSchema: () => ke2, SetSchema: () => he2, ValueConfigSchema: () => Se, ValueSchema: () => be, ValuesSchema: () => fe2, configJsonSchema: () => Le2, loopJsonSchema: () => Pe, mapJsonSchema: () => De, policyJsonSchema: () => Ie, ruleJsonSchema: () => Re, rulesJsonSchema: () => Oe2, setJsonSchema: () => Ee, valueConfigJsonSchema: () => Je, valueJsonSchema: () => xe });
15661
+ n(me2, { ConfigSchema: () => Ce, LoopSchema: () => ge2, MapSchema: () => ve2, PolicySchema: () => ye2, ResultSchema: () => je2, RuleSchema: () => we2, RulesSchema: () => ke2, SetSchema: () => he2, ValueConfigSchema: () => Se, ValueSchema: () => be, ValuesSchema: () => fe2, configJsonSchema: () => Ne, loopJsonSchema: () => Ee, mapJsonSchema: () => Ie, policyJsonSchema: () => De, ruleJsonSchema: () => Re, rulesJsonSchema: () => Oe2, setJsonSchema: () => Pe, valueConfigJsonSchema: () => Je, valueJsonSchema: () => xe });
15601
15662
  be = external_exports.lazy(() => external_exports.union([external_exports.string().describe('String value or property path (e.g., "data.id")'), external_exports.number().describe("Numeric value"), external_exports.boolean().describe("Boolean value"), external_exports.lazy(() => A2), external_exports.array(be).describe("Array of values")]));
15602
15663
  fe2 = external_exports.array(be).describe("Array of transformation values");
15603
15664
  ge2 = external_exports.lazy(() => external_exports.tuple([be, be]).describe("Loop transformation: [source, transform] tuple for array processing"));
@@ -15606,55 +15667,55 @@ var init_dev = __esm({
15606
15667
  Se = A2 = external_exports.object({ key: external_exports.string().optional().describe('Property path to extract from event (e.g., "data.id", "user.email")'), value: external_exports.union([external_exports.string(), external_exports.number(), external_exports.boolean()]).optional().describe("Static primitive value"), fn: external_exports.string().optional().describe("Custom transformation function as string (serialized)"), map: ve2.optional().describe("Object mapping: transform event data to structured output"), loop: ge2.optional().describe("Loop transformation: [source, transform] for array processing"), set: he2.optional().describe("Set of values: combine or select from multiple values"), consent: K2.optional().describe("Required consent states to include this value"), condition: external_exports.string().optional().describe("Condition function as string: return true to include value"), validate: external_exports.string().optional().describe("Validation function as string: return true if value is valid") }).refine((e4) => Object.keys(e4).length > 0, { message: "ValueConfig must have at least one property" }).describe("Value transformation configuration with multiple strategies");
15607
15668
  ye2 = external_exports.record(external_exports.string(), be).describe("Policy rules for event pre-processing (key \u2192 value mapping)");
15608
15669
  we2 = external_exports.object({ batch: external_exports.number().optional().describe("Batch size: bundle N events for batch processing"), condition: external_exports.string().optional().describe("Condition function as string: return true to process event"), consent: K2.optional().describe("Required consent states to process this event"), settings: external_exports.any().optional().describe("Destination-specific settings for this event mapping"), data: external_exports.union([be, fe2]).optional().describe("Data transformation rules for event"), ignore: external_exports.boolean().optional().describe("Set to true to skip processing this event"), name: external_exports.string().optional().describe('Custom event name override (e.g., "view_item" for "product view")'), policy: ye2.optional().describe("Event-level policy overrides (applied after config-level policy)") }).describe("Mapping rule for specific entity-action combination");
15609
- ke2 = external_exports.record(external_exports.string(), external_exports.record(external_exports.string(), external_exports.union([we2, external_exports.array(we2)])).optional()).describe("Nested mapping rules: { entity: { action: Rule | Rule[] } } with wildcard support");
15670
+ ke2 = external_exports.record(external_exports.string(), external_exports.record(external_exports.string(), external_exports.union([we2, external_exports.array(we2)])).optional()).describe('Event mapping rules: entity \u2192 action \u2192 Rule. Keys match event name split by space. Use "*" as wildcard for entity or action. Priority: exact > entity wildcard > action wildcard > global wildcard (*\u2192*).');
15610
15671
  Ce = external_exports.object({ consent: K2.optional().describe("Required consent states to process any events"), data: external_exports.union([be, fe2]).optional().describe("Global data transformation applied to all events"), mapping: ke2.optional().describe("Entity-action specific mapping rules"), policy: ye2.optional().describe("Pre-processing policy rules applied before mapping") }).describe("Shared mapping configuration for sources and destinations");
15611
15672
  je2 = external_exports.object({ eventMapping: we2.optional().describe("Resolved mapping rule for event"), mappingKey: external_exports.string().optional().describe('Mapping key used (e.g., "product.view")') }).describe("Mapping resolution result");
15612
15673
  xe = o(be);
15613
15674
  Je = o(Se);
15614
- Pe = o(ge2);
15615
- Ee = o(he2);
15616
- De = o(ve2);
15617
- Ie = o(ye2);
15675
+ Ee = o(ge2);
15676
+ Pe = o(he2);
15677
+ Ie = o(ve2);
15678
+ De = o(ye2);
15618
15679
  Re = o(we2);
15619
15680
  Oe2 = o(ke2);
15620
- Le2 = o(Ce);
15681
+ Ne = o(Ce);
15621
15682
  ze = {};
15622
- n(ze, { BatchSchema: () => Be2, ConfigSchema: () => Ne, ContextSchema: () => Me, DLQSchema: () => Ye, DataSchema: () => Ae, DestinationPolicySchema: () => Te, DestinationsSchema: () => Qe, InitDestinationsSchema: () => Ge, InitSchema: () => He, InstanceSchema: () => Fe, PartialConfigSchema: () => qe, PushBatchContextSchema: () => Ve2, PushContextSchema: () => Ue, PushEventSchema: () => We, PushEventsSchema: () => $e, PushResultSchema: () => Ke, RefSchema: () => _e2, ResultSchema: () => Xe, batchJsonSchema: () => on, configJsonSchema: () => Ze, contextJsonSchema: () => nn, instanceJsonSchema: () => rn, partialConfigJsonSchema: () => en, pushContextJsonSchema: () => tn, resultJsonSchema: () => an });
15623
- Ne = external_exports.object({ consent: K2.optional().describe("Required consent states to send events to this destination"), settings: external_exports.any().describe("Implementation-specific configuration").optional(), data: external_exports.union([be, fe2]).optional().describe("Global data transformation applied to all events for this destination"), env: external_exports.any().describe("Environment dependencies (platform-specific)").optional(), id: c.describe("Destination instance identifier (defaults to destination key)").optional(), init: external_exports.boolean().describe("Whether to initialize immediately").optional(), loadScript: external_exports.boolean().describe("Whether to load external script (for web destinations)").optional(), mapping: ke2.optional().describe("Entity-action specific mapping rules for this destination"), policy: ye2.optional().describe("Pre-processing policy rules applied before event mapping"), queue: external_exports.boolean().describe("Whether to queue events when consent is not granted").optional(), verbose: external_exports.boolean().describe("Enable verbose logging for debugging").optional(), onError: h.optional(), onLog: v.optional() }).describe("Destination configuration");
15624
- qe = Ne.partial().describe("Partial destination configuration with all fields optional");
15625
- Te = ye2.describe("Destination policy rules for event pre-processing");
15626
- Me = external_exports.object({ collector: external_exports.unknown().describe("Collector instance (runtime object)"), config: Ne.describe("Destination configuration"), data: external_exports.union([external_exports.unknown(), external_exports.array(external_exports.unknown())]).optional().describe("Transformed event data"), env: external_exports.unknown().describe("Environment dependencies") }).describe("Destination context for init and push functions");
15683
+ n(ze, { BatchSchema: () => Ve2, ConfigSchema: () => Le2, ContextSchema: () => Me, DLQSchema: () => Ye, DataSchema: () => Ae, DestinationPolicySchema: () => Te2, DestinationsSchema: () => Qe, InitDestinationsSchema: () => Ge, InitSchema: () => Fe, InstanceSchema: () => He, PartialConfigSchema: () => qe, PushBatchContextSchema: () => We, PushContextSchema: () => Ue, PushEventSchema: () => $e, PushEventsSchema: () => Be, PushResultSchema: () => Ke, RefSchema: () => _e, ResultSchema: () => Xe, batchJsonSchema: () => on, configJsonSchema: () => Ze2, contextJsonSchema: () => nn, instanceJsonSchema: () => rn, partialConfigJsonSchema: () => en, pushContextJsonSchema: () => tn, resultJsonSchema: () => an });
15684
+ Le2 = external_exports.object({ consent: K2.optional().describe("Required consent states to send events to this destination"), settings: external_exports.any().describe("Implementation-specific configuration").optional(), data: external_exports.union([be, fe2]).optional().describe("Global data transformation applied to all events for this destination"), env: external_exports.any().describe("Environment dependencies (platform-specific)").optional(), id: c2.describe("Destination instance identifier (defaults to destination key)").optional(), init: external_exports.boolean().describe("Whether to initialize immediately").optional(), loadScript: external_exports.boolean().describe("Whether to load external script (for web destinations)").optional(), mapping: ke2.optional().describe("Entity-action specific mapping rules for this destination"), policy: ye2.optional().describe("Pre-processing policy rules applied before event mapping"), queue: external_exports.boolean().describe("Whether to queue events when consent is not granted").optional(), verbose: external_exports.boolean().describe("Enable verbose logging for debugging").optional(), onError: h.optional(), onLog: v.optional() }).describe("Destination configuration");
15685
+ qe = Le2.partial().describe("Partial destination configuration with all fields optional");
15686
+ Te2 = ye2.describe("Destination policy rules for event pre-processing");
15687
+ Me = external_exports.object({ collector: external_exports.unknown().describe("Collector instance (runtime object)"), config: Le2.describe("Destination configuration"), data: external_exports.union([external_exports.unknown(), external_exports.array(external_exports.unknown())]).optional().describe("Transformed event data"), env: external_exports.unknown().describe("Environment dependencies") }).describe("Destination context for init and push functions");
15627
15688
  Ue = Me.extend({ mapping: we2.optional().describe("Resolved mapping rule for this specific event") }).describe("Push context with event-specific mapping");
15628
- Ve2 = Ue.describe("Batch push context with event-specific mapping");
15629
- We = external_exports.object({ event: ie.describe("The event to process"), mapping: we2.optional().describe("Mapping rule for this event") }).describe("Event with optional mapping for batch processing");
15630
- $e = external_exports.array(We).describe("Array of events with mappings");
15631
- Be2 = external_exports.object({ key: external_exports.string().describe('Batch key (usually mapping key like "product.view")'), events: external_exports.array(ie).describe("Array of events in batch"), data: external_exports.array(external_exports.union([external_exports.unknown(), external_exports.array(external_exports.unknown())]).optional()).describe("Transformed data for each event"), mapping: we2.optional().describe("Shared mapping rule for batch") }).describe("Batch of events grouped by mapping key");
15689
+ We = Ue.describe("Batch push context with event-specific mapping");
15690
+ $e = external_exports.object({ event: ie2.describe("The event to process"), mapping: we2.optional().describe("Mapping rule for this event") }).describe("Event with optional mapping for batch processing");
15691
+ Be = external_exports.array($e).describe("Array of events with mappings");
15692
+ Ve2 = external_exports.object({ key: external_exports.string().describe('Batch key (usually mapping key like "product.view")'), events: external_exports.array(ie2).describe("Array of events in batch"), data: external_exports.array(external_exports.union([external_exports.unknown(), external_exports.array(external_exports.unknown())]).optional()).describe("Transformed data for each event"), mapping: we2.optional().describe("Shared mapping rule for batch") }).describe("Batch of events grouped by mapping key");
15632
15693
  Ae = external_exports.union([external_exports.unknown(), external_exports.array(external_exports.unknown())]).optional().describe("Transformed event data (Property, undefined, or array)");
15633
- Fe = external_exports.object({ config: Ne.describe("Destination configuration"), queue: external_exports.array(ie).optional().describe("Queued events awaiting consent"), dlq: external_exports.array(external_exports.tuple([ie, external_exports.unknown()])).optional().describe("Dead letter queue (failed events with errors)"), type: external_exports.string().optional().describe("Destination type identifier"), env: external_exports.unknown().optional().describe("Environment dependencies"), init: external_exports.unknown().optional().describe("Initialization function"), push: external_exports.unknown().describe("Push function for single events"), pushBatch: external_exports.unknown().optional().describe("Batch push function"), on: external_exports.unknown().optional().describe("Event lifecycle hook function") }).describe("Destination instance (runtime object with functions)");
15634
- He = external_exports.object({ code: Fe.describe("Destination instance with implementation"), config: qe.optional().describe("Partial configuration overrides"), env: external_exports.unknown().optional().describe("Partial environment overrides") }).describe("Destination initialization configuration");
15635
- Ge = external_exports.record(external_exports.string(), He).describe("Map of destination IDs to initialization configurations");
15636
- Qe = external_exports.record(external_exports.string(), Fe).describe("Map of destination IDs to runtime instances");
15637
- _e2 = external_exports.object({ type: external_exports.string().describe('Destination type ("gtag", "meta", "bigquery")'), data: external_exports.unknown().optional().describe("Response from push()"), error: external_exports.unknown().optional().describe("Error if failed") }).describe("Destination reference with type and response data");
15638
- Ke = external_exports.object({ queue: external_exports.array(ie).optional().describe("Events queued (awaiting consent)"), error: external_exports.unknown().optional().describe("Error if push failed") }).describe("Push operation result");
15639
- Xe = external_exports.object({ ok: external_exports.boolean().describe("True if nothing failed"), event: external_exports.unknown().optional().describe("The processed event"), done: external_exports.record(external_exports.string(), _e2).optional().describe("Destinations that processed successfully"), queued: external_exports.record(external_exports.string(), _e2).optional().describe("Destinations that queued events"), failed: external_exports.record(external_exports.string(), _e2).optional().describe("Destinations that failed to process") }).describe("Push result with destination outcomes");
15640
- Ye = external_exports.array(external_exports.tuple([ie, external_exports.unknown()])).describe("Dead letter queue: [(event, error), ...]");
15641
- Ze = o(Ne);
15694
+ He = external_exports.object({ config: Le2.describe("Destination configuration"), queue: external_exports.array(ie2).optional().describe("Queued events awaiting consent"), dlq: external_exports.array(external_exports.tuple([ie2, external_exports.unknown()])).optional().describe("Dead letter queue (failed events with errors)"), type: external_exports.string().optional().describe("Destination type identifier"), env: external_exports.unknown().optional().describe("Environment dependencies"), init: external_exports.unknown().optional().describe("Initialization function"), push: external_exports.unknown().describe("Push function for single events"), pushBatch: external_exports.unknown().optional().describe("Batch push function"), on: external_exports.unknown().optional().describe("Event lifecycle hook function") }).describe("Destination instance (runtime object with functions)");
15695
+ Fe = external_exports.object({ code: He.describe("Destination instance with implementation"), config: qe.optional().describe("Partial configuration overrides"), env: external_exports.unknown().optional().describe("Partial environment overrides") }).describe("Destination initialization configuration");
15696
+ Ge = external_exports.record(external_exports.string(), Fe).describe("Map of destination IDs to initialization configurations");
15697
+ Qe = external_exports.record(external_exports.string(), He).describe("Map of destination IDs to runtime instances");
15698
+ _e = external_exports.object({ type: external_exports.string().describe('Destination type ("gtag", "meta", "bigquery")'), data: external_exports.unknown().optional().describe("Response from push()"), error: external_exports.unknown().optional().describe("Error if failed") }).describe("Destination reference with type and response data");
15699
+ Ke = external_exports.object({ queue: external_exports.array(ie2).optional().describe("Events queued (awaiting consent)"), error: external_exports.unknown().optional().describe("Error if push failed") }).describe("Push operation result");
15700
+ Xe = external_exports.object({ ok: external_exports.boolean().describe("True if nothing failed"), event: external_exports.unknown().optional().describe("The processed event"), done: external_exports.record(external_exports.string(), _e).optional().describe("Destinations that processed successfully"), queued: external_exports.record(external_exports.string(), _e).optional().describe("Destinations that queued events"), failed: external_exports.record(external_exports.string(), _e).optional().describe("Destinations that failed to process") }).describe("Push result with destination outcomes");
15701
+ Ye = external_exports.array(external_exports.tuple([ie2, external_exports.unknown()])).describe("Dead letter queue: [(event, error), ...]");
15702
+ Ze2 = o(Le2);
15642
15703
  en = o(qe);
15643
15704
  nn = o(Me);
15644
15705
  tn = o(Ue);
15645
- on = o(Be2);
15646
- rn = o(Fe);
15706
+ on = o(Ve2);
15707
+ rn = o(He);
15647
15708
  an = o(Xe);
15648
15709
  sn = {};
15649
15710
  n(sn, { CommandTypeSchema: () => cn, ConfigSchema: () => ln, DestinationsSchema: () => bn, InitConfigSchema: () => pn, InstanceSchema: () => fn, PushContextSchema: () => un, SessionDataSchema: () => dn, SourcesSchema: () => mn, commandTypeJsonSchema: () => gn, configJsonSchema: () => hn, initConfigJsonSchema: () => Sn, instanceJsonSchema: () => wn, pushContextJsonSchema: () => yn, sessionDataJsonSchema: () => vn });
15650
15711
  cn = external_exports.union([external_exports.enum(["action", "config", "consent", "context", "destination", "elb", "globals", "hook", "init", "link", "run", "user", "walker"]), external_exports.string()]).describe("Collector command type: standard commands or custom string for extensions");
15651
15712
  ln = external_exports.object({ run: external_exports.boolean().describe("Whether to run collector automatically on initialization").optional(), tagging: p, globalsStatic: G.describe("Static global properties that persist across collector runs"), sessionStatic: external_exports.record(external_exports.string(), external_exports.unknown()).describe("Static session data that persists across collector runs"), verbose: external_exports.boolean().describe("Enable verbose logging for debugging"), onError: h.optional(), onLog: v.optional() }).describe("Core collector configuration");
15652
- dn = G.and(external_exports.object({ isStart: external_exports.boolean().describe("Whether this is a new session start"), storage: external_exports.boolean().describe("Whether storage is available"), id: c.describe("Session identifier").optional(), start: l.describe("Session start timestamp").optional(), marketing: external_exports.literal(true).optional().describe("Marketing attribution flag"), updated: l.describe("Last update timestamp").optional(), isNew: external_exports.boolean().describe("Whether this is a new session").optional(), device: c.describe("Device identifier").optional(), count: d.describe("Event count in session").optional(), runs: d.describe("Number of runs").optional() })).describe("Session state and tracking data");
15713
+ dn = G.and(external_exports.object({ isStart: external_exports.boolean().describe("Whether this is a new session start"), storage: external_exports.boolean().describe("Whether storage is available"), id: c2.describe("Session identifier").optional(), start: l.describe("Session start timestamp").optional(), marketing: external_exports.literal(true).optional().describe("Marketing attribution flag"), updated: l.describe("Last update timestamp").optional(), isNew: external_exports.boolean().describe("Whether this is a new session").optional(), device: c2.describe("Device identifier").optional(), count: d.describe("Event count in session").optional(), runs: d.describe("Number of runs").optional() })).describe("Session state and tracking data");
15653
15714
  pn = ln.partial().extend({ consent: K2.optional().describe("Initial consent state"), user: X2.optional().describe("Initial user data"), globals: G.optional().describe("Initial global properties"), sources: external_exports.unknown().optional().describe("Source configurations"), destinations: external_exports.unknown().optional().describe("Destination configurations"), custom: G.optional().describe("Initial custom implementation-specific properties") }).describe("Collector initialization configuration with initial state");
15654
15715
  un = external_exports.object({ mapping: Ce.optional().describe("Source-level mapping configuration") }).describe("Push context with optional source mapping");
15655
15716
  mn = external_exports.record(external_exports.string(), external_exports.unknown()).describe("Map of source IDs to source instances");
15656
15717
  bn = external_exports.record(external_exports.string(), external_exports.unknown()).describe("Map of destination IDs to destination instances");
15657
- fn = external_exports.object({ push: external_exports.unknown().describe("Push function for processing events"), command: external_exports.unknown().describe("Command function for walker commands"), allowed: external_exports.boolean().describe("Whether event processing is allowed"), config: ln.describe("Current collector configuration"), consent: K2.describe("Current consent state"), count: external_exports.number().describe("Event count (increments with each event)"), custom: G.describe("Custom implementation-specific properties"), sources: mn.describe("Registered source instances"), destinations: bn.describe("Registered destination instances"), globals: G.describe("Current global properties"), group: external_exports.string().describe("Event grouping identifier"), hooks: external_exports.unknown().describe("Lifecycle hook functions"), on: external_exports.unknown().describe("Event lifecycle configuration"), queue: external_exports.array(ie).describe("Queued events awaiting processing"), round: external_exports.number().describe("Collector run count (increments with each run)"), session: external_exports.union([dn]).describe("Current session state"), timing: external_exports.number().describe("Event processing timing information"), user: X2.describe("Current user data"), version: external_exports.string().describe("Walker implementation version") }).describe("Collector instance with state and methods");
15718
+ fn = external_exports.object({ push: external_exports.unknown().describe("Push function for processing events"), command: external_exports.unknown().describe("Command function for walker commands"), allowed: external_exports.boolean().describe("Whether event processing is allowed"), config: ln.describe("Current collector configuration"), consent: K2.describe("Current consent state"), count: external_exports.number().describe("Event count (increments with each event)"), custom: G.describe("Custom implementation-specific properties"), sources: mn.describe("Registered source instances"), destinations: bn.describe("Registered destination instances"), globals: G.describe("Current global properties"), group: external_exports.string().describe("Event grouping identifier"), hooks: external_exports.unknown().describe("Lifecycle hook functions"), on: external_exports.unknown().describe("Event lifecycle configuration"), queue: external_exports.array(ie2).describe("Queued events awaiting processing"), round: external_exports.number().describe("Collector run count (increments with each run)"), session: external_exports.union([dn]).describe("Current session state"), timing: external_exports.number().describe("Event processing timing information"), user: X2.describe("Current user data"), version: external_exports.string().describe("Walker implementation version") }).describe("Collector instance with state and methods");
15658
15719
  gn = o(cn);
15659
15720
  hn = o(ln);
15660
15721
  vn = o(dn);
@@ -15662,53 +15723,56 @@ var init_dev = __esm({
15662
15723
  yn = o(un);
15663
15724
  wn = o(fn);
15664
15725
  kn = {};
15665
- n(kn, { BaseEnvSchema: () => Cn, ConfigSchema: () => jn, InitSchema: () => Pn, InitSourceSchema: () => En, InitSourcesSchema: () => Dn, InstanceSchema: () => Jn, PartialConfigSchema: () => xn, baseEnvJsonSchema: () => In, configJsonSchema: () => Rn, initSourceJsonSchema: () => zn, initSourcesJsonSchema: () => Nn, instanceJsonSchema: () => Ln, partialConfigJsonSchema: () => On });
15726
+ n(kn, { BaseEnvSchema: () => Cn, ConfigSchema: () => jn, InitSchema: () => En, InitSourceSchema: () => Pn, InitSourcesSchema: () => In, InstanceSchema: () => Jn, PartialConfigSchema: () => xn, baseEnvJsonSchema: () => Dn, configJsonSchema: () => Rn, initSourceJsonSchema: () => zn, initSourcesJsonSchema: () => Ln, instanceJsonSchema: () => Nn, partialConfigJsonSchema: () => On });
15666
15727
  Cn = external_exports.object({ push: external_exports.unknown().describe("Collector push function"), command: external_exports.unknown().describe("Collector command function"), sources: external_exports.unknown().optional().describe("Map of registered source instances"), elb: external_exports.unknown().describe("Public API function (alias for collector.push)") }).catchall(external_exports.unknown()).describe("Base environment for dependency injection - platform-specific sources extend this");
15667
- jn = Ce.extend({ settings: external_exports.any().describe("Implementation-specific configuration").optional(), env: Cn.optional().describe("Environment dependencies (platform-specific)"), id: c.describe("Source identifier (defaults to source key)").optional(), onError: h.optional(), primary: external_exports.boolean().describe("Mark as primary (only one can be primary)").optional() }).describe("Source configuration with mapping and environment");
15728
+ jn = Ce.extend({ settings: external_exports.any().describe("Implementation-specific configuration").optional(), env: Cn.optional().describe("Environment dependencies (platform-specific)"), id: c2.describe("Source identifier (defaults to source key)").optional(), onError: h.optional(), primary: external_exports.boolean().describe("Mark as primary (only one can be primary)").optional() }).describe("Source configuration with mapping and environment");
15668
15729
  xn = jn.partial().describe("Partial source configuration with all fields optional");
15669
15730
  Jn = external_exports.object({ type: external_exports.string().describe('Source type identifier (e.g., "browser", "dataLayer")'), config: jn.describe("Current source configuration"), push: external_exports.any().describe("Push function - THE HANDLER (flexible signature for platform compatibility)"), destroy: external_exports.any().optional().describe("Cleanup function called when source is removed"), on: external_exports.unknown().optional().describe("Lifecycle hook function for event types") }).describe("Source instance with push handler and lifecycle methods");
15670
- Pn = external_exports.any().describe("Source initialization function: (config, env) => Instance | Promise<Instance>");
15671
- En = external_exports.object({ code: Pn.describe("Source initialization function"), config: xn.optional().describe("Partial configuration overrides"), env: Cn.partial().optional().describe("Partial environment overrides"), primary: external_exports.boolean().optional().describe("Mark as primary source (only one can be primary)") }).describe("Source initialization configuration");
15672
- Dn = external_exports.record(external_exports.string(), En).describe("Map of source IDs to initialization configurations");
15673
- In = o(Cn);
15731
+ En = external_exports.any().describe("Source initialization function: (config, env) => Instance | Promise<Instance>");
15732
+ Pn = external_exports.object({ code: En.describe("Source initialization function"), config: xn.optional().describe("Partial configuration overrides"), env: Cn.partial().optional().describe("Partial environment overrides"), primary: external_exports.boolean().optional().describe("Mark as primary source (only one can be primary)") }).describe("Source initialization configuration");
15733
+ In = external_exports.record(external_exports.string(), Pn).describe("Map of source IDs to initialization configurations");
15734
+ Dn = o(Cn);
15674
15735
  Rn = o(jn);
15675
15736
  On = o(xn);
15676
- Ln = o(Jn);
15677
- zn = o(En);
15678
- Nn = o(Dn);
15737
+ Nn = o(Jn);
15738
+ zn = o(Pn);
15739
+ Ln = o(In);
15679
15740
  qn = {};
15680
- n(qn, { ConfigSchema: () => ti, ConfigV2Schema: () => ii, ContractActionsSchema: () => Xn, ContractSchema: () => Yn, ContractSchemaEntry: () => Kn, DefinitionsSchema: () => Un, DestinationReferenceSchema: () => Qn, InlineCodeSchema: () => Bn, PackagesSchema: () => Vn, PrimitiveSchema: () => Tn, ServerSchema: () => $n, SettingsSchema: () => Zn, SourceReferenceSchema: () => Hn, StepExampleSchema: () => An, StepExamplesSchema: () => Fn, StoreReferenceSchema: () => _n, TransformerReferenceSchema: () => Gn, VariablesSchema: () => Mn, WebSchema: () => Wn, configJsonSchema: () => ci, configV2JsonSchema: () => li, destinationReferenceJsonSchema: () => ui, parseConfig: () => oi, parseSettings: () => ai, safeParseConfig: () => ri, safeParseSettings: () => si, settingsJsonSchema: () => di, sourceReferenceJsonSchema: () => pi, storeReferenceJsonSchema: () => bi, transformerReferenceJsonSchema: () => mi });
15741
+ n(qn, { ConfigSchema: () => ii, ContractActionsSchema: () => Xn, ContractEntrySchema: () => Zn, ContractEventsSchema: () => Yn, ContractSchema: () => ei, ContractSchemaEntry: () => Kn, DefinitionsSchema: () => Un, DestinationReferenceSchema: () => Qn, InlineCodeSchema: () => Vn, PackagesSchema: () => Wn, PrimitiveSchema: () => Tn, ServerSchema: () => Bn, SettingsSchema: () => ni, SourceReferenceSchema: () => Fn, StepExampleSchema: () => An, StepExamplesSchema: () => Hn, StoreReferenceSchema: () => _n, TransformerReferenceSchema: () => Gn, VariablesSchema: () => Mn, WebSchema: () => $n, configJsonSchema: () => si, contractEntryJsonSchema: () => mi, contractJsonSchema: () => bi, destinationReferenceJsonSchema: () => di, parseConfig: () => ti, parseSettings: () => ri, safeParseConfig: () => oi, safeParseSettings: () => ai, settingsJsonSchema: () => ci, sourceReferenceJsonSchema: () => li, storeReferenceJsonSchema: () => ui, transformerReferenceJsonSchema: () => pi });
15681
15742
  Tn = external_exports.union([external_exports.string(), external_exports.number(), external_exports.boolean()]).describe("Primitive value: string, number, or boolean");
15682
15743
  Mn = external_exports.record(external_exports.string(), Tn).describe("Variables for interpolation");
15683
15744
  Un = external_exports.record(external_exports.string(), external_exports.unknown()).describe("Reusable configuration definitions");
15684
- Vn = external_exports.record(external_exports.string().regex(/^(@[a-z0-9\-~][a-z0-9\-._~]*\/)?[a-z0-9\-~][a-z0-9\-._~]*$/, "Invalid npm package name"), external_exports.object({ version: external_exports.string().optional(), imports: external_exports.array(external_exports.string()).optional(), path: external_exports.string().optional() })).describe("NPM packages to bundle");
15685
- Wn = external_exports.object({ windowCollector: external_exports.string().optional().default("collector").describe('Window property name for the collector instance (default: "collector")'), windowElb: external_exports.string().optional().default("elb").describe('Window property name for the elb command queue (default: "elb")') }).describe("Web platform configuration");
15686
- $n = external_exports.object({}).passthrough().describe("Server platform configuration (reserved for future options)");
15687
- Bn = external_exports.object({ push: external_exports.string().min(1, "Push function cannot be empty").describe('JavaScript function for processing events. Must start with "$code:" prefix. Example: "$code:(event) => { console.log(event); }"'), type: external_exports.string().optional().describe("Optional type identifier for the inline instance"), init: external_exports.string().optional().describe("Optional initialization function. Use $code: prefix for inline JavaScript.") }).describe("Inline code for custom sources/transformers/destinations");
15745
+ Wn = external_exports.record(external_exports.string().regex(/^(@[a-z0-9\-~][a-z0-9\-._~]*\/)?[a-z0-9\-~][a-z0-9\-._~]*$/, "Invalid npm package name"), external_exports.object({ version: external_exports.string().optional(), imports: external_exports.array(external_exports.string()).optional(), path: external_exports.string().optional() })).describe("NPM packages to bundle");
15746
+ $n = external_exports.object({ windowCollector: external_exports.string().default("collector").optional().describe('Window property name for the collector instance (default: "collector")'), windowElb: external_exports.string().default("elb").optional().describe('Window property name for the elb command queue (default: "elb")') }).describe("Web platform configuration");
15747
+ Bn = external_exports.object({}).passthrough().describe("Server platform configuration (reserved for future options)");
15748
+ Vn = external_exports.object({ push: external_exports.string().min(1, "Push function cannot be empty").describe('JavaScript function for processing events. Must start with "$code:" prefix. Example: "$code:(event) => { console.log(event); }"'), type: external_exports.string().optional().describe("Optional type identifier for the inline instance"), init: external_exports.string().optional().describe("Optional initialization function. Use $code: prefix for inline JavaScript.") }).describe("Inline code for custom sources/transformers/destinations");
15688
15749
  An = external_exports.object({ in: external_exports.unknown().optional().describe("Input to the step"), out: external_exports.unknown().optional().describe("Expected output from the step") }).describe("Named example with input/output pair");
15689
- Fn = external_exports.record(external_exports.string(), An).describe("Named step examples for testing and documentation");
15690
- Hn = external_exports.object({ package: external_exports.string().min(1, "Package name cannot be empty").optional().describe('Package specifier with optional version (e.g., "@walkeros/web-source-browser@2.0.0")'), code: external_exports.union([external_exports.string(), Bn]).optional().describe('Either a named export string (e.g., "sourceExpress") or an inline code object with push function'), config: external_exports.unknown().optional().describe("Source-specific configuration object"), env: external_exports.unknown().optional().describe("Source environment configuration"), primary: external_exports.boolean().optional().describe("Mark as primary source (provides main elb). Only one source should be primary."), variables: Mn.optional().describe("Source-level variables (highest priority in cascade)"), definitions: Un.optional().describe("Source-level definitions (highest priority in cascade)"), next: external_exports.union([external_exports.string(), external_exports.array(external_exports.string())]).optional().describe("First transformer in post-source chain. If omitted, events route directly to collector."), examples: Fn.optional().describe("Named step examples for testing and documentation (stripped during bundling)") }).describe("Source package reference with configuration");
15691
- Gn = external_exports.object({ package: external_exports.string().min(1, "Package name cannot be empty").optional().describe('Package specifier with optional version (e.g., "@walkeros/transformer-enricher@1.0.0")'), code: external_exports.union([external_exports.string(), Bn]).optional().describe('Either a named export string (e.g., "transformerEnricher") or an inline code object with push function'), config: external_exports.unknown().optional().describe("Transformer-specific configuration object"), env: external_exports.unknown().optional().describe("Transformer environment configuration"), next: external_exports.union([external_exports.string(), external_exports.array(external_exports.string())]).optional().describe("Next transformer in chain. If omitted: pre-collector routes to collector, post-collector routes to destination."), variables: Mn.optional().describe("Transformer-level variables (highest priority in cascade)"), definitions: Un.optional().describe("Transformer-level definitions (highest priority in cascade)"), examples: Fn.optional().describe("Named step examples for testing and documentation (stripped during bundling)") }).describe("Transformer package reference with configuration");
15692
- Qn = external_exports.object({ package: external_exports.string().min(1, "Package name cannot be empty").optional().describe('Package specifier with optional version (e.g., "@walkeros/web-destination-gtag@2.0.0")'), code: external_exports.union([external_exports.string(), Bn]).optional().describe('Either a named export string (e.g., "destinationAnalytics") or an inline code object with push function'), config: external_exports.unknown().optional().describe("Destination-specific configuration object"), env: external_exports.unknown().optional().describe("Destination environment configuration"), variables: Mn.optional().describe("Destination-level variables (highest priority in cascade)"), definitions: Un.optional().describe("Destination-level definitions (highest priority in cascade)"), before: external_exports.union([external_exports.string(), external_exports.array(external_exports.string())]).optional().describe("First transformer in pre-destination chain. If omitted, events are sent directly from collector."), examples: Fn.optional().describe("Named step examples for testing and documentation (stripped during bundling)") }).describe("Destination package reference with configuration");
15693
- _n = external_exports.object({ package: external_exports.string().min(1, "Package name cannot be empty").optional().describe("Store package specifier with optional version"), code: external_exports.union([external_exports.string(), Bn]).optional().describe("Named export string or inline code definition"), config: external_exports.unknown().optional().describe("Store-specific configuration object"), env: external_exports.unknown().optional().describe("Store environment configuration"), variables: Mn.optional().describe("Store-level variables (highest priority in cascade)"), definitions: Un.optional().describe("Store-level definitions (highest priority in cascade)"), examples: Fn.optional().describe("Named step examples for testing and documentation (stripped during bundling)") }).describe("Store package reference with configuration");
15750
+ Hn = external_exports.record(external_exports.string(), An).describe("Named step examples for testing and documentation");
15751
+ Fn = external_exports.object({ package: external_exports.string().min(1, "Package name cannot be empty").optional().describe('Package specifier with optional version (e.g., "@walkeros/web-source-browser@2.0.0")'), code: external_exports.union([external_exports.string(), Vn]).optional().describe('Either a named export string (e.g., "sourceExpress") or an inline code object with push function'), config: external_exports.unknown().optional().describe("Source-specific configuration object"), env: external_exports.unknown().optional().describe("Source environment configuration"), primary: external_exports.boolean().optional().describe("Mark as primary source (provides main elb). Only one source should be primary."), variables: Mn.optional().describe("Source-level variables (highest priority in cascade)"), definitions: Un.optional().describe("Source-level definitions (highest priority in cascade)"), next: external_exports.union([external_exports.string(), external_exports.array(external_exports.string())]).optional().describe("Pre-collector transformer chain. Name of the first transformer to run after this source captures an event. If omitted, events go directly to the collector. Can be an array for explicit chain control."), examples: Hn.optional().describe("Named step examples for testing and documentation (stripped during bundling)") }).describe("Source package reference with configuration");
15752
+ Gn = external_exports.object({ package: external_exports.string().min(1, "Package name cannot be empty").optional().describe('Package specifier with optional version (e.g., "@walkeros/transformer-enricher@1.0.0")'), code: external_exports.union([external_exports.string(), Vn]).optional().describe('Either a named export string (e.g., "transformerEnricher") or an inline code object with push function'), config: external_exports.unknown().optional().describe("Transformer-specific configuration object"), env: external_exports.unknown().optional().describe("Transformer environment configuration"), next: external_exports.union([external_exports.string(), external_exports.array(external_exports.string())]).optional().describe("Next transformer in chain. If omitted: pre-collector routes to collector, post-collector routes to destination."), variables: Mn.optional().describe("Transformer-level variables (highest priority in cascade)"), definitions: Un.optional().describe("Transformer-level definitions (highest priority in cascade)"), examples: Hn.optional().describe("Named step examples for testing and documentation (stripped during bundling)") }).describe("Transformer package reference with configuration");
15753
+ Qn = external_exports.object({ package: external_exports.string().min(1, "Package name cannot be empty").optional().describe('Package specifier with optional version (e.g., "@walkeros/web-destination-gtag@2.0.0")'), code: external_exports.union([external_exports.string(), Vn]).optional().describe('Either a named export string (e.g., "destinationAnalytics") or an inline code object with push function'), config: external_exports.unknown().optional().describe("Destination-specific configuration object"), env: external_exports.unknown().optional().describe("Destination environment configuration"), variables: Mn.optional().describe("Destination-level variables (highest priority in cascade)"), definitions: Un.optional().describe("Destination-level definitions (highest priority in cascade)"), before: external_exports.union([external_exports.string(), external_exports.array(external_exports.string())]).optional().describe("Post-collector transformer chain. Name of the first transformer to run before sending events to this destination. If omitted, events come directly from the collector. Can be an array for explicit chain control."), examples: Hn.optional().describe("Named step examples for testing and documentation (stripped during bundling)") }).describe("Destination package reference with configuration");
15754
+ _n = external_exports.object({ package: external_exports.string().min(1, "Package name cannot be empty").optional().describe("Store package specifier with optional version"), code: external_exports.union([external_exports.string(), Vn]).optional().describe("Named export string or inline code definition"), config: external_exports.unknown().optional().describe("Store-specific configuration object"), env: external_exports.unknown().optional().describe("Store environment configuration"), variables: Mn.optional().describe("Store-level variables (highest priority in cascade)"), definitions: Un.optional().describe("Store-level definitions (highest priority in cascade)"), examples: Hn.optional().describe("Named step examples for testing and documentation (stripped during bundling)") }).describe("Store package reference with configuration");
15694
15755
  Kn = external_exports.record(external_exports.string(), external_exports.unknown()).describe("JSON Schema object for event validation with description/examples annotations");
15695
15756
  Xn = external_exports.record(external_exports.string(), Kn).describe("Action-level contract entries");
15696
- Yn = external_exports.record(external_exports.string(), external_exports.union([Xn, external_exports.number()])).describe("Data contract: entity-action keyed JSON Schema with additive inheritance");
15697
- Zn = external_exports.object({ web: Wn.optional().describe("Web platform configuration (browser-based tracking). Mutually exclusive with server."), server: $n.optional().describe("Server platform configuration (Node.js). Mutually exclusive with web."), contract: Yn.optional().describe("Flow-level data contract (merges on top of Config-level contract)"), sources: external_exports.record(external_exports.string(), Hn).optional().describe("Source configurations (data capture) keyed by unique identifier"), destinations: external_exports.record(external_exports.string(), Qn).optional().describe("Destination configurations (data output) keyed by unique identifier"), transformers: external_exports.record(external_exports.string(), Gn).optional().describe("Transformer configurations (event transformation) keyed by unique identifier"), stores: external_exports.record(external_exports.string(), _n).optional().describe("Store configurations (key-value storage) keyed by unique identifier"), collector: external_exports.unknown().optional().describe("Collector configuration for event processing (uses Collector.InitConfig)"), packages: Vn.optional().describe("NPM packages to bundle"), variables: Mn.optional().describe("Flow-level variables (override Config.variables, overridden by source/destination variables)"), definitions: Un.optional().describe("Flow-level definitions (extend Config.definitions, overridden by source/destination definitions)") }).refine((e4) => {
15757
+ Yn = external_exports.record(external_exports.string(), Xn).describe("Entity-action event schemas");
15758
+ Zn = external_exports.object({ extends: external_exports.string().optional().describe("Inherit from another named contract"), tagging: external_exports.number().int().min(0).optional().describe("Contract version number"), description: external_exports.string().optional().describe("Human-readable description"), globals: Kn.optional().describe("JSON Schema for event.globals"), context: Kn.optional().describe("JSON Schema for event.context"), custom: Kn.optional().describe("JSON Schema for event.custom"), user: Kn.optional().describe("JSON Schema for event.user"), consent: Kn.optional().describe("JSON Schema for event.consent"), events: Yn.optional().describe("Entity-action event schemas") }).describe("Named contract entry with optional sections and events");
15759
+ ei = external_exports.record(external_exports.string(), Zn).describe("Named contracts with optional extends inheritance");
15760
+ ni = external_exports.object({ web: $n.optional().describe("Web platform configuration (browser-based tracking). Mutually exclusive with server."), server: Bn.optional().describe("Server platform configuration (Node.js). Mutually exclusive with web."), sources: external_exports.record(external_exports.string(), Fn).optional().describe("Source configurations (data capture) keyed by unique identifier"), destinations: external_exports.record(external_exports.string(), Qn).optional().describe("Destination configurations (data output) keyed by unique identifier"), transformers: external_exports.record(external_exports.string(), Gn).optional().describe("Transformer configurations (event transformation) keyed by unique identifier"), stores: external_exports.record(external_exports.string(), _n).optional().describe("Store configurations (key-value storage) keyed by unique identifier"), collector: external_exports.unknown().optional().describe("Collector configuration for event processing (uses Collector.InitConfig)"), packages: Wn.optional().describe("NPM packages to bundle"), variables: Mn.optional().describe("Flow-level variables (override Config.variables, overridden by source/destination variables)"), definitions: Un.optional().describe("Flow-level definitions (extend Config.definitions, overridden by source/destination definitions)") }).refine((e4) => {
15698
15761
  const n3 = void 0 !== e4.web, i2 = void 0 !== e4.server;
15699
15762
  return (n3 || i2) && !(n3 && i2);
15700
15763
  }, { message: 'Exactly one of "web" or "server" must be present' }).describe("Single flow settings for one deployment target");
15701
- ei = external_exports.object({ $schema: external_exports.string().url("Schema URL must be a valid URL").optional().describe('JSON Schema reference for IDE validation (e.g., "https://walkeros.io/schema/flow/v2.json")'), include: external_exports.array(external_exports.string()).optional().describe("Folders to include in the bundle output"), variables: Mn.optional().describe("Shared variables for interpolation across all flows (use $var.name syntax)"), definitions: Un.optional().describe("Reusable configuration definitions (use $def.name syntax)"), flows: external_exports.record(external_exports.string(), Zn).refine((e4) => Object.keys(e4).length > 0, { message: "At least one flow is required" }).describe("Named flow configurations (e.g., production, staging, development)") });
15702
- ni = ei.extend({ version: external_exports.literal(1).describe("Configuration schema version 1") }).describe("walkerOS v1 configuration");
15703
- ii = ei.extend({ version: external_exports.literal(2).describe("Configuration schema version 2"), contract: Yn.optional().describe("Data contract: entity-action keyed JSON Schema with additive inheritance") }).describe("walkerOS v2 configuration with data contracts");
15704
- ti = external_exports.union([ni, ii]).describe("Complete multi-flow walkerOS configuration (walkeros.config.json)");
15705
- ci = external_exports.toJSONSchema(ti, { target: "draft-7" });
15706
- li = external_exports.toJSONSchema(ii, { target: "draft-7" });
15707
- di = o(Zn);
15708
- pi = o(Hn);
15709
- ui = o(Qn);
15710
- mi = o(Gn);
15711
- bi = o(_n);
15764
+ ii = external_exports.object({ $schema: external_exports.string().url("Schema URL must be a valid URL").optional().describe('JSON Schema reference for IDE validation (e.g., "https://walkeros.io/schema/flow/v2.json")'), include: external_exports.array(external_exports.string()).optional().describe("Folders to include in the bundle output"), variables: Mn.optional().describe("Shared variables for interpolation across all flows (use $var.name syntax)"), definitions: Un.optional().describe("Reusable configuration definitions (use $def.name syntax)"), flows: external_exports.record(external_exports.string(), ni).refine((e4) => Object.keys(e4).length > 0, { message: "At least one flow is required" }).describe("Named flow configurations (e.g., production, staging, development)") }).extend({ version: external_exports.literal(3).describe("Configuration schema version"), contract: ei.optional().describe("Named contracts with extends inheritance and dot-path references") }).describe("walkerOS flow configuration (walkeros.config.json)");
15765
+ si = external_exports.toJSONSchema(ii, { target: "draft-7" });
15766
+ ci = o(ni);
15767
+ li = o(Fn);
15768
+ di = o(Qn);
15769
+ pi = o(Gn);
15770
+ ui = o(_n);
15771
+ mi = o(Zn);
15772
+ bi = o(ei);
15773
+ gi = external_exports.object({ lang: external_exports.string().optional().describe("Language identifier (e.g. json, sql, bash, typescript)"), code: external_exports.string().describe("Code snippet") });
15774
+ hi = external_exports.object({ text: external_exports.string().describe("Short actionable hint text focused on walkerOS usage"), code: external_exports.array(gi).optional().describe("Optional code snippets") });
15775
+ vi = external_exports.record(external_exports.string(), hi).describe("Keyed hints for AI consumption \u2014 lightweight context beyond schemas and examples");
15712
15776
  }
15713
15777
  });
15714
15778
 
@@ -15783,7 +15847,7 @@ function loadBundleConfig(rawConfig, options) {
15783
15847
  const config2 = validateFlowConfig(rawConfig);
15784
15848
  const availableFlows = getAvailableFlows(config2);
15785
15849
  const flowName = resolveFlow(config2, options.flowName, availableFlows);
15786
- let flowSettings = C(config2, flowName, { deferred: true });
15850
+ let flowSettings = H(config2, flowName, { deferred: true });
15787
15851
  const platform = D(flowSettings);
15788
15852
  if (!platform) {
15789
15853
  throw new Error(
@@ -15791,7 +15855,7 @@ function loadBundleConfig(rawConfig, options) {
15791
15855
  );
15792
15856
  }
15793
15857
  if (platform === "web") {
15794
- flowSettings = C(config2, flowName);
15858
+ flowSettings = H(config2, flowName);
15795
15859
  }
15796
15860
  const buildDefaults = getBuildDefaults(platform);
15797
15861
  const packages = flowSettings.packages || {};
@@ -15880,6 +15944,7 @@ var init_config = __esm({
15880
15944
  "src/config/index.ts"() {
15881
15945
  "use strict";
15882
15946
  init_validators();
15947
+ init_build_defaults();
15883
15948
  init_utils();
15884
15949
  init_loader();
15885
15950
  }
@@ -15887,7 +15952,7 @@ var init_config = __esm({
15887
15952
 
15888
15953
  // ../server/core/dist/index.mjs
15889
15954
  import { createHash as n2 } from "crypto";
15890
- async function u3(t2, e4) {
15955
+ async function u2(t2, e4) {
15891
15956
  return (await (async function(t3) {
15892
15957
  const e5 = n2("sha256");
15893
15958
  return e5.update(t3), e5.digest("hex");
@@ -15896,12 +15961,15 @@ async function u3(t2, e4) {
15896
15961
  var init_dist2 = __esm({
15897
15962
  "../server/core/dist/index.mjs"() {
15898
15963
  "use strict";
15964
+ init_dist();
15899
15965
  }
15900
15966
  });
15901
15967
 
15902
15968
  // src/core/cache-utils.ts
15969
+ import semver from "semver";
15903
15970
  function isMutableVersion(version2) {
15904
- return version2 === "latest" || version2.includes("^") || version2.includes("~") || version2.includes("*") || version2.includes("x");
15971
+ if (semver.valid(version2)) return false;
15972
+ return true;
15905
15973
  }
15906
15974
  function getTodayDate() {
15907
15975
  return (/* @__PURE__ */ new Date()).toISOString().split("T")[0];
@@ -15911,10 +15979,10 @@ async function getPackageCacheKey(packageName, version2, date5) {
15911
15979
  if (isMutableVersion(version2)) {
15912
15980
  const dateStr = date5 ?? getTodayDate();
15913
15981
  const input2 = `${safeName}@${version2}:${dateStr}`;
15914
- return u3(input2, HASH_LENGTH);
15982
+ return u2(input2, HASH_LENGTH);
15915
15983
  }
15916
15984
  const input = `${safeName}@${version2}`;
15917
- return u3(input, HASH_LENGTH);
15985
+ return u2(input, HASH_LENGTH);
15918
15986
  }
15919
15987
  function normalizeJson(content) {
15920
15988
  const parsed = JSON.parse(content);
@@ -15924,7 +15992,7 @@ async function getFlowSettingsCacheKey(content, date5) {
15924
15992
  const dateStr = date5 ?? getTodayDate();
15925
15993
  const normalized = normalizeJson(content);
15926
15994
  const input = `${normalized}:${dateStr}`;
15927
- return u3(input, HASH_LENGTH);
15995
+ return u2(input, HASH_LENGTH);
15928
15996
  }
15929
15997
  var HASH_LENGTH;
15930
15998
  var init_cache_utils = __esm({
@@ -15939,7 +16007,7 @@ var init_cache_utils = __esm({
15939
16007
  import pacote from "pacote";
15940
16008
  import path7 from "path";
15941
16009
  import fs6 from "fs-extra";
15942
- import semver from "semver";
16010
+ import semver2 from "semver";
15943
16011
  async function withTimeout(promise2, ms, errorMessage) {
15944
16012
  let timer;
15945
16013
  const timeout = new Promise((_3, reject) => {
@@ -16051,14 +16119,14 @@ function resolveVersionConflicts(allSpecs, logger) {
16051
16119
  (a3, b2) => SOURCE_PRIORITY[a3.source] - SOURCE_PRIORITY[b2.source]
16052
16120
  );
16053
16121
  const directSpecs = activeSpecs.filter((s3) => s3.source === "direct");
16054
- const directExact = directSpecs.find((s3) => semver.valid(s3.spec) !== null);
16122
+ const directExact = directSpecs.find((s3) => semver2.valid(s3.spec) !== null);
16055
16123
  let chosenVersion;
16056
16124
  if (directExact) {
16057
16125
  chosenVersion = directExact.spec;
16058
16126
  } else if (directSpecs.length > 0) {
16059
16127
  chosenVersion = directSpecs[0].spec;
16060
16128
  } else {
16061
- const exactVersions = activeSpecs.filter((s3) => semver.valid(s3.spec) !== null).map((s3) => s3.spec);
16129
+ const exactVersions = activeSpecs.filter((s3) => semver2.valid(s3.spec) !== null).map((s3) => s3.spec);
16062
16130
  const uniqueExact = [...new Set(exactVersions)];
16063
16131
  if (uniqueExact.length > 1) {
16064
16132
  throw new Error(
@@ -16070,10 +16138,10 @@ function resolveVersionConflicts(allSpecs, logger) {
16070
16138
  chosenVersion = activeSpecs[0].spec;
16071
16139
  }
16072
16140
  }
16073
- if (semver.valid(chosenVersion)) {
16141
+ if (semver2.valid(chosenVersion)) {
16074
16142
  for (const spec of specs) {
16075
16143
  if (spec.localPath) continue;
16076
- if (semver.valid(spec.spec)) {
16144
+ if (semver2.valid(spec.spec)) {
16077
16145
  if (spec.spec !== chosenVersion) {
16078
16146
  if (spec.source === "peerDependency") {
16079
16147
  logger.warn(
@@ -16082,7 +16150,7 @@ function resolveVersionConflicts(allSpecs, logger) {
16082
16150
  }
16083
16151
  }
16084
16152
  } else {
16085
- if (!semver.satisfies(chosenVersion, spec.spec, {
16153
+ if (!semver2.satisfies(chosenVersion, spec.spec, {
16086
16154
  includePrerelease: true
16087
16155
  })) {
16088
16156
  if (spec.source === "peerDependency") {
@@ -16199,7 +16267,7 @@ function validateNoDuplicatePackages(packages) {
16199
16267
  if (conflicts.length > 0) {
16200
16268
  throw new Error(
16201
16269
  `Version conflicts detected:
16202
- ${conflicts.map((c2) => ` - ${c2}`).join("\n")}
16270
+ ${conflicts.map((c3) => ` - ${c3}`).join("\n")}
16203
16271
 
16204
16272
  Each package must use the same version across all declarations. Please update your configuration to use consistent versions.`
16205
16273
  );
@@ -16777,7 +16845,7 @@ function generateImportStatements(packages, destinationPackages, sourcePackages,
16777
16845
  const hasExplicitCode = explicitCodeImports.has(packageName);
16778
16846
  const namedImportsToGenerate = [];
16779
16847
  if (isUsedByDestOrSource && !hasExplicitCode) {
16780
- const varName = _(packageName);
16848
+ const varName = M(packageName);
16781
16849
  importStatements.push(`import ${varName} from '${packageName}';`);
16782
16850
  }
16783
16851
  if (hasExplicitCode) {
@@ -16830,7 +16898,7 @@ function validateComponentNames(components, section) {
16830
16898
  for (const name of Object.keys(components)) {
16831
16899
  if (!VALID_JS_IDENTIFIER.test(name)) {
16832
16900
  throw new Error(
16833
- `Invalid ${section} name "${name}": must be a valid JavaScript identifier (use camelCase, e.g., "${name.replace(/-([a-z])/g, (_3, c2) => c2.toUpperCase())}")`
16901
+ `Invalid ${section} name "${name}": must be a valid JavaScript identifier (use camelCase, e.g., "${name.replace(/-([a-z])/g, (_3, c3) => c3.toUpperCase())}")`
16834
16902
  );
16835
16903
  }
16836
16904
  }
@@ -16975,7 +17043,7 @@ function buildConfigObject(flowSettings, explicitCodeImports) {
16975
17043
  if (source.code && typeof source.code === "string" && explicitCodeImports.has(source.package)) {
16976
17044
  codeVar = source.code;
16977
17045
  } else {
16978
- codeVar = _(source.package);
17046
+ codeVar = M(source.package);
16979
17047
  }
16980
17048
  const configStr = source.config ? processConfigValue(source.config) : "{}";
16981
17049
  const envStr = source.env ? `,
@@ -16997,7 +17065,7 @@ function buildConfigObject(flowSettings, explicitCodeImports) {
16997
17065
  if (dest.code && typeof dest.code === "string" && explicitCodeImports.has(dest.package)) {
16998
17066
  codeVar = dest.code;
16999
17067
  } else {
17000
- codeVar = _(dest.package);
17068
+ codeVar = M(dest.package);
17001
17069
  }
17002
17070
  const configStr = dest.config ? processConfigValue(dest.config) : "{}";
17003
17071
  const envStr = dest.env ? `,
@@ -17019,7 +17087,7 @@ function buildConfigObject(flowSettings, explicitCodeImports) {
17019
17087
  if (transformer.code && typeof transformer.code === "string" && explicitCodeImports.has(transformer.package)) {
17020
17088
  codeVar = transformer.code;
17021
17089
  } else {
17022
- codeVar = _(transformer.package);
17090
+ codeVar = M(transformer.package);
17023
17091
  }
17024
17092
  const configStr = transformer.config ? processConfigValue(transformer.config) : "{}";
17025
17093
  const envStr = transformer.env ? `,
@@ -17044,7 +17112,7 @@ function buildConfigObject(flowSettings, explicitCodeImports) {
17044
17112
  if (store.code && typeof store.code === "string" && explicitCodeImports.has(store.package)) {
17045
17113
  codeVar = store.code;
17046
17114
  } else {
17047
- codeVar = _(store.package);
17115
+ codeVar = M(store.package);
17048
17116
  }
17049
17117
  const configStr = store.config ? processConfigValue(store.config) : "{}";
17050
17118
  const envStr = store.env ? `,
@@ -17536,6 +17604,7 @@ var init_bundle = __esm({
17536
17604
  init_bundler();
17537
17605
  init_upload();
17538
17606
  init_stats();
17607
+ init_api_client();
17539
17608
  init_dockerfile();
17540
17609
  }
17541
17610
  });
@@ -17690,7 +17759,7 @@ function s2(n3, e4) {
17690
17759
  return Object.entries(e4).forEach(([n4, e5]) => {
17691
17760
  const o2 = !!e5;
17692
17761
  s3[n4] = o2, t2 = t2 || o2;
17693
- }), n3.consent = I(n3.consent, s3), { update: s3, runQueue: t2 };
17762
+ }), n3.consent = W(n3.consent, s3), { update: s3, runQueue: t2 };
17694
17763
  }
17695
17764
  function D3(n3) {
17696
17765
  const e4 = {};
@@ -17721,17 +17790,17 @@ async function x3(n3, e4, t2) {
17721
17790
  if (e4.init && !e4.config.init) {
17722
17791
  const o2 = e4.type || "unknown", s3 = n3.logger.scope(`transformer:${o2}`), r2 = { collector: n3, logger: s3, id: t2, config: e4.config, env: $3(e4.config.env) };
17723
17792
  s3.debug("init");
17724
- const i2 = await _e(e4.init, "TransformerInit", n3.hooks)(r2);
17793
+ const i2 = await Te(e4.init, "TransformerInit", n3.hooks)(r2);
17725
17794
  if (false === i2) return false;
17726
- e4.config = { ...i2 || e4.config, init: true }, s3.debug("init done");
17795
+ e4.config = { ...i2 || e4.config, env: i2?.env || e4.config.env, init: true }, s3.debug("init done");
17727
17796
  }
17728
17797
  return true;
17729
17798
  }
17730
17799
  async function P3(n3, e4, t2, o2, s3, r2) {
17731
- const i2 = e4.type || "unknown", a3 = n3.logger.scope(`transformer:${i2}`), c2 = { collector: n3, logger: a3, id: t2, ingest: s3, config: e4.config, env: { ...$3(e4.config.env), ...r2 ? { respond: r2 } : {} } };
17800
+ const i2 = e4.type || "unknown", a3 = n3.logger.scope(`transformer:${i2}`), c3 = { collector: n3, logger: a3, id: t2, ingest: s3, config: e4.config, env: { ...$3(e4.config.env), ...r2 ? { respond: r2 } : {} } };
17732
17801
  a3.debug("push", { event: o2.name });
17733
- const u4 = await _e(e4.push, "TransformerPush", n3.hooks)(o2, c2);
17734
- return a3.debug("push done"), u4;
17802
+ const u3 = await Te(e4.push, "TransformerPush", n3.hooks)(o2, c3);
17803
+ return a3.debug("push done"), u3;
17735
17804
  }
17736
17805
  async function S3(n3, e4, t2, o2, s3, r2) {
17737
17806
  let i2 = o2, a3 = r2;
@@ -17745,10 +17814,10 @@ async function S3(n3, e4, t2, o2, s3, r2) {
17745
17814
  const r3 = await he(P3, (e5) => (n3.logger.scope(`transformer:${t3.type || "unknown"}`).error("Push failed", { error: e5 }), false))(n3, t3, o3, i2, s3, a3);
17746
17815
  if (false === r3) return null;
17747
17816
  if (r3 && "object" == typeof r3) {
17748
- const { event: t4, respond: o4, next: c2 } = r3;
17749
- if (o4 && (a3 = o4), c2) {
17750
- const o5 = E3(c2, D3(e4));
17751
- return o5.length > 0 ? S3(n3, e4, o5, t4 || i2, s3, a3) : (n3.logger.warn(`Branch target not found: ${JSON.stringify(c2)}`), null);
17817
+ const { event: t4, respond: o4, next: c3 } = r3;
17818
+ if (o4 && (a3 = o4), c3) {
17819
+ const o5 = E3(c3, D3(e4));
17820
+ return o5.length > 0 ? S3(n3, e4, o5, t4 || i2, s3, a3) : (n3.logger.warn(`Branch target not found: ${JSON.stringify(c3)}`), null);
17752
17821
  }
17753
17822
  t4 && (i2 = t4);
17754
17823
  }
@@ -17760,11 +17829,11 @@ function $3(n3) {
17760
17829
  }
17761
17830
  async function R3(n3, e4, t2) {
17762
17831
  const { code: o2, config: s3 = {}, env: r2 = {}, primary: i2, next: a3 } = t2;
17763
- let c2, u4;
17764
- const f2 = E3(a3, D3(n3.transformers)), l2 = n3.logger.scope("source").scope(e4), g2 = { push: (t3, o3 = {}) => n3.push(t3, { ...o3, id: e4, ingest: c2, respond: u4, mapping: s3, preChain: f2 }), command: n3.command, sources: n3.sources, elb: n3.sources.elb.push, logger: l2, ...r2 }, d2 = { collector: n3, logger: l2, id: e4, config: s3, env: g2, setIngest: async (e5) => {
17765
- c2 = s3.ingest ? await je(e5, s3.ingest, { collector: n3 }) : void 0;
17832
+ let c3, u3;
17833
+ const f2 = E3(a3, D3(n3.transformers)), l2 = n3.logger.scope("source").scope(e4), g2 = { push: (t3, o3 = {}) => n3.push(t3, { ...o3, id: e4, ingest: c3, respond: u3, mapping: s3, preChain: f2 }), command: n3.command, sources: n3.sources, elb: n3.sources.elb.push, logger: l2, ...r2 }, d2 = { collector: n3, logger: l2, id: e4, config: s3, env: g2, setIngest: async (e5) => {
17834
+ c3 = s3.ingest ? await je(e5, s3.ingest, { collector: n3 }) : void 0;
17766
17835
  }, setRespond: (n4) => {
17767
- u4 = n4;
17836
+ u3 = n4;
17768
17837
  } }, m2 = await he(o2)(d2);
17769
17838
  if (!m2) return;
17770
17839
  const p2 = m2.type || "unknown", h2 = n3.logger.scope(p2).scope(e4);
@@ -17789,9 +17858,9 @@ async function I3(n3, e4, t2) {
17789
17858
  s3.push(n4);
17790
17859
  }), o2[e4] = s3, await G2(n3, e4, r2);
17791
17860
  }
17792
- function B3(n3, e4, t2, o2, s3) {
17861
+ function B2(n3, e4, t2, o2, s3) {
17793
17862
  if (!e4.on) return;
17794
- const r2 = e4.type || "unknown", i2 = n3.logger.scope(r2).scope("on").scope(o2), a3 = { collector: n3, logger: i2, id: t2, config: e4.config, data: s3, env: L3(e4.env, e4.config.env) };
17863
+ const r2 = e4.type || "unknown", i2 = n3.logger.scope(r2).scope("on").scope(o2), a3 = { collector: n3, logger: i2, id: t2, config: e4.config, data: s3, env: W3(e4.env, e4.config.env) };
17795
17864
  ve(e4.on)(o2, a3);
17796
17865
  }
17797
17866
  async function G2(n3, e4, o2, s3) {
@@ -17827,7 +17896,7 @@ async function G2(n3, e4, o2, s3) {
17827
17896
  if (Object.entries(n3.destinations).forEach(([t2, o3]) => {
17828
17897
  if (o3.on) {
17829
17898
  if (!o3.config.init) return o3.queueOn = o3.queueOn || [], void o3.queueOn.push({ type: e4, data: r2 });
17830
- B3(n3, o3, t2, e4, r2);
17899
+ B2(n3, o3, t2, e4, r2);
17831
17900
  }
17832
17901
  }), (Object.keys(n3.pending.sources).length > 0 || Object.keys(n3.pending.destinations).length > 0) && await (async function(n4, e5) {
17833
17902
  for (const [t2, o3] of Object.entries(n4.pending.sources)) {
@@ -17849,7 +17918,7 @@ async function G2(n3, e4, o2, s3) {
17849
17918
  if (-1 === r3) continue;
17850
17919
  if (s4.splice(r3, 1), s4.length > 0) continue;
17851
17920
  delete n4.pending.destinations[t2];
17852
- const i3 = W3(o3);
17921
+ const i3 = M3(o3);
17853
17922
  false !== i3.config.queue && (i3.queuePush = [...n4.queue]), n4.destinations[t2] = i3;
17854
17923
  }
17855
17924
  })(n3, e4), !i2.length) return !a3;
@@ -17889,17 +17958,17 @@ async function G2(n3, e4, o2, s3) {
17889
17958
  }
17890
17959
  async function H3(n3, e4, t2) {
17891
17960
  const { code: o2, config: s3 = {}, env: r2 = {}, before: i2 } = e4;
17892
- if (!Z(o2.push)) return N3({ ok: false, failed: { invalid: { type: "invalid", error: "Destination code must have a push method" } } });
17893
- const a3 = t2 || s3 || { init: false }, c2 = i2 ? { ...a3, before: i2 } : a3, u4 = { ...o2, config: c2, env: L3(o2.env, r2) };
17894
- let l2 = u4.config.id;
17961
+ if (!J(o2.push)) return J3({ ok: false, failed: { invalid: { type: "invalid", error: "Destination code must have a push method" } } });
17962
+ const a3 = t2 || s3 || { init: false }, c3 = i2 ? { ...a3, before: i2 } : a3, u3 = { ...o2, config: c3, env: W3(o2.env, r2) };
17963
+ let l2 = u3.config.id;
17895
17964
  if (!l2) do {
17896
- l2 = se(4);
17965
+ l2 = ie(4);
17897
17966
  } while (n3.destinations[l2]);
17898
- return n3.destinations[l2] = u4, false !== u4.config.queue && (u4.queuePush = [...n3.queue]), U3(n3, void 0, {}, { [l2]: u4 });
17967
+ return n3.destinations[l2] = u3, false !== u3.config.queue && (u3.queuePush = [...n3.queue]), U3(n3, void 0, {}, { [l2]: u3 });
17899
17968
  }
17900
17969
  async function U3(n3, e4, t2 = {}, o2) {
17901
- const { allowed: s3, consent: r2, globals: i2, user: u4 } = n3;
17902
- if (!s3) return N3({ ok: false });
17970
+ const { allowed: s3, consent: r2, globals: i2, user: u3 } = n3;
17971
+ if (!s3) return J3({ ok: false });
17903
17972
  e4 && (n3.queue.push(e4), n3.status.in++), o2 || (o2 = n3.destinations);
17904
17973
  const f2 = await Promise.all(Object.entries(o2 || {}).map(async ([o3, s4]) => {
17905
17974
  let f3 = (s4.queuePush || []).map((n4) => ({ ...n4, consent: r2 }));
@@ -17909,7 +17978,7 @@ async function U3(n3, e4, t2 = {}, o2) {
17909
17978
  }
17910
17979
  if (!f3.length && !s4.queueOn?.length) return { id: o3, destination: s4, skipped: true };
17911
17980
  if (!f3.length && s4.queueOn?.length) {
17912
- const e5 = await he(F2)(n3, s4, o3);
17981
+ const e5 = await he(z4)(n3, s4, o3);
17913
17982
  return { id: o3, destination: s4, skipped: !e5 };
17914
17983
  }
17915
17984
  const g3 = [], d3 = f3.filter((n4) => {
@@ -17917,28 +17986,28 @@ async function U3(n3, e4, t2 = {}, o2) {
17917
17986
  return !e5 || (n4.consent = e5, g3.push(n4), false);
17918
17987
  });
17919
17988
  if (s4.queuePush.push(...d3), !g3.length) return { id: o3, destination: s4, queue: f3 };
17920
- if (!await he(F2)(n3, s4, o3)) return { id: o3, destination: s4, queue: f3 };
17989
+ if (!await he(z4)(n3, s4, o3)) return { id: o3, destination: s4, queue: f3 };
17921
17990
  let m3, p2;
17922
17991
  s4.dlq || (s4.dlq = []);
17923
17992
  const w2 = (function(n4, e5) {
17924
17993
  const t3 = n4.config.before;
17925
17994
  return t3 ? E3(t3, D3(e5)) : [];
17926
17995
  })(s4, n3.transformers);
17927
- let y2 = 0;
17996
+ let b2 = 0;
17928
17997
  return await Promise.all(g3.map(async (e5) => {
17929
- e5.globals = I(i2, e5.globals), e5.user = I(u4, e5.user);
17998
+ e5.globals = W(i2, e5.globals), e5.user = W(u3, e5.user);
17930
17999
  let r3 = e5;
17931
18000
  if (w2.length > 0 && n3.transformers && Object.keys(n3.transformers).length > 0) {
17932
18001
  const o4 = await S3(n3, n3.transformers, w2, e5, t2.ingest, t2.respond);
17933
18002
  if (null === o4) return e5;
17934
18003
  r3 = o4;
17935
18004
  }
17936
- const c2 = Date.now(), f4 = await he(J2, (e6) => {
18005
+ const c3 = Date.now(), f4 = await he(F2, (e6) => {
17937
18006
  const t3 = s4.type || "unknown";
17938
18007
  n3.logger.scope(t3).error("Push failed", { error: e6, event: r3.name }), m3 = e6, s4.dlq.push([r3, e6]);
17939
18008
  })(n3, s4, o3, r3, t2.ingest, t2.respond);
17940
- return y2 += Date.now() - c2, void 0 !== f4 && (p2 = f4), e5;
17941
- })), { id: o3, destination: s4, error: m3, response: p2, totalDuration: y2 };
18009
+ return b2 += Date.now() - c3, void 0 !== f4 && (p2 = f4), e5;
18010
+ })), { id: o3, destination: s4, error: m3, response: p2, totalDuration: b2 };
17942
18011
  })), g2 = {}, d2 = {}, m2 = {};
17943
18012
  for (const e5 of f2) {
17944
18013
  if (e5.skipped) continue;
@@ -17947,58 +18016,58 @@ async function U3(n3, e4, t2 = {}, o2) {
17947
18016
  const o3 = n3.status.destinations[e5.id], s4 = Date.now();
17948
18017
  e5.error ? (t3.error = e5.error, m2[e5.id] = t3, o3.failed++, o3.lastAt = s4, o3.duration += e5.totalDuration || 0, n3.status.failed++) : e5.queue && e5.queue.length ? d2[e5.id] = t3 : (g2[e5.id] = t3, o3.count++, o3.lastAt = s4, o3.duration += e5.totalDuration || 0, n3.status.out++);
17949
18018
  }
17950
- return N3({ event: e4, ...Object.keys(g2).length && { done: g2 }, ...Object.keys(d2).length && { queued: d2 }, ...Object.keys(m2).length && { failed: m2 } });
18019
+ return J3({ event: e4, ...Object.keys(g2).length && { done: g2 }, ...Object.keys(d2).length && { queued: d2 }, ...Object.keys(m2).length && { failed: m2 } });
17951
18020
  }
17952
- async function F2(n3, e4, t2) {
18021
+ async function z4(n3, e4, t2) {
17953
18022
  if (e4.init && !e4.config.init) {
17954
- const o2 = e4.type || "unknown", s3 = n3.logger.scope(o2), r2 = { collector: n3, logger: s3, id: t2, config: e4.config, env: L3(e4.env, e4.config.env) };
18023
+ const o2 = e4.type || "unknown", s3 = n3.logger.scope(o2), r2 = { collector: n3, logger: s3, id: t2, config: e4.config, env: W3(e4.env, e4.config.env) };
17955
18024
  s3.debug("init");
17956
- const i2 = await _e(e4.init, "DestinationInit", n3.hooks)(r2);
18025
+ const i2 = await Te(e4.init, "DestinationInit", n3.hooks)(r2);
17957
18026
  if (false === i2) return i2;
17958
18027
  if (e4.config = { ...i2 || e4.config, init: true }, e4.queueOn?.length) {
17959
18028
  const o3 = e4.queueOn;
17960
18029
  e4.queueOn = [];
17961
- for (const { type: s4, data: r3 } of o3) B3(n3, e4, t2, s4, r3);
18030
+ for (const { type: s4, data: r3 } of o3) B2(n3, e4, t2, s4, r3);
17962
18031
  }
17963
18032
  s3.debug("init done");
17964
18033
  }
17965
18034
  return true;
17966
18035
  }
17967
- async function J2(n3, e4, t2, o2, s3, r2) {
18036
+ async function F2(n3, e4, t2, o2, s3, r2) {
17968
18037
  const { config: i2 } = e4, a3 = await Oe(o2, i2, n3);
17969
18038
  if (a3.ignore) return false;
17970
- const c2 = e4.type || "unknown", f2 = n3.logger.scope(c2), l2 = { collector: n3, logger: f2, id: t2, config: i2, data: a3.data, rule: a3.mapping, ingest: s3, env: { ...L3(e4.env, i2.env), ...r2 ? { respond: r2 } : {} } }, d2 = a3.mapping, m2 = a3.mappingKey || "* *";
18039
+ const c3 = e4.type || "unknown", f2 = n3.logger.scope(c3), l2 = { collector: n3, logger: f2, id: t2, config: i2, data: a3.data, rule: a3.mapping, ingest: s3, env: { ...W3(e4.env, i2.env), ...r2 ? { respond: r2 } : {} } }, d2 = a3.mapping, m2 = a3.mappingKey || "* *";
17971
18040
  if (!d2?.batch || !e4.pushBatch) {
17972
18041
  f2.debug("push", { event: a3.event.name });
17973
- const t3 = await _e(e4.push, "DestinationPush", n3.hooks)(a3.event, l2);
18042
+ const t3 = await Te(e4.push, "DestinationPush", n3.hooks)(a3.event, l2);
17974
18043
  return f2.debug("push done"), t3;
17975
18044
  }
17976
18045
  {
17977
18046
  if (e4.batches = e4.batches || {}, !e4.batches[m2]) {
17978
18047
  const o4 = { key: m2, events: [], data: [] };
17979
18048
  e4.batches[m2] = { batched: o4, batchFn: ae(() => {
17980
- const o5 = e4.batches[m2].batched, a4 = { collector: n3, logger: f2, id: t2, config: i2, data: void 0, rule: d2, ingest: s3, env: { ...L3(e4.env, i2.env), ...r2 ? { respond: r2 } : {} } };
17981
- f2.debug("push batch", { events: o5.events.length }), _e(e4.pushBatch, "DestinationPushBatch", n3.hooks)(o5, a4), f2.debug("push batch done"), o5.events = [], o5.data = [];
18049
+ const o5 = e4.batches[m2].batched, a4 = { collector: n3, logger: f2, id: t2, config: i2, data: void 0, rule: d2, ingest: s3, env: { ...W3(e4.env, i2.env), ...r2 ? { respond: r2 } : {} } };
18050
+ f2.debug("push batch", { events: o5.events.length }), Te(e4.pushBatch, "DestinationPushBatch", n3.hooks)(o5, a4), f2.debug("push batch done"), o5.events = [], o5.data = [];
17982
18051
  }, d2.batch) };
17983
18052
  }
17984
18053
  const o3 = e4.batches[m2];
17985
- o3.batched.events.push(a3.event), B(a3.data) && o3.batched.data.push(a3.data), o3.batchFn();
18054
+ o3.batched.events.push(a3.event), V(a3.data) && o3.batched.data.push(a3.data), o3.batchFn();
17986
18055
  }
17987
18056
  return true;
17988
18057
  }
17989
- function N3(n3) {
18058
+ function J3(n3) {
17990
18059
  return { ok: !n3?.failed, ...n3 };
17991
18060
  }
17992
- function W3(n3) {
17993
- const { code: e4, config: t2 = {}, env: o2 = {} } = n3, { config: s3 } = A3(n3, "before"), r2 = { ...e4.config, ...t2, ...s3 }, i2 = L3(e4.env, o2);
18061
+ function M3(n3) {
18062
+ const { code: e4, config: t2 = {}, env: o2 = {} } = n3, { config: s3 } = A3(n3, "before"), r2 = { ...e4.config, ...t2, ...s3 }, i2 = W3(e4.env, o2);
17994
18063
  return { ...e4, config: r2, env: i2 };
17995
18064
  }
17996
- async function z4(n3, e4 = {}) {
18065
+ async function N3(n3, e4 = {}) {
17997
18066
  const t2 = {};
17998
- for (const [o2, s3] of Object.entries(e4)) s3.config?.require?.length ? n3.pending.destinations[o2] = s3 : t2[o2] = W3(s3);
18067
+ for (const [o2, s3] of Object.entries(e4)) s3.config?.require?.length ? n3.pending.destinations[o2] = s3 : t2[o2] = M3(s3);
17999
18068
  return t2;
18000
18069
  }
18001
- function L3(n3, e4) {
18070
+ function W3(n3, e4) {
18002
18071
  return n3 || e4 ? e4 ? n3 && q(n3) && q(e4) ? { ...n3, ...e4 } : e4 : n3 : {};
18003
18072
  }
18004
18073
  async function X3(n3, e4, t2) {
@@ -18015,37 +18084,37 @@ async function X3(n3, e4, t2) {
18015
18084
  await Promise.allSettled(o2);
18016
18085
  }
18017
18086
  async function Y3(n3, e4, o2, r2) {
18018
- let i2, a3, c2 = false, u4 = false;
18087
+ let i2, a3, c3 = false, u3 = false;
18019
18088
  switch (e4) {
18020
18089
  case t.Commands.Config:
18021
- q(o2) && (I(n3.config, o2, { shallow: false }), a3 = o2, c2 = true);
18090
+ q(o2) && (W(n3.config, o2, { shallow: false }), a3 = o2, c3 = true);
18022
18091
  break;
18023
18092
  case t.Commands.Consent:
18024
18093
  if (q(o2)) {
18025
18094
  const { update: e5, runQueue: t2 } = s2(n3, o2);
18026
- a3 = e5, c2 = true, u4 = t2;
18095
+ a3 = e5, c3 = true, u3 = t2;
18027
18096
  }
18028
18097
  break;
18029
18098
  case t.Commands.Custom:
18030
- q(o2) && (n3.custom = I(n3.custom, o2), a3 = o2, c2 = true);
18099
+ q(o2) && (n3.custom = W(n3.custom, o2), a3 = o2, c3 = true);
18031
18100
  break;
18032
18101
  case t.Commands.Destination:
18033
- q(o2) && ("code" in o2 && q(o2.code) ? i2 = await H3(n3, o2, r2) : Z(o2.push) && (i2 = await H3(n3, { code: o2 }, r2)));
18102
+ q(o2) && ("code" in o2 && q(o2.code) ? i2 = await H3(n3, o2, r2) : J(o2.push) && (i2 = await H3(n3, { code: o2 }, r2)));
18034
18103
  break;
18035
18104
  case t.Commands.Globals:
18036
- q(o2) && (n3.globals = I(n3.globals, o2), a3 = o2, c2 = true);
18105
+ q(o2) && (n3.globals = W(n3.globals, o2), a3 = o2, c3 = true);
18037
18106
  break;
18038
18107
  case t.Commands.On:
18039
18108
  X(o2) && await I3(n3, o2, r2);
18040
18109
  break;
18041
18110
  case t.Commands.Ready:
18042
- c2 = true;
18111
+ c3 = true;
18043
18112
  break;
18044
18113
  case t.Commands.Run:
18045
- i2 = await nn2(n3, o2), c2 = true;
18114
+ i2 = await nn2(n3, o2), c3 = true;
18046
18115
  break;
18047
18116
  case t.Commands.Session:
18048
- c2 = true;
18117
+ c3 = true;
18049
18118
  break;
18050
18119
  case t.Commands.Shutdown:
18051
18120
  await (async function(n4) {
@@ -18054,67 +18123,83 @@ async function Y3(n3, e4, o2, r2) {
18054
18123
  })(n3);
18055
18124
  break;
18056
18125
  case t.Commands.User:
18057
- q(o2) && (I(n3.user, o2, { shallow: false }), a3 = o2, c2 = true);
18126
+ q(o2) && (W(n3.user, o2, { shallow: false }), a3 = o2, c3 = true);
18058
18127
  }
18059
- return c2 && await G2(n3, e4, void 0, a3), u4 && (i2 = await U3(n3)), i2 || N3({ ok: true });
18128
+ return c3 && await G2(n3, e4, void 0, a3), u3 && (i2 = await U3(n3)), i2 || J3({ ok: true });
18060
18129
  }
18061
- function Z3(n3, e4) {
18130
+ function Z2(n3, e4) {
18062
18131
  if (!e4.name) throw new Error("Event name is required");
18063
18132
  const [t2, o2] = e4.name.split(" ");
18064
18133
  if (!t2 || !o2) throw new Error("Event name is invalid");
18065
18134
  ++n3.count;
18066
- const { timestamp: s3 = Date.now(), group: r2 = n3.group, count: i2 = n3.count } = e4, { name: a3 = `${t2} ${o2}`, data: c2 = {}, context: u4 = {}, globals: f2 = n3.globals, custom: l2 = {}, user: g2 = n3.user, nested: d2 = [], consent: m2 = n3.consent, id: p2 = `${s3}-${r2}-${i2}`, trigger: h2 = "", entity: w2 = t2, action: y2 = o2, timing: b2 = 0, version: v2 = { source: n3.version, tagging: n3.config.tagging || 0 }, source: k2 = { type: "collector", id: "", previous_id: "" } } = e4;
18067
- return { name: a3, data: c2, context: u4, globals: f2, custom: l2, user: g2, nested: d2, consent: m2, id: p2, trigger: h2, entity: w2, action: y2, timestamp: s3, timing: b2, group: r2, count: i2, version: v2, source: k2 };
18135
+ const { timestamp: s3 = Date.now(), group: r2 = n3.group, count: i2 = n3.count } = e4, { name: a3 = `${t2} ${o2}`, data: c3 = {}, context: u3 = {}, globals: f2 = n3.globals, custom: l2 = {}, user: g2 = n3.user, nested: d2 = [], consent: m2 = n3.consent, id: p2 = `${s3}-${r2}-${i2}`, trigger: h2 = "", entity: w2 = t2, action: b2 = o2, timing: y2 = 0, version: v2 = { source: n3.version, tagging: n3.config.tagging || 0 }, source: k2 = { type: "collector", id: "", previous_id: "" } } = e4;
18136
+ return { name: a3, data: c3, context: u3, globals: f2, custom: l2, user: g2, nested: d2, consent: m2, id: p2, trigger: h2, entity: w2, action: b2, timestamp: s3, timing: y2, group: r2, count: i2, version: v2, source: k2 };
18068
18137
  }
18069
18138
  async function nn2(n3, e4) {
18070
- n3.allowed = true, n3.count = 0, n3.group = se(), n3.timing = Date.now(), e4 && (e4.consent && (n3.consent = I(n3.consent, e4.consent)), e4.user && (n3.user = I(n3.user, e4.user)), e4.globals && (n3.globals = I(n3.config.globalsStatic || {}, e4.globals)), e4.custom && (n3.custom = I(n3.custom, e4.custom))), Object.values(n3.destinations).forEach((n4) => {
18139
+ n3.allowed = true, n3.count = 0, n3.group = ie(), n3.timing = Date.now(), e4 && (e4.consent && (n3.consent = W(n3.consent, e4.consent)), e4.user && (n3.user = W(n3.user, e4.user)), e4.globals && (n3.globals = W(n3.config.globalsStatic || {}, e4.globals)), e4.custom && (n3.custom = W(n3.custom, e4.custom))), Object.values(n3.destinations).forEach((n4) => {
18071
18140
  n4.queuePush = [];
18072
18141
  }), n3.queue = [], n3.round++;
18073
18142
  return await U3(n3);
18074
18143
  }
18075
18144
  function rn2(n3, e4) {
18076
- return _e(async (t2, o2 = {}) => await he(async () => {
18077
- const s3 = Date.now(), { id: r2, ingest: i2, respond: a3, mapping: c2, preChain: u4 } = o2;
18145
+ return Te(async (t2, o2 = {}) => await he(async () => {
18146
+ const s3 = Date.now(), { id: r2, ingest: i2, respond: a3, mapping: c3, preChain: u3 } = o2;
18078
18147
  let f2 = t2;
18079
18148
  const l2 = i2 ? Object.freeze(i2) : void 0;
18080
- if (c2) {
18081
- const e5 = await Oe(f2, c2, n3);
18082
- if (e5.ignore) return N3({ ok: true });
18083
- if (c2.consent) {
18084
- if (!ne(c2.consent, n3.consent, e5.event.consent)) return N3({ ok: true });
18149
+ if (c3) {
18150
+ const e5 = await Oe(f2, c3, n3);
18151
+ if (e5.ignore) return J3({ ok: true });
18152
+ if (c3.consent) {
18153
+ if (!ne(c3.consent, n3.consent, e5.event.consent)) return J3({ ok: true });
18085
18154
  }
18086
18155
  f2 = e5.event;
18087
18156
  }
18088
- if (u4?.length && n3.transformers && Object.keys(n3.transformers).length > 0) {
18089
- const e5 = await S3(n3, n3.transformers, u4, f2, l2, a3);
18090
- if (null === e5) return N3({ ok: true });
18157
+ if (u3?.length && n3.transformers && Object.keys(n3.transformers).length > 0) {
18158
+ const e5 = await S3(n3, n3.transformers, u3, f2, l2, a3);
18159
+ if (null === e5) return J3({ ok: true });
18091
18160
  f2 = e5;
18092
18161
  }
18093
- const g2 = e4(f2), d2 = Z3(n3, g2), m2 = await U3(n3, d2, { id: r2, ingest: l2, respond: a3 });
18162
+ const g2 = e4(f2), d2 = Z2(n3, g2), m2 = await U3(n3, d2, { id: r2, ingest: l2, respond: a3 });
18094
18163
  if (r2) {
18095
18164
  n3.status.sources[r2] || (n3.status.sources[r2] = { count: 0, duration: 0 });
18096
18165
  const e5 = n3.status.sources[r2];
18097
18166
  e5.count++, e5.lastAt = Date.now(), e5.duration += Date.now() - s3;
18098
18167
  }
18099
18168
  return m2;
18100
- }, () => N3({ ok: false }))(), "Push", n3.hooks);
18169
+ }, () => J3({ ok: false }))(), "Push", n3.hooks);
18101
18170
  }
18102
18171
  async function un2(n3) {
18103
- const e4 = I({ globalsStatic: {}, sessionStatic: {}, tagging: 0, run: true }, n3, { merge: false, extend: false }), t2 = { level: n3.logger?.level, handler: n3.logger?.handler }, o2 = de(t2), s3 = { ...e4.globalsStatic, ...n3.globals }, a3 = { allowed: false, config: e4, consent: n3.consent || {}, count: 0, custom: n3.custom || {}, destinations: {}, transformers: {}, stores: {}, globals: s3, group: "", hooks: {}, logger: o2, on: {}, queue: [], round: 0, session: void 0, status: { startedAt: Date.now(), in: 0, out: 0, failed: 0, sources: {}, destinations: {} }, timing: Date.now(), user: n3.user || {}, version: "2.1.1", sources: {}, pending: { sources: {}, destinations: {} }, push: void 0, command: void 0 };
18104
- return a3.push = rn2(a3, (n4) => ({ timing: Math.round((Date.now() - a3.timing) / 10) / 100, source: { type: "collector", id: "", previous_id: "" }, ...n4 })), a3.command = (function(n4, e5) {
18105
- return _e(async (t3, o3, s4) => await he(async () => await e5(n4, t3, o3, s4), () => N3({ ok: false }))(), "Command", n4.hooks);
18106
- })(a3, Y3), a3.stores = await (async function(n4, e5 = {}) {
18172
+ const e4 = W({ globalsStatic: {}, sessionStatic: {}, tagging: 0, run: true }, n3, { merge: false, extend: false }), t2 = { level: n3.logger?.level, handler: n3.logger?.handler }, o2 = de(t2), s3 = { ...e4.globalsStatic, ...n3.globals }, a3 = { allowed: false, config: e4, consent: n3.consent || {}, count: 0, custom: n3.custom || {}, destinations: {}, transformers: {}, stores: {}, globals: s3, group: "", hooks: {}, logger: o2, on: {}, queue: [], round: 0, session: void 0, status: { startedAt: Date.now(), in: 0, out: 0, failed: 0, sources: {}, destinations: {} }, timing: Date.now(), user: n3.user || {}, version: "2.1.1", sources: {}, pending: { sources: {}, destinations: {} }, push: void 0, command: void 0 };
18173
+ a3.push = rn2(a3, (n4) => ({ timing: Math.round((Date.now() - a3.timing) / 10) / 100, source: { type: "collector", id: "", previous_id: "" }, ...n4 })), a3.command = (function(n4, e5) {
18174
+ return Te(async (t3, o3, s4) => await he(async () => await e5(n4, t3, o3, s4), () => J3({ ok: false }))(), "Command", n4.hooks);
18175
+ })(a3, Y3);
18176
+ const c3 = n3.stores || {};
18177
+ return a3.stores = await (async function(n4, e5 = {}) {
18107
18178
  const t3 = {};
18108
18179
  for (const [o3, s4] of Object.entries(e5)) {
18109
- const { code: e6, config: r2 = {}, env: i2 = {} } = s4, a4 = n4.logger.scope("store").scope(o3), c2 = { collector: n4, logger: a4, id: o3, config: r2, env: i2 }, u4 = await e6(c2);
18110
- t3[o3] = u4;
18180
+ const { code: e6, config: r2 = {}, env: i2 = {} } = s4, a4 = n4.logger.scope("store").scope(o3), c4 = { collector: n4, logger: a4, id: o3, config: r2, env: i2 }, u3 = await e6(c4);
18181
+ t3[o3] = u3;
18111
18182
  }
18112
18183
  return t3;
18113
- })(a3, n3.stores || {}), a3.destinations = await z4(a3, n3.destinations || {}), a3.transformers = await (async function(n4, e5 = {}) {
18184
+ })(a3, c3), (function(n4, e5, t3) {
18185
+ const o3 = /* @__PURE__ */ new Map();
18186
+ for (const [t4, s5] of Object.entries(n4)) e5[t4] && o3.set(s5, e5[t4]);
18187
+ if (0 !== o3.size) {
18188
+ for (const n5 of [t3.transformers, t3.destinations, t3.sources]) if (n5) for (const e6 of Object.values(n5)) s4(e6.env);
18189
+ }
18190
+ function s4(n5) {
18191
+ if (n5) {
18192
+ for (const [e6, t4] of Object.entries(n5)) if ("object" == typeof t4 && null !== t4) {
18193
+ const s5 = o3.get(t4);
18194
+ s5 && (n5[e6] = s5);
18195
+ }
18196
+ }
18197
+ }
18198
+ })(c3, a3.stores, n3), a3.destinations = await N3(a3, n3.destinations || {}), a3.transformers = await (async function(n4, e5 = {}) {
18114
18199
  const t3 = {};
18115
18200
  for (const [o3, s4] of Object.entries(e5)) {
18116
- const { code: e6, env: r2 = {} } = s4, { config: i2 } = A3(s4, "next"), a4 = n4.logger.scope("transformer").scope(o3), c2 = { collector: n4, logger: a4, id: o3, config: i2, env: r2 }, u4 = await e6(c2);
18117
- t3[o3] = u4;
18201
+ const { code: e6, env: r2 = {} } = s4, { config: i2 } = A3(s4, "next"), a4 = Object.keys(r2).length > 0 ? { ...i2, env: r2 } : i2, c4 = n4.logger.scope("transformer").scope(o3), u3 = { collector: n4, logger: c4, id: o3, config: a4, env: r2 }, f2 = await e6(u3);
18202
+ t3[o3] = f2;
18118
18203
  }
18119
18204
  return t3;
18120
18205
  })(a3, n3.transformers || {}), a3;
@@ -18129,7 +18214,7 @@ async function fn2(n3) {
18129
18214
  let a4;
18130
18215
  if ("string" == typeof n4) a4 = { name: n4 }, e5 && "object" == typeof e5 && !Array.isArray(e5) && (a4.data = e5);
18131
18216
  else {
18132
- if (!n4 || "object" != typeof n4) return N3({ ok: false });
18217
+ if (!n4 || "object" != typeof n4) return J3({ ok: false });
18133
18218
  a4 = n4, e5 && "object" == typeof e5 && !Array.isArray(e5) && (a4.data = { ...a4.data || {}, ...e5 });
18134
18219
  }
18135
18220
  return s4 && "object" == typeof s4 && (a4.context = s4), r3 && Array.isArray(r3) && (a4.nested = r3), i3 && "object" == typeof i3 && (a4.custom = i3), o2.push(a4);
@@ -18138,11 +18223,11 @@ async function fn2(n3) {
18138
18223
  e4.sources.elb = t2;
18139
18224
  const s3 = await T3(e4, n3.sources || {});
18140
18225
  Object.assign(e4.sources, s3);
18141
- const { consent: r2, user: i2, globals: a3, custom: c2 } = n3;
18142
- r2 && await e4.command("consent", r2), i2 && await e4.command("user", i2), a3 && Object.assign(e4.globals, a3), c2 && Object.assign(e4.custom, c2), e4.config.run && await e4.command("run");
18143
- let u4 = t2.push;
18226
+ const { consent: r2, user: i2, globals: a3, custom: c3 } = n3;
18227
+ r2 && await e4.command("consent", r2), i2 && await e4.command("user", i2), a3 && Object.assign(e4.globals, a3), c3 && Object.assign(e4.custom, c3), e4.config.run && await e4.command("run");
18228
+ let u3 = t2.push;
18144
18229
  const f2 = Object.values(e4.sources).filter((n4) => "elb" !== n4.type), l2 = f2.find((n4) => n4.config.primary);
18145
- return l2 ? u4 = l2.push : f2.length > 0 && (u4 = f2[0].push), { collector: e4, elb: u4 };
18230
+ return l2 ? u3 = l2.push : f2.length > 0 && (u3 = f2[0].push), { collector: e4, elb: u3 };
18146
18231
  }
18147
18232
  function ln2(n3) {
18148
18233
  if (null === n3 || "object" != typeof n3) return n3;
@@ -18175,34 +18260,34 @@ async function dn2(n3) {
18175
18260
  const { code: t2, config: o2 = {}, event: s3 } = n4, { collector: r2 } = await fn2({ transformers: { sim: { code: t2, config: o2 } } }), i2 = r2.transformers?.sim;
18176
18261
  if (!i2) throw new Error("Transformer failed to initialize");
18177
18262
  const a3 = await i2.push(s3, { collector: r2, logger: r2.logger.scope("transformer").scope("sim"), id: "sim", config: i2.config, env: i2.config?.env || {} });
18178
- let c2;
18179
- c2 = false === a3 ? [] : null == a3 ? [s3] : [a3.event || s3];
18180
- return { step: "transformer", name: n4.name, events: c2, calls: [], duration: Date.now() - e5 };
18263
+ let c3;
18264
+ c3 = false === a3 ? [] : null == a3 ? [s3] : [a3.event || s3];
18265
+ return { step: "transformer", name: n4.name, events: c3, calls: [], duration: Date.now() - e5 };
18181
18266
  })(n3, e4);
18182
18267
  case "source":
18183
18268
  return await (async function(n4, e5) {
18184
- const { code: t2, config: o2 = {}, setup: s3, input: r2, env: i2, consent: a3 } = n4, c2 = { functional: true, marketing: true, analytics: true };
18185
- let u4;
18269
+ const { code: t2, config: o2 = {}, setup: s3, input: r2, env: i2, consent: a3 } = n4, c3 = { functional: true, marketing: true, analytics: true };
18270
+ let u3;
18186
18271
  if (s3) {
18187
18272
  const n5 = s3(r2, i2);
18188
- "function" == typeof n5 && (u4 = n5);
18273
+ "function" == typeof n5 && (u3 = n5);
18189
18274
  }
18190
- const f2 = [], { collector: l2 } = await fn2({ consent: a3 || c2, sources: { sim: { code: t2, config: o2, env: i2, next: "spy" } }, transformers: { spy: { code: () => ({ type: "spy", config: {}, push: (n5) => (f2.push(JSON.parse(JSON.stringify(n5))), { event: n5 }) }) } } });
18191
- u4 && u4();
18275
+ const f2 = [], { collector: l2 } = await fn2({ consent: a3 || c3, sources: { sim: { code: t2, config: o2, env: i2, next: "spy" } }, transformers: { spy: { code: () => ({ type: "spy", config: {}, push: (n5) => (f2.push(JSON.parse(JSON.stringify(n5))), { event: n5 }) }) } } });
18276
+ u3 && u3();
18192
18277
  return { step: "source", name: n4.name, events: f2, calls: [], duration: Date.now() - e5 };
18193
18278
  })(n3, e4);
18194
18279
  case "destination":
18195
18280
  return await (async function(n4, e5) {
18196
- const { code: t2, config: o2 = {}, event: s3, consent: r2, env: i2, track: a3 } = n4, c2 = { functional: true, marketing: true, analytics: true };
18197
- let u4 = [], f2 = i2;
18281
+ const { code: t2, config: o2 = {}, event: s3, consent: r2, env: i2, track: a3 } = n4, c3 = { functional: true, marketing: true, analytics: true };
18282
+ let u3 = [], f2 = i2;
18198
18283
  if (i2 && a3 && a3.length > 0) {
18199
18284
  const n5 = gn2({ ...i2, simulation: a3 });
18200
- f2 = n5.wrappedEnv, u4 = n5.calls;
18285
+ f2 = n5.wrappedEnv, u3 = n5.calls;
18201
18286
  }
18202
18287
  const l2 = { ...o2 };
18203
18288
  f2 && (l2.env = f2);
18204
- const { collector: g2 } = await fn2({ consent: r2 || c2, destinations: { sim: { code: t2, config: l2 } } });
18205
- return await g2.push(s3), { step: "destination", name: n4.name, events: [], calls: u4, duration: Date.now() - e5 };
18289
+ const { collector: g2 } = await fn2({ consent: r2 || c3, destinations: { sim: { code: t2, config: l2 } } });
18290
+ return await g2.push(s3), { step: "destination", name: n4.name, events: [], calls: u3, duration: Date.now() - e5 };
18206
18291
  })(n3, e4);
18207
18292
  }
18208
18293
  } catch (t2) {
@@ -18248,11 +18333,11 @@ async function loadDestinationEnvs(destinations) {
18248
18333
  function callsToUsage(destName, calls) {
18249
18334
  if (!calls.length) return {};
18250
18335
  return {
18251
- [destName]: calls.map((c2) => ({
18336
+ [destName]: calls.map((c3) => ({
18252
18337
  type: "call",
18253
- path: c2.fn,
18254
- args: c2.args,
18255
- timestamp: c2.ts
18338
+ path: c3.fn,
18339
+ args: c3.args,
18340
+ timestamp: c3.ts
18256
18341
  }))
18257
18342
  };
18258
18343
  }
@@ -18864,7 +18949,7 @@ async function pushCore(inputPath, event, options = {}) {
18864
18949
  (dir) => {
18865
18950
  tempDir = dir;
18866
18951
  },
18867
- { logger: { level: options.verbose ? u.DEBUG : u.ERROR } }
18952
+ { logger: { level: options.verbose ? a.DEBUG : a.ERROR } }
18868
18953
  );
18869
18954
  }
18870
18955
  return result;
@@ -19006,7 +19091,7 @@ async function executeConfigPush(options, validatedEvent, logger, setTempDir) {
19006
19091
  } else if (platform === "server") {
19007
19092
  logger.debug("Executing in server environment (Node.js)");
19008
19093
  return executeServerPush(tempPath, validatedEvent, logger, 6e4, {
19009
- logger: { level: options.verbose ? u.DEBUG : u.ERROR }
19094
+ logger: { level: options.verbose ? a.DEBUG : a.ERROR }
19010
19095
  });
19011
19096
  } else {
19012
19097
  throw new Error(`Unsupported platform: ${platform}`);
@@ -19240,6 +19325,91 @@ init_dev();
19240
19325
  var PortSchema = external_exports.number().int("Port must be an integer").min(1, "Port must be at least 1").max(65535, "Port must be at most 65535").describe("HTTP server port number");
19241
19326
  var FilePathSchema = external_exports.string().min(1, "File path cannot be empty").describe("Path to configuration file");
19242
19327
 
19328
+ // src/schemas/run.ts
19329
+ init_dev();
19330
+ var RunOptionsSchema = external_exports.object({
19331
+ flow: FilePathSchema,
19332
+ port: PortSchema.default(8080),
19333
+ flowName: external_exports.string().optional().describe("Specific flow name to run")
19334
+ });
19335
+
19336
+ // src/schemas/validate.ts
19337
+ init_dev();
19338
+ var ValidationTypeSchema = external_exports.enum(["contract", "event", "flow", "mapping"]).describe('Validation type: "event", "flow", "mapping", or "contract"');
19339
+ var ValidateOptionsSchema = external_exports.object({
19340
+ flow: external_exports.string().optional().describe("Flow name for multi-flow configs"),
19341
+ path: external_exports.string().optional().describe(
19342
+ 'Entry path for package schema validation (e.g., "destinations.snowplow", "sources.browser")'
19343
+ )
19344
+ });
19345
+ var ValidateInputShape = {
19346
+ type: ValidationTypeSchema,
19347
+ input: external_exports.string().min(1).describe("JSON string, file path, or URL to validate"),
19348
+ flow: external_exports.string().optional().describe("Flow name for multi-flow configs"),
19349
+ path: external_exports.string().optional().describe(
19350
+ 'Entry path for package schema validation (e.g., "destinations.snowplow"). When provided, validates the entry against its package JSON Schema instead of using --type.'
19351
+ )
19352
+ };
19353
+ var ValidateInputSchema = external_exports.object(ValidateInputShape);
19354
+
19355
+ // src/schemas/bundle.ts
19356
+ init_dev();
19357
+ var BundleOptionsSchema = external_exports.object({
19358
+ silent: external_exports.boolean().optional().describe("Suppress all output"),
19359
+ verbose: external_exports.boolean().optional().describe("Enable verbose logging"),
19360
+ stats: external_exports.boolean().optional().default(true).describe("Return bundle statistics"),
19361
+ cache: external_exports.boolean().optional().default(true).describe("Enable package caching"),
19362
+ flowName: external_exports.string().optional().describe("Flow name for multi-flow configs")
19363
+ });
19364
+ var BundleInputShape = {
19365
+ configPath: FilePathSchema.describe(
19366
+ "Path to flow configuration file (JSON or JavaScript)"
19367
+ ),
19368
+ flow: external_exports.string().optional().describe("Flow name for multi-flow configs"),
19369
+ stats: external_exports.boolean().optional().default(true).describe("Return bundle statistics"),
19370
+ output: external_exports.string().optional().describe("Output file path (defaults to config-defined)")
19371
+ };
19372
+ var BundleInputSchema = external_exports.object(BundleInputShape);
19373
+
19374
+ // src/schemas/simulate.ts
19375
+ init_dev();
19376
+ var PlatformSchema = external_exports.enum(["web", "server"]).describe("Platform type for event processing");
19377
+ var SimulateOptionsSchema = external_exports.object({
19378
+ silent: external_exports.boolean().optional().describe("Suppress all output"),
19379
+ verbose: external_exports.boolean().optional().describe("Enable verbose logging"),
19380
+ json: external_exports.boolean().optional().describe("Format output as JSON")
19381
+ });
19382
+ var SimulateInputShape = {
19383
+ configPath: FilePathSchema.describe("Path to flow configuration file"),
19384
+ event: external_exports.string().min(1).optional().describe(
19385
+ "Event as JSON string, file path, or URL. Optional when example is provided."
19386
+ ),
19387
+ flow: external_exports.string().optional().describe("Flow name for multi-flow configs"),
19388
+ platform: PlatformSchema.optional().describe("Override platform detection"),
19389
+ example: external_exports.string().optional().describe(
19390
+ 'Name of a step example to use as event input (uses its "in" value)'
19391
+ ),
19392
+ step: external_exports.string().optional().describe(
19393
+ 'Step target in type.name format (e.g. "destination.gtag") to narrow example lookup'
19394
+ )
19395
+ };
19396
+ var SimulateInputSchema = external_exports.object(SimulateInputShape);
19397
+
19398
+ // src/schemas/push.ts
19399
+ init_dev();
19400
+ var PushOptionsSchema = external_exports.object({
19401
+ silent: external_exports.boolean().optional().describe("Suppress all output"),
19402
+ verbose: external_exports.boolean().optional().describe("Enable verbose logging"),
19403
+ json: external_exports.boolean().optional().describe("Format output as JSON")
19404
+ });
19405
+ var PushInputShape = {
19406
+ configPath: FilePathSchema.describe("Path to flow configuration file"),
19407
+ event: external_exports.string().min(1).describe("Event as JSON string, file path, or URL"),
19408
+ flow: external_exports.string().optional().describe("Flow name for multi-flow configs"),
19409
+ platform: PlatformSchema.optional().describe("Override platform detection")
19410
+ };
19411
+ var PushInputSchema = external_exports.object(PushInputShape);
19412
+
19243
19413
  // src/commands/run/validators.ts
19244
19414
  function validateFlowFile(filePath) {
19245
19415
  const absolutePath = resolveAsset(filePath, "bundle");
@@ -19880,6 +20050,14 @@ init_config();
19880
20050
  import chalk3 from "chalk";
19881
20051
 
19882
20052
  // src/commands/validate/validators/contract.ts
20053
+ var SECTION_KEYS = ["globals", "context", "custom", "user", "consent"];
20054
+ var KNOWN_KEYS = /* @__PURE__ */ new Set([
20055
+ "extends",
20056
+ "tagging",
20057
+ "description",
20058
+ "events",
20059
+ ...SECTION_KEYS
20060
+ ]);
19883
20061
  function validateContract(input) {
19884
20062
  const errors = [];
19885
20063
  const warnings = [];
@@ -19887,32 +20065,108 @@ function validateContract(input) {
19887
20065
  if (typeof input !== "object" || input === null || Array.isArray(input)) {
19888
20066
  errors.push({
19889
20067
  path: "root",
19890
- message: "Contract must be an object",
20068
+ message: "Contract must be an object of named contract entries",
19891
20069
  code: "INVALID_CONTRACT"
19892
20070
  });
19893
20071
  return { valid: false, type: "contract", errors, warnings, details };
19894
20072
  }
19895
- const contract = input;
19896
- let entityCount = 0;
19897
- let actionCount = 0;
19898
- if ("$tagging" in contract) {
19899
- const tagging = contract.$tagging;
19900
- if (typeof tagging !== "number" || !Number.isInteger(tagging) || tagging < 0) {
20073
+ const contracts = input;
20074
+ const contractNames = Object.keys(contracts);
20075
+ details.contractCount = contractNames.length;
20076
+ for (const [name, entry] of Object.entries(contracts)) {
20077
+ if (typeof entry !== "object" || entry === null) {
19901
20078
  errors.push({
19902
- path: "$tagging",
19903
- message: "$tagging must be a non-negative integer",
19904
- value: tagging,
19905
- code: "INVALID_TAGGING"
20079
+ path: name,
20080
+ message: `Contract "${name}" must be an object`,
20081
+ code: "INVALID_CONTRACT_ENTRY"
19906
20082
  });
19907
- } else {
19908
- details.tagging = tagging;
20083
+ continue;
20084
+ }
20085
+ const obj = entry;
20086
+ if (obj.extends !== void 0) {
20087
+ if (typeof obj.extends !== "string") {
20088
+ errors.push({
20089
+ path: `${name}.extends`,
20090
+ message: "extends must be a string",
20091
+ code: "INVALID_EXTENDS"
20092
+ });
20093
+ } else if (!contractNames.includes(obj.extends)) {
20094
+ errors.push({
20095
+ path: `${name}.extends`,
20096
+ message: `extends references non-existent contract "${obj.extends}"`,
20097
+ value: obj.extends,
20098
+ code: "INVALID_EXTENDS"
20099
+ });
20100
+ }
20101
+ }
20102
+ if (obj.tagging !== void 0) {
20103
+ if (typeof obj.tagging !== "number" || !Number.isInteger(obj.tagging) || obj.tagging < 0) {
20104
+ errors.push({
20105
+ path: `${name}.tagging`,
20106
+ message: "tagging must be a non-negative integer",
20107
+ value: obj.tagging,
20108
+ code: "INVALID_TAGGING"
20109
+ });
20110
+ }
20111
+ }
20112
+ for (const key of SECTION_KEYS) {
20113
+ if (key in obj) {
20114
+ if (typeof obj[key] !== "object" || obj[key] === null) {
20115
+ errors.push({
20116
+ path: `${name}.${key}`,
20117
+ message: `Section "${key}" must be a JSON Schema object`,
20118
+ value: obj[key],
20119
+ code: "INVALID_SECTION"
20120
+ });
20121
+ }
20122
+ }
20123
+ }
20124
+ if (obj.events !== void 0) {
20125
+ if (typeof obj.events !== "object" || obj.events === null) {
20126
+ errors.push({
20127
+ path: `${name}.events`,
20128
+ message: "events must be an object",
20129
+ code: "INVALID_EVENTS"
20130
+ });
20131
+ } else {
20132
+ validateEntityActions(
20133
+ obj.events,
20134
+ `${name}.events`,
20135
+ errors
20136
+ );
20137
+ }
19909
20138
  }
19910
20139
  }
19911
- for (const [entityKey, entityValue] of Object.entries(contract)) {
19912
- if (entityKey.startsWith("$")) continue;
20140
+ for (const name of contractNames) {
20141
+ const visited = /* @__PURE__ */ new Set();
20142
+ let current = name;
20143
+ while (current) {
20144
+ if (visited.has(current)) {
20145
+ errors.push({
20146
+ path: `${name}.extends`,
20147
+ message: `Circular extends chain: ${[...visited, current].join(" \u2192 ")}`,
20148
+ code: "CIRCULAR_EXTENDS"
20149
+ });
20150
+ break;
20151
+ }
20152
+ visited.add(current);
20153
+ const entry = contracts[current];
20154
+ current = entry?.extends || "";
20155
+ }
20156
+ }
20157
+ return {
20158
+ valid: errors.length === 0,
20159
+ type: "contract",
20160
+ errors,
20161
+ warnings,
20162
+ details
20163
+ };
20164
+ }
20165
+ function validateEntityActions(obj, prefix, errors) {
20166
+ for (const [entityKey, entityValue] of Object.entries(obj)) {
19913
20167
  if (entityKey.trim() === "") {
19914
20168
  errors.push({
19915
- path: entityKey,
20169
+ path: `${prefix}.${entityKey}`,
19916
20170
  message: "Entity key cannot be empty",
19917
20171
  code: "INVALID_ENTITY_KEY"
19918
20172
  });
@@ -19920,19 +20174,19 @@ function validateContract(input) {
19920
20174
  }
19921
20175
  if (typeof entityValue !== "object" || entityValue === null) {
19922
20176
  errors.push({
19923
- path: entityKey,
19924
- message: `Entity "${entityKey}" must be an object of action entries`,
20177
+ path: `${prefix}.${entityKey}`,
20178
+ message: `Entity "${entityKey}" must be an object`,
19925
20179
  value: entityValue,
19926
20180
  code: "INVALID_ENTITY"
19927
20181
  });
19928
20182
  continue;
19929
20183
  }
19930
- entityCount++;
19931
- const actions = entityValue;
19932
- for (const [actionKey, actionValue] of Object.entries(actions)) {
20184
+ for (const [actionKey, actionValue] of Object.entries(
20185
+ entityValue
20186
+ )) {
19933
20187
  if (actionKey.trim() === "") {
19934
20188
  errors.push({
19935
- path: `${entityKey}.${actionKey}`,
20189
+ path: `${prefix}.${entityKey}.${actionKey}`,
19936
20190
  message: "Action key cannot be empty",
19937
20191
  code: "INVALID_ACTION_KEY"
19938
20192
  });
@@ -19940,25 +20194,14 @@ function validateContract(input) {
19940
20194
  }
19941
20195
  if (typeof actionValue !== "object" || actionValue === null || Array.isArray(actionValue)) {
19942
20196
  errors.push({
19943
- path: `${entityKey}.${actionKey}`,
19944
- message: `Contract entry must be a JSON Schema object`,
20197
+ path: `${prefix}.${entityKey}.${actionKey}`,
20198
+ message: "Contract entry must be a JSON Schema object",
19945
20199
  value: typeof actionValue,
19946
20200
  code: "INVALID_SCHEMA_ENTRY"
19947
20201
  });
19948
- continue;
19949
20202
  }
19950
- actionCount++;
19951
20203
  }
19952
20204
  }
19953
- details.entityCount = entityCount;
19954
- details.actionCount = actionCount;
19955
- return {
19956
- valid: errors.length === 0,
19957
- type: "contract",
19958
- errors,
19959
- warnings,
19960
- details
19961
- };
19962
20205
  }
19963
20206
 
19964
20207
  // src/commands/validate/validators/event.ts
@@ -20112,23 +20355,38 @@ function validateFlow(input, options = {}) {
20112
20355
  for (const name of flowsToCheck) {
20113
20356
  const flowSettings = flows[name];
20114
20357
  if (!flowSettings) continue;
20115
- checkExampleCoverage(flowSettings, warnings);
20116
20358
  const connections = buildConnectionGraph(flowSettings);
20117
20359
  for (const conn of connections) {
20118
20360
  checkCompatibility(conn, errors, warnings);
20119
20361
  }
20120
20362
  totalConnections += connections.length;
20121
- const setupContract = config2.contract;
20122
- if (setupContract || flowSettings.contract) {
20123
- checkContractCompliance(
20124
- flowSettings,
20125
- setupContract,
20126
- flowSettings.contract,
20127
- warnings
20128
- );
20363
+ const contract = config2.contract;
20364
+ if (contract) {
20365
+ checkContractCompliance(flowSettings, contract, warnings);
20129
20366
  }
20130
20367
  }
20131
20368
  details.connectionsChecked = totalConnections;
20369
+ for (const name of flowsToCheck) {
20370
+ const flowSettings = flows[name];
20371
+ if (!flowSettings) continue;
20372
+ for (const [destName, dest] of Object.entries(
20373
+ flowSettings.destinations || {}
20374
+ )) {
20375
+ const destConfig = dest;
20376
+ const mapping = destConfig.config?.mapping;
20377
+ if (!mapping || typeof mapping !== "object") continue;
20378
+ for (const key of Object.keys(mapping)) {
20379
+ if (key.includes(".") && !key.includes(" ")) {
20380
+ const parts = key.split(".");
20381
+ warnings.push({
20382
+ path: `destination.${destName}.config.mapping`,
20383
+ message: `Mapping key "${key}" looks like dot-notation. Mapping uses nested entity \u2192 action structure.`,
20384
+ suggestion: `Use nested format: { "${parts[0]}": { "${parts.slice(1).join(".")}": { ... } } }`
20385
+ });
20386
+ }
20387
+ }
20388
+ }
20389
+ }
20132
20390
  }
20133
20391
  return {
20134
20392
  valid: errors.length === 0,
@@ -20138,26 +20396,6 @@ function validateFlow(input, options = {}) {
20138
20396
  details
20139
20397
  };
20140
20398
  }
20141
- function checkExampleCoverage(config2, warnings) {
20142
- const stepTypes = [
20143
- { key: "sources", type: "source" },
20144
- { key: "transformers", type: "transformer" },
20145
- { key: "destinations", type: "destination" }
20146
- ];
20147
- for (const { key, type } of stepTypes) {
20148
- const refs = config2[key];
20149
- if (!refs) continue;
20150
- for (const [name, ref] of Object.entries(refs)) {
20151
- if (!ref.examples || Object.keys(ref.examples).length === 0) {
20152
- warnings.push({
20153
- path: `${type}.${name}`,
20154
- message: `Step has no examples`,
20155
- suggestion: `Add examples to ${type}.${name} for testing and documentation`
20156
- });
20157
- }
20158
- }
20159
- }
20160
- }
20161
20399
  function buildConnectionGraph(config2) {
20162
20400
  const connections = [];
20163
20401
  for (const [name, source] of Object.entries(config2.sources || {})) {
@@ -20259,16 +20497,16 @@ function isStructurallyCompatible(a3, b2) {
20259
20497
  }
20260
20498
  return true;
20261
20499
  }
20262
- function checkContractCompliance(config2, setupContract, flowContract, warnings) {
20500
+ function checkContractCompliance(config2, contract, warnings) {
20263
20501
  for (const [name, dest] of Object.entries(config2.destinations || {})) {
20264
20502
  if (!dest.examples) continue;
20265
20503
  for (const [exName, example] of Object.entries(dest.examples)) {
20266
20504
  if (!example.in || typeof example.in !== "object") continue;
20267
20505
  const event = example.in;
20268
20506
  if (!event.entity || !event.action) continue;
20269
- const contract = flowContract?.[event.entity] || setupContract?.[event.entity];
20270
- if (!contract || typeof contract !== "object") continue;
20271
- const actionSchema = contract[event.action] || contract["*"];
20507
+ const entityContract = contract[event.entity];
20508
+ if (!entityContract || typeof entityContract !== "object") continue;
20509
+ const actionSchema = entityContract[event.action] || entityContract["*"];
20272
20510
  if (actionSchema) {
20273
20511
  warnings.push({
20274
20512
  path: `destination.${name}.examples.${exName}`,
@@ -20411,7 +20649,7 @@ async function validateEntry(path15, flowConfig) {
20411
20649
  }
20412
20650
  let schemas;
20413
20651
  try {
20414
- const info = await Be(packageName);
20652
+ const info = await Ve(packageName);
20415
20653
  schemas = info.schemas;
20416
20654
  } catch (error48) {
20417
20655
  return {
@@ -21022,10 +21260,10 @@ async function resolveSettingsId(options) {
21022
21260
  if (!settings?.length) {
21023
21261
  throw new Error("Flow has no settings.");
21024
21262
  }
21025
- const match = settings.find((c2) => c2.name === options.flowName);
21263
+ const match = settings.find((c3) => c3.name === options.flowName);
21026
21264
  if (!match) {
21027
21265
  throw new Error(
21028
- `Flow "${options.flowName}" not found. Available: ${settings.map((c2) => c2.name).join(", ")}`
21266
+ `Flow "${options.flowName}" not found. Available: ${settings.map((c3) => c3.name).join(", ")}`
21029
21267
  );
21030
21268
  }
21031
21269
  return match.id;
@@ -21036,7 +21274,7 @@ async function getAvailableFlowNames(options) {
21036
21274
  projectId: options.projectId
21037
21275
  });
21038
21276
  const settings = flow.settings;
21039
- return settings?.map((c2) => c2.name) ?? [];
21277
+ return settings?.map((c3) => c3.name) ?? [];
21040
21278
  }
21041
21279
  async function streamDeploymentStatus(projectId, deploymentId, options) {
21042
21280
  const base = resolveBaseUrl();