@walkeros/cli 4.3.2 → 4.4.0-next-1785239495233

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
@@ -1,8 +1,8 @@
1
1
  #!/usr/bin/env node
2
2
  var __defProp = Object.defineProperty;
3
3
  var __getOwnPropNames = Object.getOwnPropertyNames;
4
- var __esm = (fn2, res) => function __init() {
5
- return fn2 && (res = (0, fn2[__getOwnPropNames(fn2)[0]])(fn2 = 0)), res;
4
+ var __esm = (fn3, res) => function __init() {
5
+ return fn3 && (res = (0, fn3[__getOwnPropNames(fn3)[0]])(fn3 = 0)), res;
6
6
  };
7
7
  var __export = (target, all) => {
8
8
  for (var name in all)
@@ -168,19 +168,19 @@ function w(e4, t4) {
168
168
  async function k(e4, t4) {
169
169
  return await e4.get(t4);
170
170
  }
171
- function I(e4) {
171
+ function O(e4) {
172
172
  return { _meta: { hops: 0, path: [e4] } };
173
173
  }
174
- function M(e4) {
174
+ function N(e4) {
175
175
  throw new Error(String(e4));
176
176
  }
177
177
  function C(e4, t4) {
178
178
  const n5 = false !== t4?.stripAnnotations, r6 = {}, o4 = /* @__PURE__ */ new Set();
179
179
  function s4(t5) {
180
180
  if (r6[t5]) return r6[t5];
181
- o4.has(t5) && M(`Circular extend chain detected: ${[...o4, t5].join(" \u2192 ")}`);
181
+ o4.has(t5) && N(`Circular extend chain detected: ${[...o4, t5].join(" \u2192 ")}`);
182
182
  const i5 = e4[t5];
183
- i5 || M(`Contract "${t5}" not found`), o4.add(t5);
183
+ i5 || N(`Contract "${t5}" not found`), o4.add(t5);
184
184
  let a4 = {};
185
185
  if (i5.extend) {
186
186
  a4 = (function(e5, t6) {
@@ -267,12 +267,12 @@ function X(e4, t4, n5) {
267
267
  const s4 = r6[e5];
268
268
  if (null == o4 || "object" != typeof o4) {
269
269
  const o5 = r6.slice(0, e5).join(".");
270
- M(`Path "${t4}" not found in "${n5}": "${s4}" does not exist${o5 ? ` in "${o5}"` : ""}`);
270
+ N(`Path "${t4}" not found in "${n5}": "${s4}" does not exist${o5 ? ` in "${o5}"` : ""}`);
271
271
  }
272
272
  const i5 = o4;
273
273
  if (!(s4 in i5)) {
274
274
  const o5 = r6.slice(0, e5).join(".");
275
- M(`Path "${t4}" not found in "${n5}": "${s4}" does not exist${o5 ? ` in "${o5}"` : ""}`);
275
+ N(`Path "${t4}" not found in "${n5}": "${s4}" does not exist${o5 ? ` in "${o5}"` : ""}`);
276
276
  }
277
277
  o4 = i5[s4];
278
278
  }
@@ -283,35 +283,35 @@ function Q(e4, t4, n5, r6, o4, s4) {
283
283
  const i5 = e4.match(D);
284
284
  if (i5) {
285
285
  const e5 = i5[1].split("."), a5 = e5[0], c3 = e5.slice(1).join(".");
286
- void 0 === t4[a5] && M(`Variable "${a5}" not found`);
287
- const u3 = s4 ?? /* @__PURE__ */ new Set();
288
- if (u3.has(a5)) {
289
- M(`Cyclic $var reference: ${[...u3, a5].join(" -> ")}`);
286
+ void 0 === t4[a5] && N(`Variable "${a5}" not found`);
287
+ const f3 = s4 ?? /* @__PURE__ */ new Set();
288
+ if (f3.has(a5)) {
289
+ N(`Cyclic $var reference: ${[...f3, a5].join(" -> ")}`);
290
290
  }
291
- let f4;
292
- u3.add(a5);
291
+ let u4;
292
+ f3.add(a5);
293
293
  try {
294
- f4 = Q(t4[a5], t4, n5, r6, o4, u3);
294
+ u4 = Q(t4[a5], t4, n5, r6, o4, f3);
295
295
  } finally {
296
- u3.delete(a5);
296
+ f3.delete(a5);
297
297
  }
298
- return c3 && (f4 = X(f4, c3, `$var.${a5}`)), f4;
298
+ return c3 && (u4 = X(u4, c3, `$var.${a5}`)), u4;
299
299
  }
300
300
  const a4 = e4.match(L);
301
301
  if (a4 && r6) {
302
302
  const e5 = a4[1], t5 = a4[2];
303
- e5 in r6 || M(`Contract "${e5}" not found`);
303
+ e5 in r6 || N(`Contract "${e5}" not found`);
304
304
  let n6 = r6[e5];
305
305
  return t5 && (n6 = X(n6, t5, `$contract.${e5}`)), n6;
306
306
  }
307
- const c2 = e4.match(K);
307
+ const c2 = e4.match(q);
308
308
  if (c2) {
309
309
  const t5 = c2[1], r7 = c2[2], s5 = false === n5?.strictFlowRefs;
310
- o4 || M(`$flow.${t5}${r7 ? `.${r7}` : ""} cannot be resolved without a flow resolver`);
310
+ o4 || N(`$flow.${t5}${r7 ? `.${r7}` : ""} cannot be resolved without a flow resolver`);
311
311
  const i6 = o4(t5);
312
312
  if (!i6) {
313
313
  if (s5) return n5?.onWarning?.(Y(t5, r7, "unknown-flow")), e4;
314
- M(`Flow "${t5}" not found in $flow.${t5}`);
314
+ N(`Flow "${t5}" not found in $flow.${t5}`);
315
315
  }
316
316
  let a5 = i6;
317
317
  if (r7) if (s5) {
@@ -324,32 +324,32 @@ function Q(e4, t4, n5, r6, o4, s4) {
324
324
  } else a5 = X(a5, r7, `$flow.${t5}`);
325
325
  return a5;
326
326
  }
327
- const u2 = e4.match(q);
328
- if (u2) {
329
- const e5 = u2[1];
327
+ const f2 = e4.match(W);
328
+ if (f2) {
329
+ const e5 = f2[1];
330
330
  if (n5?.deferred) return `${G}${e5}`;
331
- M(`Secret "$secret.${e5}" cannot be used in a web flow \u2014 secrets are never sent to the browser. Use a server flow.`);
331
+ N(`Secret "$secret.${e5}" cannot be used in a web flow \u2014 secrets are never sent to the browser. Use a server flow.`);
332
332
  }
333
- let f3 = e4.replace(F, (e5, i6) => {
334
- const a5 = i6.split("."), c3 = a5[0], u3 = a5.slice(1).join(".");
335
- void 0 === t4[c3] && M(`Variable "${c3}" not found`);
336
- const f4 = s4 ?? /* @__PURE__ */ new Set();
337
- if (f4.has(c3)) {
338
- M(`Cyclic $var reference: ${[...f4, c3].join(" -> ")}`);
333
+ let u3 = e4.replace(F, (e5, i6) => {
334
+ const a5 = i6.split("."), c3 = a5[0], f3 = a5.slice(1).join(".");
335
+ void 0 === t4[c3] && N(`Variable "${c3}" not found`);
336
+ const u4 = s4 ?? /* @__PURE__ */ new Set();
337
+ if (u4.has(c3)) {
338
+ N(`Cyclic $var reference: ${[...u4, c3].join(" -> ")}`);
339
339
  }
340
340
  let l3;
341
- f4.add(c3);
341
+ u4.add(c3);
342
342
  try {
343
- l3 = Q(t4[c3], t4, n5, r6, o4, f4);
343
+ l3 = Q(t4[c3], t4, n5, r6, o4, u4);
344
344
  } finally {
345
- f4.delete(c3);
345
+ u4.delete(c3);
346
346
  }
347
- if (u3 && (l3 = X(l3, u3, `$var.${c3}`)), null === l3 || "string" != typeof l3 && "number" != typeof l3 && "boolean" != typeof l3) {
348
- M(`Variable "${i6}" resolves to non-scalar (${Array.isArray(l3) ? "array" : typeof l3}) and cannot be inlined into a string. Use it as a whole-string reference: "$var.${i6}"`);
347
+ if (f3 && (l3 = X(l3, f3, `$var.${c3}`)), null === l3 || "string" != typeof l3 && "number" != typeof l3 && "boolean" != typeof l3) {
348
+ N(`Variable "${i6}" resolves to non-scalar (${Array.isArray(l3) ? "array" : typeof l3}) and cannot be inlined into a string. Use it as a whole-string reference: "$var.${i6}"`);
349
349
  }
350
350
  return String(l3);
351
351
  });
352
- return f3 = f3.replace(U, (e5, t5, r7) => n5?.deferred ? void 0 !== r7 ? `${J}${t5}:${r7}` : `${J}${t5}` : "undefined" != typeof process && void 0 !== process.env?.[t5] ? process.env[t5] : void 0 !== r7 ? r7 : void M(`Environment variable "${t5}" not found and no default provided`)), f3;
352
+ return u3 = u3.replace(U, (e5, t5, r7) => n5?.deferred ? void 0 !== r7 ? `${J}${t5}:${r7}` : `${J}${t5}` : "undefined" != typeof process && void 0 !== process.env?.[t5] ? process.env[t5] : void 0 !== r7 ? r7 : void N(`Environment variable "${t5}" not found and no default provided`)), u3;
353
353
  }
354
354
  if (Array.isArray(e4)) return e4.map((e5) => Q(e5, t4, n5, r6, o4, s4));
355
355
  if (null !== e4 && "object" == typeof e4) {
@@ -369,7 +369,7 @@ function te(e4, t4, n5) {
369
369
  const a5 = e4.flows[t5];
370
370
  if (a5) {
371
371
  if (o4.has(t5)) {
372
- M(`Cyclic $flow reference: ${[...s4, t5].join(" -> ")}`);
372
+ N(`Cyclic $flow reference: ${[...s4, t5].join(" -> ")}`);
373
373
  }
374
374
  o4.add(t5), s4.push(t5);
375
375
  try {
@@ -380,9 +380,9 @@ function te(e4, t4, n5) {
380
380
  }
381
381
  }
382
382
  }, a4 = Object.keys(e4.flows);
383
- t4 || (1 === a4.length ? t4 = a4[0] : M(`Multiple flows found (${a4.join(", ")}). Please specify a flow.`));
383
+ t4 || (1 === a4.length ? t4 = a4[0] : N(`Multiple flows found (${a4.join(", ")}). Please specify a flow.`));
384
384
  const c2 = e4.flows[t4];
385
- c2 || M(`Flow "${t4}" not found. Available: ${a4.join(", ")}`), o4.add(t4), s4.push(t4);
385
+ c2 || N(`Flow "${t4}" not found. Available: ${a4.join(", ")}`), o4.add(t4), s4.push(t4);
386
386
  try {
387
387
  return (function(e5, t5, n6, r7) {
388
388
  const o5 = JSON.parse(JSON.stringify(t5));
@@ -396,20 +396,20 @@ function te(e4, t4, n5) {
396
396
  o5.config = Q(o5.config, i6, n6, s5, r7);
397
397
  }
398
398
  if (o5.sources) for (const [i6, a5] of Object.entries(o5.sources)) {
399
- const c3 = H(e5.variables, t5.variables, a5.variables), u2 = Q(a5.config, c3, n6, s5, r7), f3 = Q(a5.env, c3, n6, s5, r7);
400
- o5.sources[i6] = { package: a5.package, import: a5.import, config: u2, env: f3, primary: a5.primary, variables: a5.variables, before: a5.before, next: a5.next, cache: a5.cache, code: a5.code };
399
+ const c3 = H(e5.variables, t5.variables, a5.variables), f2 = Q(a5.config, c3, n6, s5, r7), u3 = Q(a5.env, c3, n6, s5, r7);
400
+ o5.sources[i6] = { package: a5.package, import: a5.import, config: f2, env: u3, primary: a5.primary, variables: a5.variables, before: a5.before, next: a5.next, cache: a5.cache, code: a5.code };
401
401
  }
402
402
  if (o5.destinations) for (const [i6, a5] of Object.entries(o5.destinations)) {
403
- const c3 = H(e5.variables, t5.variables, a5.variables), u2 = Q(a5.config, c3, n6, s5, r7), f3 = Q(a5.env, c3, n6, s5, r7);
404
- o5.destinations[i6] = { package: a5.package, import: a5.import, config: u2, env: f3, variables: a5.variables, before: a5.before, next: a5.next, cache: a5.cache, code: a5.code };
403
+ const c3 = H(e5.variables, t5.variables, a5.variables), f2 = Q(a5.config, c3, n6, s5, r7), u3 = Q(a5.env, c3, n6, s5, r7);
404
+ o5.destinations[i6] = { package: a5.package, import: a5.import, config: f2, env: u3, variables: a5.variables, before: a5.before, next: a5.next, cache: a5.cache, code: a5.code };
405
405
  }
406
406
  if (o5.stores) for (const [i6, a5] of Object.entries(o5.stores)) {
407
- const c3 = H(e5.variables, t5.variables, a5.variables), u2 = Q(a5.config, c3, n6, s5, r7), f3 = Q(a5.env, c3, n6, s5, r7);
408
- o5.stores[i6] = { package: a5.package, import: a5.import, config: u2, env: f3, cache: a5.cache, variables: a5.variables, code: a5.code };
407
+ const c3 = H(e5.variables, t5.variables, a5.variables), f2 = Q(a5.config, c3, n6, s5, r7), u3 = Q(a5.env, c3, n6, s5, r7);
408
+ o5.stores[i6] = { package: a5.package, import: a5.import, config: f2, env: u3, cache: a5.cache, variables: a5.variables, code: a5.code };
409
409
  }
410
410
  if (o5.transformers) for (const [i6, a5] of Object.entries(o5.transformers)) {
411
- const c3 = H(e5.variables, t5.variables, a5.variables), u2 = Q(a5.config, c3, n6, s5, r7), f3 = Q(a5.env, c3, n6, s5, r7);
412
- o5.transformers[i6] = { package: a5.package, import: a5.import, config: u2, env: f3, variables: a5.variables, before: a5.before, next: a5.next, cache: a5.cache, code: a5.code };
411
+ const c3 = H(e5.variables, t5.variables, a5.variables), f2 = Q(a5.config, c3, n6, s5, r7), u3 = Q(a5.env, c3, n6, s5, r7);
412
+ o5.transformers[i6] = { package: a5.package, import: a5.import, config: f2, env: u3, variables: a5.variables, before: a5.before, next: a5.next, cache: a5.cache, code: a5.code };
413
413
  }
414
414
  if (o5.collector) {
415
415
  const i6 = H(e5.variables, t5.variables), a5 = Q(o5.collector, i6, n6, s5, r7);
@@ -424,7 +424,7 @@ function te(e4, t4, n5) {
424
424
  function ne(e4) {
425
425
  const t4 = e4.config?.platform;
426
426
  if ("web" === t4 || "server" === t4) return t4;
427
- M('Flow must have config.platform set to "web" or "server"');
427
+ N('Flow must have config.platform set to "web" or "server"');
428
428
  }
429
429
  function oe(e4, t4 = {}, n5 = {}) {
430
430
  n5 = { ...re, ...n5 };
@@ -440,7 +440,7 @@ function ie(e4) {
440
440
  function ae(e4) {
441
441
  return "boolean" == typeof e4;
442
442
  }
443
- function ue(e4) {
443
+ function fe(e4) {
444
444
  return void 0 !== e4;
445
445
  }
446
446
  function le(e4) {
@@ -458,20 +458,20 @@ function me(e4, t4) {
458
458
  function ge(e4) {
459
459
  return "string" == typeof e4;
460
460
  }
461
- function he(e4, t4 = /* @__PURE__ */ new WeakMap()) {
461
+ function ve(e4, t4 = /* @__PURE__ */ new WeakMap()) {
462
462
  if ("object" != typeof e4 || null === e4) return e4;
463
463
  if (t4.has(e4)) return t4.get(e4);
464
464
  const n5 = Object.prototype.toString.call(e4);
465
465
  if ("[object Object]" === n5) {
466
466
  const n6 = {};
467
467
  t4.set(e4, n6);
468
- for (const r6 in e4) Object.prototype.hasOwnProperty.call(e4, r6) && (n6[r6] = he(e4[r6], t4));
468
+ for (const r6 in e4) Object.prototype.hasOwnProperty.call(e4, r6) && (n6[r6] = ve(e4[r6], t4));
469
469
  return n6;
470
470
  }
471
471
  if ("[object Array]" === n5) {
472
472
  const n6 = [];
473
473
  return t4.set(e4, n6), e4.forEach((e5) => {
474
- n6.push(he(e5, t4));
474
+ n6.push(ve(e5, t4));
475
475
  }), n6;
476
476
  }
477
477
  if ("[object Date]" === n5) return new Date(e4.getTime());
@@ -481,7 +481,7 @@ function he(e4, t4 = /* @__PURE__ */ new WeakMap()) {
481
481
  }
482
482
  return e4;
483
483
  }
484
- function ve(e4, t4 = "", n5) {
484
+ function he(e4, t4 = "", n5) {
485
485
  const r6 = t4.split(".");
486
486
  let o4 = e4;
487
487
  for (let e5 = 0; e5 < r6.length; e5++) {
@@ -489,18 +489,18 @@ function ve(e4, t4 = "", n5) {
489
489
  if ("*" === t5 && ie(o4)) {
490
490
  const t6 = r6.slice(e5 + 1).join("."), s4 = [];
491
491
  for (const e6 of o4) {
492
- const r7 = ve(e6, t6, n5);
492
+ const r7 = he(e6, t6, n5);
493
493
  s4.push(r7);
494
494
  }
495
495
  return s4;
496
496
  }
497
497
  if (o4 = de(o4) || ie(o4) ? o4[t5] : void 0, void 0 === o4) break;
498
498
  }
499
- return ue(o4) ? o4 : n5;
499
+ return fe(o4) ? o4 : n5;
500
500
  }
501
501
  function ye(e4, t4, n5) {
502
502
  if (!de(e4)) return e4;
503
- const r6 = he(e4), o4 = t4.split(".");
503
+ const r6 = ve(e4), o4 = t4.split(".");
504
504
  let s4 = r6;
505
505
  for (let e5 = 0; e5 < o4.length; e5++) {
506
506
  const t5 = o4[e5];
@@ -510,7 +510,7 @@ function ye(e4, t4, n5) {
510
510
  }
511
511
  function be(e4, t4) {
512
512
  if (!de(e4) && !ie(e4)) return e4;
513
- const n5 = he(e4), r6 = t4.split(".");
513
+ const n5 = ve(e4), r6 = t4.split(".");
514
514
  let o4 = n5;
515
515
  for (let e5 = 0; e5 < r6.length; e5++) {
516
516
  const t5 = r6[e5], s4 = e5 === r6.length - 1;
@@ -549,14 +549,14 @@ function $e(e4, t4) {
549
549
  }
550
550
  return n5;
551
551
  }
552
- function je(e4, t4 = {}, n5 = {}) {
552
+ function Se(e4, t4 = {}, n5 = {}) {
553
553
  const r6 = { ...t4, ...n5 }, o4 = {};
554
554
  let s4 = !e4 || 0 === Object.keys(e4).length;
555
555
  return Object.keys(r6).forEach((t5) => {
556
556
  r6[t5] && (o4[t5] = true, e4 && e4[t5] && (s4 = true));
557
557
  }), !!s4 && o4;
558
558
  }
559
- function Ee(e4 = 6, t4 = "0123456789abcdefghijklmnopqrstuvwxyz") {
559
+ function xe(e4 = 6, t4 = "0123456789abcdefghijklmnopqrstuvwxyz") {
560
560
  const n5 = t4.length;
561
561
  if (e4 <= 0 || 0 === n5) return "";
562
562
  let r6 = "";
@@ -564,14 +564,14 @@ function Ee(e4 = 6, t4 = "0123456789abcdefghijklmnopqrstuvwxyz") {
564
564
  const o4 = 256 - 256 % n5;
565
565
  for (; r6.length < e4; ) {
566
566
  const s4 = e4 - r6.length, i5 = new Uint8Array(Math.ceil(1.3 * s4) + 4);
567
- if (!Oe(i5)) break;
567
+ if (!Ee(i5)) break;
568
568
  for (let s5 = 0; s5 < i5.length && r6.length < e4; s5++) i5[s5] < o4 && (r6 += t4[i5[s5] % n5]);
569
569
  }
570
570
  }
571
571
  for (; r6.length < e4; ) r6 += t4[Math.random() * n5 | 0];
572
572
  return r6;
573
573
  }
574
- function Oe(e4) {
574
+ function Ee(e4) {
575
575
  try {
576
576
  const t4 = globalThis.crypto;
577
577
  if (t4 && "function" == typeof t4.getRandomValues) return t4.getRandomValues(e4), true;
@@ -580,11 +580,11 @@ function Oe(e4) {
580
580
  return false;
581
581
  }
582
582
  function _e(e4) {
583
- let t4 = Ee(e4, Ie);
584
- for (; /^0+$/.test(t4); ) t4 = Ee(e4, Ie);
583
+ let t4 = xe(e4, Oe);
584
+ for (; /^0+$/.test(t4); ) t4 = xe(e4, Oe);
585
585
  return t4;
586
586
  }
587
- function Ne() {
587
+ function Me() {
588
588
  return _e(16);
589
589
  }
590
590
  function Ce() {
@@ -602,22 +602,22 @@ function Fe(e4, t4) {
602
602
  }
603
603
  function Ue(e4, t4 = 1e3, n5 = false) {
604
604
  const { wait: r6, size: o4, age: s4 } = Fe(t4, 1e3);
605
- let i5, a4, c2 = null, u2 = null, f3 = false, l3 = [], p3 = 0;
605
+ let i5, a4, c2 = null, f2 = null, u3 = false, l3 = [], p3 = 0;
606
606
  const d2 = () => {
607
- c2 && (clearTimeout(c2), c2 = null), u2 && (clearTimeout(u2), u2 = null), p3 = 0, a4 = void 0;
607
+ c2 && (clearTimeout(c2), c2 = null), f2 && (clearTimeout(f2), f2 = null), p3 = 0, a4 = void 0;
608
608
  }, m3 = () => {
609
609
  const t5 = a4, n6 = l3;
610
610
  if (d2(), l3 = [], t5) return i5 = e4(...t5), n6.forEach((e5) => e5(i5)), i5;
611
611
  n6.forEach((e5) => e5(void 0));
612
612
  }, g3 = (...t5) => new Promise((d3) => {
613
- const g4 = n5 && !f3;
613
+ const g4 = n5 && !u3;
614
614
  if (a4 = t5, p3 += 1, l3.push(d3), c2 && clearTimeout(c2), c2 = setTimeout(() => {
615
- c2 = null, n5 && !f3 || m3();
616
- }, r6), void 0 === s4 || u2 || (u2 = setTimeout(() => {
617
- u2 = null, m3();
615
+ c2 = null, n5 && !u3 || m3();
616
+ }, r6), void 0 === s4 || f2 || (f2 = setTimeout(() => {
617
+ f2 = null, m3();
618
618
  }, s4)), void 0 !== o4 && p3 >= o4) m3();
619
619
  else if (g4) {
620
- f3 = true, i5 = e4(...t5);
620
+ u3 = true, i5 = e4(...t5);
621
621
  const n6 = l3;
622
622
  l3 = [], n6.forEach((e5) => e5(i5));
623
623
  }
@@ -629,12 +629,12 @@ function Ue(e4, t4 = 1e3, n5 = false) {
629
629
  l3 = [], d2(), i5 = void 0, e5.forEach((e6) => e6(void 0));
630
630
  }, g3.size = () => p3, g3;
631
631
  }
632
- function Ke(e4) {
632
+ function qe(e4) {
633
633
  return { message: e4.message, name: e4.name, stack: e4.stack, cause: e4.cause };
634
634
  }
635
- function We(e4, t4) {
635
+ function Ke(e4, t4) {
636
636
  let n5, r6 = {};
637
- return e4 instanceof Error ? (n5 = e4.message, r6.error = Ke(e4)) : n5 = e4, void 0 !== t4 && (t4 instanceof Error ? r6.error = Ke(t4) : "object" == typeof t4 && null !== t4 ? (r6 = { ...r6, ...t4 }, "error" in r6 && r6.error instanceof Error && (r6.error = Ke(r6.error))) : r6.value = t4), { message: n5, context: r6 };
637
+ return e4 instanceof Error ? (n5 = e4.message, r6.error = qe(e4)) : n5 = e4, void 0 !== t4 && (t4 instanceof Error ? r6.error = qe(t4) : "object" == typeof t4 && null !== t4 ? (r6 = { ...r6, ...t4 }, "error" in r6 && r6.error instanceof Error && (r6.error = qe(r6.error))) : r6.value = t4), { message: n5, context: r6 };
638
638
  }
639
639
  function Be(e4 = {}) {
640
640
  return Ze({ level: void 0 !== e4.level ? (function(e5) {
@@ -644,19 +644,19 @@ function Be(e4 = {}) {
644
644
  function Ze(e4) {
645
645
  const { level: t4, handler: n5, jsonHandler: r6, scope: o4 } = e4, s4 = (e5, r7, s5) => {
646
646
  if (e5 <= t4) {
647
- const t5 = We(r7, s5);
648
- n5 ? n5(e5, t5.message, t5.context, o4, qe) : qe(e5, t5.message, t5.context, o4);
647
+ const t5 = Ke(r7, s5);
648
+ n5 ? n5(e5, t5.message, t5.context, o4, We) : We(e5, t5.message, t5.context, o4);
649
649
  }
650
650
  };
651
651
  return { error: (e5, t5) => s4(0, e5, t5), warn: (e5, t5) => s4(1, e5, t5), info: (e5, t5) => s4(2, e5, t5), debug: (e5, t5) => s4(3, e5, t5), throw: (e5, t5) => {
652
- const r7 = We(e5, t5);
653
- throw n5 ? n5(0, r7.message, r7.context, o4, qe) : qe(0, r7.message, r7.context, o4), new Error(r7.message);
652
+ const r7 = Ke(e5, t5);
653
+ throw n5 ? n5(0, r7.message, r7.context, o4, We) : We(0, r7.message, r7.context, o4), new Error(r7.message);
654
654
  }, json: (e5) => {
655
655
  r6 ? r6(e5) : console.log(JSON.stringify(e5, null, 2));
656
656
  }, scope: (e5) => Ze({ level: t4, handler: n5, jsonHandler: r6, scope: [...o4, e5] }) };
657
657
  }
658
658
  function Ve(e4) {
659
- return ae(e4) || ge(e4) || pe(e4) || !ue(e4) || ie(e4) && e4.every(Ve) || de(e4) && Object.values(e4).every(Ve);
659
+ return ae(e4) || ge(e4) || pe(e4) || !fe(e4) || ie(e4) && e4.every(Ve) || de(e4) && Object.values(e4).every(Ve);
660
660
  }
661
661
  function Je(e4) {
662
662
  return Ve(e4) ? e4 : void 0;
@@ -689,7 +689,7 @@ async function Qe(e4, t4, n5) {
689
689
  const [r6, o4] = (e4.name || "").split(" ");
690
690
  if (!t4 || !r6 || !o4) return {};
691
691
  let s4, i5 = "", a4 = r6, c2 = o4;
692
- const u2 = (t5) => {
692
+ const f2 = (t5) => {
693
693
  if (!t5) return;
694
694
  return (ie(t5) ? t5 : [t5]).find((t6) => {
695
695
  if (!t6.condition) return true;
@@ -699,11 +699,11 @@ async function Qe(e4, t4, n5) {
699
699
  });
700
700
  };
701
701
  t4[a4] || (a4 = "*");
702
- const f3 = t4[a4];
703
- return f3 && (f3[c2] || (c2 = "*"), s4 = u2(f3[c2])), s4 || (a4 = "*", c2 = "*", s4 = u2(t4[a4]?.[c2])), s4 && (i5 = `${a4} ${c2}`), { eventMapping: s4, mappingKey: i5 };
702
+ const u3 = t4[a4];
703
+ return u3 && (u3[c2] || (c2 = "*"), s4 = f2(u3[c2])), s4 || (a4 = "*", c2 = "*", s4 = f2(t4[a4]?.[c2])), s4 && (i5 = `${a4} ${c2}`), { eventMapping: s4, mappingKey: i5 };
704
704
  }
705
705
  async function et(e4, t4 = {}, n5 = {}) {
706
- if (!ue(e4)) return;
706
+ if (!fe(e4)) return;
707
707
  const r6 = de(e4) && e4.consent || n5.consent || n5.collector?.consent, o4 = n5.event ?? (de(e4) ? e4 : {});
708
708
  if (!n5.collector) throw new Error("getMappingValue: context.collector is required");
709
709
  const s4 = { event: o4, mapping: t4, collector: n5.collector, logger: n5.collector.logger, consent: r6 }, i5 = ie(t4) ? t4 : [t4];
@@ -712,7 +712,7 @@ async function et(e4, t4 = {}, n5 = {}) {
712
712
  if (e5 instanceof Xe) throw e5;
713
713
  n5.collector && n5.collector.status.failed++, s4.logger.error("mapping processing failed", { event: o4, error: e5 });
714
714
  })(e4, t5, { ...s4, mapping: t5 });
715
- if (ue(r7)) return r7;
715
+ if (fe(r7)) return r7;
716
716
  }
717
717
  }
718
718
  async function tt(e4, t4, n5) {
@@ -721,29 +721,29 @@ async function tt(e4, t4, n5) {
721
721
  if (o4) return o4;
722
722
  const s4 = ge(r6) ? { key: r6 } : r6;
723
723
  if (!Object.keys(s4).length) return;
724
- const { condition: i5, consent: a4, fn: c2, key: u2, loop: f3, map: l3, set: p3, validate: d2, value: m3 } = s4, g3 = { ...n5, mapping: r6 };
724
+ const { condition: i5, consent: a4, fn: c2, key: f2, loop: u3, map: l3, set: p3, validate: d2, value: m3 } = s4, g3 = { ...n5, mapping: r6 };
725
725
  if (i5 && !await Ye(i5, (e5) => {
726
726
  if (e5 instanceof Xe) throw e5;
727
727
  return g3.logger.error("mapping condition failed", { event: g3.event, error: e5 }), false;
728
728
  })(e4, g3)) return;
729
- if (a4 && !je(a4, g3.consent)) return m3;
730
- let h2 = ue(m3) ? m3 : e4;
731
- if (c2 && (h2 = await Ye(c2, (e5) => {
729
+ if (a4 && !Se(a4, g3.consent)) return m3;
730
+ let v2 = fe(m3) ? m3 : e4;
731
+ if (c2 && (v2 = await Ye(c2, (e5) => {
732
732
  if (e5 instanceof Xe) throw e5;
733
733
  g3.logger.error("mapping fn failed", { event: g3.event, error: e5 });
734
- })(e4, g3)), u2 && (h2 = ve(e4, u2, m3)), f3) {
735
- const [t6, n6] = f3, r7 = "this" === t6 ? [e4] : await et(e4, t6, g3);
736
- ie(r7) && (h2 = (await Promise.all(r7.map((e5) => et(e5, n6, g3)))).filter(ue));
737
- } else l3 ? h2 = await Object.entries(l3).reduce(async (t6, [n6, r7]) => {
734
+ })(e4, g3)), f2 && (v2 = he(e4, f2, m3)), u3) {
735
+ const [t6, n6] = u3, r7 = "this" === t6 ? [e4] : await et(e4, t6, g3);
736
+ ie(r7) && (v2 = (await Promise.all(r7.map((e5) => et(e5, n6, g3)))).filter(fe));
737
+ } else l3 ? v2 = await Object.entries(l3).reduce(async (t6, [n6, r7]) => {
738
738
  const o5 = await t6, s5 = await et(e4, r7, g3);
739
- return ue(s5) && (o5[n6] = s5), o5;
740
- }, Promise.resolve({})) : p3 && (h2 = await Promise.all(p3.map((t6) => tt(e4, t6, g3))));
739
+ return fe(s5) && (o5[n6] = s5), o5;
740
+ }, Promise.resolve({})) : p3 && (v2 = await Promise.all(p3.map((t6) => tt(e4, t6, g3))));
741
741
  d2 && !await Ye(d2, (e5) => {
742
742
  if (e5 instanceof Xe) throw e5;
743
743
  return g3.logger.error("mapping validate failed", { event: g3.event, error: e5 }), false;
744
- })(h2, g3) && (h2 = void 0);
745
- const v3 = Je(h2);
746
- return ue(v3) ? v3 : Je(m3);
744
+ })(v2, g3) && (v2 = void 0);
745
+ const h3 = Je(v2);
746
+ return fe(h3) ? h3 : Je(m3);
747
747
  }, Promise.resolve(void 0));
748
748
  }
749
749
  async function nt(e4, t4, n5) {
@@ -783,24 +783,24 @@ function gt(e4, t4, n5, r6) {
783
783
  const o4 = e4;
784
784
  return function(...e5) {
785
785
  let s4;
786
- const i5 = "pre" + t4, a4 = "post" + t4, c2 = n5[i5], u2 = n5[a4], f3 = (e6, t5) => {
786
+ const i5 = "pre" + t4, a4 = "post" + t4, c2 = n5[i5], f2 = n5[a4], u3 = (e6, t5) => {
787
787
  r6 ? r6.warn(e6, { error: t5 }) : console.warn(e6, t5);
788
788
  };
789
789
  if (c2) try {
790
790
  s4 = c2({ fn: o4 }, ...e5);
791
791
  } catch (t5) {
792
- f3(`Hook ${String(i5)} failed, falling back to original function`, t5), s4 = o4(...e5);
792
+ u3(`Hook ${String(i5)} failed, falling back to original function`, t5), s4 = o4(...e5);
793
793
  }
794
794
  else s4 = o4(...e5);
795
- if (u2) try {
796
- s4 = u2({ fn: o4, result: s4 }, ...e5);
795
+ if (f2) try {
796
+ s4 = f2({ fn: o4, result: s4 }, ...e5);
797
797
  } catch (e6) {
798
- f3(`Hook ${String(a4)} failed, keeping original result`, e6);
798
+ u3(`Hook ${String(a4)} failed, keeping original result`, e6);
799
799
  }
800
800
  return s4;
801
801
  };
802
802
  }
803
- function ht(e4, t4) {
803
+ function vt(e4, t4) {
804
804
  if (t4 >= 1) return true;
805
805
  if (t4 <= 0) return false;
806
806
  return (function(e5) {
@@ -809,7 +809,7 @@ function ht(e4, t4) {
809
809
  return t5 >>> 0;
810
810
  })(e4) / 4294967295 < t4;
811
811
  }
812
- function vt(e4, t4) {
812
+ function ht(e4, t4) {
813
813
  const n5 = "function" == typeof t4 ? t4 : () => t4;
814
814
  return function(t5) {
815
815
  const r6 = n5();
@@ -817,11 +817,11 @@ function vt(e4, t4) {
817
817
  const o4 = r6.level ?? "standard";
818
818
  if ("off" === o4) return;
819
819
  const s4 = r6.sample, i5 = "number" == typeof s4 && Number.isFinite(s4) ? s4 : 1;
820
- if (t5.eventId && !ht(t5.eventId, i5)) return;
821
- const a4 = r6.includeIn ?? "trace" === o4, c2 = r6.includeOut ?? "trace" === o4, u2 = r6.includeMappingKey ?? "trace" === o4, f3 = { ...t5 };
822
- a4 || delete f3.inEvent, c2 || (delete f3.outEvent, delete f3.calls), u2 || delete f3.mappingKey, "trace" !== o4 && f3.error?.message && f3.error.message.length > 256 && (f3.error = { ...f3.error, message: f3.error.message.slice(0, 256) + "\u2026" });
820
+ if (t5.eventId && !vt(t5.eventId, i5)) return;
821
+ const a4 = r6.includeIn ?? "trace" === o4, c2 = r6.includeOut ?? "trace" === o4, f2 = r6.includeMappingKey ?? "trace" === o4, u3 = { ...t5 };
822
+ a4 || delete u3.inEvent, c2 || (delete u3.outEvent, delete u3.calls), f2 || delete u3.mappingKey, "trace" !== o4 && u3.error?.message && u3.error.message.length > 256 && (u3.error = { ...u3.error, message: u3.error.message.slice(0, 256) + "\u2026" });
823
823
  try {
824
- e4(f3);
824
+ e4(u3);
825
825
  } catch {
826
826
  }
827
827
  };
@@ -873,35 +873,35 @@ function At(e4) {
873
873
  return null;
874
874
  }
875
875
  }
876
- function jt(e4) {
876
+ function St(e4) {
877
877
  return "object" == typeof e4 && null !== e4 && !Array.isArray(e4);
878
878
  }
879
- function St(e4) {
879
+ function jt(e4) {
880
880
  if (!e4) return null;
881
881
  const t4 = e4.split("."), [n5, r6, o4] = t4;
882
882
  if (3 !== t4.length || !n5 || !r6 || !o4) return null;
883
883
  const s4 = At(n5);
884
- if (!jt(s4)) return null;
884
+ if (!St(s4)) return null;
885
885
  const i5 = s4.kid, a4 = s4.alg;
886
886
  if ("string" != typeof i5 || "ES256" !== a4) return null;
887
887
  const c2 = At(r6);
888
888
  if (!(function(e5) {
889
- if (!jt(e5)) return false;
889
+ if (!St(e5)) return false;
890
890
  const t5 = e5;
891
891
  return "string" == typeof t5.iss && Array.isArray(t5.aud) && t5.aud.every((e6) => "string" == typeof e6) && "number" == typeof t5.iat && "number" == typeof t5.sxp && "string" == typeof t5.art && wt.test(t5.art) && "string" == typeof t5.sri && "string" == typeof t5.pb && "activate" === t5.cap && "string" == typeof t5.jti && "string" == typeof t5.pid && (void 0 === t5.ses || "string" == typeof t5.ses) && (void 0 === t5.sb || "string" == typeof t5.sb);
892
892
  })(c2)) return null;
893
- const u2 = kt(o4);
894
- return u2 && 64 === u2.byteLength ? { grant: c2, kid: i5, signed: $t(`${n5}.${r6}`), signature: u2 } : null;
893
+ const f2 = kt(o4);
894
+ return f2 && 64 === f2.byteLength ? { grant: c2, kid: i5, signed: $t(`${n5}.${r6}`), signature: f2 } : null;
895
895
  }
896
- async function It(e4, t4) {
897
- const n5 = St(e4);
896
+ async function Ot(e4, t4) {
897
+ const n5 = jt(e4);
898
898
  if (!n5) return { ok: false, reason: "malformed" };
899
899
  const { grant: r6, kid: o4, signed: s4, signature: i5 } = n5;
900
900
  if (r6.iss !== t4.iss) return { ok: false, reason: "foreign-issuer" };
901
901
  if ("activate" !== r6.cap) return { ok: false, reason: "cap-mismatch" };
902
902
  if (1e3 * r6.iat > t4.now + 6e4) return { ok: false, reason: "expired" };
903
- if (1e3 * r6.sxp - 1e3 * r6.iat > Ot) return { ok: false, reason: "expired" };
904
- const a4 = "url" === t4.source ? Math.min(1e3 * r6.iat + xt, 1e3 * r6.sxp) : 1e3 * r6.sxp;
903
+ if (1e3 * r6.sxp - 1e3 * r6.iat > Et) return { ok: false, reason: "expired" };
904
+ const a4 = "url" === t4.source ? Math.min(1e3 * r6.iat + It, 1e3 * r6.sxp) : 1e3 * r6.sxp;
905
905
  if (t4.now >= a4) return { ok: false, reason: "expired" };
906
906
  if (void 0 !== t4.origin && !r6.aud.includes(t4.origin)) return { ok: false, reason: "aud-mismatch" };
907
907
  if (t4.acceptForeign) {
@@ -914,13 +914,13 @@ async function It(e4, t4) {
914
914
  if (r6.ses !== t4.expectSession.ses) return { ok: false, reason: "sb-mismatch" };
915
915
  if (!r6.sb || r6.sb !== t4.expectSession.sb) return { ok: false, reason: "sb-mismatch" };
916
916
  } else if (c2) return { ok: false, reason: "sb-mismatch" };
917
- const u2 = t4.keyring.find((e5) => e5.kid === o4);
918
- if (!u2) return { ok: false, reason: "kid-mismatch" };
919
- const f3 = t4.crypto ?? globalThis.crypto, l3 = f3?.subtle;
917
+ const f2 = t4.keyring.find((e5) => e5.kid === o4);
918
+ if (!f2) return { ok: false, reason: "kid-mismatch" };
919
+ const u3 = t4.crypto ?? globalThis.crypto, l3 = u3?.subtle;
920
920
  if (!l3) return { ok: false, reason: "no-subtle" };
921
921
  const p3 = (function(e5) {
922
922
  return kt(e5);
923
- })(u2.spki);
923
+ })(f2.spki);
924
924
  if (!p3) return { ok: false, reason: "kid-mismatch" };
925
925
  try {
926
926
  const e5 = await l3.importKey("spki", p3, { name: "ECDSA", namedCurve: "P-256" }, false, ["verify"]);
@@ -930,13 +930,13 @@ async function It(e4, t4) {
930
930
  }
931
931
  return { ok: true, grant: r6 };
932
932
  }
933
- function nn() {
934
- return tn;
933
+ function sn() {
934
+ return on;
935
935
  }
936
- function rn(e4) {
937
- tn = e4;
936
+ function an(e4) {
937
+ on = e4;
938
938
  }
939
- function on(e4, t4) {
939
+ function cn(e4, t4) {
940
940
  if (0 === e4.observers.size) return;
941
941
  const n5 = Array.from(e4.observers);
942
942
  for (const e5 of n5) try {
@@ -944,14 +944,14 @@ function on(e4, t4) {
944
944
  } catch {
945
945
  }
946
946
  }
947
- function sn(e4) {
947
+ function fn(e4) {
948
948
  const t4 = e4.batchMs, n5 = "number" == typeof t4 && Number.isFinite(t4) && t4 > 0 ? Math.floor(t4) : 50, r6 = e4.batchSize, o4 = "number" == typeof r6 && Number.isFinite(r6) && r6 >= 1 ? Math.floor(r6) : 50, s4 = e4.maxBodyBytes, i5 = "number" == typeof s4 && Number.isFinite(s4) && s4 >= 1 ? Math.floor(s4) : 6e4, a4 = e4.fetch ?? ((e5, t5) => globalThis.fetch(e5, t5)), c2 = e4.onError ?? (() => {
949
- }), u2 = {};
949
+ }), f2 = {};
950
950
  for (const [t5, n6] of Object.entries(e4.headers ?? {})) {
951
951
  const e5 = t5.toLowerCase();
952
- "authorization" !== e5 && "content-type" !== e5 && (u2[t5] = n6);
952
+ "authorization" !== e5 && "content-type" !== e5 && (f2[t5] = n6);
953
953
  }
954
- let f3 = [], l3 = null, p3 = 0;
954
+ let u3 = [], l3 = null, p3 = 0;
955
955
  function d2(e5) {
956
956
  const t5 = { v: 1, records: e5 }, n6 = JSON.stringify(t5);
957
957
  if (e5.length <= 1) return [n6];
@@ -972,29 +972,29 @@ function sn(e4) {
972
972
  return [...d2(e5.slice(0, r7)), ...d2(e5.slice(r7))];
973
973
  }
974
974
  function m3(t5) {
975
- return Promise.resolve().then(() => a4(e4.url, { method: "POST", headers: { ...u2, "Content-Type": "application/json", Authorization: `Bearer ${e4.token}` }, body: t5 })).then((t6) => {
975
+ return Promise.resolve().then(() => a4(e4.url, { method: "POST", headers: { ...f2, "Content-Type": "application/json", Authorization: `Bearer ${e4.token}` }, body: t5 })).then((t6) => {
976
976
  t6 && "object" == typeof t6 && "number" == typeof t6.status && e4.onStatus?.(t6.status), t6 && "object" == typeof t6 && "ok" in t6 && !t6.ok && c2(new Error(`Observer responded ${t6.status}`));
977
977
  }).catch((e5) => {
978
978
  c2(e5);
979
979
  });
980
980
  }
981
981
  function g3() {
982
- if (0 === f3.length) return;
983
- const e5 = f3;
984
- f3 = [], l3 && (clearTimeout(l3), l3 = null);
982
+ if (0 === u3.length) return;
983
+ const e5 = u3;
984
+ u3 = [], l3 && (clearTimeout(l3), l3 = null);
985
985
  const t5 = d2(e5);
986
986
  (async () => {
987
987
  for (const e6 of t5) await m3(e6);
988
988
  })();
989
989
  }
990
990
  return (e5) => {
991
- f3.push({ ...e5, seq: ++p3 }), f3.length >= o4 ? g3() : null === l3 && (l3 = setTimeout(g3, n5));
991
+ u3.push({ ...e5, seq: ++p3 }), u3.length >= o4 ? g3() : null === l3 && (l3 = setTimeout(g3, n5));
992
992
  };
993
993
  }
994
- function vn(e4) {
994
+ function wn(e4) {
995
995
  return "string" == typeof e4 || Array.isArray(e4) && e4.every((e5) => "string" == typeof e5) ? e4 : void 0;
996
996
  }
997
- async function yn(e4, t4) {
997
+ async function kn(e4, t4) {
998
998
  const n5 = t4?.version || "latest", r6 = t4?.timeout || 1e4, o4 = new AbortController(), s4 = setTimeout(() => o4.abort(), r6), i5 = o4.signal, a4 = t4?.client ? { "X-Walkeros-Client": t4.client } : void 0;
999
999
  try {
1000
1000
  if (t4?.baseUrl) {
@@ -1005,46 +1005,46 @@ async function yn(e4, t4) {
1005
1005
  return { packageName: n6.package || e5, version: "string" == typeof n6.version ? n6.version : t5, ...void 0 !== n6.description && { description: n6.description }, ...void 0 !== n6.type && { type: n6.type }, ...void 0 !== c2 && { platform: c2 }, schemas: r9, examples: o7, ...void 0 !== n6.docs && { docs: n6.docs }, ...void 0 !== n6.source && { source: n6.source }, ...s5 && Object.keys(s5).length > 0 ? { hints: s5 } : {}, hintKeys: i6, exampleSummaries: a5 };
1006
1006
  })(e4, n5, await o6.json());
1007
1007
  }
1008
- const r7 = `https://cdn.jsdelivr.net/npm/${e4}@${n5}`, o5 = await bn(`${r7}/package.json`, i5, a4);
1008
+ const r7 = `https://cdn.jsdelivr.net/npm/${e4}@${n5}`, o5 = await $n(`${r7}/package.json`, i5, a4);
1009
1009
  return (function(e5, t5, n6, r8) {
1010
- const o6 = r8.$meta || {}, s5 = r8.schemas || {}, i6 = r8.examples || {}, a5 = r8.hints, c2 = a5 ? Object.keys(a5) : [], u2 = [], f3 = i6.step || {};
1011
- for (const [e6, t6] of Object.entries(f3)) {
1010
+ const o6 = r8.$meta || {}, s5 = r8.schemas || {}, i6 = r8.examples || {}, a5 = r8.hints, c2 = a5 ? Object.keys(a5) : [], f2 = [], u3 = i6.step || {};
1011
+ for (const [e6, t6] of Object.entries(u3)) {
1012
1012
  const n7 = t6, r9 = { name: e6 };
1013
- "string" == typeof n7?.description && (r9.description = n7.description), u2.push(r9);
1013
+ "string" == typeof n7?.description && (r9.description = n7.description), f2.push(r9);
1014
1014
  }
1015
1015
  const l3 = "string" == typeof o6.docs ? o6.docs : void 0, p3 = "string" == typeof o6.source ? o6.source : void 0;
1016
- return { packageName: e5, version: "string" == typeof n6.version ? n6.version : t5, description: "string" == typeof n6.description ? n6.description : void 0, type: "string" == typeof o6.type ? o6.type : void 0, platform: vn(o6.platform), schemas: s5, examples: i6, ...l3 ? { docs: l3 } : {}, ...p3 ? { source: p3 } : {}, ...a5 && Object.keys(a5).length > 0 ? { hints: a5 } : {}, hintKeys: c2, exampleSummaries: u2 };
1017
- })(e4, n5, o5, await bn(`${r7}/dist/walkerOS.json`, i5, a4));
1016
+ return { packageName: e5, version: "string" == typeof n6.version ? n6.version : t5, description: "string" == typeof n6.description ? n6.description : void 0, type: "string" == typeof o6.type ? o6.type : void 0, platform: wn(o6.platform), schemas: s5, examples: i6, ...l3 ? { docs: l3 } : {}, ...p3 ? { source: p3 } : {}, ...a5 && Object.keys(a5).length > 0 ? { hints: a5 } : {}, hintKeys: c2, exampleSummaries: f2 };
1017
+ })(e4, n5, o5, await $n(`${r7}/dist/walkerOS.json`, i5, a4));
1018
1018
  } finally {
1019
1019
  clearTimeout(s4);
1020
1020
  }
1021
1021
  }
1022
- async function bn(e4, t4, n5) {
1022
+ async function $n(e4, t4, n5) {
1023
1023
  const r6 = await fetch(e4, { signal: t4, ...n5 && { headers: n5 } });
1024
1024
  if (!r6.ok) throw new Error(`Failed to fetch ${e4} (HTTP ${r6.status})`);
1025
1025
  return await r6.json();
1026
1026
  }
1027
- async function wn(e4, t4) {
1028
- const n5 = await yn(e4, t4);
1027
+ async function An(e4, t4) {
1028
+ const n5 = await kn(e4, t4);
1029
1029
  return { packageName: n5.packageName, version: n5.version, type: n5.type, platform: n5.platform, schemas: n5.schemas, examples: n5.examples, ...n5.hints ? { hints: n5.hints } : {} };
1030
1030
  }
1031
- function jn(e4) {
1032
- const t4 = (e4.startsWith(An) ? e4.slice(5) : e4).split(".");
1031
+ function xn(e4) {
1032
+ const t4 = (e4.startsWith(In) ? e4.slice(5) : e4).split(".");
1033
1033
  return t4.some((e5) => "" === e5) ? [] : t4;
1034
1034
  }
1035
- function xn(e4) {
1036
- if (!e4.startsWith(Sn)) return null;
1035
+ function On(e4) {
1036
+ if (!e4.startsWith(En)) return null;
1037
1037
  const t4 = e4.slice(5).split("."), [n5, r6, o4] = t4;
1038
1038
  return 3 === t4.length && n5 && r6 && o4 ? { pb: n5, ses: r6, secret: o4 } : null;
1039
1039
  }
1040
- function Nn(e4) {
1040
+ function Cn(e4) {
1041
1041
  if (void 0 === e4 || "*" === e4) return () => true;
1042
1042
  if ("and" in e4) {
1043
- const t4 = e4.and.map(Nn);
1043
+ const t4 = e4.and.map(Cn);
1044
1044
  return (e5) => t4.every((t5) => t5(e5));
1045
1045
  }
1046
1046
  if ("or" in e4) {
1047
- const t4 = e4.or.map(Nn);
1047
+ const t4 = e4.or.map(Cn);
1048
1048
  return (e5) => t4.some((t5) => t5(e5));
1049
1049
  }
1050
1050
  return (function(e5) {
@@ -1075,75 +1075,75 @@ function Nn(e4) {
1075
1075
  }
1076
1076
  })(n5, r6);
1077
1077
  return (e6) => {
1078
- const n6 = ve(e6, t4), r7 = s4(n6);
1078
+ const n6 = he(e6, t4), r7 = s4(n6);
1079
1079
  return o4 ? !r7 : r7;
1080
1080
  };
1081
1081
  })(e4);
1082
1082
  }
1083
- function Mn(e4) {
1083
+ function Pn(e4) {
1084
1084
  return "object" == typeof e4 && null !== e4 && !Array.isArray(e4) && ("match" in e4 || "next" in e4 || "one" in e4 || "many" in e4);
1085
1085
  }
1086
- function Tn(e4) {
1087
- return Array.isArray(e4) && e4.length > 0 && e4.every((e5) => Mn(e5));
1086
+ function Rn(e4) {
1087
+ return Array.isArray(e4) && e4.length > 0 && e4.every((e5) => Pn(e5));
1088
1088
  }
1089
- function Cn(e4) {
1089
+ function zn(e4) {
1090
1090
  return e4.map((e5) => {
1091
1091
  if ("string" == typeof e5) return { match: () => true, next: { type: "static", value: e5 } };
1092
- if (Array.isArray(e5)) return { match: () => true, next: Pn(e5) ?? { type: "chain", value: [] } };
1092
+ if (Array.isArray(e5)) return { match: () => true, next: Dn(e5) ?? { type: "chain", value: [] } };
1093
1093
  const t4 = e5;
1094
- return { match: t4.match ? Nn(t4.match) : () => true, next: Pn(t4) ?? { type: "chain", value: [] } };
1094
+ return { match: t4.match ? Cn(t4.match) : () => true, next: Dn(t4) ?? { type: "chain", value: [] } };
1095
1095
  });
1096
1096
  }
1097
- function Pn(e4) {
1097
+ function Dn(e4) {
1098
1098
  if (null == e4) return;
1099
1099
  if ("string" == typeof e4) return { type: "static", value: e4 };
1100
1100
  if (Array.isArray(e4)) {
1101
1101
  if (0 === e4.length) return;
1102
- if (Tn(e4)) return Pn({ one: e4 });
1102
+ if (Rn(e4)) return Dn({ one: e4 });
1103
1103
  if (e4.every((e5) => "string" == typeof e5)) return { type: "chain", value: e4 };
1104
1104
  const t5 = [];
1105
1105
  for (const n5 of e4) {
1106
- const e5 = Pn(n5);
1106
+ const e5 = Dn(n5);
1107
1107
  void 0 !== e5 && t5.push(e5);
1108
1108
  }
1109
1109
  if (0 === t5.length) return;
1110
1110
  return { type: "sequence", value: t5 };
1111
1111
  }
1112
1112
  const t4 = e4;
1113
- if ("next" in t4 && void 0 !== t4.next) return t4.match ? { type: "gate", match: Nn(t4.match), next: Pn(t4.next) } : Pn(t4.next);
1113
+ if ("next" in t4 && void 0 !== t4.next) return t4.match ? { type: "gate", match: Cn(t4.match), next: Dn(t4.next) } : Dn(t4.next);
1114
1114
  if ("one" in t4 && t4.one) {
1115
- const e5 = Cn(t4.one);
1116
- return t4.match ? { type: "gate", match: Nn(t4.match), next: { type: "one", routes: e5 } } : { type: "one", routes: e5 };
1115
+ const e5 = zn(t4.one);
1116
+ return t4.match ? { type: "gate", match: Cn(t4.match), next: { type: "one", routes: e5 } } : { type: "one", routes: e5 };
1117
1117
  }
1118
1118
  if ("many" in t4 && t4.many) {
1119
- const e5 = Cn(t4.many);
1120
- return t4.match ? { type: "gate", match: Nn(t4.match), next: { type: "many", routes: e5 } } : { type: "many", routes: e5 };
1119
+ const e5 = zn(t4.many);
1120
+ return t4.match ? { type: "gate", match: Cn(t4.match), next: { type: "many", routes: e5 } } : { type: "many", routes: e5 };
1121
1121
  }
1122
- return t4.match ? { type: "gate", match: Nn(t4.match) } : void 0;
1122
+ return t4.match ? { type: "gate", match: Cn(t4.match) } : void 0;
1123
1123
  }
1124
- function zn(e4, t4 = {}) {
1124
+ function Un(e4, t4 = {}) {
1125
1125
  if (null == e4) return [];
1126
1126
  let n5;
1127
1127
  if ("object" == typeof e4) {
1128
- const t5 = Rn.get(e4);
1129
- t5 ? n5 = t5 : (n5 = Pn(e4), n5 && Rn.set(e4, n5));
1130
- } else n5 = Pn(e4);
1128
+ const t5 = Fn.get(e4);
1129
+ t5 ? n5 = t5 : (n5 = Dn(e4), n5 && Fn.set(e4, n5));
1130
+ } else n5 = Dn(e4);
1131
1131
  if (!n5) return [];
1132
- const r6 = Dn(n5, t4);
1132
+ const r6 = Ln(n5, t4);
1133
1133
  return void 0 === r6 ? [] : Array.isArray(r6) ? r6 : [r6];
1134
1134
  }
1135
- function Dn(e4, t4 = {}) {
1135
+ function Ln(e4, t4 = {}) {
1136
1136
  if (e4) {
1137
1137
  if ("static" === e4.type) return e4.value;
1138
1138
  if ("chain" === e4.type) return e4.value;
1139
1139
  if ("gate" === e4.type) {
1140
1140
  if (!e4.match(t4)) return;
1141
- return Dn(e4.next, t4);
1141
+ return Ln(e4.next, t4);
1142
1142
  }
1143
1143
  if ("sequence" === e4.type) {
1144
1144
  const n5 = [];
1145
1145
  for (const r6 of e4.value) {
1146
- const e5 = Dn(r6, t4);
1146
+ const e5 = Ln(r6, t4);
1147
1147
  void 0 !== e5 && (Array.isArray(e5) ? n5.push(...e5) : n5.push(e5));
1148
1148
  }
1149
1149
  return n5.length > 0 ? n5 : void 0;
@@ -1152,61 +1152,61 @@ function Dn(e4, t4 = {}) {
1152
1152
  const n5 = [];
1153
1153
  for (const r6 of e4.routes) {
1154
1154
  if (!r6.match(t4)) continue;
1155
- const e5 = Dn(r6.next, t4);
1155
+ const e5 = Ln(r6.next, t4);
1156
1156
  void 0 !== e5 && (Array.isArray(e5) ? n5.push(...e5) : n5.push(e5));
1157
1157
  }
1158
1158
  return n5.length > 0 ? n5 : void 0;
1159
1159
  }
1160
- for (const n5 of e4.routes) if (n5.match(t4)) return Dn(n5.next, t4);
1160
+ for (const n5 of e4.routes) if (n5.match(t4)) return Ln(n5.next, t4);
1161
1161
  }
1162
1162
  }
1163
- function Ln(e4, t4, n5 = Date.now) {
1164
- const r6 = { [Fn]: e4 };
1165
- return void 0 !== t4 && (r6[Un] = n5() + t4), r6;
1163
+ function Wn(e4, t4, n5 = Date.now) {
1164
+ const r6 = { [qn]: e4 };
1165
+ return void 0 !== t4 && (r6[Kn] = n5() + t4), r6;
1166
1166
  }
1167
- function Kn(e4, t4 = Date.now) {
1167
+ function Bn(e4, t4 = Date.now) {
1168
1168
  if (void 0 === e4) return;
1169
- if (null === (n5 = e4) || "object" != typeof n5 || Array.isArray(n5) || !(Fn in e4)) return { value: e4 };
1169
+ if (null === (n5 = e4) || "object" != typeof n5 || Array.isArray(n5) || !(qn in e4)) return { value: e4 };
1170
1170
  var n5;
1171
- const r6 = e4[Un];
1172
- return "number" == typeof r6 && t4() > r6 ? { expired: true } : { value: e4[Fn] };
1171
+ const r6 = e4[Kn];
1172
+ return "number" == typeof r6 && t4() > r6 ? { expired: true } : { value: e4[qn] };
1173
1173
  }
1174
- function Bn(e4) {
1174
+ function Hn(e4) {
1175
1175
  return null !== e4 && "object" == typeof e4 && !Array.isArray(e4);
1176
1176
  }
1177
- function Jn(e4) {
1178
- return null === e4 || "string" == typeof e4 || "number" == typeof e4 || "boolean" == typeof e4 || e4 instanceof Uint8Array || (Array.isArray(e4) ? e4.every((e5) => void 0 === e5 || Jn(e5)) : !!Bn(e4) && Object.values(e4).every((e5) => void 0 === e5 || Jn(e5)));
1177
+ function Xn(e4) {
1178
+ return null === e4 || "string" == typeof e4 || "number" == typeof e4 || "boolean" == typeof e4 || e4 instanceof Uint8Array || (Array.isArray(e4) ? e4.every((e5) => void 0 === e5 || Xn(e5)) : !!Hn(e4) && Object.values(e4).every((e5) => void 0 === e5 || Xn(e5)));
1179
1179
  }
1180
- function Xn(e4, t4) {
1180
+ function tr(e4, t4) {
1181
1181
  const n5 = { ingest: e4 ?? {} };
1182
1182
  return void 0 !== t4 && (n5.event = t4), n5;
1183
1183
  }
1184
- function Qn(e4) {
1185
- return { stop: e4.stop ?? false, storeId: e4.store, namespace: e4.namespace, rules: e4.rules.map((e5) => ({ match: e5.match ? Nn(e5.match) : () => true, key: e5.key, ttl: e5.ttl, update: e5.update })) };
1184
+ function nr(e4) {
1185
+ return { stop: e4.stop ?? false, storeId: e4.store, namespace: e4.namespace, rules: e4.rules.map((e5) => ({ match: e5.match ? Cn(e5.match) : () => true, key: e5.key, ttl: e5.ttl, update: e5.update })) };
1186
1186
  }
1187
- async function er(e4, t4, n5, r6) {
1187
+ async function rr(e4, t4, n5, r6) {
1188
1188
  const o4 = e4.rules.find((e5) => e5.match(n5));
1189
1189
  if (!o4) return null;
1190
- const s4 = o4.key.map((e5) => String(ve(n5, e5) ?? ""));
1190
+ const s4 = o4.key.map((e5) => String(he(n5, e5) ?? ""));
1191
1191
  if (s4.every((e5) => "" === e5)) return null;
1192
- const i5 = s4.join(":"), a4 = r6 ?? e4.namespace, c2 = a4 ? `${a4}:${i5}` : i5, u2 = Kn(await t4.get(c2));
1193
- if (void 0 === u2) return { status: "MISS", key: c2, rule: o4 };
1194
- if ("expired" in u2) {
1192
+ const i5 = s4.join(":"), a4 = r6 ?? e4.namespace, c2 = a4 ? `${a4}:${i5}` : i5, f2 = Bn(await t4.get(c2));
1193
+ if (void 0 === f2) return { status: "MISS", key: c2, rule: o4 };
1194
+ if ("expired" in f2) {
1195
1195
  try {
1196
1196
  await t4.delete(c2);
1197
1197
  } catch {
1198
1198
  }
1199
1199
  return { status: "MISS", key: c2, rule: o4 };
1200
1200
  }
1201
- return { status: "HIT", key: c2, value: u2.value, rule: o4 };
1201
+ return { status: "HIT", key: c2, value: f2.value, rule: o4 };
1202
1202
  }
1203
- function tr(e4, t4, n5, r6) {
1204
- if (!Jn(n5)) return;
1205
- const o4 = 1e3 * r6, s4 = e4.set(t4, Ln(n5, o4), o4);
1203
+ function or(e4, t4, n5, r6) {
1204
+ if (!Xn(n5)) return;
1205
+ const o4 = 1e3 * r6, s4 = e4.set(t4, Wn(n5, o4), o4);
1206
1206
  s4 instanceof Promise && s4.catch(() => {
1207
1207
  });
1208
1208
  }
1209
- async function nr(e4, t4, n5, r6) {
1209
+ async function sr(e4, t4, n5, r6) {
1210
1210
  if (!t4) return e4;
1211
1211
  let o4 = e4;
1212
1212
  for (const [e5, s4] of Object.entries(t4)) {
@@ -1214,10 +1214,10 @@ async function nr(e4, t4, n5, r6) {
1214
1214
  }
1215
1215
  return o4;
1216
1216
  }
1217
- function rr(e4) {
1217
+ function ir(e4) {
1218
1218
  return ie(e4) ? e4 : [e4];
1219
1219
  }
1220
- async function or(e4, t4, n5, r6) {
1220
+ async function ar(e4, t4, n5, r6) {
1221
1221
  let o4 = n5;
1222
1222
  for (const n6 of e4) await Ye(async () => {
1223
1223
  const e5 = t4(n6.store);
@@ -1227,13 +1227,13 @@ async function or(e4, t4, n5, r6) {
1227
1227
  const i5 = n6.store ? s4 : `state:${s4}`;
1228
1228
  if ("set" === n6.mode) {
1229
1229
  const t5 = await et(o4, n6.value, { collector: r6, event: o4 });
1230
- if (!ue(t5)) return;
1230
+ if (!fe(t5)) return;
1231
1231
  await e5.set(i5, t5);
1232
1232
  } else {
1233
1233
  const t5 = ge(a4 = n6.value) ? a4 : de(a4) && ge(a4.key) ? a4.key : void 0;
1234
1234
  if (!t5) return;
1235
1235
  const r7 = await e5.get(i5);
1236
- if (!ue(r7)) return;
1236
+ if (!fe(r7)) return;
1237
1237
  o4 = ye(o4, t5, r7);
1238
1238
  }
1239
1239
  var a4;
@@ -1243,18 +1243,18 @@ async function or(e4, t4, n5, r6) {
1243
1243
  })();
1244
1244
  return o4;
1245
1245
  }
1246
- function ur(e4, t4) {
1246
+ function pr(e4, t4) {
1247
1247
  const n5 = (function(e5) {
1248
- return /* @__PURE__ */ new Set([...sr[e5], ...ir, ...ar[e5]]);
1248
+ return /* @__PURE__ */ new Set([...cr[e5], ...fr, ...ur[e5]]);
1249
1249
  })(t4);
1250
1250
  for (const r7 of Object.keys(e4)) if (!n5.has(r7)) return { ok: false, code: "UNKNOWN_KEY", key: r7, reason: `Unknown key "${r7}" on ${t4}. Allowed: ${[...n5].sort().join(", ")}.` };
1251
1251
  const r6 = void 0 !== e4.package, o4 = void 0 !== e4.import, s4 = void 0 !== e4.code;
1252
- return s4 && "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.` } : s4 && ("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." } : s4 && r6 ? { ok: false, code: "CONFLICT", key: "package", reason: "Cannot specify both `code` and `package`. Use one or the other." } : s4 && o4 ? { ok: false, code: "CONFLICT", key: "import", reason: "Cannot specify both `code` and `import`." } : o4 && !r6 ? { ok: false, code: "MISSING_PACKAGE", key: "import", reason: "`import` requires `package` to be set." } : !o4 || "string" == typeof e4.import && cr.test(e4.import) ? { ok: true } : { ok: false, code: "INVALID_IMPORT", key: "import", reason: `import must match ${cr.source}. Got: ${JSON.stringify(e4.import)}.` };
1252
+ return s4 && "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.` } : s4 && ("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." } : s4 && r6 ? { ok: false, code: "CONFLICT", key: "package", reason: "Cannot specify both `code` and `package`. Use one or the other." } : s4 && o4 ? { ok: false, code: "CONFLICT", key: "import", reason: "Cannot specify both `code` and `import`." } : o4 && !r6 ? { ok: false, code: "MISSING_PACKAGE", key: "import", reason: "`import` requires `package` to be set." } : !o4 || "string" == typeof e4.import && lr.test(e4.import) ? { ok: true } : { ok: false, code: "INVALID_IMPORT", key: "import", reason: `import must match ${lr.source}. Got: ${JSON.stringify(e4.import)}.` };
1253
1253
  }
1254
- function fr(e4, t4) {
1254
+ function dr(e4, t4) {
1255
1255
  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.state || void 0 !== e4.mapping));
1256
1256
  }
1257
- var e, t, r, i, f, l, m, v, b, T, D, F, U, L, K, q, J, G, re, we, Ie, Pe, qe, Xe, wt, xt, Ot, Nt, tn, kn, An, Sn, Rn, Fn, Un, sr, ir, ar, cr;
1257
+ var e, t, r, i, u, l, m, h, b, T, D, F, U, L, q, W, J, G, re, we, Oe, Pe, We, Xe, wt, It, Et, Mt, on, Sn, In, En, Fn, qn, Kn, cr, fr, ur, lr;
1258
1258
  var init_dist = __esm({
1259
1259
  "../core/dist/index.mjs"() {
1260
1260
  "use strict";
@@ -1266,13 +1266,13 @@ var init_dist = __esm({
1266
1266
  t(r, { stepId: () => o });
1267
1267
  i = {};
1268
1268
  t(i, { getDestination: () => a });
1269
- f = {};
1270
- t(f, { Level: () => l });
1269
+ u = {};
1270
+ t(u, { Level: () => l });
1271
1271
  l = ((e4) => (e4[e4.ERROR = 0] = "ERROR", e4[e4.WARN = 1] = "WARN", e4[e4.INFO = 2] = "INFO", e4[e4.DEBUG = 3] = "DEBUG", e4))(l || {});
1272
1272
  m = {};
1273
1273
  t(m, { getTransformer: () => g });
1274
- v = {};
1275
- t(v, { getSource: () => y });
1274
+ h = {};
1275
+ t(h, { getSource: () => y });
1276
1276
  b = {};
1277
1277
  t(b, { getStore: () => w, getStoreValue: () => k });
1278
1278
  T = /* @__PURE__ */ new Set(["description", "examples", "title", "$comment"]);
@@ -1280,15 +1280,15 @@ var init_dist = __esm({
1280
1280
  F = /\$var\.([a-zA-Z_][a-zA-Z0-9_]*(?:\.[a-zA-Z_][a-zA-Z0-9_]*)*)/g;
1281
1281
  U = /\$env\.([a-zA-Z_][a-zA-Z0-9_]*)(?::([^"}\s]*))?/g;
1282
1282
  L = /^\$contract\.([a-zA-Z_][a-zA-Z0-9_]*)(?:\.(.+))?$/;
1283
- K = /^\$flow\.([a-zA-Z_][a-zA-Z0-9_]*)(?:\.([a-zA-Z0-9_.]+))?$/;
1284
- q = /^\$secret\.([A-Z0-9_]+)$/;
1283
+ q = /^\$flow\.([a-zA-Z_][a-zA-Z0-9_]*)(?:\.([a-zA-Z0-9_.]+))?$/;
1284
+ W = /^\$secret\.([A-Z0-9_]+)$/;
1285
1285
  J = "__WALKEROS_ENV:";
1286
1286
  G = "__WALKEROS_SECRET:";
1287
1287
  re = { merge: true, shallow: true, extend: true };
1288
1288
  we = { 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 }) };
1289
- Ie = "0123456789abcdef";
1289
+ Oe = "0123456789abcdef";
1290
1290
  Pe = /^(?<version>[0-9a-f]{2})-(?<trace>[0-9a-f]{32})-(?<span>[0-9a-f]{16})-[0-9a-f]{2}$/;
1291
- qe = (e4, t4, n5, r6) => {
1291
+ We = (e4, t4, n5, r6) => {
1292
1292
  const o4 = `${l[e4]}${r6.length > 0 ? ` [${r6.join(":")}]` : ""}`, s4 = Object.keys(n5).length > 0, i5 = 0 === e4 ? console.error : 1 === e4 ? console.warn : console.log;
1293
1293
  s4 ? i5(o4, t4, n5) : i5(o4, t4);
1294
1294
  };
@@ -1298,20 +1298,20 @@ var init_dist = __esm({
1298
1298
  }
1299
1299
  };
1300
1300
  wt = /^[A-Za-z0-9_-]+$/;
1301
- xt = 9e5;
1302
- Ot = 39e5;
1303
- Nt = "elbObserve";
1304
- tn = null;
1305
- kn = "observe";
1306
- An = "call:";
1307
- Sn = "obsw_";
1308
- Rn = /* @__PURE__ */ new WeakMap();
1309
- Fn = "__walkeros_cache_v__";
1310
- Un = "__walkeros_cache_exp__";
1311
- sr = { Source: ["code", "package", "import", "before", "next", "cache", "state"], Transformer: ["code", "package", "import", "before", "next", "cache", "state", "mapping"], Destination: ["code", "package", "import", "before", "next", "cache", "state"], Store: ["code", "package", "import", "cache"] };
1312
- ir = ["config", "env", "variables", "examples", "disabled", "id", "logger", "mock", "chainMocks"];
1313
- ar = { Source: ["primary"], Transformer: [], Destination: [], Store: [] };
1314
- cr = /^[A-Za-z_$][A-Za-z0-9_$]*$/;
1301
+ It = 9e5;
1302
+ Et = 39e5;
1303
+ Mt = "elbObserve";
1304
+ on = null;
1305
+ Sn = "observe";
1306
+ In = "call:";
1307
+ En = "obsw_";
1308
+ Fn = /* @__PURE__ */ new WeakMap();
1309
+ qn = "__walkeros_cache_v__";
1310
+ Kn = "__walkeros_cache_exp__";
1311
+ cr = { Source: ["code", "package", "import", "before", "next", "cache", "state"], Transformer: ["code", "package", "import", "before", "next", "cache", "state", "mapping"], Destination: ["code", "package", "import", "before", "next", "cache", "state"], Store: ["code", "package", "import", "cache"] };
1312
+ fr = ["config", "env", "variables", "examples", "disabled", "id", "logger", "mock", "chainMocks"];
1313
+ ur = { Source: ["primary"], Transformer: [], Destination: [], Store: [] };
1314
+ lr = /^[A-Za-z_$][A-Za-z0-9_$]*$/;
1315
1315
  }
1316
1316
  });
1317
1317
 
@@ -1320,9 +1320,9 @@ import * as r3 from "http";
1320
1320
  import * as s from "https";
1321
1321
  import { createHash as n2 } from "crypto";
1322
1322
  function a2(a4, n5, i5 = {}) {
1323
- const u2 = pt(i5.headers), c2 = lt(n5), m3 = i5.method || "POST", d2 = i5.timeout || 5e3;
1323
+ const u3 = pt(i5.headers), c2 = lt(n5), m3 = i5.method || "POST", d2 = i5.timeout || 5e3;
1324
1324
  return new Promise((t4) => {
1325
- const e4 = new URL(a4), n6 = "https:" === e4.protocol ? s : r3, i6 = { method: m3, headers: u2 }, p3 = n6.request(e4, i6, (e5) => {
1325
+ const e4 = new URL(a4), n6 = "https:" === e4.protocol ? s : r3, i6 = { method: m3, headers: u3 }, p3 = n6.request(e4, i6, (e5) => {
1326
1326
  const r6 = [];
1327
1327
  e5.on("data", (t5) => {
1328
1328
  r6.push(t5);
@@ -2069,7 +2069,7 @@ function o2(e4, t4, i5 = "draft-7") {
2069
2069
  function J3(e4, t4) {
2070
2070
  return n3.object({ data: n3.union([e4, t4]).optional().describe("Data transformation rules") }).partial();
2071
2071
  }
2072
- function M2(e4) {
2072
+ function M(e4) {
2073
2073
  return n3.object({ mapping: e4.optional().describe("Event mapping rules") }).partial();
2074
2074
  }
2075
2075
  function T3(e4) {
@@ -2093,16 +2093,16 @@ function Wi(e4) {
2093
2093
  function Bi(e4) {
2094
2094
  return zi.safeParse(e4);
2095
2095
  }
2096
- function ln2(e4) {
2096
+ function ln(e4) {
2097
2097
  throw new Error(String(e4));
2098
2098
  }
2099
- function pn(e4, t4) {
2099
+ function pn2(e4, t4) {
2100
2100
  const i5 = false !== t4?.stripAnnotations, n5 = {}, o4 = /* @__PURE__ */ new Set();
2101
2101
  function r6(t5) {
2102
2102
  if (n5[t5]) return n5[t5];
2103
- o4.has(t5) && ln2(`Circular extend chain detected: ${[...o4, t5].join(" \u2192 ")}`);
2103
+ o4.has(t5) && ln(`Circular extend chain detected: ${[...o4, t5].join(" \u2192 ")}`);
2104
2104
  const a4 = e4[t5];
2105
- a4 || ln2(`Contract "${t5}" not found`), o4.add(t5);
2105
+ a4 || ln(`Contract "${t5}" not found`), o4.add(t5);
2106
2106
  let s4 = {};
2107
2107
  if (a4.extend) {
2108
2108
  s4 = (function(e5, t6) {
@@ -2160,7 +2160,7 @@ function un(e4, t4) {
2160
2160
  const i5 = { ...e4 };
2161
2161
  for (const n5 of Object.keys(t4)) {
2162
2162
  const o4 = e4[n5], r6 = t4[n5];
2163
- "required" === n5 && Array.isArray(o4) && Array.isArray(r6) ? i5[n5] = [.../* @__PURE__ */ new Set([...o4, ...r6])] : fn(o4) && fn(r6) ? i5[n5] = un(o4, r6) : i5[n5] = r6;
2163
+ "required" === n5 && Array.isArray(o4) && Array.isArray(r6) ? i5[n5] = [.../* @__PURE__ */ new Set([...o4, ...r6])] : fn2(o4) && fn2(r6) ? i5[n5] = un(o4, r6) : i5[n5] = r6;
2164
2164
  }
2165
2165
  return i5;
2166
2166
  }
@@ -2169,7 +2169,7 @@ function mn(e4) {
2169
2169
  for (const [i5, n5] of Object.entries(e4)) dn.has(i5) || (null === n5 || "object" != typeof n5 || Array.isArray(n5) ? t4[i5] = n5 : t4[i5] = mn(n5));
2170
2170
  return t4;
2171
2171
  }
2172
- function fn(e4) {
2172
+ function fn2(e4) {
2173
2173
  return "object" == typeof e4 && null !== e4 && !Array.isArray(e4);
2174
2174
  }
2175
2175
  function gn(e4, t4) {
@@ -2181,7 +2181,7 @@ function gn(e4, t4) {
2181
2181
  if (e5 instanceof SyntaxError) {
2182
2182
  const i7 = e5.message.match(/position\s+(\d+)/);
2183
2183
  if (i7) {
2184
- return En2(t6, parseInt(i7[1], 10));
2184
+ return En3(t6, parseInt(i7[1], 10));
2185
2185
  }
2186
2186
  const n7 = e5.message.match(/line\s+(\d+)\s+column\s+(\d+)/);
2187
2187
  if (n7) return { line: parseInt(n7[1], 10), column: parseInt(n7[2], 10) };
@@ -2192,7 +2192,7 @@ function gn(e4, t4) {
2192
2192
  }
2193
2193
  const n5 = [], o4 = [], r6 = Li.safeParse(i5);
2194
2194
  if (!r6.success) for (const t5 of r6.error.issues) {
2195
- const i6 = t5.path.join("."), o5 = In2(e4, t5.path);
2195
+ const i6 = t5.path.join("."), o5 = In3(e4, t5.path);
2196
2196
  n5.push({ message: t5.message, severity: "error", path: i6 || "root", ...o5 });
2197
2197
  }
2198
2198
  const a4 = (function(e5) {
@@ -2200,11 +2200,11 @@ function gn(e4, t4) {
2200
2200
  const t5 = {}, i6 = [], n6 = [], o5 = [], r7 = [], a5 = [], s4 = [];
2201
2201
  let c2;
2202
2202
  const l3 = Object.keys(e5.flows);
2203
- Jn2(t5, e5.variables), (function(e6, t6) {
2203
+ Jn(t5, e5.variables), (function(e6, t6) {
2204
2204
  if (!Rn2(t6)) return;
2205
2205
  let i7;
2206
2206
  try {
2207
- i7 = pn(t6, { stripAnnotations: false });
2207
+ i7 = pn2(t6, { stripAnnotations: false });
2208
2208
  } catch {
2209
2209
  return;
2210
2210
  }
@@ -2214,7 +2214,7 @@ function gn(e4, t4) {
2214
2214
  if (!Rn2(n7)) continue;
2215
2215
  let i9 = e6.find((e7) => e7.entity === t8);
2216
2216
  i9 || (i9 = { entity: t8, actions: [], properties: {} }, e6.push(i9)), i9.properties || (i9.properties = {});
2217
- for (const [e7, t9] of Object.entries(n7)) i9.actions.includes(e7) || i9.actions.push(e7), i9.properties[e7] = Mn2(t9);
2217
+ for (const [e7, t9] of Object.entries(n7)) i9.actions.includes(e7) || i9.actions.push(e7), i9.properties[e7] = Mn(t9);
2218
2218
  }
2219
2219
  }
2220
2220
  })(s4, e5.contract);
@@ -2223,12 +2223,12 @@ function gn(e4, t4) {
2223
2223
  const e6 = s5.config;
2224
2224
  !Rn2(e6) || "web" !== e6.platform && "server" !== e6.platform || (c2 = e6.platform);
2225
2225
  }
2226
- Jn2(t5, s5.variables);
2226
+ Jn(t5, s5.variables);
2227
2227
  for (const e6 of ["sources", "destinations", "transformers"]) {
2228
2228
  const r8 = "sources" === e6 ? "source" : "destinations" === e6 ? "destination" : "transformer", l4 = "sources" === e6 ? i6 : "destinations" === e6 ? n6 : o5;
2229
- if (Rn2(s5[e6])) for (const [i7, n7] of Object.entries(s5[e6])) l4.push(i7), Rn2(n7) && (Jn2(t5, n7.variables), "string" == typeof n7.package && a5.push({ package: n7.package, shortName: i7, type: r8, platform: c2 || "web" }));
2229
+ if (Rn2(s5[e6])) for (const [i7, n7] of Object.entries(s5[e6])) l4.push(i7), Rn2(n7) && (Jn(t5, n7.variables), "string" == typeof n7.package && a5.push({ package: n7.package, shortName: i7, type: r8, platform: c2 || "web" }));
2230
2230
  }
2231
- if (Rn2(s5.stores)) for (const [e6, i7] of Object.entries(s5.stores)) r7.push(e6), Rn2(i7) && Jn2(t5, i7.variables);
2231
+ if (Rn2(s5.stores)) for (const [e6, i7] of Object.entries(s5.stores)) r7.push(e6), Rn2(i7) && Jn(t5, i7.variables);
2232
2232
  }
2233
2233
  const d2 = { variables: t5, stepNames: { sources: i6, destinations: n6, transformers: o5, stores: r7 }, flowNames: l3 };
2234
2234
  c2 && (d2.platform = c2);
@@ -2239,9 +2239,9 @@ function gn(e4, t4) {
2239
2239
  return a4 && (t4?.secrets && (a4.secrets = t4.secrets), (function(e5, t5, i6, n6, o5) {
2240
2240
  (function(e6, t6, i7) {
2241
2241
  let n7;
2242
- Sn2.lastIndex = 0;
2243
- for (; null !== (n7 = Sn2.exec(e6)); ) {
2244
- const t7 = n7[0], o6 = n7[1], r7 = n7[2], a5 = On(e6, n7.index, t7.length);
2242
+ Sn3.lastIndex = 0;
2243
+ for (; null !== (n7 = Sn3.exec(e6)); ) {
2244
+ const t7 = n7[0], o6 = n7[1], r7 = n7[2], a5 = On2(e6, n7.index, t7.length);
2245
2245
  i7.push({ message: `Malformed reference "${t7}", use a dot, not a colon: "$${o6}.${r7}".`, severity: "warning", path: t7, ...a5 });
2246
2246
  }
2247
2247
  })(e5, 0, o5), (function(e6, t6, i7) {
@@ -2249,33 +2249,33 @@ function gn(e4, t4) {
2249
2249
  const n7 = /\$var\.(\w+)/g;
2250
2250
  let o6;
2251
2251
  for (; null !== (o6 = n7.exec(e6)); ) if (!(o6[1] in t6.variables)) {
2252
- const n8 = On(e6, o6.index, o6[0].length);
2252
+ const n8 = On2(e6, o6.index, o6[0].length);
2253
2253
  i7.push({ message: `Unknown variable "$var.${o6[1]}". Defined: ${Object.keys(t6.variables).join(", ") || "none"}`, severity: "warning", path: `$var.${o6[1]}`, ...n8 });
2254
2254
  }
2255
2255
  })(e5, i6, o5), (function(e6, t6, i7) {
2256
2256
  const n7 = t6.stepNames?.stores ?? [];
2257
2257
  let o6;
2258
- bn3.lastIndex = 0;
2259
- for (; null !== (o6 = bn3.exec(e6)); ) if (!n7.includes(o6[1])) {
2260
- const t7 = On(e6, o6.index, o6[0].length);
2258
+ bn2.lastIndex = 0;
2259
+ for (; null !== (o6 = bn2.exec(e6)); ) if (!n7.includes(o6[1])) {
2260
+ const t7 = On2(e6, o6.index, o6[0].length);
2261
2261
  i7.push({ message: `Unknown store "$store.${o6[1]}". Defined: ${n7.join(", ") || "none"}`, severity: "warning", path: `$store.${o6[1]}`, ...t7 });
2262
2262
  }
2263
2263
  })(e5, i6, o5), (function(e6, t6, i7) {
2264
2264
  let n7;
2265
- hn2.lastIndex = 0;
2266
- for (; null !== (n7 = hn2.exec(e6)); ) {
2267
- const t7 = n7[0], o6 = n7[1], r7 = n7[2], a5 = On(e6, n7.index, t7.length);
2265
+ hn.lastIndex = 0;
2266
+ for (; null !== (n7 = hn.exec(e6)); ) {
2267
+ const t7 = n7[0], o6 = n7[1], r7 = n7[2], a5 = On2(e6, n7.index, t7.length);
2268
2268
  r7 ? i7.push({ message: `Malformed $env reference "${t7}". Use ":" for default values, not "=" (e.g., "$env.${o6}:fallback").`, severity: "warning", path: t7, ...a5 }) : /^[A-Z][A-Z0-9_]*$/.test(o6) || i7.push({ message: `$env.${o6} should use UPPER_SNAKE_CASE by convention (e.g., $env.${o6.toUpperCase()}).`, severity: "warning", path: t7, ...a5 });
2269
2269
  }
2270
2270
  })(e5, 0, o5), (function(e6, t6, i7) {
2271
2271
  const n7 = t6.flowNames ?? [];
2272
2272
  if (0 === n7.length) return;
2273
2273
  let o6;
2274
- vn3.lastIndex = 0;
2275
- for (; null !== (o6 = vn3.exec(e6)); ) {
2274
+ vn.lastIndex = 0;
2275
+ for (; null !== (o6 = vn.exec(e6)); ) {
2276
2276
  const t7 = o6[0], r7 = o6[1];
2277
2277
  if (!n7.includes(r7)) {
2278
- const a5 = On(e6, o6.index, t7.length);
2278
+ const a5 = On2(e6, o6.index, t7.length);
2279
2279
  i7.push({ message: `Unknown flow "$flow.${r7}". Defined: ${n7.join(", ")}`, severity: "warning", path: t7, ...a5 });
2280
2280
  }
2281
2281
  }
@@ -2286,8 +2286,8 @@ function gn(e4, t4) {
2286
2286
  if (!Rn2(i8)) continue;
2287
2287
  const t7 = i8.config, a5 = !Rn2(t7) || "web" !== t7.platform && "server" !== t7.platform ? void 0 : t7.platform, s4 = JSON.stringify(i8);
2288
2288
  let c2;
2289
- for (yn3.lastIndex = 0; null !== (c2 = yn3.exec(s4)); ) {
2290
- const t8 = c2[0], i9 = c2[1], s5 = e6.indexOf(t8), l3 = -1 === s5 ? { line: 1, column: 1 } : On(e6, s5, t8.length);
2289
+ for (yn2.lastIndex = 0; null !== (c2 = yn2.exec(s4)); ) {
2290
+ const t8 = c2[0], i9 = c2[1], s5 = e6.indexOf(t8), l3 = -1 === s5 ? { line: 1, column: 1 } : On2(e6, s5, t8.length);
2291
2291
  "web" !== a5 ? r7 && !r7.includes(i9) && o6.push({ message: `Unknown secret "$secret.${i9}"; not in the project's registered secrets.`, severity: "warning", path: t8, ...l3 }) : n7.push({ message: `Secret "$secret.${i9}" cannot be used in a web flow \u2014 secrets are never sent to the browser; use a server flow.`, severity: "error", path: t8, ...l3 });
2292
2292
  }
2293
2293
  }
@@ -2297,14 +2297,14 @@ function gn(e4, t4) {
2297
2297
  for (const n6 of Object.values(t5.flows)) {
2298
2298
  if (!Rn2(n6)) continue;
2299
2299
  const t6 = Rn2(n6.stores) ? n6.stores : void 0;
2300
- t6 && jn2(e5, t6, i6), t6 && Rn2(n6.transformers) && Pn2(e5, n6.transformers, t6, i6);
2300
+ t6 && jn(e5, t6, i6), t6 && Rn2(n6.transformers) && Pn2(e5, n6.transformers, t6, i6);
2301
2301
  }
2302
2302
  })(e4, i5, o4), { valid: 0 === n5.length, errors: n5, warnings: o4, context: a4 };
2303
2303
  }
2304
2304
  function xn2(e4) {
2305
2305
  return Rn2(e4.config) && true === e4.config.file;
2306
2306
  }
2307
- function jn2(e4, t4, i5) {
2307
+ function jn(e4, t4, i5) {
2308
2308
  for (const [n5, o4] of Object.entries(t4)) Rn2(o4) && xn2(o4) && void 0 !== o4.cache && i5.push({ message: `Store "${n5}" sets file: true and cache. The cache holds structured values; caching a byte-serving store offers no benefit. Remove cache or unset file.`, severity: "warning", path: `stores.${n5}`, ...Dn2(e4, n5) });
2309
2309
  }
2310
2310
  function Pn2(e4, t4, i5, n5) {
@@ -2324,33 +2324,33 @@ function Pn2(e4, t4, i5, n5) {
2324
2324
  }
2325
2325
  function Dn2(e4, t4) {
2326
2326
  const i5 = e4.indexOf(`"${t4}"`);
2327
- return -1 === i5 ? { line: 1, column: 1 } : En2(e4, i5);
2327
+ return -1 === i5 ? { line: 1, column: 1 } : En3(e4, i5);
2328
2328
  }
2329
- function En2(e4, t4) {
2329
+ function En3(e4, t4) {
2330
2330
  let i5 = 1, n5 = 1;
2331
2331
  for (let o4 = 0; o4 < t4 && o4 < e4.length; o4++) "\n" === e4[o4] ? (i5++, n5 = 1) : n5++;
2332
2332
  return { line: i5, column: n5 };
2333
2333
  }
2334
- function On(e4, t4, i5) {
2335
- const n5 = En2(e4, t4), o4 = En2(e4, t4 + i5);
2334
+ function On2(e4, t4, i5) {
2335
+ const n5 = En3(e4, t4), o4 = En3(e4, t4 + i5);
2336
2336
  return { line: n5.line, column: n5.column, endLine: o4.line, endColumn: o4.column };
2337
2337
  }
2338
- function In2(e4, t4) {
2338
+ function In3(e4, t4) {
2339
2339
  if (0 === t4.length) return { line: 1, column: 1 };
2340
2340
  const i5 = t4[t4.length - 1];
2341
2341
  if ("string" == typeof i5) {
2342
2342
  const t5 = `"${i5}"`, n5 = e4.lastIndexOf(t5);
2343
- if (-1 !== n5) return En2(e4, n5);
2343
+ if (-1 !== n5) return En3(e4, n5);
2344
2344
  }
2345
2345
  return { line: 1, column: 1 };
2346
2346
  }
2347
2347
  function Rn2(e4) {
2348
2348
  return "object" == typeof e4 && null !== e4 && !Array.isArray(e4);
2349
2349
  }
2350
- function Jn2(e4, t4) {
2350
+ function Jn(e4, t4) {
2351
2351
  if (Rn2(t4)) for (const [i5, n5] of Object.entries(t4)) e4[i5] = n5;
2352
2352
  }
2353
- function Mn2(e4) {
2353
+ function Mn(e4) {
2354
2354
  const t4 = {};
2355
2355
  if (!Rn2(e4)) return t4;
2356
2356
  const i5 = Rn2(e4.properties) ? e4.properties.data : void 0;
@@ -2363,7 +2363,7 @@ function Mn2(e4) {
2363
2363
  }
2364
2364
  return t4;
2365
2365
  }
2366
- function Tn2(e4, t4) {
2366
+ function Tn(e4, t4) {
2367
2367
  const i5 = [], n5 = {};
2368
2368
  for (const [t5, o5] of Object.entries(e4)) {
2369
2369
  o5.required && i5.push(t5);
@@ -2387,7 +2387,7 @@ function Fn2(e4) {
2387
2387
  }
2388
2388
  return "array" === e4.type && e4.items && (t4.items = Fn2(e4.items)), t4;
2389
2389
  }
2390
- function $n(e4, t4) {
2390
+ function $n2(e4, t4) {
2391
2391
  const i5 = { type: "array", items: Fn2(e4) };
2392
2392
  return void 0 !== t4?.minItems && (i5.minItems = t4.minItems), void 0 !== t4?.maxItems && (i5.maxItems = t4.maxItems), t4?.description && (i5.description = t4.description), t4?.title && (i5.title = t4.title), i5;
2393
2393
  }
@@ -2396,23 +2396,23 @@ function An2(e4, t4 = "string", i5) {
2396
2396
  return i5?.description && (n5.description = i5.description), i5?.title && (n5.title = i5.title), n5;
2397
2397
  }
2398
2398
  function zn2(e4, t4, i5) {
2399
- return $n({ type: "object" }, { minItems: 2, maxItems: 2, description: i5 || "Tuple with exactly 2 elements [source, transform]" });
2399
+ return $n2({ type: "object" }, { minItems: 2, maxItems: 2, description: i5 || "Tuple with exactly 2 elements [source, transform]" });
2400
2400
  }
2401
2401
  function Ln2(e4) {
2402
2402
  const t4 = n3.toJSONSchema(e4, { target: "draft-7" });
2403
- return qn(t4), t4;
2403
+ return qn3(t4), t4;
2404
2404
  }
2405
- function qn(e4) {
2405
+ function qn3(e4) {
2406
2406
  const t4 = e4.properties;
2407
2407
  if (t4 && "object" == typeof t4) {
2408
2408
  Array.isArray(e4.required) && (e4.required = e4.required.filter((e5) => {
2409
2409
  const i5 = t4[e5];
2410
2410
  return !(i5 && "object" == typeof i5 && "default" in i5);
2411
2411
  }));
2412
- for (const [e5, i5] of Object.entries(t4)) i5 && "object" == typeof i5 && ("object" === i5.type && i5.properties && "string" != typeof i5.title && (i5.title = e5), qn(i5));
2412
+ for (const [e5, i5] of Object.entries(t4)) i5 && "object" == typeof i5 && ("object" === i5.type && i5.properties && "string" != typeof i5.title && (i5.title = e5), qn3(i5));
2413
2413
  }
2414
2414
  }
2415
- var e3, t3, i3, r4, a3, s2, c, l2, d, p, u, m2, f2, g2, b2, h, v2, S, y2, w2, k2, C2, x, j, P2, D2, E, O, I2, R3, $, A, z3, L2, q2, N2, W, B2, U3, _2, H2, V, Z2, G2, K3, Q2, X3, Y3, ee3, te3, ie3, ne3, oe2, re3, ae3, se2, ce, le2, de2, pe2, ue2, me2, fe, ge2, be2, he2, ve2, Se, ye2, we2, ke2, Ce2, xe, je2, Pe2, De, Ee2, Oe2, Ie2, Re3, Je3, Me, Te, Fe3, $e2, Ae, ze2, Le2, qe2, Ne3, We3, Be3, Ue3, _e2, He2, Ve3, Ze3, Ge3, Ke3, Qe3, Xe3, Ye3, et3, tt3, it2, nt3, ot2, rt2, at2, st2, ct2, lt3, dt2, pt3, ut2, mt2, ft2, gt3, bt3, ht3, vt3, St3, yt2, wt3, kt3, Ct2, xt3, jt3, Pt, Dt2, Et2, Ot3, It3, Rt2, Jt2, Mt2, Tt2, Ft, $t3, At3, zt, Lt2, qt2, Nt3, Wt2, Bt, Ut, _t2, Ht2, Vt2, Zt, Gt2, Kt, Qt, Xt, Yt2, ei, ti, ii, ni, oi, ri, ai, si, ci, li, di, pi, ui, mi, fi, gi, bi, hi, vi, Si, yi, wi, ki, Ci, xi, ji, Di, Ei, Oi, Ii, Ri, Ji, Mi, Ti, Fi, $i, Ai, zi, Li, Ui, _i, Hi, Vi, Zi, Gi, Ki, Qi, Xi, Yi, tn2, nn2, on2, rn3, an, sn2, cn, dn, bn3, hn2, vn3, Sn2, yn3, wn3, kn3, Cn3, Wn;
2415
+ var e3, t3, i3, r4, a3, s2, c, l2, d, p, u2, m2, f, g2, b2, h2, v, S, y2, w2, k2, C2, x, j, P2, D2, E, O2, I, R3, $, A, z3, L2, q2, N3, W2, B2, U3, _2, H2, V, Z2, G2, K2, Q2, X3, Y3, ee3, te3, ie3, ne3, oe2, re3, ae3, se2, ce, le2, de2, pe2, ue, me2, fe2, ge2, be2, he2, ve2, Se2, ye2, we2, ke2, Ce2, xe2, je, Pe2, De, Ee2, Oe2, Ie, Re3, Je3, Me2, Te, Fe3, $e2, Ae, ze, Le2, qe2, Ne2, We3, Be3, Ue3, _e2, He2, Ve3, Ze3, Ge3, Ke3, Qe3, Xe3, Ye3, et3, tt3, it2, nt3, ot2, rt2, at2, st2, ct2, lt3, dt2, pt3, ut2, mt2, ft2, gt3, bt3, ht3, vt3, St3, yt2, wt3, kt3, Ct2, xt2, jt3, Pt2, Dt2, Et3, Ot3, It3, Rt, Jt2, Mt3, Tt2, Ft, $t3, At3, zt, Lt2, qt2, Nt2, Wt2, Bt, Ut, _t2, Ht2, Vt2, Zt, Gt2, Kt, Qt, Xt2, Yt2, ei, ti, ii, ni, oi, ri, ai, si, ci, li, di, pi, ui, mi, fi, gi, bi, hi, vi, Si, yi, wi, ki, Ci, xi, ji, Di, Ei, Oi, Ii, Ri, Ji, Mi, Ti, Fi, $i, Ai, zi, Li, Ui, _i, Hi, Vi, Zi, Gi, Ki, Qi, Xi, Yi, tn, nn, on2, rn, an3, sn2, cn2, dn, bn2, hn, vn, Sn3, yn2, wn3, kn3, Cn3, Wn2;
2416
2416
  var init_dev = __esm({
2417
2417
  "../core/dist/dev.mjs"() {
2418
2418
  "use strict";
@@ -2421,7 +2421,7 @@ var init_dev = __esm({
2421
2421
  for (var n5 in i5) e3(t4, n5, { get: i5[n5], enumerable: true });
2422
2422
  };
2423
2423
  i3 = {};
2424
- t3(i3, { BaseContextConfig: () => A, CacheRuleSchema: () => Ye3, CacheSchema: () => et3, CacheSchemas: () => Ze3, ClickIdEntrySchema: () => rn3, CodeSchema: () => tn2, CollectorSchemas: () => Ot3, ConsentSchema: () => Z2, ContractActionsSchema: () => Ji, ContractRuleSchema: () => Ti, ContractSchema: () => Fi, ContractSchemaEntry: () => Ri, Counter: () => d, CredentialsSchema: () => sn2, DeepPartialEventSchema: () => ie3, DestinationSchemas: () => Me, DestinationsMapConfig: () => q2, EntitiesSchema: () => Y3, EntitySchema: () => X3, EventCacheRuleSchema: () => Ge3, EventCacheSchema: () => Ke3, EventSchema: () => ee3, FlowBundlePackageSchema: () => vi, FlowBundleSchema: () => Si, FlowCodeSchema: () => yi, FlowConfigSchema: () => Ai, FlowDestinationSchema: () => Oi, FlowJsonSchema: () => Li, FlowSchema: () => zi, FlowSchemas: () => fi, FlowSourceSchema: () => Di, FlowStoreSchema: () => Ii, FlowTransformerSchema: () => Ei, GenericEnvConfig: () => R3, GenericSettingsConfig: () => I2, HandlersConfig: () => x, HintSchema: () => nn2, HintsSchema: () => on2, IdConfig: () => D2, Identifier: () => c, InitConfig: () => E, LoggerConfigSchema: () => nt3, LoggerHandlerSchema: () => it2, LoopSchema: () => fe, MapSchema: () => be2, MappingResultSchema: () => Ce2, MappingSchemas: () => pe2, MatchExpressionSchema: () => Ae, MatcherSchemas: () => Te, OptionalPrimitiveValue: () => u, OrderedPropertiesSchema: () => H2, PartialEventSchema: () => te3, PolicySchema: () => ve2, PrimaryConfig: () => O, PrimitiveValue: () => p, ProcessingControlConfig: () => z3, PropertiesSchema: () => _2, PropertySchema: () => U3, PropertyTypeSchema: () => B2, QueueConfig: () => P2, RequiredBoolean: () => s2, RequiredNumber: () => a3, RequiredString: () => r4, RouteSchema: () => Be3, RouteWithoutManySchema: () => Ve3, RuleSchema: () => ye2, RulesSchema: () => we2, RuntimeInstanceConfig: () => $, ServiceAccountSchema: () => an, SetSchema: () => ge2, SourceSchema: () => Q2, SourceSchemas: () => Ut, SourceTypeSchema: () => V, SourcesMapConfig: () => L2, StateSchema: () => tt3, StoreCacheRuleSchema: () => Qe3, StoreCacheSchema: () => Xe3, StoreSchemas: () => li, Timestamp: () => l2, TransformerSchemas: () => oi, UserSchema: () => G2, UtilitySchemas: () => m2, ValidateEventsSchema: () => ji, ValueConfigSchema: () => he2, ValueSchema: () => ue2, ValuesSchema: () => me2, VerboseConfig: () => j, WalkerOSSchemas: () => N2, configJsonSchema: () => Ui, consentJsonSchema: () => de2, contractJsonSchema: () => Xi, contractRuleJsonSchema: () => Qi, createArraySchema: () => $n, createConsentConfig: () => F3, createDataTransformationConfig: () => J3, createEnumSchema: () => An2, createMappingRulesConfig: () => M2, createObjectSchema: () => Tn2, createPolicyConfig: () => T3, createTupleSchema: () => zn2, credentialsJsonSchema: () => cn, destinationJsonSchema: () => Zi, entityJsonSchema: () => ce, eventJsonSchema: () => ne3, flowConfigJsonSchema: () => Hi, flowJsonSchema: () => _i, loopJsonSchema: () => Pe2, mapJsonSchema: () => Ee2, orderedPropertiesJsonSchema: () => se2, parseConfig: () => qi, parseFlow: () => Wi, partialEventJsonSchema: () => oe2, policyJsonSchema: () => Oe2, propertiesJsonSchema: () => ae3, ruleJsonSchema: () => Ie2, rulesJsonSchema: () => Re3, safeParseConfig: () => Ni, safeParseFlow: () => Bi, setJsonSchema: () => De, sourceJsonSchema: () => Vi, sourceTypeJsonSchema: () => le2, storeJsonSchema: () => Ki, transformerJsonSchema: () => Gi, userJsonSchema: () => re3, validateEventsJsonSchema: () => Yi, validateFlowConfig: () => gn, valueConfigJsonSchema: () => je2, valueJsonSchema: () => xe, z: () => n3, zodToSchema: () => Ln2 });
2424
+ t3(i3, { BaseContextConfig: () => A, CacheRuleSchema: () => Ye3, CacheSchema: () => et3, CacheSchemas: () => Ze3, ClickIdEntrySchema: () => rn, CodeSchema: () => tn, CollectorSchemas: () => Ot3, ConsentSchema: () => Z2, ContractActionsSchema: () => Ji, ContractRuleSchema: () => Ti, ContractSchema: () => Fi, ContractSchemaEntry: () => Ri, Counter: () => d, CredentialsSchema: () => sn2, DeepPartialEventSchema: () => ie3, DestinationSchemas: () => Me2, DestinationsMapConfig: () => q2, EntitiesSchema: () => Y3, EntitySchema: () => X3, EventCacheRuleSchema: () => Ge3, EventCacheSchema: () => Ke3, EventSchema: () => ee3, FlowBundlePackageSchema: () => vi, FlowBundleSchema: () => Si, FlowCodeSchema: () => yi, FlowConfigSchema: () => Ai, FlowDestinationSchema: () => Oi, FlowJsonSchema: () => Li, FlowSchema: () => zi, FlowSchemas: () => fi, FlowSourceSchema: () => Di, FlowStoreSchema: () => Ii, FlowTransformerSchema: () => Ei, GenericEnvConfig: () => R3, GenericSettingsConfig: () => I, HandlersConfig: () => x, HintSchema: () => nn, HintsSchema: () => on2, IdConfig: () => D2, Identifier: () => c, InitConfig: () => E, LoggerConfigSchema: () => nt3, LoggerHandlerSchema: () => it2, LoopSchema: () => fe2, MapSchema: () => be2, MappingResultSchema: () => Ce2, MappingSchemas: () => pe2, MatchExpressionSchema: () => Ae, MatcherSchemas: () => Te, OptionalPrimitiveValue: () => u2, OrderedPropertiesSchema: () => H2, PartialEventSchema: () => te3, PolicySchema: () => ve2, PrimaryConfig: () => O2, PrimitiveValue: () => p, ProcessingControlConfig: () => z3, PropertiesSchema: () => _2, PropertySchema: () => U3, PropertyTypeSchema: () => B2, QueueConfig: () => P2, RequiredBoolean: () => s2, RequiredNumber: () => a3, RequiredString: () => r4, RouteSchema: () => Be3, RouteWithoutManySchema: () => Ve3, RuleSchema: () => ye2, RulesSchema: () => we2, RuntimeInstanceConfig: () => $, ServiceAccountSchema: () => an3, SetSchema: () => ge2, SourceSchema: () => Q2, SourceSchemas: () => Ut, SourceTypeSchema: () => V, SourcesMapConfig: () => L2, StateSchema: () => tt3, StoreCacheRuleSchema: () => Qe3, StoreCacheSchema: () => Xe3, StoreSchemas: () => li, Timestamp: () => l2, TransformerSchemas: () => oi, UserSchema: () => G2, UtilitySchemas: () => m2, ValidateEventsSchema: () => ji, ValueConfigSchema: () => he2, ValueSchema: () => ue, ValuesSchema: () => me2, VerboseConfig: () => j, WalkerOSSchemas: () => N3, configJsonSchema: () => Ui, consentJsonSchema: () => de2, contractJsonSchema: () => Xi, contractRuleJsonSchema: () => Qi, createArraySchema: () => $n2, createConsentConfig: () => F3, createDataTransformationConfig: () => J3, createEnumSchema: () => An2, createMappingRulesConfig: () => M, createObjectSchema: () => Tn, createPolicyConfig: () => T3, createTupleSchema: () => zn2, credentialsJsonSchema: () => cn2, destinationJsonSchema: () => Zi, entityJsonSchema: () => ce, eventJsonSchema: () => ne3, flowConfigJsonSchema: () => Hi, flowJsonSchema: () => _i, loopJsonSchema: () => Pe2, mapJsonSchema: () => Ee2, orderedPropertiesJsonSchema: () => se2, parseConfig: () => qi, parseFlow: () => Wi, partialEventJsonSchema: () => oe2, policyJsonSchema: () => Oe2, propertiesJsonSchema: () => ae3, ruleJsonSchema: () => Ie, rulesJsonSchema: () => Re3, safeParseConfig: () => Ni, safeParseFlow: () => Bi, setJsonSchema: () => De, sourceJsonSchema: () => Vi, sourceTypeJsonSchema: () => le2, storeJsonSchema: () => Ki, transformerJsonSchema: () => Gi, userJsonSchema: () => re3, validateEventsJsonSchema: () => Yi, validateFlowConfig: () => gn, valueConfigJsonSchema: () => je, valueJsonSchema: () => xe2, z: () => n3, zodToSchema: () => Ln2 });
2425
2425
  r4 = n3.string();
2426
2426
  a3 = n3.number();
2427
2427
  s2 = n3.boolean();
@@ -2429,34 +2429,34 @@ var init_dev = __esm({
2429
2429
  l2 = n3.number().int().positive();
2430
2430
  d = n3.number().int().nonnegative();
2431
2431
  p = n3.union([n3.string(), n3.number(), n3.boolean()]);
2432
- u = p.optional();
2432
+ u2 = p.optional();
2433
2433
  m2 = {};
2434
- t3(m2, { ErrorHandlerSchema: () => b2, HandlerSchema: () => v2, LogHandlerSchema: () => h, StorageSchema: () => g2, StorageTypeSchema: () => f2, errorHandlerJsonSchema: () => w2, handlerJsonSchema: () => C2, logHandlerJsonSchema: () => k2, storageJsonSchema: () => y2, storageTypeJsonSchema: () => S });
2435
- f2 = n3.enum(["local", "session", "cookie"]).meta({ id: "StorageType", title: "Storage.Type", description: "Storage mechanism: local, session, or cookie." }).describe("Storage mechanism: local, session, or cookie");
2434
+ t3(m2, { ErrorHandlerSchema: () => b2, HandlerSchema: () => v, LogHandlerSchema: () => h2, StorageSchema: () => g2, StorageTypeSchema: () => f, errorHandlerJsonSchema: () => w2, handlerJsonSchema: () => C2, logHandlerJsonSchema: () => k2, storageJsonSchema: () => y2, storageTypeJsonSchema: () => S });
2435
+ f = n3.enum(["local", "session", "cookie"]).meta({ id: "StorageType", title: "Storage.Type", description: "Storage mechanism: local, session, or cookie." }).describe("Storage mechanism: local, session, or cookie");
2436
2436
  g2 = n3.object({ Local: n3.literal("local"), Session: n3.literal("session"), Cookie: n3.literal("cookie") }).meta({ id: "StorageConstants", title: "Storage", description: "Storage type constants for type-safe references." }).describe("Storage type constants for type-safe references");
2437
2437
  b2 = n3.unknown().meta({ id: "ErrorHandler", title: "Error.Handler", description: "Error handler function: (error, state?) => void." }).describe("Error handler function: (error, state?) => void");
2438
- h = n3.unknown().meta({ id: "LogHandler", title: "Log.Handler", description: "Log handler function: (message, verbose?) => void." }).describe("Log handler function: (message, verbose?) => void");
2439
- v2 = n3.object({ Error: b2.describe("Error handler function"), Log: h.describe("Log handler function") }).meta({ id: "Handler", title: "Handler", description: "Handler interface with error and log functions." }).describe("Handler interface with error and log functions");
2440
- S = o2(f2);
2438
+ h2 = n3.unknown().meta({ id: "LogHandler", title: "Log.Handler", description: "Log handler function: (message, verbose?) => void." }).describe("Log handler function: (message, verbose?) => void");
2439
+ v = n3.object({ Error: b2.describe("Error handler function"), Log: h2.describe("Log handler function") }).meta({ id: "Handler", title: "Handler", description: "Handler interface with error and log functions." }).describe("Handler interface with error and log functions");
2440
+ S = o2(f);
2441
2441
  y2 = o2(g2);
2442
2442
  w2 = o2(b2);
2443
- k2 = o2(h);
2444
- C2 = o2(v2);
2445
- x = n3.object({ onError: b2.optional().describe("Error handler function: (error, state?) => void"), onLog: h.optional().describe("Log handler function: (message, verbose?) => void") }).partial();
2443
+ k2 = o2(h2);
2444
+ C2 = o2(v);
2445
+ x = n3.object({ onError: b2.optional().describe("Error handler function: (error, state?) => void"), onLog: h2.optional().describe("Log handler function: (message, verbose?) => void") }).partial();
2446
2446
  j = n3.object({ verbose: n3.boolean().describe("Enable verbose logging for debugging").optional() }).partial();
2447
2447
  P2 = n3.object({ queue: n3.boolean().describe("Whether to queue events when consent is not granted").optional() }).partial();
2448
2448
  D2 = n3.object({}).partial();
2449
2449
  E = 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();
2450
- O = n3.object({ primary: n3.boolean().describe("Mark as primary (only one can be primary)").optional() }).partial();
2451
- I2 = n3.object({ settings: n3.any().optional().describe("Implementation-specific configuration") }).partial();
2450
+ O2 = n3.object({ primary: n3.boolean().describe("Mark as primary (only one can be primary)").optional() }).partial();
2451
+ I = n3.object({ settings: n3.any().optional().describe("Implementation-specific configuration") }).partial();
2452
2452
  R3 = n3.object({ env: n3.any().optional().describe("Environment dependencies (platform-specific)") }).partial();
2453
2453
  $ = n3.object({ type: n3.string().optional().describe("Instance type identifier"), config: n3.unknown().describe("Instance configuration") }).partial();
2454
2454
  A = n3.object({ collector: n3.unknown().describe("Collector instance (runtime object)"), config: n3.unknown().describe("Configuration"), env: n3.unknown().describe("Environment dependencies") }).partial();
2455
2455
  z3 = n3.object({ ignore: n3.boolean().describe("Set to true to skip processing").optional(), condition: n3.string().optional().describe("Condition function: return true to process") }).partial();
2456
2456
  L2 = n3.object({ sources: n3.record(n3.string(), n3.unknown()).describe("Map of source instances") }).partial();
2457
2457
  q2 = n3.object({ destinations: n3.record(n3.string(), n3.unknown()).describe("Map of destination instances") }).partial();
2458
- N2 = {};
2459
- t3(N2, { ConsentSchema: () => Z2, DeepPartialEventSchema: () => ie3, EntitiesSchema: () => Y3, EntitySchema: () => X3, EventSchema: () => ee3, OrderedPropertiesSchema: () => H2, PartialEventSchema: () => te3, PropertiesSchema: () => _2, PropertySchema: () => U3, PropertyTypeSchema: () => B2, SourceFieldsSchema: () => K3, SourceSchema: () => Q2, SourceTypeSchema: () => V, UserSchema: () => G2, consentJsonSchema: () => de2, entityJsonSchema: () => ce, eventJsonSchema: () => ne3, orderedPropertiesJsonSchema: () => se2, partialEventJsonSchema: () => oe2, propertiesJsonSchema: () => ae3, sourceTypeJsonSchema: () => le2, userJsonSchema: () => re3 });
2458
+ N3 = {};
2459
+ t3(N3, { ConsentSchema: () => Z2, DeepPartialEventSchema: () => ie3, EntitiesSchema: () => Y3, EntitySchema: () => X3, EventSchema: () => ee3, OrderedPropertiesSchema: () => H2, PartialEventSchema: () => te3, PropertiesSchema: () => _2, PropertySchema: () => U3, PropertyTypeSchema: () => B2, SourceFieldsSchema: () => K2, SourceSchema: () => Q2, SourceTypeSchema: () => V, UserSchema: () => G2, consentJsonSchema: () => de2, entityJsonSchema: () => ce, eventJsonSchema: () => ne3, orderedPropertiesJsonSchema: () => se2, partialEventJsonSchema: () => oe2, propertiesJsonSchema: () => ae3, sourceTypeJsonSchema: () => le2, userJsonSchema: () => re3 });
2460
2460
  B2 = n3.lazy(() => n3.union([n3.boolean(), n3.string(), n3.number(), n3.record(n3.string(), U3)])).meta({ id: "WalkerOSPropertyType", title: "WalkerOS.PropertyType", description: "Base property value types (boolean, string, number, or nested Property record)." });
2461
2461
  U3 = 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." });
2462
2462
  _2 = n3.record(n3.string(), U3.optional()).meta({ id: "WalkerOSProperties", title: "WalkerOS.Properties", description: "Flexible property collection with optional values." }).describe("Flexible property collection with optional values");
@@ -2464,8 +2464,8 @@ var init_dev = __esm({
2464
2464
  V = n3.union([n3.enum(["web", "server", "app", "other"]), n3.string()]).meta({ id: "WalkerOSSourceType", title: "WalkerOS.SourceType", description: "Source type identifier. Standard: web, server, app, other. Extensible to custom strings." }).describe("Source type: web, server, app, other, or custom");
2465
2465
  Z2 = n3.record(n3.string(), n3.boolean()).meta({ id: "WalkerOSConsent", title: "WalkerOS.Consent", description: "Consent state mapping. Keys are consent groups (e.g. marketing, functional), values are booleans for granted/denied." }).describe("Consent requirement mapping (group name to state)");
2466
2466
  G2 = _2.and(n3.object({ id: n3.string().optional().describe("User identifier"), device: n3.string().optional().describe("Device identifier"), session: n3.string().optional().describe("Session identifier"), hash: n3.string().optional().describe("Hashed identifier"), address: n3.string().optional().describe("User address"), email: n3.string().email().optional().describe("User email address"), phone: n3.string().optional().describe("User phone number"), userAgent: n3.string().optional().describe("Browser user agent string"), browser: n3.string().optional().describe("Browser name"), browserVersion: n3.string().optional().describe("Browser version"), deviceType: n3.string().optional().describe("Device type (mobile, desktop, tablet)"), os: n3.string().optional().describe("Operating system"), osVersion: n3.string().optional().describe("Operating system version"), screenSize: n3.string().optional().describe("Screen dimensions"), language: n3.string().optional().describe("User language"), country: n3.string().optional().describe("User country"), region: n3.string().optional().describe("User region/state"), city: n3.string().optional().describe("User city"), zip: n3.string().optional().describe("User postal code"), timezone: n3.string().optional().describe("User timezone"), ip: n3.string().optional().describe("User IP address"), internal: n3.boolean().optional().describe("Internal user flag (employee, test user)") })).meta({ id: "WalkerOSUser", title: "WalkerOS.User", description: "User identification and attributes." }).describe("User identification and properties");
2467
- K3 = 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("Trace id shared by every event of a run (W3C trace-id shape)"), release: n3.record(n3.string(), n3.string()).optional().describe("Per-flow config release map, keyed by flow name; accumulates across walkerOS crossings"), url: n3.string().optional(), referrer: n3.string().optional(), tool: n3.string().optional(), command: n3.string().optional() });
2468
- Q2 = _2.and(K3).meta({ id: "WalkerOSSource", title: "WalkerOS.Source", description: "Event source information (origin of the event)." }).describe("Event source information");
2467
+ K2 = 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("Trace id shared by every event of a run (W3C trace-id shape)"), release: n3.record(n3.string(), n3.string()).optional().describe("Per-flow config release map, keyed by flow name; accumulates across walkerOS crossings"), url: n3.string().optional(), referrer: n3.string().optional(), tool: n3.string().optional(), command: n3.string().optional() });
2468
+ Q2 = _2.and(K2).meta({ id: "WalkerOSSource", title: "WalkerOS.Source", description: "Event source information (origin of the event)." }).describe("Event source information");
2469
2469
  X3 = n3.lazy(() => n3.object({ entity: n3.string().describe("Entity name"), data: _2.describe("Entity-specific properties"), nested: n3.array(X3).optional().describe("Nested child entities"), context: H2.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");
2470
2470
  Y3 = n3.array(X3).meta({ id: "WalkerOSEntities", title: "WalkerOS.Entities", description: "Array of nested entities." }).describe("Array of nested entities");
2471
2471
  ee3 = n3.object({ name: n3.string().describe('Event name in "entity action" format (e.g., "page view", "product add")'), data: _2.describe("Event-specific properties"), context: H2.describe("Ordered context properties with priorities"), globals: _2.describe("Global properties shared across events"), custom: _2.describe("Custom implementation-specific properties"), user: G2.describe("User identification and attributes"), nested: Y3.describe("Related nested entities"), consent: Z2.describe("Consent states at event time"), id: c.describe("W3C span_id, 16 lowercase hex characters"), trigger: r4.describe("Event trigger identifier"), entity: r4.describe("Parsed entity from event name"), action: r4.describe("Parsed action from event name"), timestamp: l2.describe("Unix timestamp in milliseconds since epoch"), timing: a3.describe("Event processing timing information"), source: Q2.describe("Event source information") }).meta({ id: "WalkerOSEvent", title: "WalkerOS.Event", description: "Complete walkerOS event structure." }).describe("Complete walkerOS event structure");
@@ -2480,54 +2480,54 @@ var init_dev = __esm({
2480
2480
  le2 = o2(V);
2481
2481
  de2 = o2(Z2);
2482
2482
  pe2 = {};
2483
- t3(pe2, { ConfigSchema: () => ke2, LoopSchema: () => fe, MapSchema: () => be2, PolicySchema: () => ve2, ResultSchema: () => Ce2, RulePatchSchema: () => Se, RuleSchema: () => ye2, RulesSchema: () => we2, SetSchema: () => ge2, ValueConfigSchema: () => he2, ValueSchema: () => ue2, ValuesSchema: () => me2, configJsonSchema: () => Je3, loopJsonSchema: () => Pe2, mapJsonSchema: () => Ee2, policyJsonSchema: () => Oe2, ruleJsonSchema: () => Ie2, rulesJsonSchema: () => Re3, setJsonSchema: () => De, valueConfigJsonSchema: () => je2, valueJsonSchema: () => xe });
2484
- ue2 = 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(ue2).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." });
2485
- me2 = n3.array(ue2).meta({ id: "MappingValues", title: "Mapping.Values", description: "Array of transformation values." }).describe("Array of transformation values");
2486
- fe = n3.lazy(() => n3.tuple([ue2, ue2]).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." });
2487
- ge2 = n3.lazy(() => n3.array(ue2).describe("Set: Array of values for selection or combination")).meta({ id: "MappingSet", title: "Mapping.Set", description: "Set: array of values for selection or combination." });
2488
- be2 = n3.lazy(() => n3.record(n3.string(), ue2).describe("Map: Object mapping keys to transformation values")).meta({ id: "MappingMap", title: "Mapping.Map", description: "Map: object mapping keys to transformation values." });
2489
- 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: be2.optional().describe("Object mapping: transform event data to structured output"), loop: fe.optional().describe("Loop transformation: [source, transform] for array processing"), set: ge2.optional().describe("Set of values: combine or select from multiple values"), consent: Z2.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");
2490
- ve2 = n3.record(n3.string(), ue2).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)");
2491
- Se = n3.object({ name: n3.string().nullable().optional(), data: n3.union([ue2, me2]).nullable().optional(), settings: n3.unknown().nullable().optional(), condition: n3.string().nullable().optional(), consent: Z2.nullable().optional(), policy: ve2.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");
2492
- ye2 = n3.object({ name: n3.string().optional().describe('Custom event name override (e.g., "view_item" for "product view")'), data: n3.union([ue2, me2]).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: Z2.optional().describe("Required consent states to process this event"), policy: ve2.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: Se.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");
2483
+ t3(pe2, { ConfigSchema: () => ke2, LoopSchema: () => fe2, MapSchema: () => be2, PolicySchema: () => ve2, ResultSchema: () => Ce2, RulePatchSchema: () => Se2, RuleSchema: () => ye2, RulesSchema: () => we2, SetSchema: () => ge2, ValueConfigSchema: () => he2, ValueSchema: () => ue, ValuesSchema: () => me2, configJsonSchema: () => Je3, loopJsonSchema: () => Pe2, mapJsonSchema: () => Ee2, policyJsonSchema: () => Oe2, ruleJsonSchema: () => Ie, rulesJsonSchema: () => Re3, setJsonSchema: () => De, valueConfigJsonSchema: () => je, valueJsonSchema: () => xe2 });
2484
+ ue = 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(() => W2), n3.array(ue).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." });
2485
+ me2 = n3.array(ue).meta({ id: "MappingValues", title: "Mapping.Values", description: "Array of transformation values." }).describe("Array of transformation values");
2486
+ fe2 = n3.lazy(() => n3.tuple([ue, ue]).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." });
2487
+ ge2 = n3.lazy(() => n3.array(ue).describe("Set: Array of values for selection or combination")).meta({ id: "MappingSet", title: "Mapping.Set", description: "Set: array of values for selection or combination." });
2488
+ be2 = n3.lazy(() => n3.record(n3.string(), ue).describe("Map: Object mapping keys to transformation values")).meta({ id: "MappingMap", title: "Mapping.Map", description: "Map: object mapping keys to transformation values." });
2489
+ he2 = W2 = 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: be2.optional().describe("Object mapping: transform event data to structured output"), loop: fe2.optional().describe("Loop transformation: [source, transform] for array processing"), set: ge2.optional().describe("Set of values: combine or select from multiple values"), consent: Z2.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");
2490
+ ve2 = n3.record(n3.string(), ue).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)");
2491
+ Se2 = n3.object({ name: n3.string().nullable().optional(), data: n3.union([ue, me2]).nullable().optional(), settings: n3.unknown().nullable().optional(), condition: n3.string().nullable().optional(), consent: Z2.nullable().optional(), policy: ve2.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");
2492
+ ye2 = n3.object({ name: n3.string().optional().describe('Custom event name override (e.g., "view_item" for "product view")'), data: n3.union([ue, me2]).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: Z2.optional().describe("Required consent states to process this event"), policy: ve2.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: Se2.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");
2493
2493
  we2 = n3.record(n3.string(), n3.record(n3.string(), n3.union([ye2, n3.array(ye2)])).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*).');
2494
- ke2 = n3.object({ consent: Z2.optional().describe("Required consent states to process any events"), data: n3.union([ue2, me2]).optional().describe("Global data transformation applied to all events"), include: n3.array(n3.string()).optional().describe("Event sections to flatten into context.data"), mapping: we2.optional().describe("Entity-action specific mapping rules"), policy: ve2.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");
2494
+ ke2 = n3.object({ consent: Z2.optional().describe("Required consent states to process any events"), data: n3.union([ue, me2]).optional().describe("Global data transformation applied to all events"), include: n3.array(n3.string()).optional().describe("Event sections to flatten into context.data"), mapping: we2.optional().describe("Entity-action specific mapping rules"), policy: ve2.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");
2495
2495
  Ce2 = n3.object({ eventMapping: ye2.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");
2496
- xe = o2(ue2);
2497
- je2 = o2(he2);
2498
- Pe2 = o2(fe);
2496
+ xe2 = o2(ue);
2497
+ je = o2(he2);
2498
+ Pe2 = o2(fe2);
2499
2499
  De = o2(ge2);
2500
2500
  Ee2 = o2(be2);
2501
2501
  Oe2 = o2(ve2);
2502
- Ie2 = o2(ye2);
2502
+ Ie = o2(ye2);
2503
2503
  Re3 = o2(we2);
2504
2504
  Je3 = o2(ke2);
2505
- Me = {};
2506
- t3(Me, { BatchSchema: () => ut2, ConfigSchema: () => ot2, ContextSchema: () => st2, DLQSchema: () => wt3, DataSchema: () => mt2, DestinationPolicySchema: () => at2, DestinationsSchema: () => ht3, InitDestinationsSchema: () => bt3, InitSchema: () => gt3, InstanceSchema: () => ft2, PartialConfigSchema: () => rt2, PushBatchContextSchema: () => lt3, PushContextSchema: () => ct2, PushEventSchema: () => dt2, PushEventsSchema: () => pt3, PushResultSchema: () => St3, RefSchema: () => vt3, ResultSchema: () => yt2, batchJsonSchema: () => Pt, configJsonSchema: () => kt3, contextJsonSchema: () => xt3, instanceJsonSchema: () => Dt2, partialConfigJsonSchema: () => Ct2, pushContextJsonSchema: () => jt3, resultJsonSchema: () => Et2 });
2505
+ Me2 = {};
2506
+ t3(Me2, { BatchSchema: () => ut2, ConfigSchema: () => ot2, ContextSchema: () => st2, DLQSchema: () => wt3, DataSchema: () => mt2, DestinationPolicySchema: () => at2, DestinationsSchema: () => ht3, InitDestinationsSchema: () => bt3, InitSchema: () => gt3, InstanceSchema: () => ft2, PartialConfigSchema: () => rt2, PushBatchContextSchema: () => lt3, PushContextSchema: () => ct2, PushEventSchema: () => dt2, PushEventsSchema: () => pt3, PushResultSchema: () => St3, RefSchema: () => vt3, ResultSchema: () => yt2, batchJsonSchema: () => Pt2, configJsonSchema: () => kt3, contextJsonSchema: () => xt2, instanceJsonSchema: () => Dt2, partialConfigJsonSchema: () => Ct2, pushContextJsonSchema: () => jt3, resultJsonSchema: () => Et3 });
2507
2507
  Te = {};
2508
2508
  t3(Te, { MatchExpressionSchema: () => Ae, RouteSchema: () => Be3, RouteWithoutManySchema: () => Ve3 });
2509
2509
  Fe3 = n3.enum(["eq", "contains", "prefix", "suffix", "regex", "gt", "lt", "exists"]).meta({ id: "MatcherOperator", title: "Matcher.Operator", description: "Supported operators for a match condition." });
2510
2510
  $e2 = n3.object({ key: n3.string(), operator: Fe3, value: n3.string(), not: n3.boolean().optional() }).meta({ id: "MatcherCondition", title: "Matcher.Condition", description: "Single match condition (key, operator, value, optional not)." });
2511
2511
  Ae = n3.union([$e2, n3.object({ and: n3.array(n3.lazy(() => Ae)) }), n3.object({ or: n3.array(n3.lazy(() => Ae)) })]).meta({ id: "MatcherExpression", title: "Matcher.Expression", description: "Boolean expression tree of match conditions (leaf, and, or)." });
2512
- ze2 = n3.strictObject({ match: Ae.optional(), next: n3.lazy(() => Be3) });
2512
+ ze = n3.strictObject({ match: Ae.optional(), next: n3.lazy(() => Be3) });
2513
2513
  Le2 = n3.strictObject({ match: Ae.optional(), one: n3.array(n3.lazy(() => Be3)) });
2514
2514
  qe2 = n3.strictObject({ match: Ae.optional(), many: n3.array(n3.lazy(() => Be3)) });
2515
- Ne3 = n3.strictObject({ match: Ae });
2516
- We3 = n3.union([ze2, Le2, qe2, Ne3]);
2515
+ Ne2 = n3.strictObject({ match: Ae });
2516
+ We3 = n3.union([ze, Le2, qe2, Ne2]);
2517
2517
  Be3 = n3.union([n3.string(), n3.array(n3.lazy(() => Be3)), We3]).meta({ id: "Route", title: "Route", description: "Recursive route: string ID, sequence of routes, or a RouteConfig (next/one/many/gate)." });
2518
2518
  Ue3 = n3.strictObject({ match: Ae.optional(), next: n3.lazy(() => Ve3) });
2519
2519
  _e2 = n3.strictObject({ match: Ae.optional(), one: n3.array(n3.lazy(() => Ve3)) });
2520
- He2 = n3.union([Ue3, _e2, Ne3]);
2520
+ He2 = n3.union([Ue3, _e2, Ne2]);
2521
2521
  Ve3 = n3.union([n3.string(), n3.array(n3.lazy(() => Ve3)), He2]).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." });
2522
2522
  Ze3 = {};
2523
2523
  t3(Ze3, { CacheRuleSchema: () => Ye3, CacheSchema: () => et3, EventCacheRuleSchema: () => Ge3, EventCacheSchema: () => Ke3, StoreCacheRuleSchema: () => Qe3, StoreCacheSchema: () => Xe3 });
2524
- Ge3 = n3.object({ match: Ae.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(), ue2).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." });
2524
+ Ge3 = n3.object({ match: Ae.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(), ue).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." });
2525
2525
  Ke3 = 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(Ge3).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)." });
2526
2526
  Qe3 = n3.strictObject({ match: Ae.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)." });
2527
2527
  Xe3 = 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(Qe3).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." });
2528
2528
  Ye3 = Ge3;
2529
2529
  et3 = Ke3;
2530
- tt3 = n3.object({ mode: n3.enum(["get", "set"]).describe("Direction: 'get' reads from the store, 'set' writes to it"), store: n3.string().optional().describe("Store id; defaults to the in-memory __cache store when omitted"), key: ue2.describe("Resolves against the event to the store key"), value: ue2.optional().describe("set: resolves to the payload to store. get: its key/bare-string path is the event write-target.") }).superRefine((e4, t4) => {
2530
+ tt3 = n3.object({ mode: n3.enum(["get", "set"]).describe("Direction: 'get' reads from the store, 'set' writes to it"), store: n3.string().optional().describe("Store id; defaults to the in-memory __cache store when omitted"), key: ue.describe("Resolves against the event to the store key"), value: ue.optional().describe("set: resolves to the payload to store. get: its key/bare-string path is the event write-target.") }).superRefine((e4, t4) => {
2531
2531
  if (void 0 !== e4.value) {
2532
2532
  if ("get" === e4.mode) {
2533
2533
  const i5 = e4.value;
@@ -2544,7 +2544,7 @@ var init_dev = __esm({
2544
2544
  }).meta({ id: "StateConfig", title: "State.Config", description: "Declarative store operation: stash (set) or fetch (get) a value against a store. key = store side, value = event side, mode = direction." });
2545
2545
  it2 = n3.any().meta({ id: "LoggerHandler", title: "Logger.Handler", description: "Custom log handler function (level, ...args) => void" });
2546
2546
  nt3 = n3.object({ level: n3.union([n3.number(), n3.enum(["ERROR", "WARN", "INFO", "DEBUG"])]).optional().describe("Minimum log level (default: ERROR)"), handler: it2.optional().describe("Custom log handler function") }).meta({ id: "LoggerConfig", title: "Logger.Config", description: "Logger configuration (level, handler) to override the collector defaults" });
2547
- ot2 = n3.object({ consent: Z2.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(), credentials: n3.any().meta({ id: "DestinationCredentials", title: "Destination.Credentials", description: "Optional credentials slot (destination-defined shape); back it with a managed secret via $secret.NAME (credentials use $secret, not $env). The per-package shape is supplied via mergeConfigSchema." }).describe("Optional credentials (destination-defined shape)").optional(), data: n3.union([ue2, me2]).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: we2.optional().describe("Entity-action specific mapping rules for this destination"), policy: ve2.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: nt3.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: Ve3.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: Ve3.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: Ke3.optional().describe("Cache configuration for deduplication; skip push on cache HIT"), state: n3.union([tt3, n3.array(tt3)]).optional().describe("Declarative store get/set operations applied around this destination"), 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."), timeout: n3.number().optional().describe("Per-destination delivery timeout in ms (default 10000); a delivery that does not settle in this window is routed to the DLQ like a thrown push."), batch: n3.union([n3.number(), n3.object({ wait: n3.number().optional(), size: n3.number().optional(), age: n3.number().optional() })]).optional().describe("Enables batching for all of this destination's events into one shared default buffer; a mapping rule's own batch splits that entity-action into its own buffer and overrides per field. Bare number is the debounce wait window; object form supports wait (debounce ms), size (count cap, default 1000), age (max ms since first entry, default 30000)."), breaker: n3.union([n3.number(), n3.object({ threshold: n3.number().optional(), cooldown: n3.number().optional() })]).optional().describe("Per-destination circuit breaker (presence-gated). After threshold consecutive transport failures the breaker opens and events are skipped until cooldown ms elapse, then one probe is admitted; success closes it, failure re-opens it. Partial-batch row failures are breaker-neutral. Bare number is the threshold; object form supports threshold (default 5) and cooldown (default 30000ms).") }).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");
2547
+ ot2 = n3.object({ consent: Z2.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(), credentials: n3.any().meta({ id: "DestinationCredentials", title: "Destination.Credentials", description: "Optional credentials slot (destination-defined shape); back it with a managed secret via $secret.NAME (credentials use $secret, not $env). The per-package shape is supplied via mergeConfigSchema." }).describe("Optional credentials (destination-defined shape)").optional(), data: n3.union([ue, me2]).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: we2.optional().describe("Entity-action specific mapping rules for this destination"), policy: ve2.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: nt3.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: Ve3.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: Ve3.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: Ke3.optional().describe("Cache configuration for deduplication; skip push on cache HIT"), state: n3.union([tt3, n3.array(tt3)]).optional().describe("Declarative store get/set operations applied around this destination"), 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."), timeout: n3.number().optional().describe("Per-destination delivery timeout in ms (default 10000); a delivery that does not settle in this window is routed to the DLQ like a thrown push."), batch: n3.union([n3.number(), n3.object({ wait: n3.number().optional(), size: n3.number().optional(), age: n3.number().optional() })]).optional().describe("Enables batching for all of this destination's events into one shared default buffer; a mapping rule's own batch splits that entity-action into its own buffer and overrides per field. Bare number is the debounce wait window; object form supports wait (debounce ms), size (count cap, default 1000), age (max ms since first entry, default 30000)."), breaker: n3.union([n3.number(), n3.object({ threshold: n3.number().optional(), cooldown: n3.number().optional() })]).optional().describe("Per-destination circuit breaker (presence-gated). After threshold consecutive transport failures the breaker opens and events are skipped until cooldown ms elapse, then one probe is admitted; success closes it, failure re-opens it. Partial-batch row failures are breaker-neutral. Bare number is the threshold; object form supports threshold (default 5) and cooldown (default 30000ms).") }).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");
2548
2548
  rt2 = ot2.partial().meta({ id: "DestinationPartialConfig", title: "Destination.PartialConfig", description: "Partial destination configuration with all fields optional." }).describe("Partial destination configuration with all fields optional");
2549
2549
  at2 = ve2.describe("Destination policy rules for event pre-processing");
2550
2550
  st2 = 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: ot2.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");
@@ -2564,37 +2564,37 @@ var init_dev = __esm({
2564
2564
  wt3 = n3.array(n3.tuple([ee3, n3.unknown()])).meta({ id: "DestinationDLQ", title: "Destination.DLQ", description: "Dead-letter queue: list of [event, error] tuples." }).describe("Dead letter queue: [(event, error), ...]");
2565
2565
  kt3 = o2(ot2);
2566
2566
  Ct2 = o2(rt2);
2567
- xt3 = o2(st2);
2567
+ xt2 = o2(st2);
2568
2568
  jt3 = o2(ct2);
2569
- Pt = o2(ut2);
2569
+ Pt2 = o2(ut2);
2570
2570
  Dt2 = o2(ft2);
2571
- Et2 = o2(yt2);
2571
+ Et3 = o2(yt2);
2572
2572
  Ot3 = {};
2573
- t3(Ot3, { CommandTypeSchema: () => It3, ConfigSchema: () => Rt2, DestinationsSchema: () => $t3, InitConfigSchema: () => Mt2, InstanceSchema: () => At3, PushContextSchema: () => Tt2, SessionDataSchema: () => Jt2, SourcesSchema: () => Ft, commandTypeJsonSchema: () => zt, configJsonSchema: () => Lt2, initConfigJsonSchema: () => Nt3, instanceJsonSchema: () => Bt, pushContextJsonSchema: () => Wt2, sessionDataJsonSchema: () => qt2 });
2573
+ t3(Ot3, { CommandTypeSchema: () => It3, ConfigSchema: () => Rt, DestinationsSchema: () => $t3, InitConfigSchema: () => Mt3, InstanceSchema: () => At3, PushContextSchema: () => Tt2, SessionDataSchema: () => Jt2, SourcesSchema: () => Ft, commandTypeJsonSchema: () => zt, configJsonSchema: () => Lt2, initConfigJsonSchema: () => Nt2, instanceJsonSchema: () => Bt, pushContextJsonSchema: () => Wt2, sessionDataJsonSchema: () => qt2 });
2574
2574
  It3 = 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");
2575
- Rt2 = n3.object({ run: n3.boolean().describe("Whether to run collector automatically on initialization").optional(), globalsStatic: _2.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: nt3.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."), name: n3.string().optional().describe("Flow name; keys this flow's entry in event.source.release and the observer flowId."), release: n3.string().optional().describe("Config release id stamped into event.source.release for this flow.") }).meta({ id: "CollectorConfig", title: "Collector.Config", description: "Core collector configuration (globals/session statics, logger, buffer bounds)." }).describe("Core collector configuration");
2575
+ Rt = n3.object({ run: n3.boolean().describe("Whether to run collector automatically on initialization").optional(), globalsStatic: _2.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: nt3.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."), name: n3.string().optional().describe("Flow name; keys this flow's entry in event.source.release and the observer flowId."), release: n3.string().optional().describe("Config release id stamped into event.source.release for this flow.") }).meta({ id: "CollectorConfig", title: "Collector.Config", description: "Core collector configuration (globals/session statics, logger, buffer bounds)." }).describe("Core collector configuration");
2576
2576
  Jt2 = _2.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: l2.describe("Session start timestamp").optional(), marketing: n3.literal(true).optional().describe("Marketing attribution flag"), updated: l2.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");
2577
- Mt2 = Rt2.partial().extend({ consent: Z2.optional().describe("Initial consent state"), user: G2.optional().describe("Initial user data"), globals: _2.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: _2.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"), observe: n3.union([n3.object({ url: n3.string().describe("Observer base URL"), binding: n3.string().describe("Public project binding the web credential must match") }), n3.object({ url: n3.string().describe("Observer base URL"), sessionId: n3.string().describe("Session id the runtime posts under"), token: n3.string().describe("Ingest bearer token"), level: n3.enum(["off", "standard", "trace"]).optional().describe("Telemetry level"), sample: n3.number().optional().describe("Deterministic sample fraction in [0, 1]") })]).meta({ id: "CollectorObserve", title: "Observe", description: "Observation session connect config: web arm (url + binding) or server arm (url + sessionId + token)." }).optional().describe("Observation session connect config"), observers: n3.unknown().meta({ id: "CollectorObservers", title: "Collector.Observers", description: "Caller-supplied advisory observer functions (runtime objects)." }).optional().describe("Caller-supplied advisory observer functions") }).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");
2577
+ Mt3 = Rt.partial().extend({ consent: Z2.optional().describe("Initial consent state"), user: G2.optional().describe("Initial user data"), globals: _2.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: _2.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"), observe: n3.union([n3.object({ url: n3.string().describe("Observer base URL"), binding: n3.string().describe("Public project binding the web credential must match") }), n3.object({ url: n3.string().describe("Observer base URL"), sessionId: n3.string().describe("Session id the runtime posts under"), token: n3.string().describe("Ingest bearer token"), level: n3.enum(["off", "standard", "trace"]).optional().describe("Telemetry level"), sample: n3.number().optional().describe("Deterministic sample fraction in [0, 1]") })]).meta({ id: "CollectorObserve", title: "Observe", description: "Observation session connect config: web arm (url + binding) or server arm (url + sessionId + token)." }).optional().describe("Observation session connect config"), observers: n3.unknown().meta({ id: "CollectorObservers", title: "Collector.Observers", description: "Caller-supplied advisory observer functions (runtime objects)." }).optional().describe("Caller-supplied advisory observer functions") }).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");
2578
2578
  Tt2 = n3.object({ mapping: ke2.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");
2579
2579
  Ft = 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");
2580
2580
  $t3 = 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");
2581
- At3 = 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: Rt2.describe("Current collector configuration"), consent: Z2.describe("Current consent state"), custom: _2.describe("Custom implementation-specific properties"), sources: Ft.describe("Registered source instances"), destinations: $t3.describe("Registered destination instances"), globals: _2.describe("Current global properties"), hooks: n3.unknown().describe("Lifecycle hook functions"), on: n3.unknown().describe("Event lifecycle configuration"), queue: n3.array(ee3).describe("Queued events awaiting processing"), round: n3.number().describe("Collector run count (increments with each run)"), session: n3.union([Jt2]).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");
2581
+ At3 = 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: Rt.describe("Current collector configuration"), consent: Z2.describe("Current consent state"), custom: _2.describe("Custom implementation-specific properties"), sources: Ft.describe("Registered source instances"), destinations: $t3.describe("Registered destination instances"), globals: _2.describe("Current global properties"), hooks: n3.unknown().describe("Lifecycle hook functions"), on: n3.unknown().describe("Event lifecycle configuration"), queue: n3.array(ee3).describe("Queued events awaiting processing"), round: n3.number().describe("Collector run count (increments with each run)"), session: n3.union([Jt2]).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");
2582
2582
  zt = o2(It3);
2583
- Lt2 = o2(Rt2);
2583
+ Lt2 = o2(Rt);
2584
2584
  qt2 = o2(Jt2);
2585
- Nt3 = o2(Mt2);
2585
+ Nt2 = o2(Mt3);
2586
2586
  Wt2 = o2(Tt2);
2587
2587
  Bt = o2(At3);
2588
2588
  Ut = {};
2589
- t3(Ut, { BaseEnvSchema: () => _t2, ConfigSchema: () => Ht2, InitSchema: () => Gt2, InitSourceSchema: () => Kt, InitSourcesSchema: () => Qt, InstanceSchema: () => Zt, PartialConfigSchema: () => Vt2, baseEnvJsonSchema: () => Xt, configJsonSchema: () => Yt2, initSourceJsonSchema: () => ii, initSourcesJsonSchema: () => ni, instanceJsonSchema: () => ti, partialConfigJsonSchema: () => ei });
2589
+ t3(Ut, { BaseEnvSchema: () => _t2, ConfigSchema: () => Ht2, InitSchema: () => Gt2, InitSourceSchema: () => Kt, InitSourcesSchema: () => Qt, InstanceSchema: () => Zt, PartialConfigSchema: () => Vt2, baseEnvJsonSchema: () => Xt2, configJsonSchema: () => Yt2, initSourceJsonSchema: () => ii, initSourcesJsonSchema: () => ni, instanceJsonSchema: () => ti, partialConfigJsonSchema: () => ei });
2590
2590
  _t2 = 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");
2591
- Ht2 = ke2.extend({ settings: n3.any().meta({ id: "SourceSettings", title: "Source.Settings", description: "Implementation-specific configuration (source-defined shape)." }).describe("Implementation-specific configuration").optional(), credentials: n3.any().meta({ id: "SourceCredentials", title: "Source.Credentials", description: "Optional credentials slot (source-defined shape); back it with a managed secret via $secret.NAME (credentials use $secret, not $env). The per-package shape is supplied via mergeConfigSchema." }).describe("Optional credentials (source-defined shape)").optional(), env: _t2.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: nt3.optional().describe("Logger configuration (level, handler) to override the collector defaults"), async: n3.boolean().optional().describe('Respond-first acknowledgement for response-producing server sources (express today; future fetch/lambda). When true (the default for such sources) the source responds 2xx ("accepted") before the event is delivered; when false it waits for delivery to settle. Browser/dataLayer sources have no HTTP response to defer and ignore it. A 2xx means accepted, not delivered. Default is per source type.'), 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([ue2, me2]).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(), state: n3.union([tt3, n3.array(tt3)]).optional().describe("Declarative store get/set operations applied around this source"), 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");
2591
+ Ht2 = ke2.extend({ settings: n3.any().meta({ id: "SourceSettings", title: "Source.Settings", description: "Implementation-specific configuration (source-defined shape)." }).describe("Implementation-specific configuration").optional(), credentials: n3.any().meta({ id: "SourceCredentials", title: "Source.Credentials", description: "Optional credentials slot (source-defined shape); back it with a managed secret via $secret.NAME (credentials use $secret, not $env). The per-package shape is supplied via mergeConfigSchema." }).describe("Optional credentials (source-defined shape)").optional(), env: _t2.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: nt3.optional().describe("Logger configuration (level, handler) to override the collector defaults"), async: n3.boolean().optional().describe('Respond-first acknowledgement for response-producing server sources (express today; future fetch/lambda). When true (the default for such sources) the source responds 2xx ("accepted") before the event is delivered; when false it waits for delivery to settle. Browser/dataLayer sources have no HTTP response to defer and ignore it. A 2xx means accepted, not delivered. Default is per source type.'), 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([ue, me2]).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(), state: n3.union([tt3, n3.array(tt3)]).optional().describe("Declarative store get/set operations applied around this source"), 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");
2592
2592
  Vt2 = Ht2.partial().meta({ id: "SourcePartialConfig", title: "Source.PartialConfig", description: "Partial source configuration with all fields optional." }).describe("Partial source configuration with all fields optional");
2593
2593
  Zt = n3.object({ type: n3.string().describe('Source type identifier (e.g., "browser", "dataLayer")'), config: Ht2.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");
2594
2594
  Gt2 = 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>");
2595
2595
  Kt = n3.object({ code: Gt2.describe("Source initialization function"), config: Vt2.optional().describe("Partial configuration overrides"), env: _t2.partial().optional().describe("Partial environment overrides"), state: n3.union([tt3, n3.array(tt3)]).optional().describe("Declarative store get/set operations applied around this source"), 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");
2596
2596
  Qt = n3.record(n3.string(), Kt).meta({ id: "SourceInitSources", title: "Source.InitSources", description: "Map of source IDs to initialization configurations." }).describe("Map of source IDs to initialization configurations");
2597
- Xt = o2(_t2);
2597
+ Xt2 = o2(_t2);
2598
2598
  Yt2 = o2(Ht2);
2599
2599
  ei = o2(Vt2);
2600
2600
  ti = o2(Zt);
@@ -2648,23 +2648,23 @@ var init_dev = __esm({
2648
2648
  Qi = o2(Ti);
2649
2649
  Xi = o2(Fi);
2650
2650
  Yi = o2(ji);
2651
- tn2 = en.object({ lang: en.string().optional().describe("Language identifier (e.g. json, sql, bash, typescript)"), code: en.string().describe("Code snippet") });
2652
- nn2 = en.object({ text: en.string().describe("Short actionable hint text focused on walkerOS usage"), code: en.array(tn2).optional().describe("Optional code snippets") });
2653
- on2 = en.record(en.string(), nn2).describe("Keyed hints for AI consumption \u2014 lightweight context beyond schemas and examples");
2654
- rn3 = 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).") });
2655
- an = n3.object({ client_email: n3.string().describe("Service account client email"), private_key: n3.string().describe("Service account private key (PEM)"), project_id: n3.string().optional().describe("GCP project id (derived from environment when omitted)") }).meta({ id: "ServiceAccount", title: "ServiceAccount", description: "Google-style service account credentials (client_email, private_key, optional project_id)." }).describe("Google-style service account credentials");
2656
- sn2 = n3.union([n3.string(), an]).meta({ id: "Credentials", title: "Credentials", description: "Service account credentials: a JSON string (back it with a managed secret via $secret.NAME) or a parsed service account object." }).describe("Service account credentials: a JSON string (back it with a managed secret via $secret.NAME) or a parsed object");
2657
- cn = o2(sn2);
2651
+ tn = en.object({ lang: en.string().optional().describe("Language identifier (e.g. json, sql, bash, typescript)"), code: en.string().describe("Code snippet") });
2652
+ nn = en.object({ text: en.string().describe("Short actionable hint text focused on walkerOS usage"), code: en.array(tn).optional().describe("Optional code snippets") });
2653
+ on2 = en.record(en.string(), nn).describe("Keyed hints for AI consumption \u2014 lightweight context beyond schemas and examples");
2654
+ rn = 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).") });
2655
+ an3 = n3.object({ client_email: n3.string().describe("Service account client email"), private_key: n3.string().describe("Service account private key (PEM)"), project_id: n3.string().optional().describe("GCP project id (derived from environment when omitted)") }).meta({ id: "ServiceAccount", title: "ServiceAccount", description: "Google-style service account credentials (client_email, private_key, optional project_id)." }).describe("Google-style service account credentials");
2656
+ sn2 = n3.union([n3.string(), an3]).meta({ id: "Credentials", title: "Credentials", description: "Service account credentials: a JSON string (back it with a managed secret via $secret.NAME) or a parsed service account object." }).describe("Service account credentials: a JSON string (back it with a managed secret via $secret.NAME) or a parsed object");
2657
+ cn2 = o2(sn2);
2658
2658
  dn = /* @__PURE__ */ new Set(["description", "examples", "title", "$comment"]);
2659
- bn3 = /\$store\.([a-zA-Z_][a-zA-Z0-9_]*)/g;
2660
- hn2 = /\$env\.([A-Za-z_]\w*)(=[^"}\s]*)?/g;
2661
- vn3 = /\$flow\.([a-zA-Z_][a-zA-Z0-9_]*)(?:\.([a-zA-Z0-9_.]+))?/g;
2662
- Sn2 = /\$(var|store|flow|secret):([a-zA-Z_][a-zA-Z0-9_]*)/g;
2663
- yn3 = /\$secret\.([A-Z0-9_]+)/g;
2659
+ bn2 = /\$store\.([a-zA-Z_][a-zA-Z0-9_]*)/g;
2660
+ hn = /\$env\.([A-Za-z_]\w*)(=[^"}\s]*)?/g;
2661
+ vn = /\$flow\.([a-zA-Z_][a-zA-Z0-9_]*)(?:\.([a-zA-Z0-9_.]+))?/g;
2662
+ Sn3 = /\$(var|store|flow|secret):([a-zA-Z_][a-zA-Z0-9_]*)/g;
2663
+ yn2 = /\$secret\.([A-Z0-9_]+)/g;
2664
2664
  wn3 = ["@walkeros/server-store-fs", "@walkeros/server-store-s3", "@walkeros/server-store-gcs"];
2665
2665
  kn3 = "@walkeros/server-transformer-file";
2666
2666
  Cn3 = /^\$store\.([a-zA-Z_][a-zA-Z0-9_]*)$/;
2667
- Wn = { source: Ut.configJsonSchema, destination: Me.configJsonSchema, store: li.configJsonSchema };
2667
+ Wn2 = { source: Ut.configJsonSchema, destination: Me2.configJsonSchema, store: li.configJsonSchema };
2668
2668
  }
2669
2669
  });
2670
2670
 
@@ -3106,7 +3106,7 @@ function hasCodeReference(code) {
3106
3106
  }
3107
3107
  function validateReference(type, name, ref) {
3108
3108
  if (type === "Transformer") {
3109
- const r6 = ur({ ...ref }, "Transformer");
3109
+ const r6 = pr({ ...ref }, "Transformer");
3110
3110
  if (!r6.ok) {
3111
3111
  throw new Error(`Transformer "${name}": ${r6.reason ?? "invalid entry."}`);
3112
3112
  }
@@ -3242,7 +3242,7 @@ async function loadNpmConfigForPacote(projectDir = process.cwd(), homeDir = os3.
3242
3242
  }
3243
3243
  value = value.replace(
3244
3244
  /\$\{([^}]+)\}/g,
3245
- (match, v3) => process.env[v3] ?? match
3245
+ (match, v2) => process.env[v2] ?? match
3246
3246
  );
3247
3247
  merged[key] = value;
3248
3248
  }
@@ -3251,8 +3251,8 @@ async function loadNpmConfigForPacote(projectDir = process.cwd(), homeDir = os3.
3251
3251
  if (!registry.endsWith("/")) registry = `${registry}/`;
3252
3252
  for (const key of Object.keys(merged)) {
3253
3253
  if (key.endsWith(":registry") && key.startsWith("@")) {
3254
- const v3 = merged[key];
3255
- if (!v3.endsWith("/")) merged[key] = `${v3}/`;
3254
+ const v2 = merged[key];
3255
+ if (!v2.endsWith("/")) merged[key] = `${v2}/`;
3256
3256
  }
3257
3257
  }
3258
3258
  return { ...merged, registry, preferOnline: true };
@@ -3283,7 +3283,7 @@ function describeError(error) {
3283
3283
  function withSignal(opts, signal) {
3284
3284
  return { ...opts, signal };
3285
3285
  }
3286
- async function withPacoteRetry(fn2, label, options = {}) {
3286
+ async function withPacoteRetry(fn3, label, options = {}) {
3287
3287
  const attempts = options.attempts ?? PACOTE_RETRY_ATTEMPTS;
3288
3288
  const perAttemptTimeoutMs = options.perAttemptTimeoutMs ?? PACOTE_PER_ATTEMPT_TIMEOUT_MS;
3289
3289
  const maxTotalMs = options.maxTotalMs ?? PACOTE_MAX_TOTAL_MS;
@@ -3298,7 +3298,7 @@ async function withPacoteRetry(fn2, label, options = {}) {
3298
3298
  const controller = new AbortController();
3299
3299
  const timeoutId = setTimeout(() => controller.abort(), attemptTimeoutMs);
3300
3300
  try {
3301
- return await fn2(controller.signal);
3301
+ return await fn3(controller.signal);
3302
3302
  } catch (error) {
3303
3303
  lastError = error;
3304
3304
  if (isPermanentError(error)) throw error;
@@ -3838,7 +3838,7 @@ async function traceAndCopy(opts) {
3838
3838
  function assertDepsTraced(opts) {
3839
3839
  const missing = opts.expectedPackages.filter((dep) => {
3840
3840
  const expected = `node_modules/${dep}/package.json`;
3841
- return !opts.fileList.some((f3) => f3.endsWith(expected));
3841
+ return !opts.fileList.some((f2) => f2.endsWith(expected));
3842
3842
  });
3843
3843
  if (missing.length > 0) {
3844
3844
  throw new Error(
@@ -4600,7 +4600,7 @@ async function runNftServerPath(outputPath, flowSettings, buildOptions, tempDir,
4600
4600
  });
4601
4601
  }
4602
4602
  const stagedRel = path12.relative(await fs11.realpath(tempDir), stagedEntry);
4603
- const trimmedFileList = result.fileList.filter((f3) => f3 !== stagedRel);
4603
+ const trimmedFileList = result.fileList.filter((f2) => f2 !== stagedRel);
4604
4604
  await fs11.remove(path12.join(outDir, stagedRel)).catch(() => {
4605
4605
  });
4606
4606
  if (expectedPackages.length > 0) {
@@ -5004,12 +5004,12 @@ function buildSplitConfigObject(flowSettings, namedImports) {
5004
5004
  return buildSplitStepEntry("destinations", key, dest);
5005
5005
  });
5006
5006
  const transformersEntries = Object.entries(transformers).filter(
5007
- ([, transformer]) => transformer.package || hasCodeReference2(transformer.code) || fr({ ...transformer }, "Transformer")
5007
+ ([, transformer]) => transformer.package || hasCodeReference2(transformer.code) || dr({ ...transformer }, "Transformer")
5008
5008
  ).map(([key, transformer]) => {
5009
5009
  if (isInlineCode2(transformer.code)) {
5010
5010
  return ` ${key}: ${generateInlineCode(transformer.code, transformer.config || {}, transformer.env, { before: transformer.before, next: transformer.next })}`;
5011
5011
  }
5012
- if (fr({ ...transformer }, "Transformer")) {
5012
+ if (dr({ ...transformer }, "Transformer")) {
5013
5013
  const chainLines = [];
5014
5014
  if (transformer.before !== void 0) {
5015
5015
  chainLines.push(`before: ${JSON.stringify(transformer.before)}`);
@@ -5269,7 +5269,7 @@ function serializeWithCode(value, indent) {
5269
5269
  if (Array.isArray(value)) {
5270
5270
  if (value.length === 0) return "[]";
5271
5271
  const items = value.map(
5272
- (v3) => nextSpaces + serializeWithCode(v3, indent + 1)
5272
+ (v2) => nextSpaces + serializeWithCode(v2, indent + 1)
5273
5273
  );
5274
5274
  return `[
5275
5275
  ${items.join(",\n")}
@@ -5279,7 +5279,7 @@ ${spaces}]`;
5279
5279
  const entries = Object.entries(value);
5280
5280
  if (entries.length === 0) return "{}";
5281
5281
  const props = entries.map(
5282
- ([k3, v3]) => `${nextSpaces}${JSON.stringify(k3)}: ${serializeWithCode(v3, indent + 1)}`
5282
+ ([k3, v2]) => `${nextSpaces}${JSON.stringify(k3)}: ${serializeWithCode(v2, indent + 1)}`
5283
5283
  );
5284
5284
  return `{
5285
5285
  ${props.join(",\n")}
@@ -5858,7 +5858,7 @@ var init_contract = __esm({
5858
5858
  "src/core/contract.ts"() {
5859
5859
  "use strict";
5860
5860
  init_config_file();
5861
- bakedContractVersion = true ? "4.1.0" : PLACEHOLDER;
5861
+ bakedContractVersion = true ? "4.2.0" : PLACEHOLDER;
5862
5862
  }
5863
5863
  });
5864
5864
 
@@ -5957,9 +5957,9 @@ async function deleteProject(options = {}) {
5957
5957
  if (getDefaultProject() === id) clearDefaultProject();
5958
5958
  return data ?? { success: true };
5959
5959
  }
5960
- async function handleResult(fn2, options) {
5960
+ async function handleResult(fn3, options) {
5961
5961
  try {
5962
- const result = await fn2();
5962
+ const result = await fn3();
5963
5963
  await writeResult(JSON.stringify(result, null, 2), options);
5964
5964
  } catch (error) {
5965
5965
  handleCliError(error);
@@ -6100,9 +6100,9 @@ async function duplicateFlow(options) {
6100
6100
  if (error) throwApiError(error, "Failed to duplicate flow");
6101
6101
  return data;
6102
6102
  }
6103
- async function handleResult2(fn2, options) {
6103
+ async function handleResult2(fn3, options) {
6104
6104
  try {
6105
- const result = await fn2();
6105
+ const result = await fn3();
6106
6106
  await writeResult(JSON.stringify(result, null, 2), options);
6107
6107
  } catch (error) {
6108
6108
  handleCliError(error);
@@ -6696,10 +6696,10 @@ function U2(e4, t4, n5) {
6696
6696
  for (const [o5, s4] of Object.entries(e4)) r6[o5] = "function" == typeof s4 ? s4 : U2(s4, t4, n5 + 1);
6697
6697
  return r6;
6698
6698
  }
6699
- function K2(e4) {
6699
+ function K(e4) {
6700
6700
  const t4 = [], n5 = [], { simulation: o4, ...r6 } = e4, s4 = U2(r6, /* @__PURE__ */ new WeakMap(), 0);
6701
6701
  for (const e5 of o4) {
6702
- const o5 = jn(e5);
6702
+ const o5 = xn(e5);
6703
6703
  if (0 === o5.length) continue;
6704
6704
  const r7 = o5.join(".");
6705
6705
  if (o5.length - 1 >= 8) {
@@ -6720,9 +6720,9 @@ function K2(e4) {
6720
6720
  n5.push(r7);
6721
6721
  continue;
6722
6722
  }
6723
- const u2 = a4[c2];
6724
- "function" == typeof u2 ? a4[c2] = function(...e6) {
6725
- return t4.push({ fn: r7, args: e6, ts: Date.now() }), u2.apply(this, e6);
6723
+ const d2 = a4[c2];
6724
+ "function" == typeof d2 ? a4[c2] = function(...e6) {
6725
+ return t4.push({ fn: r7, args: e6, ts: Date.now() }), d2.apply(this, e6);
6726
6726
  } : n5.push(r7);
6727
6727
  }
6728
6728
  return { wrappedEnv: s4, calls: t4, unresolved: n5 };
@@ -6773,7 +6773,7 @@ function F2(e4) {
6773
6773
  function R2(e4) {
6774
6774
  return e4.map((e5) => ({ fn: e5.fn, args: F2(e5.args), ts: e5.ts }));
6775
6775
  }
6776
- function N(e4, t4, n5, o4) {
6776
+ function N2(e4, t4, n5, o4) {
6777
6777
  if (!Number.isFinite(n5.max) || n5.max <= 0) throw new Error(`pushBounded: max must be > 0 (got ${n5.max})`);
6778
6778
  if ("dropNewest" === (n5.onOverflow ?? "dropOldest")) return e4.length >= n5.max ? (o4 && o4([t4]), { appended: false, dropped: 1 }) : (e4.push(t4), { appended: true, dropped: 0 });
6779
6779
  const r6 = [];
@@ -6813,17 +6813,17 @@ function ie2(e4, t4, n5, o4, r6) {
6813
6813
  return (t5, a4) => {
6814
6814
  try {
6815
6815
  if (a4) return r6 ? (function(e5, t6, n6, o5, r7, s5) {
6816
- const a5 = t6.dlq = t6.dlq || [], i5 = { max: t6.config.dlqMax ?? re2 }, c2 = N(a5, [o5, r7], i5);
6816
+ const a5 = t6.dlq = t6.dlq || [], i5 = { max: t6.config.dlqMax ?? re2 }, c2 = N2(a5, [o5, r7], i5);
6817
6817
  if (c2.dropped > 0) {
6818
6818
  const t7 = ae2(e5.status, o("destination", n6), "dlq", c2.dropped);
6819
6819
  J2(a5, s5, "destination.dlq overflow; oldest entries dropped", { buffer: "dlq", destination: n6, cap: i5.max, droppedCount: t7 });
6820
6820
  } else a5.length < i5.max && X2(a5);
6821
- const u2 = se(e5, n6);
6822
- u2.failed++, u2.dlqSize = a5.length, e5.status.failed++;
6823
- const d2 = te2(t6.config.breaker);
6824
- if (d2) {
6821
+ const d2 = se(e5, n6);
6822
+ d2.failed++, d2.dlqSize = a5.length, e5.status.failed++;
6823
+ const u3 = te2(t6.config.breaker);
6824
+ if (u3) {
6825
6825
  const o6 = t6.config.id || n6;
6826
- ne2(e5.status.breakers, o("destination", o6), "transport-failure", d2.threshold, d2.cooldown);
6826
+ ne2(e5.status.breakers, o("destination", o6), "transport-failure", u3.threshold, u3.cooldown);
6827
6827
  }
6828
6828
  })(e4, r6, n5, a4, t5, o4) : e4.status.failed++, void o4.error("report error", { error: t5 instanceof Error ? t5.message : String(t5), event: a4.name });
6829
6829
  e4.status.connectionErrors[s4] = (e4.status.connectionErrors[s4] ?? 0) + 1, o4.error("connection error", { error: t5 instanceof Error ? t5.message : String(t5) });
@@ -6831,13 +6831,13 @@ function ie2(e4, t4, n5, o4, r6) {
6831
6831
  }
6832
6832
  };
6833
6833
  }
6834
- function ze(e4, t4) {
6834
+ function Ue2(e4, t4) {
6835
6835
  return e4.storeId && t4.stores[e4.storeId] ? t4.stores[e4.storeId] : t4.stores.__cache;
6836
6836
  }
6837
- function Ue2(e4, t4) {
6837
+ function Ke2(e4, t4) {
6838
6838
  return e4 ? t4.stores[e4] : t4.stores.__cache;
6839
6839
  }
6840
- function Ke2(e4) {
6840
+ function Be2(e4) {
6841
6841
  const t4 = {};
6842
6842
  for (const [n5, o4] of Object.entries(e4)) {
6843
6843
  const e5 = o4.config?.next;
@@ -6845,11 +6845,11 @@ function Ke2(e4) {
6845
6845
  }
6846
6846
  return t4;
6847
6847
  }
6848
- function Be2(e4, t4) {
6848
+ function Fe2(e4, t4) {
6849
6849
  const n5 = e4.config || {}, o4 = e4[t4];
6850
6850
  return void 0 !== o4 ? { config: { ...n5, [t4]: o4 }, chainValue: o4 } : { config: n5, chainValue: void 0 };
6851
6851
  }
6852
- function Fe2(e4, t4 = {}) {
6852
+ function Re2(e4, t4 = {}) {
6853
6853
  if (!e4) return [];
6854
6854
  if (Array.isArray(e4)) return e4;
6855
6855
  const n5 = [], o4 = /* @__PURE__ */ new Set();
@@ -6865,9 +6865,9 @@ function Fe2(e4, t4 = {}) {
6865
6865
  }
6866
6866
  return n5;
6867
6867
  }
6868
- async function Re2(e4, t4, n5) {
6868
+ async function He(e4, t4, n5) {
6869
6869
  if (t4.init && !t4.config.init) {
6870
- const o4 = t4.type || "unknown", r6 = e4.logger.scope(`transformer:${o4}`), s4 = { collector: e4, logger: r6, id: n5, ingest: I(n5), config: t4.config, env: Le(t4.config.env), reportError: ie2(e4, "transformer", n5, r6) };
6870
+ const o4 = t4.type || "unknown", r6 = e4.logger.scope(`transformer:${o4}`), s4 = { collector: e4, logger: r6, id: n5, ingest: O(n5), config: t4.config, env: Ve2(t4.config.env), reportError: ie2(e4, "transformer", n5, r6) };
6871
6871
  r6.debug("init");
6872
6872
  const a4 = await gt(t4.init, "TransformerInit", e4.hooks, e4.logger)(s4);
6873
6873
  if (false === a4) return false;
@@ -6875,24 +6875,24 @@ async function Re2(e4, t4, n5) {
6875
6875
  }
6876
6876
  return true;
6877
6877
  }
6878
- async function He(e4, t4, n5, o4, r6, s4) {
6879
- const a4 = t4.type || "unknown", i5 = e4.logger.scope(`transformer:${a4}`), c2 = { collector: e4, logger: i5, id: n5, ingest: r6, config: t4.config, env: { ...Le(t4.config.env), ...s4 ? { respond: s4 } : {} }, reportError: ie2(e4, "transformer", n5, i5) };
6878
+ async function Ge2(e4, t4, n5, o4, r6, s4) {
6879
+ const a4 = t4.type || "unknown", i5 = e4.logger.scope(`transformer:${a4}`), c2 = { collector: e4, logger: i5, id: n5, ingest: r6, config: t4.config, env: { ...Ve2(t4.config.env), ...s4 ? { respond: s4 } : {} }, reportError: ie2(e4, "transformer", n5, i5) };
6880
6880
  i5.debug("push", { event: o4.name });
6881
- const u2 = "string" == typeof o4.id ? o4.id : "", { traceId: d2, sourceId: l3, parentEventId: f3 } = T2(o4, r6, e4), p3 = Date.now(), g3 = _(e4, { stepId: o("transformer", n5), stepType: "transformer", phase: "in", eventId: u2, now: p3, traceId: d2, sourceId: l3, parentEventId: f3 });
6882
- g3.inEvent = o4, on(e4, g3);
6881
+ const d2 = "string" == typeof o4.id ? o4.id : "", { traceId: u3, sourceId: l3, parentEventId: f2 } = T2(o4, r6, e4), p3 = Date.now(), g3 = _(e4, { stepId: o("transformer", n5), stepType: "transformer", phase: "in", eventId: d2, now: p3, traceId: u3, sourceId: l3, parentEventId: f2 });
6882
+ g3.inEvent = o4, cn(e4, g3);
6883
6883
  try {
6884
- const r7 = await gt(t4.push, "TransformerPush", e4.hooks, e4.logger)(o4, c2), s5 = Date.now(), a5 = _(e4, { stepId: o("transformer", n5), stepType: "transformer", phase: "out", eventId: u2, now: s5, traceId: d2, sourceId: l3, parentEventId: f3 });
6885
- return a5.durationMs = s5 - p3, a5.outEvent = r7, on(e4, a5), i5.debug("push done"), r7;
6884
+ const r7 = await gt(t4.push, "TransformerPush", e4.hooks, e4.logger)(o4, c2), s5 = Date.now(), a5 = _(e4, { stepId: o("transformer", n5), stepType: "transformer", phase: "out", eventId: d2, now: s5, traceId: u3, sourceId: l3, parentEventId: f2 });
6885
+ return a5.durationMs = s5 - p3, a5.outEvent = r7, cn(e4, a5), i5.debug("push done"), r7;
6886
6886
  } catch (t5) {
6887
- const o5 = Date.now(), r7 = _(e4, { stepId: o("transformer", n5), stepType: "transformer", phase: "error", eventId: u2, now: o5, traceId: d2, sourceId: l3, parentEventId: f3 });
6888
- throw r7.durationMs = o5 - p3, r7.error = t5 instanceof Error ? { name: t5.name, message: t5.message } : { message: String(t5) }, on(e4, r7), t5;
6887
+ const o5 = Date.now(), r7 = _(e4, { stepId: o("transformer", n5), stepType: "transformer", phase: "error", eventId: d2, now: o5, traceId: u3, sourceId: l3, parentEventId: f2 });
6888
+ throw r7.durationMs = o5 - p3, r7.error = t5 instanceof Error ? { name: t5.name, message: t5.message } : { message: String(t5) }, cn(e4, r7), t5;
6889
6889
  }
6890
6890
  }
6891
- function Ge2(e4, t4) {
6892
- return e4 ? { ...e4, _meta: { ...e4._meta, path: [...e4._meta.path] } } : I(t4);
6891
+ function We2(e4, t4) {
6892
+ return e4 ? { ...e4, _meta: { ...e4._meta, path: [...e4._meta.path] } } : O(t4);
6893
6893
  }
6894
- async function We2(e4, t4, n5, o4, r6, s4, a4) {
6895
- r6 || (r6 = I(n5[0] ?? "chain")), a4 && r6._meta && (r6._meta.chainPath = a4);
6894
+ async function Le(e4, t4, n5, o4, r6, s4, a4) {
6895
+ r6 || (r6 = O(n5[0] ?? "chain")), a4 && r6._meta && (r6._meta.chainPath = a4);
6896
6896
  let i5 = o4, c2 = s4;
6897
6897
  for (const o5 of n5) {
6898
6898
  const s5 = t4[o5];
@@ -6902,7 +6902,7 @@ async function We2(e4, t4, n5, o4, r6, s4, a4) {
6902
6902
  }
6903
6903
  if (r6 && r6._meta && r6._meta.path.length > 256) return e4.logger.error(`Max path length exceeded at ${o5}`), { event: null, respond: c2 };
6904
6904
  r6 && r6._meta && (r6._meta.hops++, r6._meta.path.push(o5));
6905
- if (!await Ye(Re2, (t5) => {
6905
+ if (!await Ye(He, (t5) => {
6906
6906
  if (t5 instanceof Xe) throw t5;
6907
6907
  return e4.status.failed++, e4.logger.scope(`transformer:${s5.type || "unknown"}`).error("transformer init failed", { transformer: o5, error: t5 }), false;
6908
6908
  })(e4, s5, o5)) return { event: null, respond: c2 };
@@ -6916,156 +6916,162 @@ async function We2(e4, t4, n5, o4, r6, s4, a4) {
6916
6916
  continue;
6917
6917
  }
6918
6918
  if (s5.config?.disabled) continue;
6919
- const u2 = s5.config?.cache, d2 = u2 ? Qn(u2) : void 0, l3 = d2 ? ze(d2, e4) : void 0, f3 = s5.config?.state ? rr(s5.config.state) : void 0, p3 = f3?.filter((e5) => "get" === e5.mode), g3 = f3?.filter((e5) => "set" === e5.mode), m3 = async (t5) => g3 && 0 !== g3.length ? or(g3, (t6) => Ue2(t6, e4), t5, e4) : t5;
6920
- let h2;
6921
- if (d2 && l3) {
6922
- const e5 = Xn(r6, i5), t5 = await er(d2, l3, e5);
6919
+ const d2 = s5.config?.cache, u3 = d2 ? nr(d2) : void 0, l3 = u3 ? Ue2(u3, e4) : void 0, f2 = s5.config?.state ? ir(s5.config.state) : void 0, p3 = f2?.filter((e5) => "get" === e5.mode), g3 = f2?.filter((e5) => "set" === e5.mode), m3 = async (t5) => g3 && 0 !== g3.length ? ar(g3, (t6) => Ke2(t6, e4), t5, e4) : t5;
6920
+ let h3;
6921
+ if (u3 && l3) {
6922
+ const e5 = tr(r6, i5), t5 = await rr(u3, l3, e5);
6923
6923
  if ("HIT" === t5?.status && t5.value) {
6924
- if (i5 = t5.value, d2.stop) return { event: i5, respond: c2, stopped: true };
6924
+ if (i5 = t5.value, u3.stop) return { event: i5, respond: c2, stopped: true };
6925
6925
  continue;
6926
6926
  }
6927
- "MISS" === t5?.status && (h2 = { key: t5.key, ttl: t5.rule.ttl });
6927
+ "MISS" === t5?.status && (h3 = { key: t5.key, ttl: t5.rule.ttl });
6928
6928
  }
6929
- const v3 = s5.config.before;
6930
- if (v3) {
6931
- const n6 = zn(v3, Xn(r6, i5));
6929
+ const v2 = s5.config.before;
6930
+ if (v2) {
6931
+ const n6 = Un(v2, tr(r6, i5));
6932
6932
  if (1 === n6.length) {
6933
- const o6 = Fe2(n6[0], Ke2(t4));
6933
+ const o6 = Re2(n6[0], Be2(t4));
6934
6934
  if (o6.length > 0) {
6935
- const n7 = await We2(e4, t4, o6, i5, r6, c2, a4);
6935
+ const n7 = await Le(e4, t4, o6, i5, r6, c2, a4);
6936
6936
  if (null === n7.event) return { event: null, respond: n7.respond ?? c2 };
6937
6937
  if (n7.stopped) return { event: Array.isArray(n7.event) ? n7.event[0] : n7.event, respond: n7.respond ?? c2, stopped: true };
6938
6938
  n7.respond && (c2 = n7.respond), i5 = Array.isArray(n7.event) ? n7.event[0] : n7.event;
6939
6939
  }
6940
- } else n6.length > 1 && await Promise.all(n6.map((n7) => Ye(We2, (t5) => (e4.logger.scope("transformer:many").error(`many branch ${n7} failed`, { error: t5 }), { event: null, respond: void 0 }))(e4, t4, Fe2(n7, Ke2(t4)), i5, Ge2(r6, n7), void 0, a4)));
6940
+ } else n6.length > 1 && await Promise.all(n6.map((n7) => Ye(Le, (t5) => (e4.logger.scope("transformer:many").error(`many branch ${n7} failed`, { error: t5 }), { event: null, respond: void 0 }))(e4, t4, Re2(n7, Be2(t4)), i5, We2(r6, n7), void 0, a4)));
6941
6941
  }
6942
- p3 && p3.length > 0 && (i5 = await or(p3, (t5) => Ue2(t5, e4), i5, e4));
6943
- const y3 = await Ye(He, (t5) => (e4.logger.scope(`transformer:${s5.type || "unknown"}`).error("Push failed", { error: t5 }), false))(e4, s5, o5, i5, r6, c2);
6942
+ p3 && p3.length > 0 && (i5 = await ar(p3, (t5) => Ke2(t5, e4), i5, e4));
6943
+ const y3 = await Ye(Ge2, (t5) => (e4.logger.scope(`transformer:${s5.type || "unknown"}`).error("Push failed", { error: t5 }), false))(e4, s5, o5, i5, r6, c2);
6944
6944
  if (false === y3) return { event: null, respond: c2, droppedBy: o5 };
6945
6945
  if (Array.isArray(y3)) {
6946
- const s6 = n5.slice(n5.indexOf(o5) + 1), u3 = await Promise.all(y3.map(async (n6) => {
6947
- const o6 = await m3(n6.event || i5), u4 = Ge2(r6, "unknown");
6946
+ const s6 = n5.slice(n5.indexOf(o5) + 1), d3 = await Promise.all(y3.map(async (n6) => {
6947
+ const o6 = await m3(n6.event || i5), d4 = We2(r6, "unknown");
6948
6948
  if (n6.next) {
6949
- const r7 = zn(n6.next, Xn(u4, o6));
6949
+ const r7 = Un(n6.next, tr(d4, o6));
6950
6950
  if (0 === r7.length) return { event: o6, respond: c2 };
6951
6951
  if (1 === r7.length) {
6952
- const n7 = Fe2(r7[0], Ke2(t4));
6953
- return n7.length > 0 ? We2(e4, t4, n7, o6, u4, c2, a4) : { event: o6, respond: c2 };
6952
+ const n7 = Re2(r7[0], Be2(t4));
6953
+ return n7.length > 0 ? Le(e4, t4, n7, o6, d4, c2, a4) : { event: o6, respond: c2 };
6954
6954
  }
6955
- return (await Promise.all(r7.map((n7) => Ye(We2, (t5) => (e4.logger.scope("transformer:many").error(`many branch ${n7} failed`, { error: t5 }), { event: null, respond: void 0 }))(e4, t4, Fe2(n7, Ke2(t4)), o6, Ge2(u4, n7), void 0, a4)))).map((e5) => ({ event: e5.event, respond: void 0 }));
6955
+ return (await Promise.all(r7.map((n7) => Ye(Le, (t5) => (e4.logger.scope("transformer:many").error(`many branch ${n7} failed`, { error: t5 }), { event: null, respond: void 0 }))(e4, t4, Re2(n7, Be2(t4)), o6, We2(d4, n7), void 0, a4)))).map((e5) => ({ event: e5.event, respond: void 0 }));
6956
6956
  }
6957
- return s6.length > 0 ? We2(e4, t4, s6, o6, u4, c2, a4) : { event: o6, respond: c2 };
6957
+ return s6.length > 0 ? Le(e4, t4, s6, o6, d4, c2, a4) : { event: o6, respond: c2 };
6958
6958
  }));
6959
- let d3 = c2;
6959
+ let u4 = c2;
6960
6960
  const l4 = [];
6961
- for (const e5 of u3.flat()) if (null !== e5) if (e5 && "object" == typeof e5 && "event" in e5) {
6961
+ for (const e5 of d3.flat()) if (null !== e5) if (e5 && "object" == typeof e5 && "event" in e5) {
6962
6962
  const t5 = e5;
6963
- if (t5.respond && (d3 = t5.respond), null === t5.event) continue;
6963
+ if (t5.respond && (u4 = t5.respond), null === t5.event) continue;
6964
6964
  Array.isArray(t5.event) ? l4.push(...t5.event) : l4.push(t5.event);
6965
6965
  } else l4.push(e5);
6966
- return 0 === l4.length ? { event: null, respond: d3 } : 1 === l4.length ? { event: l4[0], respond: d3 } : { event: l4, respond: d3 };
6966
+ return 0 === l4.length ? { event: null, respond: u4 } : 1 === l4.length ? { event: l4[0], respond: u4 } : { event: l4, respond: u4 };
6967
6967
  }
6968
6968
  if (y3 && "object" == typeof y3) {
6969
6969
  const { event: n6, respond: o6, next: s6 } = y3;
6970
6970
  if (o6 && (c2 = o6), void 0 !== s6) {
6971
- const o7 = await m3(n6 || i5), u3 = zn(s6, Xn(r6, o7));
6972
- if (0 === u3.length) {
6971
+ const o7 = await m3(n6 || i5), d3 = Un(s6, tr(r6, o7));
6972
+ if (0 === d3.length) {
6973
6973
  i5 = o7;
6974
6974
  continue;
6975
6975
  }
6976
- if (1 === u3.length) {
6977
- const n7 = Fe2(u3[0], Ke2(t4));
6978
- return n7.length > 0 ? We2(e4, t4, n7, o7, r6, c2, a4) : (e4.logger.warn(`Branch target not found: ${JSON.stringify(s6)}`), { event: null, respond: c2 });
6976
+ if (1 === d3.length) {
6977
+ const n7 = Re2(d3[0], Be2(t4));
6978
+ return n7.length > 0 ? Le(e4, t4, n7, o7, r6, c2, a4) : (e4.logger.warn(`Branch target not found: ${JSON.stringify(s6)}`), { event: null, respond: c2 });
6979
6979
  }
6980
- return await Promise.all(u3.map((n7) => Ye(We2, (t5) => (e4.logger.scope("transformer:many").error(`many branch ${n7} failed`, { error: t5 }), { event: null, respond: void 0 }))(e4, t4, Fe2(n7, Ke2(t4)), o7, Ge2(r6, n7), void 0, a4))), { event: null, respond: void 0 };
6980
+ return await Promise.all(d3.map((n7) => Ye(Le, (t5) => (e4.logger.scope("transformer:many").error(`many branch ${n7} failed`, { error: t5 }), { event: null, respond: void 0 }))(e4, t4, Re2(n7, Be2(t4)), o7, We2(r6, n7), void 0, a4))), { event: null, respond: void 0 };
6981
6981
  }
6982
6982
  n6 && (i5 = n6);
6983
6983
  }
6984
- g3 && g3.length > 0 && (i5 = await or(g3, (t5) => Ue2(t5, e4), i5, e4)), h2 && l3 && tr(l3, h2.key, i5, h2.ttl);
6984
+ g3 && g3.length > 0 && (i5 = await ar(g3, (t5) => Ke2(t5, e4), i5, e4)), h3 && l3 && or(l3, h3.key, i5, h3.ttl);
6985
6985
  const w3 = s5.config.next, b3 = "string" == typeof w3 || Array.isArray(w3) && w3.every((e5) => "string" == typeof e5), k3 = void 0 !== w3 && !b3;
6986
6986
  if ((!y3 || "object" == typeof y3 && !y3.next) && k3) {
6987
- const n6 = zn(s5.config.next, Xn(r6, i5));
6987
+ const n6 = Un(s5.config.next, tr(r6, i5));
6988
6988
  if (1 === n6.length) {
6989
- const o6 = Fe2(n6[0], Ke2(t4));
6990
- return o6.length > 0 ? We2(e4, t4, o6, i5, r6, c2, a4) : { event: i5, respond: c2 };
6989
+ const o6 = Re2(n6[0], Be2(t4));
6990
+ return o6.length > 0 ? Le(e4, t4, o6, i5, r6, c2, a4) : { event: i5, respond: c2 };
6991
6991
  }
6992
- return n6.length > 1 ? (await Promise.all(n6.map((n7) => Ye(We2, (t5) => (e4.logger.scope("transformer:many").error(`many branch ${n7} failed`, { error: t5 }), { event: null, respond: void 0 }))(e4, t4, Fe2(n7, Ke2(t4)), i5, Ge2(r6, n7), void 0, a4))), { event: null, respond: void 0 }) : { event: i5, respond: c2 };
6992
+ return n6.length > 1 ? (await Promise.all(n6.map((n7) => Ye(Le, (t5) => (e4.logger.scope("transformer:many").error(`many branch ${n7} failed`, { error: t5 }), { event: null, respond: void 0 }))(e4, t4, Re2(n7, Be2(t4)), i5, We2(r6, n7), void 0, a4))), { event: null, respond: void 0 }) : { event: i5, respond: c2 };
6993
6993
  }
6994
6994
  }
6995
6995
  return { event: i5, respond: c2 };
6996
6996
  }
6997
- function Le(e4) {
6997
+ function Ve2(e4) {
6998
6998
  return e4 && de(e4) ? e4 : {};
6999
6999
  }
7000
- function Ve2(e4) {
7000
+ function Ne(e4) {
7001
7001
  return "string" == typeof e4 || !(!Array.isArray(e4) || !e4.every((e5) => "string" == typeof e5));
7002
7002
  }
7003
- async function Ne2(e4, t4, n5) {
7003
+ async function Ye2(e4, t4, n5) {
7004
7004
  if (!t4.on || !t4.queueOn?.length) return;
7005
7005
  const o4 = t4.queueOn;
7006
7006
  t4.queueOn = [];
7007
7007
  const r6 = n5 || t4.config?.id || "unknown";
7008
- for (const { type: n6, data: s4 } of o4) st(n6) && !dt(e4, t4, n6) || (await Ye(t4.on, (t5) => {
7008
+ for (const { type: n6, data: s4 } of o4) at(n6) && !lt2(e4, t4, n6) || (await Ye(t4.on, (t5) => {
7009
7009
  if (t5 instanceof Xe) throw t5;
7010
7010
  e4.status.failed++, e4.logger.scope("source").error("source on flush failed", { sourceId: r6, type: n6, error: t5 });
7011
- })(n6, s4), st(n6) && ut(e4, t4, n6));
7011
+ })(n6, s4), at(n6) && ut(e4, t4, n6));
7012
7012
  }
7013
- function Ye2(e4) {
7013
+ function Je2(e4) {
7014
7014
  return Boolean(e4.config.init) && !e4.config.require?.length;
7015
7015
  }
7016
- function Je2(e4) {
7016
+ function Xe2(e4) {
7017
7017
  return "object" == typeof e4 && null !== e4;
7018
7018
  }
7019
- async function Xe2(e4, t4, n5) {
7020
- const { code: o4, config: r6 = {}, env: s4 = {}, primary: a4, next: i5, before: c2, cache: u2 } = n5, d2 = r6.state ?? n5.state, l3 = d2 ? rr(d2) : void 0, f3 = u2, p3 = f3 ? Qn({ ...f3, stop: f3.stop ?? true }) : void 0, g3 = Ve2(i5) ? Fe2(i5, Ke2(e4.transformers)) : void 0, m3 = Ve2(c2) ? Fe2(c2, Ke2(e4.transformers)) : void 0, h2 = s4.push, v3 = h2 ?? e4.push, y3 = Boolean(h2), w3 = async (n6, o5, s5) => {
7019
+ async function Qe2(e4, t4, n5) {
7020
+ const { code: o4, config: r6 = {}, env: s4 = {}, primary: a4, next: i5, before: c2, cache: d2 } = n5, u3 = r6.state ?? n5.state, l3 = u3 ? ir(u3) : void 0, f2 = d2, p3 = f2 ? nr({ ...f2, stop: f2.stop ?? true }) : void 0, g3 = Ne(i5) ? Re2(i5, Be2(e4.transformers)) : void 0, m3 = Ne(c2) ? Re2(c2, Be2(e4.transformers)) : void 0, h3 = s4.push, v2 = h3 ?? e4.push, y3 = Boolean(h3), w3 = async (n6, o5, s5) => {
7021
7021
  let a5;
7022
- const u3 = m3 ?? (void 0 !== c2 ? (() => {
7023
- const t5 = zn(c2, Xn(s5.ingest));
7022
+ const d3 = y3 || "string" == typeof n6.id && "" !== n6.id ? n6 : { ...n6, id: Me() }, u4 = m3 ?? (void 0 !== c2 ? (() => {
7023
+ const t5 = Un(c2, tr(s5.ingest));
7024
7024
  if (0 === t5.length) return [];
7025
- return Fe2(1 === t5.length ? t5[0] : t5, Ke2(e4.transformers));
7025
+ return Re2(1 === t5.length ? t5[0] : t5, Be2(e4.transformers));
7026
7026
  })() : []);
7027
- let d3 = [n6];
7028
- if (u3.length > 0 && e4.transformers && Object.keys(e4.transformers).length > 0) {
7029
- const o6 = await We2(e4, e4.transformers, u3, n6, s5.ingest, s5.respond, `source.${t4}.before`);
7030
- if (null === o6.event) return { ok: true };
7031
- if (o6.stopped) return o6.respond && (s5.respond = o6.respond), { ok: true };
7032
- o6.respond && (s5.respond = o6.respond), d3 = Array.isArray(o6.event) ? o6.event : [o6.event];
7027
+ let f3 = [d3];
7028
+ if (u4.length > 0 && e4.transformers && Object.keys(e4.transformers).length > 0) {
7029
+ const n7 = await Le(e4, e4.transformers, u4, d3, s5.ingest, s5.respond, `source.${t4}.before`);
7030
+ if (null === n7.event) return { ok: true };
7031
+ if (n7.stopped) return n7.respond && (s5.respond = n7.respond), { ok: true };
7032
+ n7.respond && (s5.respond = n7.respond);
7033
+ const o6 = "string" == typeof d3.id ? d3.id : "";
7034
+ if (Array.isArray(n7.event)) f3 = n7.event.map((e5) => "" !== o6 && e5.id === o6 ? { ...e5, id: Me() } : e5);
7035
+ else {
7036
+ const e5 = n7.event;
7037
+ f3 = "" === o6 || "string" == typeof e5.id && "" !== e5.id ? [e5] : [{ ...e5, id: o6 }];
7038
+ }
7033
7039
  }
7034
7040
  if (p3) {
7035
- const t5 = ze(p3, e4);
7041
+ const t5 = Ue2(p3, e4);
7036
7042
  if (t5) {
7037
- const n7 = Xn(s5.ingest), o6 = await er(p3, t5, n7);
7043
+ const n7 = tr(s5.ingest), o6 = await rr(p3, t5, n7);
7038
7044
  if (o6) {
7039
7045
  if ("HIT" === o6.status && void 0 !== o6.value && p3.stop) {
7040
7046
  let t6 = o6.value;
7041
- return o6.rule.update && (t6 = await nr(t6, o6.rule.update, { ...n7, cache: { status: "HIT" } }, e4)), s5.respond?.(t6), { ok: true };
7047
+ return o6.rule.update && (t6 = await sr(t6, o6.rule.update, { ...n7, cache: { status: "HIT" } }, e4)), s5.respond?.(t6), { ok: true };
7042
7048
  }
7043
7049
  if ("MISS" === o6.status && p3.stop && s5.respond) {
7044
- const r7 = s5.respond, i6 = o6.rule.update, c3 = { ...n7, cache: { status: "MISS" } }, u4 = o6.key, d4 = o6.rule.ttl, l4 = (n8) => {
7045
- tr(t5, u4, n8, d4), i6 ? a5 = (async () => {
7046
- const t6 = await nr(n8, i6, c3, e4);
7050
+ const r7 = s5.respond, i6 = o6.rule.update, c3 = { ...n7, cache: { status: "MISS" } }, d4 = o6.key, u5 = o6.rule.ttl, l4 = (n8) => {
7051
+ or(t5, d4, n8, u5), i6 ? a5 = (async () => {
7052
+ const t6 = await sr(n8, i6, c3, e4);
7047
7053
  r7(t6);
7048
7054
  })() : r7(n8);
7049
7055
  };
7050
7056
  s5.respond = l4;
7051
7057
  }
7052
- "MISS" !== o6.status || p3.stop || tr(t5, o6.key, true, o6.rule.ttl);
7058
+ "MISS" !== o6.status || p3.stop || or(t5, o6.key, true, o6.rule.ttl);
7053
7059
  }
7054
7060
  }
7055
7061
  }
7056
- const f4 = g3 ? { kind: "single", preChain: g3 } : void 0 !== i5 ? (() => {
7057
- const t5 = zn(i5, Xn(s5.ingest));
7058
- return 0 === t5.length ? { kind: "single", preChain: [] } : 1 === t5.length ? { kind: "single", preChain: Fe2(t5[0], Ke2(e4.transformers)) } : { kind: "many", branches: t5.map((t6) => Fe2(t6, Ke2(e4.transformers))) };
7062
+ const h4 = g3 ? { kind: "single", preChain: g3 } : void 0 !== i5 ? (() => {
7063
+ const t5 = Un(i5, tr(s5.ingest));
7064
+ return 0 === t5.length ? { kind: "single", preChain: [] } : 1 === t5.length ? { kind: "single", preChain: Re2(t5[0], Be2(e4.transformers)) } : { kind: "many", branches: t5.map((t6) => Re2(t6, Be2(e4.transformers))) };
7059
7065
  })() : { kind: "single", preChain: [] };
7060
- !y3 && l3 && l3.length > 0 && (d3 = await Promise.all(d3.map((t5) => or(l3, (t6) => Ue2(t6, e4), t5, e4))));
7061
- let h3 = { ok: true };
7062
- for (const n7 of d3) "many" === f4.kind ? (await Promise.all(f4.branches.map((a6, i6) => Ye(async () => y3 ? v3(n7) : v3(n7, { ...o5, id: t4, ingest: Ge2(s5.ingest, `${t4}.${i6}`), respond: void 0, mapping: r6, preChain: a6 }), (t5) => (e4.logger.scope("source:many").error(`many branch ${i6} failed`, { error: t5 }), { ok: true }))())), h3 = { ok: true }) : h3 = y3 ? await v3(n7) : await v3(n7, { ...o5, id: t4, ingest: s5.ingest, respond: s5.respond, mapping: r6, preChain: f4.preChain });
7063
- return a5 && await a5, h3;
7066
+ !y3 && l3 && l3.length > 0 && (f3 = await Promise.all(f3.map((t5) => ar(l3, (t6) => Ke2(t6, e4), t5, e4))));
7067
+ let w4 = { ok: true };
7068
+ for (const n7 of f3) "many" === h4.kind ? (await Promise.all(h4.branches.map((a6, i6) => Ye(async () => y3 ? v2(n7) : v2(n7, { ...o5, id: t4, ingest: We2(s5.ingest, `${t4}.${i6}`), respond: void 0, mapping: r6, preChain: a6 }), (t5) => (e4.logger.scope("source:many").error(`many branch ${i6} failed`, { error: t5 }), { ok: true }))())), w4 = { ok: true }) : w4 = y3 ? await v2(n7) : await v2(n7, { ...o5, id: t4, ingest: s5.ingest, respond: s5.respond, mapping: r6, preChain: h4.preChain });
7069
+ return a5 && await a5, w4;
7064
7070
  }, b3 = async (n6) => {
7065
- const o5 = I(t4), s5 = Re((function(e5) {
7066
- if (!Je2(e5)) return;
7071
+ const o5 = O(t4), s5 = Re((function(e5) {
7072
+ if (!Xe2(e5)) return;
7067
7073
  const t5 = e5.headers;
7068
- if (Je2(t5)) {
7074
+ if (Xe2(t5)) {
7069
7075
  if ((function(e6) {
7070
7076
  return "get" in e6 && "function" == typeof e6.get;
7071
7077
  })(t5)) return t5.get("traceparent") ?? void 0;
@@ -7076,24 +7082,24 @@ async function Xe2(e4, t4, n5) {
7076
7082
  if (s5 && (o5._meta.trace = s5.trace, o5._meta.parentEventId = s5.parentSpan), !r6.ingest || void 0 === n6) return o5;
7077
7083
  const a5 = await et(n6, r6.ingest, { collector: e4 });
7078
7084
  return { ...o5, ...a5, _meta: o5._meta };
7079
- }, k3 = e4.logger.scope("source").scope(t4), I3 = { command: e4.command, sources: e4.sources, elb: e4.elb, logger: k3, ...s4, push: async (e5, n6 = {}) => {
7080
- const o5 = { ingest: I(t4), respond: void 0 };
7085
+ }, k3 = e4.logger.scope("source").scope(t4), I2 = { command: e4.command, sources: e4.sources, elb: e4.elb, logger: k3, ...s4, push: async (e5, n6 = {}) => {
7086
+ const o5 = { ingest: O(t4), respond: void 0 };
7081
7087
  return w3(e5, n6, o5);
7082
- } }, C3 = { collector: e4, logger: k3, id: t4, config: r6, env: I3, withScope: async (e5, t5, n6) => {
7088
+ } }, C3 = { collector: e4, logger: k3, id: t4, config: r6, env: I2, withScope: async (e5, t5, n6) => {
7083
7089
  const o5 = { ingest: await b3(e5), respond: t5 };
7084
- return n6({ ...I3, push: (e6, t6 = {}) => w3(e6, t6, o5), ingest: o5.ingest, respond: o5.respond });
7090
+ return n6({ ...I2, push: (e6, t6 = {}) => w3(e6, t6, o5), ingest: o5.ingest, respond: o5.respond });
7085
7091
  }, reportError: ie2(e4, "source", t4, k3) }, E2 = await Ye(o4, (n6) => {
7086
7092
  if (n6 instanceof Xe) throw n6;
7087
7093
  e4.status.failed++, e4.logger.scope("source").error("source factory failed", { sourceId: t4, error: n6 });
7088
7094
  })(C3);
7089
7095
  if (!E2) return;
7090
7096
  const S2 = E2.type || "unknown", q3 = e4.logger.scope(S2).scope(t4);
7091
- return I3.logger = q3, a4 && (E2.config = { ...E2.config, primary: a4 }), E2;
7097
+ return I2.logger = q3, a4 && (E2.config = { ...E2.config, primary: a4 }), E2;
7092
7098
  }
7093
- async function Qe2(e4, t4 = {}) {
7099
+ async function Ze2(e4, t4 = {}) {
7094
7100
  const n5 = {};
7095
7101
  for (const [o4, r6] of Object.entries(t4)) {
7096
- const t5 = await Xe2(e4, o4, r6);
7102
+ const t5 = await Qe2(e4, o4, r6);
7097
7103
  if (!t5) continue;
7098
7104
  const s4 = r6.config?.require;
7099
7105
  t5.config = { ...t5.config, init: false, ...s4 ? { require: [...s4] } : {} }, n5[o4] = t5;
@@ -7105,48 +7111,48 @@ async function Qe2(e4, t4 = {}) {
7105
7111
  n6.init && await Ye(n6.init.bind(n6), (n7) => {
7106
7112
  if (n7 instanceof Xe) throw n7;
7107
7113
  o4 = true, e4.status.failed++, e4.logger.scope("source").error("source init failed", { sourceId: t5, error: n7 });
7108
- })(), o4 || (n6.config.init = true, Ye2(n6) && await Ne2(e4, n6, t5));
7114
+ })(), o4 || (n6.config.init = true, Je2(n6) && await Ye2(e4, n6, t5));
7109
7115
  }
7110
- return await Ze2(e4), n5;
7116
+ return await et2(e4), n5;
7111
7117
  }
7112
- async function Ze2(e4) {
7118
+ async function et2(e4) {
7113
7119
  for (const [t4, n5] of Object.entries(e4.sources)) {
7114
- if (Ye2(n5)) continue;
7120
+ if (Je2(n5)) continue;
7115
7121
  const o4 = n5.config.require;
7116
7122
  if (!o4?.length) continue;
7117
- const r6 = o4.filter((t5) => !it(e4, t5));
7118
- r6.length !== o4.length && (n5.config.require = r6, Ye2(n5) && await Ne2(e4, n5, t4));
7123
+ const r6 = o4.filter((t5) => !ct(e4, t5));
7124
+ r6.length !== o4.length && (n5.config.require = r6, Je2(n5) && await Ye2(e4, n5, t4));
7119
7125
  }
7120
7126
  for (const [t4, n5] of Object.entries(e4.pending.destinations)) {
7121
7127
  if (!e4.pending.destinations[t4] || e4.destinations[t4]) continue;
7122
7128
  const o4 = n5.config?.require;
7123
7129
  if (!o4) continue;
7124
- const r6 = o4.filter((t5) => !it(e4, t5));
7130
+ const r6 = o4.filter((t5) => !ct(e4, t5));
7125
7131
  if (n5.config && (n5.config.require = r6), r6.length > 0) continue;
7126
7132
  delete e4.pending.destinations[t4];
7127
- const s4 = Mt(n5);
7133
+ const s4 = Tt(n5);
7128
7134
  false !== s4.config.queue && (s4.queuePush = [...e4.queue]), e4.destinations[t4] = s4;
7129
7135
  }
7130
7136
  }
7131
- function et2(e4) {
7137
+ function tt2(e4) {
7132
7138
  if ("object" != typeof e4 || null === e4) return false;
7133
7139
  if (!("logger" in e4)) return false;
7134
7140
  const t4 = e4.logger;
7135
7141
  return "object" == typeof t4 && null !== t4 && ("scope" in t4 && "function" == typeof t4.scope);
7136
7142
  }
7137
- var tt2 = false;
7138
- function nt2() {
7139
- tt2 || (tt2 = true, "undefined" != typeof console && "function" == typeof console.warn && console.warn("walkerOS: ignored an on-dispatch call with a non-collector argument"));
7143
+ var nt2 = false;
7144
+ function ot() {
7145
+ nt2 || (nt2 = true, "undefined" != typeof console && "function" == typeof console.warn && console.warn("walkerOS: ignored an on-dispatch call with a non-collector argument"));
7140
7146
  }
7141
- function ot(e4, t4, n5, o4) {
7147
+ function rt(e4, t4, n5, o4) {
7142
7148
  if (n5 instanceof Xe) throw n5;
7143
7149
  e4.logger.scope("on").error("on callback failed", { kind: t4, ...o4, error: n5 });
7144
7150
  }
7145
- var rt = [n.Commands.Consent, n.Commands.User, n.Commands.Globals, n.Commands.Custom];
7146
- function st(e4) {
7147
- return rt.includes(e4);
7151
+ var st = [n.Commands.Consent, n.Commands.User, n.Commands.Globals, n.Commands.Custom];
7152
+ function at(e4) {
7153
+ return st.includes(e4);
7148
7154
  }
7149
- function at(e4, t4) {
7155
+ function it(e4, t4) {
7150
7156
  switch (t4) {
7151
7157
  case n.Commands.Consent:
7152
7158
  return Object.keys(e4.consent).length > 0;
@@ -7160,13 +7166,13 @@ function at(e4, t4) {
7160
7166
  return false;
7161
7167
  }
7162
7168
  }
7163
- function it(e4, t4) {
7169
+ function ct(e4, t4) {
7164
7170
  switch (t4) {
7165
7171
  case n.Commands.Consent:
7166
7172
  case n.Commands.User:
7167
7173
  case n.Commands.Globals:
7168
7174
  case n.Commands.Custom:
7169
- return at(e4, t4);
7175
+ return it(e4, t4);
7170
7176
  case n.Commands.Run:
7171
7177
  case n.Commands.Ready:
7172
7178
  return true === e4.allowed;
@@ -7174,26 +7180,26 @@ function it(e4, t4) {
7174
7180
  return e4.seenEvents.has(String(t4));
7175
7181
  }
7176
7182
  }
7177
- function ct(e4, t4) {
7183
+ function dt(e4, t4) {
7178
7184
  return e4.cellVersion[String(t4)] ?? 0;
7179
7185
  }
7180
7186
  function ut(e4, t4, n5) {
7181
7187
  let o4 = e4.delivery.get(t4);
7182
- o4 || (o4 = {}, e4.delivery.set(t4, o4)), o4[String(n5)] = ct(e4, n5);
7188
+ o4 || (o4 = {}, e4.delivery.set(t4, o4)), o4[String(n5)] = dt(e4, n5);
7183
7189
  }
7184
- function dt(e4, t4, n5) {
7185
- return e4.allowed && ct(e4, n5) > (function(e5, t5, n6) {
7190
+ function lt2(e4, t4, n5) {
7191
+ return e4.allowed && dt(e4, n5) > (function(e5, t5, n6) {
7186
7192
  const o4 = e5.delivery.get(t5), r6 = o4?.[String(n6)];
7187
7193
  return void 0 === r6 ? -1 : r6;
7188
7194
  })(e4, t4, n5);
7189
7195
  }
7190
- function lt2(e4) {
7196
+ function ft(e4) {
7191
7197
  return e4.cascade ? () => {
7192
7198
  } : (e4.cascade = { counts: /* @__PURE__ */ new WeakMap() }, () => {
7193
7199
  e4.cascade = void 0;
7194
7200
  });
7195
7201
  }
7196
- function ft(e4, t4, n5) {
7202
+ function pt2(e4, t4, n5) {
7197
7203
  const o4 = e4.cascade;
7198
7204
  if (!o4) return true;
7199
7205
  let r6 = o4.counts.get(t4);
@@ -7201,31 +7207,31 @@ function ft(e4, t4, n5) {
7201
7207
  const s4 = String(n5), a4 = (r6[s4] || 0) + 1;
7202
7208
  return r6[s4] = a4, a4 <= 8 || (9 === a4 && e4.logger.error("state delivery did not converge", { type: s4 }), false);
7203
7209
  }
7204
- function pt2(e4, t4) {
7210
+ function gt2(e4, t4) {
7205
7211
  return { collector: e4, logger: e4.logger.scope("on").scope(String(t4)) };
7206
7212
  }
7207
- async function gt2(e4, t4, n5) {
7208
- if (!et2(e4)) return void nt2();
7213
+ async function mt(e4, t4, n5) {
7214
+ if (!tt2(e4)) return void ot();
7209
7215
  const o4 = e4.on, r6 = o4[t4] || [], s4 = ie(n5) ? n5 : [n5];
7210
7216
  s4.forEach((e5) => {
7211
7217
  r6.push(e5);
7212
- }), o4[t4] = r6, ht2(e4, t4, s4);
7218
+ }), o4[t4] = r6, vt2(e4, t4, s4);
7213
7219
  }
7214
- function mt(e4, t4, n5, o4, r6) {
7220
+ function ht2(e4, t4, n5, o4, r6) {
7215
7221
  if (!t4.on) return;
7216
- const s4 = t4.type || "unknown", a4 = e4.logger.scope(s4).scope("on").scope(o4), i5 = { collector: e4, logger: a4, id: n5, config: t4.config, data: r6, env: _t(t4.env, t4.config.env), reportError: ie2(e4, "destination", n5, a4, t4) };
7217
- Ge(t4.on, (t5) => ot(e4, "destination", t5, { destId: n5, type: o4 }))(o4, i5);
7222
+ const s4 = t4.type || "unknown", a4 = e4.logger.scope(s4).scope("on").scope(o4), i5 = { collector: e4, logger: a4, id: n5, config: t4.config, data: r6, env: Pt(t4.env, t4.config.env), reportError: ie2(e4, "destination", n5, a4, t4) };
7223
+ Ge(t4.on, (t5) => rt(e4, "destination", t5, { destId: n5, type: o4 }))(o4, i5);
7218
7224
  }
7219
- function ht2(e4, t4, o4, r6) {
7220
- if (!et2(e4)) return void nt2();
7221
- const s4 = vt2(e4, t4, r6);
7225
+ function vt2(e4, t4, o4, r6) {
7226
+ if (!tt2(e4)) return void ot();
7227
+ const s4 = yt(e4, t4, r6);
7222
7228
  if (o4.length) switch (t4) {
7223
7229
  case n.Commands.Consent:
7224
7230
  !(function(e5, t5, o5) {
7225
- const r7 = o5 || e5.consent, s5 = pt2(e5, n.Commands.Consent);
7231
+ const r7 = o5 || e5.consent, s5 = gt2(e5, n.Commands.Consent);
7226
7232
  t5.forEach((t6) => {
7227
- dt(e5, t6, n.Commands.Consent) && ft(e5, t6, n.Commands.Consent) && (Object.keys(r7).filter((e6) => e6 in t6).forEach((n5) => {
7228
- Ge(t6[n5], (t7) => ot(e5, "consent", t7, { key: n5 }))(r7, s5);
7233
+ lt2(e5, t6, n.Commands.Consent) && pt2(e5, t6, n.Commands.Consent) && (Object.keys(r7).filter((e6) => e6 in t6).forEach((n5) => {
7234
+ Ge(t6[n5], (t7) => rt(e5, "consent", t7, { key: n5 }))(r7, s5);
7229
7235
  }), ut(e5, t6, n.Commands.Consent));
7230
7236
  });
7231
7237
  })(e4, o4, r6);
@@ -7233,40 +7239,40 @@ function ht2(e4, t4, o4, r6) {
7233
7239
  case n.Commands.Ready:
7234
7240
  !(function(e5, t5) {
7235
7241
  if (!e5.allowed) return;
7236
- const o5 = pt2(e5, n.Commands.Ready);
7242
+ const o5 = gt2(e5, n.Commands.Ready);
7237
7243
  t5.forEach((t6) => {
7238
- Ge(t6, (t7) => ot(e5, "ready", t7))(void 0, o5);
7244
+ Ge(t6, (t7) => rt(e5, "ready", t7))(void 0, o5);
7239
7245
  });
7240
7246
  })(e4, o4);
7241
7247
  break;
7242
7248
  case n.Commands.Run:
7243
7249
  !(function(e5, t5) {
7244
7250
  if (!e5.allowed) return;
7245
- const o5 = pt2(e5, n.Commands.Run);
7251
+ const o5 = gt2(e5, n.Commands.Run);
7246
7252
  t5.forEach((t6) => {
7247
- Ge(t6, (t7) => ot(e5, "run", t7))(void 0, o5);
7253
+ Ge(t6, (t7) => rt(e5, "run", t7))(void 0, o5);
7248
7254
  });
7249
7255
  })(e4, o4);
7250
7256
  break;
7251
7257
  case n.Commands.Session:
7252
7258
  !(function(e5, t5) {
7253
7259
  if (!e5.session) return;
7254
- const o5 = pt2(e5, n.Commands.Session);
7260
+ const o5 = gt2(e5, n.Commands.Session);
7255
7261
  t5.forEach((t6) => {
7256
- Ge(t6, (t7) => ot(e5, "session", t7))(e5.session, o5);
7262
+ Ge(t6, (t7) => rt(e5, "session", t7))(e5.session, o5);
7257
7263
  });
7258
7264
  })(e4, o4);
7259
7265
  break;
7260
7266
  default: {
7261
- const n5 = pt2(e4, t4), r7 = st(t4);
7267
+ const n5 = gt2(e4, t4), r7 = at(t4);
7262
7268
  o4.forEach((o5) => {
7263
- "function" == typeof o5 && (r7 && !dt(e4, o5, t4) || r7 && !ft(e4, o5, t4) || (Ge(o5, (n6) => ot(e4, "generic", n6, { type: t4 }))(s4, n5), r7 && ut(e4, o5, t4)));
7269
+ "function" == typeof o5 && (r7 && !lt2(e4, o5, t4) || r7 && !pt2(e4, o5, t4) || (Ge(o5, (n6) => rt(e4, "generic", n6, { type: t4 }))(s4, n5), r7 && ut(e4, o5, t4)));
7264
7270
  });
7265
7271
  break;
7266
7272
  }
7267
7273
  }
7268
7274
  }
7269
- function vt2(e4, t4, o4) {
7275
+ function yt(e4, t4, o4) {
7270
7276
  switch (t4) {
7271
7277
  case n.Commands.Consent:
7272
7278
  return o4 || e4.consent;
@@ -7284,104 +7290,104 @@ function vt2(e4, t4, o4) {
7284
7290
  return;
7285
7291
  }
7286
7292
  }
7287
- async function yt(e4, t4, n5, o4, r6) {
7293
+ async function wt2(e4, t4, n5, o4, r6) {
7288
7294
  if (!t4.on) return false;
7289
- if (st(o4) && !dt(e4, t4, o4)) return false;
7290
- if (st(o4) && !ft(e4, t4, o4)) return false;
7291
- const s4 = await Ye(t4.on, (t5) => ot(e4, "source", t5, { sourceId: n5, type: o4 }))(o4, r6);
7292
- return st(o4) && ut(e4, t4, o4), false === s4;
7293
- }
7294
- async function wt2(e4) {
7295
- if (et2(e4)) for (const t4 of rt) {
7296
- if (!at(e4, t4)) continue;
7297
- const n5 = vt2(e4, t4);
7298
- ht2(e4, t4, e4.on[t4] || []);
7299
- for (const [o4, r6] of Object.entries(e4.sources)) Ye2(r6) && await yt(e4, r6, o4, t4, n5);
7300
- }
7301
- else nt2();
7302
- }
7303
- async function bt2(e4, t4, n5, o4) {
7304
- if (!et2(e4)) return nt2(), true;
7295
+ if (at(o4) && !lt2(e4, t4, o4)) return false;
7296
+ if (at(o4) && !pt2(e4, t4, o4)) return false;
7297
+ const s4 = await Ye(t4.on, (t5) => rt(e4, "source", t5, { sourceId: n5, type: o4 }))(o4, r6);
7298
+ return at(o4) && ut(e4, t4, o4), false === s4;
7299
+ }
7300
+ async function bt2(e4) {
7301
+ if (tt2(e4)) for (const t4 of st) {
7302
+ if (!it(e4, t4)) continue;
7303
+ const n5 = yt(e4, t4);
7304
+ vt2(e4, t4, e4.on[t4] || []);
7305
+ for (const [o4, r6] of Object.entries(e4.sources)) Je2(r6) && await wt2(e4, r6, o4, t4, n5);
7306
+ }
7307
+ else ot();
7308
+ }
7309
+ async function kt2(e4, t4, n5, o4) {
7310
+ if (!tt2(e4)) return ot(), true;
7305
7311
  e4.seenEvents.add(String(t4));
7306
7312
  let r6 = n5 || [];
7307
7313
  n5 || (r6 = e4.on[t4] || []);
7308
- const s4 = vt2(e4, t4, o4);
7314
+ const s4 = yt(e4, t4, o4);
7309
7315
  let a4 = false;
7310
7316
  for (const [n6, o5] of Object.entries(e4.sources)) {
7311
7317
  if (o5.config.require?.length) {
7312
7318
  const e5 = o5.config.require.indexOf(t4);
7313
7319
  -1 !== e5 && o5.config.require.splice(e5, 1);
7314
7320
  }
7315
- if (o5.on) if (Ye2(o5)) {
7316
- await yt(e4, o5, n6, t4, s4) && (a4 = true);
7321
+ if (o5.on) if (Je2(o5)) {
7322
+ await wt2(e4, o5, n6, t4, s4) && (a4 = true);
7317
7323
  } else o5.queueOn = o5.queueOn || [], o5.queueOn.push({ type: t4, data: s4 });
7318
7324
  }
7319
7325
  Object.entries(e4.destinations).forEach(([n6, o5]) => {
7320
7326
  if (o5.on) {
7321
7327
  if (!o5.config.init) return o5.queueOn = o5.queueOn || [], void o5.queueOn.push({ type: t4, data: s4 });
7322
- mt(e4, o5, n6, t4, s4);
7328
+ ht2(e4, o5, n6, t4, s4);
7323
7329
  }
7324
7330
  });
7325
- for (const [t5, n6] of Object.entries(e4.sources)) Ye2(n6) && n6.queueOn?.length && await Ne2(e4, n6, t5);
7326
- const i5 = Object.values(e4.sources).some((e5) => !Ye2(e5) && e5.config.require?.length);
7327
- return (Object.keys(e4.pending.destinations).length > 0 || i5) && await Ze2(e4), ht2(e4, t4, r6, o4), !a4;
7331
+ for (const [t5, n6] of Object.entries(e4.sources)) Je2(n6) && n6.queueOn?.length && await Ye2(e4, n6, t5);
7332
+ const i5 = Object.values(e4.sources).some((e5) => !Je2(e5) && e5.config.require?.length);
7333
+ return (Object.keys(e4.pending.destinations).length > 0 || i5) && await et2(e4), vt2(e4, t4, r6, o4), !a4;
7328
7334
  }
7329
- function kt2(e4) {
7335
+ function It2(e4) {
7330
7336
  return "number" == typeof e4 && e4 > 0 ? e4 : 1e4;
7331
7337
  }
7332
- var It2 = class extends Error {
7338
+ var Ct = class extends Error {
7333
7339
  constructor(e4) {
7334
7340
  super(e4), this.name = "DestinationTimeoutError";
7335
7341
  }
7336
7342
  };
7337
- function Ct(e4, t4, n5) {
7343
+ function Et2(e4, t4, n5) {
7338
7344
  let o4;
7339
7345
  const r6 = new Promise((e5, r7) => {
7340
- o4 = setTimeout(() => r7(new It2(n5)), t4);
7346
+ o4 = setTimeout(() => r7(new Ct(n5)), t4);
7341
7347
  });
7342
7348
  return Promise.race([e4, r6]).finally(() => {
7343
7349
  o4 && clearTimeout(o4);
7344
7350
  });
7345
7351
  }
7346
- var Et = Object.freeze({ batched: true });
7347
- function St2(e4) {
7348
- return e4 === Et;
7349
- }
7352
+ var St2 = Object.freeze({ batched: true });
7350
7353
  function qt(e4) {
7354
+ return e4 === St2;
7355
+ }
7356
+ function xt(e4) {
7351
7357
  return void 0 === e4 ? {} : "number" == typeof e4 ? { wait: e4 } : { wait: e4.wait, size: e4.size, age: e4.age };
7352
7358
  }
7353
- function xt2(e4, t4, n5) {
7359
+ function Ot2(e4, t4, n5) {
7354
7360
  if (!e4) return [];
7355
- if (Array.isArray(e4) && e4.every((e5) => "string" == typeof e5)) return Fe2(e4, t4);
7356
- if ("string" == typeof e4) return Fe2(e4, t4);
7357
- const o4 = zn(e4, Xn(n5));
7358
- return 0 === o4.length ? [] : 1 === o4.length ? Fe2(o4[0], t4) : Fe2(o4, t4);
7361
+ if (Array.isArray(e4) && e4.every((e5) => "string" == typeof e5)) return Re2(e4, t4);
7362
+ if ("string" == typeof e4) return Re2(e4, t4);
7363
+ const o4 = Un(e4, tr(n5));
7364
+ return 0 === o4.length ? [] : 1 === o4.length ? Re2(o4[0], t4) : Re2(o4, t4);
7359
7365
  }
7360
- async function Ot2(e4, t4) {
7366
+ async function jt2(e4, t4) {
7361
7367
  const { code: n5, config: o4 = {}, env: r6 = {}, before: s4, next: a4, cache: i5, state: c2 } = t4;
7362
- if (!le(n5.push)) return Dt({ ok: false, failed: { invalid: { type: "invalid", error: "Destination code must have a push method" } } });
7363
- const u2 = o4 || { init: false };
7364
- let d2 = s4 ? { ...u2, before: s4 } : { ...u2 };
7365
- a4 && (d2 = { ...d2, next: a4 }), i5 && (d2 = { ...d2, cache: i5 }), void 0 !== c2 && void 0 === d2.state && (d2 = { ...d2, state: c2 });
7366
- let l3 = d2.id;
7368
+ if (!le(n5.push)) return Mt2({ ok: false, failed: { invalid: { type: "invalid", error: "Destination code must have a push method" } } });
7369
+ const d2 = o4 || { init: false };
7370
+ let u3 = s4 ? { ...d2, before: s4 } : { ...d2 };
7371
+ a4 && (u3 = { ...u3, next: a4 }), i5 && (u3 = { ...u3, cache: i5 }), void 0 !== c2 && void 0 === u3.state && (u3 = { ...u3, state: c2 });
7372
+ let l3 = u3.id;
7367
7373
  if (!l3) do {
7368
- l3 = Ee(5, "abcdefghijklmnopqrstuvwxyz");
7374
+ l3 = xe(5, "abcdefghijklmnopqrstuvwxyz");
7369
7375
  } while (e4.destinations[l3] || e4.pending.destinations[l3]);
7370
- if (d2.require?.length) {
7371
- e4.pending.destinations[l3] = t4, await Ze2(e4);
7376
+ if (u3.require?.length) {
7377
+ e4.pending.destinations[l3] = t4, await et2(e4);
7372
7378
  const n6 = e4.destinations[l3];
7373
- return n6 ? jt2(e4, void 0, {}, { [l3]: n6 }) : Dt({ ok: true });
7379
+ return n6 ? $t2(e4, void 0, {}, { [l3]: n6 }) : Mt2({ ok: true });
7374
7380
  }
7375
- const f3 = { ...n5, config: d2, env: _t(n5.env, r6) };
7376
- return e4.destinations[l3] = f3, false !== f3.config.queue && (f3.queuePush = [...e4.queue]), jt2(e4, void 0, {}, { [l3]: f3 });
7381
+ const f2 = { ...n5, config: u3, env: Pt(n5.env, r6) };
7382
+ return e4.destinations[l3] = f2, false !== f2.config.queue && (f2.queuePush = [...e4.queue]), $t2(e4, void 0, {}, { [l3]: f2 });
7377
7383
  }
7378
- async function jt2(e4, t4, n5 = {}, o4) {
7384
+ async function $t2(e4, t4, n5 = {}, o4) {
7379
7385
  const { allowed: r6, consent: s4, globals: a4, user: i5 } = e4;
7380
- if (!r6) return Dt({ ok: false });
7386
+ if (!r6) return Mt2({ ok: false });
7381
7387
  if (t4) {
7382
7388
  const n6 = e4.config.queueMax;
7383
7389
  if (void 0 === n6) throw new Error("Collector.Config.queueMax is undefined; defaults must be seeded by collector()");
7384
- const o5 = N(e4.queue, t4, { max: n6 });
7390
+ const o5 = N2(e4.queue, t4, { max: n6 });
7385
7391
  if (o5.dropped > 0) {
7386
7392
  const t5 = ae2(e4.status, o("collector"), "queue", o5.dropped);
7387
7393
  J2(e4.queue, e4.logger, "collector.queue overflow; oldest events dropped", { buffer: "queue", cap: n6, droppedCount: t5 });
@@ -7389,51 +7395,51 @@ async function jt2(e4, t4, n5 = {}, o4) {
7389
7395
  e4.status.in++;
7390
7396
  }
7391
7397
  o4 || (o4 = e4.destinations);
7392
- const c2 = e4.transformers ? Ke2(e4.transformers) : {}, u2 = await Promise.all(Object.entries(o4 || {}).map(async ([o5, r7]) => {
7398
+ const c2 = e4.transformers ? Be2(e4.transformers) : {}, d2 = await Promise.all(Object.entries(o4 || {}).map(async ([o5, r7]) => {
7393
7399
  if (r7.config.disabled) return { id: o5, destination: r7, skipped: true };
7394
- const u3 = r7.config.id || o5, d3 = o("destination", u3), y4 = te2(r7.config.breaker);
7400
+ const d3 = r7.config.id || o5, u4 = o("destination", d3), y4 = te2(r7.config.breaker);
7395
7401
  if (y4 && (function(e5, t5, n6) {
7396
7402
  const o6 = e5[t5];
7397
7403
  if (!o6 || "closed" === o6.state) return false;
7398
7404
  if ("half-open" === o6.state) return true === o6.probing;
7399
7405
  const r8 = ee2();
7400
7406
  return void 0 !== o6.openUntil && r8 < o6.openUntil || (o6.state = "half-open", o6.probing = true, o6.openUntil = r8 + n6, false);
7401
- })(e4.status.breakers, d3, y4.cooldown)) return { id: o5, destination: r7, skipped: true };
7407
+ })(e4.status.breakers, u4, y4.cooldown)) return { id: o5, destination: r7, skipped: true };
7402
7408
  const b4 = (t5) => {
7403
- y4 && ne2(e4.status.breakers, d3, t5, y4.threshold, y4.cooldown);
7404
- }, I3 = () => {
7409
+ y4 && ne2(e4.status.breakers, u4, t5, y4.threshold, y4.cooldown);
7410
+ }, I2 = () => {
7405
7411
  y4 && (function(e5, t5) {
7406
7412
  const n6 = e5[t5];
7407
7413
  n6 && "half-open" === n6.state && true === n6.probing && (n6.state = "open", n6.probing = false);
7408
- })(e4.status.breakers, d3);
7414
+ })(e4.status.breakers, u4);
7409
7415
  };
7410
7416
  let C3 = (r7.queuePush || []).map((e5) => ({ ...e5, consent: s4 }));
7411
- r7.queuePush = [], t4 && C3.push(he(t4));
7412
- const E2 = n5.ingest ? { ...n5.ingest, _meta: { ...n5.ingest._meta, path: [...n5.ingest._meta.path] } } : I("unknown");
7413
- if (!C3.length && !r7.queueOn?.length) return I3(), { id: o5, destination: r7, skipped: true };
7417
+ r7.queuePush = [], t4 && C3.push(ve(t4));
7418
+ const E2 = n5.ingest ? { ...n5.ingest, _meta: { ...n5.ingest._meta, path: [...n5.ingest._meta.path] } } : O("unknown");
7419
+ if (!C3.length && !r7.queueOn?.length) return I2(), { id: o5, destination: r7, skipped: true };
7414
7420
  if (!C3.length && r7.queueOn?.length) {
7415
- if (!je(r7.config.consent, s4)) return I3(), { id: o5, destination: r7, skipped: true };
7421
+ if (!Se(r7.config.consent, s4)) return I2(), { id: o5, destination: r7, skipped: true };
7416
7422
  let t5 = false;
7417
7423
  try {
7418
- t5 = await $t2(e4, r7, o5, true);
7424
+ t5 = await At2(e4, r7, o5, true);
7419
7425
  } catch (t6) {
7420
7426
  e4.status.failed++;
7421
7427
  const n6 = r7.type || "unknown";
7422
7428
  e4.logger.scope(n6).error("destination init failed", { error: t6 instanceof Error ? t6.message : String(t6) }), b4("transport-failure");
7423
7429
  }
7424
- return I3(), { id: o5, destination: r7, skipped: !t5 };
7430
+ return I2(), { id: o5, destination: r7, skipped: !t5 };
7425
7431
  }
7426
7432
  const S2 = [], q3 = C3.filter((t5) => {
7427
- const n6 = je(r7.config.consent, s4, t5.consent);
7433
+ const n6 = Se(r7.config.consent, s4, t5.consent);
7428
7434
  if (n6) return t5.consent = n6, S2.push(t5), false;
7429
7435
  const a5 = _(e4, { stepId: o("destination", o5), stepType: "destination", phase: "skip", eventId: "string" == typeof t5.id ? t5.id : "", now: Date.now(), ...T2(t5, E2, e4) });
7430
- return a5.skipReason = "consent", s4 && (a5.consent = { ...s4 }), r7.config.consent && (a5.meta = { required: { ...r7.config.consent } }), on(e4, a5), true;
7436
+ return a5.skipReason = "consent", s4 && (a5.consent = { ...s4 }), r7.config.consent && (a5.meta = { required: { ...r7.config.consent } }), cn(e4, a5), true;
7431
7437
  });
7432
7438
  if (q3.length > 0) {
7433
7439
  const t5 = r7.queuePush, n6 = r7.config.id || o5, s5 = { max: r7.config.queueMax ?? 1e3 };
7434
7440
  let a5 = 0;
7435
7441
  for (const e5 of q3) {
7436
- a5 += N(t5, e5, s5).dropped;
7442
+ a5 += N2(t5, e5, s5).dropped;
7437
7443
  }
7438
7444
  if (a5 > 0) {
7439
7445
  se(e4, n6);
@@ -7441,62 +7447,62 @@ async function jt2(e4, t4, n5 = {}, o4) {
7441
7447
  J2(t5, e4.logger.scope(r7.type || "unknown"), "destination.queuePush overflow; oldest events dropped", { buffer: "queuePush", destination: n6, cap: s5.max, droppedCount: o6 });
7442
7448
  } else t5.length < s5.max && X2(t5);
7443
7449
  }
7444
- if (!S2.length) return I3(), { id: o5, destination: r7, queue: C3 };
7445
- let x2, $2, M3 = false;
7450
+ if (!S2.length) return I2(), { id: o5, destination: r7, queue: C3 };
7451
+ let x2, $2, M2 = false;
7446
7452
  try {
7447
- M3 = await $t2(e4, r7, o5, true);
7453
+ M2 = await At2(e4, r7, o5, true);
7448
7454
  } catch (t5) {
7449
7455
  e4.status.failed++;
7450
7456
  const n6 = r7.type || "unknown";
7451
7457
  e4.logger.scope(n6).error("destination init failed", { error: t5 instanceof Error ? t5.message : String(t5) }), b4("transport-failure");
7452
7458
  }
7453
- if (!M3) return I3(), { id: o5, destination: r7, queue: C3 };
7459
+ if (!M2) return I2(), { id: o5, destination: r7, queue: C3 };
7454
7460
  r7.dlq || (r7.dlq = []);
7455
- const P3 = xt2(r7.config.before, c2, E2), z5 = r7.config.next, U4 = r7.config?.cache, K4 = U4 ? Qn(U4) : void 0, B3 = K4 ? ze(K4, e4) : void 0, F4 = r7.config?.state ? rr(r7.config.state) : void 0, R4 = F4?.filter((e5) => "get" === e5.mode), H3 = F4?.filter((e5) => "set" === e5.mode);
7456
- let G3 = 0, W2 = 0;
7461
+ const P3 = Ot2(r7.config.before, c2, E2), z5 = r7.config.next, U4 = r7.config?.cache, K3 = U4 ? nr(U4) : void 0, B3 = K3 ? Ue2(K3, e4) : void 0, F4 = r7.config?.state ? ir(r7.config.state) : void 0, R4 = F4?.filter((e5) => "get" === e5.mode), H3 = F4?.filter((e5) => "set" === e5.mode);
7462
+ let G3 = 0, W3 = 0;
7457
7463
  return await Promise.all(S2.map(async (t5) => {
7458
7464
  let s5;
7459
- if (t5.globals = oe(a4, t5.globals), t5.user = oe(i5, t5.user), K4?.stop && B3) {
7460
- const e5 = Xn(E2, t5), n6 = await er(K4, B3, e5);
7465
+ if (t5.globals = oe(a4, t5.globals), t5.user = oe(i5, t5.user), K3?.stop && B3) {
7466
+ const e5 = tr(E2, t5), n6 = await rr(K3, B3, e5);
7461
7467
  if ("HIT" === n6?.status) return t5;
7462
7468
  "MISS" === n6?.status && (s5 = { key: n6.key, ttl: n6.rule.ttl });
7463
7469
  }
7464
- let u4 = t5, d4 = n5.respond;
7470
+ let d4 = t5, u5 = n5.respond;
7465
7471
  if (P3.length > 0 && e4.transformers && Object.keys(e4.transformers).length > 0) {
7466
- const r8 = await We2(e4, e4.transformers, P3, t5, E2, n5.respond, `destination.${o5}.before`);
7472
+ const r8 = await Le(e4, e4.transformers, P3, t5, E2, n5.respond, `destination.${o5}.before`);
7467
7473
  if (null === r8.event) return t5;
7468
- r8.respond && (d4 = r8.respond), u4 = Array.isArray(r8.event) ? r8.event[0] : r8.event;
7474
+ r8.respond && (u5 = r8.respond), d4 = Array.isArray(r8.event) ? r8.event[0] : r8.event;
7469
7475
  }
7470
- if (K4 && !K4.stop && B3) {
7471
- const e5 = Xn(E2, u4), n6 = await er(K4, B3, e5);
7476
+ if (K3 && !K3.stop && B3) {
7477
+ const e5 = tr(E2, d4), n6 = await rr(K3, B3, e5);
7472
7478
  if ("HIT" === n6?.status) return t5;
7473
7479
  "MISS" === n6?.status && (s5 = { key: n6.key, ttl: n6.rule.ttl });
7474
7480
  }
7475
- R4 && R4.length > 0 && u4 && (u4 = await or(R4, (t6) => Ue2(t6, e4), u4, e4));
7481
+ R4 && R4.length > 0 && d4 && (d4 = await ar(R4, (t6) => Ke2(t6, e4), d4, e4));
7476
7482
  const p3 = Date.now();
7477
7483
  let g3 = false;
7478
- const v3 = await Ye(At2, (t6) => {
7484
+ const v2 = await Ye(Dt, (t6) => {
7479
7485
  const n6 = r7.type || "unknown";
7480
- e4.logger.scope(n6).error("Push failed", { error: t6, event: u4.name }), x2 = t6, g3 = true;
7481
- const s6 = r7.dlq, a5 = r7.config.id || o5, i6 = { max: r7.config.dlqMax ?? re2 }, c3 = N(s6, [u4, t6], i6);
7486
+ e4.logger.scope(n6).error("Push failed", { error: t6, event: d4.name }), x2 = t6, g3 = true;
7487
+ const s6 = r7.dlq, a5 = r7.config.id || o5, i6 = { max: r7.config.dlqMax ?? re2 }, c3 = N2(s6, [d4, t6], i6);
7482
7488
  if (c3.dropped > 0) {
7483
7489
  se(e4, a5);
7484
7490
  const t7 = ae2(e4.status, o("destination", a5), "dlq", c3.dropped);
7485
7491
  J2(s6, e4.logger.scope(r7.type || "unknown"), "destination.dlq overflow; oldest entries dropped", { buffer: "dlq", destination: a5, cap: i6.max, droppedCount: t7 });
7486
7492
  } else s6.length < i6.max && X2(s6);
7487
- })(e4, r7, o5, u4, E2, d4);
7488
- if (G3 += Date.now() - p3, s5 && B3 && void 0 === r7.config.mock && tr(B3, s5.key, v3 ?? true, s5.ttl), !g3 && !St2(v3) && H3 && H3.length > 0 && u4 && (u4 = await or(H3, (t6) => Ue2(t6, e4), u4, e4)), void 0 === v3 || St2(v3) || ($2 = v3), St2(v3) && W2++, !g3 && z5) {
7489
- void 0 !== v3 && (E2._response = v3);
7490
- const t6 = xt2(z5, c2, E2);
7493
+ })(e4, r7, o5, d4, E2, u5);
7494
+ if (G3 += Date.now() - p3, s5 && B3 && void 0 === r7.config.mock && or(B3, s5.key, v2 ?? true, s5.ttl), !g3 && !qt(v2) && H3 && H3.length > 0 && d4 && (d4 = await ar(H3, (t6) => Ke2(t6, e4), d4, e4)), void 0 === v2 || qt(v2) || ($2 = v2), qt(v2) && W3++, !g3 && z5) {
7495
+ void 0 !== v2 && (E2._response = v2);
7496
+ const t6 = Ot2(z5, c2, E2);
7491
7497
  if (t6.length > 0 && e4.transformers && Object.keys(e4.transformers).length > 0) {
7492
- const n6 = await We2(e4, e4.transformers, t6, u4, E2, d4, `destination.${o5}.next`);
7493
- n6.respond && (d4 = n6.respond);
7498
+ const n6 = await Le(e4, e4.transformers, t6, d4, E2, u5, `destination.${o5}.next`);
7499
+ n6.respond && (u5 = n6.respond);
7494
7500
  }
7495
7501
  }
7496
7502
  return t5;
7497
- })), { id: o5, destination: r7, error: x2, response: $2, totalDuration: G3, batchedCount: W2, allowedCount: S2.length, canonicalId: u3, breakerConfig: y4 };
7498
- })), d2 = {}, y3 = {}, b3 = {};
7499
- for (const t5 of u2) {
7503
+ })), { id: o5, destination: r7, error: x2, response: $2, totalDuration: G3, batchedCount: W3, allowedCount: S2.length, canonicalId: d3, breakerConfig: y4 };
7504
+ })), u3 = {}, y3 = {}, b3 = {};
7505
+ for (const t5 of d2) {
7500
7506
  if (t5.skipped) continue;
7501
7507
  const n6 = t5.destination, o5 = { type: n6.type || "unknown", data: t5.response };
7502
7508
  se(e4, t5.id);
@@ -7509,139 +7515,147 @@ async function jt2(e4, t4, n5 = {}, o4) {
7509
7515
  else if (t5.queue && t5.queue.length) y3[t5.id] = o5;
7510
7516
  else {
7511
7517
  const n7 = t5.batchedCount ?? 0, a6 = t5.allowedCount ?? 0;
7512
- (Math.max(0, a6 - n7) > 0 || 0 === a6) && (d2[t5.id] = o5, r7.count++, r7.lastAt = s5, r7.duration += t5.totalDuration || 0, e4.status.out++, c3("success"));
7518
+ (Math.max(0, a6 - n7) > 0 || 0 === a6) && (u3[t5.id] = o5, r7.count++, r7.lastAt = s5, r7.duration += t5.totalDuration || 0, e4.status.out++, c3("success"));
7513
7519
  }
7514
7520
  }
7515
- return Dt({ event: t4, ...Object.keys(d2).length && { done: d2 }, ...Object.keys(y3).length && { queued: y3 }, ...Object.keys(b3).length && { failed: b3 } });
7521
+ return Mt2({ event: t4, ...Object.keys(u3).length && { done: u3 }, ...Object.keys(y3).length && { queued: y3 }, ...Object.keys(b3).length && { failed: b3 } });
7516
7522
  }
7517
- async function $t2(e4, t4, n5, o4 = false) {
7523
+ async function At2(e4, t4, n5, o4 = false) {
7518
7524
  if (t4.init && !t4.config.init) {
7519
7525
  if (!o4 && (function(e5) {
7520
7526
  const t5 = e5.config.consent;
7521
7527
  return !!t5 && Object.keys(t5).length > 0;
7522
7528
  })(t4)) return e4.logger.scope(t4.type || "unknown").debug("init blocked: consent gate not cleared"), false;
7523
- const r6 = t4.type || "unknown", s4 = e4.logger.scope(r6), a4 = { collector: e4, logger: s4, id: n5, config: t4.config, env: _t(t4.env, t4.config.env), reportError: ie2(e4, "destination", n5, s4, t4) };
7529
+ const r6 = t4.type || "unknown", s4 = e4.logger.scope(r6), a4 = { collector: e4, logger: s4, id: n5, config: t4.config, env: Pt(t4.env, t4.config.env), reportError: ie2(e4, "destination", n5, s4, t4) };
7524
7530
  s4.debug("init");
7525
7531
  const i5 = Date.now();
7526
7532
  let c2;
7527
- on(e4, _(e4, { stepId: o("destination", n5), stepType: "destination", phase: "init", eventId: "", now: i5 }));
7533
+ cn(e4, _(e4, { stepId: o("destination", n5), stepType: "destination", phase: "init", eventId: "", now: i5 }));
7528
7534
  try {
7529
7535
  c2 = await gt(t4.init, "DestinationInit", e4.hooks, e4.logger)(a4);
7530
7536
  } catch (t5) {
7531
7537
  const o5 = Date.now(), r7 = _(e4, { stepId: o("destination", n5), stepType: "destination", phase: "error", eventId: "", now: o5 });
7532
- throw r7.durationMs = o5 - i5, r7.error = t5 instanceof Error ? { name: t5.name, message: t5.message } : { message: String(t5) }, on(e4, r7), t5;
7538
+ throw r7.durationMs = o5 - i5, r7.error = t5 instanceof Error ? { name: t5.name, message: t5.message } : { message: String(t5) }, cn(e4, r7), t5;
7533
7539
  }
7534
7540
  if (false === c2) return c2;
7535
7541
  if (t4.config = { ...c2 || t4.config, init: true }, t4.queueOn?.length) {
7536
7542
  const o5 = t4.queueOn;
7537
7543
  t4.queueOn = [];
7538
- for (const { type: r7, data: s5 } of o5) mt(e4, t4, n5, r7, s5);
7544
+ for (const { type: r7, data: s5 } of o5) ht2(e4, t4, n5, r7, s5);
7539
7545
  }
7540
7546
  s4.debug("init done");
7541
7547
  }
7542
7548
  return true;
7543
7549
  }
7544
- async function At2(e4, t4, n5, o4, r6, s4) {
7550
+ async function Dt(e4, t4, n5, o4, r6, s4) {
7545
7551
  const { config: a4 } = t4, i5 = await nt(o4, a4, e4);
7546
7552
  if (i5.ignore) return false;
7547
- const c2 = t4.type || "unknown", u2 = e4.logger.scope(c2), d2 = { collector: e4, logger: u2, id: n5, config: a4, data: i5.data, rule: i5.mapping, ingest: r6, env: { ..._t(t4.env, a4.env), ...s4 ? { respond: s4 } : {} }, reportError: ie2(e4, "destination", n5, u2, t4) };
7548
- if (void 0 !== a4.mock) return u2.debug("mock", { event: i5.event.name }), a4.mock;
7549
- const l3 = i5.mapping, f3 = void 0 !== l3?.batch, p3 = f3 ? i5.mappingKey || "* *" : " batch-all";
7550
- if ((f3 || void 0 !== a4.batch) && t4.pushBatch && void 0 === a4.mock) {
7553
+ const c2 = t4.type || "unknown", d2 = e4.logger.scope(c2), u3 = { collector: e4, logger: d2, id: n5, config: a4, data: i5.data, rule: i5.mapping, ingest: r6, env: { ...Pt(t4.env, a4.env), ...s4 ? { respond: s4 } : {} }, reportError: ie2(e4, "destination", n5, d2, t4) };
7554
+ if (void 0 !== a4.mock) return d2.debug("mock", { event: i5.event.name }), a4.mock;
7555
+ const l3 = i5.mapping, f2 = void 0 !== l3?.batch, p3 = f2 ? i5.mappingKey || "* *" : " batch-all";
7556
+ if ((f2 || void 0 !== a4.batch) && t4.pushBatch && void 0 === a4.mock) {
7551
7557
  if (t4.batches = t4.batches || {}, !t4.batches[p3]) {
7552
- const o5 = { key: p3, entries: [], events: [], data: [] }, r7 = qt(l3?.batch), s5 = qt(a4.batch), i6 = r7.wait ?? s5.wait ?? 3e4, c4 = r7.size ?? s5.size ?? 1e3, d4 = r7.age ?? s5.age ?? 3e4, g4 = _t(t4.env, a4.env), m4 = Ue(async () => {
7558
+ const o5 = { key: p3, entries: [], events: [], data: [] }, r7 = xt(l3?.batch), s5 = xt(a4.batch), i6 = r7.wait ?? s5.wait ?? 3e4, c4 = r7.size ?? s5.size ?? 1e3, u5 = r7.age ?? s5.age ?? 3e4, g4 = Pt(t4.env, a4.env), m4 = Ue(async () => {
7553
7559
  const o6 = t4.batches[p3], r8 = o6.batched;
7554
7560
  if (0 === r8.entries.length) return;
7555
7561
  const s6 = { key: r8.key, entries: r8.entries, events: r8.events, data: r8.data };
7556
7562
  r8.entries = [], r8.events = [], r8.data = [];
7557
- const i7 = s6.entries[0], { traceId: c5, sourceId: d5, parentEventId: l4 } = T2(i7.event, i7.ingest, e4), f4 = { collector: e4, logger: u2, id: n5, config: a4, data: void 0, rule: o6.isDefault ? void 0 : i7.rule, ingest: i7.ingest, env: { ...g4, ...i7.respond ? { respond: i7.respond } : {} }, reportError: ie2(e4, "destination", n5, u2, t4) };
7558
- u2.debug("push batch", { events: s6.entries.length });
7559
- const m5 = t4.config.id || n5, h3 = se(e4, m5), v4 = te2(t4.config.breaker), y3 = o("destination", m5), b4 = (t5) => {
7560
- v4 && ne2(e4.status.breakers, y3, t5, v4.threshold, v4.cooldown);
7561
- }, k4 = Date.now(), I3 = _(e4, { stepId: o("destination", n5), stepType: "destination", phase: "flush", eventId: "", now: k4, traceId: c5, sourceId: d5, parentEventId: l4 });
7562
- I3.batch = { size: s6.entries.length, index: 0 }, on(e4, I3);
7563
- const C3 = (n6) => {
7563
+ const i7 = s6.entries[0], c5 = { collector: e4, logger: d2, id: n5, config: a4, data: void 0, rule: o6.isDefault ? void 0 : i7.rule, ingest: i7.ingest, env: { ...g4, ...i7.respond ? { respond: i7.respond } : {} }, reportError: ie2(e4, "destination", n5, d2, t4) };
7564
+ d2.debug("push batch", { events: s6.entries.length });
7565
+ const u6 = t4.config.id || n5, l4 = se(e4, u6), f3 = te2(t4.config.breaker), m5 = o("destination", u6), h4 = (t5) => {
7566
+ f3 && ne2(e4.status.breakers, m5, t5, f3.threshold, f3.cooldown);
7567
+ }, v3 = Date.now(), y3 = /* @__PURE__ */ new Map();
7568
+ let b4, k4 = false;
7569
+ const I2 = (n6) => {
7564
7570
  const o7 = t4.dlq = t4.dlq || [], r9 = { max: t4.config.dlqMax ?? re2 };
7565
7571
  let s7 = 0;
7566
7572
  for (const e5 of n6) {
7567
- s7 += N(o7, e5, r9).dropped;
7573
+ s7 += N2(o7, e5, r9).dropped;
7568
7574
  }
7569
7575
  if (s7 > 0) {
7570
- const t5 = ae2(e4.status, o("destination", m5), "dlq", s7);
7571
- J2(o7, u2, "destination.dlq overflow; oldest entries dropped", { buffer: "dlq", destination: m5, cap: r9.max, droppedCount: t5 });
7576
+ const t5 = ae2(e4.status, o("destination", u6), "dlq", s7);
7577
+ J2(o7, d2, "destination.dlq overflow; oldest entries dropped", { buffer: "dlq", destination: u6, cap: r9.max, droppedCount: t5 });
7572
7578
  } else o7.length < r9.max && X2(o7);
7573
- h3.failed += n6.length, h3.dlqSize = o7.length, e4.status.failed += n6.length;
7579
+ l4.failed += n6.length, l4.dlqSize = o7.length, e4.status.failed += n6.length;
7574
7580
  };
7575
- let E2 = s6.entries.length;
7576
- const q3 = kt2(a4.timeout), x2 = await Ye((o7, r9) => Ct(Promise.resolve(gt(t4.pushBatch, "DestinationPushBatch", e4.hooks, e4.logger)(o7, r9)), q3, `Destination "${n5}" batch delivery timed out after ${q3}ms`), (t5) => {
7577
- E2 = 0;
7578
- const o7 = Date.now(), r9 = _(e4, { stepId: o("destination", n5), stepType: "destination", phase: "error", eventId: "", now: o7, traceId: c5, sourceId: d5, parentEventId: l4 });
7579
- r9.durationMs = o7 - k4, r9.error = t5 instanceof Error ? { name: t5.name, message: t5.message } : { message: String(t5) }, r9.batch = { size: s6.entries.length, index: 0 }, on(e4, r9), C3(s6.entries.map((e5) => [e5.event, t5])), b4("transport-failure"), u2.error("Push batch failed", { error: t5 instanceof Error ? t5.message : String(t5), entries: s6.entries.length });
7580
- })(s6, f4);
7581
- if (de(A2 = x2) && Array.isArray(A2.failed) && x2.failed.length > 0) {
7582
- const e5 = [], t5 = /* @__PURE__ */ new Set();
7583
- for (const n6 of x2.failed) {
7584
- const o7 = s6.entries[n6.index];
7585
- o7 && !t5.has(n6.index) && (t5.add(n6.index), e5.push([o7.event, n6.error ?? new Error(`Push batch entry ${n6.index} failed (no per-row error provided)`)]));
7581
+ let C3 = s6.entries.length;
7582
+ const E2 = It2(a4.timeout), q3 = await Ye((o7, r9) => Et2(Promise.resolve(gt(t4.pushBatch, "DestinationPushBatch", e4.hooks, e4.logger)(o7, r9)), E2, `Destination "${n5}" batch delivery timed out after ${E2}ms`), (e5) => {
7583
+ C3 = 0, k4 = true, b4 = e5, I2(s6.entries.map((t5) => [t5.event, e5])), h4("transport-failure"), d2.error("Push batch failed", { error: e5 instanceof Error ? e5.message : String(e5), entries: s6.entries.length });
7584
+ })(s6, c5);
7585
+ if (de(x2 = q3) && Array.isArray(x2.failed) && q3.failed.length > 0) {
7586
+ const e5 = [];
7587
+ for (const t5 of q3.failed) {
7588
+ const n6 = s6.entries[t5.index];
7589
+ if (!n6 || y3.has(t5.index)) continue;
7590
+ const o7 = t5.error ?? new Error(`Push batch entry ${t5.index} failed (no per-row error provided)`);
7591
+ y3.set(t5.index, o7), e5.push([n6.event, o7]);
7586
7592
  }
7587
- e5.length > 0 && (C3(e5), E2 = Math.max(0, s6.entries.length - e5.length), u2.error("Push batch partial failure", { failed: e5.length, delivered: E2, entries: s6.entries.length }));
7593
+ e5.length > 0 && (I2(e5), C3 = Math.max(0, s6.entries.length - e5.length), d2.error("Push batch partial failure", { failed: e5.length, delivered: C3, entries: s6.entries.length }));
7588
7594
  }
7589
- var A2;
7590
- u2.debug("push batch done"), h3.inFlightBatch = Math.max(0, (h3.inFlightBatch ?? 0) - s6.entries.length), E2 > 0 && (h3.count += E2, h3.lastAt = Date.now(), e4.status.out += E2, b4("success"));
7591
- }, { wait: i6, size: c4, age: d4 });
7592
- t4.batches[p3] = { batched: o5, isDefault: !f3, batchFn: () => {
7595
+ var x2;
7596
+ const A2 = Date.now();
7597
+ s6.entries.forEach((t5, o7) => {
7598
+ const r9 = k4 || y3.has(o7), a5 = T2(t5.event, t5.ingest, e4), i8 = _(e4, { stepId: o("destination", n5), stepType: "destination", phase: r9 ? "error" : "flush", eventId: "string" == typeof t5.event.id ? t5.event.id : "", now: A2, traceId: a5.traceId, sourceId: a5.sourceId, parentEventId: a5.parentEventId });
7599
+ if (i8.batch = { size: s6.entries.length, index: o7 }, r9) {
7600
+ const e5 = k4 ? b4 : y3.get(o7);
7601
+ i8.durationMs = A2 - v3, i8.error = e5 instanceof Error ? { name: e5.name, message: e5.message } : { message: String(e5) };
7602
+ }
7603
+ cn(e4, i8);
7604
+ }), d2.debug("push batch done"), l4.inFlightBatch = Math.max(0, (l4.inFlightBatch ?? 0) - s6.entries.length), C3 > 0 && (l4.count += C3, l4.lastAt = Date.now(), e4.status.out += C3, h4("success"));
7605
+ }, { wait: i6, size: c4, age: u5 });
7606
+ t4.batches[p3] = { batched: o5, isDefault: !f2, batchFn: () => {
7593
7607
  m4();
7594
7608
  }, flush: async () => {
7595
7609
  await m4.flush();
7596
7610
  } };
7597
7611
  }
7598
7612
  const c3 = t4.batches[p3];
7599
- c3.batched.entries.push({ event: i5.event, ingest: r6, respond: s4, rule: l3, data: i5.data }), c3.batched.events.push(i5.event), ue(i5.data) && c3.batched.data.push(i5.data);
7600
- const d3 = "string" == typeof i5.event.id ? i5.event.id : "", g3 = T2(o4, r6, e4), m3 = Date.now(), h2 = _(e4, { stepId: o("destination", n5), stepType: "destination", phase: "in", eventId: d3, now: m3, traceId: g3.traceId, sourceId: g3.sourceId, parentEventId: g3.parentEventId });
7601
- i5.mappingKey && (h2.mappingKey = i5.mappingKey), i5.event.consent && (h2.consent = { ...i5.event.consent }), h2.inEvent = i5.event, on(e4, h2);
7602
- const v3 = _(e4, { stepId: o("destination", n5), stepType: "destination", phase: "out", eventId: d3, now: m3, traceId: g3.traceId, sourceId: g3.sourceId, parentEventId: g3.parentEventId });
7603
- i5.mappingKey && (v3.mappingKey = i5.mappingKey), v3.outEvent = i5.event, v3.batch = { size: c3.batched.entries.length, index: c3.batched.entries.length - 1 }, on(e4, v3);
7613
+ c3.batched.entries.push({ event: i5.event, ingest: r6, respond: s4, rule: l3, data: i5.data }), c3.batched.events.push(i5.event), fe(i5.data) && c3.batched.data.push(i5.data);
7614
+ const u4 = "string" == typeof i5.event.id ? i5.event.id : "", g3 = T2(o4, r6, e4), m3 = Date.now(), h3 = _(e4, { stepId: o("destination", n5), stepType: "destination", phase: "in", eventId: u4, now: m3, traceId: g3.traceId, sourceId: g3.sourceId, parentEventId: g3.parentEventId });
7615
+ i5.mappingKey && (h3.mappingKey = i5.mappingKey), i5.event.consent && (h3.consent = { ...i5.event.consent }), h3.inEvent = i5.event, cn(e4, h3);
7616
+ const v2 = _(e4, { stepId: o("destination", n5), stepType: "destination", phase: "out", eventId: u4, now: m3, traceId: g3.traceId, sourceId: g3.sourceId, parentEventId: g3.parentEventId });
7617
+ i5.mappingKey && (v2.mappingKey = i5.mappingKey), v2.outEvent = i5.event, v2.batch = { size: c3.batched.entries.length, index: c3.batched.entries.length - 1 }, cn(e4, v2);
7604
7618
  const b3 = t4.config.id || n5, k3 = se(e4, b3);
7605
- return k3.inFlightBatch = (k3.inFlightBatch ?? 0) + 1, c3.batchFn(), Et;
7619
+ return k3.inFlightBatch = (k3.inFlightBatch ?? 0) + 1, c3.batchFn(), St2;
7606
7620
  }
7607
7621
  {
7608
7622
  let s5;
7609
- if (u2.debug("push", { event: i5.event.name }), "trace" === e4.observeLevel?.() && Array.isArray(t4.calls) && t4.calls.length > 0) {
7610
- const e5 = K2({ ...d2.env, simulation: t4.calls });
7611
- d2.env = e5.wrappedEnv, s5 = e5.calls, e5.unresolved.length > 0 && (e5.wrappedEnv[kn] = { paths: e5.unresolved, record: (t5, n6) => e5.calls.push({ fn: t5, args: n6, ts: Date.now() }) });
7623
+ if (d2.debug("push", { event: i5.event.name }), "trace" === e4.observeLevel?.() && Array.isArray(t4.calls) && t4.calls.length > 0) {
7624
+ const e5 = K({ ...u3.env, simulation: t4.calls });
7625
+ u3.env = e5.wrappedEnv, s5 = e5.calls, e5.unresolved.length > 0 && (e5.wrappedEnv[Sn] = { paths: e5.unresolved, record: (t5, n6) => e5.calls.push({ fn: t5, args: n6, ts: Date.now() }) });
7612
7626
  }
7613
- const c3 = "string" == typeof i5.event.id ? i5.event.id : "", { traceId: l4, sourceId: f4, parentEventId: p4 } = T2(o4, r6, e4), g3 = Date.now(), m3 = _(e4, { stepId: o("destination", n5), stepType: "destination", phase: "in", eventId: c3, now: g3, traceId: l4, sourceId: f4, parentEventId: p4 });
7614
- i5.mappingKey && (m3.mappingKey = i5.mappingKey), i5.event.consent && (m3.consent = { ...i5.event.consent }), m3.inEvent = i5.event, on(e4, m3);
7627
+ const c3 = "string" == typeof i5.event.id ? i5.event.id : "", { traceId: l4, sourceId: f3, parentEventId: p4 } = T2(o4, r6, e4), g3 = Date.now(), m3 = _(e4, { stepId: o("destination", n5), stepType: "destination", phase: "in", eventId: c3, now: g3, traceId: l4, sourceId: f3, parentEventId: p4 });
7628
+ i5.mappingKey && (m3.mappingKey = i5.mappingKey), i5.event.consent && (m3.consent = { ...i5.event.consent }), m3.inEvent = i5.event, cn(e4, m3);
7615
7629
  try {
7616
- const o5 = kt2(a4.timeout), r7 = await Ct(Promise.resolve(gt(t4.push, "DestinationPush", e4.hooks, e4.logger)(i5.event, d2)), o5, `Destination "${n5}" delivery timed out after ${o5}ms`), m4 = Date.now(), h2 = _(e4, { stepId: o("destination", n5), stepType: "destination", phase: "out", eventId: c3, now: m4, traceId: l4, sourceId: f4, parentEventId: p4 });
7617
- return h2.durationMs = m4 - g3, h2.outEvent = i5.event, s5 && s5.length > 0 && (h2.calls = R2(s5)), ue(r7) && (h2.meta = { ...h2.meta, response: r7 }), i5.mappingKey && (h2.mappingKey = i5.mappingKey), on(e4, h2), u2.debug("push done"), r7;
7630
+ const o5 = It2(a4.timeout), r7 = await Et2(Promise.resolve(gt(t4.push, "DestinationPush", e4.hooks, e4.logger)(i5.event, u3)), o5, `Destination "${n5}" delivery timed out after ${o5}ms`), m4 = Date.now(), h3 = _(e4, { stepId: o("destination", n5), stepType: "destination", phase: "out", eventId: c3, now: m4, traceId: l4, sourceId: f3, parentEventId: p4 });
7631
+ return h3.durationMs = m4 - g3, h3.outEvent = i5.event, s5 && s5.length > 0 && (h3.calls = R2(s5)), fe(r7) && (h3.meta = { ...h3.meta, response: r7 }), i5.mappingKey && (h3.mappingKey = i5.mappingKey), cn(e4, h3), d2.debug("push done"), r7;
7618
7632
  } catch (t5) {
7619
- const o5 = Date.now(), r7 = _(e4, { stepId: o("destination", n5), stepType: "destination", phase: "error", eventId: c3, now: o5, traceId: l4, sourceId: f4, parentEventId: p4 });
7620
- throw r7.durationMs = o5 - g3, r7.error = t5 instanceof Error ? { name: t5.name, message: t5.message } : { message: String(t5) }, s5 && s5.length > 0 && (r7.calls = R2(s5)), i5.mappingKey && (r7.mappingKey = i5.mappingKey), on(e4, r7), t5;
7633
+ const o5 = Date.now(), r7 = _(e4, { stepId: o("destination", n5), stepType: "destination", phase: "error", eventId: c3, now: o5, traceId: l4, sourceId: f3, parentEventId: p4 });
7634
+ throw r7.durationMs = o5 - g3, r7.error = t5 instanceof Error ? { name: t5.name, message: t5.message } : { message: String(t5) }, s5 && s5.length > 0 && (r7.calls = R2(s5)), i5.mappingKey && (r7.mappingKey = i5.mappingKey), cn(e4, r7), t5;
7621
7635
  }
7622
7636
  }
7623
7637
  }
7624
- function Dt(e4) {
7638
+ function Mt2(e4) {
7625
7639
  return { ok: !e4?.failed, ...e4 };
7626
7640
  }
7627
- function Mt(e4) {
7628
- const { code: t4, config: n5 = {}, env: o4 = {}, cache: r6, state: s4 } = e4, { config: a4 } = Be2(e4, "before"), { config: i5 } = Be2({ ...e4, config: a4 }, "next"), c2 = { ...t4.config, ...n5, ...i5 };
7641
+ function Tt(e4) {
7642
+ const { code: t4, config: n5 = {}, env: o4 = {}, cache: r6, state: s4 } = e4, { config: a4 } = Fe2(e4, "before"), { config: i5 } = Fe2({ ...e4, config: a4 }, "next"), c2 = { ...t4.config, ...n5, ...i5 };
7629
7643
  r6 && (c2.cache = r6), void 0 !== s4 && void 0 === c2.state && (c2.state = s4);
7630
- const u2 = _t(t4.env, o4);
7631
- return { ...t4, config: c2, env: u2 };
7644
+ const d2 = Pt(t4.env, o4);
7645
+ return { ...t4, config: c2, env: d2 };
7632
7646
  }
7633
- async function Tt(e4, t4 = {}) {
7647
+ async function _t(e4, t4 = {}) {
7634
7648
  const n5 = {};
7635
- for (const [o4, r6] of Object.entries(t4)) r6.config?.require?.length ? e4.pending.destinations[o4] = r6 : n5[o4] = Mt(r6);
7649
+ for (const [o4, r6] of Object.entries(t4)) r6.config?.require?.length ? e4.pending.destinations[o4] = r6 : n5[o4] = Tt(r6);
7636
7650
  return n5;
7637
7651
  }
7638
- function _t(e4, t4) {
7652
+ function Pt(e4, t4) {
7639
7653
  return e4 || t4 ? t4 ? e4 && de(e4) && de(t4) ? { ...e4, ...t4 } : t4 : e4 : {};
7640
7654
  }
7641
- var Rt = 5e3;
7642
- async function Ht(e4) {
7655
+ var Ht = 5e3;
7656
+ async function Gt(e4) {
7643
7657
  const t4 = e4.logger;
7644
- await Gt(e4.sources, "source", t4), await (async function(e5, t5) {
7658
+ await Wt(e4.sources, "source", t4), await (async function(e5, t5) {
7645
7659
  const n5 = Object.entries(e5).flatMap(([e6, n6]) => {
7646
7660
  const o4 = n6.batches;
7647
7661
  if (!o4) return [];
@@ -7650,7 +7664,7 @@ async function Ht(e4) {
7650
7664
  let n7;
7651
7665
  try {
7652
7666
  await Promise.race([t6.flush(), new Promise((t7, o5) => {
7653
- n7 = setTimeout(() => o5(new Error(`destination '${e6}' batch flush timed out`)), Rt);
7667
+ n7 = setTimeout(() => o5(new Error(`destination '${e6}' batch flush timed out`)), Ht);
7654
7668
  })]);
7655
7669
  } catch (t7) {
7656
7670
  r6.error(`destination '${e6}' batch flush failed: ${t7}`);
@@ -7660,9 +7674,9 @@ async function Ht(e4) {
7660
7674
  });
7661
7675
  });
7662
7676
  await Promise.allSettled(n5);
7663
- })(e4.destinations, t4), await Gt(e4.destinations, "destination", t4), await Gt(e4.transformers, "transformer", t4), await Gt(e4.stores, "store", t4);
7677
+ })(e4.destinations, t4), await Wt(e4.destinations, "destination", t4), await Wt(e4.transformers, "transformer", t4), await Wt(e4.stores, "store", t4);
7664
7678
  }
7665
- async function Gt(e4, t4, n5) {
7679
+ async function Wt(e4, t4, n5) {
7666
7680
  const o4 = Object.entries(e4).map(async ([e5, o5]) => {
7667
7681
  const r6 = o5.destroy;
7668
7682
  if (!r6) return;
@@ -7670,7 +7684,7 @@ async function Gt(e4, t4, n5) {
7670
7684
  let c2;
7671
7685
  try {
7672
7686
  await Promise.race([r6(i5), new Promise((n6, o6) => {
7673
- c2 = setTimeout(() => o6(new Error(`${t4} '${e5}' destroy timed out`)), Rt);
7687
+ c2 = setTimeout(() => o6(new Error(`${t4} '${e5}' destroy timed out`)), Ht);
7674
7688
  })]);
7675
7689
  } catch (n6) {
7676
7690
  a4.error(`${t4} '${e5}' destroy failed: ${n6}`);
@@ -7680,12 +7694,12 @@ async function Gt(e4, t4, n5) {
7680
7694
  });
7681
7695
  await Promise.allSettled(o4);
7682
7696
  }
7683
- function Wt(e4, t4) {
7697
+ function Lt(e4, t4) {
7684
7698
  e4.stateVersion++, e4.cellVersion[t4] = e4.stateVersion;
7685
7699
  }
7686
- async function Lt(e4, t4, o4) {
7700
+ async function Vt(e4, t4, o4) {
7687
7701
  let s4, a4, i5 = false;
7688
- const c2 = lt2(e4);
7702
+ const c2 = ft(e4);
7689
7703
  try {
7690
7704
  return await (async function() {
7691
7705
  switch (t4) {
@@ -7695,17 +7709,17 @@ async function Lt(e4, t4, o4) {
7695
7709
  case n.Commands.Consent:
7696
7710
  if (de(o4)) {
7697
7711
  const { update: t5 } = r2(e4, o4);
7698
- Wt(e4, n.Commands.Consent), a4 = t5, i5 = true;
7712
+ Lt(e4, n.Commands.Consent), a4 = t5, i5 = true;
7699
7713
  }
7700
7714
  break;
7701
7715
  case n.Commands.Custom:
7702
- de(o4) && (e4.custom = oe(e4.custom, o4), Wt(e4, n.Commands.Custom), a4 = o4, i5 = true);
7716
+ de(o4) && (e4.custom = oe(e4.custom, o4), Lt(e4, n.Commands.Custom), a4 = o4, i5 = true);
7703
7717
  break;
7704
7718
  case n.Commands.Destination:
7705
- de(o4) && "code" in o4 && de(o4.code) && (s4 = await Ot2(e4, o4));
7719
+ de(o4) && "code" in o4 && de(o4.code) && (s4 = await jt2(e4, o4));
7706
7720
  break;
7707
7721
  case n.Commands.Globals:
7708
- de(o4) && (e4.globals = oe(e4.globals, o4), Wt(e4, n.Commands.Globals), a4 = o4, i5 = true);
7722
+ de(o4) && (e4.globals = oe(e4.globals, o4), Lt(e4, n.Commands.Globals), a4 = o4, i5 = true);
7709
7723
  break;
7710
7724
  case n.Commands.Hook:
7711
7725
  if (de(o4) && ge(o4.name) && le(o4.fn)) {
@@ -7716,113 +7730,115 @@ async function Lt(e4, t4, o4) {
7716
7730
  case n.Commands.On:
7717
7731
  if (de(o4) && ge(o4.type)) {
7718
7732
  const { type: t5, rules: n5 } = o4;
7719
- await gt2(e4, t5, n5);
7733
+ await mt(e4, t5, n5);
7720
7734
  }
7721
7735
  break;
7722
7736
  case n.Commands.Ready:
7723
7737
  i5 = true;
7724
7738
  break;
7725
7739
  case n.Commands.Run:
7726
- s4 = await Jt(e4, o4), i5 = true;
7740
+ s4 = await Xt(e4, o4), i5 = true;
7727
7741
  break;
7728
7742
  case n.Commands.Session:
7729
7743
  i5 = true;
7730
7744
  break;
7731
7745
  case n.Commands.Shutdown:
7732
- e4.hasShutdown || (e4.hasShutdown = true, await Ht(e4));
7746
+ e4.hasShutdown || (e4.hasShutdown = true, await Gt(e4));
7733
7747
  break;
7734
7748
  case n.Commands.User:
7735
- de(o4) && (oe(e4.user, o4, { shallow: false }), Wt(e4, n.Commands.User), a4 = o4, i5 = true);
7749
+ de(o4) && (oe(e4.user, o4, { shallow: false }), Lt(e4, n.Commands.User), a4 = o4, i5 = true);
7736
7750
  break;
7737
7751
  default:
7738
- return e4.logger.warn("unknown command", { command: t4 }), Dt({ ok: false });
7752
+ return e4.logger.warn("unknown command", { command: t4 }), Mt2({ ok: false });
7739
7753
  }
7740
- i5 && (await bt2(e4, t4, void 0, a4), s4 = await jt2(e4));
7741
- return s4 || Dt({ ok: true });
7754
+ i5 && (await kt2(e4, t4, void 0, a4), s4 = await $t2(e4));
7755
+ return s4 || Mt2({ ok: true });
7742
7756
  })();
7743
7757
  } finally {
7744
7758
  c2();
7745
7759
  }
7746
7760
  }
7747
- function Vt(e4, t4) {
7761
+ function Nt(e4, t4) {
7748
7762
  return { timing: Math.round((Date.now() - e4.timing) / 10) / 100, source: { type: "collector", schema: "4" }, ...t4 };
7749
7763
  }
7750
- function Nt2(e4, t4, n5) {
7764
+ function Yt(e4, t4, n5) {
7751
7765
  if (!t4.name) throw new Error("Event name is required");
7752
7766
  const [o4, r6] = t4.name.split(" ");
7753
7767
  if (!o4 || !r6) throw new Error("Event name is invalid");
7754
- const { timestamp: s4 = Date.now(), name: a4 = `${o4} ${r6}`, data: i5 = {}, context: c2 = {}, globals: u2 = e4.globals, custom: d2 = {}, user: l3 = e4.user, nested: f3 = [], consent: p3 = e4.consent, id: g3 = Ne(), trigger: m3 = "", entity: h2 = o4, action: v3 = r6, timing: y3 = 0, source: w3 = { type: "collector", schema: "4" } } = t4, b3 = w3.count ?? (e4.count += 1), k3 = w3.trace ?? n5?._meta.trace ?? e4.trace, I3 = { ...w3, count: b3 };
7755
- void 0 !== k3 && (I3.trace = k3);
7756
- const C3 = e4.name ?? w3.platform ?? "default", E2 = e4.release ?? "4.3.2";
7757
- return I3.release = { ...w3.release, [C3]: E2 }, { name: a4, data: i5, context: c2, globals: u2, custom: d2, user: l3, nested: f3, consent: p3, id: g3, trigger: m3, entity: h2, action: v3, timestamp: s4, timing: y3, source: I3 };
7768
+ const { timestamp: s4 = Date.now(), name: a4 = `${o4} ${r6}`, data: i5 = {}, context: c2 = {}, globals: d2 = e4.globals, custom: u3 = {}, user: l3 = e4.user, nested: f2 = [], consent: p3 = e4.consent, id: g3 = Me(), trigger: m3 = "", entity: h3 = o4, action: v2 = r6, timing: y3 = 0, source: w3 = { type: "collector", schema: "4" } } = t4, b3 = w3.count ?? (e4.count += 1), k3 = w3.trace ?? n5?._meta.trace ?? e4.trace, I2 = { ...w3, count: b3 };
7769
+ void 0 !== k3 && (I2.trace = k3);
7770
+ const C3 = e4.name ?? w3.platform ?? "default", E2 = e4.release ?? "4.4.0-next-1785239495233";
7771
+ return I2.release = { ...w3.release, [C3]: E2 }, { name: a4, data: i5, context: c2, globals: d2, custom: u3, user: l3, nested: f2, consent: p3, id: g3, trigger: m3, entity: h3, action: v2, timestamp: s4, timing: y3, source: I2 };
7758
7772
  }
7759
- function Yt(e4, t4, n5) {
7760
- return Nt2(e4, Vt(e4, t4), n5);
7773
+ function Jt(e4, t4, n5) {
7774
+ return Yt(e4, Nt(e4, t4), n5);
7761
7775
  }
7762
- async function Jt(e4, t4) {
7763
- e4.allowed = true, e4.timing = Date.now(), e4.trace = Ce(), e4.count = 0, t4 && (t4.consent && (e4.consent = oe(e4.consent, t4.consent), Wt(e4, n.Commands.Consent)), t4.user && (e4.user = oe(e4.user, t4.user), Wt(e4, n.Commands.User)), t4.globals && (e4.globals = oe(e4.config.globalsStatic || {}, t4.globals), Wt(e4, n.Commands.Globals)), t4.custom && (e4.custom = oe(e4.custom, t4.custom), Wt(e4, n.Commands.Custom))), Object.values(e4.destinations).forEach((e5) => {
7776
+ async function Xt(e4, t4) {
7777
+ e4.allowed = true, e4.timing = Date.now(), e4.trace = Ce(), e4.count = 0, t4 && (t4.consent && (e4.consent = oe(e4.consent, t4.consent), Lt(e4, n.Commands.Consent)), t4.user && (e4.user = oe(e4.user, t4.user), Lt(e4, n.Commands.User)), t4.globals && (e4.globals = oe(e4.config.globalsStatic || {}, t4.globals), Lt(e4, n.Commands.Globals)), t4.custom && (e4.custom = oe(e4.custom, t4.custom), Lt(e4, n.Commands.Custom))), Object.values(e4.destinations).forEach((e5) => {
7764
7778
  e5.queuePush = [];
7765
- }), e4.queue = [], e4.round++, await Ze2(e4), await wt2(e4);
7766
- return await jt2(e4);
7779
+ }), e4.queue = [], e4.round++, await et2(e4), await bt2(e4);
7780
+ return await $t2(e4);
7767
7781
  }
7768
- function rn2(e4, t4) {
7782
+ function an2(e4, t4) {
7769
7783
  const n5 = gt(async (n6, o4 = {}) => await Ye(async () => {
7770
- const r6 = Date.now(), { id: s4, ingest: a4, respond: i5, mapping: c2, preChain: u2, include: d2, exclude: l3 } = o4;
7771
- let f3 = i5, p3 = n6;
7772
- const g3 = d2 || l3 ? (function(e5, t5, n7) {
7784
+ const r6 = Date.now(), { id: s4, ingest: a4, respond: i5, mapping: c2, preChain: d2, include: u3, exclude: l3 } = o4;
7785
+ let f2 = i5, p3 = n6;
7786
+ const g3 = u3 || l3 ? (function(e5, t5, n7) {
7773
7787
  let o5 = e5;
7774
7788
  return t5 && (o5 = Object.fromEntries(Object.entries(o5).filter(([e6]) => t5.includes(e6)))), n7 && (o5 = Object.fromEntries(Object.entries(o5).filter(([e6]) => !n7.includes(e6)))), o5;
7775
- })(e4.destinations, d2, l3) : void 0, m3 = a4 ?? I(s4 || "unknown");
7789
+ })(e4.destinations, u3, l3) : void 0, m3 = a4 ?? O(s4 || "unknown");
7776
7790
  if (c2) {
7777
7791
  const t5 = await nt(p3, c2, e4);
7778
- if (t5.ignore) return Dt({ ok: true });
7792
+ if (t5.ignore) return Mt2({ ok: true });
7779
7793
  if (c2.consent) {
7780
- if (!je(c2.consent, e4.consent, t5.event.consent)) return Dt({ ok: true });
7794
+ if (!Se(c2.consent, e4.consent, t5.event.consent)) return Mt2({ ok: true });
7781
7795
  }
7782
7796
  p3 = t5.event;
7783
7797
  }
7784
- if (u2?.length && e4.transformers && Object.keys(e4.transformers).length > 0) {
7785
- const n7 = await We2(e4, e4.transformers, u2, p3, m3, f3, s4 ? `source.${s4}.next` : void 0);
7786
- if (null === n7.event) return e4.logger.debug("Event dropped by transformer chain" + (n7.droppedBy ? ` (${n7.droppedBy})` : "")), Dt({ ok: true, dropped: true });
7787
- if (n7.stopped) return n7.respond && (f3 = n7.respond), Dt({ ok: true });
7788
- if (n7.respond && (f3 = n7.respond), Array.isArray(n7.event)) {
7789
- const o5 = await Promise.all(n7.event.map(async (n8) => {
7790
- const o6 = t4(n8), r7 = Nt2(e4, o6, m3);
7791
- return jt2(e4, r7, { id: s4, ingest: m3, respond: f3 }, g3);
7798
+ if (d2?.length && e4.transformers && Object.keys(e4.transformers).length > 0) {
7799
+ const n7 = await Le(e4, e4.transformers, d2, p3, m3, f2, s4 ? `source.${s4}.next` : void 0);
7800
+ if (null === n7.event) return e4.logger.debug("Event dropped by transformer chain" + (n7.droppedBy ? ` (${n7.droppedBy})` : "")), Mt2({ ok: true, dropped: true });
7801
+ if (n7.stopped) return n7.respond && (f2 = n7.respond), Mt2({ ok: true });
7802
+ n7.respond && (f2 = n7.respond);
7803
+ const o5 = "string" == typeof p3.id ? p3.id : "";
7804
+ if (Array.isArray(n7.event)) {
7805
+ const a5 = await Promise.all(n7.event.map(async (n8) => {
7806
+ const r7 = "" !== o5 && n8.id === o5 ? { ...n8, id: Me() } : n8, a6 = t4(r7), i6 = Yt(e4, a6, m3);
7807
+ return $t2(e4, i6, { id: s4, ingest: m3, respond: f2 }, g3);
7792
7808
  }));
7793
7809
  if (s4) {
7794
7810
  e4.status.sources[s4] || (e4.status.sources[s4] = { count: 0, duration: 0 });
7795
7811
  const t5 = e4.status.sources[s4];
7796
7812
  t5.count += n7.event.length, t5.lastAt = Date.now(), t5.duration += Date.now() - r6;
7797
7813
  }
7798
- return o5[0] ?? Dt({ ok: true });
7814
+ return a5[0] ?? Mt2({ ok: true });
7799
7815
  }
7800
- p3 = n7.event;
7816
+ p3 = "" === o5 || "string" == typeof n7.event.id && "" !== n7.event.id ? n7.event : { ...n7.event, id: o5 };
7801
7817
  }
7802
- const h2 = Yt(e4, p3, m3), v3 = await jt2(e4, h2, { id: s4, ingest: m3, respond: f3 }, g3);
7818
+ const h3 = Jt(e4, p3, m3), v2 = await $t2(e4, h3, { id: s4, ingest: m3, respond: f2 }, g3);
7803
7819
  if (s4) {
7804
7820
  e4.status.sources[s4] || (e4.status.sources[s4] = { count: 0, duration: 0 });
7805
7821
  const t5 = e4.status.sources[s4];
7806
7822
  t5.count++, t5.lastAt = Date.now(), t5.duration += Date.now() - r6;
7807
7823
  }
7808
- return v3;
7824
+ return v2;
7809
7825
  }, (t5) => {
7810
7826
  if (t5 instanceof Xe) throw t5;
7811
- return e4.status.failed++, e4.logger.error("push failed", { event: n6, ingest: o4.ingest, error: t5 }), Dt({ ok: false });
7827
+ return e4.status.failed++, e4.logger.error("push failed", { event: n6, ingest: o4.ingest, error: t5 }), Mt2({ ok: false });
7812
7828
  })(), "Push", e4.hooks, e4.logger);
7813
7829
  return async (t5, o4) => {
7814
- const r6 = "string" == typeof t5.id ? t5.id : "", { traceId: s4, sourceId: a4, parentEventId: i5 } = T2(t5, o4?.ingest, e4), c2 = Date.now(), u2 = _(e4, { stepId: "collector.push", stepType: "collector", phase: "in", eventId: r6, now: c2, traceId: s4, sourceId: a4, parentEventId: i5 });
7815
- u2.inEvent = t5, on(e4, u2);
7830
+ const r6 = "string" == typeof t5.id && "" !== t5.id ? t5 : { ...t5, id: Me() }, s4 = "string" == typeof r6.id ? r6.id : "", { traceId: a4, sourceId: i5, parentEventId: c2 } = T2(r6, o4?.ingest, e4), d2 = Date.now(), u3 = _(e4, { stepId: "collector.push", stepType: "collector", phase: "in", eventId: s4, now: d2, traceId: a4, sourceId: i5, parentEventId: c2 });
7831
+ u3.inEvent = r6, cn(e4, u3);
7816
7832
  try {
7817
- const u3 = await n5(t5, o4), d2 = Date.now(), l3 = _(e4, { stepId: "collector.push", stepType: "collector", phase: "out", eventId: r6, now: d2, traceId: s4, sourceId: a4, parentEventId: i5 });
7818
- return l3.durationMs = d2 - c2, l3.outEvent = u3, on(e4, l3), u3;
7833
+ const t6 = await n5(r6, o4), u4 = Date.now(), l3 = _(e4, { stepId: "collector.push", stepType: "collector", phase: "out", eventId: s4, now: u4, traceId: a4, sourceId: i5, parentEventId: c2 });
7834
+ return l3.durationMs = u4 - d2, l3.outEvent = t6, cn(e4, l3), t6;
7819
7835
  } catch (t6) {
7820
- const n6 = Date.now(), o5 = _(e4, { stepId: "collector.push", stepType: "collector", phase: "error", eventId: r6, now: n6, traceId: s4, sourceId: a4, parentEventId: i5 });
7821
- throw o5.durationMs = n6 - c2, o5.error = t6 instanceof Error ? { name: t6.name, message: t6.message } : { message: String(t6) }, on(e4, o5), t6;
7836
+ const n6 = Date.now(), o5 = _(e4, { stepId: "collector.push", stepType: "collector", phase: "error", eventId: s4, now: n6, traceId: a4, sourceId: i5, parentEventId: c2 });
7837
+ throw o5.durationMs = n6 - d2, o5.error = t6 instanceof Error ? { name: t6.name, message: t6.message } : { message: String(t6) }, cn(e4, o5), t6;
7822
7838
  }
7823
7839
  };
7824
7840
  }
7825
- function ln(e4 = {}) {
7841
+ function pn(e4 = {}) {
7826
7842
  const t4 = e4.maxEntries ?? 1e4, n5 = e4.lowWaterMark ?? 0.8, o4 = e4.sweepIntervalMs ?? 6e4, r6 = Math.floor(t4 * n5), s4 = /* @__PURE__ */ new Map(), a4 = { hits: 0, misses: 0, populates: 0, writes: 0, deletes: 0, evictions_entries: 0, evictions_ttl: 0 };
7827
7843
  let i5;
7828
7844
  o4 > 0 && (i5 = setInterval(function() {
@@ -7855,23 +7871,23 @@ function ln(e4 = {}) {
7855
7871
  void 0 !== i5 && (clearInterval(i5), i5 = void 0), s4.clear();
7856
7872
  } };
7857
7873
  }
7858
- function hn(e4, t4) {
7874
+ function yn(e4, t4) {
7859
7875
  const { cacheConfig: n5, cacheStore: o4, namespace: r6, logger: s4, storeId: a4, collector: i5 } = t4, c2 = (e5, t5) => {
7860
7876
  if (!i5) return;
7861
7877
  const n6 = _(i5, { stepId: `store.${a4}`, stepType: "store", phase: "in", eventId: "", now: Date.now() });
7862
- n6.meta = { op: "cache", cached: "hit" === t5, status: t5, key: e5 }, on(i5, n6);
7863
- }, u2 = { hits: 0, misses: 0, populates: 0, writes: 0, deletes: 0, inflight_dedups: 0 }, d2 = n5.rules.map((e5) => ({ match: e5.match ? Nn(e5.match) : () => true, ttl: e5.ttl })), l3 = (e5) => `${r6}:${e5}`;
7864
- function f3(e5, t5) {
7878
+ n6.meta = { op: "cache", cached: "hit" === t5, status: t5, key: e5 }, cn(i5, n6);
7879
+ }, d2 = { hits: 0, misses: 0, populates: 0, writes: 0, deletes: 0, inflight_dedups: 0 }, u3 = n5.rules.map((e5) => ({ match: e5.match ? Cn(e5.match) : () => true, ttl: e5.ttl })), l3 = (e5) => `${r6}:${e5}`;
7880
+ function f2(e5, t5) {
7865
7881
  const n6 = void 0 === t5 ? { key: e5 } : { key: e5, value: t5 };
7866
- return d2.find((e6) => e6.match(n6));
7882
+ return u3.find((e6) => e6.match(n6));
7867
7883
  }
7868
7884
  const p3 = /* @__PURE__ */ new Map();
7869
7885
  return { type: e4.type, config: e4.config, setup: e4.setup, get counters() {
7870
- return { ...u2 };
7886
+ return { ...d2 };
7871
7887
  }, async get(t5) {
7872
- const n6 = l3(t5), r7 = await o4.get(n6), s5 = Kn(r7);
7888
+ const n6 = l3(t5), r7 = await o4.get(n6), s5 = Bn(r7);
7873
7889
  if (void 0 !== s5) {
7874
- if (!("expired" in s5)) return u2.hits++, c2(t5, "hit"), s5.value;
7890
+ if (!("expired" in s5)) return d2.hits++, c2(t5, "hit"), s5.value;
7875
7891
  try {
7876
7892
  await o4.delete(n6);
7877
7893
  } catch (e5) {
@@ -7879,16 +7895,16 @@ function hn(e4, t4) {
7879
7895
  }
7880
7896
  }
7881
7897
  const a5 = p3.get(n6);
7882
- if (a5) return u2.inflight_dedups++, c2(t5, "hit"), a5;
7883
- u2.misses++, c2(t5, "miss");
7898
+ if (a5) return d2.inflight_dedups++, c2(t5, "hit"), a5;
7899
+ d2.misses++, c2(t5, "miss");
7884
7900
  const i6 = (async () => {
7885
7901
  try {
7886
7902
  const r8 = await e4.get(t5);
7887
7903
  if (void 0 === r8) return;
7888
- const s6 = f3(t5, r8);
7904
+ const s6 = f2(t5, r8);
7889
7905
  if (s6) try {
7890
7906
  const e5 = 1e3 * s6.ttl;
7891
- await o4.set(n6, Ln(r8, e5), e5), u2.populates++;
7907
+ await o4.set(n6, Wn(r8, e5), e5), d2.populates++;
7892
7908
  } catch (e5) {
7893
7909
  g3("set", t5, e5);
7894
7910
  }
@@ -7899,16 +7915,16 @@ function hn(e4, t4) {
7899
7915
  })();
7900
7916
  return p3.set(n6, i6), i6;
7901
7917
  }, async set(t5, n6, r7) {
7902
- u2.writes++, await e4.set(t5, n6, r7);
7903
- const s5 = f3(t5, n6);
7918
+ d2.writes++, await e4.set(t5, n6, r7);
7919
+ const s5 = f2(t5, n6);
7904
7920
  if (s5) try {
7905
7921
  const e5 = 1e3 * s5.ttl;
7906
- await o4.set(l3(t5), Ln(n6, e5), e5);
7922
+ await o4.set(l3(t5), Wn(n6, e5), e5);
7907
7923
  } catch (e5) {
7908
7924
  g3("set", t5, e5);
7909
7925
  }
7910
7926
  }, async delete(t5) {
7911
- u2.deletes++, await e4.delete(t5);
7927
+ d2.deletes++, await e4.delete(t5);
7912
7928
  try {
7913
7929
  await o4.delete(l3(t5));
7914
7930
  } catch (e5) {
@@ -7920,47 +7936,47 @@ function hn(e4, t4) {
7920
7936
  s4 ? s4.warn(o5, { error: n6 }) : console.warn(o5, n6);
7921
7937
  }
7922
7938
  }
7923
- function vn2(e4, t4, n5) {
7939
+ function wn2(e4, t4, n5) {
7924
7940
  const o4 = `store.${n5}`, r6 = gt(t4.get, "StoreGet", e4.hooks, e4.logger), s4 = gt(t4.set, "StoreSet", e4.hooks, e4.logger), a4 = gt(t4.delete, "StoreDelete", e4.hooks, e4.logger);
7925
7941
  t4.get = async (t5) => {
7926
7942
  const n6 = Date.now(), s5 = _(e4, { stepId: o4, stepType: "store", phase: "in", eventId: "", now: n6 });
7927
- s5.meta = { op: "get", key: t5 }, on(e4, s5);
7943
+ s5.meta = { op: "get", key: t5 }, cn(e4, s5);
7928
7944
  try {
7929
7945
  const s6 = await r6(t5), a5 = Date.now(), i5 = _(e4, { stepId: o4, stepType: "store", phase: "out", eventId: "", now: a5 });
7930
- return i5.durationMs = a5 - n6, i5.meta = { op: "get", key: t5 }, on(e4, i5), s6;
7946
+ return i5.durationMs = a5 - n6, i5.meta = { op: "get", key: t5 }, cn(e4, i5), s6;
7931
7947
  } catch (r7) {
7932
7948
  const s6 = Date.now(), a5 = _(e4, { stepId: o4, stepType: "store", phase: "error", eventId: "", now: s6 });
7933
- throw a5.durationMs = s6 - n6, a5.meta = { op: "get", key: t5 }, a5.error = r7 instanceof Error ? { name: r7.name, message: r7.message } : { message: String(r7) }, on(e4, a5), r7;
7949
+ throw a5.durationMs = s6 - n6, a5.meta = { op: "get", key: t5 }, a5.error = r7 instanceof Error ? { name: r7.name, message: r7.message } : { message: String(r7) }, cn(e4, a5), r7;
7934
7950
  }
7935
7951
  }, t4.set = async (t5, n6, r7) => {
7936
7952
  const a5 = Date.now(), i5 = _(e4, { stepId: o4, stepType: "store", phase: "in", eventId: "", now: a5 });
7937
- i5.meta = { op: "set", key: t5 }, on(e4, i5);
7953
+ i5.meta = { op: "set", key: t5 }, cn(e4, i5);
7938
7954
  try {
7939
7955
  await s4(t5, n6, r7);
7940
7956
  const i6 = Date.now(), c2 = _(e4, { stepId: o4, stepType: "store", phase: "out", eventId: "", now: i6 });
7941
- c2.durationMs = i6 - a5, c2.meta = { op: "set", key: t5 }, on(e4, c2);
7957
+ c2.durationMs = i6 - a5, c2.meta = { op: "set", key: t5 }, cn(e4, c2);
7942
7958
  } catch (n7) {
7943
7959
  const r8 = Date.now(), s5 = _(e4, { stepId: o4, stepType: "store", phase: "error", eventId: "", now: r8 });
7944
- throw s5.durationMs = r8 - a5, s5.meta = { op: "set", key: t5 }, s5.error = n7 instanceof Error ? { name: n7.name, message: n7.message } : { message: String(n7) }, on(e4, s5), n7;
7960
+ throw s5.durationMs = r8 - a5, s5.meta = { op: "set", key: t5 }, s5.error = n7 instanceof Error ? { name: n7.name, message: n7.message } : { message: String(n7) }, cn(e4, s5), n7;
7945
7961
  }
7946
7962
  }, t4.delete = async (t5) => {
7947
7963
  const n6 = Date.now(), r7 = _(e4, { stepId: o4, stepType: "store", phase: "in", eventId: "", now: n6 });
7948
- r7.meta = { op: "delete", key: t5 }, on(e4, r7);
7964
+ r7.meta = { op: "delete", key: t5 }, cn(e4, r7);
7949
7965
  try {
7950
7966
  await a4(t5);
7951
7967
  const r8 = Date.now(), s5 = _(e4, { stepId: o4, stepType: "store", phase: "out", eventId: "", now: r8 });
7952
- s5.durationMs = r8 - n6, s5.meta = { op: "delete", key: t5 }, on(e4, s5);
7968
+ s5.durationMs = r8 - n6, s5.meta = { op: "delete", key: t5 }, cn(e4, s5);
7953
7969
  } catch (r8) {
7954
7970
  const s5 = Date.now(), a5 = _(e4, { stepId: o4, stepType: "store", phase: "error", eventId: "", now: s5 });
7955
- throw a5.durationMs = s5 - n6, a5.meta = { op: "delete", key: t5 }, a5.error = r8 instanceof Error ? { name: r8.name, message: r8.message } : { message: String(r8) }, on(e4, a5), r8;
7971
+ throw a5.durationMs = s5 - n6, a5.meta = { op: "delete", key: t5 }, a5.error = r8 instanceof Error ? { name: r8.name, message: r8.message } : { message: String(r8) }, cn(e4, a5), r8;
7956
7972
  }
7957
7973
  };
7958
7974
  }
7959
- async function yn2(e4, t4 = {}) {
7975
+ async function bn(e4, t4 = {}) {
7960
7976
  const n5 = {};
7961
7977
  for (const [o5, r7] of Object.entries(t4)) {
7962
- const { code: t5, config: s4 = {}, env: a4 = {} } = r7, i5 = e4.logger.scope("store").scope(o5), c2 = { collector: e4, logger: i5, id: o5, config: s4, env: a4, reportError: ie2(e4, "store", o5, i5) }, u2 = await t5(c2);
7963
- n5[o5] = u2;
7978
+ const { code: t5, config: s4 = {}, env: a4 = {} } = r7, i5 = e4.logger.scope("store").scope(o5), c2 = { collector: e4, logger: i5, id: o5, config: s4, env: a4, reportError: ie2(e4, "store", o5, i5) }, d2 = await t5(c2);
7979
+ n5[o5] = d2;
7964
7980
  }
7965
7981
  const o4 = t4, r6 = (function(e5) {
7966
7982
  const t5 = {};
@@ -7988,21 +8004,21 @@ async function yn2(e4, t4 = {}) {
7988
8004
  const r7 = o4[t5].cache;
7989
8005
  if (!r7) continue;
7990
8006
  let s4, a4;
7991
- void 0 !== r7.store ? (s4 = n5[r7.store], a4 = r7.store) : (n5.__cache || (n5.__cache = ln()), s4 = n5.__cache, a4 = "__cache");
8007
+ void 0 !== r7.store ? (s4 = n5[r7.store], a4 = r7.store) : (n5.__cache || (n5.__cache = pn()), s4 = n5.__cache, a4 = "__cache");
7992
8008
  const i5 = r7.namespace ?? t5;
7993
- e4.logger.scope("store-cache").scope(t5).info(`store "${t5}" caches with namespace "${i5}:" via ${a4}`), n5[t5] = hn(n5[t5], { storeId: t5, cacheConfig: r7, cacheStore: s4, namespace: i5, logger: e4.logger.scope("store-cache").scope(t5), collector: e4 });
8009
+ e4.logger.scope("store-cache").scope(t5).info(`store "${t5}" caches with namespace "${i5}:" via ${a4}`), n5[t5] = yn(n5[t5], { storeId: t5, cacheConfig: r7, cacheStore: s4, namespace: i5, logger: e4.logger.scope("store-cache").scope(t5), collector: e4 });
7994
8010
  }
7995
- for (const [t5, o5] of Object.entries(n5)) "__cache" !== t5 && vn2(e4, o5, t5);
8011
+ for (const [t5, o5] of Object.entries(n5)) "__cache" !== t5 && wn2(e4, o5, t5);
7996
8012
  return n5;
7997
8013
  }
7998
- async function wn2(e4) {
8014
+ async function kn2(e4) {
7999
8015
  const t4 = oe({ globalsStatic: {}, sessionStatic: {}, run: true, queueMax: 1e3 }, e4, { merge: false, extend: false }), n5 = { level: e4.logger?.level, handler: e4.logger?.handler }, o4 = Be(n5), r6 = { ...t4.globalsStatic, ...e4.globals }, s4 = { allowed: false, config: t4, consent: e4.consent || {}, custom: e4.custom || {}, destinations: {}, transformers: {}, stores: {}, globals: r6, hooks: e4.hooks || {}, observers: /* @__PURE__ */ new Set(), logger: o4, on: {}, queue: [], round: 0, count: 0, stateVersion: 0, cellVersion: {}, delivery: /* @__PURE__ */ new WeakMap(), session: void 0, status: { startedAt: Date.now(), in: 0, out: 0, failed: 0, sources: {}, destinations: {}, dropped: {}, connectionErrors: {}, breakers: {} }, timing: Date.now(), user: e4.user || {}, sources: {}, pending: { destinations: {} }, hasShutdown: false, seenEvents: /* @__PURE__ */ new Set(), push: void 0, command: void 0, elb: void 0 };
8000
- void 0 !== e4.name && (s4.name = e4.name), void 0 !== e4.release && (s4.release = e4.release), s4.push = rn2(s4, (e5) => Vt(s4, e5)), s4.command = (function(e5, t5) {
8016
+ void 0 !== e4.name && (s4.name = e4.name), void 0 !== e4.release && (s4.release = e4.release), s4.push = an2(s4, (e5) => Nt(s4, e5)), s4.command = (function(e5, t5) {
8001
8017
  return gt(async (n6, o5, r7) => await Ye(async () => await t5(e5, n6, o5, r7), (t6) => {
8002
8018
  if (t6 instanceof Xe) throw t6;
8003
- return e5.status.failed++, e5.logger.error("command failed", { command: n6, data: o5, error: t6 }), Dt({ ok: false });
8019
+ return e5.status.failed++, e5.logger.error("command failed", { command: n6, data: o5, error: t6 }), Mt2({ ok: false });
8004
8020
  })(), "Command", e5.hooks, e5.logger);
8005
- })(s4, Lt), s4.elb = /* @__PURE__ */ (function(e5) {
8021
+ })(s4, Vt), s4.elb = /* @__PURE__ */ (function(e5) {
8006
8022
  return async (t5, n6, o5, r7, s5) => {
8007
8023
  if ("string" == typeof t5 && t5.startsWith("walker ")) {
8008
8024
  const o6 = t5.replace("walker ", "");
@@ -8011,14 +8027,14 @@ async function wn2(e4) {
8011
8027
  let a5;
8012
8028
  if ("string" == typeof t5) a5 = { name: t5 }, n6 && "object" == typeof n6 && !Array.isArray(n6) && (a5.data = n6);
8013
8029
  else {
8014
- if (!t5 || "object" != typeof t5 || Array.isArray(t5)) return Dt({ ok: false });
8030
+ if (!t5 || "object" != typeof t5 || Array.isArray(t5)) return Mt2({ ok: false });
8015
8031
  a5 = { ...t5 }, n6 && "object" == typeof n6 && !Array.isArray(n6) && (a5.data = { ...a5.data || {}, ...n6 });
8016
8032
  }
8017
8033
  return o5 && "object" == typeof o5 && (a5.context = o5), r7 && Array.isArray(r7) && (a5.nested = r7), s5 && "object" == typeof s5 && (a5.custom = s5), e5.push(a5);
8018
8034
  };
8019
8035
  })(s4);
8020
8036
  const a4 = e4.stores || {};
8021
- return s4.stores = await yn2(s4, a4), (function(e5, t5, n6) {
8037
+ return s4.stores = await bn(s4, a4), (function(e5, t5, n6) {
8022
8038
  const o5 = /* @__PURE__ */ new Map();
8023
8039
  for (const [n7, r8] of Object.entries(e5)) t5[n7] && o5.set(r8, t5[n7]);
8024
8040
  if (0 !== o5.size) {
@@ -8032,15 +8048,15 @@ async function wn2(e4) {
8032
8048
  }
8033
8049
  }
8034
8050
  }
8035
- })(a4, s4.stores, e4), s4.stores.__cache || (s4.stores.__cache = ln()), s4.destinations = await Tt(s4, e4.destinations || {}), s4.transformers = await (async function(e5, t5 = {}) {
8051
+ })(a4, s4.stores, e4), s4.stores.__cache || (s4.stores.__cache = pn()), s4.destinations = await _t(s4, e4.destinations || {}), s4.transformers = await (async function(e5, t5 = {}) {
8036
8052
  const n6 = {};
8037
8053
  for (const [o5, r7] of Object.entries(t5)) {
8038
- const { code: t6, env: s5 = {} } = r7, a5 = ur(r7, "Transformer");
8054
+ const { code: t6, env: s5 = {} } = r7, a5 = pr(r7, "Transformer");
8039
8055
  if (!a5.ok) {
8040
8056
  e5.logger.warn(`Transformer ${o5} invalid (${a5.code}): ${a5.reason}. Skipping.`);
8041
8057
  continue;
8042
8058
  }
8043
- const { config: i5 } = Be2(r7, "before"), { config: c2 } = Be2({ ...r7, config: i5 }, "next"), u2 = Object.keys(s5).length > 0 ? { ...c2, env: s5 } : c2, { cache: d2 } = r7, l3 = d2 ? { ...u2, cache: d2 } : u2, f3 = r7.config?.state ?? r7.state, p3 = void 0 !== f3 && void 0 === l3.state ? { ...l3, state: f3 } : l3, g3 = e5.logger.scope("transformer").scope(o5), m3 = { collector: e5, logger: g3, id: o5, ingest: I(o5), config: p3, env: s5, reportError: ie2(e5, "transformer", o5, g3) }, h2 = t6 ?? ((e6) => {
8059
+ const { config: i5 } = Fe2(r7, "before"), { config: c2 } = Fe2({ ...r7, config: i5 }, "next"), d2 = Object.keys(s5).length > 0 ? { ...c2, env: s5 } : c2, { cache: u3 } = r7, l3 = u3 ? { ...d2, cache: u3 } : d2, f2 = r7.config?.state ?? r7.state, p3 = void 0 !== f2 && void 0 === l3.state ? { ...l3, state: f2 } : l3, g3 = e5.logger.scope("transformer").scope(o5), m3 = { collector: e5, logger: g3, id: o5, ingest: O(o5), config: p3, env: s5, reportError: ie2(e5, "transformer", o5, g3) }, h3 = t6 ?? ((e6) => {
8044
8060
  const t7 = r7.mapping;
8045
8061
  if (t7) {
8046
8062
  const n7 = [];
@@ -8057,83 +8073,83 @@ async function wn2(e4) {
8057
8073
  } };
8058
8074
  }
8059
8075
  return { type: "pass", config: e6.config, push: (e7) => ({ event: e7 }) };
8060
- }), v3 = await h2(m3);
8061
- void 0 !== r7.before && void 0 === v3.config?.before && (v3.config = { ...v3.config ?? {}, before: r7.before }), void 0 !== r7.next && void 0 === v3.config?.next && (v3.config = { ...v3.config ?? {}, next: r7.next }), void 0 !== f3 && void 0 === v3.config?.state && (v3.config = { ...v3.config ?? {}, state: f3 }), n6[o5] = v3;
8076
+ }), v2 = await h3(m3);
8077
+ void 0 !== r7.before && void 0 === v2.config?.before && (v2.config = { ...v2.config ?? {}, before: r7.before }), void 0 !== r7.next && void 0 === v2.config?.next && (v2.config = { ...v2.config ?? {}, next: r7.next }), void 0 !== f2 && void 0 === v2.config?.state && (v2.config = { ...v2.config ?? {}, state: f2 }), n6[o5] = v2;
8062
8078
  }
8063
8079
  return n6;
8064
8080
  })(s4, e4.transformers || {}), s4;
8065
8081
  }
8066
- var bn2 = globalThis;
8067
- function kn2(e4) {
8082
+ var In2 = globalThis;
8083
+ function Cn2(e4) {
8068
8084
  try {
8069
- const t4 = bn2.window;
8085
+ const t4 = In2.window;
8070
8086
  if (!t4) return;
8071
- t4.localStorage.getItem(Nt) === e4 && t4.localStorage.removeItem(Nt);
8087
+ t4.localStorage.getItem(Mt) === e4 && t4.localStorage.removeItem(Mt);
8072
8088
  } catch {
8073
8089
  }
8074
8090
  }
8075
- function In(e4, t4) {
8091
+ function En2(e4, t4) {
8076
8092
  return void 0 === t4 ? e4 : (n5) => e4({ ...n5, release: t4 });
8077
8093
  }
8078
- function Cn2(e4, t4) {
8094
+ function Sn2(e4, t4) {
8079
8095
  if (t4.observers) for (const n6 of t4.observers) e4.observers.add(n6);
8080
8096
  const n5 = t4.observe;
8081
8097
  if (!n5) return;
8082
8098
  const o4 = e4.name ?? "default";
8083
8099
  if ("binding" in n5) {
8084
8100
  const t5 = (function() {
8085
- const e5 = bn2.window, t6 = bn2.URLSearchParams;
8101
+ const e5 = In2.window, t6 = In2.URLSearchParams;
8086
8102
  if (!e5 || !t6) return null;
8087
8103
  try {
8088
- const n6 = new t6(e5.location.search.replace(/^\?/, "")).getAll(Nt);
8104
+ const n6 = new t6(e5.location.search.replace(/^\?/, "")).getAll(Mt);
8089
8105
  return n6.length > 0 ? n6[n6.length - 1] ?? null : null;
8090
8106
  } catch {
8091
8107
  return null;
8092
8108
  }
8093
8109
  })(), r7 = t5 ?? (function() {
8094
8110
  try {
8095
- return bn2.window?.localStorage.getItem(Nt) ?? null;
8111
+ return In2.window?.localStorage.getItem(Mt) ?? null;
8096
8112
  } catch {
8097
8113
  return null;
8098
8114
  }
8099
8115
  })();
8100
8116
  if (!r7) return;
8101
- const u2 = xn(r7);
8102
- if (!u2) return void (null === t5 ? (e4.logger.warn("observe: malformed stored credential cleared"), kn2(r7)) : e4.logger.warn("observe: malformed credential ignored"));
8103
- if (u2.pb !== n5.binding) return void e4.logger.warn("observe: credential binding mismatch, credential ignored");
8104
- let d2;
8117
+ const d2 = On(r7);
8118
+ if (!d2) return void (null === t5 ? (e4.logger.warn("observe: malformed stored credential cleared"), Cn2(r7)) : e4.logger.warn("observe: malformed credential ignored"));
8119
+ if (d2.pb !== n5.binding) return void e4.logger.warn("observe: credential binding mismatch, credential ignored");
8120
+ let u3;
8105
8121
  !(function(e5) {
8106
8122
  try {
8107
- bn2.window?.localStorage.setItem(Nt, e5);
8123
+ In2.window?.localStorage.setItem(Mt, e5);
8108
8124
  } catch {
8109
8125
  }
8110
8126
  })(r7), null !== t5 && (function() {
8111
- const e5 = bn2.window, t6 = bn2.URLSearchParams;
8127
+ const e5 = In2.window, t6 = In2.URLSearchParams;
8112
8128
  if (e5 && t6) try {
8113
- const n6 = e5.location.href, o5 = n6.indexOf("#"), r8 = o5 >= 0 ? n6.slice(o5) : "", a4 = o5 >= 0 ? n6.slice(0, o5) : n6, i5 = a4.indexOf("?"), c2 = i5 >= 0 ? a4.slice(0, i5) : a4, u3 = new t6(i5 >= 0 ? a4.slice(i5 + 1) : "");
8114
- u3.delete(Nt);
8115
- const d3 = u3.toString();
8116
- e5.history.replaceState({}, "", `${c2}${d3 ? `?${d3}` : ""}${r8}`);
8129
+ const n6 = e5.location.href, o5 = n6.indexOf("#"), r8 = o5 >= 0 ? n6.slice(o5) : "", a4 = o5 >= 0 ? n6.slice(0, o5) : n6, i5 = a4.indexOf("?"), c2 = i5 >= 0 ? a4.slice(0, i5) : a4, d3 = new t6(i5 >= 0 ? a4.slice(i5 + 1) : "");
8130
+ d3.delete(Mt);
8131
+ const u4 = d3.toString();
8132
+ e5.history.replaceState({}, "", `${c2}${u4 ? `?${u4}` : ""}${r8}`);
8117
8133
  } catch {
8118
8134
  }
8119
8135
  })();
8120
- const l3 = sn({ url: `${n5.url}/ingest/${u2.ses}`, token: u2.secret, headers: { "X-Walkeros-Binding": n5.binding }, onStatus: (t6) => {
8121
- 401 === t6 && (kn2(r7), d2 && e4.observers.delete(d2));
8136
+ const l3 = fn({ url: `${n5.url}/ingest/${d2.ses}`, token: d2.secret, headers: { "X-Walkeros-Binding": n5.binding }, onStatus: (t6) => {
8137
+ 401 === t6 && (Cn2(r7), u3 && e4.observers.delete(u3));
8122
8138
  } });
8123
- d2 = vt(/* @__PURE__ */ (function(e5, t6) {
8139
+ u3 = ht(/* @__PURE__ */ (function(e5, t6) {
8124
8140
  return void 0 === t6 ? e5 : (n6) => e5({ ...n6, flowId: t6 });
8125
- })(In(l3, e4.release), n5.flowId), { flowId: n5.flowId ?? o4, ...void 0 !== n5.level ? { level: n5.level } : {}, ...void 0 !== n5.sample ? { sample: n5.sample } : {} }), e4.observers.add(d2);
8126
- const f3 = n5.level;
8127
- return void (void 0 !== f3 && (e4.observeLevel = () => f3));
8141
+ })(En2(l3, e4.release), n5.flowId), { flowId: n5.flowId ?? o4, ...void 0 !== n5.level ? { level: n5.level } : {}, ...void 0 !== n5.sample ? { sample: n5.sample } : {} }), e4.observers.add(u3);
8142
+ const f2 = n5.level;
8143
+ return void (void 0 !== f2 && (e4.observeLevel = () => f2));
8128
8144
  }
8129
8145
  if ("off" === n5.level) return;
8130
8146
  const r6 = n5.level;
8131
- void 0 !== r6 && (e4.observeLevel = () => r6), e4.observers.add(vt(In(sn({ url: `${n5.url}/ingest/${n5.sessionId}`, token: n5.token }), e4.release), { flowId: o4, level: n5.level, sample: n5.sample }));
8147
+ void 0 !== r6 && (e4.observeLevel = () => r6), e4.observers.add(ht(En2(fn({ url: `${n5.url}/ingest/${n5.sessionId}`, token: n5.token }), e4.release), { flowId: o4, level: n5.level, sample: n5.sample }));
8132
8148
  }
8133
- async function En(e4) {
8149
+ async function qn2(e4) {
8134
8150
  e4 = e4 || {};
8135
- const t4 = await wn2(e4);
8136
- Cn2(t4, e4), await Qe2(t4, e4.sources || {});
8151
+ const t4 = await kn2(e4);
8152
+ Sn2(t4, e4), await Ze2(t4, e4.sources || {});
8137
8153
  const { consent: n5, user: o4, globals: r6, custom: s4 } = e4;
8138
8154
  n5 && await t4.command("consent", n5), o4 && await t4.command("user", o4), r6 && await t4.command("globals", r6), s4 && await t4.command("custom", s4), t4.config.run && await t4.command("run");
8139
8155
  let a4 = t4.elb;
@@ -8147,7 +8163,7 @@ init_dist2();
8147
8163
  var destinationAPI = { type: "api", config: {}, env: { sendServer: a2 }, async push(event, { config, rule, data, env, logger }) {
8148
8164
  const { settings } = config, { url, headers, method, transform, timeout } = settings || {};
8149
8165
  if (!url) return;
8150
- const eventData = ue(data) ? data : event, body = transform ? transform(eventData, config, rule) : JSON.stringify(eventData);
8166
+ const eventData = fe(data) ? data : event, body = transform ? transform(eventData, config, rule) : JSON.stringify(eventData);
8151
8167
  logger?.debug("API destination sending request", { url, method: method || "POST", eventName: event.name });
8152
8168
  const sendServerFn = env?.sendServer || a2, response = await sendServerFn(url, body, { headers, method, timeout });
8153
8169
  logger?.debug("API destination response", { ok: response?.ok });
@@ -8206,8 +8222,8 @@ function createInstallationId() {
8206
8222
  // src/telemetry/consent.ts
8207
8223
  init_config_file();
8208
8224
  function envFlag(name) {
8209
- const v3 = process.env[name];
8210
- return v3 === "1" || v3 === "true";
8225
+ const v2 = process.env[name];
8226
+ return v2 === "1" || v2 === "true";
8211
8227
  }
8212
8228
  function isTelemetryEnabled() {
8213
8229
  if (envFlag("DO_NOT_TRACK")) return false;
@@ -8283,7 +8299,7 @@ async function createEmitter(opts) {
8283
8299
  }
8284
8300
  }
8285
8301
  };
8286
- const { elb } = await En(collectorConfig);
8302
+ const { elb } = await qn2(collectorConfig);
8287
8303
  elbFn = elb;
8288
8304
  return elbFn;
8289
8305
  }
@@ -8695,7 +8711,7 @@ function defaultPushError(error, startTime) {
8695
8711
  error: getErrorMessage(error)
8696
8712
  };
8697
8713
  }
8698
- async function withFlowContext(options, fn2, onError) {
8714
+ async function withFlowContext(options, fn3, onError) {
8699
8715
  const {
8700
8716
  esmPath,
8701
8717
  platform,
@@ -8770,7 +8786,7 @@ async function withFlowContext(options, fn2, onError) {
8770
8786
  const stopPump = drainPump ? startDrainPump(timerControl.pending) : null;
8771
8787
  let result;
8772
8788
  try {
8773
- result = await fn2(flowModule);
8789
+ result = await fn3(flowModule);
8774
8790
  } finally {
8775
8791
  if (stopPump) stopPump();
8776
8792
  }
@@ -8783,9 +8799,9 @@ async function withFlowContext(options, fn2, onError) {
8783
8799
  timeout
8784
8800
  );
8785
8801
  });
8786
- return await Promise.race([fn2(flowModule), timeoutPromise]);
8802
+ return await Promise.race([fn3(flowModule), timeoutPromise]);
8787
8803
  }
8788
- return await fn2(flowModule);
8804
+ return await fn3(flowModule);
8789
8805
  } catch (error) {
8790
8806
  return (onError ?? defaultPushError)(error, startTime);
8791
8807
  } finally {
@@ -8818,13 +8834,13 @@ function applyNetworkPolyfills(dom, networkCalls) {
8818
8834
  const headers = {};
8819
8835
  if (init?.headers) {
8820
8836
  if (init.headers instanceof Headers) {
8821
- init.headers.forEach((v3, k3) => {
8822
- headers[k3] = v3;
8837
+ init.headers.forEach((v2, k3) => {
8838
+ headers[k3] = v2;
8823
8839
  });
8824
8840
  } else if (typeof init.headers === "object") {
8825
8841
  Object.entries(init.headers).forEach(
8826
- ([k3, v3]) => {
8827
- headers[k3] = v3;
8842
+ ([k3, v2]) => {
8843
+ headers[k3] = v2;
8828
8844
  }
8829
8845
  );
8830
8846
  }
@@ -9155,7 +9171,7 @@ function resolveBeforeChain(before, transformers, ingest, event) {
9155
9171
  if (Array.isArray(before) && before.every(isString)) {
9156
9172
  return before;
9157
9173
  }
9158
- const ids = zn(before, Xn(ingest, event));
9174
+ const ids = Un(before, tr(ingest, event));
9159
9175
  if (ids.length === 0) return [];
9160
9176
  if (ids.length === 1) return walkStaticChain(ids[0], transformers);
9161
9177
  return ids;
@@ -9468,7 +9484,7 @@ async function simulateSource(configOrPath, input, options) {
9468
9484
  const captured = [];
9469
9485
  flowConfig.hooks = {
9470
9486
  ...flowConfig.hooks || {},
9471
- prePush: ({ fn: fn2 }, event) => {
9487
+ prePush: ({ fn: fn3 }, event) => {
9472
9488
  captured.push({ event, timestamp: Date.now() });
9473
9489
  return { ok: true };
9474
9490
  }
@@ -9584,7 +9600,7 @@ async function simulateTransformer(configOrPath, event, options) {
9584
9600
  `Transformer "${options.transformerId}" not found in collector. Available: ${Object.keys(collector.transformers || {}).join(", ") || "none"}`
9585
9601
  );
9586
9602
  }
9587
- const initialized = await Re2(
9603
+ const initialized = await He(
9588
9604
  collector,
9589
9605
  transformer,
9590
9606
  options.transformerId
@@ -9596,7 +9612,7 @@ async function simulateTransformer(configOrPath, event, options) {
9596
9612
  }
9597
9613
  const inputEvent = event;
9598
9614
  const ingest = {
9599
- ...I(options.transformerId),
9615
+ ...O(options.transformerId),
9600
9616
  ...options.ingest
9601
9617
  };
9602
9618
  const captured = [];
@@ -9611,7 +9627,7 @@ async function simulateTransformer(configOrPath, event, options) {
9611
9627
  processedEvent
9612
9628
  );
9613
9629
  if (beforeChainIds.length > 0) {
9614
- const beforeResult = await We2(
9630
+ const beforeResult = await Le(
9615
9631
  collector,
9616
9632
  collector.transformers,
9617
9633
  beforeChainIds,
@@ -9633,7 +9649,7 @@ async function simulateTransformer(configOrPath, event, options) {
9633
9649
  processedEvent = Array.isArray(beforeResult) ? beforeResult[0] : beforeResult;
9634
9650
  }
9635
9651
  }
9636
- const pushResult = await He(
9652
+ const pushResult = await Ge2(
9637
9653
  collector,
9638
9654
  transformer,
9639
9655
  options.transformerId,
@@ -9756,7 +9772,7 @@ async function simulateCollector(configOrPath, event, options) {
9756
9772
  if (options.state.timing !== void 0)
9757
9773
  collector.timing = options.state.timing;
9758
9774
  }
9759
- const enriched = Yt(collector, event);
9775
+ const enriched = Jt(collector, event);
9760
9776
  const captured = [{ event: enriched, timestamp: Date.now() }];
9761
9777
  await collector.command("shutdown");
9762
9778
  return buildSimulationResult({
@@ -9862,7 +9878,7 @@ async function simulateDestination(configOrPath, event, options) {
9862
9878
  ...devEnv.push,
9863
9879
  simulation: devEnv.simulation
9864
9880
  };
9865
- const { wrappedEnv, calls } = K2(combined);
9881
+ const { wrappedEnv, calls } = K(combined);
9866
9882
  if (destConfig) destConfig.env = wrappedEnv;
9867
9883
  trackedCalls = calls;
9868
9884
  }
@@ -10606,7 +10622,7 @@ function readGrantHeader(req) {
10606
10622
  return "";
10607
10623
  }
10608
10624
  function guardPreviewIntake(req, res, gate, logger, onPass) {
10609
- It(readGrantHeader(req), {
10625
+ Ot(readGrantHeader(req), {
10610
10626
  keyring: gate.keyring,
10611
10627
  iss: gate.iss,
10612
10628
  pb: gate.pb,
@@ -10803,9 +10819,9 @@ var ErrorRing = class {
10803
10819
  if (this.map.size >= this.maxUnique) {
10804
10820
  let oldestKey;
10805
10821
  let oldest = Infinity;
10806
- for (const [k3, v3] of this.map) {
10807
- if (v3.lastSeen < oldest) {
10808
- oldest = v3.lastSeen;
10822
+ for (const [k3, v2] of this.map) {
10823
+ if (v2.lastSeen < oldest) {
10824
+ oldest = v2.lastSeen;
10809
10825
  oldestKey = k3;
10810
10826
  }
10811
10827
  }
@@ -11028,9 +11044,9 @@ function createTracePoller(config, logger) {
11028
11044
  if (!("traceUntil" in parsed)) return;
11029
11045
  const value = parsed.traceUntil;
11030
11046
  if (typeof value === "string" && value.length > 0) {
11031
- rn(value);
11047
+ an(value);
11032
11048
  } else if (value === null) {
11033
- rn(null);
11049
+ an(null);
11034
11050
  }
11035
11051
  } finally {
11036
11052
  inFlight = false;
@@ -11457,12 +11473,12 @@ function buildTelemetryObservers(flowId, observeLevel) {
11457
11473
  const deploymentId = process.env.WALKEROS_DEPLOYMENT_ID;
11458
11474
  if (!base || !token || !deploymentId) return void 0;
11459
11475
  const url = `${base}/ingest/${deploymentId}`;
11460
- const emit = sn({ url, token });
11476
+ const emit = fn({ url, token });
11461
11477
  const observe = observeLevel !== void 0 ? { level: observeLevel } : void 0;
11462
11478
  return [
11463
- vt(
11479
+ ht(
11464
11480
  emit,
11465
- () => bt({ flowId, observe, traceUntil: nn() })
11481
+ () => bt({ flowId, observe, traceUntil: sn() })
11466
11482
  )
11467
11483
  ];
11468
11484
  }
@@ -11472,7 +11488,7 @@ function buildObserveLevelSupplier(flowId, observeLevel) {
11472
11488
  const opts = bt({
11473
11489
  flowId,
11474
11490
  observe,
11475
- traceUntil: nn()
11491
+ traceUntil: sn()
11476
11492
  });
11477
11493
  return opts ? opts.level ?? "standard" : "off";
11478
11494
  };
@@ -11821,12 +11837,12 @@ function resolveEnvMarkers(value) {
11821
11837
  return resolveEnvMarkersInString(value);
11822
11838
  }
11823
11839
  if (Array.isArray(value)) {
11824
- return value.map((v3) => resolveEnvMarkers(v3));
11840
+ return value.map((v2) => resolveEnvMarkers(v2));
11825
11841
  }
11826
11842
  if (value !== null && typeof value === "object") {
11827
11843
  const out = {};
11828
- for (const [k3, v3] of Object.entries(value)) {
11829
- out[k3] = resolveEnvMarkers(v3);
11844
+ for (const [k3, v2] of Object.entries(value)) {
11845
+ out[k3] = resolveEnvMarkers(v2);
11830
11846
  }
11831
11847
  return out;
11832
11848
  }
@@ -13347,7 +13363,7 @@ function validateFlow(input, options = {}) {
13347
13363
  transformersValue
13348
13364
  )) {
13349
13365
  if (!de(transformerValue)) continue;
13350
- const result = ur(transformerValue, "Transformer");
13366
+ const result = pr(transformerValue, "Transformer");
13351
13367
  if (!result.ok) {
13352
13368
  errors.push({
13353
13369
  path: `flows.${flowName}.transformers.${name}`,
@@ -13808,7 +13824,7 @@ function validateMapping(input) {
13808
13824
  // src/commands/validate/validators/entry.ts
13809
13825
  init_dist();
13810
13826
  import Ajv from "ajv";
13811
- var CLIENT_HEADER = "walkeros-cli/4.3.2";
13827
+ var CLIENT_HEADER = "walkeros-cli/4.4.0-next-1785239495233";
13812
13828
  var SECTIONS = ["destinations", "sources", "transformers"];
13813
13829
  function resolveEntry(path19, flowConfig) {
13814
13830
  const flows = flowConfig.flows;
@@ -13884,7 +13900,7 @@ async function validateEntry(path19, flowConfig) {
13884
13900
  }
13885
13901
  let schemas;
13886
13902
  try {
13887
- const info = await wn(packageName, {
13903
+ const info = await An(packageName, {
13888
13904
  client: CLIENT_HEADER
13889
13905
  });
13890
13906
  schemas = info.schemas;
@@ -14145,8 +14161,8 @@ async function loginCommand(options) {
14145
14161
  }
14146
14162
  async function requestDeviceCode(options = {}) {
14147
14163
  const appUrl = options.url || resolveAppUrl();
14148
- const f3 = options.fetch ?? globalThis.fetch;
14149
- const response = await f3(`${appUrl}/api/auth/device/code`, {
14164
+ const f2 = options.fetch ?? globalThis.fetch;
14165
+ const response = await f2(`${appUrl}/api/auth/device/code`, {
14150
14166
  method: "POST",
14151
14167
  headers: { "Content-Type": "application/json" },
14152
14168
  body: JSON.stringify({})
@@ -14175,7 +14191,7 @@ async function requestDeviceCode(options = {}) {
14175
14191
  }
14176
14192
  async function pollForToken(deviceCode, options = {}) {
14177
14193
  const appUrl = options.url || resolveAppUrl();
14178
- const f3 = options.fetch ?? globalThis.fetch;
14194
+ const f2 = options.fetch ?? globalThis.fetch;
14179
14195
  const timeoutMs = options.timeoutMs ?? DEFAULT_POLL_TIMEOUT_MS;
14180
14196
  let intervalMs = options.intervalMs ?? DEFAULT_POLL_INTERVAL_MS;
14181
14197
  const deadline = Date.now() + timeoutMs;
@@ -14187,7 +14203,7 @@ async function pollForToken(deviceCode, options = {}) {
14187
14203
  const timeoutHandle = setTimeout(() => controller.abort(), remaining);
14188
14204
  let tokenResponse;
14189
14205
  try {
14190
- tokenResponse = await f3(`${appUrl}/api/auth/device/token`, {
14206
+ tokenResponse = await f2(`${appUrl}/api/auth/device/token`, {
14191
14207
  method: "POST",
14192
14208
  headers: { "Content-Type": "application/json" },
14193
14209
  body: JSON.stringify({ deviceCode, hostname: hostname() }),
@@ -14299,7 +14315,7 @@ async function login(options = {}) {
14299
14315
  const intervalMs = (interval ?? 5) * 1e3;
14300
14316
  if (options.maxPollAttempts !== void 0) {
14301
14317
  const appUrl = urlOption || resolveAppUrl();
14302
- const f3 = fetchOption;
14318
+ const f2 = fetchOption;
14303
14319
  let pollInterval = intervalMs;
14304
14320
  let attempts = 0;
14305
14321
  const deadline = Date.now() + timeoutMs;
@@ -14311,7 +14327,7 @@ async function login(options = {}) {
14311
14327
  const timeoutHandle = setTimeout(() => controller.abort(), remaining);
14312
14328
  let tokenResponse;
14313
14329
  try {
14314
- tokenResponse = await f3(`${appUrl}/api/auth/device/token`, {
14330
+ tokenResponse = await f2(`${appUrl}/api/auth/device/token`, {
14315
14331
  method: "POST",
14316
14332
  headers: { "Content-Type": "application/json" },
14317
14333
  body: JSON.stringify({ deviceCode, hostname: hostname() }),
@@ -14719,9 +14735,9 @@ async function deleteDeployment(options) {
14719
14735
  const data = await response.json().catch(() => null);
14720
14736
  return data ?? { success: true };
14721
14737
  }
14722
- async function handleResult3(fn2, options) {
14738
+ async function handleResult3(fn3, options) {
14723
14739
  try {
14724
- const result = await fn2();
14740
+ const result = await fn3();
14725
14741
  await writeResult(JSON.stringify(result, null, 2), options);
14726
14742
  } catch (error) {
14727
14743
  handleCliError(error);