@walkeros/cli 4.1.0 → 4.1.1-next-1779485810490

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
@@ -123,71 +123,71 @@ function E(e4) {
123
123
  function C(e4) {
124
124
  throw new Error(String(e4));
125
125
  }
126
- function z(e4) {
126
+ function I(e4) {
127
127
  const t4 = {}, n4 = /* @__PURE__ */ new Set();
128
128
  function r4(o3) {
129
129
  if (t4[o3]) return t4[o3];
130
- n4.has(o3) && C(`Circular extends chain detected: ${[...n4, o3].join(" \u2192 ")}`);
131
- const a3 = e4[o3];
132
- a3 || C(`Contract "${o3}" not found`), n4.add(o3);
133
- let i3 = {};
134
- if (a3.extends) {
135
- i3 = (function(e5, t5) {
130
+ n4.has(o3) && C(`Circular extend chain detected: ${[...n4, o3].join(" \u2192 ")}`);
131
+ const i2 = e4[o3];
132
+ i2 || C(`Contract "${o3}" not found`), n4.add(o3);
133
+ let a4 = {};
134
+ if (i2.extend) {
135
+ a4 = (function(e5, t5) {
136
136
  const n5 = {};
137
137
  void 0 === e5.tagging && void 0 === t5.tagging || (n5.tagging = t5.tagging ?? e5.tagging);
138
138
  void 0 === e5.description && void 0 === t5.description || (n5.description = t5.description ?? e5.description);
139
- e5.schema && t5.schema ? n5.schema = I(e5.schema, t5.schema) : (e5.schema || t5.schema) && (n5.schema = { ...e5.schema || t5.schema });
139
+ e5.schema && t5.schema ? n5.schema = z(e5.schema, t5.schema) : (e5.schema || t5.schema) && (n5.schema = { ...e5.schema || t5.schema });
140
140
  if (e5.events || t5.events) {
141
141
  const r5 = {}, o4 = /* @__PURE__ */ new Set([...Object.keys(e5.events || {}), ...Object.keys(t5.events || {})]);
142
142
  for (const n6 of o4) {
143
- const o5 = e5.events?.[n6] || {}, a4 = t5.events?.[n6] || {}, i4 = /* @__PURE__ */ new Set([...Object.keys(o5), ...Object.keys(a4)]);
143
+ const o5 = e5.events?.[n6] || {}, i3 = t5.events?.[n6] || {}, a5 = /* @__PURE__ */ new Set([...Object.keys(o5), ...Object.keys(i3)]);
144
144
  r5[n6] = {};
145
- for (const e6 of i4) {
146
- const t6 = o5[e6], i5 = a4[e6];
147
- r5[n6][e6] = t6 && i5 ? I(t6, i5) : { ...t6 || i5 };
145
+ for (const e6 of a5) {
146
+ const t6 = o5[e6], a6 = i3[e6];
147
+ r5[n6][e6] = t6 && a6 ? z(t6, a6) : { ...t6 || a6 };
148
148
  }
149
149
  }
150
150
  n5.events = r5;
151
151
  }
152
152
  return n5;
153
- })(r4(a3.extends), a3);
154
- } else i3 = { ...a3 };
155
- if (delete i3.extends, i3.events && (i3.events = (function(e5) {
153
+ })(r4(i2.extend), i2);
154
+ } else a4 = { ...i2 };
155
+ if (delete a4.extend, a4.events && (a4.events = (function(e5) {
156
156
  const t5 = {};
157
157
  for (const n5 of Object.keys(e5)) if ("*" !== n5) {
158
158
  t5[n5] = {};
159
159
  for (const r5 of Object.keys(e5[n5] || {})) {
160
160
  let o4 = {};
161
- const a4 = e5["*"]?.["*"];
162
- a4 && (o4 = I(o4, a4));
163
- const i4 = e5["*"]?.[r5];
164
- i4 && "*" !== r5 && (o4 = I(o4, i4));
161
+ const i3 = e5["*"]?.["*"];
162
+ i3 && (o4 = z(o4, i3));
163
+ const a5 = e5["*"]?.[r5];
164
+ a5 && "*" !== r5 && (o4 = z(o4, a5));
165
165
  const s5 = e5[n5]?.["*"];
166
- s5 && "*" !== r5 && (o4 = I(o4, s5));
166
+ s5 && "*" !== r5 && (o4 = z(o4, s5));
167
167
  const c2 = e5[n5]?.[r5];
168
- c2 && (o4 = I(o4, c2)), t5[n5][r5] = o4;
168
+ c2 && (o4 = z(o4, c2)), t5[n5][r5] = o4;
169
169
  }
170
170
  }
171
171
  e5["*"] && (t5["*"] = { ...e5["*"] });
172
172
  return t5;
173
- })(i3.events)), i3.events) {
173
+ })(a4.events)), a4.events) {
174
174
  const e5 = {};
175
- for (const [t5, n5] of Object.entries(i3.events)) {
175
+ for (const [t5, n5] of Object.entries(a4.events)) {
176
176
  e5[t5] = {};
177
177
  for (const [r5, o4] of Object.entries(n5)) e5[t5][r5] = P(o4);
178
178
  }
179
- i3.events = e5;
179
+ a4.events = e5;
180
180
  }
181
- return n4.delete(o3), t4[o3] = i3, i3;
181
+ return n4.delete(o3), t4[o3] = a4, a4;
182
182
  }
183
183
  for (const t5 of Object.keys(e4)) r4(t5);
184
184
  return t4;
185
185
  }
186
- function I(e4, t4) {
186
+ function z(e4, t4) {
187
187
  const n4 = { ...e4 };
188
188
  for (const r4 of Object.keys(t4)) {
189
- const o3 = e4[r4], a3 = t4[r4];
190
- "required" === r4 && Array.isArray(o3) && Array.isArray(a3) ? n4[r4] = [.../* @__PURE__ */ new Set([...o3, ...a3])] : M(o3) && M(a3) ? n4[r4] = I(o3, a3) : n4[r4] = a3;
189
+ const o3 = e4[r4], i2 = t4[r4];
190
+ "required" === r4 && Array.isArray(o3) && Array.isArray(i2) ? n4[r4] = [.../* @__PURE__ */ new Set([...o3, ...i2])] : M(o3) && M(i2) ? n4[r4] = z(o3, i2) : n4[r4] = i2;
191
191
  }
192
192
  return n4;
193
193
  }
@@ -213,27 +213,27 @@ function B(e4, t4, n4) {
213
213
  const r4 = t4.split(".");
214
214
  let o3 = e4;
215
215
  for (let e5 = 0; e5 < r4.length; e5++) {
216
- const a3 = r4[e5];
216
+ const i2 = r4[e5];
217
217
  if (null == o3 || "object" != typeof o3) {
218
218
  const o4 = r4.slice(0, e5).join(".");
219
- C(`Path "${t4}" not found in "${n4}": "${a3}" does not exist${o4 ? ` in "${o4}"` : ""}`);
219
+ C(`Path "${t4}" not found in "${n4}": "${i2}" does not exist${o4 ? ` in "${o4}"` : ""}`);
220
220
  }
221
- const i3 = o3;
222
- if (!(a3 in i3)) {
221
+ const a4 = o3;
222
+ if (!(i2 in a4)) {
223
223
  const o4 = r4.slice(0, e5).join(".");
224
- C(`Path "${t4}" not found in "${n4}": "${a3}" does not exist${o4 ? ` in "${o4}"` : ""}`);
224
+ C(`Path "${t4}" not found in "${n4}": "${i2}" does not exist${o4 ? ` in "${o4}"` : ""}`);
225
225
  }
226
- o3 = i3[a3];
226
+ o3 = a4[i2];
227
227
  }
228
228
  return o3;
229
229
  }
230
- function J(e4, t4, n4, r4, o3, a3) {
230
+ function J(e4, t4, n4, r4, o3, i2) {
231
231
  if ("string" == typeof e4) {
232
- const i3 = e4.match(R);
233
- if (i3) {
234
- const e5 = i3[1].split("."), s6 = e5[0], c3 = e5.slice(1).join(".");
232
+ const a4 = e4.match(R);
233
+ if (a4) {
234
+ const e5 = a4[1].split("."), s6 = e5[0], c3 = e5.slice(1).join(".");
235
235
  void 0 === t4[s6] && C(`Variable "${s6}" not found`);
236
- const l3 = a3 ?? /* @__PURE__ */ new Set();
236
+ const l3 = i2 ?? /* @__PURE__ */ new Set();
237
237
  if (l3.has(s6)) {
238
238
  C(`Cyclic $var reference: ${[...l3, s6].join(" -> ")}`);
239
239
  }
@@ -255,15 +255,15 @@ function J(e4, t4, n4, r4, o3, a3) {
255
255
  }
256
256
  const c2 = e4.match(F);
257
257
  if (c2) {
258
- const t5 = c2[1], r5 = c2[2], a4 = false === n4?.strictFlowRefs;
258
+ const t5 = c2[1], r5 = c2[2], i3 = false === n4?.strictFlowRefs;
259
259
  o3 || C(`$flow.${t5}${r5 ? `.${r5}` : ""} cannot be resolved without a flow resolver`);
260
- const i4 = o3(t5);
261
- if (!i4) {
262
- if (a4) return n4?.onWarning?.(K(t5, r5, "unknown-flow")), e4;
260
+ const a5 = o3(t5);
261
+ if (!a5) {
262
+ if (i3) return n4?.onWarning?.(K(t5, r5, "unknown-flow")), e4;
263
263
  C(`Flow "${t5}" not found in $flow.${t5}`);
264
264
  }
265
- let s6 = i4;
266
- if (r5) if (a4) {
265
+ let s6 = a5;
266
+ if (r5) if (i3) {
267
267
  try {
268
268
  s6 = B(s6, r5, `$flow.${t5}`);
269
269
  } catch {
@@ -273,10 +273,10 @@ function J(e4, t4, n4, r4, o3, a3) {
273
273
  } else s6 = B(s6, r5, `$flow.${t5}`);
274
274
  return s6;
275
275
  }
276
- let l2 = e4.replace(Z, (e5, i4) => {
277
- const s6 = i4.split("."), c3 = s6[0], l3 = s6.slice(1).join(".");
276
+ let l2 = e4.replace(Z, (e5, a5) => {
277
+ const s6 = a5.split("."), c3 = s6[0], l3 = s6.slice(1).join(".");
278
278
  void 0 === t4[c3] && C(`Variable "${c3}" not found`);
279
- const u4 = a3 ?? /* @__PURE__ */ new Set();
279
+ const u4 = i2 ?? /* @__PURE__ */ new Set();
280
280
  if (u4.has(c3)) {
281
281
  C(`Cyclic $var reference: ${[...u4, c3].join(" -> ")}`);
282
282
  }
@@ -288,17 +288,17 @@ function J(e4, t4, n4, r4, o3, a3) {
288
288
  u4.delete(c3);
289
289
  }
290
290
  if (l3 && (f3 = B(f3, l3, `$var.${c3}`)), null === f3 || "string" != typeof f3 && "number" != typeof f3 && "boolean" != typeof f3) {
291
- C(`Variable "${i4}" resolves to non-scalar (${Array.isArray(f3) ? "array" : typeof f3}) and cannot be inlined into a string. Use it as a whole-string reference: "$var.${i4}"`);
291
+ C(`Variable "${a5}" resolves to non-scalar (${Array.isArray(f3) ? "array" : typeof f3}) and cannot be inlined into a string. Use it as a whole-string reference: "$var.${a5}"`);
292
292
  }
293
293
  return String(f3);
294
294
  });
295
295
  return l2 = l2.replace(D, (e5, t5, r5) => n4?.deferred ? void 0 !== r5 ? `${q}${t5}:${r5}` : `${q}${t5}` : "undefined" != typeof process && void 0 !== process.env?.[t5] ? process.env[t5] : void 0 !== r5 ? r5 : void C(`Environment variable "${t5}" not found and no default provided`)), l2;
296
296
  }
297
- if (Array.isArray(e4)) return e4.map((e5) => J(e5, t4, n4, r4, o3, a3));
297
+ if (Array.isArray(e4)) return e4.map((e5) => J(e5, t4, n4, r4, o3, i2));
298
298
  if (null !== e4 && "object" == typeof e4) {
299
- const i3 = {};
300
- for (const [s5, c2] of Object.entries(e4)) i3[s5] = J(c2, t4, n4, r4, o3, a3);
301
- return i3;
299
+ const a4 = {};
300
+ for (const [s5, c2] of Object.entries(e4)) a4[s5] = J(c2, t4, n4, r4, o3, i2);
301
+ return a4;
302
302
  }
303
303
  return e4;
304
304
  }
@@ -307,61 +307,61 @@ function G(e4) {
307
307
  return t4 ? "_" + n4 : n4;
308
308
  }
309
309
  function X(e4, t4, n4) {
310
- const r4 = /* @__PURE__ */ new Map(), o3 = /* @__PURE__ */ new Set(), a3 = [], i3 = (t5) => {
310
+ const r4 = /* @__PURE__ */ new Map(), o3 = /* @__PURE__ */ new Set(), i2 = [], a4 = (t5) => {
311
311
  if (r4.has(t5)) return r4.get(t5);
312
312
  const s6 = e4.flows[t5];
313
313
  if (s6) {
314
314
  if (o3.has(t5)) {
315
- C(`Cyclic $flow reference: ${[...a3, t5].join(" -> ")}`);
315
+ C(`Cyclic $flow reference: ${[...i2, t5].join(" -> ")}`);
316
316
  }
317
- o3.add(t5), a3.push(t5);
317
+ o3.add(t5), i2.push(t5);
318
318
  try {
319
- const o4 = V(e4.variables, s6.variables), a4 = J(s6.config ?? {}, o4, n4, void 0, i3);
320
- return r4.set(t5, a4), a4;
319
+ const o4 = V(e4.variables, s6.variables), i3 = J(s6.config ?? {}, o4, n4, void 0, a4);
320
+ return r4.set(t5, i3), i3;
321
321
  } finally {
322
- o3.delete(t5), a3.pop();
322
+ o3.delete(t5), i2.pop();
323
323
  }
324
324
  }
325
325
  }, s5 = Object.keys(e4.flows);
326
326
  t4 || (1 === s5.length ? t4 = s5[0] : C(`Multiple flows found (${s5.join(", ")}). Please specify a flow.`));
327
327
  const c2 = e4.flows[t4];
328
- c2 || C(`Flow "${t4}" not found. Available: ${s5.join(", ")}`), o3.add(t4), a3.push(t4);
328
+ c2 || C(`Flow "${t4}" not found. Available: ${s5.join(", ")}`), o3.add(t4), i2.push(t4);
329
329
  try {
330
330
  return (function(e5, t5, n5, r5) {
331
331
  const o4 = JSON.parse(JSON.stringify(t5));
332
- let a4;
332
+ let i3;
333
333
  if (e5.contract) {
334
334
  const o5 = V(e5.variables, t5.variables);
335
- a4 = z(J(e5.contract, o5, n5, void 0, r5));
335
+ i3 = I(J(e5.contract, o5, n5, void 0, r5));
336
336
  }
337
337
  if (o4.config) {
338
- const i4 = V(e5.variables, t5.variables);
339
- o4.config = J(o4.config, i4, n5, a4, r5);
338
+ const a5 = V(e5.variables, t5.variables);
339
+ o4.config = J(o4.config, a5, n5, i3, r5);
340
340
  }
341
- if (o4.sources) for (const [i4, s6] of Object.entries(o4.sources)) {
342
- const c3 = V(e5.variables, t5.variables, s6.variables), l2 = J(s6.config, c3, n5, a4, r5), u4 = J(s6.env, c3, n5, a4, r5);
343
- o4.sources[i4] = { package: s6.package, import: s6.import, config: l2, env: u4, primary: s6.primary, variables: s6.variables, before: s6.before, next: s6.next, cache: s6.cache, validate: s6.validate, code: s6.code };
341
+ if (o4.sources) for (const [a5, s6] of Object.entries(o4.sources)) {
342
+ const c3 = V(e5.variables, t5.variables, s6.variables), l2 = J(s6.config, c3, n5, i3, r5), u4 = J(s6.env, c3, n5, i3, r5);
343
+ o4.sources[a5] = { package: s6.package, import: s6.import, config: l2, env: u4, primary: s6.primary, variables: s6.variables, before: s6.before, next: s6.next, cache: s6.cache, validate: s6.validate, code: s6.code };
344
344
  }
345
- if (o4.destinations) for (const [i4, s6] of Object.entries(o4.destinations)) {
346
- const c3 = V(e5.variables, t5.variables, s6.variables), l2 = J(s6.config, c3, n5, a4, r5), u4 = J(s6.env, c3, n5, a4, r5);
347
- o4.destinations[i4] = { package: s6.package, import: s6.import, config: l2, env: u4, variables: s6.variables, before: s6.before, next: s6.next, cache: s6.cache, validate: s6.validate, code: s6.code };
345
+ if (o4.destinations) for (const [a5, s6] of Object.entries(o4.destinations)) {
346
+ const c3 = V(e5.variables, t5.variables, s6.variables), l2 = J(s6.config, c3, n5, i3, r5), u4 = J(s6.env, c3, n5, i3, r5);
347
+ o4.destinations[a5] = { package: s6.package, import: s6.import, config: l2, env: u4, variables: s6.variables, before: s6.before, next: s6.next, cache: s6.cache, validate: s6.validate, code: s6.code };
348
348
  }
349
- if (o4.stores) for (const [i4, s6] of Object.entries(o4.stores)) {
350
- const c3 = V(e5.variables, t5.variables, s6.variables), l2 = J(s6.config, c3, n5, a4, r5), u4 = J(s6.env, c3, n5, a4, r5);
351
- o4.stores[i4] = { package: s6.package, import: s6.import, config: l2, env: u4, cache: s6.cache, variables: s6.variables, code: s6.code };
349
+ if (o4.stores) for (const [a5, s6] of Object.entries(o4.stores)) {
350
+ const c3 = V(e5.variables, t5.variables, s6.variables), l2 = J(s6.config, c3, n5, i3, r5), u4 = J(s6.env, c3, n5, i3, r5);
351
+ o4.stores[a5] = { package: s6.package, import: s6.import, config: l2, env: u4, cache: s6.cache, variables: s6.variables, code: s6.code };
352
352
  }
353
- if (o4.transformers) for (const [i4, s6] of Object.entries(o4.transformers)) {
354
- const c3 = V(e5.variables, t5.variables, s6.variables), l2 = J(s6.config, c3, n5, a4, r5), u4 = J(s6.env, c3, n5, a4, r5);
355
- o4.transformers[i4] = { package: s6.package, import: s6.import, config: l2, env: u4, variables: s6.variables, before: s6.before, next: s6.next, cache: s6.cache, validate: s6.validate, code: s6.code };
353
+ if (o4.transformers) for (const [a5, s6] of Object.entries(o4.transformers)) {
354
+ const c3 = V(e5.variables, t5.variables, s6.variables), l2 = J(s6.config, c3, n5, i3, r5), u4 = J(s6.env, c3, n5, i3, r5);
355
+ o4.transformers[a5] = { package: s6.package, import: s6.import, config: l2, env: u4, variables: s6.variables, before: s6.before, next: s6.next, cache: s6.cache, validate: s6.validate, code: s6.code };
356
356
  }
357
357
  if (o4.collector) {
358
- const i4 = V(e5.variables, t5.variables), s6 = J(o4.collector, i4, n5, a4, r5);
358
+ const a5 = V(e5.variables, t5.variables), s6 = J(o4.collector, a5, n5, i3, r5);
359
359
  o4.collector = s6;
360
360
  }
361
361
  return o4;
362
- })(e4, c2, n4, i3);
362
+ })(e4, c2, n4, a4);
363
363
  } finally {
364
- o3.delete(t4), a3.pop();
364
+ o3.delete(t4), i2.pop();
365
365
  }
366
366
  }
367
367
  function Y(e4) {
@@ -372,8 +372,8 @@ function Y(e4) {
372
372
  function ee(e4, t4 = {}, n4 = {}) {
373
373
  n4 = { ...Q, ...n4 };
374
374
  const r4 = Object.entries(t4).reduce((t5, [r5, o3]) => {
375
- const a3 = e4[r5];
376
- return n4.merge && Array.isArray(a3) && Array.isArray(o3) ? t5[r5] = o3.reduce((e5, t6) => e5.includes(t6) ? e5 : [...e5, t6], [...a3]) : (n4.extend || r5 in e4) && (t5[r5] = o3), t5;
375
+ const i2 = e4[r5];
376
+ return n4.merge && Array.isArray(i2) && Array.isArray(o3) ? t5[r5] = o3.reduce((e5, t6) => e5.includes(t6) ? e5 : [...e5, t6], [...i2]) : (n4.extend || r5 in e4) && (t5[r5] = o3), t5;
377
377
  }, {});
378
378
  return n4.shallow ? { ...e4, ...r4 } : (Object.assign(e4, r4), e4);
379
379
  }
@@ -383,7 +383,7 @@ function ne(e4) {
383
383
  function re(e4) {
384
384
  return "boolean" == typeof e4;
385
385
  }
386
- function ae(e4) {
386
+ function ie(e4) {
387
387
  return void 0 !== e4;
388
388
  }
389
389
  function se(e4) {
@@ -430,31 +430,55 @@ function de(e4, t4 = "", n4) {
430
430
  for (let e5 = 0; e5 < r4.length; e5++) {
431
431
  const t5 = r4[e5];
432
432
  if ("*" === t5 && ne(o3)) {
433
- const t6 = r4.slice(e5 + 1).join("."), a3 = [];
433
+ const t6 = r4.slice(e5 + 1).join("."), i2 = [];
434
434
  for (const e6 of o3) {
435
435
  const r5 = de(e6, t6, n4);
436
- a3.push(r5);
436
+ i2.push(r5);
437
437
  }
438
- return a3;
438
+ return i2;
439
439
  }
440
440
  if (o3 = le(o3) || ne(o3) ? o3[t5] : void 0, void 0 === o3) break;
441
441
  }
442
- return ae(o3) ? o3 : n4;
442
+ return ie(o3) ? o3 : n4;
443
443
  }
444
444
  function me(e4, t4, n4) {
445
445
  if (!le(e4)) return e4;
446
446
  const r4 = pe(e4), o3 = t4.split(".");
447
- let a3 = r4;
447
+ let i2 = r4;
448
448
  for (let e5 = 0; e5 < o3.length; e5++) {
449
449
  const t5 = o3[e5];
450
- e5 === o3.length - 1 ? a3[t5] = n4 : (t5 in a3 && "object" == typeof a3[t5] && null !== a3[t5] || (a3[t5] = {}), a3 = a3[t5]);
450
+ e5 === o3.length - 1 ? i2[t5] = n4 : (t5 in i2 && "object" == typeof i2[t5] && null !== i2[t5] || (i2[t5] = {}), i2 = i2[t5]);
451
451
  }
452
452
  return r4;
453
453
  }
454
- function ye(e4, t4) {
455
- const n4 = {}, r4 = t4.includes("all") ? Object.keys(ge) : t4;
454
+ function ge(e4, t4) {
455
+ if (!le(e4) && !ne(e4)) return e4;
456
+ const n4 = pe(e4), r4 = t4.split(".");
457
+ let o3 = n4;
458
+ for (let e5 = 0; e5 < r4.length; e5++) {
459
+ const t5 = r4[e5], i2 = e5 === r4.length - 1;
460
+ if (ne(o3)) {
461
+ const e6 = Number(t5);
462
+ if (!Number.isInteger(e6) || e6 < 0 || e6 >= o3.length) return n4;
463
+ if (i2) o3.splice(e6, 1);
464
+ else {
465
+ const t6 = o3[e6];
466
+ if (!le(t6) && !ne(t6)) return n4;
467
+ o3 = t6;
468
+ }
469
+ } else if (i2) delete o3[t5];
470
+ else {
471
+ const e6 = o3[t5];
472
+ if (!le(e6) && !ne(e6)) return n4;
473
+ o3 = e6;
474
+ }
475
+ }
476
+ return n4;
477
+ }
478
+ function he(e4, t4) {
479
+ const n4 = {}, r4 = t4.includes("all") ? Object.keys(ye) : t4;
456
480
  for (const t5 of r4) {
457
- const r5 = ge[t5];
481
+ const r5 = ye[t5];
458
482
  if (!r5) continue;
459
483
  const o3 = r5(e4);
460
484
  if (le(o3)) for (const [e5, r6] of Object.entries(o3)) {
@@ -465,31 +489,31 @@ function ye(e4, t4) {
465
489
  }
466
490
  return n4;
467
491
  }
468
- function ve(e4, t4 = {}, n4 = {}) {
492
+ function be(e4, t4 = {}, n4 = {}) {
469
493
  const r4 = { ...t4, ...n4 }, o3 = {};
470
- let a3 = !e4 || 0 === Object.keys(e4).length;
494
+ let i2 = !e4 || 0 === Object.keys(e4).length;
471
495
  return Object.keys(r4).forEach((t5) => {
472
- r4[t5] && (o3[t5] = true, e4 && e4[t5] && (a3 = true));
473
- }), !!a3 && o3;
496
+ r4[t5] && (o3[t5] = true, e4 && e4[t5] && (i2 = true));
497
+ }), !!i2 && o3;
474
498
  }
475
- function ke() {
499
+ function $e() {
476
500
  let e4 = "";
477
501
  for (let t4 = 0; t4 < 16; t4++) e4 += (16 * Math.random() | 0).toString(16);
478
502
  return e4;
479
503
  }
480
- function $e(e4 = {}) {
481
- const t4 = e4.timestamp || (/* @__PURE__ */ new Date()).setHours(0, 13, 37, 0), n4 = ee({ name: "entity action", data: { string: "foo", number: 1, boolean: true, array: [0, "text", false], not: void 0 }, context: { dev: ["test", 1] }, globals: { lang: "elb" }, custom: { completely: "random" }, user: { id: "us3r", device: "c00k13", session: "s3ss10n" }, nested: [{ entity: "child", data: { is: "subordinated" } }], consent: { functional: true }, id: e4.id || ke(), trigger: "test", entity: "entity", action: "action", timestamp: t4, timing: 3.14, source: { type: "collector", schema: "4" } }, e4, { merge: false });
504
+ function je(e4 = {}) {
505
+ const t4 = e4.timestamp || (/* @__PURE__ */ new Date()).setHours(0, 13, 37, 0), n4 = ee({ name: "entity action", data: { string: "foo", number: 1, boolean: true, array: [0, "text", false], not: void 0 }, context: { dev: ["test", 1] }, globals: { lang: "elb" }, custom: { completely: "random" }, user: { id: "us3r", device: "c00k13", session: "s3ss10n" }, nested: [{ entity: "child", data: { is: "subordinated" } }], consent: { functional: true }, id: e4.id || $e(), trigger: "test", entity: "entity", action: "action", timestamp: t4, timing: 3.14, source: { type: "collector", schema: "4" } }, e4, { merge: false });
482
506
  if (e4.name) {
483
507
  const [t5, r4] = e4.name.split(" ") ?? [];
484
508
  t5 && r4 && (n4.entity = t5, n4.action = r4);
485
509
  }
486
510
  return n4;
487
511
  }
488
- function je(e4 = "entity action", t4 = {}) {
512
+ function xe(e4 = "entity action", t4 = {}) {
489
513
  const n4 = t4.timestamp || (/* @__PURE__ */ new Date()).setHours(0, 13, 37, 0), r4 = { data: { id: "ers", name: "Everyday Ruck Snack", color: "black", size: "l", price: 420 } }, o3 = { data: { id: "cc", name: "Cool Cap", size: "one size", price: 42 } };
490
- return $e({ ...{ "cart view": { data: { currency: "EUR", value: 2 * r4.data.price }, context: { shopping: ["cart", 0] }, globals: { pagegroup: "shop" }, nested: [{ entity: "product", data: { ...r4.data, quantity: 2 }, context: { shopping: ["cart", 0] }, nested: [] }], trigger: "load" }, "checkout view": { data: { step: "payment", currency: "EUR", value: r4.data.price + o3.data.price }, context: { shopping: ["checkout", 0] }, globals: { pagegroup: "shop" }, nested: [{ entity: "product", ...r4, context: { shopping: ["checkout", 0] }, nested: [] }, { entity: "product", ...o3, context: { shopping: ["checkout", 0] }, nested: [] }], trigger: "load" }, "order complete": { data: { id: "0rd3r1d", currency: "EUR", shipping: 5.22, taxes: 73.76, total: 555 }, context: { shopping: ["complete", 0] }, globals: { pagegroup: "shop" }, nested: [{ entity: "product", ...r4, context: { shopping: ["complete", 0] }, nested: [] }, { entity: "product", ...o3, context: { shopping: ["complete", 0] }, nested: [] }, { entity: "gift", data: { name: "Surprise" }, context: { shopping: ["complete", 0] }, nested: [] }], trigger: "load" }, "page view": { data: { domain: "www.example.com", title: "walkerOS documentation", referrer: "https://www.walkeros.io/", search: "?foo=bar", hash: "#hash", id: "/docs/" }, globals: { pagegroup: "docs" }, trigger: "load" }, "product add": { ...r4, context: { shopping: ["intent", 0] }, globals: { pagegroup: "shop" }, nested: [], trigger: "click" }, "product view": { ...r4, context: { shopping: ["detail", 0] }, globals: { pagegroup: "shop" }, nested: [], trigger: "load" }, "product visible": { data: { ...r4.data, position: 3, promo: true }, context: { shopping: ["discover", 0] }, globals: { pagegroup: "shop" }, nested: [], trigger: "load" }, "promotion visible": { data: { name: "Setting up tracking easily", position: "hero" }, context: { ab_test: ["engagement", 0] }, globals: { pagegroup: "homepage" }, trigger: "visible" }, "session start": { data: { id: "s3ss10n", start: n4, isNew: true, count: 1, runs: 1, isStart: true, storage: true, referrer: "", device: "c00k13" }, user: { id: "us3r", device: "c00k13", session: "s3ss10n", hash: "h4sh", address: "street number", email: "user@example.com", phone: "+49 123 456 789", userAgent: "Mozilla...", browser: "Chrome", browserVersion: "90", deviceType: "desktop", language: "de-DE", country: "DE", region: "HH", city: "Hamburg", zip: "20354", timezone: "Berlin", os: "walkerOS", osVersion: "1.0", screenSize: "1337x420", ip: "127.0.0.0", internal: true, custom: "value" } } }[e4], ...t4, name: e4 });
514
+ return je({ ...{ "cart view": { data: { currency: "EUR", value: 2 * r4.data.price }, context: { shopping: ["cart", 0] }, globals: { pagegroup: "shop" }, nested: [{ entity: "product", data: { ...r4.data, quantity: 2 }, context: { shopping: ["cart", 0] }, nested: [] }], trigger: "load" }, "checkout view": { data: { step: "payment", currency: "EUR", value: r4.data.price + o3.data.price }, context: { shopping: ["checkout", 0] }, globals: { pagegroup: "shop" }, nested: [{ entity: "product", ...r4, context: { shopping: ["checkout", 0] }, nested: [] }, { entity: "product", ...o3, context: { shopping: ["checkout", 0] }, nested: [] }], trigger: "load" }, "order complete": { data: { id: "0rd3r1d", currency: "EUR", shipping: 5.22, taxes: 73.76, total: 555 }, context: { shopping: ["complete", 0] }, globals: { pagegroup: "shop" }, nested: [{ entity: "product", ...r4, context: { shopping: ["complete", 0] }, nested: [] }, { entity: "product", ...o3, context: { shopping: ["complete", 0] }, nested: [] }, { entity: "gift", data: { name: "Surprise" }, context: { shopping: ["complete", 0] }, nested: [] }], trigger: "load" }, "page view": { data: { domain: "www.example.com", title: "walkerOS documentation", referrer: "https://www.walkeros.io/", search: "?foo=bar", hash: "#hash", id: "/docs/" }, globals: { pagegroup: "docs" }, trigger: "load" }, "product add": { ...r4, context: { shopping: ["intent", 0] }, globals: { pagegroup: "shop" }, nested: [], trigger: "click" }, "product view": { ...r4, context: { shopping: ["detail", 0] }, globals: { pagegroup: "shop" }, nested: [], trigger: "load" }, "product visible": { data: { ...r4.data, position: 3, promo: true }, context: { shopping: ["discover", 0] }, globals: { pagegroup: "shop" }, nested: [], trigger: "load" }, "promotion visible": { data: { name: "Setting up tracking easily", position: "hero" }, context: { ab_test: ["engagement", 0] }, globals: { pagegroup: "homepage" }, trigger: "visible" }, "session start": { data: { id: "s3ss10n", start: n4, isNew: true, count: 1, runs: 1, isStart: true, storage: true, referrer: "", device: "c00k13" }, user: { id: "us3r", device: "c00k13", session: "s3ss10n", hash: "h4sh", address: "street number", email: "user@example.com", phone: "+49 123 456 789", userAgent: "Mozilla...", browser: "Chrome", browserVersion: "90", deviceType: "desktop", language: "de-DE", country: "DE", region: "HH", city: "Hamburg", zip: "20354", timezone: "Berlin", os: "walkerOS", osVersion: "1.0", screenSize: "1337x420", ip: "127.0.0.0", internal: true, custom: "value" } } }[e4], ...t4, name: e4 });
491
515
  }
492
- function xe(e4 = 6, t4) {
516
+ function Ae(e4 = 6, t4) {
493
517
  if (t4) {
494
518
  const n5 = t4.length;
495
519
  let r4 = "";
@@ -500,29 +524,29 @@ function xe(e4 = 6, t4) {
500
524
  for (let t5 = 36; n4.length < e4; ) n4 += (Math.random() * t5 | 0).toString(t5);
501
525
  return n4;
502
526
  }
503
- function Se(e4, t4) {
527
+ function Ee(e4, t4) {
504
528
  return "number" == typeof e4 ? { wait: e4 } : e4 ? { wait: e4.wait ?? t4, size: e4.size, age: e4.age } : { wait: t4 };
505
529
  }
506
- function Ee(e4, t4 = 1e3, n4 = false) {
507
- const { wait: r4, size: o3, age: a3 } = Se(t4, 1e3);
508
- let i3, s5, c2 = null, l2 = null, u4 = false, f3 = [], p2 = 0;
530
+ function _e(e4, t4 = 1e3, n4 = false) {
531
+ const { wait: r4, size: o3, age: i2 } = Ee(t4, 1e3);
532
+ let a4, s5, c2 = null, l2 = null, u4 = false, f3 = [], p2 = 0;
509
533
  const d2 = () => {
510
534
  c2 && (clearTimeout(c2), c2 = null), l2 && (clearTimeout(l2), l2 = null), p2 = 0, s5 = void 0;
511
535
  }, m3 = () => {
512
536
  const t5 = s5, n5 = f3;
513
- if (d2(), f3 = [], t5) return i3 = e4(...t5), n5.forEach((e5) => e5(i3)), i3;
537
+ if (d2(), f3 = [], t5) return a4 = e4(...t5), n5.forEach((e5) => e5(a4)), a4;
514
538
  n5.forEach((e5) => e5(void 0));
515
539
  }, g3 = (...t5) => new Promise((d3) => {
516
540
  const g4 = n4 && !u4;
517
541
  if (s5 = t5, p2 += 1, f3.push(d3), c2 && clearTimeout(c2), c2 = setTimeout(() => {
518
542
  c2 = null, n4 && !u4 || m3();
519
- }, r4), void 0 === a3 || l2 || (l2 = setTimeout(() => {
543
+ }, r4), void 0 === i2 || l2 || (l2 = setTimeout(() => {
520
544
  l2 = null, m3();
521
- }, a3)), void 0 !== o3 && p2 >= o3) m3();
545
+ }, i2)), void 0 !== o3 && p2 >= o3) m3();
522
546
  else if (g4) {
523
- u4 = true, i3 = e4(...t5);
547
+ u4 = true, a4 = e4(...t5);
524
548
  const n5 = f3;
525
- f3 = [], n5.forEach((e5) => e5(i3));
549
+ f3 = [], n5.forEach((e5) => e5(a4));
526
550
  }
527
551
  });
528
552
  return g3.flush = () => s5 || 0 !== f3.length ? new Promise((e5) => {
@@ -532,39 +556,39 @@ function Ee(e4, t4 = 1e3, n4 = false) {
532
556
  f3 = [], d2(), e5.forEach((e6) => e6(void 0));
533
557
  }, g3.size = () => p2, g3;
534
558
  }
535
- function Ne(e4) {
559
+ function Ce(e4) {
536
560
  return { message: e4.message, name: e4.name, stack: e4.stack, cause: e4.cause };
537
561
  }
538
- function Ce(e4, t4) {
562
+ function Te(e4, t4) {
539
563
  let n4, r4 = {};
540
- return e4 instanceof Error ? (n4 = e4.message, r4.error = Ne(e4)) : n4 = e4, void 0 !== t4 && (t4 instanceof Error ? r4.error = Ne(t4) : "object" == typeof t4 && null !== t4 ? (r4 = { ...r4, ...t4 }, "error" in r4 && r4.error instanceof Error && (r4.error = Ne(r4.error))) : r4.value = t4), { message: n4, context: r4 };
564
+ return e4 instanceof Error ? (n4 = e4.message, r4.error = Ce(e4)) : n4 = e4, void 0 !== t4 && (t4 instanceof Error ? r4.error = Ce(t4) : "object" == typeof t4 && null !== t4 ? (r4 = { ...r4, ...t4 }, "error" in r4 && r4.error instanceof Error && (r4.error = Ce(r4.error))) : r4.value = t4), { message: n4, context: r4 };
541
565
  }
542
566
  function ze(e4 = {}) {
543
- return Ie({ level: void 0 !== e4.level ? (function(e5) {
567
+ return Pe({ level: void 0 !== e4.level ? (function(e5) {
544
568
  return "string" == typeof e5 ? f[e5] : e5;
545
569
  })(e4.level) : 0, handler: e4.handler, jsonHandler: e4.jsonHandler, scope: [] });
546
570
  }
547
- function Ie(e4) {
548
- const { level: t4, handler: n4, jsonHandler: r4, scope: o3 } = e4, a3 = (e5, r5, a4) => {
571
+ function Pe(e4) {
572
+ const { level: t4, handler: n4, jsonHandler: r4, scope: o3 } = e4, i2 = (e5, r5, i3) => {
549
573
  if (e5 <= t4) {
550
- const t5 = Ce(r5, a4);
551
- n4 ? n4(e5, t5.message, t5.context, o3, Te) : Te(e5, t5.message, t5.context, o3);
574
+ const t5 = Te(r5, i3);
575
+ n4 ? n4(e5, t5.message, t5.context, o3, Ie) : Ie(e5, t5.message, t5.context, o3);
552
576
  }
553
577
  };
554
- return { error: (e5, t5) => a3(0, e5, t5), warn: (e5, t5) => a3(1, e5, t5), info: (e5, t5) => a3(2, e5, t5), debug: (e5, t5) => a3(3, e5, t5), throw: (e5, t5) => {
555
- const r5 = Ce(e5, t5);
556
- throw n4 ? n4(0, r5.message, r5.context, o3, Te) : Te(0, r5.message, r5.context, o3), new Error(r5.message);
578
+ return { error: (e5, t5) => i2(0, e5, t5), warn: (e5, t5) => i2(1, e5, t5), info: (e5, t5) => i2(2, e5, t5), debug: (e5, t5) => i2(3, e5, t5), throw: (e5, t5) => {
579
+ const r5 = Te(e5, t5);
580
+ throw n4 ? n4(0, r5.message, r5.context, o3, Ie) : Ie(0, r5.message, r5.context, o3), new Error(r5.message);
557
581
  }, json: (e5) => {
558
582
  r4 ? r4(e5) : console.log(JSON.stringify(e5, null, 2));
559
- }, scope: (e5) => Ie({ level: t4, handler: n4, jsonHandler: r4, scope: [...o3, e5] }) };
583
+ }, scope: (e5) => Pe({ level: t4, handler: n4, jsonHandler: r4, scope: [...o3, e5] }) };
560
584
  }
561
- function Pe(e4) {
562
- return re(e4) || fe(e4) || ce(e4) || !ae(e4) || ne(e4) && e4.every(Pe) || le(e4) && Object.values(e4).every(Pe);
585
+ function Me(e4) {
586
+ return re(e4) || fe(e4) || ce(e4) || !ie(e4) || ne(e4) && e4.every(Me) || le(e4) && Object.values(e4).every(Me);
563
587
  }
564
- function Re(e4) {
565
- return Pe(e4) ? e4 : void 0;
588
+ function Ze(e4) {
589
+ return Me(e4) ? e4 : void 0;
566
590
  }
567
- function Ze(e4, t4, n4) {
591
+ function De(e4, t4, n4) {
568
592
  return function(...r4) {
569
593
  try {
570
594
  return e4(...r4);
@@ -576,7 +600,7 @@ function Ze(e4, t4, n4) {
576
600
  }
577
601
  };
578
602
  }
579
- function De(e4, t4, n4) {
603
+ function Ue(e4, t4, n4) {
580
604
  return async function(...r4) {
581
605
  try {
582
606
  return await e4(...r4);
@@ -588,10 +612,10 @@ function De(e4, t4, n4) {
588
612
  }
589
613
  };
590
614
  }
591
- async function Fe(e4, t4, n4) {
615
+ async function We(e4, t4, n4) {
592
616
  const [r4, o3] = (e4.name || "").split(" ");
593
617
  if (!t4 || !r4 || !o3) return {};
594
- let a3, i3 = "", s5 = r4, c2 = o3;
618
+ let i2, a4 = "", s5 = r4, c2 = o3;
595
619
  const l2 = (t5) => {
596
620
  if (!t5) return;
597
621
  return (ne(t5) ? t5 : [t5]).find((t6) => {
@@ -603,153 +627,154 @@ async function Fe(e4, t4, n4) {
603
627
  };
604
628
  t4[s5] || (s5 = "*");
605
629
  const u4 = t4[s5];
606
- return u4 && (u4[c2] || (c2 = "*"), a3 = l2(u4[c2])), a3 || (s5 = "*", c2 = "*", a3 = l2(t4[s5]?.[c2])), a3 && (i3 = `${s5} ${c2}`), { eventMapping: a3, mappingKey: i3 };
630
+ return u4 && (u4[c2] || (c2 = "*"), i2 = l2(u4[c2])), i2 || (s5 = "*", c2 = "*", i2 = l2(t4[s5]?.[c2])), i2 && (a4 = `${s5} ${c2}`), { eventMapping: i2, mappingKey: a4 };
607
631
  }
608
- async function We(e4, t4 = {}, n4 = {}) {
609
- if (!ae(e4)) return;
632
+ async function He(e4, t4 = {}, n4 = {}) {
633
+ if (!ie(e4)) return;
610
634
  const r4 = le(e4) && e4.consent || n4.consent || n4.collector?.consent, o3 = n4.event ?? (le(e4) ? e4 : {});
611
635
  if (!n4.collector) throw new Error("getMappingValue: context.collector is required");
612
- const a3 = { event: o3, mapping: t4, collector: n4.collector, logger: n4.collector.logger, consent: r4 }, i3 = ne(t4) ? t4 : [t4];
613
- for (const t5 of i3) {
614
- const r5 = await De(He, (e5) => {
615
- if (e5 instanceof Ue) throw e5;
616
- n4.collector && n4.collector.status.failed++, a3.logger.error("mapping processing failed", { event: o3, error: e5 });
617
- })(e4, t5, { ...a3, mapping: t5 });
618
- if (ae(r5)) return r5;
636
+ const i2 = { event: o3, mapping: t4, collector: n4.collector, logger: n4.collector.logger, consent: r4 }, a4 = ne(t4) ? t4 : [t4];
637
+ for (const t5 of a4) {
638
+ const r5 = await Ue(Le, (e5) => {
639
+ if (e5 instanceof Fe) throw e5;
640
+ n4.collector && n4.collector.status.failed++, i2.logger.error("mapping processing failed", { event: o3, error: e5 });
641
+ })(e4, t5, { ...i2, mapping: t5 });
642
+ if (ie(r5)) return r5;
619
643
  }
620
644
  }
621
- async function He(e4, t4, n4) {
645
+ async function Le(e4, t4, n4) {
622
646
  return (ne(t4) ? t4 : [t4]).reduce(async (t5, r4) => {
623
647
  const o3 = await t5;
624
648
  if (o3) return o3;
625
- const a3 = fe(r4) ? { key: r4 } : r4;
626
- if (!Object.keys(a3).length) return;
627
- const { condition: i3, consent: s5, fn: c2, key: l2, loop: u4, map: f3, set: p2, validate: d2, value: m3 } = a3, g3 = { ...n4, mapping: r4 };
628
- if (i3 && !await De(i3, (e5) => {
629
- if (e5 instanceof Ue) throw e5;
649
+ const i2 = fe(r4) ? { key: r4 } : r4;
650
+ if (!Object.keys(i2).length) return;
651
+ const { condition: a4, consent: s5, fn: c2, key: l2, loop: u4, map: f3, set: p2, validate: d2, value: m3 } = i2, g3 = { ...n4, mapping: r4 };
652
+ if (a4 && !await Ue(a4, (e5) => {
653
+ if (e5 instanceof Fe) throw e5;
630
654
  return g3.logger.error("mapping condition failed", { event: g3.event, error: e5 }), false;
631
655
  })(e4, g3)) return;
632
- if (s5 && !ve(s5, g3.consent)) return m3;
633
- let y2 = ae(m3) ? m3 : e4;
634
- if (c2 && (y2 = await De(c2, (e5) => {
635
- if (e5 instanceof Ue) throw e5;
656
+ if (s5 && !be(s5, g3.consent)) return m3;
657
+ let y2 = ie(m3) ? m3 : e4;
658
+ if (c2 && (y2 = await Ue(c2, (e5) => {
659
+ if (e5 instanceof Fe) throw e5;
636
660
  g3.logger.error("mapping fn failed", { event: g3.event, error: e5 });
637
661
  })(e4, g3)), l2 && (y2 = de(e4, l2, m3)), u4) {
638
- const [t6, n5] = u4, r5 = "this" === t6 ? [e4] : await We(e4, t6, g3);
639
- ne(r5) && (y2 = (await Promise.all(r5.map((e5) => We(e5, n5, g3)))).filter(ae));
662
+ const [t6, n5] = u4, r5 = "this" === t6 ? [e4] : await He(e4, t6, g3);
663
+ ne(r5) && (y2 = (await Promise.all(r5.map((e5) => He(e5, n5, g3)))).filter(ie));
640
664
  } else f3 ? y2 = await Object.entries(f3).reduce(async (t6, [n5, r5]) => {
641
- const o4 = await t6, a4 = await We(e4, r5, g3);
642
- return ae(a4) && (o4[n5] = a4), o4;
643
- }, Promise.resolve({})) : p2 && (y2 = await Promise.all(p2.map((t6) => He(e4, t6, g3))));
644
- d2 && !await De(d2, (e5) => {
645
- if (e5 instanceof Ue) throw e5;
665
+ const o4 = await t6, i3 = await He(e4, r5, g3);
666
+ return ie(i3) && (o4[n5] = i3), o4;
667
+ }, Promise.resolve({})) : p2 && (y2 = await Promise.all(p2.map((t6) => Le(e4, t6, g3))));
668
+ d2 && !await Ue(d2, (e5) => {
669
+ if (e5 instanceof Fe) throw e5;
646
670
  return g3.logger.error("mapping validate failed", { event: g3.event, error: e5 }), false;
647
671
  })(y2, g3) && (y2 = void 0);
648
- const h3 = Re(y2);
649
- return ae(h3) ? h3 : Re(m3);
672
+ const h3 = Ze(y2);
673
+ return ie(h3) ? h3 : Ze(m3);
650
674
  }, Promise.resolve(void 0));
651
675
  }
652
- async function Le(e4, t4, n4) {
676
+ async function Ve(e4, t4, n4) {
653
677
  t4.policy && await Promise.all(Object.entries(t4.policy).map(async ([t5, r5]) => {
654
- const o4 = await We(e4, r5, { collector: n4, event: e4 });
678
+ const o4 = await He(e4, r5, { collector: n4, event: e4 });
655
679
  e4 = me(e4, t5, o4);
656
680
  }));
657
- const { eventMapping: r4, mappingKey: o3 } = await Fe(e4, t4.mapping, n4);
681
+ const { eventMapping: r4, mappingKey: o3 } = await We(e4, t4.mapping, n4);
658
682
  r4?.policy && await Promise.all(Object.entries(r4.policy).map(async ([t5, r5]) => {
659
- const o4 = await We(e4, r5, { collector: n4, event: e4 });
683
+ const o4 = await He(e4, r5, { collector: n4, event: e4 });
660
684
  e4 = me(e4, t5, o4);
661
685
  }));
662
- let a3 = t4.data && await We(e4, t4.data, { collector: n4, event: e4 });
663
- const i3 = Boolean(r4?.silent);
686
+ let i2 = t4.data && await He(e4, t4.data, { collector: n4, event: e4 });
687
+ const a4 = Boolean(r4?.silent);
664
688
  if (r4) {
665
- if (r4.ignore) return { event: e4, data: a3, mapping: r4, mappingKey: o3, ignore: true, silent: i3 };
689
+ if (r4.ignore) return { event: e4, data: i2, mapping: r4, mappingKey: o3, ignore: true, silent: a4 };
666
690
  if (r4.name && (e4.name = r4.name), r4.data) {
667
- const t5 = r4.data && await We(e4, r4.data, { collector: n4, event: e4 });
668
- a3 = le(a3) && le(t5) ? ee(a3, t5) : t5;
691
+ const t5 = r4.data && await He(e4, r4.data, { collector: n4, event: e4 });
692
+ i2 = le(i2) && le(t5) ? ee(i2, t5) : t5;
669
693
  }
670
694
  }
671
695
  const s5 = r4?.include ?? t4.include;
672
696
  if (s5 && s5.length > 0) {
673
- const t5 = ye(e4, s5);
674
- Object.keys(t5).length > 0 && (a3 = le(a3) ? ee(t5, a3) : a3 ?? t5);
697
+ const t5 = he(e4, s5);
698
+ Object.keys(t5).length > 0 && (i2 = le(i2) ? ee(t5, i2) : i2 ?? t5);
675
699
  }
676
- return { event: e4, data: a3, mapping: r4, mappingKey: o3, ignore: false, silent: i3 };
700
+ if (r4?.remove && le(i2)) for (const e5 of r4.remove) i2 = ge(i2, e5);
701
+ return { event: e4, data: i2, mapping: r4, mappingKey: o3, ignore: false, silent: a4 };
677
702
  }
678
- function Xe(e4) {
703
+ function et(e4) {
679
704
  return void 0 === e4 || ue(e4, "") ? e4 : JSON.stringify(e4);
680
705
  }
681
- function Ye(e4 = {}) {
706
+ function tt(e4 = {}) {
682
707
  return ee({ "Content-Type": "application/json; charset=utf-8" }, e4);
683
708
  }
684
- function tt(e4, t4, n4, r4) {
709
+ function ot(e4, t4, n4, r4) {
685
710
  return function(...o3) {
686
- let a3;
687
- const i3 = "pre" + t4, s5 = "post" + t4, c2 = n4[i3], l2 = n4[s5], u4 = (e5, t5) => {
711
+ let i2;
712
+ const a4 = "pre" + t4, s5 = "post" + t4, c2 = n4[a4], l2 = n4[s5], u4 = (e5, t5) => {
688
713
  r4 ? r4.warn(e5, { error: t5 }) : console.warn(e5, t5);
689
714
  };
690
715
  if (c2) try {
691
- a3 = c2({ fn: e4 }, ...o3);
716
+ i2 = c2({ fn: e4 }, ...o3);
692
717
  } catch (t5) {
693
- u4(`Hook ${String(i3)} failed, falling back to original function`, t5), a3 = e4(...o3);
718
+ u4(`Hook ${String(a4)} failed, falling back to original function`, t5), i2 = e4(...o3);
694
719
  }
695
- else a3 = e4(...o3);
720
+ else i2 = e4(...o3);
696
721
  if (l2) try {
697
- a3 = l2({ fn: e4, result: a3 }, ...o3);
722
+ i2 = l2({ fn: e4, result: i2 }, ...o3);
698
723
  } catch (e5) {
699
724
  u4(`Hook ${String(s5)} failed, keeping original result`, e5);
700
725
  }
701
- return a3;
726
+ return i2;
702
727
  };
703
728
  }
704
- function pt(e4) {
729
+ function gt(e4) {
705
730
  return "string" == typeof e4 || Array.isArray(e4) && e4.every((e5) => "string" == typeof e5) ? e4 : void 0;
706
731
  }
707
- async function dt(e4, t4) {
708
- const n4 = t4?.version || "latest", r4 = t4?.timeout || 1e4, o3 = new AbortController(), a3 = setTimeout(() => o3.abort(), r4), i3 = o3.signal, s5 = t4?.client ? { "X-Walkeros-Client": t4.client } : void 0;
732
+ async function yt(e4, t4) {
733
+ const n4 = t4?.version || "latest", r4 = t4?.timeout || 1e4, o3 = new AbortController(), i2 = setTimeout(() => o3.abort(), r4), a4 = o3.signal, s5 = t4?.client ? { "X-Walkeros-Client": t4.client } : void 0;
709
734
  try {
710
735
  if (t4?.baseUrl) {
711
- const r6 = `${t4.baseUrl}/api/packages/${encodeURIComponent(e4)}?version=${encodeURIComponent(n4)}&expand=all`, o5 = await fetch(r6, { signal: i3, ...s5 && { headers: s5 } });
736
+ const r6 = `${t4.baseUrl}/api/packages/${encodeURIComponent(e4)}?version=${encodeURIComponent(n4)}&expand=all`, o5 = await fetch(r6, { signal: a4, ...s5 && { headers: s5 } });
712
737
  if (!o5.ok) throw new Error(`Failed to fetch ${r6} (HTTP ${o5.status})`);
713
738
  return (function(e5, t5, n5) {
714
- const r7 = n5.schemas || {}, o6 = n5.examples || {}, a4 = n5.hints, i4 = n5.hintKeys ?? (a4 ? Object.keys(a4) : []), s6 = n5.exampleSummaries ?? [], c2 = n5.platform;
715
- return { packageName: n5.package || e5, version: "string" == typeof n5.version ? n5.version : t5, ...void 0 !== n5.description && { description: n5.description }, ...void 0 !== n5.type && { type: n5.type }, ...void 0 !== c2 && { platform: c2 }, schemas: r7, examples: o6, ...void 0 !== n5.docs && { docs: n5.docs }, ...void 0 !== n5.source && { source: n5.source }, ...a4 && Object.keys(a4).length > 0 ? { hints: a4 } : {}, hintKeys: i4, exampleSummaries: s6 };
739
+ const r7 = n5.schemas || {}, o6 = n5.examples || {}, i3 = n5.hints, a5 = n5.hintKeys ?? (i3 ? Object.keys(i3) : []), s6 = n5.exampleSummaries ?? [], c2 = n5.platform;
740
+ return { packageName: n5.package || e5, version: "string" == typeof n5.version ? n5.version : t5, ...void 0 !== n5.description && { description: n5.description }, ...void 0 !== n5.type && { type: n5.type }, ...void 0 !== c2 && { platform: c2 }, schemas: r7, examples: o6, ...void 0 !== n5.docs && { docs: n5.docs }, ...void 0 !== n5.source && { source: n5.source }, ...i3 && Object.keys(i3).length > 0 ? { hints: i3 } : {}, hintKeys: a5, exampleSummaries: s6 };
716
741
  })(e4, n4, await o5.json());
717
742
  }
718
- const r5 = `https://cdn.jsdelivr.net/npm/${e4}@${n4}`, o4 = await mt(`${r5}/package.json`, i3, s5);
743
+ const r5 = `https://cdn.jsdelivr.net/npm/${e4}@${n4}`, o4 = await ht(`${r5}/package.json`, a4, s5);
719
744
  return (function(e5, t5, n5, r6) {
720
- const o5 = r6.$meta || {}, a4 = r6.schemas || {}, i4 = r6.examples || {}, s6 = r6.hints, c2 = s6 ? Object.keys(s6) : [], l2 = [], u4 = i4.step || {};
745
+ const o5 = r6.$meta || {}, i3 = r6.schemas || {}, a5 = r6.examples || {}, s6 = r6.hints, c2 = s6 ? Object.keys(s6) : [], l2 = [], u4 = a5.step || {};
721
746
  for (const [e6, t6] of Object.entries(u4)) {
722
747
  const n6 = t6, r7 = { name: e6 };
723
748
  "string" == typeof n6?.description && (r7.description = n6.description), l2.push(r7);
724
749
  }
725
750
  const f3 = "string" == typeof o5.docs ? o5.docs : void 0, p2 = "string" == typeof o5.source ? o5.source : void 0;
726
- return { packageName: e5, version: "string" == typeof n5.version ? n5.version : t5, description: "string" == typeof n5.description ? n5.description : void 0, type: "string" == typeof o5.type ? o5.type : void 0, platform: pt(o5.platform), schemas: a4, examples: i4, ...f3 ? { docs: f3 } : {}, ...p2 ? { source: p2 } : {}, ...s6 && Object.keys(s6).length > 0 ? { hints: s6 } : {}, hintKeys: c2, exampleSummaries: l2 };
727
- })(e4, n4, o4, await mt(`${r5}/dist/walkerOS.json`, i3, s5));
751
+ return { packageName: e5, version: "string" == typeof n5.version ? n5.version : t5, description: "string" == typeof n5.description ? n5.description : void 0, type: "string" == typeof o5.type ? o5.type : void 0, platform: gt(o5.platform), schemas: i3, examples: a5, ...f3 ? { docs: f3 } : {}, ...p2 ? { source: p2 } : {}, ...s6 && Object.keys(s6).length > 0 ? { hints: s6 } : {}, hintKeys: c2, exampleSummaries: l2 };
752
+ })(e4, n4, o4, await ht(`${r5}/dist/walkerOS.json`, a4, s5));
728
753
  } finally {
729
- clearTimeout(a3);
754
+ clearTimeout(i2);
730
755
  }
731
756
  }
732
- async function mt(e4, t4, n4) {
757
+ async function ht(e4, t4, n4) {
733
758
  const r4 = await fetch(e4, { signal: t4, ...n4 && { headers: n4 } });
734
759
  if (!r4.ok) throw new Error(`Failed to fetch ${e4} (HTTP ${r4.status})`);
735
760
  return await r4.json();
736
761
  }
737
- async function gt(e4, t4) {
738
- const n4 = await dt(e4, t4);
762
+ async function vt(e4, t4) {
763
+ const n4 = await yt(e4, t4);
739
764
  return { packageName: n4.packageName, version: n4.version, type: n4.type, platform: n4.platform, schemas: n4.schemas, examples: n4.examples, ...n4.hints ? { hints: n4.hints } : {} };
740
765
  }
741
- function bt(e4) {
766
+ function $t(e4) {
742
767
  if (void 0 === e4 || "*" === e4) return () => true;
743
768
  if ("and" in e4) {
744
- const t4 = e4.and.map(bt);
769
+ const t4 = e4.and.map($t);
745
770
  return (e5) => t4.every((t5) => t5(e5));
746
771
  }
747
772
  if ("or" in e4) {
748
- const t4 = e4.or.map(bt);
773
+ const t4 = e4.or.map($t);
749
774
  return (e5) => t4.some((t5) => t5(e5));
750
775
  }
751
776
  return (function(e5) {
752
- const { key: t4, operator: n4, value: r4, not: o3 } = e5, a3 = (function(e6, t5) {
777
+ const { key: t4, operator: n4, value: r4, not: o3 } = e5, i2 = (function(e6, t5) {
753
778
  switch (e6) {
754
779
  case "eq":
755
780
  return (e7) => String(e7 ?? "") === t5;
@@ -776,74 +801,74 @@ function bt(e4) {
776
801
  }
777
802
  })(n4, r4);
778
803
  return (e6) => {
779
- const n5 = de(e6, t4), r5 = a3(n5);
804
+ const n5 = de(e6, t4), r5 = i2(n5);
780
805
  return o3 ? !r5 : r5;
781
806
  };
782
807
  })(e4);
783
808
  }
784
- function wt(e4) {
809
+ function jt(e4) {
785
810
  return Array.isArray(e4) && e4.length > 0 && e4.every((e5) => (function(e6) {
786
811
  return "object" == typeof e6 && null !== e6 && !Array.isArray(e6) && ("match" in e6 || "next" in e6 || "one" in e6 || "many" in e6);
787
812
  })(e5));
788
813
  }
789
- function kt(e4) {
814
+ function xt(e4) {
790
815
  return e4.map((e5) => {
791
816
  if ("string" == typeof e5) return { match: () => true, next: { type: "static", value: e5 } };
792
- if (Array.isArray(e5)) return { match: () => true, next: $t(e5) ?? { type: "chain", value: [] } };
817
+ if (Array.isArray(e5)) return { match: () => true, next: At(e5) ?? { type: "chain", value: [] } };
793
818
  const t4 = e5;
794
- return { match: t4.match ? bt(t4.match) : () => true, next: $t(t4) ?? { type: "chain", value: [] } };
819
+ return { match: t4.match ? $t(t4.match) : () => true, next: At(t4) ?? { type: "chain", value: [] } };
795
820
  });
796
821
  }
797
- function $t(e4) {
822
+ function At(e4) {
798
823
  if (null == e4) return;
799
824
  if ("string" == typeof e4) return { type: "static", value: e4 };
800
825
  if (Array.isArray(e4)) {
801
826
  if (0 === e4.length) return;
802
- if (wt(e4)) return $t({ one: e4 });
827
+ if (jt(e4)) return At({ one: e4 });
803
828
  if (e4.every((e5) => "string" == typeof e5)) return { type: "chain", value: e4 };
804
829
  const t5 = [];
805
830
  for (const n4 of e4) {
806
- const e5 = $t(n4);
831
+ const e5 = At(n4);
807
832
  void 0 !== e5 && t5.push(e5);
808
833
  }
809
834
  if (0 === t5.length) return;
810
835
  return { type: "sequence", value: t5 };
811
836
  }
812
837
  const t4 = e4;
813
- if ("next" in t4 && void 0 !== t4.next) return t4.match ? { type: "gate", match: bt(t4.match), next: $t(t4.next) } : $t(t4.next);
838
+ if ("next" in t4 && void 0 !== t4.next) return t4.match ? { type: "gate", match: $t(t4.match), next: At(t4.next) } : At(t4.next);
814
839
  if ("one" in t4 && t4.one) {
815
- const e5 = kt(t4.one);
816
- return t4.match ? { type: "gate", match: bt(t4.match), next: { type: "one", routes: e5 } } : { type: "one", routes: e5 };
840
+ const e5 = xt(t4.one);
841
+ return t4.match ? { type: "gate", match: $t(t4.match), next: { type: "one", routes: e5 } } : { type: "one", routes: e5 };
817
842
  }
818
843
  if ("many" in t4 && t4.many) {
819
- const e5 = kt(t4.many);
820
- return t4.match ? { type: "gate", match: bt(t4.match), next: { type: "many", routes: e5 } } : { type: "many", routes: e5 };
844
+ const e5 = xt(t4.many);
845
+ return t4.match ? { type: "gate", match: $t(t4.match), next: { type: "many", routes: e5 } } : { type: "many", routes: e5 };
821
846
  }
822
- return t4.match ? { type: "gate", match: bt(t4.match) } : void 0;
847
+ return t4.match ? { type: "gate", match: $t(t4.match) } : void 0;
823
848
  }
824
- function xt(e4, t4 = {}) {
849
+ function St(e4, t4 = {}) {
825
850
  if (null == e4) return [];
826
851
  let n4;
827
852
  if ("object" == typeof e4) {
828
- const t5 = jt.get(e4);
829
- t5 ? n4 = t5 : (n4 = $t(e4), n4 && jt.set(e4, n4));
830
- } else n4 = $t(e4);
853
+ const t5 = Ot.get(e4);
854
+ t5 ? n4 = t5 : (n4 = At(e4), n4 && Ot.set(e4, n4));
855
+ } else n4 = At(e4);
831
856
  if (!n4) return [];
832
- const r4 = At(n4, t4);
857
+ const r4 = Et(n4, t4);
833
858
  return void 0 === r4 ? [] : Array.isArray(r4) ? r4 : [r4];
834
859
  }
835
- function At(e4, t4 = {}) {
860
+ function Et(e4, t4 = {}) {
836
861
  if (e4) {
837
862
  if ("static" === e4.type) return e4.value;
838
863
  if ("chain" === e4.type) return e4.value;
839
864
  if ("gate" === e4.type) {
840
865
  if (!e4.match(t4)) return;
841
- return At(e4.next, t4);
866
+ return Et(e4.next, t4);
842
867
  }
843
868
  if ("sequence" === e4.type) {
844
869
  const n4 = [];
845
870
  for (const r4 of e4.value) {
846
- const e5 = At(r4, t4);
871
+ const e5 = Et(r4, t4);
847
872
  void 0 !== e5 && (Array.isArray(e5) ? n4.push(...e5) : n4.push(e5));
848
873
  }
849
874
  return n4.length > 0 ? n4 : void 0;
@@ -852,52 +877,52 @@ function At(e4, t4 = {}) {
852
877
  const n4 = [];
853
878
  for (const r4 of e4.routes) {
854
879
  if (!r4.match(t4)) continue;
855
- const e5 = At(r4.next, t4);
880
+ const e5 = Et(r4.next, t4);
856
881
  void 0 !== e5 && (Array.isArray(e5) ? n4.push(...e5) : n4.push(e5));
857
882
  }
858
883
  return n4.length > 0 ? n4 : void 0;
859
884
  }
860
- for (const n4 of e4.routes) if (n4.match(t4)) return At(n4.next, t4);
885
+ for (const n4 of e4.routes) if (n4.match(t4)) return Et(n4.next, t4);
861
886
  }
862
887
  }
863
- function Ot(e4, t4) {
888
+ function _t(e4, t4) {
864
889
  const n4 = { ingest: e4 ?? {} };
865
890
  return void 0 !== t4 && (n4.event = t4), n4;
866
891
  }
867
- function St(e4) {
868
- return { stop: e4.stop ?? false, storeId: e4.store, namespace: e4.namespace, rules: e4.rules.map((e5) => ({ match: e5.match ? bt(e5.match) : () => true, key: e5.key, ttl: e5.ttl, update: e5.update })) };
892
+ function Nt(e4) {
893
+ return { stop: e4.stop ?? false, storeId: e4.store, namespace: e4.namespace, rules: e4.rules.map((e5) => ({ match: e5.match ? $t(e5.match) : () => true, key: e5.key, ttl: e5.ttl, update: e5.update })) };
869
894
  }
870
- async function Et(e4, t4, n4, r4) {
895
+ async function Ct(e4, t4, n4, r4) {
871
896
  const o3 = e4.rules.find((e5) => e5.match(n4));
872
897
  if (!o3) return null;
873
- const a3 = o3.key.map((e5) => String(de(n4, e5) ?? ""));
874
- if (a3.every((e5) => "" === e5)) return null;
875
- const i3 = a3.join(":"), s5 = r4 ?? e4.namespace, c2 = s5 ? `${s5}:${i3}` : i3, l2 = await t4.get(c2);
898
+ const i2 = o3.key.map((e5) => String(de(n4, e5) ?? ""));
899
+ if (i2.every((e5) => "" === e5)) return null;
900
+ const a4 = i2.join(":"), s5 = r4 ?? e4.namespace, c2 = s5 ? `${s5}:${a4}` : a4, l2 = await t4.get(c2);
876
901
  return void 0 !== l2 ? { status: "HIT", key: c2, value: l2, rule: o3 } : { status: "MISS", key: c2, rule: o3 };
877
902
  }
878
- function _t(e4, t4, n4, r4) {
903
+ function Tt(e4, t4, n4, r4) {
879
904
  e4.set(t4, n4, 1e3 * r4);
880
905
  }
881
- async function Nt(e4, t4, n4, r4) {
906
+ async function It(e4, t4, n4, r4) {
882
907
  if (!t4) return e4;
883
908
  let o3 = e4;
884
- for (const [e5, a3] of Object.entries(t4)) {
885
- o3 = me(o3, e5, await We(n4, a3, { collector: r4 }));
909
+ for (const [e5, i2] of Object.entries(t4)) {
910
+ o3 = me(o3, e5, await He(n4, i2, { collector: r4 }));
886
911
  }
887
912
  return o3;
888
913
  }
889
- function Pt(e4, t4) {
914
+ function Zt(e4, t4) {
890
915
  const n4 = (function(e5) {
891
- return /* @__PURE__ */ new Set([...Ct[e5], ...Tt, ...zt[e5]]);
916
+ return /* @__PURE__ */ new Set([...zt[e5], ...Pt, ...Mt[e5]]);
892
917
  })(t4);
893
918
  for (const r5 of Object.keys(e4)) if (!n4.has(r5)) return { ok: false, code: "UNKNOWN_KEY", key: r5, reason: `Unknown key "${r5}" on ${t4}. Allowed: ${[...n4].sort().join(", ")}.` };
894
- const r4 = void 0 !== e4.package, o3 = void 0 !== e4.import, a3 = void 0 !== e4.code;
895
- return a3 && "string" == typeof e4.code ? { ok: false, code: "OBSOLETE_CODE_STRING", key: "code", reason: `code: "<name>" is no longer supported. Use import: "${e4.code}" with the package field instead.` } : a3 && ("object" != typeof e4.code && "function" != typeof e4.code || null === e4.code || Array.isArray(e4.code)) ? { ok: false, code: "INVALID_CODE_SHAPE", key: "code", reason: "code must be an object ({ push, type?, init? }) or a resolved function value." } : a3 && r4 ? { ok: false, code: "CONFLICT", key: "package", reason: "Cannot specify both `code` and `package`. Use one or the other." } : a3 && o3 ? { ok: false, code: "CONFLICT", key: "import", reason: "Cannot specify both `code` and `import`." } : o3 && !r4 ? { ok: false, code: "MISSING_PACKAGE", key: "import", reason: "`import` requires `package` to be set." } : !o3 || "string" == typeof e4.import && It.test(e4.import) ? { ok: true } : { ok: false, code: "INVALID_IMPORT", key: "import", reason: `import must match ${It.source}. Got: ${JSON.stringify(e4.import)}.` };
919
+ const r4 = void 0 !== e4.package, o3 = void 0 !== e4.import, i2 = void 0 !== e4.code;
920
+ return i2 && "string" == typeof e4.code ? { ok: false, code: "OBSOLETE_CODE_STRING", key: "code", reason: `code: "<name>" is no longer supported. Use import: "${e4.code}" with the package field instead.` } : i2 && ("object" != typeof e4.code && "function" != typeof e4.code || null === e4.code || Array.isArray(e4.code)) ? { ok: false, code: "INVALID_CODE_SHAPE", key: "code", reason: "code must be an object ({ push, type?, init? }) or a resolved function value." } : i2 && r4 ? { ok: false, code: "CONFLICT", key: "package", reason: "Cannot specify both `code` and `package`. Use one or the other." } : i2 && o3 ? { ok: false, code: "CONFLICT", key: "import", reason: "Cannot specify both `code` and `import`." } : o3 && !r4 ? { ok: false, code: "MISSING_PACKAGE", key: "import", reason: "`import` requires `package` to be set." } : !o3 || "string" == typeof e4.import && Rt.test(e4.import) ? { ok: true } : { ok: false, code: "INVALID_IMPORT", key: "import", reason: `import must match ${Rt.source}. Got: ${JSON.stringify(e4.import)}.` };
896
921
  }
897
- function Mt(e4, t4) {
922
+ function Dt(e4, t4) {
898
923
  return "Transformer" === t4 && (void 0 === e4.code && void 0 === e4.package && void 0 === e4.import && (void 0 !== e4.before || void 0 !== e4.next || void 0 !== e4.cache || void 0 !== e4.mapping));
899
924
  }
900
- var e, t, r, i, u, f, m, h, b, T, R, Z, D, U, F, q, Q, ge, Te, Ue, jt, Ct, Tt, zt, It;
925
+ var e, t, r, a, u, f, m, h, b, T, R, Z, D, U, F, q, Q, ye, Ie, Fe, Ot, zt, Pt, Mt, Rt;
901
926
  var init_dist = __esm({
902
927
  "../core/dist/index.mjs"() {
903
928
  "use strict";
@@ -907,8 +932,8 @@ var init_dist = __esm({
907
932
  };
908
933
  r = {};
909
934
  t(r, { stepId: () => o });
910
- i = {};
911
- t(i, { getDestination: () => s });
935
+ a = {};
936
+ t(a, { getDestination: () => s });
912
937
  u = {};
913
938
  t(u, { Level: () => f });
914
939
  f = ((e4) => (e4[e4.ERROR = 0] = "ERROR", e4[e4.WARN = 1] = "WARN", e4[e4.INFO = 2] = "INFO", e4[e4.DEBUG = 3] = "DEBUG", e4))(f || {});
@@ -926,21 +951,21 @@ var init_dist = __esm({
926
951
  F = /^\$flow\.([a-zA-Z_][a-zA-Z0-9_]*)(?:\.([a-zA-Z0-9_.]+))?$/;
927
952
  q = "__WALKEROS_ENV:";
928
953
  Q = { merge: true, shallow: true, extend: true };
929
- ge = { data: (e4) => e4.data, globals: (e4) => e4.globals, context: (e4) => e4.context, user: (e4) => e4.user, source: (e4) => e4.source, event: (e4) => ({ entity: e4.entity, action: e4.action, id: e4.id, timestamp: e4.timestamp, name: e4.name, trigger: e4.trigger, timing: e4.timing }) };
930
- Te = (e4, t4, n4, r4) => {
931
- const o3 = `${f[e4]}${r4.length > 0 ? ` [${r4.join(":")}]` : ""}`, a3 = Object.keys(n4).length > 0, i3 = 0 === e4 ? console.error : 1 === e4 ? console.warn : console.log;
932
- a3 ? i3(o3, t4, n4) : i3(o3, t4);
954
+ ye = { data: (e4) => e4.data, globals: (e4) => e4.globals, context: (e4) => e4.context, user: (e4) => e4.user, source: (e4) => e4.source, event: (e4) => ({ entity: e4.entity, action: e4.action, id: e4.id, timestamp: e4.timestamp, name: e4.name, trigger: e4.trigger, timing: e4.timing }) };
955
+ Ie = (e4, t4, n4, r4) => {
956
+ const o3 = `${f[e4]}${r4.length > 0 ? ` [${r4.join(":")}]` : ""}`, i2 = Object.keys(n4).length > 0, a4 = 0 === e4 ? console.error : 1 === e4 ? console.warn : console.log;
957
+ i2 ? a4(o3, t4, n4) : a4(o3, t4);
933
958
  };
934
- Ue = class e2 extends Error {
959
+ Fe = class e2 extends Error {
935
960
  constructor(t4, n4) {
936
961
  super(t4, n4), this.name = "FatalError", Object.setPrototypeOf(this, e2.prototype);
937
962
  }
938
963
  };
939
- jt = /* @__PURE__ */ new WeakMap();
940
- Ct = { Source: ["code", "package", "import", "before", "next", "cache"], Transformer: ["code", "package", "import", "before", "next", "cache", "mapping"], Destination: ["code", "package", "import", "before", "next", "cache"], Store: ["code", "package", "import", "cache"] };
941
- Tt = ["config", "env", "validate", "variables", "examples", "disabled", "id", "logger", "mock", "chainMocks"];
942
- zt = { Source: ["primary"], Transformer: [], Destination: [], Store: [] };
943
- It = /^[A-Za-z_$][A-Za-z0-9_$]*$/;
964
+ Ot = /* @__PURE__ */ new WeakMap();
965
+ zt = { Source: ["code", "package", "import", "before", "next", "cache"], Transformer: ["code", "package", "import", "before", "next", "cache", "mapping"], Destination: ["code", "package", "import", "before", "next", "cache"], Store: ["code", "package", "import", "cache"] };
966
+ Pt = ["config", "env", "validate", "variables", "examples", "disabled", "id", "logger", "mock", "chainMocks"];
967
+ Mt = { Source: ["primary"], Transformer: [], Destination: [], Store: [] };
968
+ Rt = /^[A-Za-z_$][A-Za-z0-9_$]*$/;
944
969
  }
945
970
  });
946
971
 
@@ -948,15 +973,15 @@ var init_dist = __esm({
948
973
  import * as r2 from "http";
949
974
  import * as s3 from "https";
950
975
  import { createHash as n2 } from "crypto";
951
- function a(a3, n4, u4 = {}) {
952
- const i3 = Ye(u4.headers), c2 = Xe(n4), d2 = u4.method || "POST", m3 = u4.timeout || 5e3;
976
+ function a2(a4, n4, u4 = {}) {
977
+ const i2 = tt(u4.headers), c2 = et(n4), d2 = u4.method || "POST", m3 = u4.timeout || 5e3;
953
978
  return new Promise((t4) => {
954
- const e4 = new URL(a3), n5 = "https:" === e4.protocol ? s3 : r2, u5 = { method: d2, headers: i3 }, p2 = n5.request(e4, u5, (e5) => {
979
+ const e4 = new URL(a4), n5 = "https:" === e4.protocol ? s3 : r2, u5 = { method: d2, headers: i2 }, p2 = n5.request(e4, u5, (e5) => {
955
980
  const r4 = [];
956
981
  e5.on("data", (t5) => {
957
982
  r4.push(t5);
958
983
  }), e5.on("end", () => {
959
- const s5 = !!(e5.statusCode && e5.statusCode >= 200 && e5.statusCode < 300), a4 = Buffer.concat(r4).toString(), n6 = Ze(JSON.parse, () => a4)(a4);
984
+ const s5 = !!(e5.statusCode && e5.statusCode >= 200 && e5.statusCode < 300), a5 = Buffer.concat(r4).toString(), n6 = De(JSON.parse, () => a5)(a5);
960
985
  t4({ ok: s5, data: n6, error: s5 ? void 0 : `${e5.statusCode} ${e5.statusMessage}` });
961
986
  });
962
987
  });
@@ -1559,9 +1584,9 @@ var init_sse = __esm({
1559
1584
 
1560
1585
  // ../core/dist/dev.mjs
1561
1586
  import { z as n3 } from "zod";
1562
- import { z as Qi } from "zod";
1563
- function o2(e4, t4, i3 = "draft-7") {
1564
- return n3.toJSONSchema(e4, { target: i3 });
1587
+ import { z as Yi } from "zod";
1588
+ function o2(e4, t4, i2 = "draft-7") {
1589
+ return n3.toJSONSchema(e4, { target: i2 });
1565
1590
  }
1566
1591
  function R2(e4, t4) {
1567
1592
  return n3.object({ data: n3.union([e4, t4]).optional().describe("Data transformation rules") }).partial();
@@ -1575,213 +1600,216 @@ function T2(e4) {
1575
1600
  function F2(e4) {
1576
1601
  return n3.object({ consent: e4.optional().describe("Required consent states") }).partial();
1577
1602
  }
1578
- function zi(e4) {
1579
- return Fi.parse(e4);
1580
- }
1581
- function Li(e4) {
1582
- return Fi.safeParse(e4);
1603
+ function Pi(e4, t4) {
1604
+ void 0 !== e4.import && (void 0 !== e4.code && t4.addIssue({ code: "custom", message: "`import` cannot be combined with inline `code`", path: ["import"] }), void 0 === e4.package && t4.addIssue({ code: "custom", message: "`import` requires `package`", path: ["import"] }));
1583
1605
  }
1584
1606
  function $i(e4) {
1585
- return Ti.parse(e4);
1607
+ return Li.parse(e4);
1586
1608
  }
1587
1609
  function qi(e4) {
1588
- return Ti.safeParse(e4);
1610
+ return Li.safeParse(e4);
1611
+ }
1612
+ function Ni(e4) {
1613
+ return zi.parse(e4);
1614
+ }
1615
+ function Ai(e4) {
1616
+ return zi.safeParse(e4);
1589
1617
  }
1590
- function nn2(e4) {
1618
+ function rn2(e4) {
1591
1619
  let t4;
1592
1620
  try {
1593
1621
  t4 = JSON.parse(e4);
1594
1622
  } catch (t5) {
1595
- const { line: i4, column: n5 } = (function(e5, t6) {
1623
+ const { line: i3, column: n5 } = (function(e5, t6) {
1596
1624
  if (e5 instanceof SyntaxError) {
1597
- const i5 = e5.message.match(/position\s+(\d+)/);
1598
- if (i5) {
1599
- return cn2(t6, parseInt(i5[1], 10));
1625
+ const i4 = e5.message.match(/position\s+(\d+)/);
1626
+ if (i4) {
1627
+ return dn(t6, parseInt(i4[1], 10));
1600
1628
  }
1601
1629
  const n6 = e5.message.match(/line\s+(\d+)\s+column\s+(\d+)/);
1602
1630
  if (n6) return { line: parseInt(n6[1], 10), column: parseInt(n6[2], 10) };
1603
1631
  }
1604
1632
  return { line: 1, column: 1 };
1605
1633
  })(t5, e4);
1606
- return { valid: false, errors: [{ message: t5 instanceof Error ? t5.message : "Invalid JSON", severity: "error", line: i4, column: n5 }], warnings: [] };
1634
+ return { valid: false, errors: [{ message: t5 instanceof Error ? t5.message : "Invalid JSON", severity: "error", line: i3, column: n5 }], warnings: [] };
1607
1635
  }
1608
- const i3 = [], n4 = [], o3 = Fi.safeParse(t4);
1636
+ const i2 = [], n4 = [], o3 = Li.safeParse(t4);
1609
1637
  if (!o3.success) for (const t5 of o3.error.issues) {
1610
- const n5 = t5.path.join("."), o4 = dn(e4, t5.path);
1611
- i3.push({ message: t5.message, severity: "error", path: n5 || "root", ...o4 });
1638
+ const n5 = t5.path.join("."), o4 = un2(e4, t5.path);
1639
+ i2.push({ message: t5.message, severity: "error", path: n5 || "root", ...o4 });
1612
1640
  }
1613
1641
  const r4 = (function(e5) {
1614
- if (!(pn(e5) && "version" in e5 && "flows" in e5 && pn(e5.flows))) return;
1615
- const t5 = {}, i4 = [], n5 = [], o4 = [], r5 = [], a3 = [], s5 = [];
1642
+ if (!(mn(e5) && "version" in e5 && "flows" in e5 && mn(e5.flows))) return;
1643
+ const t5 = {}, i3 = [], n5 = [], o4 = [], r5 = [], a4 = [], s5 = [];
1616
1644
  let c2;
1617
1645
  const l2 = Object.keys(e5.flows);
1618
- un2(t5, e5.variables), (function(e6, t6) {
1619
- if (!pn(t6)) return;
1620
- for (const [, i5] of Object.entries(t6)) {
1621
- if (!pn(i5)) continue;
1622
- const t7 = i5.events;
1623
- if (pn(t7)) for (const [i6, n6] of Object.entries(t7)) {
1624
- if (!pn(n6)) continue;
1625
- const t8 = e6.find((e7) => e7.entity === i6), o5 = Object.keys(n6);
1646
+ fn(t5, e5.variables), (function(e6, t6) {
1647
+ if (!mn(t6)) return;
1648
+ for (const [, i4] of Object.entries(t6)) {
1649
+ if (!mn(i4)) continue;
1650
+ const t7 = i4.events;
1651
+ if (mn(t7)) for (const [i5, n6] of Object.entries(t7)) {
1652
+ if (!mn(n6)) continue;
1653
+ const t8 = e6.find((e7) => e7.entity === i5), o5 = Object.keys(n6);
1626
1654
  if (t8) for (const e7 of o5) t8.actions.includes(e7) || t8.actions.push(e7);
1627
- else e6.push({ entity: i6, actions: o5 });
1655
+ else e6.push({ entity: i5, actions: o5 });
1628
1656
  }
1629
1657
  }
1630
1658
  })(s5, e5.contract);
1631
- for (const s6 of Object.values(e5.flows)) if (pn(s6)) {
1659
+ for (const s6 of Object.values(e5.flows)) if (mn(s6)) {
1632
1660
  if (!c2) {
1633
1661
  const e6 = s6.config;
1634
- !pn(e6) || "web" !== e6.platform && "server" !== e6.platform || (c2 = e6.platform);
1662
+ !mn(e6) || "web" !== e6.platform && "server" !== e6.platform || (c2 = e6.platform);
1635
1663
  }
1636
- un2(t5, s6.variables);
1664
+ fn(t5, s6.variables);
1637
1665
  for (const e6 of ["sources", "destinations", "transformers"]) {
1638
- const r6 = "sources" === e6 ? "source" : "destinations" === e6 ? "destination" : "transformer", l3 = "sources" === e6 ? i4 : "destinations" === e6 ? n5 : o4;
1639
- if (pn(s6[e6])) for (const [i5, n6] of Object.entries(s6[e6])) l3.push(i5), pn(n6) && (un2(t5, n6.variables), "string" == typeof n6.package && a3.push({ package: n6.package, shortName: i5, type: r6, platform: c2 || "web" }));
1666
+ const r6 = "sources" === e6 ? "source" : "destinations" === e6 ? "destination" : "transformer", l3 = "sources" === e6 ? i3 : "destinations" === e6 ? n5 : o4;
1667
+ if (mn(s6[e6])) for (const [i4, n6] of Object.entries(s6[e6])) l3.push(i4), mn(n6) && (fn(t5, n6.variables), "string" == typeof n6.package && a4.push({ package: n6.package, shortName: i4, type: r6, platform: c2 || "web" }));
1640
1668
  }
1641
- if (pn(s6.stores)) for (const [e6, i5] of Object.entries(s6.stores)) r5.push(e6), pn(i5) && un2(t5, i5.variables);
1669
+ if (mn(s6.stores)) for (const [e6, i4] of Object.entries(s6.stores)) r5.push(e6), mn(i4) && fn(t5, i4.variables);
1642
1670
  }
1643
- const d2 = { variables: t5, stepNames: { sources: i4, destinations: n5, transformers: o4, stores: r5 }, flowNames: l2 };
1671
+ const d2 = { variables: t5, stepNames: { sources: i3, destinations: n5, transformers: o4, stores: r5 }, flowNames: l2 };
1644
1672
  c2 && (d2.platform = c2);
1645
- a3.length > 0 && (d2.packages = a3);
1673
+ a4.length > 0 && (d2.packages = a4);
1646
1674
  s5.length > 0 && (d2.contract = s5);
1647
1675
  return d2;
1648
1676
  })(t4);
1649
1677
  if (r4) {
1650
1678
  const t5 = (function(e5, t6) {
1651
- const i4 = [];
1652
- return (function(e6, t7, i5) {
1679
+ const i3 = [];
1680
+ return (function(e6, t7, i4) {
1653
1681
  let n5;
1654
- sn2.lastIndex = 0;
1655
- for (; null !== (n5 = sn2.exec(e6)); ) {
1656
- const t8 = n5[0], o4 = n5[1], r5 = n5[2], a3 = ln2(e6, n5.index, t8.length);
1657
- i5.push({ message: `Malformed reference "${t8}", use a dot, not a colon: "$${o4}.${r5}".`, severity: "warning", path: t8, ...a3 });
1682
+ ln2.lastIndex = 0;
1683
+ for (; null !== (n5 = ln2.exec(e6)); ) {
1684
+ const t8 = n5[0], o4 = n5[1], r5 = n5[2], a4 = pn(e6, n5.index, t8.length);
1685
+ i4.push({ message: `Malformed reference "${t8}", use a dot, not a colon: "$${o4}.${r5}".`, severity: "warning", path: t8, ...a4 });
1658
1686
  }
1659
- })(e5, 0, i4), (function(e6, t7, i5) {
1687
+ })(e5, 0, i3), (function(e6, t7, i4) {
1660
1688
  if (!t7.variables) return;
1661
1689
  const n5 = /\$var\.(\w+)/g;
1662
1690
  let o4;
1663
1691
  for (; null !== (o4 = n5.exec(e6)); ) if (!(o4[1] in t7.variables)) {
1664
- const n6 = ln2(e6, o4.index, o4[0].length);
1665
- i5.push({ message: `Unknown variable "$var.${o4[1]}". Defined: ${Object.keys(t7.variables).join(", ") || "none"}`, severity: "warning", path: `$var.${o4[1]}`, ...n6 });
1692
+ const n6 = pn(e6, o4.index, o4[0].length);
1693
+ i4.push({ message: `Unknown variable "$var.${o4[1]}". Defined: ${Object.keys(t7.variables).join(", ") || "none"}`, severity: "warning", path: `$var.${o4[1]}`, ...n6 });
1666
1694
  }
1667
- })(e5, t6, i4), (function(e6, t7, i5) {
1695
+ })(e5, t6, i3), (function(e6, t7, i4) {
1668
1696
  const n5 = t7.stepNames?.stores ?? [];
1669
1697
  let o4;
1670
- on2.lastIndex = 0;
1671
- for (; null !== (o4 = on2.exec(e6)); ) if (!n5.includes(o4[1])) {
1672
- const t8 = ln2(e6, o4.index, o4[0].length);
1673
- i5.push({ message: `Unknown store "$store.${o4[1]}". Defined: ${n5.join(", ") || "none"}`, severity: "warning", path: `$store.${o4[1]}`, ...t8 });
1698
+ an2.lastIndex = 0;
1699
+ for (; null !== (o4 = an2.exec(e6)); ) if (!n5.includes(o4[1])) {
1700
+ const t8 = pn(e6, o4.index, o4[0].length);
1701
+ i4.push({ message: `Unknown store "$store.${o4[1]}". Defined: ${n5.join(", ") || "none"}`, severity: "warning", path: `$store.${o4[1]}`, ...t8 });
1674
1702
  }
1675
- })(e5, t6, i4), (function(e6, t7, i5) {
1703
+ })(e5, t6, i3), (function(e6, t7, i4) {
1676
1704
  let n5;
1677
- rn2.lastIndex = 0;
1678
- for (; null !== (n5 = rn2.exec(e6)); ) {
1679
- const t8 = n5[0], o4 = n5[1], r5 = n5[2], a3 = ln2(e6, n5.index, t8.length);
1680
- r5 ? i5.push({ message: `Malformed $env reference "${t8}". Use ":" for default values, not "=" (e.g., "$env.${o4}:fallback").`, severity: "warning", path: t8, ...a3 }) : /^[A-Z][A-Z0-9_]*$/.test(o4) || i5.push({ message: `$env.${o4} should use UPPER_SNAKE_CASE by convention (e.g., $env.${o4.toUpperCase()}).`, severity: "warning", path: t8, ...a3 });
1705
+ sn2.lastIndex = 0;
1706
+ for (; null !== (n5 = sn2.exec(e6)); ) {
1707
+ const t8 = n5[0], o4 = n5[1], r5 = n5[2], a4 = pn(e6, n5.index, t8.length);
1708
+ r5 ? i4.push({ message: `Malformed $env reference "${t8}". Use ":" for default values, not "=" (e.g., "$env.${o4}:fallback").`, severity: "warning", path: t8, ...a4 }) : /^[A-Z][A-Z0-9_]*$/.test(o4) || i4.push({ message: `$env.${o4} should use UPPER_SNAKE_CASE by convention (e.g., $env.${o4.toUpperCase()}).`, severity: "warning", path: t8, ...a4 });
1681
1709
  }
1682
- })(e5, 0, i4), (function(e6, t7, i5) {
1710
+ })(e5, 0, i3), (function(e6, t7, i4) {
1683
1711
  const n5 = t7.flowNames ?? [];
1684
1712
  if (0 === n5.length) return;
1685
1713
  let o4;
1686
- an2.lastIndex = 0;
1687
- for (; null !== (o4 = an2.exec(e6)); ) {
1714
+ cn2.lastIndex = 0;
1715
+ for (; null !== (o4 = cn2.exec(e6)); ) {
1688
1716
  const t8 = o4[0], r5 = o4[1];
1689
1717
  if (!n5.includes(r5)) {
1690
- const a3 = ln2(e6, o4.index, t8.length);
1691
- i5.push({ message: `Unknown flow "$flow.${r5}". Defined: ${n5.join(", ")}`, severity: "warning", path: t8, ...a3 });
1718
+ const a4 = pn(e6, o4.index, t8.length);
1719
+ i4.push({ message: `Unknown flow "$flow.${r5}". Defined: ${n5.join(", ")}`, severity: "warning", path: t8, ...a4 });
1692
1720
  }
1693
1721
  }
1694
- })(e5, t6, i4), i4;
1722
+ })(e5, t6, i3), i3;
1695
1723
  })(e4, r4);
1696
1724
  n4.push(...t5);
1697
1725
  }
1698
- return { valid: 0 === i3.length, errors: i3, warnings: n4, context: r4 };
1726
+ return { valid: 0 === i2.length, errors: i2, warnings: n4, context: r4 };
1699
1727
  }
1700
- function cn2(e4, t4) {
1701
- let i3 = 1, n4 = 1;
1702
- for (let o3 = 0; o3 < t4 && o3 < e4.length; o3++) "\n" === e4[o3] ? (i3++, n4 = 1) : n4++;
1703
- return { line: i3, column: n4 };
1728
+ function dn(e4, t4) {
1729
+ let i2 = 1, n4 = 1;
1730
+ for (let o3 = 0; o3 < t4 && o3 < e4.length; o3++) "\n" === e4[o3] ? (i2++, n4 = 1) : n4++;
1731
+ return { line: i2, column: n4 };
1704
1732
  }
1705
- function ln2(e4, t4, i3) {
1706
- const n4 = cn2(e4, t4), o3 = cn2(e4, t4 + i3);
1733
+ function pn(e4, t4, i2) {
1734
+ const n4 = dn(e4, t4), o3 = dn(e4, t4 + i2);
1707
1735
  return { line: n4.line, column: n4.column, endLine: o3.line, endColumn: o3.column };
1708
1736
  }
1709
- function dn(e4, t4) {
1737
+ function un2(e4, t4) {
1710
1738
  if (0 === t4.length) return { line: 1, column: 1 };
1711
- const i3 = t4[t4.length - 1];
1712
- if ("string" == typeof i3) {
1713
- const t5 = `"${i3}"`, n4 = e4.lastIndexOf(t5);
1714
- if (-1 !== n4) return cn2(e4, n4);
1739
+ const i2 = t4[t4.length - 1];
1740
+ if ("string" == typeof i2) {
1741
+ const t5 = `"${i2}"`, n4 = e4.lastIndexOf(t5);
1742
+ if (-1 !== n4) return dn(e4, n4);
1715
1743
  }
1716
1744
  return { line: 1, column: 1 };
1717
1745
  }
1718
- function pn(e4) {
1746
+ function mn(e4) {
1719
1747
  return "object" == typeof e4 && null !== e4 && !Array.isArray(e4);
1720
1748
  }
1721
- function un2(e4, t4) {
1722
- if (pn(t4)) for (const [i3, n4] of Object.entries(t4)) e4[i3] = n4;
1749
+ function fn(e4, t4) {
1750
+ if (mn(t4)) for (const [i2, n4] of Object.entries(t4)) e4[i2] = n4;
1723
1751
  }
1724
- function mn(e4, t4) {
1725
- const i3 = [], n4 = {};
1752
+ function gn(e4, t4) {
1753
+ const i2 = [], n4 = {};
1726
1754
  for (const [t5, o4] of Object.entries(e4)) {
1727
- o4.required && i3.push(t5);
1755
+ o4.required && i2.push(t5);
1728
1756
  const e5 = { type: o4.type };
1729
1757
  if (o4.description && (e5.description = o4.description), o4.pattern && (e5.pattern = o4.pattern), void 0 !== o4.minLength && (e5.minLength = o4.minLength), void 0 !== o4.maxLength && (e5.maxLength = o4.maxLength), void 0 !== o4.minimum && (e5.minimum = o4.minimum), void 0 !== o4.maximum && (e5.maximum = o4.maximum), o4.enum && (e5.enum = [...o4.enum]), void 0 !== o4.default && (e5.default = o4.default), "object" === o4.type && o4.properties) {
1730
1758
  const t6 = {};
1731
- for (const [e6, i4] of Object.entries(o4.properties)) t6[e6] = fn(i4);
1759
+ for (const [e6, i3] of Object.entries(o4.properties)) t6[e6] = hn(i3);
1732
1760
  e5.properties = t6;
1733
1761
  }
1734
- "array" === o4.type && o4.items && (e5.items = fn(o4.items)), n4[t5] = e5;
1762
+ "array" === o4.type && o4.items && (e5.items = hn(o4.items)), n4[t5] = e5;
1735
1763
  }
1736
1764
  const o3 = { type: "object", properties: n4 };
1737
- return t4 && (o3.title = t4), i3.length > 0 && (o3.required = i3), o3;
1765
+ return t4 && (o3.title = t4), i2.length > 0 && (o3.required = i2), o3;
1738
1766
  }
1739
- function fn(e4) {
1767
+ function hn(e4) {
1740
1768
  const t4 = { type: e4.type };
1741
1769
  if (e4.description && (t4.description = e4.description), e4.pattern && (t4.pattern = e4.pattern), void 0 !== e4.minLength && (t4.minLength = e4.minLength), void 0 !== e4.maxLength && (t4.maxLength = e4.maxLength), void 0 !== e4.minimum && (t4.minimum = e4.minimum), void 0 !== e4.maximum && (t4.maximum = e4.maximum), e4.enum && (t4.enum = [...e4.enum]), void 0 !== e4.default && (t4.default = e4.default), "object" === e4.type && e4.properties) {
1742
- const i3 = {};
1743
- for (const [t5, n4] of Object.entries(e4.properties)) i3[t5] = fn(n4);
1744
- t4.properties = i3;
1770
+ const i2 = {};
1771
+ for (const [t5, n4] of Object.entries(e4.properties)) i2[t5] = hn(n4);
1772
+ t4.properties = i2;
1745
1773
  }
1746
- return "array" === e4.type && e4.items && (t4.items = fn(e4.items)), t4;
1774
+ return "array" === e4.type && e4.items && (t4.items = hn(e4.items)), t4;
1747
1775
  }
1748
- function gn(e4, t4) {
1749
- const i3 = { type: "array", items: fn(e4) };
1750
- return void 0 !== t4?.minItems && (i3.minItems = t4.minItems), void 0 !== t4?.maxItems && (i3.maxItems = t4.maxItems), t4?.description && (i3.description = t4.description), t4?.title && (i3.title = t4.title), i3;
1776
+ function bn(e4, t4) {
1777
+ const i2 = { type: "array", items: hn(e4) };
1778
+ return void 0 !== t4?.minItems && (i2.minItems = t4.minItems), void 0 !== t4?.maxItems && (i2.maxItems = t4.maxItems), t4?.description && (i2.description = t4.description), t4?.title && (i2.title = t4.title), i2;
1751
1779
  }
1752
- function hn(e4, t4 = "string", i3) {
1780
+ function vn(e4, t4 = "string", i2) {
1753
1781
  const n4 = { type: t4, enum: [...e4] };
1754
- return i3?.description && (n4.description = i3.description), i3?.title && (n4.title = i3.title), n4;
1782
+ return i2?.description && (n4.description = i2.description), i2?.title && (n4.title = i2.title), n4;
1755
1783
  }
1756
- function bn(e4, t4, i3) {
1757
- return gn({ type: "object" }, { minItems: 2, maxItems: 2, description: i3 || "Tuple with exactly 2 elements [source, transform]" });
1784
+ function Sn(e4, t4, i2) {
1785
+ return bn({ type: "object" }, { minItems: 2, maxItems: 2, description: i2 || "Tuple with exactly 2 elements [source, transform]" });
1758
1786
  }
1759
- function vn(e4) {
1787
+ function yn(e4) {
1760
1788
  const t4 = n3.toJSONSchema(e4, { target: "draft-7" });
1761
- return Sn(t4), t4;
1789
+ return wn(t4), t4;
1762
1790
  }
1763
- function Sn(e4) {
1791
+ function wn(e4) {
1764
1792
  const t4 = e4.properties;
1765
1793
  if (t4 && "object" == typeof t4) {
1766
1794
  Array.isArray(e4.required) && (e4.required = e4.required.filter((e5) => {
1767
- const i3 = t4[e5];
1768
- return !(i3 && "object" == typeof i3 && "default" in i3);
1795
+ const i2 = t4[e5];
1796
+ return !(i2 && "object" == typeof i2 && "default" in i2);
1769
1797
  }));
1770
- for (const [e5, i3] of Object.entries(t4)) i3 && "object" == typeof i3 && ("object" === i3.type && i3.properties && "string" != typeof i3.title && (i3.title = e5), Sn(i3));
1798
+ for (const [e5, i2] of Object.entries(t4)) i2 && "object" == typeof i2 && ("object" === i2.type && i2.properties && "string" != typeof i2.title && (i2.title = e5), wn(i2));
1771
1799
  }
1772
1800
  }
1773
- var e3, t3, i2, r3, a2, s4, c, l, d, p, u3, m2, f2, g2, h2, b2, v2, S, y, w2, k, C2, x, j, E2, P2, D2, I2, O, J2, z2, L, $, q2, N, A, W, B2, U2, V2, H, _, Z3, G2, K2, Q3, X3, Y2, ee3, te2, ie2, ne3, oe2, re3, ae3, se3, ce3, le3, de3, pe3, ue3, me3, fe3, ge3, he2, be2, ve3, Se3, ye3, we2, ke3, Ce3, xe3, je3, Ee3, Pe3, De3, Ie3, Oe2, Je2, Re2, Me, Te2, Fe3, ze2, Le2, $e3, qe2, Ne2, Ae2, We3, Be, Ue2, Ve, He3, _e2, Ze2, Ge2, Ke, Qe, Xe2, Ye2, et, tt2, it, nt, ot, rt, at, st, ct, lt, dt2, pt2, ut, mt2, ft, gt2, ht, bt2, vt, St2, yt, wt2, kt2, Ct2, xt2, jt2, Et2, Pt2, Dt, It2, Ot2, Jt, Rt, Mt2, Tt2, Ft, zt2, Lt, $t2, qt, Nt2, At2, Wt, Bt, Ut, Vt, Ht, _t2, Zt, Gt, Kt, Qt, Xt, Yt, ei, ti, ii, ni, oi, ri, ai, si, ci, li, di, pi, ui, mi, fi, gi, hi, bi, vi, Si, yi, wi, ki, Ci, xi, ji, Ei, Pi, Di, Ii, Oi, Ji, Ri, Mi, Ti, Fi, Ni, Ai, Wi, Bi, Ui, Vi, Hi, _i, Zi, Gi, Ki, Xi, Yi, en, tn, on2, rn2, an2, sn2, wn;
1801
+ var e3, t3, i, r3, a3, s4, c, l, d, p, u3, m2, f2, g2, h2, b2, v2, S, y, w2, k, C2, x, P2, j, E2, D2, I2, O, J2, z2, L, $, q2, N, A, W, B2, U2, V2, H, _, Z3, G2, K2, Q3, X3, Y2, ee3, te2, ie3, ne3, oe2, re3, ae2, se3, ce3, le3, de3, pe3, ue3, me3, fe3, ge3, he3, be3, ve2, Se2, ye3, we2, ke2, Ce3, xe3, Pe3, je3, Ee3, De3, Ie3, Oe2, Je2, Re, Me2, Te2, Fe3, ze2, Le2, $e3, qe2, Ne, Ae3, We3, Be, Ue2, Ve2, He3, _e3, Ze2, Ge2, Ke, Qe, Xe, Ye, et2, tt2, it, nt, ot2, rt, at, st, ct, lt, dt, pt, ut, mt, ft, gt2, ht2, bt, vt2, St2, yt2, wt, kt, Ct2, xt2, Pt2, jt2, Et2, Dt2, It2, Ot2, Jt, Rt2, Mt2, Tt2, Ft, zt2, Lt, $t2, qt, Nt2, At2, Wt, Bt, Ut, Vt, Ht, _t2, Zt2, Gt, Kt, Qt, Xt, Yt, ei, ti, ii, ni, oi, ri, ai, si, ci, li, di, pi, ui, mi, fi, gi, hi, bi, vi, Si, yi, wi, ki, Ci, xi, ji, Ei, Di, Ii, Oi, Ji, Ri, Mi, Ti, Fi, zi, Li, Wi, Bi, Ui, Vi, Hi, _i, Zi, Gi, Ki, Qi, Xi, en, tn, nn2, on2, an2, sn2, cn2, ln2, Cn;
1774
1802
  var init_dev = __esm({
1775
1803
  "../core/dist/dev.mjs"() {
1776
1804
  "use strict";
1777
1805
  e3 = Object.defineProperty;
1778
- t3 = (t4, i3) => {
1779
- for (var n4 in i3) e3(t4, n4, { get: i3[n4], enumerable: true });
1806
+ t3 = (t4, i2) => {
1807
+ for (var n4 in i2) e3(t4, n4, { get: i2[n4], enumerable: true });
1780
1808
  };
1781
- i2 = {};
1782
- t3(i2, { BaseContextConfig: () => L, CacheRuleSchema: () => Qe, CacheSchema: () => Xe2, CacheSchemas: () => He3, ClickIdEntrySchema: () => tn, CodeSchema: () => Xi, CollectorSchemas: () => Et2, ConsentSchema: () => Z3, ContractActionsSchema: () => Ii, ContractRuleSchema: () => Ji, ContractSchema: () => Ri, ContractSchemaEntry: () => Di, Counter: () => d, DeepPartialEventSchema: () => te2, DestinationSchemas: () => Je2, DestinationsMapConfig: () => N, EntitiesSchema: () => X3, EntitySchema: () => Q3, EventCacheRuleSchema: () => _e2, EventCacheSchema: () => Ze2, EventSchema: () => Y2, FlowBundlePackageSchema: () => gi, FlowBundleSchema: () => hi, FlowCodeSchema: () => bi, FlowConfigSchema: () => Mi, FlowDestinationSchema: () => Ei, FlowJsonSchema: () => Fi, FlowSchema: () => Ti, FlowSchemas: () => pi, FlowSourceSchema: () => xi, FlowStoreSchema: () => Pi, FlowTransformerSchema: () => ji, GenericEnvConfig: () => J2, GenericSettingsConfig: () => O, HandlersConfig: () => x, HintSchema: () => Yi, HintsSchema: () => en, IdConfig: () => P2, Identifier: () => c, InitConfig: () => D2, LoggerConfigSchema: () => et, LoggerHandlerSchema: () => Ye2, LoopSchema: () => me3, MapSchema: () => ge3, MappingResultSchema: () => we2, MappingSchemas: () => de3, MatchExpressionSchema: () => Fe3, MatcherSchemas: () => Re2, OptionalPrimitiveValue: () => u3, OrderedPropertiesSchema: () => H, PartialEventSchema: () => ee3, PolicySchema: () => be2, PrimaryConfig: () => I2, PrimitiveValue: () => p, ProcessingControlConfig: () => $, PropertiesSchema: () => V2, PropertySchema: () => U2, PropertyTypeSchema: () => B2, QueueConfig: () => E2, RequiredBoolean: () => s4, RequiredNumber: () => a2, RequiredString: () => r3, RouteSchema: () => Ae2, RouteWithoutManySchema: () => Ve, RuleSchema: () => ve3, RulesSchema: () => Se3, RuntimeInstanceConfig: () => z2, SetSchema: () => fe3, SourceSchema: () => K2, SourceSchemas: () => At2, SourceTypeSchema: () => _, SourcesMapConfig: () => q2, StoreCacheRuleSchema: () => Ge2, StoreCacheSchema: () => Ke, StoreSchemas: () => ai, Timestamp: () => l, TransformerSchemas: () => ti, UserSchema: () => G2, UtilitySchemas: () => m2, ValidateEventsSchema: () => ki, ValidateSchema: () => Ci, ValueConfigSchema: () => he2, ValueSchema: () => pe3, ValuesSchema: () => ue3, VerboseConfig: () => j, WalkerOSSchemas: () => A, configJsonSchema: () => Ni, consentJsonSchema: () => le3, contractJsonSchema: () => Zi, contractRuleJsonSchema: () => _i, createArraySchema: () => gn, createConsentConfig: () => F2, createDataTransformationConfig: () => R2, createEnumSchema: () => hn, createMappingRulesConfig: () => M2, createObjectSchema: () => mn, createPolicyConfig: () => T2, createTupleSchema: () => bn, destinationJsonSchema: () => Ui, entityJsonSchema: () => se3, eventJsonSchema: () => ie2, flowConfigJsonSchema: () => Wi, flowJsonSchema: () => Ai, loopJsonSchema: () => xe3, mapJsonSchema: () => Ee3, orderedPropertiesJsonSchema: () => ae3, parseConfig: () => zi, parseFlow: () => $i, partialEventJsonSchema: () => ne3, policyJsonSchema: () => Pe3, propertiesJsonSchema: () => re3, ruleJsonSchema: () => De3, rulesJsonSchema: () => Ie3, safeParseConfig: () => Li, safeParseFlow: () => qi, setJsonSchema: () => je3, sourceJsonSchema: () => Bi, sourceTypeJsonSchema: () => ce3, storeJsonSchema: () => Hi, transformerJsonSchema: () => Vi, userJsonSchema: () => oe2, validateEventsJsonSchema: () => Ki, validateFlowConfig: () => nn2, validateJsonSchema: () => Gi, valueConfigJsonSchema: () => Ce3, valueJsonSchema: () => ke3, z: () => n3, zodToSchema: () => vn });
1809
+ i = {};
1810
+ t3(i, { BaseContextConfig: () => L, CacheRuleSchema: () => Xe, CacheSchema: () => Ye, CacheSchemas: () => _e3, ClickIdEntrySchema: () => on2, CodeSchema: () => en, CollectorSchemas: () => Et2, ConsentSchema: () => Z3, ContractActionsSchema: () => Ji, ContractRuleSchema: () => Mi, ContractSchema: () => Ti, ContractSchemaEntry: () => Oi, Counter: () => d, DeepPartialEventSchema: () => te2, DestinationSchemas: () => Re, DestinationsMapConfig: () => N, EntitiesSchema: () => X3, EntitySchema: () => Q3, EventCacheRuleSchema: () => Ze2, EventCacheSchema: () => Ge2, EventSchema: () => Y2, FlowBundlePackageSchema: () => hi, FlowBundleSchema: () => bi, FlowCodeSchema: () => vi, FlowConfigSchema: () => Fi, FlowDestinationSchema: () => Di, FlowJsonSchema: () => Li, FlowSchema: () => zi, FlowSchemas: () => ui, FlowSourceSchema: () => ji, FlowStoreSchema: () => Ii, FlowTransformerSchema: () => Ei, GenericEnvConfig: () => J2, GenericSettingsConfig: () => O, HandlersConfig: () => x, HintSchema: () => tn, HintsSchema: () => nn2, IdConfig: () => E2, Identifier: () => c, InitConfig: () => D2, LoggerConfigSchema: () => tt2, LoggerHandlerSchema: () => et2, LoopSchema: () => me3, MapSchema: () => ge3, MappingResultSchema: () => ke2, MappingSchemas: () => de3, MatchExpressionSchema: () => ze2, MatcherSchemas: () => Me2, OptionalPrimitiveValue: () => u3, OrderedPropertiesSchema: () => H, PartialEventSchema: () => ee3, PolicySchema: () => be3, PrimaryConfig: () => I2, PrimitiveValue: () => p, ProcessingControlConfig: () => $, PropertiesSchema: () => V2, PropertySchema: () => U2, PropertyTypeSchema: () => B2, QueueConfig: () => j, RequiredBoolean: () => s4, RequiredNumber: () => a3, RequiredString: () => r3, RouteSchema: () => We3, RouteWithoutManySchema: () => He3, RuleSchema: () => Se2, RulesSchema: () => ye3, RuntimeInstanceConfig: () => z2, SetSchema: () => fe3, SourceSchema: () => K2, SourceSchemas: () => Wt, SourceTypeSchema: () => _, SourcesMapConfig: () => q2, StoreCacheRuleSchema: () => Ke, StoreCacheSchema: () => Qe, StoreSchemas: () => si, Timestamp: () => l, TransformerSchemas: () => ii, UserSchema: () => G2, UtilitySchemas: () => m2, ValidateEventsSchema: () => Ci, ValidateSchema: () => xi, ValueConfigSchema: () => he3, ValueSchema: () => pe3, ValuesSchema: () => ue3, VerboseConfig: () => P2, WalkerOSSchemas: () => A, configJsonSchema: () => Wi, consentJsonSchema: () => le3, contractJsonSchema: () => Ki, contractRuleJsonSchema: () => Gi, createArraySchema: () => bn, createConsentConfig: () => F2, createDataTransformationConfig: () => R2, createEnumSchema: () => vn, createMappingRulesConfig: () => M2, createObjectSchema: () => gn, createPolicyConfig: () => T2, createTupleSchema: () => Sn, destinationJsonSchema: () => Hi, entityJsonSchema: () => se3, eventJsonSchema: () => ie3, flowConfigJsonSchema: () => Ui, flowJsonSchema: () => Bi, loopJsonSchema: () => Pe3, mapJsonSchema: () => Ee3, orderedPropertiesJsonSchema: () => ae2, parseConfig: () => $i, parseFlow: () => Ni, partialEventJsonSchema: () => ne3, policyJsonSchema: () => De3, propertiesJsonSchema: () => re3, ruleJsonSchema: () => Ie3, rulesJsonSchema: () => Oe2, safeParseConfig: () => qi, safeParseFlow: () => Ai, setJsonSchema: () => je3, sourceJsonSchema: () => Vi, sourceTypeJsonSchema: () => ce3, storeJsonSchema: () => Zi, transformerJsonSchema: () => _i, userJsonSchema: () => oe2, validateEventsJsonSchema: () => Xi, validateFlowConfig: () => rn2, validateJsonSchema: () => Qi, valueConfigJsonSchema: () => xe3, valueJsonSchema: () => Ce3, z: () => n3, zodToSchema: () => yn });
1783
1811
  r3 = n3.string();
1784
- a2 = n3.number();
1812
+ a3 = n3.number();
1785
1813
  s4 = n3.boolean();
1786
1814
  c = n3.string().min(1);
1787
1815
  l = n3.number().int().positive();
@@ -1801,9 +1829,9 @@ var init_dev = __esm({
1801
1829
  k = o2(b2);
1802
1830
  C2 = o2(v2);
1803
1831
  x = n3.object({ onError: h2.optional().describe("Error handler function: (error, state?) => void"), onLog: b2.optional().describe("Log handler function: (message, verbose?) => void") }).partial();
1804
- j = n3.object({ verbose: n3.boolean().describe("Enable verbose logging for debugging").optional() }).partial();
1805
- E2 = n3.object({ queue: n3.boolean().describe("Whether to queue events when consent is not granted").optional() }).partial();
1806
- P2 = n3.object({}).partial();
1832
+ P2 = n3.object({ verbose: n3.boolean().describe("Enable verbose logging for debugging").optional() }).partial();
1833
+ j = n3.object({ queue: n3.boolean().describe("Whether to queue events when consent is not granted").optional() }).partial();
1834
+ E2 = n3.object({}).partial();
1807
1835
  D2 = n3.object({ init: n3.boolean().describe("Whether to initialize immediately").optional(), loadScript: n3.boolean().describe("Whether to load external script (for web destinations)").optional() }).partial();
1808
1836
  I2 = n3.object({ primary: n3.boolean().describe("Mark as primary (only one can be primary)").optional() }).partial();
1809
1837
  O = n3.object({ settings: n3.any().optional().describe("Implementation-specific configuration") }).partial();
@@ -1814,7 +1842,7 @@ var init_dev = __esm({
1814
1842
  q2 = n3.object({ sources: n3.record(n3.string(), n3.unknown()).describe("Map of source instances") }).partial();
1815
1843
  N = n3.object({ destinations: n3.record(n3.string(), n3.unknown()).describe("Map of destination instances") }).partial();
1816
1844
  A = {};
1817
- t3(A, { ConsentSchema: () => Z3, DeepPartialEventSchema: () => te2, EntitiesSchema: () => X3, EntitySchema: () => Q3, EventSchema: () => Y2, OrderedPropertiesSchema: () => H, PartialEventSchema: () => ee3, PropertiesSchema: () => V2, PropertySchema: () => U2, PropertyTypeSchema: () => B2, SourceSchema: () => K2, SourceTypeSchema: () => _, UserSchema: () => G2, consentJsonSchema: () => le3, entityJsonSchema: () => se3, eventJsonSchema: () => ie2, orderedPropertiesJsonSchema: () => ae3, partialEventJsonSchema: () => ne3, propertiesJsonSchema: () => re3, sourceTypeJsonSchema: () => ce3, userJsonSchema: () => oe2 });
1845
+ t3(A, { ConsentSchema: () => Z3, DeepPartialEventSchema: () => te2, EntitiesSchema: () => X3, EntitySchema: () => Q3, EventSchema: () => Y2, OrderedPropertiesSchema: () => H, PartialEventSchema: () => ee3, PropertiesSchema: () => V2, PropertySchema: () => U2, PropertyTypeSchema: () => B2, SourceSchema: () => K2, SourceTypeSchema: () => _, UserSchema: () => G2, consentJsonSchema: () => le3, entityJsonSchema: () => se3, eventJsonSchema: () => ie3, orderedPropertiesJsonSchema: () => ae2, partialEventJsonSchema: () => ne3, propertiesJsonSchema: () => re3, sourceTypeJsonSchema: () => ce3, userJsonSchema: () => oe2 });
1818
1846
  B2 = n3.lazy(() => n3.union([n3.boolean(), n3.string(), n3.number(), n3.record(n3.string(), U2)])).meta({ id: "WalkerOSPropertyType", title: "WalkerOS.PropertyType", description: "Base property value types (boolean, string, number, or nested Property record)." });
1819
1847
  U2 = n3.lazy(() => n3.union([B2, n3.array(B2)])).meta({ id: "WalkerOSProperty", title: "WalkerOS.Property", description: "PropertyType or an array of PropertyType. Recursive structure for nested objects and arrays." });
1820
1848
  V2 = n3.record(n3.string(), U2.optional()).meta({ id: "WalkerOSProperties", title: "WalkerOS.Properties", description: "Flexible property collection with optional values." }).describe("Flexible property collection with optional values");
@@ -1825,180 +1853,181 @@ var init_dev = __esm({
1825
1853
  K2 = V2.and(n3.object({ type: n3.string().describe("Source kind (browser, dataLayer, gtag, ...)"), platform: n3.string().optional().describe("Runtime platform (web, server, app, ios, android, terminal, ...)"), version: n3.string().optional().describe("Deployment version of the source emitter"), schema: n3.string().optional().describe('Event model spec version (collector defaults to "4")'), count: n3.number().int().nonnegative().optional().describe("Emission sequence per run"), trace: n3.string().optional().describe("W3C traceparent full string"), url: n3.string().optional(), referrer: n3.string().optional(), tool: n3.string().optional(), command: n3.string().optional() })).meta({ id: "WalkerOSSource", title: "WalkerOS.Source", description: "Event source information (origin of the event)." }).describe("Event source information");
1826
1854
  Q3 = n3.lazy(() => n3.object({ entity: n3.string().describe("Entity name"), data: V2.describe("Entity-specific properties"), nested: n3.array(Q3).optional().describe("Nested child entities"), context: H.optional().describe("Entity context data") })).meta({ id: "WalkerOSEntity", title: "WalkerOS.Entity", description: "Nested entity structure with recursive nesting support." }).describe("Nested entity structure with recursive nesting support");
1827
1855
  X3 = n3.array(Q3).meta({ id: "WalkerOSEntities", title: "WalkerOS.Entities", description: "Array of nested entities." }).describe("Array of nested entities");
1828
- Y2 = n3.object({ name: n3.string().describe('Event name in "entity action" format (e.g., "page view", "product add")'), data: V2.describe("Event-specific properties"), context: H.describe("Ordered context properties with priorities"), globals: V2.describe("Global properties shared across events"), custom: V2.describe("Custom implementation-specific properties"), user: G2.describe("User identification and attributes"), nested: X3.describe("Related nested entities"), consent: Z3.describe("Consent states at event time"), id: c.describe("W3C span_id, 16 lowercase hex characters"), trigger: r3.describe("Event trigger identifier"), entity: r3.describe("Parsed entity from event name"), action: r3.describe("Parsed action from event name"), timestamp: l.describe("Unix timestamp in milliseconds since epoch"), timing: a2.describe("Event processing timing information"), source: K2.describe("Event source information") }).meta({ id: "WalkerOSEvent", title: "WalkerOS.Event", description: "Complete walkerOS event structure." }).describe("Complete walkerOS event structure");
1856
+ Y2 = n3.object({ name: n3.string().describe('Event name in "entity action" format (e.g., "page view", "product add")'), data: V2.describe("Event-specific properties"), context: H.describe("Ordered context properties with priorities"), globals: V2.describe("Global properties shared across events"), custom: V2.describe("Custom implementation-specific properties"), user: G2.describe("User identification and attributes"), nested: X3.describe("Related nested entities"), consent: Z3.describe("Consent states at event time"), id: c.describe("W3C span_id, 16 lowercase hex characters"), trigger: r3.describe("Event trigger identifier"), entity: r3.describe("Parsed entity from event name"), action: r3.describe("Parsed action from event name"), timestamp: l.describe("Unix timestamp in milliseconds since epoch"), timing: a3.describe("Event processing timing information"), source: K2.describe("Event source information") }).meta({ id: "WalkerOSEvent", title: "WalkerOS.Event", description: "Complete walkerOS event structure." }).describe("Complete walkerOS event structure");
1829
1857
  ee3 = Y2.partial().meta({ id: "WalkerOSPartialEvent", title: "WalkerOS.PartialEvent", description: "Partial event structure with all fields optional." }).describe("Partial event structure with all fields optional");
1830
1858
  te2 = Y2.partial().meta({ id: "WalkerOSDeepPartialEvent", title: "WalkerOS.DeepPartialEvent", description: "Partial event structure with all top-level fields optional." }).describe("Partial event structure with all top-level fields optional");
1831
- ie2 = o2(Y2);
1859
+ ie3 = o2(Y2);
1832
1860
  ne3 = o2(ee3);
1833
1861
  oe2 = o2(G2);
1834
1862
  re3 = o2(V2);
1835
- ae3 = o2(H);
1863
+ ae2 = o2(H);
1836
1864
  se3 = o2(Q3);
1837
1865
  ce3 = o2(_);
1838
1866
  le3 = o2(Z3);
1839
1867
  de3 = {};
1840
- t3(de3, { ConfigSchema: () => ye3, LoopSchema: () => me3, MapSchema: () => ge3, PolicySchema: () => be2, ResultSchema: () => we2, RuleSchema: () => ve3, RulesSchema: () => Se3, SetSchema: () => fe3, ValueConfigSchema: () => he2, ValueSchema: () => pe3, ValuesSchema: () => ue3, configJsonSchema: () => Oe2, loopJsonSchema: () => xe3, mapJsonSchema: () => Ee3, policyJsonSchema: () => Pe3, ruleJsonSchema: () => De3, rulesJsonSchema: () => Ie3, setJsonSchema: () => je3, valueConfigJsonSchema: () => Ce3, valueJsonSchema: () => ke3 });
1868
+ t3(de3, { ConfigSchema: () => we2, LoopSchema: () => me3, MapSchema: () => ge3, PolicySchema: () => be3, ResultSchema: () => ke2, RulePatchSchema: () => ve2, RuleSchema: () => Se2, RulesSchema: () => ye3, SetSchema: () => fe3, ValueConfigSchema: () => he3, ValueSchema: () => pe3, ValuesSchema: () => ue3, configJsonSchema: () => Je2, loopJsonSchema: () => Pe3, mapJsonSchema: () => Ee3, policyJsonSchema: () => De3, ruleJsonSchema: () => Ie3, rulesJsonSchema: () => Oe2, setJsonSchema: () => je3, valueConfigJsonSchema: () => xe3, valueJsonSchema: () => Ce3 });
1841
1869
  pe3 = n3.lazy(() => n3.union([n3.string().describe('String value or property path (e.g., "data.id")'), n3.number().describe("Numeric value"), n3.boolean().describe("Boolean value"), n3.lazy(() => W), n3.array(pe3).describe("Array of values")])).meta({ id: "MappingValue", title: "Mapping.Value", description: "Polymorphic transform primitive used in every mapping field. A string path, constant, operator object (map/loop/set/condition/consent), or array of values." });
1842
1870
  ue3 = n3.array(pe3).meta({ id: "MappingValues", title: "Mapping.Values", description: "Array of transformation values." }).describe("Array of transformation values");
1843
1871
  me3 = n3.lazy(() => n3.tuple([pe3, pe3]).describe("Loop transformation: [source, transform] tuple for array processing")).meta({ id: "MappingLoop", title: "Mapping.Loop", description: "Loop tuple [source, transform] for iterating and transforming arrays." });
1844
1872
  fe3 = n3.lazy(() => n3.array(pe3).describe("Set: Array of values for selection or combination")).meta({ id: "MappingSet", title: "Mapping.Set", description: "Set: array of values for selection or combination." });
1845
1873
  ge3 = n3.lazy(() => n3.record(n3.string(), pe3).describe("Map: Object mapping keys to transformation values")).meta({ id: "MappingMap", title: "Mapping.Map", description: "Map: object mapping keys to transformation values." });
1846
- he2 = W = n3.object({ key: n3.string().optional().describe('Property path to extract from event (e.g., "data.id", "user.email")'), value: n3.union([n3.string(), n3.number(), n3.boolean()]).optional().describe("Static primitive value"), fn: n3.string().optional().describe("Custom transformation function as string (serialized)"), map: ge3.optional().describe("Object mapping: transform event data to structured output"), loop: me3.optional().describe("Loop transformation: [source, transform] for array processing"), set: fe3.optional().describe("Set of values: combine or select from multiple values"), consent: Z3.optional().describe("Required consent states to include this value"), condition: n3.string().optional().describe("Condition function as string: return true to include value"), validate: n3.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" }).meta({ id: "MappingValueConfig", title: "Mapping.ValueConfig", description: "Object-form value transformation with map/loop/set/condition/consent etc." }).describe("Value transformation configuration with multiple strategies");
1847
- be2 = n3.record(n3.string(), pe3).meta({ id: "MappingPolicy", title: "Mapping.Policy", description: "Policy rules for event pre-processing (key \u2192 value transformation)." }).describe("Policy rules for event pre-processing (key \u2192 value mapping)");
1848
- ve3 = n3.object({ name: n3.string().optional().describe('Custom event name override (e.g., "view_item" for "product view")'), data: n3.union([pe3, ue3]).optional().describe("Data transformation rules for event"), settings: n3.any().optional().describe("Destination-specific settings for this event mapping"), condition: n3.string().optional().describe("Condition function as string: return true to process event"), consent: Z3.optional().describe("Required consent states to process this event"), policy: be2.optional().describe("Event-level policy overrides (applied after config-level policy)"), batch: n3.union([n3.number(), n3.object({ wait: n3.number().optional(), size: n3.number().optional(), age: n3.number().optional() })]).optional().describe("Batch scheduling: bare number is the debounce wait window (legacy); object form supports wait/size/age."), include: n3.array(n3.string()).optional().describe('Event sections (e.g. ["context", "globals"]) flattened into context.data'), ignore: n3.boolean().optional().describe("Skip the event entirely. No push, no side effects. Use for suppression."), silent: n3.boolean().optional().describe("Run side effects (settings.identify, ...) but suppress the destination default push call.") }).meta({ id: "MappingRule", title: "Mapping.Rule", description: "Configuration for transforming a single event at one stage of the flow (source or destination)." }).describe("Mapping rule for specific entity-action combination");
1849
- Se3 = n3.record(n3.string(), n3.record(n3.string(), n3.union([ve3, n3.array(ve3)])).optional()).meta({ id: "MappingRules", title: "Mapping.Rules", description: 'Event mapping rules tree: entity \u2192 action \u2192 Rule (or Rule[]). Use "*" as wildcard for entity or action.' }).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*).');
1850
- ye3 = n3.object({ consent: Z3.optional().describe("Required consent states to process any events"), data: n3.union([pe3, ue3]).optional().describe("Global data transformation applied to all events"), include: n3.array(n3.string()).optional().describe("Event sections to flatten into context.data"), mapping: Se3.optional().describe("Entity-action specific mapping rules"), policy: be2.optional().describe("Pre-processing policy rules applied before mapping") }).meta({ id: "MappingConfig", title: "Mapping.Config", description: "Shared mapping configuration (consent, data, include, mapping, policy)." }).describe("Shared mapping configuration for sources and destinations");
1851
- we2 = n3.object({ eventMapping: ve3.optional().describe("Resolved mapping rule for event"), mappingKey: n3.string().optional().describe('Mapping key used (e.g., "product.view")') }).meta({ id: "MappingResult", title: "Mapping.Result", description: "Mapping resolution result (matched rule + key)." }).describe("Mapping resolution result");
1852
- ke3 = o2(pe3);
1853
- Ce3 = o2(he2);
1854
- xe3 = o2(me3);
1874
+ he3 = W = n3.object({ key: n3.string().optional().describe('Property path to extract from event (e.g., "data.id", "user.email")'), value: n3.union([n3.string(), n3.number(), n3.boolean()]).optional().describe("Static primitive value"), fn: n3.string().optional().describe("Custom transformation function as string (serialized)"), map: ge3.optional().describe("Object mapping: transform event data to structured output"), loop: me3.optional().describe("Loop transformation: [source, transform] for array processing"), set: fe3.optional().describe("Set of values: combine or select from multiple values"), consent: Z3.optional().describe("Required consent states to include this value"), condition: n3.string().optional().describe("Condition function as string: return true to include value"), validate: n3.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" }).meta({ id: "MappingValueConfig", title: "Mapping.ValueConfig", description: "Object-form value transformation with map/loop/set/condition/consent etc." }).describe("Value transformation configuration with multiple strategies");
1875
+ be3 = n3.record(n3.string(), pe3).meta({ id: "MappingPolicy", title: "Mapping.Policy", description: "Policy rules for event pre-processing (key \u2192 value transformation)." }).describe("Policy rules for event pre-processing (key \u2192 value mapping)");
1876
+ ve2 = n3.object({ name: n3.string().nullable().optional(), data: n3.union([pe3, ue3]).nullable().optional(), settings: n3.unknown().nullable().optional(), condition: n3.string().nullable().optional(), consent: Z3.nullable().optional(), policy: be3.nullable().optional(), batch: n3.union([n3.number(), n3.object({ wait: n3.number().optional(), size: n3.number().optional(), age: n3.number().optional() })]).nullable().optional(), include: n3.array(n3.string()).nullable().optional(), ignore: n3.boolean().nullable().optional(), silent: n3.boolean().nullable().optional() }).meta({ id: "MappingRulePatch", title: "Mapping.RulePatch", description: "Partial rule deep-merged onto a package-shipped default; a null value clears the inherited field." }).describe("Partial rule for `extend`; null clears an inherited field");
1877
+ Se2 = n3.object({ name: n3.string().optional().describe('Custom event name override (e.g., "view_item" for "product view")'), data: n3.union([pe3, ue3]).optional().describe("Data transformation rules for event"), settings: n3.unknown().optional().describe("Destination-specific settings for this event mapping"), condition: n3.string().optional().describe("Condition function as string: return true to process event"), consent: Z3.optional().describe("Required consent states to process this event"), policy: be3.optional().describe("Event-level policy overrides (applied after config-level policy)"), batch: n3.union([n3.number(), n3.object({ wait: n3.number().optional(), size: n3.number().optional(), age: n3.number().optional() })]).optional().describe("Batch scheduling: bare number is the debounce wait window (legacy); object form supports wait/size/age."), include: n3.array(n3.string()).optional().describe('Event sections (e.g. ["context", "globals"]) flattened into context.data'), ignore: n3.boolean().optional().describe("Skip the event entirely. No push, no side effects. Use for suppression."), silent: n3.boolean().optional().describe("Run side effects (settings.identify, ...) but suppress the destination default push call."), extend: ve2.optional().describe("Merge mode: a partial rule deep-merged onto the package-shipped default at this key (instead of replacing it). A null value clears an inherited field."), remove: n3.array(n3.string()).optional().describe("Dotted paths stripped from the produced data payload after evaluation (applied last).") }).meta({ id: "MappingRule", title: "Mapping.Rule", description: "Configuration for transforming a single event at one stage of the flow (source or destination)." }).describe("Mapping rule for specific entity-action combination");
1878
+ ye3 = n3.record(n3.string(), n3.record(n3.string(), n3.union([Se2, n3.array(Se2)])).optional()).meta({ id: "MappingRules", title: "Mapping.Rules", description: 'Event mapping rules tree: entity \u2192 action \u2192 Rule (or Rule[]). Use "*" as wildcard for entity or action.' }).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*).');
1879
+ we2 = n3.object({ consent: Z3.optional().describe("Required consent states to process any events"), data: n3.union([pe3, ue3]).optional().describe("Global data transformation applied to all events"), include: n3.array(n3.string()).optional().describe("Event sections to flatten into context.data"), mapping: ye3.optional().describe("Entity-action specific mapping rules"), policy: be3.optional().describe("Pre-processing policy rules applied before mapping") }).meta({ id: "MappingConfig", title: "Mapping.Config", description: "Shared mapping configuration (consent, data, include, mapping, policy)." }).describe("Shared mapping configuration for sources and destinations");
1880
+ ke2 = n3.object({ eventMapping: Se2.optional().describe("Resolved mapping rule for event"), mappingKey: n3.string().optional().describe('Mapping key used (e.g., "product.view")') }).meta({ id: "MappingResult", title: "Mapping.Result", description: "Mapping resolution result (matched rule + key)." }).describe("Mapping resolution result");
1881
+ Ce3 = o2(pe3);
1882
+ xe3 = o2(he3);
1883
+ Pe3 = o2(me3);
1855
1884
  je3 = o2(fe3);
1856
1885
  Ee3 = o2(ge3);
1857
- Pe3 = o2(be2);
1858
- De3 = o2(ve3);
1859
- Ie3 = o2(Se3);
1886
+ De3 = o2(be3);
1887
+ Ie3 = o2(Se2);
1860
1888
  Oe2 = o2(ye3);
1861
- Je2 = {};
1862
- t3(Je2, { BatchSchema: () => lt, ConfigSchema: () => tt2, ContextSchema: () => ot, DLQSchema: () => vt, DataSchema: () => dt2, DestinationPolicySchema: () => nt, DestinationsSchema: () => ft, InitDestinationsSchema: () => mt2, InitSchema: () => ut, InstanceSchema: () => pt2, PartialConfigSchema: () => it, PushBatchContextSchema: () => at, PushContextSchema: () => rt, PushEventSchema: () => st, PushEventsSchema: () => ct, PushResultSchema: () => ht, RefSchema: () => gt2, ResultSchema: () => bt2, batchJsonSchema: () => Ct2, configJsonSchema: () => St2, contextJsonSchema: () => wt2, instanceJsonSchema: () => xt2, partialConfigJsonSchema: () => yt, pushContextJsonSchema: () => kt2, resultJsonSchema: () => jt2 });
1863
- Re2 = {};
1864
- t3(Re2, { MatchExpressionSchema: () => Fe3, RouteSchema: () => Ae2, RouteWithoutManySchema: () => Ve });
1865
- Me = n3.enum(["eq", "contains", "prefix", "suffix", "regex", "gt", "lt", "exists"]).meta({ id: "MatcherOperator", title: "Matcher.Operator", description: "Supported operators for a match condition." });
1866
- Te2 = n3.object({ key: n3.string(), operator: Me, value: n3.string(), not: n3.boolean().optional() }).meta({ id: "MatcherCondition", title: "Matcher.Condition", description: "Single match condition (key, operator, value, optional not)." });
1867
- Fe3 = n3.union([Te2, n3.object({ and: n3.array(n3.lazy(() => Fe3)) }), n3.object({ or: n3.array(n3.lazy(() => Fe3)) })]).meta({ id: "MatcherExpression", title: "Matcher.Expression", description: "Boolean expression tree of match conditions (leaf, and, or)." });
1868
- ze2 = n3.strictObject({ match: Fe3.optional(), next: n3.lazy(() => Ae2) });
1869
- Le2 = n3.strictObject({ match: Fe3.optional(), one: n3.array(n3.lazy(() => Ae2)) });
1870
- $e3 = n3.strictObject({ match: Fe3.optional(), many: n3.array(n3.lazy(() => Ae2)) });
1871
- qe2 = n3.strictObject({ match: Fe3 });
1872
- Ne2 = n3.union([ze2, Le2, $e3, qe2]);
1873
- Ae2 = n3.union([n3.string(), n3.array(n3.lazy(() => Ae2)), Ne2]).meta({ id: "Route", title: "Route", description: "Recursive route: string ID, sequence of routes, or a RouteConfig (next/one/many/gate)." });
1874
- We3 = n3.strictObject({ match: Fe3.optional(), next: n3.lazy(() => Ve) });
1875
- Be = n3.strictObject({ match: Fe3.optional(), one: n3.array(n3.lazy(() => Ve)) });
1876
- Ue2 = n3.union([We3, Be, qe2]);
1877
- Ve = n3.union([n3.string(), n3.array(n3.lazy(() => Ve)), Ue2]).meta({ id: "RouteWithoutMany", title: "RouteWithoutMany", description: "Route variant for post-collector positions (destination.before). Excludes the many operator \u2014 post-collector fan-out uses the destinations map." });
1878
- He3 = {};
1879
- t3(He3, { CacheRuleSchema: () => Qe, CacheSchema: () => Xe2, EventCacheRuleSchema: () => _e2, EventCacheSchema: () => Ze2, StoreCacheRuleSchema: () => Ge2, StoreCacheSchema: () => Ke });
1880
- _e2 = n3.object({ match: Fe3.optional().describe("Optional match expression \u2014 omit for always-match."), key: n3.array(n3.string()).min(1).describe("Dot-path fields used to build the cache key"), ttl: n3.number().positive().describe("Time-to-live in seconds"), update: n3.record(n3.string(), pe3).optional().describe("Response mutations applied on cache hit (key \u2192 Value mapping)") }).meta({ id: "EventCacheRule", title: "EventCache.Rule", description: "Single event-cache rule: when it applies (match), what event fields it keys off, TTL, and optional response mutations on hit." });
1881
- Ze2 = n3.object({ stop: n3.boolean().optional().describe("Stop the chain on cache HIT (default: false). When true, skip remaining steps and return cached value."), store: n3.string().optional().describe("Store ID for persistent caching (references a configured store)"), namespace: n3.string().optional().describe("Optional key prefix. Omit to write keys directly to the store. Same store + same key + same namespace = same cache entry."), rules: n3.array(_e2).min(1).describe("Cache rules \u2014 at least one required") }).meta({ id: "EventCacheConfig", title: "EventCache.Config", description: "Top-level cache configuration for an event-context pipeline step (source / transformer / destination)." });
1882
- Ge2 = n3.strictObject({ match: Fe3.optional().describe("Optional match expression evaluated against `{ key, value? }`. Omit for always-match."), ttl: n3.number().positive().describe("Time-to-live in seconds") }).meta({ id: "StoreCacheRule", title: "StoreCache.Rule", description: "Single store-cache rule: optional match against `{ key, value? }` and a TTL. No `key` (caller provides it) and no `update` (no event to mutate)." });
1883
- Ke = n3.strictObject({ store: n3.string().optional().describe("Store ID for persistent caching (references a configured store)"), namespace: n3.string().min(1).optional().describe("Optional key prefix. Omit to default to the host store id. Empty string is rejected."), rules: n3.array(Ge2).min(1).describe("Cache rules \u2014 at least one required") }).meta({ id: "StoreCacheConfig", title: "StoreCache.Config", description: "Top-level cache configuration for a store wrapper. No `stop` (always falls through on miss); namespace defaults to the host store id." });
1884
- Qe = _e2;
1885
- Xe2 = Ze2;
1886
- Ye2 = n3.any().meta({ id: "LoggerHandler", title: "Logger.Handler", description: "Custom log handler function (level, ...args) => void" });
1887
- et = n3.object({ level: n3.union([n3.number(), n3.enum(["ERROR", "WARN", "INFO", "DEBUG"])]).optional().describe("Minimum log level (default: ERROR)"), handler: Ye2.optional().describe("Custom log handler function") }).meta({ id: "LoggerConfig", title: "Logger.Config", description: "Logger configuration (level, handler) to override the collector defaults" });
1888
- tt2 = n3.object({ consent: Z3.optional().describe("Required consent states to send events to this destination"), settings: n3.any().meta({ id: "DestinationSettings", title: "Destination.Settings", description: "Implementation-specific configuration (destination-defined shape)." }).describe("Implementation-specific configuration").optional(), data: n3.union([pe3, ue3]).optional().describe("Global data transformation applied to all events for this destination"), include: n3.array(n3.string()).optional().describe("Event sections to flatten into context.data"), env: n3.any().meta({ id: "DestinationEnv", title: "Destination.Env", description: "Environment dependencies (destination-defined shape) \u2014 platform, SDK, or mock hook." }).describe("Environment dependencies (platform-specific)").optional(), id: c.describe("Destination instance identifier (defaults to destination key)").optional(), init: n3.boolean().describe("Whether to initialize immediately").optional(), loadScript: n3.boolean().describe("Whether to load external script (for web destinations)").optional(), mapping: Se3.optional().describe("Entity-action specific mapping rules for this destination"), policy: be2.optional().describe("Pre-processing policy rules applied before event mapping"), queue: n3.boolean().describe("Whether to queue events when consent is not granted").optional(), require: n3.array(n3.string()).optional().describe('Defer destination initialization until these collector events fire (e.g., ["consent"])'), logger: et.optional().describe("Logger configuration (level, handler) to override the collector defaults"), setup: n3.union([n3.boolean(), n3.record(n3.string(), n3.unknown())]).optional().describe("One-time setup options applied during destination registration (boolean enables defaults, object configures specifics)"), before: Ve.optional().describe("Post-collector transformer chain applied before this destination receives the event. `many` is not valid here \u2014 use multiple destinations for post-collector fan-out."), next: Ve.optional().describe("Post-push transformer chain. Runs after destination push completes; push response is available at ingest._response. `many` is not valid here \u2014 use multiple destinations for post-collector fan-out."), cache: Ze2.optional().describe("Cache configuration for deduplication; skip push on cache HIT"), disabled: n3.boolean().describe("Completely skip this destination (no init, no push, no queue)").optional(), mock: n3.unknown().meta({ id: "DestinationMock", title: "Destination.Mock", description: "Return this value instead of calling push(). Dev/testing only." }).optional().describe("Return this value instead of calling push(). Dev/testing only."), queueMax: n3.number().optional().describe("Maximum consent-denied events retained in queuePush for this destination. FIFO drop on overflow. Default 1000."), dlqMax: n3.number().optional().describe("Maximum failed-push entries retained in dlq for this destination. FIFO drop on overflow. Default 100."), batch: n3.union([n3.number(), n3.object({ wait: n3.number().optional(), size: n3.number().optional(), age: n3.number().optional() })]).optional().describe("Batch scheduling: bare number is the debounce wait window (legacy); object form supports wait (debounce ms), size (count cap, default 1000), age (max ms since first entry, default 30000).") }).meta({ id: "DestinationConfig", title: "Destination.Config", description: "Destination configuration: consent, settings, data, env, mapping rules, policy, queue, logger, before/next chains, cache." }).describe("Destination configuration");
1889
- it = tt2.partial().meta({ id: "DestinationPartialConfig", title: "Destination.PartialConfig", description: "Partial destination configuration with all fields optional." }).describe("Partial destination configuration with all fields optional");
1890
- nt = be2.describe("Destination policy rules for event pre-processing");
1891
- ot = n3.object({ collector: n3.unknown().meta({ id: "DestinationContextCollector", title: "Collector.Instance", description: "Collector instance handed to the destination (runtime object)." }).describe("Collector instance (runtime object)"), config: tt2.describe("Destination configuration"), data: n3.union([n3.unknown(), n3.array(n3.unknown())]).optional().describe("Transformed event data"), env: n3.unknown().meta({ id: "DestinationContextEnv", title: "Destination.Env", description: "Environment dependencies (destination-defined shape)." }).describe("Environment dependencies") }).meta({ id: "DestinationContext", title: "Destination.Context", description: "Destination context passed to init and push functions." }).describe("Destination context for init and push functions");
1892
- rt = ot.extend({ mapping: ve3.optional().describe("Resolved mapping rule for this specific event") }).meta({ id: "DestinationPushContext", title: "Destination.PushContext", description: "Destination context for push() with the resolved event mapping rule." }).describe("Push context with event-specific mapping");
1893
- at = rt.describe("Batch push context with event-specific mapping");
1894
- st = n3.object({ event: Y2.describe("The event to process"), mapping: ve3.optional().describe("Mapping rule for this event") }).meta({ id: "DestinationPushEvent", title: "Destination.PushEvent", description: "Single event paired with its resolved mapping rule (batch element)." }).describe("Event with optional mapping for batch processing");
1895
- ct = n3.array(st).meta({ id: "DestinationPushEvents", title: "Destination.PushEvents", description: "Array of events with mappings (batch input)." }).describe("Array of events with mappings");
1896
- lt = n3.object({ key: n3.string().describe('Batch key (usually mapping key like "product.view")'), events: n3.array(Y2).describe("Array of events in batch"), data: n3.array(n3.union([n3.unknown(), n3.array(n3.unknown())]).optional()).describe("Transformed data for each event"), mapping: ve3.optional().describe("Shared mapping rule for batch") }).meta({ id: "DestinationBatch", title: "Destination.Batch", description: "Batch of events grouped by mapping key for batch delivery." }).describe("Batch of events grouped by mapping key");
1897
- dt2 = n3.union([n3.unknown(), n3.array(n3.unknown())]).meta({ id: "DestinationData", title: "Destination.Data", description: "Transformed event data delivered to the destination (Property, undefined, or array)." }).optional().describe("Transformed event data (Property, undefined, or array)");
1898
- pt2 = n3.object({ config: tt2.describe("Destination configuration"), queue: n3.array(Y2).optional().describe("Queued events awaiting consent"), dlq: n3.array(n3.tuple([Y2, n3.unknown()])).optional().describe("Dead letter queue (failed events with errors)"), type: n3.string().optional().describe("Destination type identifier"), env: n3.unknown().optional().describe("Environment dependencies"), init: n3.unknown().optional().describe("Initialization function"), push: n3.unknown().describe("Push function for single events"), pushBatch: n3.unknown().optional().describe("Batch push function"), on: n3.unknown().optional().describe("Event lifecycle hook function") }).meta({ id: "DestinationInstance", title: "Destination.Instance", description: "Destination instance (runtime object with init/push/pushBatch/on)." }).describe("Destination instance (runtime object with functions)");
1899
- ut = n3.object({ code: pt2.describe("Destination instance with implementation"), config: it.optional().describe("Partial configuration overrides"), env: n3.unknown().optional().describe("Partial environment overrides") }).meta({ id: "DestinationInit", title: "Destination.Init", description: "Destination initialization bundle (instance code + config + env)." }).describe("Destination initialization configuration");
1900
- mt2 = n3.record(n3.string(), ut).meta({ id: "DestinationInitDestinations", title: "Destination.InitDestinations", description: "Map of destination IDs to initialization configurations." }).describe("Map of destination IDs to initialization configurations");
1901
- ft = n3.record(n3.string(), pt2).meta({ id: "DestinationDestinations", title: "Destination.Destinations", description: "Map of destination IDs to runtime destination instances." }).describe("Map of destination IDs to runtime instances");
1902
- gt2 = n3.object({ type: n3.string().describe('Destination type ("gtag", "meta", "bigquery")'), data: n3.unknown().optional().describe("Response from push()"), error: n3.unknown().optional().describe("Error if failed") }).meta({ id: "DestinationRef", title: "Destination.Ref", description: "Reference to a destination outcome (type + response data or error)." }).describe("Destination reference with type and response data");
1903
- ht = n3.object({ queue: n3.array(Y2).optional().describe("Events queued (awaiting consent)"), error: n3.unknown().optional().describe("Error if push failed") }).meta({ id: "DestinationPushResult", title: "Destination.PushResult", description: "Result of a single destination push (queued events, optional error)." }).describe("Push operation result");
1904
- bt2 = n3.object({ ok: n3.boolean().describe("True if nothing failed"), event: n3.unknown().optional().describe("The processed event"), done: n3.record(n3.string(), gt2).optional().describe("Destinations that processed successfully"), queued: n3.record(n3.string(), gt2).optional().describe("Destinations that queued events"), failed: n3.record(n3.string(), gt2).optional().describe("Destinations that failed to process") }).meta({ id: "DestinationResult", title: "Destination.Result", description: "Overall push result aggregated across all destinations (done/queued/failed maps)." }).describe("Push result with destination outcomes");
1905
- vt = n3.array(n3.tuple([Y2, n3.unknown()])).meta({ id: "DestinationDLQ", title: "Destination.DLQ", description: "Dead-letter queue: list of [event, error] tuples." }).describe("Dead letter queue: [(event, error), ...]");
1906
- St2 = o2(tt2);
1907
- yt = o2(it);
1908
- wt2 = o2(ot);
1909
- kt2 = o2(rt);
1910
- Ct2 = o2(lt);
1911
- xt2 = o2(pt2);
1912
- jt2 = o2(bt2);
1889
+ Je2 = o2(we2);
1890
+ Re = {};
1891
+ t3(Re, { BatchSchema: () => dt, ConfigSchema: () => it, ContextSchema: () => rt, DLQSchema: () => St2, DataSchema: () => pt, DestinationPolicySchema: () => ot2, DestinationsSchema: () => gt2, InitDestinationsSchema: () => ft, InitSchema: () => mt, InstanceSchema: () => ut, PartialConfigSchema: () => nt, PushBatchContextSchema: () => st, PushContextSchema: () => at, PushEventSchema: () => ct, PushEventsSchema: () => lt, PushResultSchema: () => bt, RefSchema: () => ht2, ResultSchema: () => vt2, batchJsonSchema: () => xt2, configJsonSchema: () => yt2, contextJsonSchema: () => kt, instanceJsonSchema: () => Pt2, partialConfigJsonSchema: () => wt, pushContextJsonSchema: () => Ct2, resultJsonSchema: () => jt2 });
1892
+ Me2 = {};
1893
+ t3(Me2, { MatchExpressionSchema: () => ze2, RouteSchema: () => We3, RouteWithoutManySchema: () => He3 });
1894
+ Te2 = n3.enum(["eq", "contains", "prefix", "suffix", "regex", "gt", "lt", "exists"]).meta({ id: "MatcherOperator", title: "Matcher.Operator", description: "Supported operators for a match condition." });
1895
+ Fe3 = n3.object({ key: n3.string(), operator: Te2, value: n3.string(), not: n3.boolean().optional() }).meta({ id: "MatcherCondition", title: "Matcher.Condition", description: "Single match condition (key, operator, value, optional not)." });
1896
+ ze2 = n3.union([Fe3, n3.object({ and: n3.array(n3.lazy(() => ze2)) }), n3.object({ or: n3.array(n3.lazy(() => ze2)) })]).meta({ id: "MatcherExpression", title: "Matcher.Expression", description: "Boolean expression tree of match conditions (leaf, and, or)." });
1897
+ Le2 = n3.strictObject({ match: ze2.optional(), next: n3.lazy(() => We3) });
1898
+ $e3 = n3.strictObject({ match: ze2.optional(), one: n3.array(n3.lazy(() => We3)) });
1899
+ qe2 = n3.strictObject({ match: ze2.optional(), many: n3.array(n3.lazy(() => We3)) });
1900
+ Ne = n3.strictObject({ match: ze2 });
1901
+ Ae3 = n3.union([Le2, $e3, qe2, Ne]);
1902
+ We3 = n3.union([n3.string(), n3.array(n3.lazy(() => We3)), Ae3]).meta({ id: "Route", title: "Route", description: "Recursive route: string ID, sequence of routes, or a RouteConfig (next/one/many/gate)." });
1903
+ Be = n3.strictObject({ match: ze2.optional(), next: n3.lazy(() => He3) });
1904
+ Ue2 = n3.strictObject({ match: ze2.optional(), one: n3.array(n3.lazy(() => He3)) });
1905
+ Ve2 = n3.union([Be, Ue2, Ne]);
1906
+ He3 = n3.union([n3.string(), n3.array(n3.lazy(() => He3)), Ve2]).meta({ id: "RouteWithoutMany", title: "RouteWithoutMany", description: "Route variant for post-collector positions (destination.before). Excludes the many operator \u2014 post-collector fan-out uses the destinations map." });
1907
+ _e3 = {};
1908
+ t3(_e3, { CacheRuleSchema: () => Xe, CacheSchema: () => Ye, EventCacheRuleSchema: () => Ze2, EventCacheSchema: () => Ge2, StoreCacheRuleSchema: () => Ke, StoreCacheSchema: () => Qe });
1909
+ Ze2 = n3.object({ match: ze2.optional().describe("Optional match expression \u2014 omit for always-match."), key: n3.array(n3.string()).min(1).describe("Dot-path fields used to build the cache key"), ttl: n3.number().positive().describe("Time-to-live in seconds"), update: n3.record(n3.string(), pe3).optional().describe("Response mutations applied on cache hit (key \u2192 Value mapping)") }).meta({ id: "EventCacheRule", title: "EventCache.Rule", description: "Single event-cache rule: when it applies (match), what event fields it keys off, TTL, and optional response mutations on hit." });
1910
+ Ge2 = n3.object({ stop: n3.boolean().optional().describe("Stop the chain on cache HIT (default: false). When true, skip remaining steps and return cached value."), store: n3.string().optional().describe("Store ID for persistent caching (references a configured store)"), namespace: n3.string().optional().describe("Optional key prefix. Omit to write keys directly to the store. Same store + same key + same namespace = same cache entry."), rules: n3.array(Ze2).min(1).describe("Cache rules \u2014 at least one required") }).meta({ id: "EventCacheConfig", title: "EventCache.Config", description: "Top-level cache configuration for an event-context pipeline step (source / transformer / destination)." });
1911
+ Ke = n3.strictObject({ match: ze2.optional().describe("Optional match expression evaluated against `{ key, value? }`. Omit for always-match."), ttl: n3.number().positive().describe("Time-to-live in seconds") }).meta({ id: "StoreCacheRule", title: "StoreCache.Rule", description: "Single store-cache rule: optional match against `{ key, value? }` and a TTL. No `key` (caller provides it) and no `update` (no event to mutate)." });
1912
+ Qe = n3.strictObject({ store: n3.string().optional().describe("Store ID for persistent caching (references a configured store)"), namespace: n3.string().min(1).optional().describe("Optional key prefix. Omit to default to the host store id. Empty string is rejected."), rules: n3.array(Ke).min(1).describe("Cache rules \u2014 at least one required") }).meta({ id: "StoreCacheConfig", title: "StoreCache.Config", description: "Top-level cache configuration for a store wrapper. No `stop` (always falls through on miss); namespace defaults to the host store id." });
1913
+ Xe = Ze2;
1914
+ Ye = Ge2;
1915
+ et2 = n3.any().meta({ id: "LoggerHandler", title: "Logger.Handler", description: "Custom log handler function (level, ...args) => void" });
1916
+ tt2 = n3.object({ level: n3.union([n3.number(), n3.enum(["ERROR", "WARN", "INFO", "DEBUG"])]).optional().describe("Minimum log level (default: ERROR)"), handler: et2.optional().describe("Custom log handler function") }).meta({ id: "LoggerConfig", title: "Logger.Config", description: "Logger configuration (level, handler) to override the collector defaults" });
1917
+ it = n3.object({ consent: Z3.optional().describe("Required consent states to send events to this destination"), settings: n3.any().meta({ id: "DestinationSettings", title: "Destination.Settings", description: "Implementation-specific configuration (destination-defined shape)." }).describe("Implementation-specific configuration").optional(), data: n3.union([pe3, ue3]).optional().describe("Global data transformation applied to all events for this destination"), include: n3.array(n3.string()).optional().describe("Event sections to flatten into context.data"), env: n3.any().meta({ id: "DestinationEnv", title: "Destination.Env", description: "Environment dependencies (destination-defined shape) \u2014 platform, SDK, or mock hook." }).describe("Environment dependencies (platform-specific)").optional(), id: c.describe("Destination instance identifier (defaults to destination key)").optional(), init: n3.boolean().describe("Whether to initialize immediately").optional(), loadScript: n3.boolean().describe("Whether to load external script (for web destinations)").optional(), mapping: ye3.optional().describe("Entity-action specific mapping rules for this destination"), policy: be3.optional().describe("Pre-processing policy rules applied before event mapping"), queue: n3.boolean().describe("Whether to queue events when consent is not granted").optional(), require: n3.array(n3.string()).optional().describe('Defer destination initialization until these collector events fire (e.g., ["consent"])'), logger: tt2.optional().describe("Logger configuration (level, handler) to override the collector defaults"), setup: n3.union([n3.boolean(), n3.record(n3.string(), n3.unknown())]).optional().describe("One-time setup options applied during destination registration (boolean enables defaults, object configures specifics)"), before: He3.optional().describe("Post-collector transformer chain applied before this destination receives the event. `many` is not valid here \u2014 use multiple destinations for post-collector fan-out."), next: He3.optional().describe("Post-push transformer chain. Runs after destination push completes; push response is available at ingest._response. `many` is not valid here \u2014 use multiple destinations for post-collector fan-out."), cache: Ge2.optional().describe("Cache configuration for deduplication; skip push on cache HIT"), disabled: n3.boolean().describe("Completely skip this destination (no init, no push, no queue)").optional(), mock: n3.unknown().meta({ id: "DestinationMock", title: "Destination.Mock", description: "Return this value instead of calling push(). Dev/testing only." }).optional().describe("Return this value instead of calling push(). Dev/testing only."), queueMax: n3.number().optional().describe("Maximum consent-denied events retained in queuePush for this destination. FIFO drop on overflow. Default 1000."), dlqMax: n3.number().optional().describe("Maximum failed-push entries retained in dlq for this destination. FIFO drop on overflow. Default 100."), batch: n3.union([n3.number(), n3.object({ wait: n3.number().optional(), size: n3.number().optional(), age: n3.number().optional() })]).optional().describe("Batch scheduling: bare number is the debounce wait window (legacy); object form supports wait (debounce ms), size (count cap, default 1000), age (max ms since first entry, default 30000).") }).meta({ id: "DestinationConfig", title: "Destination.Config", description: "Destination configuration: consent, settings, data, env, mapping rules, policy, queue, logger, before/next chains, cache." }).describe("Destination configuration");
1918
+ nt = it.partial().meta({ id: "DestinationPartialConfig", title: "Destination.PartialConfig", description: "Partial destination configuration with all fields optional." }).describe("Partial destination configuration with all fields optional");
1919
+ ot2 = be3.describe("Destination policy rules for event pre-processing");
1920
+ rt = n3.object({ collector: n3.unknown().meta({ id: "DestinationContextCollector", title: "Collector.Instance", description: "Collector instance handed to the destination (runtime object)." }).describe("Collector instance (runtime object)"), config: it.describe("Destination configuration"), data: n3.union([n3.unknown(), n3.array(n3.unknown())]).optional().describe("Transformed event data"), env: n3.unknown().meta({ id: "DestinationContextEnv", title: "Destination.Env", description: "Environment dependencies (destination-defined shape)." }).describe("Environment dependencies") }).meta({ id: "DestinationContext", title: "Destination.Context", description: "Destination context passed to init and push functions." }).describe("Destination context for init and push functions");
1921
+ at = rt.extend({ mapping: Se2.optional().describe("Resolved mapping rule for this specific event") }).meta({ id: "DestinationPushContext", title: "Destination.PushContext", description: "Destination context for push() with the resolved event mapping rule." }).describe("Push context with event-specific mapping");
1922
+ st = at.describe("Batch push context with event-specific mapping");
1923
+ ct = n3.object({ event: Y2.describe("The event to process"), mapping: Se2.optional().describe("Mapping rule for this event") }).meta({ id: "DestinationPushEvent", title: "Destination.PushEvent", description: "Single event paired with its resolved mapping rule (batch element)." }).describe("Event with optional mapping for batch processing");
1924
+ lt = n3.array(ct).meta({ id: "DestinationPushEvents", title: "Destination.PushEvents", description: "Array of events with mappings (batch input)." }).describe("Array of events with mappings");
1925
+ dt = n3.object({ key: n3.string().describe('Batch key (usually mapping key like "product.view")'), events: n3.array(Y2).describe("Array of events in batch"), data: n3.array(n3.union([n3.unknown(), n3.array(n3.unknown())]).optional()).describe("Transformed data for each event"), mapping: Se2.optional().describe("Shared mapping rule for batch") }).meta({ id: "DestinationBatch", title: "Destination.Batch", description: "Batch of events grouped by mapping key for batch delivery." }).describe("Batch of events grouped by mapping key");
1926
+ pt = n3.union([n3.unknown(), n3.array(n3.unknown())]).meta({ id: "DestinationData", title: "Destination.Data", description: "Transformed event data delivered to the destination (Property, undefined, or array)." }).optional().describe("Transformed event data (Property, undefined, or array)");
1927
+ ut = n3.object({ config: it.describe("Destination configuration"), queue: n3.array(Y2).optional().describe("Queued events awaiting consent"), dlq: n3.array(n3.tuple([Y2, n3.unknown()])).optional().describe("Dead letter queue (failed events with errors)"), type: n3.string().optional().describe("Destination type identifier"), env: n3.unknown().optional().describe("Environment dependencies"), init: n3.unknown().optional().describe("Initialization function"), push: n3.unknown().describe("Push function for single events"), pushBatch: n3.unknown().optional().describe("Batch push function"), on: n3.unknown().optional().describe("Event lifecycle hook function") }).meta({ id: "DestinationInstance", title: "Destination.Instance", description: "Destination instance (runtime object with init/push/pushBatch/on)." }).describe("Destination instance (runtime object with functions)");
1928
+ mt = n3.object({ code: ut.describe("Destination instance with implementation"), config: nt.optional().describe("Partial configuration overrides"), env: n3.unknown().optional().describe("Partial environment overrides") }).meta({ id: "DestinationInit", title: "Destination.Init", description: "Destination initialization bundle (instance code + config + env)." }).describe("Destination initialization configuration");
1929
+ ft = n3.record(n3.string(), mt).meta({ id: "DestinationInitDestinations", title: "Destination.InitDestinations", description: "Map of destination IDs to initialization configurations." }).describe("Map of destination IDs to initialization configurations");
1930
+ gt2 = n3.record(n3.string(), ut).meta({ id: "DestinationDestinations", title: "Destination.Destinations", description: "Map of destination IDs to runtime destination instances." }).describe("Map of destination IDs to runtime instances");
1931
+ ht2 = n3.object({ type: n3.string().describe('Destination type ("gtag", "meta", "bigquery")'), data: n3.unknown().optional().describe("Response from push()"), error: n3.unknown().optional().describe("Error if failed") }).meta({ id: "DestinationRef", title: "Destination.Ref", description: "Reference to a destination outcome (type + response data or error)." }).describe("Destination reference with type and response data");
1932
+ bt = n3.object({ queue: n3.array(Y2).optional().describe("Events queued (awaiting consent)"), error: n3.unknown().optional().describe("Error if push failed") }).meta({ id: "DestinationPushResult", title: "Destination.PushResult", description: "Result of a single destination push (queued events, optional error)." }).describe("Push operation result");
1933
+ vt2 = n3.object({ ok: n3.boolean().describe("True if nothing failed"), event: n3.unknown().optional().describe("The processed event"), done: n3.record(n3.string(), ht2).optional().describe("Destinations that processed successfully"), queued: n3.record(n3.string(), ht2).optional().describe("Destinations that queued events"), failed: n3.record(n3.string(), ht2).optional().describe("Destinations that failed to process") }).meta({ id: "DestinationResult", title: "Destination.Result", description: "Overall push result aggregated across all destinations (done/queued/failed maps)." }).describe("Push result with destination outcomes");
1934
+ St2 = n3.array(n3.tuple([Y2, n3.unknown()])).meta({ id: "DestinationDLQ", title: "Destination.DLQ", description: "Dead-letter queue: list of [event, error] tuples." }).describe("Dead letter queue: [(event, error), ...]");
1935
+ yt2 = o2(it);
1936
+ wt = o2(nt);
1937
+ kt = o2(rt);
1938
+ Ct2 = o2(at);
1939
+ xt2 = o2(dt);
1940
+ Pt2 = o2(ut);
1941
+ jt2 = o2(vt2);
1913
1942
  Et2 = {};
1914
- t3(Et2, { CommandTypeSchema: () => Pt2, ConfigSchema: () => Dt, DestinationsSchema: () => Mt2, InitConfigSchema: () => Ot2, InstanceSchema: () => Tt2, PushContextSchema: () => Jt, SessionDataSchema: () => It2, SourcesSchema: () => Rt, commandTypeJsonSchema: () => Ft, configJsonSchema: () => zt2, initConfigJsonSchema: () => $t2, instanceJsonSchema: () => Nt2, pushContextJsonSchema: () => qt, sessionDataJsonSchema: () => Lt });
1915
- Pt2 = n3.union([n3.enum(["action", "config", "consent", "context", "destination", "elb", "globals", "hook", "init", "link", "run", "user", "walker"]), n3.string()]).meta({ id: "CollectorCommandType", title: "Collector.CommandType", description: "Collector command type identifier (standard or extension string)." }).describe("Collector command type: standard commands or custom string for extensions");
1916
- Dt = n3.object({ run: n3.boolean().describe("Whether to run collector automatically on initialization").optional(), globalsStatic: V2.describe("Static global properties that persist across collector runs"), sessionStatic: n3.record(n3.string(), n3.unknown()).meta({ id: "CollectorSessionStatic", title: "Collector.SessionStatic", description: "Static session data that persists across collector runs." }).describe("Static session data that persists across collector runs"), logger: et.optional().describe("Logger configuration (level, handler)"), queueMax: n3.number().optional().describe("Maximum events retained in collector.queue (late-registration replay). FIFO drop on overflow. Default 1000.") }).meta({ id: "CollectorConfig", title: "Collector.Config", description: "Core collector configuration (globals/session statics, logger, buffer bounds)." }).describe("Core collector configuration");
1917
- It2 = V2.and(n3.object({ isStart: n3.boolean().describe("Whether this is a new session start"), storage: n3.boolean().describe("Whether storage is available"), id: c.describe("Session identifier").optional(), start: l.describe("Session start timestamp").optional(), marketing: n3.literal(true).optional().describe("Marketing attribution flag"), updated: l.describe("Last update timestamp").optional(), isNew: n3.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() })).meta({ id: "CollectorSessionData", title: "Collector.SessionData", description: "Session state and tracking data." }).describe("Session state and tracking data");
1918
- Ot2 = Dt.partial().extend({ consent: Z3.optional().describe("Initial consent state"), user: G2.optional().describe("Initial user data"), globals: V2.optional().describe("Initial global properties"), sources: n3.unknown().meta({ id: "CollectorInitSources", title: "Source.InitSources", description: "Source configurations map (id \u2192 InitSource)." }).optional().describe("Source configurations"), destinations: n3.unknown().meta({ id: "CollectorInitDestinations", title: "Destination.InitDestinations", description: "Destination configurations map (id \u2192 Init)." }).optional().describe("Destination configurations"), transformers: n3.unknown().meta({ id: "CollectorInitTransformers", title: "Transformer.Configs", description: "Transformer configurations map (id \u2192 Config)." }).optional().describe("Transformer configurations"), stores: n3.unknown().meta({ id: "CollectorInitStores", title: "Store.Configs", description: "Store configurations map (id \u2192 Config)." }).optional().describe("Store configurations"), custom: V2.optional().describe("Initial custom implementation-specific properties"), hooks: n3.unknown().meta({ id: "CollectorHooks", title: "Collector.Hooks", description: "Pipeline observation hooks." }).optional().describe("Pipeline observation hooks") }).meta({ id: "CollectorInitConfig", title: "Collector.InitConfig", description: "Collector initialization configuration with initial state (consent, user, globals, components, hooks)." }).describe("Collector initialization configuration with initial state");
1919
- Jt = n3.object({ mapping: ye3.optional().describe("Source-level mapping configuration") }).meta({ id: "CollectorPushContext", title: "Collector.PushContext", description: "Push context with optional source-level mapping." }).describe("Push context with optional source mapping");
1920
- Rt = n3.record(n3.string(), n3.unknown()).meta({ id: "CollectorSources", title: "Collector.Sources", description: "Map of source IDs to runtime source instances." }).describe("Map of source IDs to source instances");
1921
- Mt2 = n3.record(n3.string(), n3.unknown()).meta({ id: "CollectorDestinations", title: "Collector.Destinations", description: "Map of destination IDs to runtime destination instances." }).describe("Map of destination IDs to destination instances");
1922
- Tt2 = n3.object({ push: n3.unknown().describe("Push function for processing events"), command: n3.unknown().describe("Command function for walker commands"), allowed: n3.boolean().describe("Whether event processing is allowed"), config: Dt.describe("Current collector configuration"), consent: Z3.describe("Current consent state"), custom: V2.describe("Custom implementation-specific properties"), sources: Rt.describe("Registered source instances"), destinations: Mt2.describe("Registered destination instances"), globals: V2.describe("Current global properties"), hooks: n3.unknown().describe("Lifecycle hook functions"), on: n3.unknown().describe("Event lifecycle configuration"), queue: n3.array(Y2).describe("Queued events awaiting processing"), round: n3.number().describe("Collector run count (increments with each run)"), session: n3.union([It2]).describe("Current session state"), timing: n3.number().describe("Event processing timing information"), user: G2.describe("Current user data") }).meta({ id: "CollectorInstance", title: "Collector.Instance", description: "Collector instance (runtime object with push/command + full state and component maps)." }).describe("Collector instance with state and methods");
1923
- Ft = o2(Pt2);
1924
- zt2 = o2(Dt);
1943
+ t3(Et2, { CommandTypeSchema: () => Dt2, ConfigSchema: () => It2, DestinationsSchema: () => Tt2, InitConfigSchema: () => Jt, InstanceSchema: () => Ft, PushContextSchema: () => Rt2, SessionDataSchema: () => Ot2, SourcesSchema: () => Mt2, commandTypeJsonSchema: () => zt2, configJsonSchema: () => Lt, initConfigJsonSchema: () => qt, instanceJsonSchema: () => At2, pushContextJsonSchema: () => Nt2, sessionDataJsonSchema: () => $t2 });
1944
+ Dt2 = n3.union([n3.enum(["action", "config", "consent", "context", "destination", "elb", "globals", "hook", "init", "link", "run", "user", "walker"]), n3.string()]).meta({ id: "CollectorCommandType", title: "Collector.CommandType", description: "Collector command type identifier (standard or extension string)." }).describe("Collector command type: standard commands or custom string for extensions");
1945
+ It2 = n3.object({ run: n3.boolean().describe("Whether to run collector automatically on initialization").optional(), globalsStatic: V2.describe("Static global properties that persist across collector runs"), sessionStatic: n3.record(n3.string(), n3.unknown()).meta({ id: "CollectorSessionStatic", title: "Collector.SessionStatic", description: "Static session data that persists across collector runs." }).describe("Static session data that persists across collector runs"), logger: tt2.optional().describe("Logger configuration (level, handler)"), queueMax: n3.number().optional().describe("Maximum events retained in collector.queue (late-registration replay). FIFO drop on overflow. Default 1000.") }).meta({ id: "CollectorConfig", title: "Collector.Config", description: "Core collector configuration (globals/session statics, logger, buffer bounds)." }).describe("Core collector configuration");
1946
+ Ot2 = V2.and(n3.object({ isStart: n3.boolean().describe("Whether this is a new session start"), storage: n3.boolean().describe("Whether storage is available"), id: c.describe("Session identifier").optional(), start: l.describe("Session start timestamp").optional(), marketing: n3.literal(true).optional().describe("Marketing attribution flag"), updated: l.describe("Last update timestamp").optional(), isNew: n3.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() })).meta({ id: "CollectorSessionData", title: "Collector.SessionData", description: "Session state and tracking data." }).describe("Session state and tracking data");
1947
+ Jt = It2.partial().extend({ consent: Z3.optional().describe("Initial consent state"), user: G2.optional().describe("Initial user data"), globals: V2.optional().describe("Initial global properties"), sources: n3.unknown().meta({ id: "CollectorInitSources", title: "Source.InitSources", description: "Source configurations map (id \u2192 InitSource)." }).optional().describe("Source configurations"), destinations: n3.unknown().meta({ id: "CollectorInitDestinations", title: "Destination.InitDestinations", description: "Destination configurations map (id \u2192 Init)." }).optional().describe("Destination configurations"), transformers: n3.unknown().meta({ id: "CollectorInitTransformers", title: "Transformer.Configs", description: "Transformer configurations map (id \u2192 Config)." }).optional().describe("Transformer configurations"), stores: n3.unknown().meta({ id: "CollectorInitStores", title: "Store.Configs", description: "Store configurations map (id \u2192 Config)." }).optional().describe("Store configurations"), custom: V2.optional().describe("Initial custom implementation-specific properties"), hooks: n3.unknown().meta({ id: "CollectorHooks", title: "Collector.Hooks", description: "Pipeline observation hooks." }).optional().describe("Pipeline observation hooks") }).meta({ id: "CollectorInitConfig", title: "Collector.InitConfig", description: "Collector initialization configuration with initial state (consent, user, globals, components, hooks)." }).describe("Collector initialization configuration with initial state");
1948
+ Rt2 = n3.object({ mapping: we2.optional().describe("Source-level mapping configuration") }).meta({ id: "CollectorPushContext", title: "Collector.PushContext", description: "Push context with optional source-level mapping." }).describe("Push context with optional source mapping");
1949
+ Mt2 = n3.record(n3.string(), n3.unknown()).meta({ id: "CollectorSources", title: "Collector.Sources", description: "Map of source IDs to runtime source instances." }).describe("Map of source IDs to source instances");
1950
+ Tt2 = n3.record(n3.string(), n3.unknown()).meta({ id: "CollectorDestinations", title: "Collector.Destinations", description: "Map of destination IDs to runtime destination instances." }).describe("Map of destination IDs to destination instances");
1951
+ Ft = n3.object({ push: n3.unknown().describe("Push function for processing events"), command: n3.unknown().describe("Command function for walker commands"), allowed: n3.boolean().describe("Whether event processing is allowed"), config: It2.describe("Current collector configuration"), consent: Z3.describe("Current consent state"), custom: V2.describe("Custom implementation-specific properties"), sources: Mt2.describe("Registered source instances"), destinations: Tt2.describe("Registered destination instances"), globals: V2.describe("Current global properties"), hooks: n3.unknown().describe("Lifecycle hook functions"), on: n3.unknown().describe("Event lifecycle configuration"), queue: n3.array(Y2).describe("Queued events awaiting processing"), round: n3.number().describe("Collector run count (increments with each run)"), session: n3.union([Ot2]).describe("Current session state"), timing: n3.number().describe("Event processing timing information"), user: G2.describe("Current user data") }).meta({ id: "CollectorInstance", title: "Collector.Instance", description: "Collector instance (runtime object with push/command + full state and component maps)." }).describe("Collector instance with state and methods");
1952
+ zt2 = o2(Dt2);
1925
1953
  Lt = o2(It2);
1926
1954
  $t2 = o2(Ot2);
1927
1955
  qt = o2(Jt);
1928
- Nt2 = o2(Tt2);
1929
- At2 = {};
1930
- t3(At2, { BaseEnvSchema: () => Wt, ConfigSchema: () => Bt, InitSchema: () => Ht, InitSourceSchema: () => _t2, InitSourcesSchema: () => Zt, InstanceSchema: () => Vt, PartialConfigSchema: () => Ut, baseEnvJsonSchema: () => Gt, configJsonSchema: () => Kt, initSourceJsonSchema: () => Yt, initSourcesJsonSchema: () => ei, instanceJsonSchema: () => Xt, partialConfigJsonSchema: () => Qt });
1931
- Wt = n3.object({ push: n3.unknown().meta({ id: "SourcePushFn", title: "Source.PushFn", description: "Collector push function passed to the source via dependency injection." }).describe("Collector push function"), command: n3.unknown().meta({ id: "SourceCommandFn", title: "Source.CommandFn", description: "Collector command function passed to the source." }).describe("Collector command function"), sources: n3.unknown().optional().describe("Map of registered source instances"), elb: n3.unknown().meta({ id: "ElbFn", title: "Elb.Fn", description: "Public `elb(...)` API function alias for collector.push." }).describe("Public API function (alias for collector.push)") }).catchall(n3.unknown()).meta({ id: "SourceBaseEnv", title: "Source.BaseEnv", description: "Base environment for source dependency injection; platform-specific sources extend this." }).describe("Base environment for dependency injection - platform-specific sources extend this");
1932
- Bt = ye3.extend({ settings: n3.any().meta({ id: "SourceSettings", title: "Source.Settings", description: "Implementation-specific configuration (source-defined shape)." }).describe("Implementation-specific configuration").optional(), env: Wt.optional().describe("Environment dependencies (platform-specific)"), id: c.describe("Source identifier (defaults to source key)").optional(), primary: n3.boolean().describe("Mark as primary (only one can be primary)").optional(), require: n3.array(n3.string()).optional().describe('Defer source initialization until these collector events fire (e.g., ["consent"])'), logger: et.optional().describe("Logger configuration (level, handler) to override the collector defaults"), setup: n3.union([n3.boolean(), n3.record(n3.string(), n3.unknown())]).optional().describe("One-time setup options applied during source registration (boolean enables defaults, object configures specifics)"), ingest: n3.union([pe3, ue3]).optional().describe("Ingest metadata extraction mapping. Extracts values from raw request objects (Express req, Lambda event) using mapping syntax."), disabled: n3.boolean().describe("Completely skip this source (no init, no event capture)").optional(), init: n3.boolean().optional().describe("Init lifecycle flag set by collector to true after Instance.init() runs") }).meta({ id: "SourceConfig", title: "Source.Config", description: "Source configuration with mapping, environment, and lifecycle hooks." }).describe("Source configuration with mapping and environment");
1933
- Ut = Bt.partial().meta({ id: "SourcePartialConfig", title: "Source.PartialConfig", description: "Partial source configuration with all fields optional." }).describe("Partial source configuration with all fields optional");
1934
- Vt = n3.object({ type: n3.string().describe('Source type identifier (e.g., "browser", "dataLayer")'), config: Bt.describe("Current source configuration"), push: n3.any().meta({ id: "SourceInstancePushFn", title: "Source.PushFn", description: "Push function \u2014 THE HANDLER (flexible signature for platform compatibility)." }).describe("Push function - THE HANDLER (flexible signature for platform compatibility)"), destroy: n3.any().meta({ id: "SourceDestroyFn", title: "Source.DestroyFn", description: "Cleanup function called when the source is removed." }).optional().describe("Cleanup function called when source is removed"), on: n3.unknown().optional().describe("Lifecycle hook function for event types") }).meta({ id: "SourceInstance", title: "Source.Instance", description: "Source instance (runtime object with push handler and lifecycle methods)." }).describe("Source instance with push handler and lifecycle methods");
1935
- Ht = n3.any().meta({ id: "SourceInit", title: "Source.Init", description: "Source initialization function: (config, env) => Instance | Promise<Instance>." }).describe("Source initialization function: (config, env) => Instance | Promise<Instance>");
1936
- _t2 = n3.object({ code: Ht.describe("Source initialization function"), config: Ut.optional().describe("Partial configuration overrides"), env: Wt.partial().optional().describe("Partial environment overrides"), primary: n3.boolean().optional().describe("Mark as primary source (only one can be primary)") }).meta({ id: "SourceInitSource", title: "Source.InitSource", description: "Source initialization bundle (init function + config + env + primary flag)." }).describe("Source initialization configuration");
1937
- Zt = n3.record(n3.string(), _t2).meta({ id: "SourceInitSources", title: "Source.InitSources", description: "Map of source IDs to initialization configurations." }).describe("Map of source IDs to initialization configurations");
1938
- Gt = o2(Wt);
1956
+ Nt2 = o2(Rt2);
1957
+ At2 = o2(Ft);
1958
+ Wt = {};
1959
+ t3(Wt, { BaseEnvSchema: () => Bt, ConfigSchema: () => Ut, InitSchema: () => _t2, InitSourceSchema: () => Zt2, InitSourcesSchema: () => Gt, InstanceSchema: () => Ht, PartialConfigSchema: () => Vt, baseEnvJsonSchema: () => Kt, configJsonSchema: () => Qt, initSourceJsonSchema: () => ei, initSourcesJsonSchema: () => ti, instanceJsonSchema: () => Yt, partialConfigJsonSchema: () => Xt });
1960
+ Bt = n3.object({ push: n3.unknown().meta({ id: "SourcePushFn", title: "Source.PushFn", description: "Collector push function passed to the source via dependency injection." }).describe("Collector push function"), command: n3.unknown().meta({ id: "SourceCommandFn", title: "Source.CommandFn", description: "Collector command function passed to the source." }).describe("Collector command function"), sources: n3.unknown().optional().describe("Map of registered source instances"), elb: n3.unknown().meta({ id: "ElbFn", title: "Elb.Fn", description: "Public `elb(...)` API function alias for collector.push." }).describe("Public API function (alias for collector.push)") }).catchall(n3.unknown()).meta({ id: "SourceBaseEnv", title: "Source.BaseEnv", description: "Base environment for source dependency injection; platform-specific sources extend this." }).describe("Base environment for dependency injection - platform-specific sources extend this");
1961
+ Ut = we2.extend({ settings: n3.any().meta({ id: "SourceSettings", title: "Source.Settings", description: "Implementation-specific configuration (source-defined shape)." }).describe("Implementation-specific configuration").optional(), env: Bt.optional().describe("Environment dependencies (platform-specific)"), id: c.describe("Source identifier (defaults to source key)").optional(), primary: n3.boolean().describe("Mark as primary (only one can be primary)").optional(), require: n3.array(n3.string()).optional().describe('Defer source initialization until these collector events fire (e.g., ["consent"])'), logger: tt2.optional().describe("Logger configuration (level, handler) to override the collector defaults"), setup: n3.union([n3.boolean(), n3.record(n3.string(), n3.unknown())]).optional().describe("One-time setup options applied during source registration (boolean enables defaults, object configures specifics)"), ingest: n3.union([pe3, ue3]).optional().describe("Ingest metadata extraction mapping. Extracts values from raw request objects (Express req, Lambda event) using mapping syntax."), disabled: n3.boolean().describe("Completely skip this source (no init, no event capture)").optional(), init: n3.boolean().optional().describe("Init lifecycle flag set by collector to true after Instance.init() runs") }).meta({ id: "SourceConfig", title: "Source.Config", description: "Source configuration with mapping, environment, and lifecycle hooks." }).describe("Source configuration with mapping and environment");
1962
+ Vt = Ut.partial().meta({ id: "SourcePartialConfig", title: "Source.PartialConfig", description: "Partial source configuration with all fields optional." }).describe("Partial source configuration with all fields optional");
1963
+ Ht = n3.object({ type: n3.string().describe('Source type identifier (e.g., "browser", "dataLayer")'), config: Ut.describe("Current source configuration"), push: n3.any().meta({ id: "SourceInstancePushFn", title: "Source.PushFn", description: "Push function \u2014 THE HANDLER (flexible signature for platform compatibility)." }).describe("Push function - THE HANDLER (flexible signature for platform compatibility)"), destroy: n3.any().meta({ id: "SourceDestroyFn", title: "Source.DestroyFn", description: "Cleanup function called when the source is removed." }).optional().describe("Cleanup function called when source is removed"), on: n3.unknown().optional().describe("Lifecycle hook function for event types") }).meta({ id: "SourceInstance", title: "Source.Instance", description: "Source instance (runtime object with push handler and lifecycle methods)." }).describe("Source instance with push handler and lifecycle methods");
1964
+ _t2 = n3.any().meta({ id: "SourceInit", title: "Source.Init", description: "Source initialization function: (config, env) => Instance | Promise<Instance>." }).describe("Source initialization function: (config, env) => Instance | Promise<Instance>");
1965
+ Zt2 = n3.object({ code: _t2.describe("Source initialization function"), config: Vt.optional().describe("Partial configuration overrides"), env: Bt.partial().optional().describe("Partial environment overrides"), primary: n3.boolean().optional().describe("Mark as primary source (only one can be primary)") }).meta({ id: "SourceInitSource", title: "Source.InitSource", description: "Source initialization bundle (init function + config + env + primary flag)." }).describe("Source initialization configuration");
1966
+ Gt = n3.record(n3.string(), Zt2).meta({ id: "SourceInitSources", title: "Source.InitSources", description: "Map of source IDs to initialization configurations." }).describe("Map of source IDs to initialization configurations");
1939
1967
  Kt = o2(Bt);
1940
1968
  Qt = o2(Ut);
1941
1969
  Xt = o2(Vt);
1942
- Yt = o2(_t2);
1943
- ei = o2(Zt);
1944
- ti = {};
1945
- t3(ti, { ConfigSchema: () => ii, PartialConfigSchema: () => ni, configJsonSchema: () => oi, partialConfigJsonSchema: () => ri });
1946
- ii = n3.object({ settings: n3.any().meta({ id: "TransformerSettings", title: "Transformer.Settings", description: "Implementation-specific configuration (transformer-defined shape)." }).describe("Implementation-specific configuration").optional(), env: n3.any().meta({ id: "TransformerEnv", title: "Transformer.Env", description: "Environment dependencies (transformer-defined shape)." }).describe("Environment dependencies (platform-specific)").optional(), id: c.describe("Transformer instance identifier (defaults to transformer key)").optional(), logger: et.optional().describe("Logger configuration (level, handler) to override the collector defaults"), before: Ae2.optional().describe("Pre-transformer chain that runs before this transformer pushes"), next: Ae2.optional().describe("Graph wiring to the next transformer in the chain"), cache: Ze2.optional().describe("Step-level cache configuration for this transformer"), init: n3.boolean().describe("Whether to initialize immediately").optional(), disabled: n3.boolean().describe("Completely skip this transformer in chains").optional(), mock: n3.unknown().meta({ id: "TransformerMock", title: "Transformer.Mock", description: "Return this value instead of calling push(). Dev/testing only." }).optional().describe("Return this value instead of calling push(). Global mock for all chains. Dev/testing only."), chainMocks: n3.record(n3.string(), n3.unknown().meta({ id: "TransformerChainMock", title: "Transformer.ChainMock", description: "Chain-path-specific mock value. Dev/testing only." })).optional().describe("Path-specific mock values keyed by chain path. Takes precedence over global mock. Dev/testing only."), mapping: ye3.optional().describe("Declarative event-to-event mapping applied when this transformer step has no code. At this position, only event-mutating fields apply (policy, mapping[].policy, mapping[].name, mapping[].ignore, mapping[].consent, include); vendor-payload fields are ignored.") }).strict().meta({ id: "TransformerConfig", title: "Transformer.Config", description: "Transformer configuration (settings, env, chain wiring, cache, mocks)." }).describe("Transformer configuration");
1947
- ni = ii.partial().meta({ id: "TransformerPartialConfig", title: "Transformer.PartialConfig", description: "Partial transformer configuration with all fields optional." }).describe("Partial transformer configuration with all fields optional");
1948
- oi = o2(ii);
1970
+ Yt = o2(Ht);
1971
+ ei = o2(Zt2);
1972
+ ti = o2(Gt);
1973
+ ii = {};
1974
+ t3(ii, { ConfigSchema: () => ni, PartialConfigSchema: () => oi, configJsonSchema: () => ri, partialConfigJsonSchema: () => ai });
1975
+ ni = n3.object({ settings: n3.any().meta({ id: "TransformerSettings", title: "Transformer.Settings", description: "Implementation-specific configuration (transformer-defined shape)." }).describe("Implementation-specific configuration").optional(), env: n3.any().meta({ id: "TransformerEnv", title: "Transformer.Env", description: "Environment dependencies (transformer-defined shape)." }).describe("Environment dependencies (platform-specific)").optional(), id: c.describe("Transformer instance identifier (defaults to transformer key)").optional(), logger: tt2.optional().describe("Logger configuration (level, handler) to override the collector defaults"), before: We3.optional().describe("Pre-transformer chain that runs before this transformer pushes"), next: We3.optional().describe("Graph wiring to the next transformer in the chain"), cache: Ge2.optional().describe("Step-level cache configuration for this transformer"), init: n3.boolean().describe("Whether to initialize immediately").optional(), disabled: n3.boolean().describe("Completely skip this transformer in chains").optional(), mock: n3.unknown().meta({ id: "TransformerMock", title: "Transformer.Mock", description: "Return this value instead of calling push(). Dev/testing only." }).optional().describe("Return this value instead of calling push(). Global mock for all chains. Dev/testing only."), chainMocks: n3.record(n3.string(), n3.unknown().meta({ id: "TransformerChainMock", title: "Transformer.ChainMock", description: "Chain-path-specific mock value. Dev/testing only." })).optional().describe("Path-specific mock values keyed by chain path. Takes precedence over global mock. Dev/testing only."), mapping: we2.optional().describe("Declarative event-to-event mapping applied when this transformer step has no code. At this position, only event-mutating fields apply (policy, mapping[].policy, mapping[].name, mapping[].ignore, mapping[].consent, include); vendor-payload fields are ignored.") }).strict().meta({ id: "TransformerConfig", title: "Transformer.Config", description: "Transformer configuration (settings, env, chain wiring, cache, mocks)." }).describe("Transformer configuration");
1976
+ oi = ni.partial().meta({ id: "TransformerPartialConfig", title: "Transformer.PartialConfig", description: "Partial transformer configuration with all fields optional." }).describe("Partial transformer configuration with all fields optional");
1949
1977
  ri = o2(ni);
1950
- ai = {};
1951
- t3(ai, { ConfigSchema: () => si, PartialConfigSchema: () => ci, configJsonSchema: () => li, partialConfigJsonSchema: () => di });
1952
- si = n3.object({ settings: n3.unknown().meta({ id: "StoreSettings", title: "Store.Settings", description: "Implementation-specific configuration (store-defined shape)." }).describe("Implementation-specific configuration").optional(), env: n3.unknown().meta({ id: "StoreEnv", title: "Store.Env", description: "Environment dependencies (store-defined shape)." }).describe("Environment dependencies (platform-specific)").optional(), id: c.describe("Store instance identifier (defaults to store key)").optional(), logger: et.optional().describe("Logger configuration (level, handler) to override the collector defaults"), setup: n3.union([n3.boolean(), n3.record(n3.string(), n3.unknown())]).optional().describe("One-time setup options applied during store registration (boolean enables defaults, object configures specifics)") }).meta({ id: "StoreConfig", title: "Store.Config", description: "Store configuration (settings, env, logger) \u2014 key-value infrastructure component." }).describe("Store configuration");
1953
- ci = si.partial().meta({ id: "StorePartialConfig", title: "Store.PartialConfig", description: "Partial store configuration with all fields optional." }).describe("Partial store configuration with all fields optional");
1954
- li = o2(si);
1978
+ ai = o2(oi);
1979
+ si = {};
1980
+ t3(si, { ConfigSchema: () => ci, PartialConfigSchema: () => li, configJsonSchema: () => di, partialConfigJsonSchema: () => pi });
1981
+ ci = n3.object({ settings: n3.unknown().meta({ id: "StoreSettings", title: "Store.Settings", description: "Implementation-specific configuration (store-defined shape)." }).describe("Implementation-specific configuration").optional(), env: n3.unknown().meta({ id: "StoreEnv", title: "Store.Env", description: "Environment dependencies (store-defined shape)." }).describe("Environment dependencies (platform-specific)").optional(), id: c.describe("Store instance identifier (defaults to store key)").optional(), logger: tt2.optional().describe("Logger configuration (level, handler) to override the collector defaults"), setup: n3.union([n3.boolean(), n3.record(n3.string(), n3.unknown())]).optional().describe("One-time setup options applied during store registration (boolean enables defaults, object configures specifics)") }).meta({ id: "StoreConfig", title: "Store.Config", description: "Store configuration (settings, env, logger) \u2014 key-value infrastructure component." }).describe("Store configuration");
1982
+ li = ci.partial().meta({ id: "StorePartialConfig", title: "Store.PartialConfig", description: "Partial store configuration with all fields optional." }).describe("Partial store configuration with all fields optional");
1955
1983
  di = o2(ci);
1956
- pi = {};
1957
- t3(pi, { BundlePackageSchema: () => gi, BundleSchema: () => hi, CodeSchema: () => bi, ConfigSchema: () => Mi, ContractActionsSchema: () => Ii, ContractEventsSchema: () => Oi, ContractRuleSchema: () => Ji, ContractSchema: () => Ri, ContractSchemaEntry: () => Di, DestinationSchema: () => Ei, FlowSchema: () => Ti, JsonSchema: () => Fi, JsonSchemaSchema: () => wi, SettingsSchema: () => mi, SourceSchema: () => xi, StepExampleSchema: () => Si, StepExamplesSchema: () => yi, StoreSchema: () => Pi, TransformerSchema: () => ji, TriggerDescriptorSchema: () => vi, ValidateEventsSchema: () => ki, ValidateSchema: () => Ci, VariablesSchema: () => ui, configJsonSchema: () => Ni, contractJsonSchema: () => Zi, contractRuleJsonSchema: () => _i, destinationJsonSchema: () => Ui, flowConfigJsonSchema: () => Wi, flowJsonSchema: () => Ai, parseConfig: () => zi, parseFlow: () => $i, safeParseConfig: () => Li, safeParseFlow: () => qi, sourceJsonSchema: () => Bi, storeJsonSchema: () => Hi, transformerJsonSchema: () => Vi, validateEventsJsonSchema: () => Ki, validateJsonSchema: () => Gi });
1958
- ui = n3.record(n3.string(), n3.unknown()).meta({ id: "FlowVariables", title: "Flow.Variables", description: "Reusable values referenced via $var.name (with optional deep paths). Whole-string refs preserve native type; inline interpolation requires scalars." });
1959
- mi = n3.record(n3.string(), n3.unknown()).meta({ id: "FlowSettings", title: "Flow.Settings", description: "Free-form key-value settings consumed by the platform runtime." }).describe("Free-form platform settings bag");
1960
- fi = /^(@[a-z0-9\-~][a-z0-9\-._~]*\/)?[a-z0-9\-~][a-z0-9\-._~]*$/;
1961
- gi = n3.object({ version: n3.string().optional(), imports: n3.array(n3.string()).optional(), path: n3.string().optional() }).meta({ id: "FlowBundlePackage", title: "Flow.BundlePackage", description: "Per-package bundle spec (version / imports / local path)." });
1962
- hi = n3.object({ packages: n3.record(n3.string().regex(fi, "Invalid npm package name"), gi).optional().describe("NPM packages to bundle, keyed by package name"), overrides: n3.record(n3.string().regex(fi, "Invalid npm package name"), n3.string().min(1, "Override version cannot be empty")).optional().describe("Transitive dependency version pins"), traceInclude: n3.array(n3.string()).optional().describe("Extra paths or globs the bundler must include in the trace output (server flows only)") }).strict().meta({ id: "FlowBundle", title: "Flow.Bundle", description: "Bundle configuration (packages + overrides + traceInclude)." }).describe("Bundle configuration (packages + overrides + traceInclude)");
1963
- bi = n3.object({ push: n3.string().min(1, "Push function cannot be empty").describe('JavaScript function for processing events. Must start with "$code:" prefix.'), type: n3.string().optional().describe("Optional type identifier for the inline instance"), init: n3.string().optional().describe("Optional initialization function. Use $code: prefix for inline JavaScript.") }).meta({ id: "FlowCode", title: "Flow.Code", description: "Inline code block (object form) for custom sources / transformers / destinations / stores. Use `import` on the step to select a named export from a package." }).describe("Inline code for custom components (object form)");
1964
- vi = n3.object({ type: n3.string().optional().describe("Trigger mechanism (e.g., click, POST, load)"), options: n3.unknown().optional().describe("Mechanism-specific options") }).meta({ id: "TriggerDescriptor", title: "Trigger.Descriptor", description: "Source trigger metadata (mechanism + options) used by step examples." });
1965
- Si = n3.object({ title: n3.string().optional().describe("Human-readable title (overrides default heading)"), description: n3.string().optional().describe("Human-readable description"), public: n3.boolean().optional().describe("Whether this example is shown in docs/UI/MCP default output (default: true). Set false for test-only fixtures."), in: n3.unknown().optional().describe("Input to the step"), trigger: vi.optional().describe("Source trigger metadata"), mapping: n3.unknown().optional().describe("Mapping configuration"), out: n3.unknown().optional().describe("Expected output from the step"), command: n3.enum(["config", "consent", "user", "run"]).optional().describe("Invoke elb('walker <command>', in) instead of pushing in as an event") }).meta({ id: "FlowStepExample", title: "Flow.StepExample", description: "Named example with input/output pair used for step testing." }).describe("Named example with input/output pair");
1966
- yi = n3.record(n3.string(), Si).meta({ id: "FlowStepExamples", title: "Flow.StepExamples", description: "Named step examples keyed by scenario name." }).describe("Named step examples for testing and documentation");
1967
- wi = n3.record(n3.string(), n3.unknown()).meta({ id: "JsonSchema", title: "JsonSchema", description: "Structural JSON Schema fragment (Record<string, unknown>)" });
1968
- ki = n3.record(n3.string(), n3.record(n3.string(), wi)).meta({ id: "ValidateEvents", title: "ValidateEvents", description: "Entity-action keyed JSON Schemas" }).describe("Entity-action keyed JSON Schemas");
1969
- Ci = n3.object({ format: n3.boolean().optional().describe("Validate event structure against the standard event format"), events: ki.optional().describe("Per entity-action JSON Schemas to validate matching events against"), schema: wi.optional().describe("A single JSON Schema applied to every event this step handles") }).meta({ id: "Validate", title: "Validate", description: "Step-level validation: { format?, events?, schema? }" });
1970
- xi = n3.object({ package: n3.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: bi.optional().describe("Inline code definition (object form). For a named export from a package, use `import` instead."), import: n3.string().regex(/^[A-Za-z_$][A-Za-z0-9_$]*$/, "import must be a valid JavaScript identifier").optional().describe("Named export from `package` to import as this step's implementation. Top-level identifier only. Requires `package`. Mutually exclusive with `code`."), config: n3.looseObject({ setup: n3.union([n3.boolean(), n3.record(n3.string(), n3.unknown())]).optional().describe("One-time setup options applied during source registration (boolean enables defaults, object configures specifics)") }).meta({ id: "FlowSourceConfig", title: "Source.Config", description: "Source-specific configuration object (Source.Config)." }).optional().describe("Source-specific configuration object"), env: n3.unknown().meta({ id: "FlowSourceEnv", title: "Source.BaseEnv", description: "Source environment configuration (Source.BaseEnv overrides)." }).optional().describe("Source environment configuration"), primary: n3.boolean().optional().describe("Mark as primary source (provides main elb). Only one source should be primary."), variables: ui.optional().describe("Source-level variables (highest priority in cascade)"), next: Ae2.optional().describe("Pre-collector transformer chain. String, string[], or Route[] for conditional routing based on ingest data."), before: Ae2.optional().describe("Pre-source transformer chain (consent-exempt). Handles transport-level preprocessing."), examples: yi.optional().describe("Named step examples for testing and documentation (stripped during bundling)"), cache: Ze2.optional().describe("Cache configuration for this source (match \u2192 key \u2192 ttl rules)"), validate: Ci.optional() }).meta({ id: "FlowSource", title: "Flow.Source", description: "Source package reference with configuration, env, chains, and examples." }).describe("Source package reference with configuration");
1971
- ji = n3.object({ package: n3.string().min(1, "Package name cannot be empty").optional().describe('Package specifier with optional version (e.g., "@walkeros/transformer-enricher@1.0.0")'), code: bi.optional().describe("Inline code definition (object form). For a named export from a package, use `import` instead."), import: n3.string().regex(/^[A-Za-z_$][A-Za-z0-9_$]*$/, "import must be a valid JavaScript identifier").optional().describe("Named export from `package` to import as this step's implementation. Top-level identifier only. Requires `package`. Mutually exclusive with `code`."), config: n3.unknown().meta({ id: "FlowTransformerConfig", title: "Transformer.Config", description: "Transformer-specific configuration object." }).optional().describe("Transformer-specific configuration object"), env: n3.unknown().meta({ id: "FlowTransformerEnv", title: "Transformer.Env", description: "Transformer environment configuration." }).optional().describe("Transformer environment configuration"), before: Ae2.optional().describe("Pre-transformer chain. Runs before this transformer push function."), next: Ae2.optional().describe("Next transformer in chain. String, string[], or Route[] for conditional routing."), variables: ui.optional().describe("Transformer-level variables (highest priority in cascade)"), examples: yi.optional().describe("Named step examples for testing and documentation (stripped during bundling)"), cache: Ze2.optional().describe("Cache configuration for this transformer (match \u2192 key \u2192 ttl rules)"), validate: Ci.optional() }).meta({ id: "FlowTransformer", title: "Flow.Transformer", description: "Transformer package reference with configuration, env, chains, and cache." }).describe("Transformer package reference with configuration");
1972
- Ei = n3.object({ package: n3.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: bi.optional().describe("Inline code definition (object form). For a named export from a package, use `import` instead."), import: n3.string().regex(/^[A-Za-z_$][A-Za-z0-9_$]*$/, "import must be a valid JavaScript identifier").optional().describe("Named export from `package` to import as this step's implementation. Top-level identifier only. Requires `package`. Mutually exclusive with `code`."), config: n3.looseObject({ setup: n3.union([n3.boolean(), n3.record(n3.string(), n3.unknown())]).optional().describe("One-time setup options applied during destination registration (boolean enables defaults, object configures specifics)") }).meta({ id: "FlowDestinationConfig", title: "Destination.Config", description: "Destination-specific configuration object." }).optional().describe("Destination-specific configuration object"), env: n3.unknown().meta({ id: "FlowDestinationEnv", title: "Destination.Env", description: "Destination environment configuration." }).optional().describe("Destination environment configuration"), variables: ui.optional().describe("Destination-level variables (highest priority in cascade)"), before: Ve.optional().describe("Post-collector transformer chain. String, string[], or Route[] for conditional routing. `many` is not valid here \u2014 use multiple destinations for post-collector fan-out."), next: Ve.optional().describe("Post-push transformer chain. Push response available at context.ingest._response. `many` is not valid here \u2014 use multiple destinations for post-collector fan-out."), examples: yi.optional().describe("Named step examples for testing and documentation (stripped during bundling)"), cache: Ze2.optional().describe("Cache configuration for this destination (match \u2192 key \u2192 ttl rules)"), validate: Ci.optional() }).meta({ id: "FlowDestination", title: "Flow.Destination", description: "Destination package reference with configuration, env, chains, and cache." }).describe("Destination package reference with configuration");
1973
- Pi = n3.object({ package: n3.string().min(1, "Package name cannot be empty").optional().describe("Store package specifier with optional version"), code: bi.optional().describe("Inline code definition (object form). For a named export from a package, use `import` instead."), import: n3.string().regex(/^[A-Za-z_$][A-Za-z0-9_$]*$/, "import must be a valid JavaScript identifier").optional().describe("Named export from `package` to import as this step's implementation. Top-level identifier only. Requires `package`. Mutually exclusive with `code`."), config: n3.looseObject({ setup: n3.union([n3.boolean(), n3.record(n3.string(), n3.unknown())]).optional().describe("One-time setup options applied during store registration (boolean enables defaults, object configures specifics)") }).meta({ id: "FlowStoreConfig", title: "Store.Config", description: "Store-specific configuration object." }).optional().describe("Store-specific configuration object"), env: n3.unknown().meta({ id: "FlowStoreEnv", title: "Store.Env", description: "Store environment configuration." }).optional().describe("Store environment configuration"), cache: Ke.optional().describe("Cache configuration for this store (TTL-only rules, optional recursive `cache.store`)"), variables: ui.optional().describe("Store-level variables (highest priority in cascade)"), examples: yi.optional().describe("Named step examples for testing and documentation (stripped during bundling)") }).meta({ id: "FlowStore", title: "Flow.Store", description: "Store package reference with configuration, env, cache, and examples." }).describe("Store package reference with configuration");
1974
- Di = n3.record(n3.string(), n3.unknown()).meta({ id: "FlowContractSchemaEntry", title: "Flow.ContractSchemaEntry", description: "JSON Schema object for event validation with description/examples annotations." }).describe("JSON Schema object for event validation with description/examples annotations");
1975
- Ii = n3.record(n3.string(), Di).meta({ id: "FlowContractActions", title: "Flow.ContractActions", description: "Action-level contract entries keyed by action name." }).describe("Action-level contract entries");
1976
- Oi = n3.record(n3.string(), Ii).meta({ id: "FlowContractEvents", title: "Flow.ContractEvents", description: "Entity-action event schemas (entity \u2192 action \u2192 schema)." }).describe("Entity-action event schemas");
1977
- Ji = n3.object({ extends: n3.string().optional(), tagging: n3.number().optional(), description: n3.string().optional(), events: ki.optional(), schema: wi.optional() }).meta({ id: "ContractRule", title: "Flow.ContractRule", description: "Named contract entry" });
1978
- Ri = n3.record(n3.string(), Ji).meta({ id: "FlowContract", title: "Flow.Contract", description: "Named contracts map with optional extends inheritance." }).describe("Named contracts with optional extends inheritance");
1979
- Mi = n3.object({ platform: n3.enum(["web", "server"]).describe("Platform identity for this flow. Drives bundle target/format."), url: n3.string().min(1).optional().describe("Public URL where this flow is reachable (for cross-flow $flow.X.url references)."), settings: mi.optional().describe("Free-form key-value settings consumed by the platform runtime."), bundle: hi.optional().describe("Bundle configuration: NPM packages, transitive dependency overrides.") }).meta({ id: "FlowConfig", title: "Flow.Config", description: "Per-flow configuration block: platform identity, optional public URL, settings, bundle." }).describe("Per-flow configuration block");
1980
- Ti = n3.object({ config: Mi.optional().describe("Per-flow configuration: platform, url, settings, bundle."), sources: n3.record(n3.string(), xi).optional().describe("Source configurations (data capture) keyed by unique identifier"), destinations: n3.record(n3.string(), Ei).optional().describe("Destination configurations (data output) keyed by unique identifier"), transformers: n3.record(n3.string(), ji).optional().describe("Transformer configurations (event transformation) keyed by unique identifier"), stores: n3.record(n3.string(), Pi).optional().describe("Store configurations (key-value storage) keyed by unique identifier"), collector: n3.unknown().meta({ id: "FlowCollector", title: "Collector.InitConfig", description: "Collector configuration for event processing (Collector.InitConfig)." }).optional().describe("Collector configuration for event processing (uses Collector.InitConfig)"), variables: ui.optional().describe("Flow-level variables (override root variables, overridden by source/destination variables)") }).meta({ id: "Flow", title: "Flow", description: "Single flow definition (one deployment target): config, sources, destinations, transformers, stores, collector." }).describe("Single flow definition for one deployment target");
1981
- Fi = n3.object({ version: n3.literal(4).describe("Configuration schema version (v4, current)."), $schema: n3.string().url("Schema URL must be a valid URL").optional().describe('JSON Schema reference for IDE validation (e.g., "https://walkeros.io/schema/flow/v4.json")'), include: n3.array(n3.string()).optional().describe("Folders to include in the bundle output"), variables: ui.optional().describe("Shared variables for interpolation across all flows (use $var.name syntax, deep paths supported)"), contract: Ri.optional().describe("Named contracts with extends inheritance and dot-path references"), flows: n3.record(n3.string(), Ti).refine((e4) => Object.keys(e4).length > 0, { message: "At least one flow is required" }).describe("Named flow configurations (e.g., production, staging, development)") }).meta({ id: "FlowJson", title: "Flow.Json", description: "walkerOS root configuration (walkeros.config.json) v4: version, variables, contract, named flows." }).describe("walkerOS root configuration (walkeros.config.json)");
1982
- Ni = n3.toJSONSchema(Fi, { target: "draft-7" });
1983
- Ai = o2(Ti);
1984
- Wi = o2(Mi);
1985
- Bi = o2(xi);
1986
- Ui = o2(Ei);
1984
+ pi = o2(li);
1985
+ ui = {};
1986
+ t3(ui, { BundlePackageSchema: () => hi, BundleSchema: () => bi, CodeSchema: () => vi, ConfigSchema: () => Fi, ContractActionsSchema: () => Ji, ContractEventsSchema: () => Ri, ContractRuleSchema: () => Mi, ContractSchema: () => Ti, ContractSchemaEntry: () => Oi, DestinationSchema: () => Di, FlowSchema: () => zi, JsonSchema: () => Li, JsonSchemaSchema: () => ki, SettingsSchema: () => fi, SourceSchema: () => ji, StepExampleSchema: () => yi, StepExamplesSchema: () => wi, StoreSchema: () => Ii, TransformerSchema: () => Ei, TriggerDescriptorSchema: () => Si, ValidateEventsSchema: () => Ci, ValidateSchema: () => xi, VariablesSchema: () => mi, configJsonSchema: () => Wi, contractJsonSchema: () => Ki, contractRuleJsonSchema: () => Gi, destinationJsonSchema: () => Hi, flowConfigJsonSchema: () => Ui, flowJsonSchema: () => Bi, parseConfig: () => $i, parseFlow: () => Ni, safeParseConfig: () => qi, safeParseFlow: () => Ai, sourceJsonSchema: () => Vi, storeJsonSchema: () => Zi, transformerJsonSchema: () => _i, validateEventsJsonSchema: () => Xi, validateJsonSchema: () => Qi });
1987
+ mi = n3.record(n3.string(), n3.unknown()).meta({ id: "FlowVariables", title: "Flow.Variables", description: "Reusable values referenced via $var.name (with optional deep paths). Whole-string refs preserve native type; inline interpolation requires scalars." });
1988
+ fi = n3.record(n3.string(), n3.unknown()).meta({ id: "FlowSettings", title: "Flow.Settings", description: "Free-form key-value settings consumed by the platform runtime." }).describe("Free-form platform settings bag");
1989
+ gi = /^(@[a-z0-9\-~][a-z0-9\-._~]*\/)?[a-z0-9\-~][a-z0-9\-._~]*$/;
1990
+ hi = n3.object({ version: n3.string().optional(), imports: n3.array(n3.string()).optional(), path: n3.string().optional() }).meta({ id: "FlowBundlePackage", title: "Flow.BundlePackage", description: "Per-package bundle spec (version / imports / local path)." });
1991
+ bi = n3.object({ packages: n3.record(n3.string().regex(gi, "Invalid npm package name"), hi).optional().describe("NPM packages to bundle, keyed by package name"), overrides: n3.record(n3.string().regex(gi, "Invalid npm package name"), n3.string().min(1, "Override version cannot be empty")).optional().describe("Transitive dependency version pins"), traceInclude: n3.array(n3.string()).optional().describe("Extra paths or globs the bundler must include in the trace output (server flows only)") }).strict().meta({ id: "FlowBundle", title: "Flow.Bundle", description: "Bundle configuration (packages + overrides + traceInclude)." }).describe("Bundle configuration (packages + overrides + traceInclude)");
1992
+ vi = n3.object({ push: n3.string().min(1, "Push function cannot be empty").describe('JavaScript function for processing events. Must start with "$code:" prefix.'), type: n3.string().optional().describe("Optional type identifier for the inline instance"), init: n3.string().optional().describe("Optional initialization function. Use $code: prefix for inline JavaScript.") }).meta({ id: "FlowCode", title: "Flow.Code", description: "Inline code block (object form) for custom sources / transformers / destinations / stores. Use `import` on the step to select a named export from a package." }).describe("Inline code for custom components (object form)");
1993
+ Si = n3.object({ type: n3.string().optional().describe("Trigger mechanism (e.g., click, POST, load)"), options: n3.unknown().optional().describe("Mechanism-specific options") }).meta({ id: "TriggerDescriptor", title: "Trigger.Descriptor", description: "Source trigger metadata (mechanism + options) used by step examples." });
1994
+ yi = n3.object({ title: n3.string().optional().describe("Human-readable title (overrides default heading)"), description: n3.string().optional().describe("Human-readable description"), public: n3.boolean().optional().describe("Whether this example is shown in docs/UI/MCP default output (default: true). Set false for test-only fixtures."), in: n3.unknown().optional().describe("Input to the step"), trigger: Si.optional().describe("Source trigger metadata"), mapping: n3.unknown().optional().describe("Mapping configuration"), out: n3.unknown().optional().describe("Expected output from the step"), command: n3.enum(["config", "consent", "user", "run"]).optional().describe("Invoke elb('walker <command>', in) instead of pushing in as an event") }).meta({ id: "FlowStepExample", title: "Flow.StepExample", description: "Named example with input/output pair used for step testing." }).describe("Named example with input/output pair");
1995
+ wi = n3.record(n3.string(), yi).meta({ id: "FlowStepExamples", title: "Flow.StepExamples", description: "Named step examples keyed by scenario name." }).describe("Named step examples for testing and documentation");
1996
+ ki = n3.record(n3.string(), n3.unknown()).meta({ id: "JsonSchema", title: "JsonSchema", description: "Structural JSON Schema fragment (Record<string, unknown>)" });
1997
+ Ci = n3.record(n3.string(), n3.record(n3.string(), ki)).meta({ id: "ValidateEvents", title: "ValidateEvents", description: "Entity-action keyed JSON Schemas" }).describe("Entity-action keyed JSON Schemas");
1998
+ xi = n3.object({ format: n3.boolean().optional().describe("Validate event structure against the standard event format"), events: Ci.optional().describe("Per entity-action JSON Schemas to validate matching events against"), schema: ki.optional().describe("A single JSON Schema applied to every event this step handles") }).meta({ id: "Validate", title: "Validate", description: "Step-level validation: { format?, events?, schema? }" });
1999
+ ji = n3.object({ package: n3.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: vi.optional().describe("Inline code definition (object form). For a named export from a package, use `import` instead."), import: n3.string().regex(/^[A-Za-z_$][A-Za-z0-9_$]*$/, "import must be a valid JavaScript identifier").optional().describe("Named export from `package` to import as this step's implementation. Top-level identifier only. Requires `package`. Mutually exclusive with `code`."), config: n3.looseObject({ setup: n3.union([n3.boolean(), n3.record(n3.string(), n3.unknown())]).optional().describe("One-time setup options applied during source registration (boolean enables defaults, object configures specifics)") }).meta({ id: "FlowSourceConfig", title: "Source.Config", description: "Source-specific configuration object (Source.Config)." }).optional().describe("Source-specific configuration object"), env: n3.unknown().meta({ id: "FlowSourceEnv", title: "Source.BaseEnv", description: "Source environment configuration (Source.BaseEnv overrides)." }).optional().describe("Source environment configuration"), primary: n3.boolean().optional().describe("Mark as primary source (provides main elb). Only one source should be primary."), variables: mi.optional().describe("Source-level variables (highest priority in cascade)"), next: We3.optional().describe("Pre-collector transformer chain. String, string[], or Route[] for conditional routing based on ingest data."), before: We3.optional().describe("Pre-source transformer chain (consent-exempt). Handles transport-level preprocessing."), examples: wi.optional().describe("Named step examples for testing and documentation (stripped during bundling)"), cache: Ge2.optional().describe("Cache configuration for this source (match \u2192 key \u2192 ttl rules)"), validate: xi.optional() }).meta({ id: "FlowSource", title: "Flow.Source", description: "Source package reference with configuration, env, chains, and examples." }).describe("Source package reference with configuration").superRefine(Pi);
2000
+ Ei = n3.object({ package: n3.string().min(1, "Package name cannot be empty").optional().describe('Package specifier with optional version (e.g., "@walkeros/transformer-enricher@1.0.0")'), code: vi.optional().describe("Inline code definition (object form). For a named export from a package, use `import` instead."), import: n3.string().regex(/^[A-Za-z_$][A-Za-z0-9_$]*$/, "import must be a valid JavaScript identifier").optional().describe("Named export from `package` to import as this step's implementation. Top-level identifier only. Requires `package`. Mutually exclusive with `code`."), config: n3.unknown().meta({ id: "FlowTransformerConfig", title: "Transformer.Config", description: "Transformer-specific configuration object." }).optional().describe("Transformer-specific configuration object"), env: n3.unknown().meta({ id: "FlowTransformerEnv", title: "Transformer.Env", description: "Transformer environment configuration." }).optional().describe("Transformer environment configuration"), before: We3.optional().describe("Pre-transformer chain. Runs before this transformer push function."), next: We3.optional().describe("Next transformer in chain. String, string[], or Route[] for conditional routing."), variables: mi.optional().describe("Transformer-level variables (highest priority in cascade)"), examples: wi.optional().describe("Named step examples for testing and documentation (stripped during bundling)"), cache: Ge2.optional().describe("Cache configuration for this transformer (match \u2192 key \u2192 ttl rules)"), validate: xi.optional() }).meta({ id: "FlowTransformer", title: "Flow.Transformer", description: "Transformer package reference with configuration, env, chains, and cache." }).describe("Transformer package reference with configuration").superRefine(Pi);
2001
+ Di = n3.object({ package: n3.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: vi.optional().describe("Inline code definition (object form). For a named export from a package, use `import` instead."), import: n3.string().regex(/^[A-Za-z_$][A-Za-z0-9_$]*$/, "import must be a valid JavaScript identifier").optional().describe("Named export from `package` to import as this step's implementation. Top-level identifier only. Requires `package`. Mutually exclusive with `code`."), config: n3.looseObject({ setup: n3.union([n3.boolean(), n3.record(n3.string(), n3.unknown())]).optional().describe("One-time setup options applied during destination registration (boolean enables defaults, object configures specifics)") }).meta({ id: "FlowDestinationConfig", title: "Destination.Config", description: "Destination-specific configuration object." }).optional().describe("Destination-specific configuration object"), env: n3.unknown().meta({ id: "FlowDestinationEnv", title: "Destination.Env", description: "Destination environment configuration." }).optional().describe("Destination environment configuration"), variables: mi.optional().describe("Destination-level variables (highest priority in cascade)"), before: He3.optional().describe("Post-collector transformer chain. String, string[], or Route[] for conditional routing. `many` is not valid here \u2014 use multiple destinations for post-collector fan-out."), next: He3.optional().describe("Post-push transformer chain. Push response available at context.ingest._response. `many` is not valid here \u2014 use multiple destinations for post-collector fan-out."), examples: wi.optional().describe("Named step examples for testing and documentation (stripped during bundling)"), cache: Ge2.optional().describe("Cache configuration for this destination (match \u2192 key \u2192 ttl rules)"), validate: xi.optional() }).meta({ id: "FlowDestination", title: "Flow.Destination", description: "Destination package reference with configuration, env, chains, and cache." }).describe("Destination package reference with configuration").superRefine(Pi);
2002
+ Ii = n3.object({ package: n3.string().min(1, "Package name cannot be empty").optional().describe("Store package specifier with optional version"), code: vi.optional().describe("Inline code definition (object form). For a named export from a package, use `import` instead."), import: n3.string().regex(/^[A-Za-z_$][A-Za-z0-9_$]*$/, "import must be a valid JavaScript identifier").optional().describe("Named export from `package` to import as this step's implementation. Top-level identifier only. Requires `package`. Mutually exclusive with `code`."), config: n3.looseObject({ setup: n3.union([n3.boolean(), n3.record(n3.string(), n3.unknown())]).optional().describe("One-time setup options applied during store registration (boolean enables defaults, object configures specifics)") }).meta({ id: "FlowStoreConfig", title: "Store.Config", description: "Store-specific configuration object." }).optional().describe("Store-specific configuration object"), env: n3.unknown().meta({ id: "FlowStoreEnv", title: "Store.Env", description: "Store environment configuration." }).optional().describe("Store environment configuration"), cache: Qe.optional().describe("Cache configuration for this store (TTL-only rules, optional recursive `cache.store`)"), variables: mi.optional().describe("Store-level variables (highest priority in cascade)"), examples: wi.optional().describe("Named step examples for testing and documentation (stripped during bundling)") }).meta({ id: "FlowStore", title: "Flow.Store", description: "Store package reference with configuration, env, cache, and examples." }).describe("Store package reference with configuration").superRefine(Pi);
2003
+ Oi = n3.record(n3.string(), n3.unknown()).meta({ id: "FlowContractSchemaEntry", title: "Flow.ContractSchemaEntry", description: "JSON Schema object for event validation with description/examples annotations." }).describe("JSON Schema object for event validation with description/examples annotations");
2004
+ Ji = n3.record(n3.string(), Oi).meta({ id: "FlowContractActions", title: "Flow.ContractActions", description: "Action-level contract entries keyed by action name." }).describe("Action-level contract entries");
2005
+ Ri = n3.record(n3.string(), Ji).meta({ id: "FlowContractEvents", title: "Flow.ContractEvents", description: "Entity-action event schemas (entity \u2192 action \u2192 schema)." }).describe("Entity-action event schemas");
2006
+ Mi = n3.object({ extend: n3.string().optional(), tagging: n3.number().optional(), description: n3.string().optional(), events: Ci.optional(), schema: ki.optional() }).meta({ id: "ContractRule", title: "Flow.ContractRule", description: "Named contract entry" });
2007
+ Ti = n3.record(n3.string(), Mi).meta({ id: "FlowContract", title: "Flow.Contract", description: "Named contracts map with optional extend inheritance." }).describe("Named contracts with optional extend inheritance");
2008
+ Fi = n3.object({ platform: n3.enum(["web", "server"]).describe("Platform identity for this flow. Drives bundle target/format."), url: n3.string().min(1).optional().describe("Public URL where this flow is reachable (for cross-flow $flow.X.url references)."), settings: fi.optional().describe("Free-form key-value settings consumed by the platform runtime."), bundle: bi.optional().describe("Bundle configuration: NPM packages, transitive dependency overrides.") }).meta({ id: "FlowConfig", title: "Flow.Config", description: "Per-flow configuration block: platform identity, optional public URL, settings, bundle." }).describe("Per-flow configuration block");
2009
+ zi = n3.object({ config: Fi.optional().describe("Per-flow configuration: platform, url, settings, bundle."), sources: n3.record(n3.string(), ji).optional().describe("Source configurations (data capture) keyed by unique identifier"), destinations: n3.record(n3.string(), Di).optional().describe("Destination configurations (data output) keyed by unique identifier"), transformers: n3.record(n3.string(), Ei).optional().describe("Transformer configurations (event transformation) keyed by unique identifier"), stores: n3.record(n3.string(), Ii).optional().describe("Store configurations (key-value storage) keyed by unique identifier"), collector: n3.unknown().meta({ id: "FlowCollector", title: "Collector.InitConfig", description: "Collector configuration for event processing (Collector.InitConfig)." }).optional().describe("Collector configuration for event processing (uses Collector.InitConfig)"), variables: mi.optional().describe("Flow-level variables (override root variables, overridden by source/destination variables)") }).meta({ id: "Flow", title: "Flow", description: "Single flow definition (one deployment target): config, sources, destinations, transformers, stores, collector." }).describe("Single flow definition for one deployment target");
2010
+ Li = n3.object({ version: n3.literal(4).describe("Configuration schema version (v4, current)."), $schema: n3.string().url("Schema URL must be a valid URL").optional().describe('JSON Schema reference for IDE validation (e.g., "https://walkeros.io/schema/flow/v4.json")'), include: n3.array(n3.string()).optional().describe("Folders to include in the bundle output"), variables: mi.optional().describe("Shared variables for interpolation across all flows (use $var.name syntax, deep paths supported)"), contract: Ti.optional().describe("Named contracts with extend inheritance and dot-path references"), flows: n3.record(n3.string(), zi).refine((e4) => Object.keys(e4).length > 0, { message: "At least one flow is required" }).describe("Named flow configurations (e.g., production, staging, development)") }).meta({ id: "FlowJson", title: "Flow.Json", description: "walkerOS root configuration (walkeros.config.json) v4: version, variables, contract, named flows." }).describe("walkerOS root configuration (walkeros.config.json)");
2011
+ Wi = n3.toJSONSchema(Li, { target: "draft-7" });
2012
+ Bi = o2(zi);
2013
+ Ui = o2(Fi);
1987
2014
  Vi = o2(ji);
1988
- Hi = o2(Pi);
1989
- _i = o2(Ji);
1990
- Zi = o2(Ri);
1991
- Gi = o2(Ci);
1992
- Ki = o2(ki);
1993
- Xi = Qi.object({ lang: Qi.string().optional().describe("Language identifier (e.g. json, sql, bash, typescript)"), code: Qi.string().describe("Code snippet") });
1994
- Yi = Qi.object({ text: Qi.string().describe("Short actionable hint text focused on walkerOS usage"), code: Qi.array(Xi).optional().describe("Optional code snippets") });
1995
- en = Qi.record(Qi.string(), Yi).describe("Keyed hints for AI consumption \u2014 lightweight context beyond schemas and examples");
1996
- tn = n3.object({ param: n3.string().describe("Lowercase URL parameter name. Match is case-insensitive on lookup."), platform: n3.string().describe("Canonical platform identifier (lowercase, kebab-case).") });
1997
- on2 = /\$store\.([a-zA-Z_][a-zA-Z0-9_]*)/g;
1998
- rn2 = /\$env\.([A-Za-z_]\w*)(=[^"}\s]*)?/g;
1999
- an2 = /\$flow\.([a-zA-Z_][a-zA-Z0-9_]*)(?:\.([a-zA-Z0-9_.]+))?/g;
2000
- sn2 = /\$(var|store|flow|secret):([a-zA-Z_][a-zA-Z0-9_]*)/g;
2001
- wn = { source: At2.configJsonSchema, destination: Je2.configJsonSchema };
2015
+ Hi = o2(Di);
2016
+ _i = o2(Ei);
2017
+ Zi = o2(Ii);
2018
+ Gi = o2(Mi);
2019
+ Ki = o2(Ti);
2020
+ Qi = o2(xi);
2021
+ Xi = o2(Ci);
2022
+ en = Yi.object({ lang: Yi.string().optional().describe("Language identifier (e.g. json, sql, bash, typescript)"), code: Yi.string().describe("Code snippet") });
2023
+ tn = Yi.object({ text: Yi.string().describe("Short actionable hint text focused on walkerOS usage"), code: Yi.array(en).optional().describe("Optional code snippets") });
2024
+ nn2 = Yi.record(Yi.string(), tn).describe("Keyed hints for AI consumption \u2014 lightweight context beyond schemas and examples");
2025
+ on2 = n3.object({ param: n3.string().describe("Lowercase URL parameter name. Match is case-insensitive on lookup."), platform: n3.string().describe("Canonical platform identifier (lowercase, kebab-case).") });
2026
+ an2 = /\$store\.([a-zA-Z_][a-zA-Z0-9_]*)/g;
2027
+ sn2 = /\$env\.([A-Za-z_]\w*)(=[^"}\s]*)?/g;
2028
+ cn2 = /\$flow\.([a-zA-Z_][a-zA-Z0-9_]*)(?:\.([a-zA-Z0-9_.]+))?/g;
2029
+ ln2 = /\$(var|store|flow|secret):([a-zA-Z_][a-zA-Z0-9_]*)/g;
2030
+ Cn = { source: Wt.configJsonSchema, destination: Re.configJsonSchema };
2002
2031
  }
2003
2032
  });
2004
2033
 
@@ -2091,7 +2120,7 @@ var init_event_validation = __esm({
2091
2120
  "src/core/event-validation.ts"() {
2092
2121
  "use strict";
2093
2122
  init_dev();
2094
- ({ PartialEventSchema } = i2);
2123
+ ({ PartialEventSchema } = i);
2095
2124
  }
2096
2125
  });
2097
2126
 
@@ -2195,7 +2224,7 @@ var init_validators = __esm({
2195
2224
  "use strict";
2196
2225
  init_dist();
2197
2226
  init_dev();
2198
- ({ safeParseConfig } = i2);
2227
+ ({ safeParseConfig } = i);
2199
2228
  }
2200
2229
  });
2201
2230
 
@@ -2698,7 +2727,7 @@ async function resolveVersionConflicts(allSpecs, logger, npmConfig = {}) {
2698
2727
  activeSpecs = requiredPeers;
2699
2728
  }
2700
2729
  activeSpecs.sort(
2701
- (a3, b3) => SOURCE_PRIORITY[a3.source] - SOURCE_PRIORITY[b3.source]
2730
+ (a4, b3) => SOURCE_PRIORITY[a4.source] - SOURCE_PRIORITY[b3.source]
2702
2731
  );
2703
2732
  const directSpecs = activeSpecs.filter((s5) => s5.source === "direct");
2704
2733
  const directExact = directSpecs.find((s5) => semver2.valid(s5.spec) !== null);
@@ -2714,8 +2743,8 @@ async function resolveVersionConflicts(allSpecs, logger, npmConfig = {}) {
2714
2743
  if (uniqueExact.length > 1) {
2715
2744
  const sorted = [...uniqueExact].sort(semver2.rcompare);
2716
2745
  chosenVersion = sorted[0];
2717
- for (let i3 = 1; i3 < sorted.length; i3++) {
2718
- const loserVersion = sorted[i3];
2746
+ for (let i2 = 1; i2 < sorted.length; i2++) {
2747
+ const loserVersion = sorted[i2];
2719
2748
  const consumers = activeSpecs.filter((s5) => s5.spec === loserVersion).map((s5) => s5.from);
2720
2749
  nested.push({ name, version: loserVersion, consumers });
2721
2750
  alreadyNested.add(loserVersion);
@@ -3271,7 +3300,7 @@ function hasCodeReference(code) {
3271
3300
  }
3272
3301
  function validateReference(type, name, ref) {
3273
3302
  if (type === "Transformer") {
3274
- const r4 = Pt({ ...ref }, "Transformer");
3303
+ const r4 = Zt({ ...ref }, "Transformer");
3275
3304
  if (!r4.ok) {
3276
3305
  throw new Error(`Transformer "${name}": ${r4.reason ?? "invalid entry."}`);
3277
3306
  }
@@ -3462,7 +3491,7 @@ async function bundleCore(flowSettings, buildOptions, logger, showStats = false)
3462
3491
  if (process.env.BUNDLER_STRICT_RANGES !== "0") {
3463
3492
  await assertConsumerDepsSatisfied(TEMP_DIR, logger);
3464
3493
  }
3465
- const sortedVersions = [...resolutionResult.topLevel.entries()].sort(([a3], [b3]) => a3.localeCompare(b3)).map(([name, p2]) => `${name}@${p2.version}`);
3494
+ const sortedVersions = [...resolutionResult.topLevel.entries()].sort(([a4], [b3]) => a4.localeCompare(b3)).map(([name, p2]) => `${name}@${p2.version}`);
3466
3495
  const versionsHash = await u2(sortedVersions.join("\n"), 12);
3467
3496
  const expectedTopLevelPackages = Object.keys(buildOptions.packages).filter(
3468
3497
  (name) => !name.startsWith(".") && !name.startsWith("/")
@@ -4124,12 +4153,12 @@ function buildSplitConfigObject(flowSettings, namedImports) {
4124
4153
  return buildSplitStepEntry("destinations", key, dest);
4125
4154
  });
4126
4155
  const transformersEntries = Object.entries(transformers).filter(
4127
- ([, transformer]) => transformer.package || hasCodeReference(transformer.code) || Mt({ ...transformer }, "Transformer")
4156
+ ([, transformer]) => transformer.package || hasCodeReference(transformer.code) || Dt({ ...transformer }, "Transformer")
4128
4157
  ).map(([key, transformer]) => {
4129
4158
  if (isInlineCode(transformer.code)) {
4130
4159
  return ` ${key}: ${generateInlineCode(transformer.code, transformer.config || {}, transformer.env, { before: transformer.before, next: transformer.next })}`;
4131
4160
  }
4132
- if (Mt({ ...transformer }, "Transformer")) {
4161
+ if (Dt({ ...transformer }, "Transformer")) {
4133
4162
  const chainLines = [];
4134
4163
  if (transformer.before !== void 0) {
4135
4164
  chainLines.push(`before: ${JSON.stringify(transformer.before)}`);
@@ -4827,9 +4856,11 @@ var init_api_client = __esm({
4827
4856
  });
4828
4857
 
4829
4858
  // src/commands/projects/index.ts
4830
- async function listProjects() {
4859
+ async function listProjects(options = {}) {
4831
4860
  const client = createApiClient();
4832
- const { data, error } = await client.GET("/api/projects");
4861
+ const { data, error } = await client.GET("/api/projects", {
4862
+ params: { query: { cursor: options.cursor, limit: options.limit } }
4863
+ });
4833
4864
  if (error) throw new Error(error.error?.message || "Failed to list projects");
4834
4865
  return data;
4835
4866
  }
@@ -4931,7 +4962,9 @@ async function listFlows(options = {}) {
4931
4962
  query: {
4932
4963
  sort: options.sort,
4933
4964
  order: options.order,
4934
- include_deleted: options.includeDeleted ? "true" : void 0
4965
+ include_deleted: options.includeDeleted ? "true" : void 0,
4966
+ cursor: options.cursor,
4967
+ limit: options.limit
4935
4968
  }
4936
4969
  }
4937
4970
  });
@@ -5307,24 +5340,24 @@ async function ne2(e4, n4, t4) {
5307
5340
  if (n4.init && !n4.config.init) {
5308
5341
  const o3 = n4.type || "unknown", s5 = e4.logger.scope(`transformer:${o3}`), r4 = { collector: e4, logger: s5, id: t4, ingest: E(t4), config: n4.config, env: re2(n4.config.env) };
5309
5342
  s5.debug("init");
5310
- const i3 = await tt(n4.init, "TransformerInit", e4.hooks, e4.logger)(r4);
5311
- if (false === i3) return false;
5312
- n4.config = { ...i3 || n4.config, env: i3?.env || n4.config.env, init: true }, s5.debug("init done");
5343
+ const i2 = await ot(n4.init, "TransformerInit", e4.hooks, e4.logger)(r4);
5344
+ if (false === i2) return false;
5345
+ n4.config = { ...i2 || n4.config, env: i2?.env || n4.config.env, init: true }, s5.debug("init done");
5313
5346
  }
5314
5347
  return true;
5315
5348
  }
5316
5349
  async function te(e4, n4, t4, o3, s5, r4) {
5317
- const i3 = n4.type || "unknown", a3 = e4.logger.scope(`transformer:${i3}`), c2 = { collector: e4, logger: a3, id: t4, ingest: s5, config: n4.config, env: { ...re2(n4.config.env), ...r4 ? { respond: r4 } : {} } };
5318
- a3.debug("push", { event: o3.name });
5319
- const u4 = await tt(n4.push, "TransformerPush", e4.hooks, e4.logger)(o3, c2);
5320
- return a3.debug("push done"), u4;
5350
+ const i2 = n4.type || "unknown", a4 = e4.logger.scope(`transformer:${i2}`), c2 = { collector: e4, logger: a4, id: t4, ingest: s5, config: n4.config, env: { ...re2(n4.config.env), ...r4 ? { respond: r4 } : {} } };
5351
+ a4.debug("push", { event: o3.name });
5352
+ const u4 = await ot(n4.push, "TransformerPush", e4.hooks, e4.logger)(o3, c2);
5353
+ return a4.debug("push done"), u4;
5321
5354
  }
5322
5355
  function oe(e4, n4) {
5323
5356
  return e4 ? { ...e4, _meta: { ...e4._meta, path: [...e4._meta.path] } } : E(n4);
5324
5357
  }
5325
- async function se2(e4, n4, t4, o3, s5, r4, i3) {
5326
- s5 || (s5 = E(t4[0] ?? "chain")), i3 && s5._meta && (s5._meta.chainPath = i3);
5327
- let a3 = o3, c2 = r4;
5358
+ async function se2(e4, n4, t4, o3, s5, r4, i2) {
5359
+ s5 || (s5 = E(t4[0] ?? "chain")), i2 && s5._meta && (s5._meta.chainPath = i2);
5360
+ let a4 = o3, c2 = r4;
5328
5361
  for (const o4 of t4) {
5329
5362
  const r5 = n4[o4];
5330
5363
  if (!r5) {
@@ -5333,58 +5366,58 @@ async function se2(e4, n4, t4, o3, s5, r4, i3) {
5333
5366
  }
5334
5367
  if (s5 && s5._meta && s5._meta.path.length > 256) return e4.logger.error(`Max path length exceeded at ${o4}`), { event: null, respond: c2 };
5335
5368
  s5 && s5._meta && (s5._meta.hops++, s5._meta.path.push(o4));
5336
- if (!await De(ne2, (n5) => {
5337
- if (n5 instanceof Ue) throw n5;
5369
+ if (!await Ue(ne2, (n5) => {
5370
+ if (n5 instanceof Fe) throw n5;
5338
5371
  return e4.status.failed++, e4.logger.scope(`transformer:${r5.type || "unknown"}`).error("transformer init failed", { transformer: o4, error: n5 }), false;
5339
5372
  })(e4, r5, o4)) return { event: null, respond: c2 };
5340
- if (i3 && void 0 !== r5.config?.chainMocks?.[i3]) {
5341
- const n5 = r5.config.chainMocks[i3];
5342
- e4.logger.scope(`transformer:${r5.type || "unknown"}`).debug("chainMock", { chain: i3 }), a3 = n5;
5373
+ if (i2 && void 0 !== r5.config?.chainMocks?.[i2]) {
5374
+ const n5 = r5.config.chainMocks[i2];
5375
+ e4.logger.scope(`transformer:${r5.type || "unknown"}`).debug("chainMock", { chain: i2 }), a4 = n5;
5343
5376
  continue;
5344
5377
  }
5345
5378
  if (void 0 !== r5.config?.mock) {
5346
- e4.logger.scope(`transformer:${r5.type || "unknown"}`).debug("mock"), a3 = r5.config.mock;
5379
+ e4.logger.scope(`transformer:${r5.type || "unknown"}`).debug("mock"), a4 = r5.config.mock;
5347
5380
  continue;
5348
5381
  }
5349
5382
  if (r5.config?.disabled) continue;
5350
- const u4 = r5.config?.cache, l2 = u4 ? St(u4) : void 0, f3 = l2 ? Q2(l2, e4) : void 0;
5383
+ const u4 = r5.config?.cache, l2 = u4 ? Nt(u4) : void 0, f3 = l2 ? Q2(l2, e4) : void 0;
5351
5384
  let d2;
5352
5385
  if (l2 && f3) {
5353
- const e5 = Ot(s5, a3), n5 = await Et(l2, f3, e5);
5386
+ const e5 = _t(s5, a4), n5 = await Ct(l2, f3, e5);
5354
5387
  if ("HIT" === n5?.status && n5.value) {
5355
- if (a3 = n5.value, l2.stop) return { event: a3, respond: c2, stopped: true };
5388
+ if (a4 = n5.value, l2.stop) return { event: a4, respond: c2, stopped: true };
5356
5389
  continue;
5357
5390
  }
5358
5391
  "MISS" === n5?.status && (d2 = { key: n5.key, ttl: n5.rule.ttl });
5359
5392
  }
5360
5393
  const g3 = r5.config.before;
5361
5394
  if (g3) {
5362
- const t5 = xt(g3, Ot(s5, a3));
5395
+ const t5 = St(g3, _t(s5, a4));
5363
5396
  if (1 === t5.length) {
5364
5397
  const o5 = ee2(t5[0], X2(n4));
5365
5398
  if (o5.length > 0) {
5366
- const t6 = await se2(e4, n4, o5, a3, s5, c2, i3);
5399
+ const t6 = await se2(e4, n4, o5, a4, s5, c2, i2);
5367
5400
  if (null === t6.event) return { event: null, respond: t6.respond ?? c2 };
5368
5401
  if (t6.stopped) return { event: Array.isArray(t6.event) ? t6.event[0] : t6.event, respond: t6.respond ?? c2, stopped: true };
5369
- t6.respond && (c2 = t6.respond), a3 = Array.isArray(t6.event) ? t6.event[0] : t6.event;
5402
+ t6.respond && (c2 = t6.respond), a4 = Array.isArray(t6.event) ? t6.event[0] : t6.event;
5370
5403
  }
5371
- } else t5.length > 1 && await Promise.all(t5.map((t6) => De(se2, (n5) => (e4.logger.scope("transformer:many").error(`many branch ${t6} failed`, { error: n5 }), { event: null, respond: void 0 }))(e4, n4, ee2(t6, X2(n4)), a3, oe(s5, t6), void 0, i3)));
5404
+ } else t5.length > 1 && await Promise.all(t5.map((t6) => Ue(se2, (n5) => (e4.logger.scope("transformer:many").error(`many branch ${t6} failed`, { error: n5 }), { event: null, respond: void 0 }))(e4, n4, ee2(t6, X2(n4)), a4, oe(s5, t6), void 0, i2)));
5372
5405
  }
5373
- const p2 = await De(te, (n5) => (e4.logger.scope(`transformer:${r5.type || "unknown"}`).error("Push failed", { error: n5 }), false))(e4, r5, o4, a3, s5, c2);
5406
+ const p2 = await Ue(te, (n5) => (e4.logger.scope(`transformer:${r5.type || "unknown"}`).error("Push failed", { error: n5 }), false))(e4, r5, o4, a4, s5, c2);
5374
5407
  if (false === p2) return { event: null, respond: c2 };
5375
5408
  if (Array.isArray(p2)) {
5376
5409
  const r6 = t4.slice(t4.indexOf(o4) + 1), u5 = await Promise.all(p2.map(async (t5) => {
5377
- const o5 = t5.event || a3, u6 = oe(s5, "unknown");
5410
+ const o5 = t5.event || a4, u6 = oe(s5, "unknown");
5378
5411
  if (t5.next) {
5379
- const s6 = xt(t5.next, Ot(u6, o5));
5412
+ const s6 = St(t5.next, _t(u6, o5));
5380
5413
  if (0 === s6.length) return { event: o5, respond: c2 };
5381
5414
  if (1 === s6.length) {
5382
5415
  const t6 = ee2(s6[0], X2(n4));
5383
- return t6.length > 0 ? se2(e4, n4, t6, o5, u6, c2, i3) : { event: o5, respond: c2 };
5416
+ return t6.length > 0 ? se2(e4, n4, t6, o5, u6, c2, i2) : { event: o5, respond: c2 };
5384
5417
  }
5385
- return (await Promise.all(s6.map((t6) => De(se2, (n5) => (e4.logger.scope("transformer:many").error(`many branch ${t6} failed`, { error: n5 }), { event: null, respond: void 0 }))(e4, n4, ee2(t6, X2(n4)), o5, oe(u6, t6), void 0, i3)))).map((e5) => ({ event: e5.event, respond: void 0 }));
5418
+ return (await Promise.all(s6.map((t6) => Ue(se2, (n5) => (e4.logger.scope("transformer:many").error(`many branch ${t6} failed`, { error: n5 }), { event: null, respond: void 0 }))(e4, n4, ee2(t6, X2(n4)), o5, oe(u6, t6), void 0, i2)))).map((e5) => ({ event: e5.event, respond: void 0 }));
5386
5419
  }
5387
- return r6.length > 0 ? se2(e4, n4, r6, o5, u6, c2, i3) : { event: o5, respond: c2 };
5420
+ return r6.length > 0 ? se2(e4, n4, r6, o5, u6, c2, i2) : { event: o5, respond: c2 };
5388
5421
  }));
5389
5422
  let l3 = c2;
5390
5423
  const f4 = [];
@@ -5398,45 +5431,45 @@ async function se2(e4, n4, t4, o3, s5, r4, i3) {
5398
5431
  if (p2 && "object" == typeof p2) {
5399
5432
  const { event: t5, respond: o5, next: r6 } = p2;
5400
5433
  if (o5 && (c2 = o5), void 0 !== r6) {
5401
- const o6 = xt(r6, Ot(s5, a3));
5434
+ const o6 = St(r6, _t(s5, a4));
5402
5435
  if (0 === o6.length) {
5403
- t5 && (a3 = t5);
5436
+ t5 && (a4 = t5);
5404
5437
  continue;
5405
5438
  }
5406
5439
  if (1 === o6.length) {
5407
5440
  const u5 = ee2(o6[0], X2(n4));
5408
- return u5.length > 0 ? se2(e4, n4, u5, t5 || a3, s5, c2, i3) : (e4.logger.warn(`Branch target not found: ${JSON.stringify(r6)}`), { event: null, respond: c2 });
5441
+ return u5.length > 0 ? se2(e4, n4, u5, t5 || a4, s5, c2, i2) : (e4.logger.warn(`Branch target not found: ${JSON.stringify(r6)}`), { event: null, respond: c2 });
5409
5442
  }
5410
- return await Promise.all(o6.map((o7) => De(se2, (n5) => (e4.logger.scope("transformer:many").error(`many branch ${o7} failed`, { error: n5 }), { event: null, respond: void 0 }))(e4, n4, ee2(o7, X2(n4)), t5 || a3, oe(s5, o7), void 0, i3))), { event: null, respond: void 0 };
5443
+ return await Promise.all(o6.map((o7) => Ue(se2, (n5) => (e4.logger.scope("transformer:many").error(`many branch ${o7} failed`, { error: n5 }), { event: null, respond: void 0 }))(e4, n4, ee2(o7, X2(n4)), t5 || a4, oe(s5, o7), void 0, i2))), { event: null, respond: void 0 };
5411
5444
  }
5412
- t5 && (a3 = t5);
5445
+ t5 && (a4 = t5);
5413
5446
  }
5414
- d2 && f3 && _t(f3, d2.key, a3, d2.ttl);
5447
+ d2 && f3 && Tt(f3, d2.key, a4, d2.ttl);
5415
5448
  const h3 = r5.config.next, m3 = "string" == typeof h3 || Array.isArray(h3) && h3.every((e5) => "string" == typeof e5), y2 = void 0 !== h3 && !m3;
5416
5449
  if ((!p2 || "object" == typeof p2 && !p2.next) && y2) {
5417
- const t5 = xt(r5.config.next, Ot(s5, a3));
5450
+ const t5 = St(r5.config.next, _t(s5, a4));
5418
5451
  if (1 === t5.length) {
5419
5452
  const o5 = ee2(t5[0], X2(n4));
5420
- return o5.length > 0 ? se2(e4, n4, o5, a3, s5, c2, i3) : { event: a3, respond: c2 };
5453
+ return o5.length > 0 ? se2(e4, n4, o5, a4, s5, c2, i2) : { event: a4, respond: c2 };
5421
5454
  }
5422
- return t5.length > 1 ? (await Promise.all(t5.map((t6) => De(se2, (n5) => (e4.logger.scope("transformer:many").error(`many branch ${t6} failed`, { error: n5 }), { event: null, respond: void 0 }))(e4, n4, ee2(t6, X2(n4)), a3, oe(s5, t6), void 0, i3))), { event: null, respond: void 0 }) : { event: a3, respond: c2 };
5455
+ return t5.length > 1 ? (await Promise.all(t5.map((t6) => Ue(se2, (n5) => (e4.logger.scope("transformer:many").error(`many branch ${t6} failed`, { error: n5 }), { event: null, respond: void 0 }))(e4, n4, ee2(t6, X2(n4)), a4, oe(s5, t6), void 0, i2))), { event: null, respond: void 0 }) : { event: a4, respond: c2 };
5423
5456
  }
5424
5457
  }
5425
- return { event: a3, respond: c2 };
5458
+ return { event: a4, respond: c2 };
5426
5459
  }
5427
5460
  function re2(e4) {
5428
5461
  return e4 && le(e4) ? e4 : {};
5429
5462
  }
5430
- function ie(e4) {
5463
+ function ie2(e4) {
5431
5464
  return "string" == typeof e4 || !(!Array.isArray(e4) || !e4.every((e5) => "string" == typeof e5));
5432
5465
  }
5433
- async function ae2(e4, n4, t4) {
5466
+ async function ae(e4, n4, t4) {
5434
5467
  if (!n4.on || !n4.queueOn?.length) return;
5435
5468
  const o3 = n4.queueOn;
5436
5469
  n4.queueOn = [];
5437
5470
  const s5 = t4 || n4.config?.id || "unknown";
5438
- for (const { type: t5, data: r4 } of o3) await De(n4.on, (n5) => {
5439
- if (n5 instanceof Ue) throw n5;
5471
+ for (const { type: t5, data: r4 } of o3) await Ue(n4.on, (n5) => {
5472
+ if (n5 instanceof Fe) throw n5;
5440
5473
  e4.status.failed++, e4.logger.scope("source").error("source on flush failed", { sourceId: s5, type: t5, error: n5 });
5441
5474
  })(t5, r4);
5442
5475
  }
@@ -5444,10 +5477,10 @@ function ce2(e4) {
5444
5477
  return Boolean(e4.config.init) && !e4.config.require?.length;
5445
5478
  }
5446
5479
  async function ue2(e4, n4, t4) {
5447
- const { code: o3, config: s5 = {}, env: r4 = {}, primary: i3, next: a3, before: c2, cache: u4 } = t4, l2 = u4, f3 = l2 ? St({ ...l2, stop: l2.stop ?? true }) : void 0, d2 = ie(a3) ? ee2(a3, X2(e4.transformers)) : void 0, g3 = ie(c2) ? ee2(c2, X2(e4.transformers)) : void 0, p2 = r4.push, h3 = p2 ?? e4.push, m3 = Boolean(p2), y2 = async (t5, o4, r5) => {
5448
- let i4;
5480
+ const { code: o3, config: s5 = {}, env: r4 = {}, primary: i2, next: a4, before: c2, cache: u4 } = t4, l2 = u4, f3 = l2 ? Nt({ ...l2, stop: l2.stop ?? true }) : void 0, d2 = ie2(a4) ? ee2(a4, X2(e4.transformers)) : void 0, g3 = ie2(c2) ? ee2(c2, X2(e4.transformers)) : void 0, p2 = r4.push, h3 = p2 ?? e4.push, m3 = Boolean(p2), y2 = async (t5, o4, r5) => {
5481
+ let i3;
5449
5482
  const u5 = g3 ?? (void 0 !== c2 ? (() => {
5450
- const n5 = xt(c2, Ot(r5.ingest));
5483
+ const n5 = St(c2, _t(r5.ingest));
5451
5484
  if (0 === n5.length) return [];
5452
5485
  return ee2(1 === n5.length ? n5[0] : n5, X2(e4.transformers));
5453
5486
  })() : []);
@@ -5461,36 +5494,36 @@ async function ue2(e4, n4, t4) {
5461
5494
  if (f3) {
5462
5495
  const n5 = Q2(f3, e4);
5463
5496
  if (n5) {
5464
- const t6 = Ot(r5.ingest), o5 = await Et(f3, n5, t6);
5497
+ const t6 = _t(r5.ingest), o5 = await Ct(f3, n5, t6);
5465
5498
  if (o5) {
5466
5499
  if ("HIT" === o5.status && void 0 !== o5.value && f3.stop) {
5467
5500
  let n6 = o5.value;
5468
- return o5.rule.update && (n6 = await Nt(n6, o5.rule.update, { ...t6, cache: { status: "HIT" } }, e4)), r5.respond?.(n6), { ok: true };
5501
+ return o5.rule.update && (n6 = await It(n6, o5.rule.update, { ...t6, cache: { status: "HIT" } }, e4)), r5.respond?.(n6), { ok: true };
5469
5502
  }
5470
5503
  if ("MISS" === o5.status && f3.stop && r5.respond) {
5471
- const s6 = r5.respond, a4 = o5.rule.update, c3 = { ...t6, cache: { status: "MISS" } }, u6 = o5.key, l4 = o5.rule.ttl, f4 = (t7) => {
5472
- _t(n5, u6, t7, l4), a4 ? i4 = (async () => {
5473
- const n6 = await Nt(t7, a4, c3, e4);
5504
+ const s6 = r5.respond, a5 = o5.rule.update, c3 = { ...t6, cache: { status: "MISS" } }, u6 = o5.key, l4 = o5.rule.ttl, f4 = (t7) => {
5505
+ Tt(n5, u6, t7, l4), a5 ? i3 = (async () => {
5506
+ const n6 = await It(t7, a5, c3, e4);
5474
5507
  s6(n6);
5475
5508
  })() : s6(t7);
5476
5509
  };
5477
5510
  r5.respond = f4;
5478
5511
  }
5479
- "MISS" !== o5.status || f3.stop || _t(n5, o5.key, true, o5.rule.ttl);
5512
+ "MISS" !== o5.status || f3.stop || Tt(n5, o5.key, true, o5.rule.ttl);
5480
5513
  }
5481
5514
  }
5482
5515
  }
5483
- const p3 = d2 ? { kind: "single", preChain: d2 } : void 0 !== a3 ? (() => {
5484
- const n5 = xt(a3, Ot(r5.ingest));
5516
+ const p3 = d2 ? { kind: "single", preChain: d2 } : void 0 !== a4 ? (() => {
5517
+ const n5 = St(a4, _t(r5.ingest));
5485
5518
  return 0 === n5.length ? { kind: "single", preChain: [] } : 1 === n5.length ? { kind: "single", preChain: ee2(n5[0], X2(e4.transformers)) } : { kind: "many", branches: n5.map((n6) => ee2(n6, X2(e4.transformers))) };
5486
5519
  })() : { kind: "single", preChain: [] };
5487
5520
  let y3 = { ok: true };
5488
- for (const t6 of l3) "many" === p3.kind ? (await Promise.all(p3.branches.map((i5, a4) => De(async () => m3 ? h3(t6) : h3(t6, { ...o4, id: n4, ingest: oe(r5.ingest, `${n4}.${a4}`), respond: void 0, mapping: s5, preChain: i5 }), (n5) => (e4.logger.scope("source:many").error(`many branch ${a4} failed`, { error: n5 }), { ok: true }))())), y3 = { ok: true }) : y3 = m3 ? await h3(t6) : await h3(t6, { ...o4, id: n4, ingest: r5.ingest, respond: r5.respond, mapping: s5, preChain: p3.preChain });
5489
- return i4 && await i4, y3;
5521
+ for (const t6 of l3) "many" === p3.kind ? (await Promise.all(p3.branches.map((i4, a5) => Ue(async () => m3 ? h3(t6) : h3(t6, { ...o4, id: n4, ingest: oe(r5.ingest, `${n4}.${a5}`), respond: void 0, mapping: s5, preChain: i4 }), (n5) => (e4.logger.scope("source:many").error(`many branch ${a5} failed`, { error: n5 }), { ok: true }))())), y3 = { ok: true }) : y3 = m3 ? await h3(t6) : await h3(t6, { ...o4, id: n4, ingest: r5.ingest, respond: r5.respond, mapping: s5, preChain: p3.preChain });
5522
+ return i3 && await i3, y3;
5490
5523
  }, v3 = async (t5) => {
5491
5524
  const o4 = E(n4);
5492
5525
  if (!s5.ingest || void 0 === t5) return o4;
5493
- const r5 = await We(t5, s5.ingest, { collector: e4 });
5526
+ const r5 = await He(t5, s5.ingest, { collector: e4 });
5494
5527
  return { ...o4, ...r5, _meta: o4._meta };
5495
5528
  }, w3 = e4.logger.scope("source").scope(n4), b3 = { command: e4.command, sources: e4.sources, elb: e4.sources.elb.push, logger: w3, ...r4, push: async (e5, t5 = {}) => {
5496
5529
  const o4 = { ingest: E(n4), respond: void 0 };
@@ -5498,13 +5531,13 @@ async function ue2(e4, n4, t4) {
5498
5531
  } }, k2 = { collector: e4, logger: w3, id: n4, config: s5, env: b3, withScope: async (e5, n5, t5) => {
5499
5532
  const o4 = { ingest: await v3(e5), respond: n5 };
5500
5533
  return t5({ ...b3, push: (e6, n6 = {}) => y2(e6, n6, o4), ingest: o4.ingest, respond: o4.respond });
5501
- } }, C3 = await De(o3, (t5) => {
5502
- if (t5 instanceof Ue) throw t5;
5534
+ } }, C3 = await Ue(o3, (t5) => {
5535
+ if (t5 instanceof Fe) throw t5;
5503
5536
  e4.status.failed++, e4.logger.scope("source").error("source factory failed", { sourceId: n4, error: t5 });
5504
5537
  })(k2);
5505
5538
  if (!C3) return;
5506
5539
  const q3 = C3.type || "unknown", x2 = e4.logger.scope(q3).scope(n4);
5507
- return b3.logger = x2, i3 && (C3.config = { ...C3.config, primary: i3 }), C3;
5540
+ return b3.logger = x2, i2 && (C3.config = { ...C3.config, primary: i2 }), C3;
5508
5541
  }
5509
5542
  async function le2(e4, n4 = {}) {
5510
5543
  const t4 = {};
@@ -5518,15 +5551,15 @@ async function le2(e4, n4 = {}) {
5518
5551
  for (const n5 of Object.keys(t4)) {
5519
5552
  const t5 = e4.sources[n5];
5520
5553
  let o3 = false;
5521
- t5.init && await De(t5.init.bind(t5), (t6) => {
5522
- if (t6 instanceof Ue) throw t6;
5554
+ t5.init && await Ue(t5.init.bind(t5), (t6) => {
5555
+ if (t6 instanceof Fe) throw t6;
5523
5556
  o3 = true, e4.status.failed++, e4.logger.scope("source").error("source init failed", { sourceId: n5, error: t6 });
5524
- })(), o3 || (t5.config.init = true, ce2(t5) && await ae2(e4, t5, n5));
5557
+ })(), o3 || (t5.config.init = true, ce2(t5) && await ae(e4, t5, n5));
5525
5558
  }
5526
5559
  return t4;
5527
5560
  }
5528
5561
  function fe2(e4, n4, t4, o3) {
5529
- if (t4 instanceof Ue) throw t4;
5562
+ if (t4 instanceof Fe) throw t4;
5530
5563
  e4.logger.scope("on").error("on callback failed", { kind: n4, ...o3, error: t4 });
5531
5564
  }
5532
5565
  function de2(e4, n4) {
@@ -5536,14 +5569,14 @@ async function ge2(e4, n4, t4) {
5536
5569
  const o3 = e4.on, s5 = o3[n4] || [], r4 = ne(t4) ? t4 : [t4];
5537
5570
  r4.forEach((e5) => {
5538
5571
  s5.push(e5);
5539
- }), o3[n4] = s5, he(e4, n4, r4);
5572
+ }), o3[n4] = s5, he2(e4, n4, r4);
5540
5573
  }
5541
5574
  function pe2(e4, n4, t4, o3, s5) {
5542
5575
  if (!n4.on) return;
5543
- const r4 = n4.type || "unknown", i3 = e4.logger.scope(r4).scope("on").scope(o3), a3 = { collector: e4, logger: i3, id: t4, config: n4.config, data: s5, env: De2(n4.env, n4.config.env) };
5544
- Ze(n4.on, (n5) => fe2(e4, "destination", n5, { destId: t4, type: o3 }))(o3, a3);
5576
+ const r4 = n4.type || "unknown", i2 = e4.logger.scope(r4).scope("on").scope(o3), a4 = { collector: e4, logger: i2, id: t4, config: n4.config, data: s5, env: De2(n4.env, n4.config.env) };
5577
+ De(n4.on, (n5) => fe2(e4, "destination", n5, { destId: t4, type: o3 }))(o3, a4);
5545
5578
  }
5546
- function he(e4, n4, o3, s5) {
5579
+ function he2(e4, n4, o3, s5) {
5547
5580
  let r4;
5548
5581
  switch (n4) {
5549
5582
  case t2.Commands.Consent:
@@ -5575,7 +5608,7 @@ function he(e4, n4, o3, s5) {
5575
5608
  const s6 = o4 || e5.consent, r5 = de2(e5, t2.Commands.Consent);
5576
5609
  n5.forEach((n6) => {
5577
5610
  Object.keys(s6).filter((e6) => e6 in n6).forEach((t4) => {
5578
- Ze(n6[t4], (n7) => fe2(e5, "consent", n7, { key: t4 }))(s6, r5);
5611
+ De(n6[t4], (n7) => fe2(e5, "consent", n7, { key: t4 }))(s6, r5);
5579
5612
  });
5580
5613
  });
5581
5614
  })(e4, o3, s5);
@@ -5585,7 +5618,7 @@ function he(e4, n4, o3, s5) {
5585
5618
  if (!e5.allowed) return;
5586
5619
  const o4 = de2(e5, t2.Commands.Ready);
5587
5620
  n5.forEach((n6) => {
5588
- Ze(n6, (n7) => fe2(e5, "ready", n7))(void 0, o4);
5621
+ De(n6, (n7) => fe2(e5, "ready", n7))(void 0, o4);
5589
5622
  });
5590
5623
  })(e4, o3);
5591
5624
  break;
@@ -5594,7 +5627,7 @@ function he(e4, n4, o3, s5) {
5594
5627
  if (!e5.allowed) return;
5595
5628
  const o4 = de2(e5, t2.Commands.Run);
5596
5629
  n5.forEach((n6) => {
5597
- Ze(n6, (n7) => fe2(e5, "run", n7))(void 0, o4);
5630
+ De(n6, (n7) => fe2(e5, "run", n7))(void 0, o4);
5598
5631
  });
5599
5632
  })(e4, o3);
5600
5633
  break;
@@ -5603,22 +5636,22 @@ function he(e4, n4, o3, s5) {
5603
5636
  if (!e5.session) return;
5604
5637
  const o4 = de2(e5, t2.Commands.Session);
5605
5638
  n5.forEach((n6) => {
5606
- Ze(n6, (n7) => fe2(e5, "session", n7))(e5.session, o4);
5639
+ De(n6, (n7) => fe2(e5, "session", n7))(e5.session, o4);
5607
5640
  });
5608
5641
  })(e4, o3);
5609
5642
  break;
5610
5643
  default: {
5611
5644
  const t4 = de2(e4, n4);
5612
5645
  o3.forEach((o4) => {
5613
- "function" == typeof o4 && Ze(o4, (t5) => fe2(e4, "generic", t5, { type: n4 }))(r4, t4);
5646
+ "function" == typeof o4 && De(o4, (t5) => fe2(e4, "generic", t5, { type: n4 }))(r4, t4);
5614
5647
  });
5615
5648
  break;
5616
5649
  }
5617
5650
  }
5618
5651
  }
5619
5652
  async function me2(e4, n4, o3, s5) {
5620
- let r4, i3 = o3 || [];
5621
- switch (o3 || (i3 = e4.on[n4] || []), n4) {
5653
+ let r4, i2 = o3 || [];
5654
+ switch (o3 || (i2 = e4.on[n4] || []), n4) {
5622
5655
  case t2.Commands.Consent:
5623
5656
  r4 = s5 || e4.consent;
5624
5657
  break;
@@ -5642,14 +5675,14 @@ async function me2(e4, n4, o3, s5) {
5642
5675
  default:
5643
5676
  r4 = void 0;
5644
5677
  }
5645
- let a3 = false;
5678
+ let a4 = false;
5646
5679
  for (const [t4, o4] of Object.entries(e4.sources)) {
5647
5680
  if (o4.config.require?.length) {
5648
5681
  const e5 = o4.config.require.indexOf(n4);
5649
5682
  -1 !== e5 && o4.config.require.splice(e5, 1);
5650
5683
  }
5651
5684
  if (o4.on) if (ce2(o4)) {
5652
- false === await De(o4.on, (o5) => fe2(e4, "source", o5, { sourceId: t4, type: n4 }))(n4, r4) && (a3 = true);
5685
+ false === await Ue(o4.on, (o5) => fe2(e4, "source", o5, { sourceId: t4, type: n4 }))(n4, r4) && (a4 = true);
5653
5686
  } else o4.queueOn = o4.queueOn || [], o4.queueOn.push({ type: n4, data: r4 });
5654
5687
  }
5655
5688
  Object.entries(e4.destinations).forEach(([t4, o4]) => {
@@ -5658,7 +5691,7 @@ async function me2(e4, n4, o3, s5) {
5658
5691
  pe2(e4, o4, t4, n4, r4);
5659
5692
  }
5660
5693
  });
5661
- for (const [n5, t4] of Object.entries(e4.sources)) ce2(t4) && t4.queueOn?.length && await ae2(e4, t4, n5);
5694
+ for (const [n5, t4] of Object.entries(e4.sources)) ce2(t4) && t4.queueOn?.length && await ae(e4, t4, n5);
5662
5695
  return Object.keys(e4.pending.destinations).length > 0 && await (async function(e5, n5) {
5663
5696
  for (const [t4, o4] of Object.entries(e5.pending.destinations)) {
5664
5697
  if (!e5.pending.destinations[t4] || e5.destinations[t4]) continue;
@@ -5668,10 +5701,10 @@ async function me2(e4, n4, o3, s5) {
5668
5701
  if (-1 === r5) continue;
5669
5702
  if (s6.splice(r5, 1), s6.length > 0) continue;
5670
5703
  delete e5.pending.destinations[t4];
5671
- const i4 = Ie2(o4);
5672
- false !== i4.config.queue && (i4.queuePush = [...e5.queue]), e5.destinations[t4] = i4;
5704
+ const i3 = Ie2(o4);
5705
+ false !== i3.config.queue && (i3.queuePush = [...e5.queue]), e5.destinations[t4] = i3;
5673
5706
  }
5674
- })(e4, n4), he(e4, n4, i3, s5), !a3;
5707
+ })(e4, n4), he2(e4, n4, i2, s5), !a4;
5675
5708
  }
5676
5709
  function ye2(e4, n4, t4, o3) {
5677
5710
  if (!Number.isFinite(t4.max) || t4.max <= 0) throw new Error(`pushBounded: max must be > 0 (got ${t4.max})`);
@@ -5680,16 +5713,16 @@ function ye2(e4, n4, t4, o3) {
5680
5713
  for (; e4.length >= t4.max; ) s5.push(e4.shift());
5681
5714
  return e4.push(n4), s5.length > 0 && o3 && o3(s5), { appended: true, dropped: s5.length };
5682
5715
  }
5683
- var ve2 = /* @__PURE__ */ new WeakMap();
5716
+ var ve = /* @__PURE__ */ new WeakMap();
5684
5717
  function we(e4, n4, t4, o3) {
5685
- ve2.get(e4) || (ve2.set(e4, true), n4.warn(t4, o3));
5718
+ ve.get(e4) || (ve.set(e4, true), n4.warn(t4, o3));
5686
5719
  }
5687
- function be(e4) {
5688
- ve2.delete(e4);
5720
+ function be2(e4) {
5721
+ ve.delete(e4);
5689
5722
  }
5690
- var ke2 = Object.freeze({ batched: true });
5723
+ var ke = Object.freeze({ batched: true });
5691
5724
  function Ce2(e4) {
5692
- return e4 === ke2;
5725
+ return e4 === ke;
5693
5726
  }
5694
5727
  function qe(e4) {
5695
5728
  return void 0 === e4 ? {} : "number" == typeof e4 ? { wait: e4 } : { wait: e4.wait, size: e4.size, age: e4.age };
@@ -5706,24 +5739,24 @@ function je2(e4, n4, t4) {
5706
5739
  if (!e4) return [];
5707
5740
  if (Array.isArray(e4) && e4.every((e5) => "string" == typeof e5)) return ee2(e4, n4);
5708
5741
  if ("string" == typeof e4) return ee2(e4, n4);
5709
- const o3 = xt(e4, Ot(t4));
5742
+ const o3 = St(e4, _t(t4));
5710
5743
  return 0 === o3.length ? [] : 1 === o3.length ? ee2(o3[0], n4) : ee2(o3, n4);
5711
5744
  }
5712
- async function Ae(e4, n4) {
5713
- const { code: t4, config: o3 = {}, env: s5 = {}, before: r4, next: i3, cache: a3 } = n4;
5745
+ async function Ae2(e4, n4) {
5746
+ const { code: t4, config: o3 = {}, env: s5 = {}, before: r4, next: i2, cache: a4 } = n4;
5714
5747
  if (!se(t4.push)) return Ee2({ ok: false, failed: { invalid: { type: "invalid", error: "Destination code must have a push method" } } });
5715
5748
  const c2 = o3 || { init: false };
5716
5749
  let u4 = r4 ? { ...c2, before: r4 } : { ...c2 };
5717
- i3 && (u4 = { ...u4, next: i3 }), a3 && (u4 = { ...u4, cache: a3 });
5750
+ i2 && (u4 = { ...u4, next: i2 }), a4 && (u4 = { ...u4, cache: a4 });
5718
5751
  const l2 = { ...t4, config: u4, env: De2(t4.env, s5) };
5719
5752
  let f3 = l2.config.id;
5720
5753
  if (!f3) do {
5721
- f3 = xe(5, "abcdefghijklmnopqrstuvwxyz");
5754
+ f3 = Ae(5, "abcdefghijklmnopqrstuvwxyz");
5722
5755
  } while (e4.destinations[f3]);
5723
- return e4.destinations[f3] = l2, false !== l2.config.queue && (l2.queuePush = [...e4.queue]), Se2(e4, void 0, {}, { [f3]: l2 });
5756
+ return e4.destinations[f3] = l2, false !== l2.config.queue && (l2.queuePush = [...e4.queue]), Se(e4, void 0, {}, { [f3]: l2 });
5724
5757
  }
5725
- async function Se2(e4, n4, t4 = {}, o3) {
5726
- const { allowed: s5, consent: r4, globals: i3, user: p2 } = e4;
5758
+ async function Se(e4, n4, t4 = {}, o3) {
5759
+ const { allowed: s5, consent: r4, globals: i2, user: p2 } = e4;
5727
5760
  if (!s5) return Ee2({ ok: false });
5728
5761
  if (n4) {
5729
5762
  const t5 = e4.config.queueMax;
@@ -5732,7 +5765,7 @@ async function Se2(e4, n4, t4 = {}, o3) {
5732
5765
  if (o4.dropped > 0) {
5733
5766
  const n5 = Oe(e4.status, o("collector"), "queue", o4.dropped);
5734
5767
  we(e4.queue, e4.logger, "collector.queue overflow; oldest events dropped", { buffer: "queue", cap: t5, droppedCount: n5 });
5735
- } else e4.queue.length < t5 && be(e4.queue);
5768
+ } else e4.queue.length < t5 && be2(e4.queue);
5736
5769
  e4.status.in++;
5737
5770
  }
5738
5771
  o3 || (o3 = e4.destinations);
@@ -5754,20 +5787,20 @@ async function Se2(e4, n4, t4 = {}, o3) {
5754
5787
  return { id: o4, destination: s6, skipped: !n5 };
5755
5788
  }
5756
5789
  const w4 = [], b4 = y3.filter((e5) => {
5757
- const n5 = ve(s6.config.consent, r4, e5.consent);
5790
+ const n5 = be(s6.config.consent, r4, e5.consent);
5758
5791
  return !n5 || (e5.consent = n5, w4.push(e5), false);
5759
5792
  });
5760
5793
  if (b4.length > 0) {
5761
5794
  const n5 = s6.queuePush, t5 = s6.config.id || o4, r5 = { max: s6.config.queueMax ?? 1e3 };
5762
- let i4 = 0;
5795
+ let i3 = 0;
5763
5796
  for (const e5 of b4) {
5764
- i4 += ye2(n5, e5, r5).dropped;
5797
+ i3 += ye2(n5, e5, r5).dropped;
5765
5798
  }
5766
- if (i4 > 0) {
5799
+ if (i3 > 0) {
5767
5800
  xe2(e4, t5);
5768
- const o5 = Oe(e4.status, o("destination", t5), "queue", i4);
5801
+ const o5 = Oe(e4.status, o("destination", t5), "queue", i3);
5769
5802
  we(n5, e4.logger.scope(s6.type || "unknown"), "destination.queuePush overflow; oldest events dropped", { buffer: "queuePush", destination: t5, cap: r5.max, droppedCount: o5 });
5770
- } else n5.length < r5.max && be(n5);
5803
+ } else n5.length < r5.max && be2(n5);
5771
5804
  }
5772
5805
  if (!w4.length) return { id: o4, destination: s6, queue: y3 };
5773
5806
  let k2, x2, O2 = false;
@@ -5780,12 +5813,12 @@ async function Se2(e4, n4, t4 = {}, o3) {
5780
5813
  }
5781
5814
  if (!O2) return { id: o4, destination: s6, queue: y3 };
5782
5815
  s6.dlq || (s6.dlq = []);
5783
- const j2 = je2(s6.config.before, h3, v4), A2 = s6.config.next, S2 = s6.config?.cache, $2 = S2 ? St(S2) : void 0, _2 = $2 ? Q2($2, e4) : void 0;
5816
+ const j2 = je2(s6.config.before, h3, v4), A2 = s6.config.next, S2 = s6.config?.cache, $2 = S2 ? Nt(S2) : void 0, _2 = $2 ? Q2($2, e4) : void 0;
5784
5817
  let E3 = 0, I3 = 0;
5785
5818
  return await Promise.all(w4.map(async (n5) => {
5786
5819
  let r5;
5787
- if (n5.globals = ee(i3, n5.globals), n5.user = ee(p2, n5.user), $2?.stop && _2) {
5788
- const e5 = Ot(v4, n5), t5 = await Et($2, _2, e5);
5820
+ if (n5.globals = ee(i2, n5.globals), n5.user = ee(p2, n5.user), $2?.stop && _2) {
5821
+ const e5 = _t(v4, n5), t5 = await Ct($2, _2, e5);
5789
5822
  if ("HIT" === t5?.status) return n5;
5790
5823
  "MISS" === t5?.status && (r5 = { key: t5.key, ttl: t5.rule.ttl });
5791
5824
  }
@@ -5796,23 +5829,23 @@ async function Se2(e4, n4, t4 = {}, o3) {
5796
5829
  s7.respond && (l2 = s7.respond), u4 = Array.isArray(s7.event) ? s7.event[0] : s7.event;
5797
5830
  }
5798
5831
  if ($2 && !$2.stop && _2) {
5799
- const e5 = Ot(v4, u4), t5 = await Et($2, _2, e5);
5832
+ const e5 = _t(v4, u4), t5 = await Ct($2, _2, e5);
5800
5833
  if ("HIT" === t5?.status) return n5;
5801
5834
  "MISS" === t5?.status && (r5 = { key: t5.key, ttl: t5.rule.ttl });
5802
5835
  }
5803
5836
  const g3 = Date.now();
5804
5837
  let m3 = false;
5805
- const y4 = await De(_e, (n6) => {
5838
+ const y4 = await Ue(_e2, (n6) => {
5806
5839
  const t5 = s6.type || "unknown";
5807
5840
  e4.logger.scope(t5).error("Push failed", { error: n6, event: u4.name }), k2 = n6, m3 = true;
5808
- const r6 = s6.dlq, i4 = s6.config.id || o4, a3 = { max: s6.config.dlqMax ?? 100 }, c2 = ye2(r6, [u4, n6], a3);
5841
+ const r6 = s6.dlq, i3 = s6.config.id || o4, a4 = { max: s6.config.dlqMax ?? 100 }, c2 = ye2(r6, [u4, n6], a4);
5809
5842
  if (c2.dropped > 0) {
5810
- xe2(e4, i4);
5811
- const n7 = Oe(e4.status, o("destination", i4), "dlq", c2.dropped);
5812
- we(r6, e4.logger.scope(s6.type || "unknown"), "destination.dlq overflow; oldest entries dropped", { buffer: "dlq", destination: i4, cap: a3.max, droppedCount: n7 });
5813
- } else r6.length < a3.max && be(r6);
5843
+ xe2(e4, i3);
5844
+ const n7 = Oe(e4.status, o("destination", i3), "dlq", c2.dropped);
5845
+ we(r6, e4.logger.scope(s6.type || "unknown"), "destination.dlq overflow; oldest entries dropped", { buffer: "dlq", destination: i3, cap: a4.max, droppedCount: n7 });
5846
+ } else r6.length < a4.max && be2(r6);
5814
5847
  })(e4, s6, o4, u4, v4, l2);
5815
- if (E3 += Date.now() - g3, r5 && _2 && void 0 === s6.config.mock && _t(_2, r5.key, y4 ?? true, r5.ttl), void 0 === y4 || Ce2(y4) || (x2 = y4), Ce2(y4) && I3++, !m3 && A2) {
5848
+ if (E3 += Date.now() - g3, r5 && _2 && void 0 === s6.config.mock && Tt(_2, r5.key, y4 ?? true, r5.ttl), void 0 === y4 || Ce2(y4) || (x2 = y4), Ce2(y4) && I3++, !m3 && A2) {
5816
5849
  void 0 !== y4 && (v4._response = y4);
5817
5850
  const n6 = je2(A2, h3, v4);
5818
5851
  if (n6.length > 0 && e4.transformers && Object.keys(e4.transformers).length > 0) {
@@ -5831,8 +5864,8 @@ async function Se2(e4, n4, t4 = {}, o3) {
5831
5864
  if (s6.queuePushSize = t5.queuePush?.length ?? 0, s6.dlqSize = t5.dlq?.length ?? 0, n5.error) o4.error = n5.error, b3[n5.id] = o4, s6.failed++, s6.lastAt = r5, s6.duration += n5.totalDuration || 0, e4.status.failed++;
5832
5865
  else if (n5.queue && n5.queue.length) w3[n5.id] = o4;
5833
5866
  else {
5834
- const t6 = n5.batchedCount ?? 0, i4 = n5.allowedCount ?? 0;
5835
- (Math.max(0, i4 - t6) > 0 || 0 === i4) && (v3[n5.id] = o4, s6.count++, s6.lastAt = r5, s6.duration += n5.totalDuration || 0, e4.status.out++);
5867
+ const t6 = n5.batchedCount ?? 0, i3 = n5.allowedCount ?? 0;
5868
+ (Math.max(0, i3 - t6) > 0 || 0 === i3) && (v3[n5.id] = o4, s6.count++, s6.lastAt = r5, s6.duration += n5.totalDuration || 0, e4.status.out++);
5836
5869
  }
5837
5870
  }
5838
5871
  return Ee2({ event: n4, ...Object.keys(v3).length && { done: v3 }, ...Object.keys(w3).length && { queued: w3 }, ...Object.keys(b3).length && { failed: b3 } });
@@ -5841,9 +5874,9 @@ async function $e2(e4, n4, t4) {
5841
5874
  if (n4.init && !n4.config.init) {
5842
5875
  const o3 = n4.type || "unknown", s5 = e4.logger.scope(o3), r4 = { collector: e4, logger: s5, id: t4, config: n4.config, env: De2(n4.env, n4.config.env) };
5843
5876
  s5.debug("init");
5844
- const i3 = await tt(n4.init, "DestinationInit", e4.hooks, e4.logger)(r4);
5845
- if (false === i3) return i3;
5846
- if (n4.config = { ...i3 || n4.config, init: true }, n4.queueOn?.length) {
5877
+ const i2 = await ot(n4.init, "DestinationInit", e4.hooks, e4.logger)(r4);
5878
+ if (false === i2) return i2;
5879
+ if (n4.config = { ...i2 || n4.config, init: true }, n4.queueOn?.length) {
5847
5880
  const o4 = n4.queueOn;
5848
5881
  n4.queueOn = [];
5849
5882
  for (const { type: s6, data: r5 } of o4) pe2(e4, n4, t4, s6, r5);
@@ -5852,37 +5885,37 @@ async function $e2(e4, n4, t4) {
5852
5885
  }
5853
5886
  return true;
5854
5887
  }
5855
- async function _e(e4, n4, t4, o3, s5, r4) {
5856
- const { config: i3 } = n4, a3 = await Le(o3, i3, e4);
5857
- if (a3.ignore) return false;
5858
- const c2 = n4.type || "unknown", u4 = e4.logger.scope(c2), l2 = { collector: e4, logger: u4, id: t4, config: i3, data: a3.data, rule: a3.mapping, ingest: s5, env: { ...De2(n4.env, i3.env), ...r4 ? { respond: r4 } : {} } };
5859
- if (void 0 !== i3.mock) return u4.debug("mock", { event: a3.event.name }), i3.mock;
5860
- const f3 = a3.mapping, d2 = a3.mappingKey || "* *";
5861
- if (f3?.batch && n4.pushBatch && void 0 === i3.mock) {
5888
+ async function _e2(e4, n4, t4, o3, s5, r4) {
5889
+ const { config: i2 } = n4, a4 = await Ve(o3, i2, e4);
5890
+ if (a4.ignore) return false;
5891
+ const c2 = n4.type || "unknown", u4 = e4.logger.scope(c2), l2 = { collector: e4, logger: u4, id: t4, config: i2, data: a4.data, rule: a4.mapping, ingest: s5, env: { ...De2(n4.env, i2.env), ...r4 ? { respond: r4 } : {} } };
5892
+ if (void 0 !== i2.mock) return u4.debug("mock", { event: a4.event.name }), i2.mock;
5893
+ const f3 = a4.mapping, d2 = a4.mappingKey || "* *";
5894
+ if (f3?.batch && n4.pushBatch && void 0 === i2.mock) {
5862
5895
  if (n4.batches = n4.batches || {}, !n4.batches[d2]) {
5863
- const o5 = { key: d2, entries: [], events: [], data: [] }, s6 = qe(f3.batch), r5 = qe(i3.batch), a4 = s6.wait ?? r5.wait ?? 3e4, c4 = s6.size ?? r5.size ?? 1e3, l4 = s6.age ?? r5.age ?? 3e4, g3 = De2(n4.env, i3.env), h3 = Ee(async () => {
5896
+ const o5 = { key: d2, entries: [], events: [], data: [] }, s6 = qe(f3.batch), r5 = qe(i2.batch), a5 = s6.wait ?? r5.wait ?? 3e4, c4 = s6.size ?? r5.size ?? 1e3, l4 = s6.age ?? r5.age ?? 3e4, g3 = De2(n4.env, i2.env), h3 = _e(async () => {
5864
5897
  const o6 = n4.batches[d2].batched;
5865
5898
  if (0 === o6.entries.length) return;
5866
5899
  const s7 = { key: o6.key, entries: o6.entries, events: o6.events, data: o6.data };
5867
5900
  o6.entries = [], o6.events = [], o6.data = [];
5868
- const r6 = s7.entries[0], a5 = { collector: e4, logger: u4, id: t4, config: i3, data: void 0, rule: r6.rule, ingest: r6.ingest, env: { ...g3, ...r6.respond ? { respond: r6.respond } : {} } };
5901
+ const r6 = s7.entries[0], a6 = { collector: e4, logger: u4, id: t4, config: i2, data: void 0, rule: r6.rule, ingest: r6.ingest, env: { ...g3, ...r6.respond ? { respond: r6.respond } : {} } };
5869
5902
  u4.debug("push batch", { events: s7.entries.length });
5870
5903
  const c5 = n4.config.id || t4, l5 = xe2(e4, c5);
5871
5904
  let f4 = true;
5872
- await De(tt(n4.pushBatch, "DestinationPushBatch", e4.hooks, e4.logger), (t5) => {
5905
+ await Ue(ot(n4.pushBatch, "DestinationPushBatch", e4.hooks, e4.logger), (t5) => {
5873
5906
  f4 = false;
5874
5907
  const o7 = n4.dlq = n4.dlq || [], r7 = { max: n4.config.dlqMax ?? 100 };
5875
- let i4 = 0;
5908
+ let i3 = 0;
5876
5909
  for (const e5 of s7.entries) {
5877
- i4 += ye2(o7, [e5.event, t5], r7).dropped;
5910
+ i3 += ye2(o7, [e5.event, t5], r7).dropped;
5878
5911
  }
5879
- if (i4 > 0) {
5880
- const n5 = Oe(e4.status, o("destination", c5), "dlq", i4);
5912
+ if (i3 > 0) {
5913
+ const n5 = Oe(e4.status, o("destination", c5), "dlq", i3);
5881
5914
  we(o7, u4, "destination.dlq overflow; oldest entries dropped", { buffer: "dlq", destination: c5, cap: r7.max, droppedCount: n5 });
5882
- } else o7.length < r7.max && be(o7);
5915
+ } else o7.length < r7.max && be2(o7);
5883
5916
  l5.failed += s7.entries.length, l5.dlqSize = o7.length, e4.status.failed += s7.entries.length, u4.error("Push batch failed", { error: t5 instanceof Error ? t5.message : String(t5), entries: s7.entries.length });
5884
- })(s7, a5), u4.debug("push batch done"), l5.inFlightBatch = Math.max(0, (l5.inFlightBatch ?? 0) - s7.entries.length), f4 && (l5.count += s7.entries.length, l5.lastAt = Date.now(), e4.status.out += s7.entries.length);
5885
- }, { wait: a4, size: c4, age: l4 });
5917
+ })(s7, a6), u4.debug("push batch done"), l5.inFlightBatch = Math.max(0, (l5.inFlightBatch ?? 0) - s7.entries.length), f4 && (l5.count += s7.entries.length, l5.lastAt = Date.now(), e4.status.out += s7.entries.length);
5918
+ }, { wait: a5, size: c4, age: l4 });
5886
5919
  n4.batches[d2] = { batched: o5, batchFn: () => {
5887
5920
  h3();
5888
5921
  }, flush: async () => {
@@ -5890,13 +5923,13 @@ async function _e(e4, n4, t4, o3, s5, r4) {
5890
5923
  } };
5891
5924
  }
5892
5925
  const o4 = n4.batches[d2];
5893
- o4.batched.entries.push({ event: a3.event, ingest: s5, respond: r4, rule: f3, data: a3.data }), o4.batched.events.push(a3.event), ae(a3.data) && o4.batched.data.push(a3.data);
5926
+ o4.batched.entries.push({ event: a4.event, ingest: s5, respond: r4, rule: f3, data: a4.data }), o4.batched.events.push(a4.event), ie(a4.data) && o4.batched.data.push(a4.data);
5894
5927
  const c3 = n4.config.id || t4, l3 = xe2(e4, c3);
5895
- return l3.inFlightBatch = (l3.inFlightBatch ?? 0) + 1, o4.batchFn(), ke2;
5928
+ return l3.inFlightBatch = (l3.inFlightBatch ?? 0) + 1, o4.batchFn(), ke;
5896
5929
  }
5897
5930
  {
5898
- u4.debug("push", { event: a3.event.name });
5899
- const t5 = await tt(n4.push, "DestinationPush", e4.hooks, e4.logger)(a3.event, l2);
5931
+ u4.debug("push", { event: a4.event.name });
5932
+ const t5 = await ot(n4.push, "DestinationPush", e4.hooks, e4.logger)(a4.event, l2);
5900
5933
  return u4.debug("push done"), t5;
5901
5934
  }
5902
5935
  }
@@ -5904,10 +5937,10 @@ function Ee2(e4) {
5904
5937
  return { ok: !e4?.failed, ...e4 };
5905
5938
  }
5906
5939
  function Ie2(e4) {
5907
- const { code: n4, config: t4 = {}, env: o3 = {}, cache: s5 } = e4, { config: r4 } = Z2(e4, "before"), { config: i3 } = Z2({ ...e4, config: r4 }, "next"), a3 = { ...n4.config, ...t4, ...i3 };
5908
- s5 && (a3.cache = s5);
5940
+ const { code: n4, config: t4 = {}, env: o3 = {}, cache: s5 } = e4, { config: r4 } = Z2(e4, "before"), { config: i2 } = Z2({ ...e4, config: r4 }, "next"), a4 = { ...n4.config, ...t4, ...i2 };
5941
+ s5 && (a4.cache = s5);
5909
5942
  const c2 = De2(n4.env, o3);
5910
- return { ...n4, config: a3, env: c2 };
5943
+ return { ...n4, config: a4, env: c2 };
5911
5944
  }
5912
5945
  async function Pe2(e4, n4 = {}) {
5913
5946
  const t4 = {};
@@ -5921,40 +5954,40 @@ async function He2(e4, n4, t4) {
5921
5954
  const o3 = Object.entries(e4).map(async ([e5, o4]) => {
5922
5955
  const s5 = o4.destroy;
5923
5956
  if (!s5) return;
5924
- const r4 = o4.type || "unknown", i3 = t4.scope(r4), a3 = { id: e5, config: o4.config, env: o4.env ?? {}, logger: i3 };
5957
+ const r4 = o4.type || "unknown", i2 = t4.scope(r4), a4 = { id: e5, config: o4.config, env: o4.env ?? {}, logger: i2 };
5925
5958
  try {
5926
- await Promise.race([s5(a3), new Promise((t5, o5) => setTimeout(() => o5(new Error(`${n4} '${e5}' destroy timed out`)), 5e3))]);
5959
+ await Promise.race([s5(a4), new Promise((t5, o5) => setTimeout(() => o5(new Error(`${n4} '${e5}' destroy timed out`)), 5e3))]);
5927
5960
  } catch (t5) {
5928
- i3.error(`${n4} '${e5}' destroy failed: ${t5}`);
5961
+ i2.error(`${n4} '${e5}' destroy failed: ${t5}`);
5929
5962
  }
5930
5963
  });
5931
5964
  await Promise.allSettled(o3);
5932
5965
  }
5933
5966
  async function Fe2(e4, n4, o3) {
5934
- let r4, i3, a3 = false;
5967
+ let r4, i2, a4 = false;
5935
5968
  switch (n4) {
5936
5969
  case t2.Commands.Config:
5937
- le(o3) && (ee(e4.config, o3, { shallow: false }), i3 = o3, a3 = true);
5970
+ le(o3) && (ee(e4.config, o3, { shallow: false }), i2 = o3, a4 = true);
5938
5971
  break;
5939
5972
  case t2.Commands.Consent:
5940
5973
  if (le(o3)) {
5941
5974
  const { update: n5 } = s2(e4, o3);
5942
- i3 = n5, a3 = true;
5975
+ i2 = n5, a4 = true;
5943
5976
  }
5944
5977
  break;
5945
5978
  case t2.Commands.Custom:
5946
- le(o3) && (e4.custom = ee(e4.custom, o3), i3 = o3, a3 = true);
5979
+ le(o3) && (e4.custom = ee(e4.custom, o3), i2 = o3, a4 = true);
5947
5980
  break;
5948
5981
  case t2.Commands.Destination:
5949
- le(o3) && "code" in o3 && le(o3.code) && (r4 = await Ae(e4, o3));
5982
+ le(o3) && "code" in o3 && le(o3.code) && (r4 = await Ae2(e4, o3));
5950
5983
  break;
5951
5984
  case t2.Commands.Globals:
5952
- le(o3) && (e4.globals = ee(e4.globals, o3), i3 = o3, a3 = true);
5985
+ le(o3) && (e4.globals = ee(e4.globals, o3), i2 = o3, a4 = true);
5953
5986
  break;
5954
5987
  case t2.Commands.Hook:
5955
5988
  if (le(o3) && fe(o3.name) && se(o3.fn)) {
5956
5989
  const { name: n5, fn: t4 } = o3;
5957
- e4.hooks[n5] = t4, i3 = o3, a3 = true;
5990
+ e4.hooks[n5] = t4, i2 = o3, a4 = true;
5958
5991
  }
5959
5992
  break;
5960
5993
  case t2.Commands.On:
@@ -5964,13 +5997,13 @@ async function Fe2(e4, n4, o3) {
5964
5997
  }
5965
5998
  break;
5966
5999
  case t2.Commands.Ready:
5967
- a3 = true;
6000
+ a4 = true;
5968
6001
  break;
5969
6002
  case t2.Commands.Run:
5970
- r4 = await We2(e4, o3), a3 = true;
6003
+ r4 = await We2(e4, o3), a4 = true;
5971
6004
  break;
5972
6005
  case t2.Commands.Session:
5973
- a3 = true;
6006
+ a4 = true;
5974
6007
  break;
5975
6008
  case t2.Commands.Shutdown:
5976
6009
  await (async function(e5) {
@@ -5979,36 +6012,36 @@ async function Fe2(e4, n4, o3) {
5979
6012
  })(e4);
5980
6013
  break;
5981
6014
  case t2.Commands.User:
5982
- le(o3) && (ee(e4.user, o3, { shallow: false }), i3 = o3, a3 = true);
6015
+ le(o3) && (ee(e4.user, o3, { shallow: false }), i2 = o3, a4 = true);
5983
6016
  }
5984
- return a3 && (await me2(e4, n4, void 0, i3), r4 = await Se2(e4)), r4 || Ee2({ ok: true });
6017
+ return a4 && (await me2(e4, n4, void 0, i2), r4 = await Se(e4)), r4 || Ee2({ ok: true });
5985
6018
  }
5986
6019
  function Ge(e4, n4) {
5987
6020
  if (!n4.name) throw new Error("Event name is required");
5988
6021
  const [t4, o3] = n4.name.split(" ");
5989
6022
  if (!t4 || !o3) throw new Error("Event name is invalid");
5990
- const { timestamp: s5 = Date.now(), name: r4 = `${t4} ${o3}`, data: i3 = {}, context: a3 = {}, globals: c2 = e4.globals, custom: u4 = {}, user: l2 = e4.user, nested: f3 = [], consent: d2 = e4.consent, id: g3 = ke(), trigger: p2 = "", entity: h3 = t4, action: m3 = o3, timing: y2 = 0, source: v3 = { type: "collector", schema: "4" } } = n4;
5991
- return { name: r4, data: i3, context: a3, globals: c2, custom: u4, user: l2, nested: f3, consent: d2, id: g3, trigger: p2, entity: h3, action: m3, timestamp: s5, timing: y2, source: v3 };
6023
+ const { timestamp: s5 = Date.now(), name: r4 = `${t4} ${o3}`, data: i2 = {}, context: a4 = {}, globals: c2 = e4.globals, custom: u4 = {}, user: l2 = e4.user, nested: f3 = [], consent: d2 = e4.consent, id: g3 = $e(), trigger: p2 = "", entity: h3 = t4, action: m3 = o3, timing: y2 = 0, source: v3 = { type: "collector", schema: "4" } } = n4;
6024
+ return { name: r4, data: i2, context: a4, globals: c2, custom: u4, user: l2, nested: f3, consent: d2, id: g3, trigger: p2, entity: h3, action: m3, timestamp: s5, timing: y2, source: v3 };
5992
6025
  }
5993
6026
  async function We2(e4, n4) {
5994
6027
  e4.allowed = true, e4.timing = Date.now(), n4 && (n4.consent && (e4.consent = ee(e4.consent, n4.consent)), n4.user && (e4.user = ee(e4.user, n4.user)), n4.globals && (e4.globals = ee(e4.config.globalsStatic || {}, n4.globals)), n4.custom && (e4.custom = ee(e4.custom, n4.custom))), Object.values(e4.destinations).forEach((e5) => {
5995
6028
  e5.queuePush = [];
5996
6029
  }), e4.queue = [], e4.round++;
5997
- return await Se2(e4);
6030
+ return await Se(e4);
5998
6031
  }
5999
6032
  function Je(e4, n4) {
6000
- return tt(async (t4, o3 = {}) => await De(async () => {
6001
- const s5 = Date.now(), { id: r4, ingest: i3, respond: a3, mapping: c2, preChain: u4, include: l2, exclude: f3 } = o3;
6002
- let d2 = a3, g3 = t4;
6033
+ return ot(async (t4, o3 = {}) => await Ue(async () => {
6034
+ const s5 = Date.now(), { id: r4, ingest: i2, respond: a4, mapping: c2, preChain: u4, include: l2, exclude: f3 } = o3;
6035
+ let d2 = a4, g3 = t4;
6003
6036
  const p2 = l2 || f3 ? (function(e5, n5, t5) {
6004
6037
  let o4 = e5;
6005
6038
  return n5 && (o4 = Object.fromEntries(Object.entries(o4).filter(([e6]) => n5.includes(e6)))), t5 && (o4 = Object.fromEntries(Object.entries(o4).filter(([e6]) => !t5.includes(e6)))), o4;
6006
- })(e4.destinations, l2, f3) : void 0, h3 = i3 ?? E(r4 || "unknown");
6039
+ })(e4.destinations, l2, f3) : void 0, h3 = i2 ?? E(r4 || "unknown");
6007
6040
  if (c2) {
6008
- const n5 = await Le(g3, c2, e4);
6041
+ const n5 = await Ve(g3, c2, e4);
6009
6042
  if (n5.ignore) return Ee2({ ok: true });
6010
6043
  if (c2.consent) {
6011
- if (!ve(c2.consent, e4.consent, n5.event.consent)) return Ee2({ ok: true });
6044
+ if (!be(c2.consent, e4.consent, n5.event.consent)) return Ee2({ ok: true });
6012
6045
  }
6013
6046
  g3 = n5.event;
6014
6047
  }
@@ -6019,7 +6052,7 @@ function Je(e4, n4) {
6019
6052
  if (t5.respond && (d2 = t5.respond), Array.isArray(t5.event)) {
6020
6053
  const o4 = await Promise.all(t5.event.map(async (t6) => {
6021
6054
  const o5 = n4(t6), s6 = Ge(e4, o5);
6022
- return Se2(e4, s6, { id: r4, ingest: h3, respond: d2 }, p2);
6055
+ return Se(e4, s6, { id: r4, ingest: h3, respond: d2 }, p2);
6023
6056
  }));
6024
6057
  if (r4) {
6025
6058
  e4.status.sources[r4] || (e4.status.sources[r4] = { count: 0, duration: 0 });
@@ -6030,7 +6063,7 @@ function Je(e4, n4) {
6030
6063
  }
6031
6064
  g3 = t5.event;
6032
6065
  }
6033
- const m3 = n4(g3), y2 = Ge(e4, m3), v3 = await Se2(e4, y2, { id: r4, ingest: h3, respond: d2 }, p2);
6066
+ const m3 = n4(g3), y2 = Ge(e4, m3), v3 = await Se(e4, y2, { id: r4, ingest: h3, respond: d2 }, p2);
6034
6067
  if (r4) {
6035
6068
  e4.status.sources[r4] || (e4.status.sources[r4] = { count: 0, duration: 0 });
6036
6069
  const n5 = e4.status.sources[r4];
@@ -6038,26 +6071,26 @@ function Je(e4, n4) {
6038
6071
  }
6039
6072
  return v3;
6040
6073
  }, (n5) => {
6041
- if (n5 instanceof Ue) throw n5;
6074
+ if (n5 instanceof Fe) throw n5;
6042
6075
  return e4.status.failed++, e4.logger.error("push failed", { event: t4, ingest: o3.ingest, error: n5 }), Ee2({ ok: false });
6043
6076
  })(), "Push", e4.hooks, e4.logger);
6044
6077
  }
6045
6078
  function nn(e4 = {}) {
6046
- const n4 = e4.maxEntries ?? 1e4, t4 = e4.lowWaterMark ?? 0.8, o3 = e4.sweepIntervalMs ?? 6e4, s5 = Math.floor(n4 * t4), r4 = /* @__PURE__ */ new Map(), i3 = { hits: 0, misses: 0, populates: 0, writes: 0, deletes: 0, evictions_entries: 0, evictions_ttl: 0 };
6047
- let a3;
6048
- o3 > 0 && (a3 = setInterval(function() {
6079
+ const n4 = e4.maxEntries ?? 1e4, t4 = e4.lowWaterMark ?? 0.8, o3 = e4.sweepIntervalMs ?? 6e4, s5 = Math.floor(n4 * t4), r4 = /* @__PURE__ */ new Map(), i2 = { hits: 0, misses: 0, populates: 0, writes: 0, deletes: 0, evictions_entries: 0, evictions_ttl: 0 };
6080
+ let a4;
6081
+ o3 > 0 && (a4 = setInterval(function() {
6049
6082
  const e5 = Date.now();
6050
6083
  let n5 = 0;
6051
6084
  for (const [t5, o4] of r4) void 0 !== o4.expires && o4.expires <= e5 && (r4.delete(t5), n5++);
6052
- i3.evictions_ttl += n5;
6053
- }, o3), a3 && "function" == typeof a3.unref && a3.unref());
6085
+ i2.evictions_ttl += n5;
6086
+ }, o3), a4 && "function" == typeof a4.unref && a4.unref());
6054
6087
  return { type: "memory", config: {}, get(e5) {
6055
6088
  const n5 = r4.get(e5);
6056
- if (n5) return void 0 !== n5.expires && n5.expires <= Date.now() ? (r4.delete(e5), i3.evictions_ttl++, void i3.misses++) : (r4.delete(e5), r4.set(e5, n5), i3.hits++, n5.value);
6057
- i3.misses++;
6089
+ if (n5) return void 0 !== n5.expires && n5.expires <= Date.now() ? (r4.delete(e5), i2.evictions_ttl++, void i2.misses++) : (r4.delete(e5), r4.set(e5, n5), i2.hits++, n5.value);
6090
+ i2.misses++;
6058
6091
  }, set(e5, t5, o4) {
6059
- const a4 = !r4.has(e5);
6060
- a4 || r4.delete(e5), r4.set(e5, { value: t5, expires: void 0 !== o4 ? Date.now() + o4 : void 0 }), i3.writes++, a4 && i3.populates++, r4.size > n4 && (function() {
6092
+ const a5 = !r4.has(e5);
6093
+ a5 || r4.delete(e5), r4.set(e5, { value: t5, expires: void 0 !== o4 ? Date.now() + o4 : void 0 }), i2.writes++, a5 && i2.populates++, r4.size > n4 && (function() {
6061
6094
  if (r4.size <= n4) return;
6062
6095
  const e6 = r4.size - s5;
6063
6096
  let t6 = 0;
@@ -6065,38 +6098,38 @@ function nn(e4 = {}) {
6065
6098
  if (t6 >= e6) break;
6066
6099
  r4.delete(n5), t6++;
6067
6100
  }
6068
- i3.evictions_entries += t6;
6101
+ i2.evictions_entries += t6;
6069
6102
  })();
6070
6103
  }, delete(e5) {
6071
- r4.delete(e5) && i3.deletes++;
6104
+ r4.delete(e5) && i2.deletes++;
6072
6105
  }, get counters() {
6073
- return { ...i3 };
6106
+ return { ...i2 };
6074
6107
  }, destroy() {
6075
- void 0 !== a3 && (clearInterval(a3), a3 = void 0), r4.clear();
6108
+ void 0 !== a4 && (clearInterval(a4), a4 = void 0), r4.clear();
6076
6109
  } };
6077
6110
  }
6078
6111
  function on(e4, n4) {
6079
- const { cacheConfig: t4, cacheStore: o3, namespace: s5, logger: r4, storeId: i3 } = n4, a3 = { hits: 0, misses: 0, populates: 0, writes: 0, deletes: 0, inflight_dedups: 0 }, c2 = t4.rules.map((e5) => ({ match: e5.match ? bt(e5.match) : () => true, ttl: e5.ttl })), u4 = (e5) => `${s5}:${e5}`;
6112
+ const { cacheConfig: t4, cacheStore: o3, namespace: s5, logger: r4, storeId: i2 } = n4, a4 = { hits: 0, misses: 0, populates: 0, writes: 0, deletes: 0, inflight_dedups: 0 }, c2 = t4.rules.map((e5) => ({ match: e5.match ? $t(e5.match) : () => true, ttl: e5.ttl })), u4 = (e5) => `${s5}:${e5}`;
6080
6113
  function l2(e5, n5) {
6081
6114
  const t5 = void 0 === n5 ? { key: e5 } : { key: e5, value: n5 };
6082
6115
  return c2.find((e6) => e6.match(t5));
6083
6116
  }
6084
6117
  const f3 = /* @__PURE__ */ new Map();
6085
6118
  return { type: e4.type, config: e4.config, setup: e4.setup, get counters() {
6086
- return { ...a3 };
6119
+ return { ...a4 };
6087
6120
  }, async get(n5) {
6088
6121
  const t5 = u4(n5), s6 = await o3.get(t5);
6089
- if (void 0 !== s6) return a3.hits++, s6;
6122
+ if (void 0 !== s6) return a4.hits++, s6;
6090
6123
  const r5 = f3.get(t5);
6091
- if (r5) return a3.inflight_dedups++, r5;
6092
- a3.misses++;
6093
- const i4 = (async () => {
6124
+ if (r5) return a4.inflight_dedups++, r5;
6125
+ a4.misses++;
6126
+ const i3 = (async () => {
6094
6127
  try {
6095
6128
  const s7 = await e4.get(n5);
6096
6129
  if (void 0 === s7) return;
6097
6130
  const r6 = l2(n5, s7);
6098
6131
  if (r6) try {
6099
- await o3.set(t5, s7, 1e3 * r6.ttl), a3.populates++;
6132
+ await o3.set(t5, s7, 1e3 * r6.ttl), a4.populates++;
6100
6133
  } catch (e5) {
6101
6134
  d2("set", n5, e5);
6102
6135
  }
@@ -6105,9 +6138,9 @@ function on(e4, n4) {
6105
6138
  f3.delete(t5);
6106
6139
  }
6107
6140
  })();
6108
- return f3.set(t5, i4), i4;
6141
+ return f3.set(t5, i3), i3;
6109
6142
  }, async set(n5, t5, s6) {
6110
- a3.writes++, await e4.set(n5, t5, s6);
6143
+ a4.writes++, await e4.set(n5, t5, s6);
6111
6144
  const r5 = l2(n5, t5);
6112
6145
  if (r5) try {
6113
6146
  await o3.set(u4(n5), t5, 1e3 * r5.ttl);
@@ -6115,7 +6148,7 @@ function on(e4, n4) {
6115
6148
  d2("set", n5, e5);
6116
6149
  }
6117
6150
  }, async delete(n5) {
6118
- a3.deletes++, await e4.delete(n5);
6151
+ a4.deletes++, await e4.delete(n5);
6119
6152
  try {
6120
6153
  await o3.delete(u4(n5));
6121
6154
  } catch (e5) {
@@ -6123,18 +6156,18 @@ function on(e4, n4) {
6123
6156
  }
6124
6157
  } };
6125
6158
  function d2(e5, n5, t5) {
6126
- const o4 = `store-cache(${i3}): cache ${e5} failed for "${n5}"; backing succeeded, continuing`;
6159
+ const o4 = `store-cache(${i2}): cache ${e5} failed for "${n5}"; backing succeeded, continuing`;
6127
6160
  r4 ? r4.warn(o4, { error: t5 }) : console.warn(o4, t5);
6128
6161
  }
6129
6162
  }
6130
6163
  function sn(e4, n4) {
6131
6164
  const t4 = n4.get, o3 = n4.set, s5 = n4.delete;
6132
- n4.get = tt(t4, "StoreGet", e4.hooks, e4.logger), n4.set = tt(o3, "StoreSet", e4.hooks, e4.logger), n4.delete = tt(s5, "StoreDelete", e4.hooks, e4.logger);
6165
+ n4.get = ot(t4, "StoreGet", e4.hooks, e4.logger), n4.set = ot(o3, "StoreSet", e4.hooks, e4.logger), n4.delete = ot(s5, "StoreDelete", e4.hooks, e4.logger);
6133
6166
  }
6134
6167
  async function rn(e4, n4 = {}) {
6135
6168
  const t4 = {};
6136
6169
  for (const [o4, s6] of Object.entries(n4)) {
6137
- const { code: n5, config: r4 = {}, env: i3 = {} } = s6, a3 = e4.logger.scope("store").scope(o4), c2 = { collector: e4, logger: a3, id: o4, config: r4, env: i3 }, u4 = await n5(c2);
6170
+ const { code: n5, config: r4 = {}, env: i2 = {} } = s6, a4 = e4.logger.scope("store").scope(o4), c2 = { collector: e4, logger: a4, id: o4, config: r4, env: i2 }, u4 = await n5(c2);
6138
6171
  t4[o4] = u4;
6139
6172
  }
6140
6173
  const o3 = n4, s5 = (function(e5) {
@@ -6142,17 +6175,17 @@ async function rn(e4, n4 = {}) {
6142
6175
  for (const t6 of Object.keys(e5)) n5[t6] = "WHITE";
6143
6176
  const t5 = [], o4 = [];
6144
6177
  function s6(r4) {
6145
- const i3 = n5[r4];
6146
- if ("BLACK" === i3) return;
6147
- if ("GRAY" === i3) {
6178
+ const i2 = n5[r4];
6179
+ if ("BLACK" === i2) return;
6180
+ if ("GRAY" === i2) {
6148
6181
  const e6 = o4.indexOf(r4), n6 = o4.slice(-1 === e6 ? 0 : e6).concat(r4).join(" -> ");
6149
6182
  throw new Error(`Cycle in cache.store chain: ${n6}`);
6150
6183
  }
6151
6184
  n5[r4] = "GRAY", o4.push(r4);
6152
- const a3 = e5[r4].cache?.store;
6153
- if (void 0 !== a3) {
6154
- if (!(a3 in e5)) throw new Error(`Store "${r4}" cache.store references "${a3}", which is not declared in flow.stores`);
6155
- s6(a3);
6185
+ const a4 = e5[r4].cache?.store;
6186
+ if (void 0 !== a4) {
6187
+ if (!(a4 in e5)) throw new Error(`Store "${r4}" cache.store references "${a4}", which is not declared in flow.stores`);
6188
+ s6(a4);
6156
6189
  }
6157
6190
  o4.pop(), n5[r4] = "BLACK", t5.push(r4);
6158
6191
  }
@@ -6162,24 +6195,24 @@ async function rn(e4, n4 = {}) {
6162
6195
  for (const n5 of s5) {
6163
6196
  const s6 = o3[n5].cache;
6164
6197
  if (!s6) continue;
6165
- let r4, i3;
6166
- void 0 !== s6.store ? (r4 = t4[s6.store], i3 = s6.store) : (t4.__cache || (t4.__cache = nn()), r4 = t4.__cache, i3 = "__cache");
6167
- const a3 = s6.namespace ?? n5;
6168
- e4.logger.scope("store-cache").scope(n5).info(`store "${n5}" caches with namespace "${a3}:" via ${i3}`), t4[n5] = on(t4[n5], { storeId: n5, cacheConfig: s6, cacheStore: r4, namespace: a3, logger: e4.logger.scope("store-cache").scope(n5) });
6198
+ let r4, i2;
6199
+ void 0 !== s6.store ? (r4 = t4[s6.store], i2 = s6.store) : (t4.__cache || (t4.__cache = nn()), r4 = t4.__cache, i2 = "__cache");
6200
+ const a4 = s6.namespace ?? n5;
6201
+ e4.logger.scope("store-cache").scope(n5).info(`store "${n5}" caches with namespace "${a4}:" via ${i2}`), t4[n5] = on(t4[n5], { storeId: n5, cacheConfig: s6, cacheStore: r4, namespace: a4, logger: e4.logger.scope("store-cache").scope(n5) });
6169
6202
  }
6170
6203
  for (const [n5, o4] of Object.entries(t4)) "__cache" !== n5 && sn(e4, o4);
6171
6204
  return t4;
6172
6205
  }
6173
6206
  async function an(e4) {
6174
- const n4 = ee({ globalsStatic: {}, sessionStatic: {}, run: true, queueMax: 1e3 }, e4, { merge: false, extend: false }), t4 = { level: e4.logger?.level, handler: e4.logger?.handler }, o3 = ze(t4), s5 = { ...n4.globalsStatic, ...e4.globals }, a3 = { allowed: false, config: n4, consent: e4.consent || {}, custom: e4.custom || {}, destinations: {}, transformers: {}, stores: {}, globals: s5, hooks: e4.hooks || {}, logger: o3, on: {}, queue: [], round: 0, session: void 0, status: { startedAt: Date.now(), in: 0, out: 0, failed: 0, sources: {}, destinations: {}, dropped: {} }, timing: Date.now(), user: e4.user || {}, sources: {}, pending: { destinations: {} }, push: void 0, command: void 0 };
6175
- a3.push = Je(a3, (e5) => ({ timing: Math.round((Date.now() - a3.timing) / 10) / 100, source: { type: "collector", schema: "4", version: "4.1.0" }, ...e5 })), a3.command = (function(e5, n5) {
6176
- return tt(async (t5, o4, s6) => await De(async () => await n5(e5, t5, o4, s6), (n6) => {
6177
- if (n6 instanceof Ue) throw n6;
6207
+ const n4 = ee({ globalsStatic: {}, sessionStatic: {}, run: true, queueMax: 1e3 }, e4, { merge: false, extend: false }), t4 = { level: e4.logger?.level, handler: e4.logger?.handler }, o3 = ze(t4), s5 = { ...n4.globalsStatic, ...e4.globals }, a4 = { allowed: false, config: n4, consent: e4.consent || {}, custom: e4.custom || {}, destinations: {}, transformers: {}, stores: {}, globals: s5, hooks: e4.hooks || {}, logger: o3, on: {}, queue: [], round: 0, session: void 0, status: { startedAt: Date.now(), in: 0, out: 0, failed: 0, sources: {}, destinations: {}, dropped: {} }, timing: Date.now(), user: e4.user || {}, sources: {}, pending: { destinations: {} }, push: void 0, command: void 0 };
6208
+ a4.push = Je(a4, (e5) => ({ timing: Math.round((Date.now() - a4.timing) / 10) / 100, source: { type: "collector", schema: "4", version: "4.1.1-next-1779485810490" }, ...e5 })), a4.command = (function(e5, n5) {
6209
+ return ot(async (t5, o4, s6) => await Ue(async () => await n5(e5, t5, o4, s6), (n6) => {
6210
+ if (n6 instanceof Fe) throw n6;
6178
6211
  return e5.status.failed++, e5.logger.error("command failed", { command: t5, data: o4, error: n6 }), Ee2({ ok: false });
6179
6212
  })(), "Command", e5.hooks, e5.logger);
6180
- })(a3, Fe2);
6213
+ })(a4, Fe2);
6181
6214
  const c2 = e4.stores || {};
6182
- return a3.stores = await rn(a3, c2), (function(e5, n5, t5) {
6215
+ return a4.stores = await rn(a4, c2), (function(e5, n5, t5) {
6183
6216
  const o4 = /* @__PURE__ */ new Map();
6184
6217
  for (const [t6, s7] of Object.entries(e5)) n5[t6] && o4.set(s7, n5[t6]);
6185
6218
  if (0 !== o4.size) {
@@ -6193,15 +6226,15 @@ async function an(e4) {
6193
6226
  }
6194
6227
  }
6195
6228
  }
6196
- })(c2, a3.stores, e4), a3.stores.__cache || (a3.stores.__cache = nn()), a3.destinations = await Pe2(a3, e4.destinations || {}), a3.transformers = await (async function(e5, n5 = {}) {
6229
+ })(c2, a4.stores, e4), a4.stores.__cache || (a4.stores.__cache = nn()), a4.destinations = await Pe2(a4, e4.destinations || {}), a4.transformers = await (async function(e5, n5 = {}) {
6197
6230
  const t5 = {};
6198
6231
  for (const [o4, s6] of Object.entries(n5)) {
6199
- const { code: n6, env: r4 = {} } = s6, i3 = Pt(s6, "Transformer");
6200
- if (!i3.ok) {
6201
- e5.logger.warn(`Transformer ${o4} invalid (${i3.code}): ${i3.reason}. Skipping.`);
6232
+ const { code: n6, env: r4 = {} } = s6, i2 = Zt(s6, "Transformer");
6233
+ if (!i2.ok) {
6234
+ e5.logger.warn(`Transformer ${o4} invalid (${i2.code}): ${i2.reason}. Skipping.`);
6202
6235
  continue;
6203
6236
  }
6204
- const { config: a4 } = Z2(s6, "before"), { config: c3 } = Z2({ ...s6, config: a4 }, "next"), u4 = Object.keys(r4).length > 0 ? { ...c3, env: r4 } : c3, { cache: l2 } = s6, f3 = l2 ? { ...u4, cache: l2 } : u4, d2 = e5.logger.scope("transformer").scope(o4), g3 = { collector: e5, logger: d2, id: o4, ingest: E(o4), config: f3, env: r4 }, p2 = n6 ?? ((e6) => {
6237
+ const { config: a5 } = Z2(s6, "before"), { config: c3 } = Z2({ ...s6, config: a5 }, "next"), u4 = Object.keys(r4).length > 0 ? { ...c3, env: r4 } : c3, { cache: l2 } = s6, f3 = l2 ? { ...u4, cache: l2 } : u4, d2 = e5.logger.scope("transformer").scope(o4), g3 = { collector: e5, logger: d2, id: o4, ingest: E(o4), config: f3, env: r4 }, p2 = n6 ?? ((e6) => {
6205
6238
  const n7 = s6.mapping;
6206
6239
  if (n7) {
6207
6240
  const t6 = [];
@@ -6213,7 +6246,7 @@ async function an(e4) {
6213
6246
  }
6214
6247
  }
6215
6248
  return t6.length > 0 && e6.collector.logger.warn(`Transformer ${o4}: \`${t6.join(", ")}\` ignored at transformer position (only event-mutating fields apply).`), { type: "pass", config: e6.config, push: async (t7) => {
6216
- const o5 = await Le(t7, n7, e6.collector);
6249
+ const o5 = await Ve(t7, n7, e6.collector);
6217
6250
  return !o5.ignore && { event: o5.event };
6218
6251
  } };
6219
6252
  }
@@ -6222,7 +6255,7 @@ async function an(e4) {
6222
6255
  void 0 !== s6.before && void 0 === h3.config?.before && (h3.config = { ...h3.config ?? {}, before: s6.before }), void 0 !== s6.next && void 0 === h3.config?.next && (h3.config = { ...h3.config ?? {}, next: s6.next }), t5[o4] = h3;
6223
6256
  }
6224
6257
  return t5;
6225
- })(a3, e4.transformers || {}), a3;
6258
+ })(a4, e4.transformers || {}), a4;
6226
6259
  }
6227
6260
  async function cn(e4) {
6228
6261
  e4 = e4 || {};
@@ -6231,18 +6264,18 @@ async function cn(e4) {
6231
6264
  const t6 = e5.replace("walker ", "");
6232
6265
  return o3.command(t6, n5);
6233
6266
  }
6234
- let i4;
6235
- if ("string" == typeof e5) i4 = { name: e5 }, n5 && "object" == typeof n5 && !Array.isArray(n5) && (i4.data = n5);
6267
+ let i3;
6268
+ if ("string" == typeof e5) i3 = { name: e5 }, n5 && "object" == typeof n5 && !Array.isArray(n5) && (i3.data = n5);
6236
6269
  else {
6237
6270
  if (!e5 || "object" != typeof e5) return Ee2({ ok: false });
6238
- i4 = e5, n5 && "object" == typeof n5 && !Array.isArray(n5) && (i4.data = { ...i4.data || {}, ...n5 });
6271
+ i3 = e5, n5 && "object" == typeof n5 && !Array.isArray(n5) && (i3.data = { ...i3.data || {}, ...n5 });
6239
6272
  }
6240
- return t5 && "object" == typeof t5 && (i4.context = t5), s6 && Array.isArray(s6) && (i4.nested = s6), r5 && "object" == typeof r5 && (i4.custom = r5), o3.push(i4);
6273
+ return t5 && "object" == typeof t5 && (i3.context = t5), s6 && Array.isArray(s6) && (i3.nested = s6), r5 && "object" == typeof r5 && (i3.custom = r5), o3.push(i3);
6241
6274
  } });
6242
6275
  var o3;
6243
6276
  n4.sources.elb = t4, await le2(n4, e4.sources || {});
6244
- const { consent: s5, user: r4, globals: i3, custom: a3 } = e4;
6245
- s5 && await n4.command("consent", s5), r4 && await n4.command("user", r4), i3 && Object.assign(n4.globals, i3), a3 && Object.assign(n4.custom, a3), n4.config.run && await n4.command("run");
6277
+ const { consent: s5, user: r4, globals: i2, custom: a4 } = e4;
6278
+ s5 && await n4.command("consent", s5), r4 && await n4.command("user", r4), i2 && Object.assign(n4.globals, i2), a4 && Object.assign(n4.custom, a4), n4.config.run && await n4.command("run");
6246
6279
  let c2 = t4.push;
6247
6280
  const u4 = Object.values(n4.sources).filter((e5) => "elb" !== e5.type), l2 = u4.find((e5) => e5.config.primary);
6248
6281
  return l2 ? c2 = l2.push : u4.length > 0 && (c2 = u4[0].push), { collector: n4, elb: c2 };
@@ -6260,11 +6293,11 @@ function ln(e4) {
6260
6293
  const t5 = e5.startsWith("call:") ? e5.slice(5) : e5, o4 = t5.split(".");
6261
6294
  let r4 = s5;
6262
6295
  for (let e6 = 0; e6 < o4.length - 1 && null != r4[o4[e6]]; e6++) r4 = r4[o4[e6]];
6263
- const i3 = o4[o4.length - 1];
6264
- if (null == r4 || !(i3 in r4)) continue;
6265
- const a3 = r4[i3];
6266
- "function" == typeof a3 && (r4[i3] = function(...e6) {
6267
- return n4.push({ fn: t5, args: e6, ts: Date.now() }), a3.apply(this, e6);
6296
+ const i2 = o4[o4.length - 1];
6297
+ if (null == r4 || !(i2 in r4)) continue;
6298
+ const a4 = r4[i2];
6299
+ "function" == typeof a4 && (r4[i2] = function(...e6) {
6300
+ return n4.push({ fn: t5, args: e6, ts: Date.now() }), a4.apply(this, e6);
6268
6301
  });
6269
6302
  }
6270
6303
  return { wrappedEnv: s5, calls: n4 };
@@ -6288,15 +6321,15 @@ var simulation = ["sendServer"];
6288
6321
  var step_exports = {};
6289
6322
  __export2(step_exports, { customHeaders: () => customHeaders, customTransform: () => customTransform, fullEvent: () => fullEvent });
6290
6323
  var URL2 = "https://api.example.com/events";
6291
- var fullEvent = { title: "Forward event data", description: "A page view is POSTed to the configured endpoint with the event data serialized as the JSON body.", in: je("page view", { timestamp: 1700000800, data: { title: "Docs", url: "https://example.com/docs" }, source: { type: "express", platform: "server" } }), mapping: { data: "data" }, out: [["sendServer", URL2, JSON.stringify({ title: "Docs", url: "https://example.com/docs" }), { headers: void 0, method: void 0, timeout: void 0 }]] };
6292
- var customHeaders = { title: "Custom headers", description: "A form submission is sent to the API with custom request headers such as an API key for authentication.", in: je("form submit", { timestamp: 1700000801, data: { type: "contact", email: "user@example.com" }, source: { type: "express", platform: "server" } }), mapping: { data: "data" }, out: [["sendServer", URL2, JSON.stringify({ type: "contact", email: "user@example.com" }), { headers: { "X-API-Key": "YOUR_API_KEY" }, method: void 0, timeout: void 0 }]] };
6293
- var customTransform = { title: "Custom payload", description: "An order event is reshaped via a data mapping into a custom JSON payload with renamed fields for the API.", in: je("order complete", { timestamp: 1700000802, data: { id: "ORD-500", total: 199.99, currency: "USD" }, user: { id: "buyer-42" }, source: { type: "express", platform: "server" } }), mapping: { data: { map: { order_id: "data.id", amount: "data.total", currency: "data.currency", customer_id: "user.id", event_type: "name" } } }, out: [["sendServer", URL2, JSON.stringify({ order_id: "ORD-500", amount: 199.99, currency: "USD", customer_id: "buyer-42", event_type: "order complete" }), { headers: void 0, method: void 0, timeout: void 0 }]] };
6294
- var destinationAPI = { type: "api", config: {}, env: { sendServer: a }, async push(event, { config, rule, data, env, logger }) {
6324
+ var fullEvent = { title: "Forward event data", description: "A page view is POSTed to the configured endpoint with the event data serialized as the JSON body.", in: xe("page view", { timestamp: 1700000800, data: { title: "Docs", url: "https://example.com/docs" }, source: { type: "express", platform: "server" } }), mapping: { data: "data" }, out: [["sendServer", URL2, JSON.stringify({ title: "Docs", url: "https://example.com/docs" }), { headers: void 0, method: void 0, timeout: void 0 }]] };
6325
+ var customHeaders = { title: "Custom headers", description: "A form submission is sent to the API with custom request headers such as an API key for authentication.", in: xe("form submit", { timestamp: 1700000801, data: { type: "contact", email: "user@example.com" }, source: { type: "express", platform: "server" } }), mapping: { data: "data" }, out: [["sendServer", URL2, JSON.stringify({ type: "contact", email: "user@example.com" }), { headers: { "X-API-Key": "YOUR_API_KEY" }, method: void 0, timeout: void 0 }]] };
6326
+ var customTransform = { title: "Custom payload", description: "An order event is reshaped via a data mapping into a custom JSON payload with renamed fields for the API.", in: xe("order complete", { timestamp: 1700000802, data: { id: "ORD-500", total: 199.99, currency: "USD" }, user: { id: "buyer-42" }, source: { type: "express", platform: "server" } }), mapping: { data: { map: { order_id: "data.id", amount: "data.total", currency: "data.currency", customer_id: "user.id", event_type: "name" } } }, out: [["sendServer", URL2, JSON.stringify({ order_id: "ORD-500", amount: 199.99, currency: "USD", customer_id: "buyer-42", event_type: "order complete" }), { headers: void 0, method: void 0, timeout: void 0 }]] };
6327
+ var destinationAPI = { type: "api", config: {}, env: { sendServer: a2 }, async push(event, { config, rule, data, env, logger }) {
6295
6328
  const { settings } = config, { url, headers, method, transform, timeout } = settings || {};
6296
6329
  if (!url) return;
6297
- const eventData = ae(data) ? data : event, body = transform ? transform(eventData, config, rule) : JSON.stringify(eventData);
6330
+ const eventData = ie(data) ? data : event, body = transform ? transform(eventData, config, rule) : JSON.stringify(eventData);
6298
6331
  logger?.debug("API destination sending request", { url, method: method || "POST", eventName: event.name });
6299
- const sendServerFn = env?.sendServer || a, response = await sendServerFn(url, body, { headers, method, timeout });
6332
+ const sendServerFn = env?.sendServer || a2, response = await sendServerFn(url, body, { headers, method, timeout });
6300
6333
  logger?.debug("API destination response", { ok: response?.ok });
6301
6334
  } };
6302
6335
 
@@ -6734,7 +6767,7 @@ function installTimerInterception(options = {}) {
6734
6767
  let iterations = 0;
6735
6768
  while (iterations < maxIterations) {
6736
6769
  await drainMicrotasks();
6737
- const ready = Array.from(pending.values()).filter((t4) => !t4.cleared).sort((a3, b3) => a3.delay - b3.delay);
6770
+ const ready = Array.from(pending.values()).filter((t4) => !t4.cleared).sort((a4, b3) => a4.delay - b3.delay);
6738
6771
  if (ready.length === 0) break;
6739
6772
  for (const timer of ready) {
6740
6773
  if (timer.cleared) continue;
@@ -6793,7 +6826,7 @@ function startDrainPump(pending, options = {}) {
6793
6826
  return;
6794
6827
  }
6795
6828
  iterations += 1;
6796
- const snapshot = [...pending.values()].filter((t4) => !t4.cleared).sort((a3, b3) => a3.delay - b3.delay);
6829
+ const snapshot = [...pending.values()].filter((t4) => !t4.cleared).sort((a4, b3) => a4.delay - b3.delay);
6797
6830
  for (const timer of snapshot) {
6798
6831
  pending.delete(timer.id);
6799
6832
  try {
@@ -6818,7 +6851,14 @@ function startDrainPump(pending, options = {}) {
6818
6851
  }
6819
6852
 
6820
6853
  // src/commands/push/flow-context.ts
6821
- async function withFlowContext(options, fn2) {
6854
+ function defaultPushError(error, startTime) {
6855
+ return {
6856
+ success: false,
6857
+ duration: Date.now() - startTime,
6858
+ error: getErrorMessage(error)
6859
+ };
6860
+ }
6861
+ async function withFlowContext(options, fn2, onError) {
6822
6862
  const {
6823
6863
  esmPath,
6824
6864
  platform,
@@ -6910,11 +6950,7 @@ async function withFlowContext(options, fn2) {
6910
6950
  }
6911
6951
  return await fn2(flowModule);
6912
6952
  } catch (error) {
6913
- return {
6914
- success: false,
6915
- duration: Date.now() - startTime,
6916
- error: getErrorMessage(error)
6917
- };
6953
+ return (onError ?? defaultPushError)(error, startTime);
6918
6954
  } finally {
6919
6955
  if (timerControl) timerControl.restore();
6920
6956
  if (savedFetch !== void 0) {
@@ -6976,6 +7012,28 @@ function cleanupNetworkPolyfills(savedFetch) {
6976
7012
  global.fetch = savedFetch;
6977
7013
  }
6978
7014
 
7015
+ // src/commands/push/simulation-result.ts
7016
+ init_utils2();
7017
+ function hasEvent(entry) {
7018
+ return entry.event != null;
7019
+ }
7020
+ function toError(error) {
7021
+ return error instanceof Error ? error : new Error(getErrorMessage(error));
7022
+ }
7023
+ function buildSimulationResult(args) {
7024
+ const { step, name, startTime, captured, usage, error } = args;
7025
+ const events = (captured ?? []).filter(hasEvent).map((entry) => entry.event);
7026
+ const calls = usage ? Object.values(usage).flat().map((call) => ({ fn: call.fn, args: call.args, ts: call.ts })) : [];
7027
+ return {
7028
+ step,
7029
+ name,
7030
+ events,
7031
+ calls,
7032
+ duration: Date.now() - startTime,
7033
+ ...error !== void 0 ? { error: toError(error) } : {}
7034
+ };
7035
+ }
7036
+
6979
7037
  // src/commands/push/prepare.ts
6980
7038
  init_dist();
6981
7039
  init_cli_logger();
@@ -7079,6 +7137,13 @@ function dispatchSimulate(flags) {
7079
7137
  // src/commands/push/run.ts
7080
7138
  init_core();
7081
7139
  init_config();
7140
+ function simulationToPushResult(result) {
7141
+ return {
7142
+ success: !result.error,
7143
+ duration: result.duration,
7144
+ ...result.error ? { error: result.error.message } : {}
7145
+ };
7146
+ }
7082
7147
  async function runPushCommand(options) {
7083
7148
  const startTime = Date.now();
7084
7149
  try {
@@ -7109,26 +7174,30 @@ async function runPushCommand(options) {
7109
7174
  });
7110
7175
  break;
7111
7176
  case "source":
7112
- result = await simulateSource(config, resolvedEvent, {
7113
- sourceId: plan.ids[0],
7114
- flow: options.flow,
7115
- silent: options.silent,
7116
- verbose: options.verbose,
7117
- snapshot: options.snapshot
7118
- });
7119
- break;
7120
- case "transformer":
7121
- result = await simulateTransformer(
7122
- config,
7123
- resolvedEvent,
7124
- {
7125
- transformerId: plan.ids[0],
7177
+ result = simulationToPushResult(
7178
+ await simulateSource(config, resolvedEvent, {
7179
+ sourceId: plan.ids[0],
7126
7180
  flow: options.flow,
7127
- mock: options.mock,
7128
7181
  silent: options.silent,
7129
7182
  verbose: options.verbose,
7130
7183
  snapshot: options.snapshot
7131
- }
7184
+ })
7185
+ );
7186
+ break;
7187
+ case "transformer":
7188
+ result = simulationToPushResult(
7189
+ await simulateTransformer(
7190
+ config,
7191
+ resolvedEvent,
7192
+ {
7193
+ transformerId: plan.ids[0],
7194
+ flow: options.flow,
7195
+ mock: options.mock,
7196
+ silent: options.silent,
7197
+ verbose: options.verbose,
7198
+ snapshot: options.snapshot
7199
+ }
7200
+ )
7132
7201
  );
7133
7202
  break;
7134
7203
  case "destination":
@@ -7151,7 +7220,6 @@ async function runPushCommand(options) {
7151
7220
  }
7152
7221
  async function runDestinationSimulationLoop(config, event, destinationIds, options) {
7153
7222
  const startTime = Date.now();
7154
- const perDestination = {};
7155
7223
  for (const destinationId of destinationIds) {
7156
7224
  const r4 = await simulateDestination(config, event, {
7157
7225
  destinationId,
@@ -7161,20 +7229,17 @@ async function runDestinationSimulationLoop(config, event, destinationIds, optio
7161
7229
  verbose: options.verbose,
7162
7230
  snapshot: options.snapshot
7163
7231
  });
7164
- perDestination[destinationId] = r4;
7165
- if (!r4.success) {
7232
+ if (r4.error) {
7166
7233
  return {
7167
7234
  success: false,
7168
7235
  duration: Date.now() - startTime,
7169
- error: `simulate destination.${destinationId}: ${r4.error ?? "unknown error"}`,
7170
- perDestination
7236
+ error: `simulate destination.${destinationId}: ${r4.error.message}`
7171
7237
  };
7172
7238
  }
7173
7239
  }
7174
7240
  return {
7175
7241
  success: true,
7176
- duration: Date.now() - startTime,
7177
- perDestination
7242
+ duration: Date.now() - startTime
7178
7243
  };
7179
7244
  }
7180
7245
 
@@ -7211,7 +7276,7 @@ function resolveBeforeChain(before, transformers, ingest, event) {
7211
7276
  if (Array.isArray(before) && before.every(isString)) {
7212
7277
  return before;
7213
7278
  }
7214
- const ids = xt(before, Ot(ingest, event));
7279
+ const ids = St(before, _t(ingest, event));
7215
7280
  if (ids.length === 0) return [];
7216
7281
  if (ids.length === 1) return walkStaticChain(ids[0], transformers);
7217
7282
  return ids;
@@ -7313,12 +7378,12 @@ async function push(configOrPath, event, options = {}) {
7313
7378
  "push() currently only supports config file paths. Config object support will be added in a future version. Please provide a path to a configuration file."
7314
7379
  );
7315
7380
  }
7316
- const parsed = i2.PartialEventSchema.safeParse(event);
7381
+ const parsed = i.PartialEventSchema.safeParse(event);
7317
7382
  if (!parsed.success) {
7318
7383
  return {
7319
7384
  success: false,
7320
7385
  duration: 0,
7321
- error: `Invalid event: ${parsed.error.issues.map((i3) => `${i3.path.join(".")}: ${i3.message}`).join(", ")}`
7386
+ error: `Invalid event: ${parsed.error.issues.map((i2) => `${i2.path.join(".")}: ${i2.message}`).join(", ")}`
7322
7387
  };
7323
7388
  }
7324
7389
  return pushCore(configOrPath, event, {
@@ -7538,33 +7603,41 @@ async function simulateSource(configOrPath, input, options) {
7538
7603
  if (instance.flow?.collector?.command) {
7539
7604
  await instance.flow.collector.command("shutdown");
7540
7605
  }
7541
- return {
7542
- success: true,
7543
- ...captured.length > 0 ? { captured } : {},
7544
- ...networkCalls.length > 0 ? { networkCalls } : {},
7545
- duration: Date.now() - startTime
7546
- };
7547
- }
7606
+ return buildSimulationResult({
7607
+ step: "source",
7608
+ name: options.sourceId,
7609
+ startTime,
7610
+ captured
7611
+ });
7612
+ },
7613
+ (error) => buildSimulationResult({
7614
+ step: "source",
7615
+ name: options.sourceId,
7616
+ startTime,
7617
+ error
7618
+ })
7548
7619
  );
7549
7620
  } catch (error) {
7550
- return {
7551
- success: false,
7552
- duration: Date.now() - startTime,
7553
- error: getErrorMessage(error)
7554
- };
7621
+ return buildSimulationResult({
7622
+ step: "source",
7623
+ name: options.sourceId,
7624
+ startTime,
7625
+ error
7626
+ });
7555
7627
  } finally {
7556
7628
  await prepared.cleanup();
7557
7629
  }
7558
7630
  }
7559
7631
  async function simulateTransformer(configOrPath, event, options) {
7560
7632
  const startTime = Date.now();
7561
- const parsed = i2.PartialEventSchema.safeParse(event);
7633
+ const parsed = i.PartialEventSchema.safeParse(event);
7562
7634
  if (!parsed.success) {
7563
- return {
7564
- success: false,
7565
- duration: 0,
7635
+ return buildSimulationResult({
7636
+ step: "transformer",
7637
+ name: options.transformerId,
7638
+ startTime,
7566
7639
  error: parsed.error.message
7567
- };
7640
+ });
7568
7641
  }
7569
7642
  let config;
7570
7643
  if (typeof configOrPath === "string") {
@@ -7640,7 +7713,6 @@ async function simulateTransformer(configOrPath, event, options) {
7640
7713
  const inputEvent = event;
7641
7714
  const ingest = E(options.transformerId);
7642
7715
  const captured = [];
7643
- captured.push({ event: { ...inputEvent }, timestamp: Date.now() });
7644
7716
  logger.info(`Simulating transformer: ${options.transformerId}`);
7645
7717
  let processedEvent = inputEvent;
7646
7718
  const before = transformer.config.before;
@@ -7664,11 +7736,12 @@ async function simulateTransformer(configOrPath, event, options) {
7664
7736
  if (beforeResult === null) {
7665
7737
  captured.push({ event: null, timestamp: Date.now() });
7666
7738
  await collector.command("shutdown");
7667
- return {
7668
- success: true,
7669
- captured,
7670
- duration: Date.now() - startTime
7671
- };
7739
+ return buildSimulationResult({
7740
+ step: "transformer",
7741
+ name: options.transformerId,
7742
+ startTime,
7743
+ captured
7744
+ });
7672
7745
  }
7673
7746
  processedEvent = Array.isArray(beforeResult) ? beforeResult[0] : beforeResult;
7674
7747
  }
@@ -7695,33 +7768,41 @@ async function simulateTransformer(configOrPath, event, options) {
7695
7768
  captured.push({ event: processedEvent, timestamp: Date.now() });
7696
7769
  }
7697
7770
  await collector.command("shutdown");
7698
- return {
7699
- success: true,
7700
- captured,
7701
- ...networkCalls.length > 0 ? { networkCalls } : {},
7702
- duration: Date.now() - startTime
7703
- };
7704
- }
7771
+ return buildSimulationResult({
7772
+ step: "transformer",
7773
+ name: options.transformerId,
7774
+ startTime,
7775
+ captured
7776
+ });
7777
+ },
7778
+ (error) => buildSimulationResult({
7779
+ step: "transformer",
7780
+ name: options.transformerId,
7781
+ startTime,
7782
+ error
7783
+ })
7705
7784
  );
7706
7785
  } catch (error) {
7707
- return {
7708
- success: false,
7709
- duration: Date.now() - startTime,
7710
- error: getErrorMessage(error)
7711
- };
7786
+ return buildSimulationResult({
7787
+ step: "transformer",
7788
+ name: options.transformerId,
7789
+ startTime,
7790
+ error
7791
+ });
7712
7792
  } finally {
7713
7793
  await prepared.cleanup();
7714
7794
  }
7715
7795
  }
7716
7796
  async function simulateDestination(configOrPath, event, options) {
7717
7797
  const startTime = Date.now();
7718
- const parsed = i2.PartialEventSchema.safeParse(event);
7798
+ const parsed = i.PartialEventSchema.safeParse(event);
7719
7799
  if (!parsed.success) {
7720
- return {
7721
- success: false,
7722
- duration: 0,
7800
+ return buildSimulationResult({
7801
+ step: "destination",
7802
+ name: options.destinationId,
7803
+ startTime,
7723
7804
  error: parsed.error.message
7724
- };
7805
+ });
7725
7806
  }
7726
7807
  let config;
7727
7808
  if (typeof configOrPath === "string") {
@@ -7804,25 +7885,31 @@ async function simulateDestination(configOrPath, event, options) {
7804
7885
  );
7805
7886
  }
7806
7887
  logger.info(`Simulating destination: ${options.destinationId}`);
7807
- const elbResult = await collector.push(event, {
7888
+ await collector.push(event, {
7808
7889
  include: [options.destinationId]
7809
7890
  });
7810
7891
  await collector.command("shutdown");
7811
- return {
7812
- success: true,
7813
- elbResult,
7814
- ...trackedCalls.length > 0 ? { usage: { [options.destinationId]: trackedCalls } } : {},
7815
- ...networkCalls.length > 0 ? { networkCalls } : {},
7816
- duration: Date.now() - startTime
7817
- };
7818
- }
7892
+ return buildSimulationResult({
7893
+ step: "destination",
7894
+ name: options.destinationId,
7895
+ startTime,
7896
+ usage: trackedCalls.length ? { [options.destinationId]: trackedCalls } : void 0
7897
+ });
7898
+ },
7899
+ (error) => buildSimulationResult({
7900
+ step: "destination",
7901
+ name: options.destinationId,
7902
+ startTime,
7903
+ error
7904
+ })
7819
7905
  );
7820
7906
  } catch (error) {
7821
- return {
7822
- success: false,
7823
- duration: Date.now() - startTime,
7824
- error: getErrorMessage(error)
7825
- };
7907
+ return buildSimulationResult({
7908
+ step: "destination",
7909
+ name: options.destinationId,
7910
+ startTime,
7911
+ error
7912
+ });
7826
7913
  } finally {
7827
7914
  await prepared.cleanup();
7828
7915
  }
@@ -8991,7 +9078,7 @@ import chalk3 from "chalk";
8991
9078
  // src/commands/validate/validators/contract.ts
8992
9079
  var SECTION_KEYS = ["globals", "context", "custom", "user", "consent"];
8993
9080
  var KNOWN_KEYS = /* @__PURE__ */ new Set([
8994
- "extends",
9081
+ "extend",
8995
9082
  "description",
8996
9083
  "events",
8997
9084
  ...SECTION_KEYS
@@ -9021,18 +9108,18 @@ function validateContract(input) {
9021
9108
  continue;
9022
9109
  }
9023
9110
  const obj = entry;
9024
- if (obj.extends !== void 0) {
9025
- if (typeof obj.extends !== "string") {
9111
+ if (obj.extend !== void 0) {
9112
+ if (typeof obj.extend !== "string") {
9026
9113
  errors.push({
9027
- path: `${name}.extends`,
9028
- message: "extends must be a string",
9114
+ path: `${name}.extend`,
9115
+ message: "extend must be a string",
9029
9116
  code: "INVALID_EXTENDS"
9030
9117
  });
9031
- } else if (!contractNames.includes(obj.extends)) {
9118
+ } else if (!contractNames.includes(obj.extend)) {
9032
9119
  errors.push({
9033
- path: `${name}.extends`,
9034
- message: `extends references non-existent contract "${obj.extends}"`,
9035
- value: obj.extends,
9120
+ path: `${name}.extend`,
9121
+ message: `extend references non-existent contract "${obj.extend}"`,
9122
+ value: obj.extend,
9036
9123
  code: "INVALID_EXTENDS"
9037
9124
  });
9038
9125
  }
@@ -9071,15 +9158,15 @@ function validateContract(input) {
9071
9158
  while (current) {
9072
9159
  if (visited.has(current)) {
9073
9160
  errors.push({
9074
- path: `${name}.extends`,
9075
- message: `Circular extends chain: ${[...visited, current].join(" \u2192 ")}`,
9161
+ path: `${name}.extend`,
9162
+ message: `Circular extend chain: ${[...visited, current].join(" \u2192 ")}`,
9076
9163
  code: "CIRCULAR_EXTENDS"
9077
9164
  });
9078
9165
  break;
9079
9166
  }
9080
9167
  visited.add(current);
9081
9168
  const entry = contracts[current];
9082
- current = entry?.extends || "";
9169
+ current = entry?.extend || "";
9083
9170
  }
9084
9171
  }
9085
9172
  return {
@@ -9148,7 +9235,7 @@ function validateEvent2(input) {
9148
9235
  // src/commands/validate/validators/flow.ts
9149
9236
  init_dist();
9150
9237
  init_dev();
9151
- var { validateFlowConfig: validateFlowConfig2 } = i2;
9238
+ var { validateFlowConfig: validateFlowConfig2 } = i;
9152
9239
  function isFlowJson(value) {
9153
9240
  if (!le(value)) return false;
9154
9241
  if (!("version" in value) || !("flows" in value)) return false;
@@ -9202,7 +9289,7 @@ function validateFlow(input, options = {}) {
9202
9289
  transformersValue
9203
9290
  )) {
9204
9291
  if (!le(transformerValue)) continue;
9205
- const result = Pt(transformerValue, "Transformer");
9292
+ const result = Zt(transformerValue, "Transformer");
9206
9293
  if (!result.ok) {
9207
9294
  errors.push({
9208
9295
  path: `flows.${flowName}.transformers.${name}`,
@@ -9467,12 +9554,12 @@ function checkCompatibility(conn, errors, warnings) {
9467
9554
  });
9468
9555
  }
9469
9556
  }
9470
- function isStructurallyCompatible(a3, b3) {
9471
- if (typeof a3 !== typeof b3) return false;
9472
- if (a3 === null || b3 === null) return a3 === b3;
9473
- if (Array.isArray(a3) && Array.isArray(b3)) return true;
9474
- if (typeof a3 === "object" && typeof b3 === "object") {
9475
- const keysA = Object.keys(a3);
9557
+ function isStructurallyCompatible(a4, b3) {
9558
+ if (typeof a4 !== typeof b3) return false;
9559
+ if (a4 === null || b3 === null) return a4 === b3;
9560
+ if (Array.isArray(a4) && Array.isArray(b3)) return true;
9561
+ if (typeof a4 === "object" && typeof b3 === "object") {
9562
+ const keysA = Object.keys(a4);
9476
9563
  const keysB = Object.keys(b3);
9477
9564
  const shared = keysA.filter((k2) => keysB.includes(k2));
9478
9565
  return shared.length >= Math.min(keysA.length, keysB.length) * 0.5;
@@ -9517,16 +9604,16 @@ function lintRoute(spec, position, warnings) {
9517
9604
  if (!spec) return;
9518
9605
  if (typeof spec === "string") return;
9519
9606
  if (Array.isArray(spec)) {
9520
- for (let i3 = 0; i3 < spec.length; i3++) {
9521
- const entry = spec[i3];
9522
- if (i3 < spec.length - 1 && typeof entry === "object" && entry !== null && !Array.isArray(entry) && isRouteMany(entry)) {
9607
+ for (let i2 = 0; i2 < spec.length; i2++) {
9608
+ const entry = spec[i2];
9609
+ if (i2 < spec.length - 1 && typeof entry === "object" && entry !== null && !Array.isArray(entry) && isRouteMany(entry)) {
9523
9610
  warnings.push({
9524
9611
  path: position,
9525
9612
  message: `dead code after many at ${position}: main chain terminates at the many operator`,
9526
9613
  suggestion: "Remove entries after the many operator; move them into each many branch if they should still run."
9527
9614
  });
9528
9615
  }
9529
- lintRoute(entry, `${position}[${i3}]`, warnings);
9616
+ lintRoute(entry, `${position}[${i2}]`, warnings);
9530
9617
  }
9531
9618
  return;
9532
9619
  }
@@ -9535,8 +9622,8 @@ function lintRoute(spec, position, warnings) {
9535
9622
  return;
9536
9623
  }
9537
9624
  if (isRouteOne(spec)) {
9538
- for (let i3 = 0; i3 < spec.one.length; i3++) {
9539
- lintRoute(spec.one[i3], `${position}.one[${i3}]`, warnings);
9625
+ for (let i2 = 0; i2 < spec.one.length; i2++) {
9626
+ lintRoute(spec.one[i2], `${position}.one[${i2}]`, warnings);
9540
9627
  }
9541
9628
  return;
9542
9629
  }
@@ -9556,8 +9643,8 @@ function lintRoute(spec, position, warnings) {
9556
9643
  suggestion: "Replace many with next when only one branch exists."
9557
9644
  });
9558
9645
  }
9559
- for (let i3 = 0; i3 < spec.many.length; i3++) {
9560
- lintRoute(spec.many[i3], `${position}.many[${i3}]`, warnings);
9646
+ for (let i2 = 0; i2 < spec.many.length; i2++) {
9647
+ lintRoute(spec.many[i2], `${position}.many[${i2}]`, warnings);
9561
9648
  }
9562
9649
  return;
9563
9650
  }
@@ -9648,7 +9735,7 @@ function validateMapping(input) {
9648
9735
  // src/commands/validate/validators/entry.ts
9649
9736
  init_dist();
9650
9737
  import Ajv from "ajv";
9651
- var CLIENT_HEADER = "walkeros-cli/4.1.0";
9738
+ var CLIENT_HEADER = "walkeros-cli/4.1.1-next-1779485810490";
9652
9739
  var SECTIONS = ["destinations", "sources", "transformers"];
9653
9740
  function resolveEntry(path19, flowConfig) {
9654
9741
  const flows = flowConfig.flows;
@@ -9724,7 +9811,7 @@ async function validateEntry(path19, flowConfig) {
9724
9811
  }
9725
9812
  let schemas;
9726
9813
  try {
9727
- const info = await gt(packageName, {
9814
+ const info = await vt(packageName, {
9728
9815
  client: CLIENT_HEADER
9729
9816
  });
9730
9817
  schemas = info.schemas;
@@ -10475,6 +10562,8 @@ async function listDeployments(options = {}) {
10475
10562
  if (options.type) params.set("type", options.type);
10476
10563
  if (options.status) params.set("status", options.status);
10477
10564
  if (options.flowId) params.set("flowId", options.flowId);
10565
+ if (options.cursor) params.set("cursor", options.cursor);
10566
+ if (options.limit !== void 0) params.set("limit", String(options.limit));
10478
10567
  const qs = params.toString();
10479
10568
  const response = await apiFetch(
10480
10569
  `/api/projects/${id}/deployments${qs ? `?${qs}` : ""}`
@@ -11055,7 +11144,7 @@ program.hook("postAction", async () => {
11055
11144
  process.on("exit", () => {
11056
11145
  if (telemetryEmitted) return;
11057
11146
  const argvTail = process.argv.slice(2);
11058
- const argvCmd = cmdPath || argvTail.find((a3) => !a3.startsWith("-")) || (argvTail.some((a3) => a3 === "--version" || a3 === "-V") ? "--version" : "") || (argvTail.some((a3) => a3 === "--help" || a3 === "-h") ? "--help" : "");
11147
+ const argvCmd = cmdPath || argvTail.find((a4) => !a4.startsWith("-")) || (argvTail.some((a4) => a4 === "--version" || a4 === "-V") ? "--version" : "") || (argvTail.some((a4) => a4 === "--help" || a4 === "-h") ? "--help" : "");
11059
11148
  void emitter.send(
11060
11149
  "cmd invoke",
11061
11150
  { command: argvCmd, outcome: "success" },