@walkeros/cli 4.3.0 → 4.3.1-next-1784373088875
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/CHANGELOG.md +23 -0
- package/dist/cli.js +1201 -879
- package/dist/index.d.ts +20 -2
- package/dist/index.js +54 -5
- package/dist/index.js.map +1 -1
- package/package.json +8 -8
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 = (
|
|
5
|
-
return
|
|
4
|
+
var __esm = (fn2, res) => function __init() {
|
|
5
|
+
return fn2 && (res = (0, fn2[__getOwnPropNames(fn2)[0]])(fn2 = 0)), res;
|
|
6
6
|
};
|
|
7
7
|
var __export = (target, all) => {
|
|
8
8
|
for (var name in all)
|
|
@@ -168,7 +168,7 @@ function w(e4, t4) {
|
|
|
168
168
|
async function k(e4, t4) {
|
|
169
169
|
return await e4.get(t4);
|
|
170
170
|
}
|
|
171
|
-
function
|
|
171
|
+
function I(e4) {
|
|
172
172
|
return { _meta: { hops: 0, path: [e4] } };
|
|
173
173
|
}
|
|
174
174
|
function M(e4) {
|
|
@@ -225,7 +225,7 @@ function C(e4, t4) {
|
|
|
225
225
|
const e5 = {};
|
|
226
226
|
for (const [t6, n6] of Object.entries(a4.events)) {
|
|
227
227
|
e5[t6] = {};
|
|
228
|
-
for (const [r7, o5] of Object.entries(n6)) e5[t6][r7] =
|
|
228
|
+
for (const [r7, o5] of Object.entries(n6)) e5[t6][r7] = R(o5);
|
|
229
229
|
}
|
|
230
230
|
a4.events = e5;
|
|
231
231
|
}
|
|
@@ -238,16 +238,16 @@ function P(e4, t4) {
|
|
|
238
238
|
const n5 = { ...e4 };
|
|
239
239
|
for (const r6 of Object.keys(t4)) {
|
|
240
240
|
const o4 = e4[r6], s4 = t4[r6];
|
|
241
|
-
"required" === r6 && Array.isArray(o4) && Array.isArray(s4) ? n5[r6] = [.../* @__PURE__ */ new Set([...o4, ...s4])] :
|
|
241
|
+
"required" === r6 && Array.isArray(o4) && Array.isArray(s4) ? n5[r6] = [.../* @__PURE__ */ new Set([...o4, ...s4])] : z(o4) && z(s4) ? n5[r6] = P(o4, s4) : n5[r6] = s4;
|
|
242
242
|
}
|
|
243
243
|
return n5;
|
|
244
244
|
}
|
|
245
|
-
function
|
|
245
|
+
function R(e4) {
|
|
246
246
|
const t4 = {};
|
|
247
|
-
for (const [n5, r6] of Object.entries(e4)) T.has(n5) || (null === r6 || "object" != typeof r6 || Array.isArray(r6) ? t4[n5] = r6 : t4[n5] =
|
|
247
|
+
for (const [n5, r6] of Object.entries(e4)) T.has(n5) || (null === r6 || "object" != typeof r6 || Array.isArray(r6) ? t4[n5] = r6 : t4[n5] = R(r6));
|
|
248
248
|
return t4;
|
|
249
249
|
}
|
|
250
|
-
function
|
|
250
|
+
function z(e4) {
|
|
251
251
|
return "object" == typeof e4 && null !== e4 && !Array.isArray(e4);
|
|
252
252
|
}
|
|
253
253
|
function H(...e4) {
|
|
@@ -255,12 +255,12 @@ function H(...e4) {
|
|
|
255
255
|
for (const n5 of e4) n5 && Object.assign(t4, n5);
|
|
256
256
|
return t4;
|
|
257
257
|
}
|
|
258
|
-
function
|
|
258
|
+
function Y(e4, t4, n5) {
|
|
259
259
|
const r6 = `$flow.${e4}${t4 ? `.${t4}` : ""}`;
|
|
260
260
|
if ("unknown-flow" === n5) return `${r6} cannot resolve: flow "${e4}" does not exist in this config.`;
|
|
261
261
|
return `${r6} is empty. Set ${t4 ? `flows.${e4}.config.${t4}` : `flows.${e4}.config`}, or run \`walkeros deploy ${e4}\` first.`;
|
|
262
262
|
}
|
|
263
|
-
function
|
|
263
|
+
function X(e4, t4, n5) {
|
|
264
264
|
const r6 = t4.split(".");
|
|
265
265
|
let o4 = e4;
|
|
266
266
|
for (let e5 = 0; e5 < r6.length; e5++) {
|
|
@@ -280,7 +280,7 @@ function Y(e4, t4, n5) {
|
|
|
280
280
|
}
|
|
281
281
|
function Q(e4, t4, n5, r6, o4, s4) {
|
|
282
282
|
if ("string" == typeof e4) {
|
|
283
|
-
const i5 = e4.match(
|
|
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
286
|
void 0 === t4[a5] && M(`Variable "${a5}" not found`);
|
|
@@ -295,42 +295,42 @@ function Q(e4, t4, n5, r6, o4, s4) {
|
|
|
295
295
|
} finally {
|
|
296
296
|
u3.delete(a5);
|
|
297
297
|
}
|
|
298
|
-
return c3 && (f4 =
|
|
298
|
+
return c3 && (f4 = X(f4, c3, `$var.${a5}`)), f4;
|
|
299
299
|
}
|
|
300
|
-
const a4 = e4.match(
|
|
300
|
+
const a4 = e4.match(L);
|
|
301
301
|
if (a4 && r6) {
|
|
302
302
|
const e5 = a4[1], t5 = a4[2];
|
|
303
303
|
e5 in r6 || M(`Contract "${e5}" not found`);
|
|
304
304
|
let n6 = r6[e5];
|
|
305
|
-
return t5 && (n6 =
|
|
305
|
+
return t5 && (n6 = X(n6, t5, `$contract.${e5}`)), n6;
|
|
306
306
|
}
|
|
307
|
-
const c2 = e4.match(
|
|
307
|
+
const c2 = e4.match(K);
|
|
308
308
|
if (c2) {
|
|
309
309
|
const t5 = c2[1], r7 = c2[2], s5 = false === n5?.strictFlowRefs;
|
|
310
310
|
o4 || M(`$flow.${t5}${r7 ? `.${r7}` : ""} cannot be resolved without a flow resolver`);
|
|
311
311
|
const i6 = o4(t5);
|
|
312
312
|
if (!i6) {
|
|
313
|
-
if (s5) return n5?.onWarning?.(
|
|
313
|
+
if (s5) return n5?.onWarning?.(Y(t5, r7, "unknown-flow")), e4;
|
|
314
314
|
M(`Flow "${t5}" not found in $flow.${t5}`);
|
|
315
315
|
}
|
|
316
316
|
let a5 = i6;
|
|
317
317
|
if (r7) if (s5) {
|
|
318
318
|
try {
|
|
319
|
-
a5 =
|
|
319
|
+
a5 = X(a5, r7, `$flow.${t5}`);
|
|
320
320
|
} catch {
|
|
321
|
-
return n5?.onWarning?.(
|
|
321
|
+
return n5?.onWarning?.(Y(t5, r7, "missing-key")), e4;
|
|
322
322
|
}
|
|
323
|
-
if (null == a5 || "" === a5) return n5?.onWarning?.(
|
|
324
|
-
} else a5 =
|
|
323
|
+
if (null == a5 || "" === a5) return n5?.onWarning?.(Y(t5, r7, "missing-key")), e4;
|
|
324
|
+
} else a5 = X(a5, r7, `$flow.${t5}`);
|
|
325
325
|
return a5;
|
|
326
326
|
}
|
|
327
|
-
const u2 = e4.match(
|
|
327
|
+
const u2 = e4.match(q);
|
|
328
328
|
if (u2) {
|
|
329
329
|
const e5 = u2[1];
|
|
330
330
|
if (n5?.deferred) return `${G}${e5}`;
|
|
331
331
|
M(`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(
|
|
333
|
+
let f3 = e4.replace(F, (e5, i6) => {
|
|
334
334
|
const a5 = i6.split("."), c3 = a5[0], u3 = a5.slice(1).join(".");
|
|
335
335
|
void 0 === t4[c3] && M(`Variable "${c3}" not found`);
|
|
336
336
|
const f4 = s4 ?? /* @__PURE__ */ new Set();
|
|
@@ -344,12 +344,12 @@ function Q(e4, t4, n5, r6, o4, s4) {
|
|
|
344
344
|
} finally {
|
|
345
345
|
f4.delete(c3);
|
|
346
346
|
}
|
|
347
|
-
if (u3 && (l3 =
|
|
347
|
+
if (u3 && (l3 = X(l3, u3, `$var.${c3}`)), null === l3 || "string" != typeof l3 && "number" != typeof l3 && "boolean" != typeof l3) {
|
|
348
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}"`);
|
|
349
349
|
}
|
|
350
350
|
return String(l3);
|
|
351
351
|
});
|
|
352
|
-
return f3 = f3.replace(
|
|
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;
|
|
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) {
|
|
@@ -549,14 +549,14 @@ function $e(e4, t4) {
|
|
|
549
549
|
}
|
|
550
550
|
return n5;
|
|
551
551
|
}
|
|
552
|
-
function
|
|
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
|
|
559
|
+
function Ee(e4 = 6, t4 = "0123456789abcdefghijklmnopqrstuvwxyz") {
|
|
560
560
|
const n5 = t4.length;
|
|
561
561
|
if (e4 <= 0 || 0 === n5) return "";
|
|
562
562
|
let r6 = "";
|
|
@@ -580,8 +580,8 @@ function Oe(e4) {
|
|
|
580
580
|
return false;
|
|
581
581
|
}
|
|
582
582
|
function _e(e4) {
|
|
583
|
-
let t4 =
|
|
584
|
-
for (; /^0+$/.test(t4); ) t4 =
|
|
583
|
+
let t4 = Ee(e4, Ie);
|
|
584
|
+
for (; /^0+$/.test(t4); ) t4 = Ee(e4, Ie);
|
|
585
585
|
return t4;
|
|
586
586
|
}
|
|
587
587
|
function Ne() {
|
|
@@ -590,18 +590,18 @@ function Ne() {
|
|
|
590
590
|
function Ce() {
|
|
591
591
|
return _e(32);
|
|
592
592
|
}
|
|
593
|
-
function
|
|
593
|
+
function Re(e4) {
|
|
594
594
|
if ("string" != typeof e4) return;
|
|
595
595
|
const t4 = Pe.exec(e4)?.groups;
|
|
596
596
|
if (!t4) return;
|
|
597
597
|
const { version: n5, trace: r6, span: o4 } = t4;
|
|
598
598
|
return void 0 === n5 || void 0 === r6 || void 0 === o4 || "ff" === n5 || /^0+$/.test(r6) || /^0+$/.test(o4) ? void 0 : { trace: r6, parentSpan: o4 };
|
|
599
599
|
}
|
|
600
|
-
function
|
|
600
|
+
function Fe(e4, t4) {
|
|
601
601
|
return "number" == typeof e4 ? { wait: e4 } : e4 ? { wait: e4.wait ?? t4, size: e4.size, age: e4.age } : { wait: t4 };
|
|
602
602
|
}
|
|
603
|
-
function
|
|
604
|
-
const { wait: r6, size: o4, age: s4 } =
|
|
603
|
+
function Ue(e4, t4 = 1e3, n5 = false) {
|
|
604
|
+
const { wait: r6, size: o4, age: s4 } = Fe(t4, 1e3);
|
|
605
605
|
let i5, a4, c2 = null, u2 = null, f3 = false, l3 = [], p3 = 0;
|
|
606
606
|
const d2 = () => {
|
|
607
607
|
c2 && (clearTimeout(c2), c2 = null), u2 && (clearTimeout(u2), u2 = null), p3 = 0, a4 = void 0;
|
|
@@ -629,31 +629,31 @@ function De(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
|
|
632
|
+
function Ke(e4) {
|
|
633
633
|
return { message: e4.message, name: e4.name, stack: e4.stack, cause: e4.cause };
|
|
634
634
|
}
|
|
635
|
-
function
|
|
635
|
+
function We(e4, t4) {
|
|
636
636
|
let n5, r6 = {};
|
|
637
|
-
return e4 instanceof Error ? (n5 = e4.message, r6.error =
|
|
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 };
|
|
638
638
|
}
|
|
639
|
-
function
|
|
640
|
-
return
|
|
639
|
+
function Be(e4 = {}) {
|
|
640
|
+
return Ze({ level: void 0 !== e4.level ? (function(e5) {
|
|
641
641
|
return "string" == typeof e5 ? l[e5] : e5;
|
|
642
642
|
})(e4.level) : 0, handler: e4.handler, jsonHandler: e4.jsonHandler, scope: [] });
|
|
643
643
|
}
|
|
644
|
-
function
|
|
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 =
|
|
648
|
-
n5 ? n5(e5, t5.message, t5.context, o4,
|
|
647
|
+
const t5 = We(r7, s5);
|
|
648
|
+
n5 ? n5(e5, t5.message, t5.context, o4, qe) : qe(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 =
|
|
653
|
-
throw n5 ? n5(0, r7.message, r7.context, o4,
|
|
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);
|
|
654
654
|
}, json: (e5) => {
|
|
655
655
|
r6 ? r6(e5) : console.log(JSON.stringify(e5, null, 2));
|
|
656
|
-
}, scope: (e5) =>
|
|
656
|
+
}, scope: (e5) => Ze({ level: t4, handler: n5, jsonHandler: r6, scope: [...o4, e5] }) };
|
|
657
657
|
}
|
|
658
658
|
function Ve(e4) {
|
|
659
659
|
return ae(e4) || ge(e4) || pe(e4) || !ue(e4) || ie(e4) && e4.every(Ve) || de(e4) && Object.values(e4).every(Ve);
|
|
@@ -673,7 +673,7 @@ function Ge(e4, t4, n5) {
|
|
|
673
673
|
}
|
|
674
674
|
};
|
|
675
675
|
}
|
|
676
|
-
function
|
|
676
|
+
function Ye(e4, t4, n5) {
|
|
677
677
|
return async function(...r6) {
|
|
678
678
|
try {
|
|
679
679
|
return await e4(...r6);
|
|
@@ -708,8 +708,8 @@ async function et(e4, t4 = {}, n5 = {}) {
|
|
|
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];
|
|
710
710
|
for (const t5 of i5) {
|
|
711
|
-
const r7 = await
|
|
712
|
-
if (e5 instanceof
|
|
711
|
+
const r7 = await Ye(tt, (e5) => {
|
|
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
715
|
if (ue(r7)) return r7;
|
|
@@ -722,14 +722,14 @@ async function tt(e4, t4, n5) {
|
|
|
722
722
|
const s4 = ge(r6) ? { key: r6 } : r6;
|
|
723
723
|
if (!Object.keys(s4).length) return;
|
|
724
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 };
|
|
725
|
-
if (i5 && !await
|
|
726
|
-
if (e5 instanceof
|
|
725
|
+
if (i5 && !await Ye(i5, (e5) => {
|
|
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 && !
|
|
729
|
+
if (a4 && !Se(a4, g3.consent)) return m3;
|
|
730
730
|
let h2 = ue(m3) ? m3 : e4;
|
|
731
|
-
if (c2 && (h2 = await
|
|
732
|
-
if (e5 instanceof
|
|
731
|
+
if (c2 && (h2 = await Ye(c2, (e5) => {
|
|
732
|
+
if (e5 instanceof Xe) throw e5;
|
|
733
733
|
g3.logger.error("mapping fn failed", { event: g3.event, error: e5 });
|
|
734
734
|
})(e4, g3)), u2 && (h2 = ve(e4, u2, m3)), f3) {
|
|
735
735
|
const [t6, n6] = f3, r7 = "this" === t6 ? [e4] : await et(e4, t6, g3);
|
|
@@ -738,8 +738,8 @@ async function tt(e4, t4, n5) {
|
|
|
738
738
|
const o5 = await t6, s5 = await et(e4, r7, g3);
|
|
739
739
|
return ue(s5) && (o5[n6] = s5), o5;
|
|
740
740
|
}, Promise.resolve({})) : p3 && (h2 = await Promise.all(p3.map((t6) => tt(e4, t6, g3))));
|
|
741
|
-
d2 && !await
|
|
742
|
-
if (e5 instanceof
|
|
741
|
+
d2 && !await Ye(d2, (e5) => {
|
|
742
|
+
if (e5 instanceof Xe) throw e5;
|
|
743
743
|
return g3.logger.error("mapping validate failed", { event: g3.event, error: e5 }), false;
|
|
744
744
|
})(h2, g3) && (h2 = void 0);
|
|
745
745
|
const v3 = Je(h2);
|
|
@@ -873,28 +873,28 @@ function At(e4) {
|
|
|
873
873
|
return null;
|
|
874
874
|
}
|
|
875
875
|
}
|
|
876
|
-
function
|
|
876
|
+
function St(e4) {
|
|
877
877
|
return "object" == typeof e4 && null !== e4 && !Array.isArray(e4);
|
|
878
878
|
}
|
|
879
|
-
function
|
|
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 (!
|
|
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 (!
|
|
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
893
|
const u2 = kt(o4);
|
|
894
894
|
return u2 && 64 === u2.byteLength ? { grant: c2, kid: i5, signed: $t(`${n5}.${r6}`), signature: u2 } : null;
|
|
895
895
|
}
|
|
896
|
-
async function
|
|
897
|
-
const n5 =
|
|
896
|
+
async function It(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" };
|
|
@@ -930,13 +930,13 @@ async function Et(e4, t4) {
|
|
|
930
930
|
}
|
|
931
931
|
return { ok: true, grant: r6 };
|
|
932
932
|
}
|
|
933
|
-
function
|
|
934
|
-
return
|
|
933
|
+
function nn() {
|
|
934
|
+
return tn;
|
|
935
935
|
}
|
|
936
|
-
function
|
|
937
|
-
|
|
936
|
+
function rn(e4) {
|
|
937
|
+
tn = e4;
|
|
938
938
|
}
|
|
939
|
-
function
|
|
939
|
+
function on(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,32 +944,32 @@ function rn(e4, t4) {
|
|
|
944
944
|
} catch {
|
|
945
945
|
}
|
|
946
946
|
}
|
|
947
|
-
function
|
|
947
|
+
function sn(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
949
|
});
|
|
950
950
|
let u2 = [], f3 = null, l3 = 0;
|
|
951
951
|
function p3(e5) {
|
|
952
|
-
const t5 = JSON.stringify(
|
|
953
|
-
if (e5.length <= 1) return [
|
|
952
|
+
const t5 = { v: 1, records: e5 }, n6 = JSON.stringify(t5);
|
|
953
|
+
if (e5.length <= 1) return [n6];
|
|
954
954
|
if ((function(e6) {
|
|
955
955
|
let t6 = 0;
|
|
956
956
|
for (let n7 = 0; n7 < e6.length; n7++) {
|
|
957
|
-
const
|
|
958
|
-
if (
|
|
959
|
-
else if (
|
|
960
|
-
else if (
|
|
961
|
-
const
|
|
962
|
-
|
|
957
|
+
const r8 = e6.charCodeAt(n7);
|
|
958
|
+
if (r8 < 128) t6 += 1;
|
|
959
|
+
else if (r8 < 2048) t6 += 2;
|
|
960
|
+
else if (r8 >= 55296 && r8 <= 56319 && n7 + 1 < e6.length) {
|
|
961
|
+
const r9 = e6.charCodeAt(n7 + 1);
|
|
962
|
+
r9 >= 56320 && r9 <= 57343 ? (t6 += 4, n7++) : t6 += 3;
|
|
963
963
|
} else t6 += 3;
|
|
964
964
|
}
|
|
965
965
|
return t6;
|
|
966
|
-
})(
|
|
967
|
-
const
|
|
968
|
-
return [...p3(e5.slice(0,
|
|
966
|
+
})(n6) <= i5) return [n6];
|
|
967
|
+
const r7 = Math.floor(e5.length / 2);
|
|
968
|
+
return [...p3(e5.slice(0, r7)), ...p3(e5.slice(r7))];
|
|
969
969
|
}
|
|
970
970
|
function d2(t5) {
|
|
971
|
-
return Promise.resolve().then(() => a4(e4.url, { method: "POST", headers: { "Content-Type": "application/json", Authorization: `Bearer ${e4.token}` }, body: t5 })).then((
|
|
972
|
-
|
|
971
|
+
return Promise.resolve().then(() => a4(e4.url, { method: "POST", headers: { ...e4.headers, "Content-Type": "application/json", Authorization: `Bearer ${e4.token}` }, body: t5 })).then((t6) => {
|
|
972
|
+
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}`));
|
|
973
973
|
}).catch((e5) => {
|
|
974
974
|
c2(e5);
|
|
975
975
|
});
|
|
@@ -987,10 +987,10 @@ function on(e4) {
|
|
|
987
987
|
u2.push({ ...e5, seq: ++l3 }), u2.length >= o4 ? m3() : null === f3 && (f3 = setTimeout(m3, n5));
|
|
988
988
|
};
|
|
989
989
|
}
|
|
990
|
-
function
|
|
990
|
+
function vn(e4) {
|
|
991
991
|
return "string" == typeof e4 || Array.isArray(e4) && e4.every((e5) => "string" == typeof e5) ? e4 : void 0;
|
|
992
992
|
}
|
|
993
|
-
async function
|
|
993
|
+
async function yn(e4, t4) {
|
|
994
994
|
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;
|
|
995
995
|
try {
|
|
996
996
|
if (t4?.baseUrl) {
|
|
@@ -1001,7 +1001,7 @@ async function vn(e4, t4) {
|
|
|
1001
1001
|
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 };
|
|
1002
1002
|
})(e4, n5, await o6.json());
|
|
1003
1003
|
}
|
|
1004
|
-
const r7 = `https://cdn.jsdelivr.net/npm/${e4}@${n5}`, o5 = await
|
|
1004
|
+
const r7 = `https://cdn.jsdelivr.net/npm/${e4}@${n5}`, o5 = await bn(`${r7}/package.json`, i5, a4);
|
|
1005
1005
|
return (function(e5, t5, n6, r8) {
|
|
1006
1006
|
const o6 = r8.$meta || {}, s5 = r8.schemas || {}, i6 = r8.examples || {}, a5 = r8.hints, c2 = a5 ? Object.keys(a5) : [], u2 = [], f3 = i6.step || {};
|
|
1007
1007
|
for (const [e6, t6] of Object.entries(f3)) {
|
|
@@ -1009,33 +1009,38 @@ async function vn(e4, t4) {
|
|
|
1009
1009
|
"string" == typeof n7?.description && (r9.description = n7.description), u2.push(r9);
|
|
1010
1010
|
}
|
|
1011
1011
|
const l3 = "string" == typeof o6.docs ? o6.docs : void 0, p3 = "string" == typeof o6.source ? o6.source : void 0;
|
|
1012
|
-
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:
|
|
1013
|
-
})(e4, n5, o5, await
|
|
1012
|
+
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 };
|
|
1013
|
+
})(e4, n5, o5, await bn(`${r7}/dist/walkerOS.json`, i5, a4));
|
|
1014
1014
|
} finally {
|
|
1015
1015
|
clearTimeout(s4);
|
|
1016
1016
|
}
|
|
1017
1017
|
}
|
|
1018
|
-
async function
|
|
1018
|
+
async function bn(e4, t4, n5) {
|
|
1019
1019
|
const r6 = await fetch(e4, { signal: t4, ...n5 && { headers: n5 } });
|
|
1020
1020
|
if (!r6.ok) throw new Error(`Failed to fetch ${e4} (HTTP ${r6.status})`);
|
|
1021
1021
|
return await r6.json();
|
|
1022
1022
|
}
|
|
1023
|
-
async function
|
|
1024
|
-
const n5 = await
|
|
1023
|
+
async function wn(e4, t4) {
|
|
1024
|
+
const n5 = await yn(e4, t4);
|
|
1025
1025
|
return { packageName: n5.packageName, version: n5.version, type: n5.type, platform: n5.platform, schemas: n5.schemas, examples: n5.examples, ...n5.hints ? { hints: n5.hints } : {} };
|
|
1026
1026
|
}
|
|
1027
|
-
function
|
|
1028
|
-
const t4 = (e4.startsWith(
|
|
1027
|
+
function Sn(e4) {
|
|
1028
|
+
const t4 = (e4.startsWith(An) ? e4.slice(5) : e4).split(".");
|
|
1029
1029
|
return t4.some((e5) => "" === e5) ? [] : t4;
|
|
1030
1030
|
}
|
|
1031
|
-
function
|
|
1031
|
+
function xn(e4) {
|
|
1032
|
+
if (!e4.startsWith(jn)) return null;
|
|
1033
|
+
const t4 = e4.slice(5).split("."), [n5, r6, o4] = t4;
|
|
1034
|
+
return 3 === t4.length && n5 && r6 && o4 ? { pb: n5, ses: r6, secret: o4 } : null;
|
|
1035
|
+
}
|
|
1036
|
+
function Nn(e4) {
|
|
1032
1037
|
if (void 0 === e4 || "*" === e4) return () => true;
|
|
1033
1038
|
if ("and" in e4) {
|
|
1034
|
-
const t4 = e4.and.map(
|
|
1039
|
+
const t4 = e4.and.map(Nn);
|
|
1035
1040
|
return (e5) => t4.every((t5) => t5(e5));
|
|
1036
1041
|
}
|
|
1037
1042
|
if ("or" in e4) {
|
|
1038
|
-
const t4 = e4.or.map(
|
|
1043
|
+
const t4 = e4.or.map(Nn);
|
|
1039
1044
|
return (e5) => t4.some((t5) => t5(e5));
|
|
1040
1045
|
}
|
|
1041
1046
|
return (function(e5) {
|
|
@@ -1071,70 +1076,70 @@ function In(e4) {
|
|
|
1071
1076
|
};
|
|
1072
1077
|
})(e4);
|
|
1073
1078
|
}
|
|
1074
|
-
function
|
|
1079
|
+
function Mn(e4) {
|
|
1075
1080
|
return "object" == typeof e4 && null !== e4 && !Array.isArray(e4) && ("match" in e4 || "next" in e4 || "one" in e4 || "many" in e4);
|
|
1076
1081
|
}
|
|
1077
|
-
function
|
|
1078
|
-
return Array.isArray(e4) && e4.length > 0 && e4.every((e5) =>
|
|
1082
|
+
function Tn(e4) {
|
|
1083
|
+
return Array.isArray(e4) && e4.length > 0 && e4.every((e5) => Mn(e5));
|
|
1079
1084
|
}
|
|
1080
|
-
function
|
|
1085
|
+
function Cn(e4) {
|
|
1081
1086
|
return e4.map((e5) => {
|
|
1082
1087
|
if ("string" == typeof e5) return { match: () => true, next: { type: "static", value: e5 } };
|
|
1083
|
-
if (Array.isArray(e5)) return { match: () => true, next:
|
|
1088
|
+
if (Array.isArray(e5)) return { match: () => true, next: Pn(e5) ?? { type: "chain", value: [] } };
|
|
1084
1089
|
const t4 = e5;
|
|
1085
|
-
return { match: t4.match ?
|
|
1090
|
+
return { match: t4.match ? Nn(t4.match) : () => true, next: Pn(t4) ?? { type: "chain", value: [] } };
|
|
1086
1091
|
});
|
|
1087
1092
|
}
|
|
1088
|
-
function
|
|
1093
|
+
function Pn(e4) {
|
|
1089
1094
|
if (null == e4) return;
|
|
1090
1095
|
if ("string" == typeof e4) return { type: "static", value: e4 };
|
|
1091
1096
|
if (Array.isArray(e4)) {
|
|
1092
1097
|
if (0 === e4.length) return;
|
|
1093
|
-
if (
|
|
1098
|
+
if (Tn(e4)) return Pn({ one: e4 });
|
|
1094
1099
|
if (e4.every((e5) => "string" == typeof e5)) return { type: "chain", value: e4 };
|
|
1095
1100
|
const t5 = [];
|
|
1096
1101
|
for (const n5 of e4) {
|
|
1097
|
-
const e5 =
|
|
1102
|
+
const e5 = Pn(n5);
|
|
1098
1103
|
void 0 !== e5 && t5.push(e5);
|
|
1099
1104
|
}
|
|
1100
1105
|
if (0 === t5.length) return;
|
|
1101
1106
|
return { type: "sequence", value: t5 };
|
|
1102
1107
|
}
|
|
1103
1108
|
const t4 = e4;
|
|
1104
|
-
if ("next" in t4 && void 0 !== t4.next) return t4.match ? { type: "gate", match:
|
|
1109
|
+
if ("next" in t4 && void 0 !== t4.next) return t4.match ? { type: "gate", match: Nn(t4.match), next: Pn(t4.next) } : Pn(t4.next);
|
|
1105
1110
|
if ("one" in t4 && t4.one) {
|
|
1106
|
-
const e5 =
|
|
1107
|
-
return t4.match ? { type: "gate", match:
|
|
1111
|
+
const e5 = Cn(t4.one);
|
|
1112
|
+
return t4.match ? { type: "gate", match: Nn(t4.match), next: { type: "one", routes: e5 } } : { type: "one", routes: e5 };
|
|
1108
1113
|
}
|
|
1109
1114
|
if ("many" in t4 && t4.many) {
|
|
1110
|
-
const e5 =
|
|
1111
|
-
return t4.match ? { type: "gate", match:
|
|
1115
|
+
const e5 = Cn(t4.many);
|
|
1116
|
+
return t4.match ? { type: "gate", match: Nn(t4.match), next: { type: "many", routes: e5 } } : { type: "many", routes: e5 };
|
|
1112
1117
|
}
|
|
1113
|
-
return t4.match ? { type: "gate", match:
|
|
1118
|
+
return t4.match ? { type: "gate", match: Nn(t4.match) } : void 0;
|
|
1114
1119
|
}
|
|
1115
|
-
function
|
|
1120
|
+
function zn(e4, t4 = {}) {
|
|
1116
1121
|
if (null == e4) return [];
|
|
1117
1122
|
let n5;
|
|
1118
1123
|
if ("object" == typeof e4) {
|
|
1119
|
-
const t5 =
|
|
1120
|
-
t5 ? n5 = t5 : (n5 =
|
|
1121
|
-
} else n5 =
|
|
1124
|
+
const t5 = Rn.get(e4);
|
|
1125
|
+
t5 ? n5 = t5 : (n5 = Pn(e4), n5 && Rn.set(e4, n5));
|
|
1126
|
+
} else n5 = Pn(e4);
|
|
1122
1127
|
if (!n5) return [];
|
|
1123
|
-
const r6 =
|
|
1128
|
+
const r6 = Dn(n5, t4);
|
|
1124
1129
|
return void 0 === r6 ? [] : Array.isArray(r6) ? r6 : [r6];
|
|
1125
1130
|
}
|
|
1126
|
-
function
|
|
1131
|
+
function Dn(e4, t4 = {}) {
|
|
1127
1132
|
if (e4) {
|
|
1128
1133
|
if ("static" === e4.type) return e4.value;
|
|
1129
1134
|
if ("chain" === e4.type) return e4.value;
|
|
1130
1135
|
if ("gate" === e4.type) {
|
|
1131
1136
|
if (!e4.match(t4)) return;
|
|
1132
|
-
return
|
|
1137
|
+
return Dn(e4.next, t4);
|
|
1133
1138
|
}
|
|
1134
1139
|
if ("sequence" === e4.type) {
|
|
1135
1140
|
const n5 = [];
|
|
1136
1141
|
for (const r6 of e4.value) {
|
|
1137
|
-
const e5 =
|
|
1142
|
+
const e5 = Dn(r6, t4);
|
|
1138
1143
|
void 0 !== e5 && (Array.isArray(e5) ? n5.push(...e5) : n5.push(e5));
|
|
1139
1144
|
}
|
|
1140
1145
|
return n5.length > 0 ? n5 : void 0;
|
|
@@ -1143,44 +1148,44 @@ function Cn(e4, t4 = {}) {
|
|
|
1143
1148
|
const n5 = [];
|
|
1144
1149
|
for (const r6 of e4.routes) {
|
|
1145
1150
|
if (!r6.match(t4)) continue;
|
|
1146
|
-
const e5 =
|
|
1151
|
+
const e5 = Dn(r6.next, t4);
|
|
1147
1152
|
void 0 !== e5 && (Array.isArray(e5) ? n5.push(...e5) : n5.push(e5));
|
|
1148
1153
|
}
|
|
1149
1154
|
return n5.length > 0 ? n5 : void 0;
|
|
1150
1155
|
}
|
|
1151
|
-
for (const n5 of e4.routes) if (n5.match(t4)) return
|
|
1156
|
+
for (const n5 of e4.routes) if (n5.match(t4)) return Dn(n5.next, t4);
|
|
1152
1157
|
}
|
|
1153
1158
|
}
|
|
1154
|
-
function
|
|
1155
|
-
const r6 = { [
|
|
1156
|
-
return void 0 !== t4 && (r6[
|
|
1159
|
+
function Ln(e4, t4, n5 = Date.now) {
|
|
1160
|
+
const r6 = { [Fn]: e4 };
|
|
1161
|
+
return void 0 !== t4 && (r6[Un] = n5() + t4), r6;
|
|
1157
1162
|
}
|
|
1158
|
-
function
|
|
1163
|
+
function Kn(e4, t4 = Date.now) {
|
|
1159
1164
|
if (void 0 === e4) return;
|
|
1160
|
-
if (null === (n5 = e4) || "object" != typeof n5 || Array.isArray(n5) || !(
|
|
1165
|
+
if (null === (n5 = e4) || "object" != typeof n5 || Array.isArray(n5) || !(Fn in e4)) return { value: e4 };
|
|
1161
1166
|
var n5;
|
|
1162
|
-
const r6 = e4[
|
|
1163
|
-
return "number" == typeof r6 && t4() > r6 ? { expired: true } : { value: e4[
|
|
1167
|
+
const r6 = e4[Un];
|
|
1168
|
+
return "number" == typeof r6 && t4() > r6 ? { expired: true } : { value: e4[Fn] };
|
|
1164
1169
|
}
|
|
1165
|
-
function
|
|
1170
|
+
function Bn(e4) {
|
|
1166
1171
|
return null !== e4 && "object" == typeof e4 && !Array.isArray(e4);
|
|
1167
1172
|
}
|
|
1168
|
-
function
|
|
1169
|
-
return null === e4 || "string" == typeof e4 || "number" == typeof e4 || "boolean" == typeof e4 || e4 instanceof Uint8Array || (Array.isArray(e4) ? e4.every((e5) => void 0 === e5 ||
|
|
1173
|
+
function Jn(e4) {
|
|
1174
|
+
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)));
|
|
1170
1175
|
}
|
|
1171
|
-
function
|
|
1176
|
+
function Xn(e4, t4) {
|
|
1172
1177
|
const n5 = { ingest: e4 ?? {} };
|
|
1173
1178
|
return void 0 !== t4 && (n5.event = t4), n5;
|
|
1174
1179
|
}
|
|
1175
|
-
function
|
|
1176
|
-
return { stop: e4.stop ?? false, storeId: e4.store, namespace: e4.namespace, rules: e4.rules.map((e5) => ({ match: e5.match ?
|
|
1180
|
+
function Qn(e4) {
|
|
1181
|
+
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 })) };
|
|
1177
1182
|
}
|
|
1178
|
-
async function
|
|
1183
|
+
async function er(e4, t4, n5, r6) {
|
|
1179
1184
|
const o4 = e4.rules.find((e5) => e5.match(n5));
|
|
1180
1185
|
if (!o4) return null;
|
|
1181
1186
|
const s4 = o4.key.map((e5) => String(ve(n5, e5) ?? ""));
|
|
1182
1187
|
if (s4.every((e5) => "" === e5)) return null;
|
|
1183
|
-
const i5 = s4.join(":"), a4 = r6 ?? e4.namespace, c2 = a4 ? `${a4}:${i5}` : i5, u2 =
|
|
1188
|
+
const i5 = s4.join(":"), a4 = r6 ?? e4.namespace, c2 = a4 ? `${a4}:${i5}` : i5, u2 = Kn(await t4.get(c2));
|
|
1184
1189
|
if (void 0 === u2) return { status: "MISS", key: c2, rule: o4 };
|
|
1185
1190
|
if ("expired" in u2) {
|
|
1186
1191
|
try {
|
|
@@ -1191,13 +1196,13 @@ async function Gn(e4, t4, n5, r6) {
|
|
|
1191
1196
|
}
|
|
1192
1197
|
return { status: "HIT", key: c2, value: u2.value, rule: o4 };
|
|
1193
1198
|
}
|
|
1194
|
-
function
|
|
1195
|
-
if (!
|
|
1196
|
-
const o4 = 1e3 * r6, s4 = e4.set(t4,
|
|
1199
|
+
function tr(e4, t4, n5, r6) {
|
|
1200
|
+
if (!Jn(n5)) return;
|
|
1201
|
+
const o4 = 1e3 * r6, s4 = e4.set(t4, Ln(n5, o4), o4);
|
|
1197
1202
|
s4 instanceof Promise && s4.catch(() => {
|
|
1198
1203
|
});
|
|
1199
1204
|
}
|
|
1200
|
-
async function
|
|
1205
|
+
async function nr(e4, t4, n5, r6) {
|
|
1201
1206
|
if (!t4) return e4;
|
|
1202
1207
|
let o4 = e4;
|
|
1203
1208
|
for (const [e5, s4] of Object.entries(t4)) {
|
|
@@ -1205,12 +1210,12 @@ async function Yn(e4, t4, n5, r6) {
|
|
|
1205
1210
|
}
|
|
1206
1211
|
return o4;
|
|
1207
1212
|
}
|
|
1208
|
-
function
|
|
1213
|
+
function rr(e4) {
|
|
1209
1214
|
return ie(e4) ? e4 : [e4];
|
|
1210
1215
|
}
|
|
1211
|
-
async function
|
|
1216
|
+
async function or(e4, t4, n5, r6) {
|
|
1212
1217
|
let o4 = n5;
|
|
1213
|
-
for (const n6 of e4) await
|
|
1218
|
+
for (const n6 of e4) await Ye(async () => {
|
|
1214
1219
|
const e5 = t4(n6.store);
|
|
1215
1220
|
if (!e5) return;
|
|
1216
1221
|
const s4 = await et(o4, n6.key, { collector: r6, event: o4 });
|
|
@@ -1229,23 +1234,23 @@ async function er(e4, t4, n5, r6) {
|
|
|
1229
1234
|
}
|
|
1230
1235
|
var a4;
|
|
1231
1236
|
}, (e5) => {
|
|
1232
|
-
if (e5 instanceof
|
|
1237
|
+
if (e5 instanceof Xe) throw e5;
|
|
1233
1238
|
r6.logger?.error?.("[state] operation failed", e5);
|
|
1234
1239
|
})();
|
|
1235
1240
|
return o4;
|
|
1236
1241
|
}
|
|
1237
|
-
function
|
|
1242
|
+
function ur(e4, t4) {
|
|
1238
1243
|
const n5 = (function(e5) {
|
|
1239
|
-
return /* @__PURE__ */ new Set([...
|
|
1244
|
+
return /* @__PURE__ */ new Set([...sr[e5], ...ir, ...ar[e5]]);
|
|
1240
1245
|
})(t4);
|
|
1241
1246
|
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(", ")}.` };
|
|
1242
1247
|
const r6 = void 0 !== e4.package, o4 = void 0 !== e4.import, s4 = void 0 !== e4.code;
|
|
1243
|
-
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 &&
|
|
1248
|
+
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)}.` };
|
|
1244
1249
|
}
|
|
1245
|
-
function
|
|
1250
|
+
function fr(e4, t4) {
|
|
1246
1251
|
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));
|
|
1247
1252
|
}
|
|
1248
|
-
var e, t, r, i, f, l, m, v, b, T, F, U,
|
|
1253
|
+
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, jn, Rn, Fn, Un, sr, ir, ar, cr;
|
|
1249
1254
|
var init_dist = __esm({
|
|
1250
1255
|
"../core/dist/index.mjs"() {
|
|
1251
1256
|
"use strict";
|
|
@@ -1267,23 +1272,23 @@ var init_dist = __esm({
|
|
|
1267
1272
|
b = {};
|
|
1268
1273
|
t(b, { getStore: () => w, getStoreValue: () => k });
|
|
1269
1274
|
T = /* @__PURE__ */ new Set(["description", "examples", "title", "$comment"]);
|
|
1270
|
-
|
|
1271
|
-
|
|
1272
|
-
|
|
1273
|
-
|
|
1274
|
-
|
|
1275
|
-
|
|
1275
|
+
D = /^\$var\.([a-zA-Z_][a-zA-Z0-9_]*(?:\.[a-zA-Z_][a-zA-Z0-9_]*)*)$/;
|
|
1276
|
+
F = /\$var\.([a-zA-Z_][a-zA-Z0-9_]*(?:\.[a-zA-Z_][a-zA-Z0-9_]*)*)/g;
|
|
1277
|
+
U = /\$env\.([a-zA-Z_][a-zA-Z0-9_]*)(?::([^"}\s]*))?/g;
|
|
1278
|
+
L = /^\$contract\.([a-zA-Z_][a-zA-Z0-9_]*)(?:\.(.+))?$/;
|
|
1279
|
+
K = /^\$flow\.([a-zA-Z_][a-zA-Z0-9_]*)(?:\.([a-zA-Z0-9_.]+))?$/;
|
|
1280
|
+
q = /^\$secret\.([A-Z0-9_]+)$/;
|
|
1276
1281
|
J = "__WALKEROS_ENV:";
|
|
1277
1282
|
G = "__WALKEROS_SECRET:";
|
|
1278
1283
|
re = { merge: true, shallow: true, extend: true };
|
|
1279
1284
|
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 }) };
|
|
1280
|
-
|
|
1285
|
+
Ie = "0123456789abcdef";
|
|
1281
1286
|
Pe = /^(?<version>[0-9a-f]{2})-(?<trace>[0-9a-f]{32})-(?<span>[0-9a-f]{16})-[0-9a-f]{2}$/;
|
|
1282
|
-
|
|
1287
|
+
qe = (e4, t4, n5, r6) => {
|
|
1283
1288
|
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;
|
|
1284
1289
|
s4 ? i5(o4, t4, n5) : i5(o4, t4);
|
|
1285
1290
|
};
|
|
1286
|
-
|
|
1291
|
+
Xe = class e2 extends Error {
|
|
1287
1292
|
constructor(t4, n5) {
|
|
1288
1293
|
super(t4, n5), this.name = "FatalError", Object.setPrototypeOf(this, e2.prototype);
|
|
1289
1294
|
}
|
|
@@ -1291,16 +1296,18 @@ var init_dist = __esm({
|
|
|
1291
1296
|
wt = /^[A-Za-z0-9_-]+$/;
|
|
1292
1297
|
xt = 9e5;
|
|
1293
1298
|
Ot = 39e5;
|
|
1294
|
-
|
|
1295
|
-
|
|
1296
|
-
|
|
1297
|
-
|
|
1298
|
-
|
|
1299
|
-
|
|
1300
|
-
|
|
1301
|
-
|
|
1302
|
-
|
|
1303
|
-
|
|
1299
|
+
Nt = "elbObserve";
|
|
1300
|
+
tn = null;
|
|
1301
|
+
kn = "observe";
|
|
1302
|
+
An = "call:";
|
|
1303
|
+
jn = "obsw_";
|
|
1304
|
+
Rn = /* @__PURE__ */ new WeakMap();
|
|
1305
|
+
Fn = "__walkeros_cache_v__";
|
|
1306
|
+
Un = "__walkeros_cache_exp__";
|
|
1307
|
+
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"] };
|
|
1308
|
+
ir = ["config", "env", "variables", "examples", "disabled", "id", "logger", "mock", "chainMocks"];
|
|
1309
|
+
ar = { Source: ["primary"], Transformer: [], Destination: [], Store: [] };
|
|
1310
|
+
cr = /^[A-Za-z_$][A-Za-z0-9_$]*$/;
|
|
1304
1311
|
}
|
|
1305
1312
|
});
|
|
1306
1313
|
|
|
@@ -1574,7 +1581,7 @@ function createCLILoggerConfig(options = {}) {
|
|
|
1574
1581
|
};
|
|
1575
1582
|
}
|
|
1576
1583
|
function createCLILogger(options = {}) {
|
|
1577
|
-
return
|
|
1584
|
+
return Be(createCLILoggerConfig(options));
|
|
1578
1585
|
}
|
|
1579
1586
|
var init_cli_logger = __esm({
|
|
1580
1587
|
"src/core/cli-logger.ts"() {
|
|
@@ -2051,54 +2058,54 @@ var init_sse = __esm({
|
|
|
2051
2058
|
|
|
2052
2059
|
// ../core/dist/dev.mjs
|
|
2053
2060
|
import { z as n3 } from "zod";
|
|
2054
|
-
import { z as
|
|
2061
|
+
import { z as en } from "zod";
|
|
2055
2062
|
function o2(e4, t4, i5 = "draft-7") {
|
|
2056
2063
|
return n3.toJSONSchema(e4, { target: i5 });
|
|
2057
2064
|
}
|
|
2058
|
-
function
|
|
2065
|
+
function J3(e4, t4) {
|
|
2059
2066
|
return n3.object({ data: n3.union([e4, t4]).optional().describe("Data transformation rules") }).partial();
|
|
2060
2067
|
}
|
|
2061
|
-
function
|
|
2068
|
+
function M2(e4) {
|
|
2062
2069
|
return n3.object({ mapping: e4.optional().describe("Event mapping rules") }).partial();
|
|
2063
2070
|
}
|
|
2064
2071
|
function T3(e4) {
|
|
2065
2072
|
return n3.object({ policy: e4.optional().describe("Pre-processing policy rules") }).partial();
|
|
2066
2073
|
}
|
|
2067
|
-
function
|
|
2074
|
+
function F3(e4) {
|
|
2068
2075
|
return n3.object({ consent: e4.optional().describe("Required consent states") }).partial();
|
|
2069
2076
|
}
|
|
2070
2077
|
function Pi(e4, t4) {
|
|
2071
2078
|
void 0 !== e4.import && (void 0 !== e4.code && t4.addIssue({ code: "custom", message: "`import` cannot be combined with inline `code`", path: ["import"] }), void 0 === e4.package && t4.addIssue({ code: "custom", message: "`import` requires `package`", path: ["import"] }));
|
|
2072
2079
|
}
|
|
2073
|
-
function Li(e4) {
|
|
2074
|
-
return zi.parse(e4);
|
|
2075
|
-
}
|
|
2076
2080
|
function qi(e4) {
|
|
2077
|
-
return
|
|
2081
|
+
return Li.parse(e4);
|
|
2078
2082
|
}
|
|
2079
2083
|
function Ni(e4) {
|
|
2080
|
-
return
|
|
2084
|
+
return Li.safeParse(e4);
|
|
2081
2085
|
}
|
|
2082
2086
|
function Wi(e4) {
|
|
2083
|
-
return
|
|
2087
|
+
return zi.parse(e4);
|
|
2088
|
+
}
|
|
2089
|
+
function Bi(e4) {
|
|
2090
|
+
return zi.safeParse(e4);
|
|
2084
2091
|
}
|
|
2085
|
-
function
|
|
2092
|
+
function ln2(e4) {
|
|
2086
2093
|
throw new Error(String(e4));
|
|
2087
2094
|
}
|
|
2088
|
-
function
|
|
2095
|
+
function pn(e4, t4) {
|
|
2089
2096
|
const i5 = false !== t4?.stripAnnotations, n5 = {}, o4 = /* @__PURE__ */ new Set();
|
|
2090
2097
|
function r6(t5) {
|
|
2091
2098
|
if (n5[t5]) return n5[t5];
|
|
2092
|
-
o4.has(t5) &&
|
|
2099
|
+
o4.has(t5) && ln2(`Circular extend chain detected: ${[...o4, t5].join(" \u2192 ")}`);
|
|
2093
2100
|
const a4 = e4[t5];
|
|
2094
|
-
a4 ||
|
|
2101
|
+
a4 || ln2(`Contract "${t5}" not found`), o4.add(t5);
|
|
2095
2102
|
let s4 = {};
|
|
2096
2103
|
if (a4.extend) {
|
|
2097
2104
|
s4 = (function(e5, t6) {
|
|
2098
2105
|
const i6 = {};
|
|
2099
2106
|
void 0 === e5.tagging && void 0 === t6.tagging || (i6.tagging = t6.tagging ?? e5.tagging);
|
|
2100
2107
|
void 0 === e5.description && void 0 === t6.description || (i6.description = t6.description ?? e5.description);
|
|
2101
|
-
e5.schema && t6.schema ? i6.schema =
|
|
2108
|
+
e5.schema && t6.schema ? i6.schema = un(e5.schema, t6.schema) : (e5.schema || t6.schema) && (i6.schema = { ...e5.schema || t6.schema });
|
|
2102
2109
|
if (e5.events || t6.events) {
|
|
2103
2110
|
const n6 = {}, o5 = /* @__PURE__ */ new Set([...Object.keys(e5.events || {}), ...Object.keys(t6.events || {})]);
|
|
2104
2111
|
for (const i7 of o5) {
|
|
@@ -2106,7 +2113,7 @@ function dn(e4, t4) {
|
|
|
2106
2113
|
n6[i7] = {};
|
|
2107
2114
|
for (const e6 of a5) {
|
|
2108
2115
|
const t7 = o6[e6], a6 = r7[e6];
|
|
2109
|
-
n6[i7][e6] = t7 && a6 ?
|
|
2116
|
+
n6[i7][e6] = t7 && a6 ? un(t7, a6) : { ...t7 || a6 };
|
|
2110
2117
|
}
|
|
2111
2118
|
}
|
|
2112
2119
|
i6.events = n6;
|
|
@@ -2121,13 +2128,13 @@ function dn(e4, t4) {
|
|
|
2121
2128
|
for (const n6 of Object.keys(e5[i6] || {})) {
|
|
2122
2129
|
let o5 = {};
|
|
2123
2130
|
const r7 = e5["*"]?.["*"];
|
|
2124
|
-
r7 && (o5 =
|
|
2131
|
+
r7 && (o5 = un(o5, r7));
|
|
2125
2132
|
const a5 = e5["*"]?.[n6];
|
|
2126
|
-
a5 && "*" !== n6 && (o5 =
|
|
2133
|
+
a5 && "*" !== n6 && (o5 = un(o5, a5));
|
|
2127
2134
|
const s5 = e5[i6]?.["*"];
|
|
2128
|
-
s5 && "*" !== n6 && (o5 =
|
|
2135
|
+
s5 && "*" !== n6 && (o5 = un(o5, s5));
|
|
2129
2136
|
const c2 = e5[i6]?.[n6];
|
|
2130
|
-
c2 && (o5 =
|
|
2137
|
+
c2 && (o5 = un(o5, c2)), t6[i6][n6] = o5;
|
|
2131
2138
|
}
|
|
2132
2139
|
}
|
|
2133
2140
|
e5["*"] && (t6["*"] = { ...e5["*"] });
|
|
@@ -2136,7 +2143,7 @@ function dn(e4, t4) {
|
|
|
2136
2143
|
const e5 = {};
|
|
2137
2144
|
for (const [t6, i6] of Object.entries(s4.events)) {
|
|
2138
2145
|
e5[t6] = {};
|
|
2139
|
-
for (const [n6, o5] of Object.entries(i6)) e5[t6][n6] =
|
|
2146
|
+
for (const [n6, o5] of Object.entries(i6)) e5[t6][n6] = mn(o5);
|
|
2140
2147
|
}
|
|
2141
2148
|
s4.events = e5;
|
|
2142
2149
|
}
|
|
@@ -2145,23 +2152,23 @@ function dn(e4, t4) {
|
|
|
2145
2152
|
for (const t5 of Object.keys(e4)) r6(t5);
|
|
2146
2153
|
return n5;
|
|
2147
2154
|
}
|
|
2148
|
-
function
|
|
2155
|
+
function un(e4, t4) {
|
|
2149
2156
|
const i5 = { ...e4 };
|
|
2150
2157
|
for (const n5 of Object.keys(t4)) {
|
|
2151
2158
|
const o4 = e4[n5], r6 = t4[n5];
|
|
2152
|
-
"required" === n5 && Array.isArray(o4) && Array.isArray(r6) ? i5[n5] = [.../* @__PURE__ */ new Set([...o4, ...r6])] :
|
|
2159
|
+
"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;
|
|
2153
2160
|
}
|
|
2154
2161
|
return i5;
|
|
2155
2162
|
}
|
|
2156
|
-
function
|
|
2163
|
+
function mn(e4) {
|
|
2157
2164
|
const t4 = {};
|
|
2158
|
-
for (const [i5, n5] of Object.entries(e4))
|
|
2165
|
+
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));
|
|
2159
2166
|
return t4;
|
|
2160
2167
|
}
|
|
2161
|
-
function
|
|
2168
|
+
function fn(e4) {
|
|
2162
2169
|
return "object" == typeof e4 && null !== e4 && !Array.isArray(e4);
|
|
2163
2170
|
}
|
|
2164
|
-
function
|
|
2171
|
+
function gn(e4, t4) {
|
|
2165
2172
|
let i5;
|
|
2166
2173
|
try {
|
|
2167
2174
|
i5 = JSON.parse(e4);
|
|
@@ -2170,7 +2177,7 @@ function fn2(e4, t4) {
|
|
|
2170
2177
|
if (e5 instanceof SyntaxError) {
|
|
2171
2178
|
const i7 = e5.message.match(/position\s+(\d+)/);
|
|
2172
2179
|
if (i7) {
|
|
2173
|
-
return
|
|
2180
|
+
return En2(t6, parseInt(i7[1], 10));
|
|
2174
2181
|
}
|
|
2175
2182
|
const n7 = e5.message.match(/line\s+(\d+)\s+column\s+(\d+)/);
|
|
2176
2183
|
if (n7) return { line: parseInt(n7[1], 10), column: parseInt(n7[2], 10) };
|
|
@@ -2179,45 +2186,45 @@ function fn2(e4, t4) {
|
|
|
2179
2186
|
})(t5, e4);
|
|
2180
2187
|
return { valid: false, errors: [{ message: t5 instanceof Error ? t5.message : "Invalid JSON", severity: "error", line: i6, column: n6 }], warnings: [] };
|
|
2181
2188
|
}
|
|
2182
|
-
const n5 = [], o4 = [], r6 =
|
|
2189
|
+
const n5 = [], o4 = [], r6 = Li.safeParse(i5);
|
|
2183
2190
|
if (!r6.success) for (const t5 of r6.error.issues) {
|
|
2184
|
-
const i6 = t5.path.join("."), o5 =
|
|
2191
|
+
const i6 = t5.path.join("."), o5 = In2(e4, t5.path);
|
|
2185
2192
|
n5.push({ message: t5.message, severity: "error", path: i6 || "root", ...o5 });
|
|
2186
2193
|
}
|
|
2187
2194
|
const a4 = (function(e5) {
|
|
2188
|
-
if (!(
|
|
2195
|
+
if (!(Rn2(e5) && "version" in e5 && "flows" in e5 && Rn2(e5.flows))) return;
|
|
2189
2196
|
const t5 = {}, i6 = [], n6 = [], o5 = [], r7 = [], a5 = [], s4 = [];
|
|
2190
2197
|
let c2;
|
|
2191
2198
|
const l3 = Object.keys(e5.flows);
|
|
2192
2199
|
Jn2(t5, e5.variables), (function(e6, t6) {
|
|
2193
|
-
if (!
|
|
2200
|
+
if (!Rn2(t6)) return;
|
|
2194
2201
|
let i7;
|
|
2195
2202
|
try {
|
|
2196
|
-
i7 =
|
|
2203
|
+
i7 = pn(t6, { stripAnnotations: false });
|
|
2197
2204
|
} catch {
|
|
2198
2205
|
return;
|
|
2199
2206
|
}
|
|
2200
2207
|
for (const t7 of Object.values(i7)) {
|
|
2201
2208
|
const i8 = t7.events;
|
|
2202
|
-
if (
|
|
2203
|
-
if (!
|
|
2209
|
+
if (Rn2(i8)) for (const [t8, n7] of Object.entries(i8)) {
|
|
2210
|
+
if (!Rn2(n7)) continue;
|
|
2204
2211
|
let i9 = e6.find((e7) => e7.entity === t8);
|
|
2205
2212
|
i9 || (i9 = { entity: t8, actions: [], properties: {} }, e6.push(i9)), i9.properties || (i9.properties = {});
|
|
2206
|
-
for (const [e7, t9] of Object.entries(n7)) i9.actions.includes(e7) || i9.actions.push(e7), i9.properties[e7] =
|
|
2213
|
+
for (const [e7, t9] of Object.entries(n7)) i9.actions.includes(e7) || i9.actions.push(e7), i9.properties[e7] = Mn2(t9);
|
|
2207
2214
|
}
|
|
2208
2215
|
}
|
|
2209
2216
|
})(s4, e5.contract);
|
|
2210
|
-
for (const s5 of Object.values(e5.flows)) if (
|
|
2217
|
+
for (const s5 of Object.values(e5.flows)) if (Rn2(s5)) {
|
|
2211
2218
|
if (!c2) {
|
|
2212
2219
|
const e6 = s5.config;
|
|
2213
|
-
!
|
|
2220
|
+
!Rn2(e6) || "web" !== e6.platform && "server" !== e6.platform || (c2 = e6.platform);
|
|
2214
2221
|
}
|
|
2215
2222
|
Jn2(t5, s5.variables);
|
|
2216
2223
|
for (const e6 of ["sources", "destinations", "transformers"]) {
|
|
2217
2224
|
const r8 = "sources" === e6 ? "source" : "destinations" === e6 ? "destination" : "transformer", l4 = "sources" === e6 ? i6 : "destinations" === e6 ? n6 : o5;
|
|
2218
|
-
if (
|
|
2225
|
+
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" }));
|
|
2219
2226
|
}
|
|
2220
|
-
if (
|
|
2227
|
+
if (Rn2(s5.stores)) for (const [e6, i7] of Object.entries(s5.stores)) r7.push(e6), Rn2(i7) && Jn2(t5, i7.variables);
|
|
2221
2228
|
}
|
|
2222
2229
|
const d2 = { variables: t5, stepNames: { sources: i6, destinations: n6, transformers: o5, stores: r7 }, flowNames: l3 };
|
|
2223
2230
|
c2 && (d2.platform = c2);
|
|
@@ -2228,9 +2235,9 @@ function fn2(e4, t4) {
|
|
|
2228
2235
|
return a4 && (t4?.secrets && (a4.secrets = t4.secrets), (function(e5, t5, i6, n6, o5) {
|
|
2229
2236
|
(function(e6, t6, i7) {
|
|
2230
2237
|
let n7;
|
|
2231
|
-
|
|
2232
|
-
for (; null !== (n7 =
|
|
2233
|
-
const t7 = n7[0], o6 = n7[1], r7 = n7[2], a5 =
|
|
2238
|
+
Sn2.lastIndex = 0;
|
|
2239
|
+
for (; null !== (n7 = Sn2.exec(e6)); ) {
|
|
2240
|
+
const t7 = n7[0], o6 = n7[1], r7 = n7[2], a5 = On(e6, n7.index, t7.length);
|
|
2234
2241
|
i7.push({ message: `Malformed reference "${t7}", use a dot, not a colon: "$${o6}.${r7}".`, severity: "warning", path: t7, ...a5 });
|
|
2235
2242
|
}
|
|
2236
2243
|
})(e5, 0, o5), (function(e6, t6, i7) {
|
|
@@ -2238,170 +2245,170 @@ function fn2(e4, t4) {
|
|
|
2238
2245
|
const n7 = /\$var\.(\w+)/g;
|
|
2239
2246
|
let o6;
|
|
2240
2247
|
for (; null !== (o6 = n7.exec(e6)); ) if (!(o6[1] in t6.variables)) {
|
|
2241
|
-
const n8 =
|
|
2248
|
+
const n8 = On(e6, o6.index, o6[0].length);
|
|
2242
2249
|
i7.push({ message: `Unknown variable "$var.${o6[1]}". Defined: ${Object.keys(t6.variables).join(", ") || "none"}`, severity: "warning", path: `$var.${o6[1]}`, ...n8 });
|
|
2243
2250
|
}
|
|
2244
2251
|
})(e5, i6, o5), (function(e6, t6, i7) {
|
|
2245
2252
|
const n7 = t6.stepNames?.stores ?? [];
|
|
2246
2253
|
let o6;
|
|
2247
|
-
|
|
2248
|
-
for (; null !== (o6 =
|
|
2249
|
-
const t7 =
|
|
2254
|
+
bn3.lastIndex = 0;
|
|
2255
|
+
for (; null !== (o6 = bn3.exec(e6)); ) if (!n7.includes(o6[1])) {
|
|
2256
|
+
const t7 = On(e6, o6.index, o6[0].length);
|
|
2250
2257
|
i7.push({ message: `Unknown store "$store.${o6[1]}". Defined: ${n7.join(", ") || "none"}`, severity: "warning", path: `$store.${o6[1]}`, ...t7 });
|
|
2251
2258
|
}
|
|
2252
2259
|
})(e5, i6, o5), (function(e6, t6, i7) {
|
|
2253
2260
|
let n7;
|
|
2254
|
-
|
|
2255
|
-
for (; null !== (n7 =
|
|
2256
|
-
const t7 = n7[0], o6 = n7[1], r7 = n7[2], a5 =
|
|
2261
|
+
hn2.lastIndex = 0;
|
|
2262
|
+
for (; null !== (n7 = hn2.exec(e6)); ) {
|
|
2263
|
+
const t7 = n7[0], o6 = n7[1], r7 = n7[2], a5 = On(e6, n7.index, t7.length);
|
|
2257
2264
|
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 });
|
|
2258
2265
|
}
|
|
2259
2266
|
})(e5, 0, o5), (function(e6, t6, i7) {
|
|
2260
2267
|
const n7 = t6.flowNames ?? [];
|
|
2261
2268
|
if (0 === n7.length) return;
|
|
2262
2269
|
let o6;
|
|
2263
|
-
|
|
2264
|
-
for (; null !== (o6 =
|
|
2270
|
+
vn3.lastIndex = 0;
|
|
2271
|
+
for (; null !== (o6 = vn3.exec(e6)); ) {
|
|
2265
2272
|
const t7 = o6[0], r7 = o6[1];
|
|
2266
2273
|
if (!n7.includes(r7)) {
|
|
2267
|
-
const a5 =
|
|
2274
|
+
const a5 = On(e6, o6.index, t7.length);
|
|
2268
2275
|
i7.push({ message: `Unknown flow "$flow.${r7}". Defined: ${n7.join(", ")}`, severity: "warning", path: t7, ...a5 });
|
|
2269
2276
|
}
|
|
2270
2277
|
}
|
|
2271
2278
|
})(e5, i6, o5), (function(e6, t6, i7, n7, o6) {
|
|
2272
2279
|
const r7 = i7.secrets;
|
|
2273
|
-
if (!
|
|
2280
|
+
if (!Rn2(t6) || !Rn2(t6.flows)) return;
|
|
2274
2281
|
for (const i8 of Object.values(t6.flows)) {
|
|
2275
|
-
if (!
|
|
2276
|
-
const t7 = i8.config, a5 = !
|
|
2282
|
+
if (!Rn2(i8)) continue;
|
|
2283
|
+
const t7 = i8.config, a5 = !Rn2(t7) || "web" !== t7.platform && "server" !== t7.platform ? void 0 : t7.platform, s4 = JSON.stringify(i8);
|
|
2277
2284
|
let c2;
|
|
2278
|
-
for (
|
|
2279
|
-
const t8 = c2[0], i9 = c2[1], s5 = e6.indexOf(t8), l3 = -1 === s5 ? { line: 1, column: 1 } :
|
|
2285
|
+
for (yn3.lastIndex = 0; null !== (c2 = yn3.exec(s4)); ) {
|
|
2286
|
+
const t8 = c2[0], i9 = c2[1], s5 = e6.indexOf(t8), l3 = -1 === s5 ? { line: 1, column: 1 } : On(e6, s5, t8.length);
|
|
2280
2287
|
"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 });
|
|
2281
2288
|
}
|
|
2282
2289
|
}
|
|
2283
2290
|
})(e5, t5, i6, n6, o5);
|
|
2284
2291
|
})(e4, i5, a4, n5, o4)), (function(e5, t5, i6) {
|
|
2285
|
-
if (!
|
|
2292
|
+
if (!Rn2(t5) || !Rn2(t5.flows)) return;
|
|
2286
2293
|
for (const n6 of Object.values(t5.flows)) {
|
|
2287
|
-
if (!
|
|
2288
|
-
const t6 =
|
|
2289
|
-
t6 &&
|
|
2294
|
+
if (!Rn2(n6)) continue;
|
|
2295
|
+
const t6 = Rn2(n6.stores) ? n6.stores : void 0;
|
|
2296
|
+
t6 && jn2(e5, t6, i6), t6 && Rn2(n6.transformers) && Pn2(e5, n6.transformers, t6, i6);
|
|
2290
2297
|
}
|
|
2291
2298
|
})(e4, i5, o4), { valid: 0 === n5.length, errors: n5, warnings: o4, context: a4 };
|
|
2292
2299
|
}
|
|
2293
|
-
function
|
|
2294
|
-
return
|
|
2300
|
+
function xn2(e4) {
|
|
2301
|
+
return Rn2(e4.config) && true === e4.config.file;
|
|
2295
2302
|
}
|
|
2296
|
-
function
|
|
2297
|
-
for (const [n5, o4] of Object.entries(t4))
|
|
2303
|
+
function jn2(e4, t4, i5) {
|
|
2304
|
+
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) });
|
|
2298
2305
|
}
|
|
2299
|
-
function
|
|
2306
|
+
function Pn2(e4, t4, i5, n5) {
|
|
2300
2307
|
for (const o4 of Object.values(t4)) {
|
|
2301
|
-
if (!
|
|
2302
|
-
if (o4.package !==
|
|
2303
|
-
if (!
|
|
2308
|
+
if (!Rn2(o4)) continue;
|
|
2309
|
+
if (o4.package !== kn3) continue;
|
|
2310
|
+
if (!Rn2(o4.env)) continue;
|
|
2304
2311
|
const t5 = o4.env.store;
|
|
2305
2312
|
if ("string" != typeof t5) continue;
|
|
2306
|
-
const r6 =
|
|
2313
|
+
const r6 = Cn3.exec(t5);
|
|
2307
2314
|
if (!r6) continue;
|
|
2308
2315
|
const a4 = r6[1], s4 = i5[a4];
|
|
2309
|
-
if (!
|
|
2316
|
+
if (!Rn2(s4)) continue;
|
|
2310
2317
|
const c2 = s4.package;
|
|
2311
|
-
"string" == typeof c2 &&
|
|
2318
|
+
"string" == typeof c2 && wn3.includes(c2) && (xn2(s4) || n5.push({ message: `transformer-file serves byte-exact assets; set config.file: true on store "${a4}".`, severity: "warning", path: `stores.${a4}`, ...Dn2(e4, a4) }));
|
|
2312
2319
|
}
|
|
2313
2320
|
}
|
|
2314
|
-
function
|
|
2321
|
+
function Dn2(e4, t4) {
|
|
2315
2322
|
const i5 = e4.indexOf(`"${t4}"`);
|
|
2316
|
-
return -1 === i5 ? { line: 1, column: 1 } :
|
|
2323
|
+
return -1 === i5 ? { line: 1, column: 1 } : En2(e4, i5);
|
|
2317
2324
|
}
|
|
2318
|
-
function
|
|
2325
|
+
function En2(e4, t4) {
|
|
2319
2326
|
let i5 = 1, n5 = 1;
|
|
2320
2327
|
for (let o4 = 0; o4 < t4 && o4 < e4.length; o4++) "\n" === e4[o4] ? (i5++, n5 = 1) : n5++;
|
|
2321
2328
|
return { line: i5, column: n5 };
|
|
2322
2329
|
}
|
|
2323
|
-
function
|
|
2324
|
-
const n5 =
|
|
2330
|
+
function On(e4, t4, i5) {
|
|
2331
|
+
const n5 = En2(e4, t4), o4 = En2(e4, t4 + i5);
|
|
2325
2332
|
return { line: n5.line, column: n5.column, endLine: o4.line, endColumn: o4.column };
|
|
2326
2333
|
}
|
|
2327
|
-
function
|
|
2334
|
+
function In2(e4, t4) {
|
|
2328
2335
|
if (0 === t4.length) return { line: 1, column: 1 };
|
|
2329
2336
|
const i5 = t4[t4.length - 1];
|
|
2330
2337
|
if ("string" == typeof i5) {
|
|
2331
2338
|
const t5 = `"${i5}"`, n5 = e4.lastIndexOf(t5);
|
|
2332
|
-
if (-1 !== n5) return
|
|
2339
|
+
if (-1 !== n5) return En2(e4, n5);
|
|
2333
2340
|
}
|
|
2334
2341
|
return { line: 1, column: 1 };
|
|
2335
2342
|
}
|
|
2336
|
-
function
|
|
2343
|
+
function Rn2(e4) {
|
|
2337
2344
|
return "object" == typeof e4 && null !== e4 && !Array.isArray(e4);
|
|
2338
2345
|
}
|
|
2339
2346
|
function Jn2(e4, t4) {
|
|
2340
|
-
if (
|
|
2347
|
+
if (Rn2(t4)) for (const [i5, n5] of Object.entries(t4)) e4[i5] = n5;
|
|
2341
2348
|
}
|
|
2342
|
-
function
|
|
2349
|
+
function Mn2(e4) {
|
|
2343
2350
|
const t4 = {};
|
|
2344
|
-
if (!
|
|
2345
|
-
const i5 =
|
|
2346
|
-
if (!
|
|
2351
|
+
if (!Rn2(e4)) return t4;
|
|
2352
|
+
const i5 = Rn2(e4.properties) ? e4.properties.data : void 0;
|
|
2353
|
+
if (!Rn2(i5)) return t4;
|
|
2347
2354
|
const n5 = Array.isArray(i5.required) ? i5.required.filter((e5) => "string" == typeof e5) : [], o4 = i5.properties;
|
|
2348
|
-
if (!
|
|
2355
|
+
if (!Rn2(o4)) return t4;
|
|
2349
2356
|
for (const [e5, i6] of Object.entries(o4)) {
|
|
2350
2357
|
const o5 = {};
|
|
2351
|
-
|
|
2358
|
+
Rn2(i6) && ("string" == typeof i6.type && (o5.type = i6.type), "string" == typeof i6.description && (o5.description = i6.description)), n5.includes(e5) && (o5.required = true), t4[e5] = o5;
|
|
2352
2359
|
}
|
|
2353
2360
|
return t4;
|
|
2354
2361
|
}
|
|
2355
|
-
function
|
|
2362
|
+
function Tn2(e4, t4) {
|
|
2356
2363
|
const i5 = [], n5 = {};
|
|
2357
2364
|
for (const [t5, o5] of Object.entries(e4)) {
|
|
2358
2365
|
o5.required && i5.push(t5);
|
|
2359
2366
|
const e5 = { type: o5.type };
|
|
2360
2367
|
if (o5.description && (e5.description = o5.description), o5.pattern && (e5.pattern = o5.pattern), void 0 !== o5.minLength && (e5.minLength = o5.minLength), void 0 !== o5.maxLength && (e5.maxLength = o5.maxLength), void 0 !== o5.minimum && (e5.minimum = o5.minimum), void 0 !== o5.maximum && (e5.maximum = o5.maximum), o5.enum && (e5.enum = [...o5.enum]), void 0 !== o5.default && (e5.default = o5.default), "object" === o5.type && o5.properties) {
|
|
2361
2368
|
const t6 = {};
|
|
2362
|
-
for (const [e6, i6] of Object.entries(o5.properties)) t6[e6] =
|
|
2369
|
+
for (const [e6, i6] of Object.entries(o5.properties)) t6[e6] = Fn2(i6);
|
|
2363
2370
|
e5.properties = t6;
|
|
2364
2371
|
}
|
|
2365
|
-
"array" === o5.type && o5.items && (e5.items =
|
|
2372
|
+
"array" === o5.type && o5.items && (e5.items = Fn2(o5.items)), n5[t5] = e5;
|
|
2366
2373
|
}
|
|
2367
2374
|
const o4 = { type: "object", properties: n5 };
|
|
2368
2375
|
return t4 && (o4.title = t4), i5.length > 0 && (o4.required = i5), o4;
|
|
2369
2376
|
}
|
|
2370
|
-
function
|
|
2377
|
+
function Fn2(e4) {
|
|
2371
2378
|
const t4 = { type: e4.type };
|
|
2372
2379
|
if (e4.description && (t4.description = e4.description), e4.pattern && (t4.pattern = e4.pattern), void 0 !== e4.minLength && (t4.minLength = e4.minLength), void 0 !== e4.maxLength && (t4.maxLength = e4.maxLength), void 0 !== e4.minimum && (t4.minimum = e4.minimum), void 0 !== e4.maximum && (t4.maximum = e4.maximum), e4.enum && (t4.enum = [...e4.enum]), void 0 !== e4.default && (t4.default = e4.default), "object" === e4.type && e4.properties) {
|
|
2373
2380
|
const i5 = {};
|
|
2374
|
-
for (const [t5, n5] of Object.entries(e4.properties)) i5[t5] =
|
|
2381
|
+
for (const [t5, n5] of Object.entries(e4.properties)) i5[t5] = Fn2(n5);
|
|
2375
2382
|
t4.properties = i5;
|
|
2376
2383
|
}
|
|
2377
|
-
return "array" === e4.type && e4.items && (t4.items =
|
|
2384
|
+
return "array" === e4.type && e4.items && (t4.items = Fn2(e4.items)), t4;
|
|
2378
2385
|
}
|
|
2379
|
-
function
|
|
2380
|
-
const i5 = { type: "array", items:
|
|
2386
|
+
function $n(e4, t4) {
|
|
2387
|
+
const i5 = { type: "array", items: Fn2(e4) };
|
|
2381
2388
|
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;
|
|
2382
2389
|
}
|
|
2383
|
-
function
|
|
2390
|
+
function An2(e4, t4 = "string", i5) {
|
|
2384
2391
|
const n5 = { type: t4, enum: [...e4] };
|
|
2385
2392
|
return i5?.description && (n5.description = i5.description), i5?.title && (n5.title = i5.title), n5;
|
|
2386
2393
|
}
|
|
2387
|
-
function
|
|
2388
|
-
return
|
|
2394
|
+
function zn2(e4, t4, i5) {
|
|
2395
|
+
return $n({ type: "object" }, { minItems: 2, maxItems: 2, description: i5 || "Tuple with exactly 2 elements [source, transform]" });
|
|
2389
2396
|
}
|
|
2390
|
-
function
|
|
2397
|
+
function Ln2(e4) {
|
|
2391
2398
|
const t4 = n3.toJSONSchema(e4, { target: "draft-7" });
|
|
2392
|
-
return
|
|
2399
|
+
return qn(t4), t4;
|
|
2393
2400
|
}
|
|
2394
|
-
function
|
|
2401
|
+
function qn(e4) {
|
|
2395
2402
|
const t4 = e4.properties;
|
|
2396
2403
|
if (t4 && "object" == typeof t4) {
|
|
2397
2404
|
Array.isArray(e4.required) && (e4.required = e4.required.filter((e5) => {
|
|
2398
2405
|
const i5 = t4[e5];
|
|
2399
2406
|
return !(i5 && "object" == typeof i5 && "default" in i5);
|
|
2400
2407
|
}));
|
|
2401
|
-
for (const [e5, i5] of Object.entries(t4)) i5 && "object" == typeof i5 && ("object" === i5.type && i5.properties && "string" != typeof i5.title && (i5.title = e5),
|
|
2408
|
+
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));
|
|
2402
2409
|
}
|
|
2403
2410
|
}
|
|
2404
|
-
var e3, t3, i3, r4, a3, s2, c, l2, d, p, u, m2, f2, g2,
|
|
2411
|
+
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, Se2, ye2, we2, ke2, Ce2, xe, je, 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;
|
|
2405
2412
|
var init_dev = __esm({
|
|
2406
2413
|
"../core/dist/dev.mjs"() {
|
|
2407
2414
|
"use strict";
|
|
@@ -2410,7 +2417,7 @@ var init_dev = __esm({
|
|
|
2410
2417
|
for (var n5 in i5) e3(t4, n5, { get: i5[n5], enumerable: true });
|
|
2411
2418
|
};
|
|
2412
2419
|
i3 = {};
|
|
2413
|
-
t3(i3, { BaseContextConfig: () =>
|
|
2420
|
+
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: () => je, valueJsonSchema: () => xe, z: () => n3, zodToSchema: () => Ln2 });
|
|
2414
2421
|
r4 = n3.string();
|
|
2415
2422
|
a3 = n3.number();
|
|
2416
2423
|
s2 = n3.boolean();
|
|
@@ -2420,93 +2427,93 @@ var init_dev = __esm({
|
|
|
2420
2427
|
p = n3.union([n3.string(), n3.number(), n3.boolean()]);
|
|
2421
2428
|
u = p.optional();
|
|
2422
2429
|
m2 = {};
|
|
2423
|
-
t3(m2, { ErrorHandlerSchema: () =>
|
|
2430
|
+
t3(m2, { ErrorHandlerSchema: () => b2, HandlerSchema: () => v2, LogHandlerSchema: () => h, StorageSchema: () => g2, StorageTypeSchema: () => f2, errorHandlerJsonSchema: () => w2, handlerJsonSchema: () => C2, logHandlerJsonSchema: () => k2, storageJsonSchema: () => y2, storageTypeJsonSchema: () => S });
|
|
2424
2431
|
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");
|
|
2425
2432
|
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");
|
|
2426
|
-
|
|
2427
|
-
|
|
2428
|
-
v2 = n3.object({ Error:
|
|
2433
|
+
b2 = n3.unknown().meta({ id: "ErrorHandler", title: "Error.Handler", description: "Error handler function: (error, state?) => void." }).describe("Error handler function: (error, state?) => void");
|
|
2434
|
+
h = n3.unknown().meta({ id: "LogHandler", title: "Log.Handler", description: "Log handler function: (message, verbose?) => void." }).describe("Log handler function: (message, verbose?) => void");
|
|
2435
|
+
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");
|
|
2429
2436
|
S = o2(f2);
|
|
2430
2437
|
y2 = o2(g2);
|
|
2431
|
-
w2 = o2(
|
|
2432
|
-
k2 = o2(
|
|
2438
|
+
w2 = o2(b2);
|
|
2439
|
+
k2 = o2(h);
|
|
2433
2440
|
C2 = o2(v2);
|
|
2434
|
-
x = n3.object({ onError:
|
|
2441
|
+
x = n3.object({ onError: b2.optional().describe("Error handler function: (error, state?) => void"), onLog: h.optional().describe("Log handler function: (message, verbose?) => void") }).partial();
|
|
2435
2442
|
j = n3.object({ verbose: n3.boolean().describe("Enable verbose logging for debugging").optional() }).partial();
|
|
2436
|
-
|
|
2437
|
-
|
|
2438
|
-
|
|
2443
|
+
P2 = n3.object({ queue: n3.boolean().describe("Whether to queue events when consent is not granted").optional() }).partial();
|
|
2444
|
+
D2 = n3.object({}).partial();
|
|
2445
|
+
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();
|
|
2439
2446
|
O = n3.object({ primary: n3.boolean().describe("Mark as primary (only one can be primary)").optional() }).partial();
|
|
2440
|
-
|
|
2441
|
-
|
|
2447
|
+
I2 = n3.object({ settings: n3.any().optional().describe("Implementation-specific configuration") }).partial();
|
|
2448
|
+
R3 = n3.object({ env: n3.any().optional().describe("Environment dependencies (platform-specific)") }).partial();
|
|
2442
2449
|
$ = n3.object({ type: n3.string().optional().describe("Instance type identifier"), config: n3.unknown().describe("Instance configuration") }).partial();
|
|
2443
|
-
|
|
2450
|
+
A = n3.object({ collector: n3.unknown().describe("Collector instance (runtime object)"), config: n3.unknown().describe("Configuration"), env: n3.unknown().describe("Environment dependencies") }).partial();
|
|
2444
2451
|
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();
|
|
2445
2452
|
L2 = n3.object({ sources: n3.record(n3.string(), n3.unknown()).describe("Map of source instances") }).partial();
|
|
2446
2453
|
q2 = n3.object({ destinations: n3.record(n3.string(), n3.unknown()).describe("Map of destination instances") }).partial();
|
|
2447
|
-
|
|
2448
|
-
t3(
|
|
2449
|
-
|
|
2450
|
-
|
|
2451
|
-
_2 = n3.record(n3.string(),
|
|
2452
|
-
H2 = n3.record(n3.string(), n3.tuple([
|
|
2453
|
-
|
|
2454
|
+
N2 = {};
|
|
2455
|
+
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 });
|
|
2456
|
+
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)." });
|
|
2457
|
+
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." });
|
|
2458
|
+
_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");
|
|
2459
|
+
H2 = n3.record(n3.string(), n3.tuple([U3, n3.number()]).optional()).meta({ id: "WalkerOSOrderedProperties", title: "WalkerOS.OrderedProperties", description: "Ordered properties with [value, order] tuples for priority control." }).describe("Ordered properties with [value, order] tuples for priority control");
|
|
2460
|
+
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");
|
|
2454
2461
|
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)");
|
|
2455
|
-
|
|
2462
|
+
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");
|
|
2456
2463
|
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() });
|
|
2457
|
-
|
|
2464
|
+
Q2 = _2.and(K3).meta({ id: "WalkerOSSource", title: "WalkerOS.Source", description: "Event source information (origin of the event)." }).describe("Event source information");
|
|
2458
2465
|
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");
|
|
2459
2466
|
Y3 = n3.array(X3).meta({ id: "WalkerOSEntities", title: "WalkerOS.Entities", description: "Array of nested entities." }).describe("Array of nested entities");
|
|
2460
|
-
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:
|
|
2467
|
+
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");
|
|
2461
2468
|
te3 = ee3.partial().meta({ id: "WalkerOSPartialEvent", title: "WalkerOS.PartialEvent", description: "Partial event structure with all fields optional." }).describe("Partial event structure with all fields optional");
|
|
2462
|
-
|
|
2469
|
+
ie3 = ee3.partial().meta({ id: "WalkerOSDeepPartialEvent", title: "WalkerOS.DeepPartialEvent", description: "Partial event structure with all top-level fields optional." }).describe("Partial event structure with all top-level fields optional");
|
|
2463
2470
|
ne3 = o2(ee3);
|
|
2464
|
-
|
|
2465
|
-
|
|
2466
|
-
|
|
2467
|
-
|
|
2471
|
+
oe2 = o2(te3);
|
|
2472
|
+
re3 = o2(G2);
|
|
2473
|
+
ae3 = o2(_2);
|
|
2474
|
+
se2 = o2(H2);
|
|
2468
2475
|
ce = o2(X3);
|
|
2469
|
-
le2 = o2(
|
|
2476
|
+
le2 = o2(V);
|
|
2470
2477
|
de2 = o2(Z2);
|
|
2471
2478
|
pe2 = {};
|
|
2472
|
-
t3(pe2, { ConfigSchema: () => ke2, LoopSchema: () => fe, MapSchema: () =>
|
|
2473
|
-
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(() =>
|
|
2479
|
+
t3(pe2, { ConfigSchema: () => ke2, LoopSchema: () => fe, MapSchema: () => be2, PolicySchema: () => ve2, ResultSchema: () => Ce2, RulePatchSchema: () => Se2, 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: () => je, valueJsonSchema: () => xe });
|
|
2480
|
+
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." });
|
|
2474
2481
|
me2 = n3.array(ue2).meta({ id: "MappingValues", title: "Mapping.Values", description: "Array of transformation values." }).describe("Array of transformation values");
|
|
2475
2482
|
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." });
|
|
2476
2483
|
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." });
|
|
2477
|
-
|
|
2478
|
-
|
|
2484
|
+
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." });
|
|
2485
|
+
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");
|
|
2479
2486
|
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)");
|
|
2480
|
-
|
|
2481
|
-
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:
|
|
2487
|
+
Se2 = 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");
|
|
2488
|
+
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: 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");
|
|
2482
2489
|
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*).');
|
|
2483
2490
|
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");
|
|
2484
2491
|
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");
|
|
2485
2492
|
xe = o2(ue2);
|
|
2486
|
-
|
|
2487
|
-
|
|
2488
|
-
|
|
2489
|
-
Ee2 = o2(
|
|
2493
|
+
je = o2(he2);
|
|
2494
|
+
Pe2 = o2(fe);
|
|
2495
|
+
De = o2(ge2);
|
|
2496
|
+
Ee2 = o2(be2);
|
|
2490
2497
|
Oe2 = o2(ve2);
|
|
2491
2498
|
Ie2 = o2(ye2);
|
|
2492
|
-
|
|
2493
|
-
|
|
2494
|
-
|
|
2495
|
-
t3(
|
|
2496
|
-
|
|
2497
|
-
t3(
|
|
2498
|
-
|
|
2499
|
-
$e2 = n3.object({ key: n3.string(), operator:
|
|
2499
|
+
Re3 = o2(we2);
|
|
2500
|
+
Je3 = o2(ke2);
|
|
2501
|
+
Me = {};
|
|
2502
|
+
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 });
|
|
2503
|
+
Te = {};
|
|
2504
|
+
t3(Te, { MatchExpressionSchema: () => Ae, RouteSchema: () => Be3, RouteWithoutManySchema: () => Ve3 });
|
|
2505
|
+
Fe3 = n3.enum(["eq", "contains", "prefix", "suffix", "regex", "gt", "lt", "exists"]).meta({ id: "MatcherOperator", title: "Matcher.Operator", description: "Supported operators for a match condition." });
|
|
2506
|
+
$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)." });
|
|
2500
2507
|
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)." });
|
|
2501
|
-
|
|
2502
|
-
|
|
2503
|
-
|
|
2508
|
+
ze2 = n3.strictObject({ match: Ae.optional(), next: n3.lazy(() => Be3) });
|
|
2509
|
+
Le2 = n3.strictObject({ match: Ae.optional(), one: n3.array(n3.lazy(() => Be3)) });
|
|
2510
|
+
qe2 = n3.strictObject({ match: Ae.optional(), many: n3.array(n3.lazy(() => Be3)) });
|
|
2504
2511
|
Ne3 = n3.strictObject({ match: Ae });
|
|
2505
|
-
We3 = n3.union([
|
|
2512
|
+
We3 = n3.union([ze2, Le2, qe2, Ne3]);
|
|
2506
2513
|
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)." });
|
|
2507
2514
|
Ue3 = n3.strictObject({ match: Ae.optional(), next: n3.lazy(() => Ve3) });
|
|
2508
|
-
|
|
2509
|
-
He2 = n3.union([Ue3,
|
|
2515
|
+
_e2 = n3.strictObject({ match: Ae.optional(), one: n3.array(n3.lazy(() => Ve3)) });
|
|
2516
|
+
He2 = n3.union([Ue3, _e2, Ne3]);
|
|
2510
2517
|
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." });
|
|
2511
2518
|
Ze3 = {};
|
|
2512
2519
|
t3(Ze3, { CacheRuleSchema: () => Ye3, CacheSchema: () => et3, EventCacheRuleSchema: () => Ge3, EventCacheSchema: () => Ke3, StoreCacheRuleSchema: () => Qe3, StoreCacheSchema: () => Xe3 });
|
|
@@ -2545,8 +2552,8 @@ var init_dev = __esm({
|
|
|
2545
2552
|
mt2 = n3.union([n3.unknown(), n3.array(n3.unknown())]).meta({ id: "DestinationData", title: "Destination.Data", description: "Transformed event data delivered to the destination (Property, undefined, or array)." }).optional().describe("Transformed event data (Property, undefined, or array)");
|
|
2546
2553
|
ft2 = n3.object({ config: ot2.describe("Destination configuration"), queue: n3.array(ee3).optional().describe("Queued events awaiting consent"), dlq: n3.array(n3.tuple([ee3, n3.unknown()])).optional().describe("Dead letter queue (failed events with errors)"), type: n3.string().optional().describe("Destination type identifier"), env: n3.unknown().optional().describe("Environment dependencies"), init: n3.unknown().optional().describe("Initialization function"), push: n3.unknown().describe("Push function for single events"), pushBatch: n3.unknown().optional().describe("Batch push function"), on: n3.unknown().optional().describe("Event lifecycle hook function") }).meta({ id: "DestinationInstance", title: "Destination.Instance", description: "Destination instance (runtime object with init/push/pushBatch/on)." }).describe("Destination instance (runtime object with functions)");
|
|
2547
2554
|
gt3 = n3.object({ code: ft2.describe("Destination instance with implementation"), config: rt2.optional().describe("Partial configuration overrides"), env: n3.unknown().optional().describe("Partial environment overrides") }).meta({ id: "DestinationInit", title: "Destination.Init", description: "Destination initialization bundle (instance code + config + env)." }).describe("Destination initialization configuration");
|
|
2548
|
-
|
|
2549
|
-
|
|
2555
|
+
bt3 = n3.record(n3.string(), gt3).meta({ id: "DestinationInitDestinations", title: "Destination.InitDestinations", description: "Map of destination IDs to initialization configurations." }).describe("Map of destination IDs to initialization configurations");
|
|
2556
|
+
ht3 = n3.record(n3.string(), ft2).meta({ id: "DestinationDestinations", title: "Destination.Destinations", description: "Map of destination IDs to runtime destination instances." }).describe("Map of destination IDs to runtime instances");
|
|
2550
2557
|
vt3 = n3.object({ type: n3.string().describe('Destination type ("gtag", "meta", "bigquery")'), data: n3.unknown().optional().describe("Response from push()"), error: n3.unknown().optional().describe("Error if failed") }).meta({ id: "DestinationRef", title: "Destination.Ref", description: "Reference to a destination outcome (type + response data or error)." }).describe("Destination reference with type and response data");
|
|
2551
2558
|
St3 = n3.object({ queue: n3.array(ee3).optional().describe("Events queued (awaiting consent)"), error: n3.unknown().optional().describe("Error if push failed") }).meta({ id: "DestinationPushResult", title: "Destination.PushResult", description: "Result of a single destination push (queued events, optional error)." }).describe("Push operation result");
|
|
2552
2559
|
yt2 = n3.object({ ok: n3.boolean().describe("True if nothing failed"), event: n3.unknown().optional().describe("The processed event"), done: n3.record(n3.string(), vt3).optional().describe("Destinations that processed successfully"), queued: n3.record(n3.string(), vt3).optional().describe("Destinations that queued events"), failed: n3.record(n3.string(), vt3).optional().describe("Destinations that failed to process") }).meta({ id: "DestinationResult", title: "Destination.Result", description: "Overall push result aggregated across all destinations (done/queued/failed maps)." }).describe("Push result with destination outcomes");
|
|
@@ -2557,37 +2564,37 @@ var init_dev = __esm({
|
|
|
2557
2564
|
jt3 = o2(ct2);
|
|
2558
2565
|
Pt = o2(ut2);
|
|
2559
2566
|
Dt2 = o2(ft2);
|
|
2560
|
-
|
|
2567
|
+
Et2 = o2(yt2);
|
|
2561
2568
|
Ot3 = {};
|
|
2562
|
-
t3(Ot3, { CommandTypeSchema: () =>
|
|
2563
|
-
|
|
2564
|
-
|
|
2565
|
-
|
|
2566
|
-
|
|
2567
|
-
|
|
2568
|
-
|
|
2569
|
-
$
|
|
2570
|
-
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:
|
|
2571
|
-
zt = o2(
|
|
2572
|
-
|
|
2573
|
-
qt2 = o2(
|
|
2574
|
-
|
|
2575
|
-
Wt2 = o2(
|
|
2576
|
-
|
|
2577
|
-
|
|
2578
|
-
t3(
|
|
2579
|
-
|
|
2580
|
-
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:
|
|
2569
|
+
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 });
|
|
2570
|
+
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");
|
|
2571
|
+
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");
|
|
2572
|
+
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");
|
|
2573
|
+
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");
|
|
2574
|
+
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");
|
|
2575
|
+
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");
|
|
2576
|
+
$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");
|
|
2577
|
+
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");
|
|
2578
|
+
zt = o2(It3);
|
|
2579
|
+
Lt2 = o2(Rt2);
|
|
2580
|
+
qt2 = o2(Jt2);
|
|
2581
|
+
Nt3 = o2(Mt2);
|
|
2582
|
+
Wt2 = o2(Tt2);
|
|
2583
|
+
Bt = o2(At3);
|
|
2584
|
+
Ut = {};
|
|
2585
|
+
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 });
|
|
2586
|
+
_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");
|
|
2587
|
+
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");
|
|
2581
2588
|
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");
|
|
2582
2589
|
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");
|
|
2583
2590
|
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>");
|
|
2584
|
-
|
|
2585
|
-
Qt = n3.record(n3.string(),
|
|
2586
|
-
Xt = o2(
|
|
2587
|
-
|
|
2591
|
+
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");
|
|
2592
|
+
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");
|
|
2593
|
+
Xt = o2(_t2);
|
|
2594
|
+
Yt2 = o2(Ht2);
|
|
2588
2595
|
ei = o2(Vt2);
|
|
2589
2596
|
ti = o2(Zt);
|
|
2590
|
-
ii = o2(
|
|
2597
|
+
ii = o2(Kt);
|
|
2591
2598
|
ni = o2(Qt);
|
|
2592
2599
|
oi = {};
|
|
2593
2600
|
t3(oi, { ConfigSchema: () => ri, PartialConfigSchema: () => ai, configJsonSchema: () => si, partialConfigJsonSchema: () => ci });
|
|
@@ -2602,12 +2609,12 @@ var init_dev = __esm({
|
|
|
2602
2609
|
ui = o2(di);
|
|
2603
2610
|
mi = o2(pi);
|
|
2604
2611
|
fi = {};
|
|
2605
|
-
t3(fi, { BundlePackageSchema: () => vi, BundleSchema: () => Si, CodeSchema: () => yi, ConfigSchema: () =>
|
|
2612
|
+
t3(fi, { BundlePackageSchema: () => vi, BundleSchema: () => Si, CodeSchema: () => yi, ConfigSchema: () => Ai, ContractActionsSchema: () => Ji, ContractEventsSchema: () => Mi, ContractRuleSchema: () => Ti, ContractSchema: () => Fi, ContractSchemaEntry: () => Ri, DestinationSchema: () => Oi, FlowSchema: () => zi, JsonSchema: () => Li, JsonSchemaSchema: () => xi, ObserveSchema: () => $i, SettingsSchema: () => bi, SourceSchema: () => Di, StepExampleSchema: () => ki, StepExamplesSchema: () => Ci, StoreSchema: () => Ii, TransformerSchema: () => Ei, TriggerDescriptorSchema: () => wi, ValidateEventsSchema: () => ji, VariablesSchema: () => gi, configJsonSchema: () => Ui, contractJsonSchema: () => Xi, contractRuleJsonSchema: () => Qi, destinationJsonSchema: () => Zi, flowConfigJsonSchema: () => Hi, flowJsonSchema: () => _i, parseConfig: () => qi, parseFlow: () => Wi, safeParseConfig: () => Ni, safeParseFlow: () => Bi, sourceJsonSchema: () => Vi, storeJsonSchema: () => Ki, transformerJsonSchema: () => Gi, validateEventsJsonSchema: () => Yi });
|
|
2606
2613
|
gi = n3.record(n3.string(), n3.unknown()).meta({ id: "FlowVariables", title: "Flow.Variables", description: "Reusable values referenced via $var.name (with optional deep paths). Whole-string refs preserve native type; inline interpolation requires scalars." });
|
|
2607
|
-
|
|
2608
|
-
|
|
2614
|
+
bi = n3.record(n3.string(), n3.unknown()).meta({ id: "FlowSettings", title: "Flow.Settings", description: "Free-form key-value settings consumed by the platform runtime." }).describe("Free-form platform settings bag");
|
|
2615
|
+
hi = /^(@[a-z0-9\-~][a-z0-9\-._~]*\/)?[a-z0-9\-~][a-z0-9\-._~]*$/;
|
|
2609
2616
|
vi = n3.object({ version: n3.string().optional(), imports: n3.array(n3.string()).optional(), path: n3.string().optional() }).meta({ id: "FlowBundlePackage", title: "Flow.BundlePackage", description: "Per-package bundle spec (version / imports / local path)." });
|
|
2610
|
-
Si = n3.object({ packages: n3.record(n3.string().regex(
|
|
2617
|
+
Si = n3.object({ packages: n3.record(n3.string().regex(hi, "Invalid npm package name"), vi).optional().describe("NPM packages to bundle, keyed by package name"), overrides: n3.record(n3.string().regex(hi, "Invalid npm package name"), n3.string().min(1, "Override version cannot be empty")).optional().describe("Transitive dependency version pins"), traceInclude: n3.array(n3.string()).optional().describe("Extra paths or globs the bundler must include in the trace output (server flows only)") }).strict().meta({ id: "FlowBundle", title: "Flow.Bundle", description: "Bundle configuration (packages + overrides + traceInclude)." }).describe("Bundle configuration (packages + overrides + traceInclude)");
|
|
2611
2618
|
yi = n3.object({ push: n3.string().min(1, "Push function cannot be empty").describe('JavaScript function for processing events. Must start with "$code:" prefix.'), type: n3.string().optional().describe("Optional type identifier for the inline instance"), init: n3.string().optional().describe("Optional initialization function. Use $code: prefix for inline JavaScript.") }).meta({ id: "FlowCode", title: "Flow.Code", description: "Inline code block (object form) for custom sources / transformers / destinations / stores. Use `import` on the step to select a named export from a package." }).describe("Inline code for custom components (object form)");
|
|
2612
2619
|
wi = n3.object({ type: n3.string().optional().describe("Trigger mechanism (e.g., click, POST, load)"), options: n3.unknown().optional().describe("Mechanism-specific options") }).meta({ id: "TriggerDescriptor", title: "Trigger.Descriptor", description: "Source trigger metadata (mechanism + options) used by step examples." });
|
|
2613
2620
|
ki = n3.object({ title: n3.string().optional().describe("Human-readable title (overrides default heading)"), description: n3.string().optional().describe("Human-readable description"), public: n3.boolean().optional().describe("Whether this example is shown in docs/UI/MCP default output (default: true). Set false for test-only fixtures."), in: n3.unknown().optional().describe("Input to the step"), trigger: wi.optional().describe("Source trigger metadata"), mapping: n3.unknown().optional().describe("Mapping configuration"), out: n3.unknown().optional().describe("Expected output from the step"), command: n3.enum(["config", "consent", "user", "run"]).optional().describe("Invoke elb('walker <command>', in) instead of pushing in as an event") }).meta({ id: "FlowStepExample", title: "Flow.StepExample", description: "Named example with input/output pair used for step testing." }).describe("Named example with input/output pair");
|
|
@@ -2618,41 +2625,42 @@ var init_dev = __esm({
|
|
|
2618
2625
|
Ei = n3.object({ package: n3.string().min(1, "Package name cannot be empty").optional().describe('Package specifier with optional version (e.g., "@walkeros/transformer-enricher@1.0.0")'), code: yi.optional().describe("Inline code definition (object form). For a named export from a package, use `import` instead."), import: n3.string().regex(/^[A-Za-z_$][A-Za-z0-9_$]*$/, "import must be a valid JavaScript identifier").optional().describe("Named export from `package` to import as this step's implementation. Top-level identifier only. Requires `package`. Mutually exclusive with `code`."), config: n3.unknown().meta({ id: "FlowTransformerConfig", title: "Transformer.Config", description: "Transformer-specific configuration object." }).optional().describe("Transformer-specific configuration object"), env: n3.unknown().meta({ id: "FlowTransformerEnv", title: "Transformer.Env", description: "Transformer environment configuration." }).optional().describe("Transformer environment configuration"), before: Be3.optional().describe("Pre-transformer chain. Runs before this transformer push function."), next: Be3.optional().describe("Next transformer in chain. String, string[], or Route[] for conditional routing."), variables: gi.optional().describe("Transformer-level variables (highest priority in cascade)"), examples: Ci.optional().describe("Named step examples for testing and documentation (stripped during bundling)"), cache: Ke3.optional().describe("Cache configuration for this transformer (match \u2192 key \u2192 ttl rules)") }).meta({ id: "FlowTransformer", title: "Flow.Transformer", description: "Transformer package reference with configuration, env, chains, and cache." }).describe("Transformer package reference with configuration").superRefine(Pi);
|
|
2619
2626
|
Oi = n3.object({ package: n3.string().min(1, "Package name cannot be empty").optional().describe('Package specifier with optional version (e.g., "@walkeros/web-destination-gtag@2.0.0")'), code: yi.optional().describe("Inline code definition (object form). For a named export from a package, use `import` instead."), import: n3.string().regex(/^[A-Za-z_$][A-Za-z0-9_$]*$/, "import must be a valid JavaScript identifier").optional().describe("Named export from `package` to import as this step's implementation. Top-level identifier only. Requires `package`. Mutually exclusive with `code`."), config: n3.looseObject({ setup: n3.union([n3.boolean(), n3.record(n3.string(), n3.unknown())]).optional().describe("One-time setup options applied during destination registration (boolean enables defaults, object configures specifics)") }).meta({ id: "FlowDestinationConfig", title: "Destination.Config", description: "Destination-specific configuration object." }).optional().describe("Destination-specific configuration object"), env: n3.unknown().meta({ id: "FlowDestinationEnv", title: "Destination.Env", description: "Destination environment configuration." }).optional().describe("Destination environment configuration"), variables: gi.optional().describe("Destination-level variables (highest priority in cascade)"), before: Ve3.optional().describe("Post-collector transformer chain. String, string[], or Route[] for conditional routing. `many` is not valid here \u2014 use multiple destinations for post-collector fan-out."), next: Ve3.optional().describe("Post-push transformer chain. Push response available at context.ingest._response. `many` is not valid here \u2014 use multiple destinations for post-collector fan-out."), examples: Ci.optional().describe("Named step examples for testing and documentation (stripped during bundling)"), cache: Ke3.optional().describe("Cache configuration for this destination (match \u2192 key \u2192 ttl rules)") }).meta({ id: "FlowDestination", title: "Flow.Destination", description: "Destination package reference with configuration, env, chains, and cache." }).describe("Destination package reference with configuration").superRefine(Pi);
|
|
2620
2627
|
Ii = n3.object({ package: n3.string().min(1, "Package name cannot be empty").optional().describe("Store package specifier with optional version"), code: yi.optional().describe("Inline code definition (object form). For a named export from a package, use `import` instead."), import: n3.string().regex(/^[A-Za-z_$][A-Za-z0-9_$]*$/, "import must be a valid JavaScript identifier").optional().describe("Named export from `package` to import as this step's implementation. Top-level identifier only. Requires `package`. Mutually exclusive with `code`."), config: n3.looseObject({ setup: n3.union([n3.boolean(), n3.record(n3.string(), n3.unknown())]).optional().describe("One-time setup options applied during store registration (boolean enables defaults, object configures specifics)") }).meta({ id: "FlowStoreConfig", title: "Store.Config", description: "Store-specific configuration object." }).optional().describe("Store-specific configuration object"), env: n3.unknown().meta({ id: "FlowStoreEnv", title: "Store.Env", description: "Store environment configuration." }).optional().describe("Store environment configuration"), cache: Xe3.optional().describe("Cache configuration for this store (TTL-only rules, optional recursive `cache.store`)"), variables: gi.optional().describe("Store-level variables (highest priority in cascade)"), examples: Ci.optional().describe("Named step examples for testing and documentation (stripped during bundling)") }).meta({ id: "FlowStore", title: "Flow.Store", description: "Store package reference with configuration, env, cache, and examples." }).describe("Store package reference with configuration").superRefine(Pi);
|
|
2621
|
-
|
|
2622
|
-
|
|
2623
|
-
Mi = n3.record(n3.string(),
|
|
2628
|
+
Ri = n3.record(n3.string(), n3.unknown()).meta({ id: "FlowContractSchemaEntry", title: "Flow.ContractSchemaEntry", description: "JSON Schema object for event validation with description/examples annotations." }).describe("JSON Schema object for event validation with description/examples annotations");
|
|
2629
|
+
Ji = n3.record(n3.string(), Ri).meta({ id: "FlowContractActions", title: "Flow.ContractActions", description: "Action-level contract entries keyed by action name." }).describe("Action-level contract entries");
|
|
2630
|
+
Mi = n3.record(n3.string(), Ji).meta({ id: "FlowContractEvents", title: "Flow.ContractEvents", description: "Entity-action event schemas (entity \u2192 action \u2192 schema)." }).describe("Entity-action event schemas");
|
|
2624
2631
|
Ti = n3.object({ extend: n3.string().optional(), tagging: n3.number().optional(), description: n3.string().optional(), events: ji.optional(), schema: xi.optional() }).meta({ id: "ContractRule", title: "Flow.ContractRule", description: "Named contract entry" });
|
|
2625
2632
|
Fi = n3.record(n3.string(), Ti).meta({ id: "FlowContract", title: "Flow.Contract", description: "Named contracts map with optional extend inheritance." }).describe("Named contracts with optional extend inheritance");
|
|
2626
|
-
$i = n3.object({
|
|
2627
|
-
Ai = n3.object({
|
|
2628
|
-
zi = n3.object({
|
|
2629
|
-
|
|
2630
|
-
Ui =
|
|
2631
|
-
_i = o2(
|
|
2632
|
-
Hi = o2(
|
|
2633
|
-
Vi = o2(
|
|
2634
|
-
Zi = o2(
|
|
2635
|
-
Gi = o2(
|
|
2636
|
-
Ki = o2(
|
|
2637
|
-
Qi = o2(
|
|
2638
|
-
Xi = o2(
|
|
2639
|
-
|
|
2640
|
-
tn2 =
|
|
2641
|
-
nn2 =
|
|
2642
|
-
on2 =
|
|
2643
|
-
|
|
2644
|
-
|
|
2645
|
-
|
|
2646
|
-
|
|
2647
|
-
|
|
2648
|
-
|
|
2649
|
-
|
|
2650
|
-
|
|
2651
|
-
|
|
2652
|
-
|
|
2653
|
-
|
|
2654
|
-
|
|
2655
|
-
|
|
2633
|
+
$i = n3.object({ level: n3.enum(["off", "standard", "trace"]).optional().describe("Managed-telemetry verbosity. 'off' disables telemetry entirely, 'standard' emits structural records, 'trace' emits full payloads."), sample: n3.number().min(0).max(1).optional().describe("Deterministic sample fraction in [0, 1]. Defaults to 1."), url: n3.string().min(1).optional().describe("Observer base URL for the web connect form. Public, safe to commit. Paired with binding."), binding: n3.string().min(1).optional().describe("Public project binding a web observe credential must match. Paired with url; public, safe to commit.") }).meta({ id: "FlowObserve", title: "Flow.Observe", description: "Observability configuration: public web connect pair (url + binding) and managed-telemetry knobs (level + sample)." }).describe("Observability configuration block");
|
|
2634
|
+
Ai = n3.object({ platform: n3.enum(["web", "server"]).describe("Platform identity for this flow. Drives bundle target/format."), url: n3.string().min(1).optional().describe("Public URL where this flow is reachable (for cross-flow $flow.X.url references)."), settings: bi.optional().describe("Free-form key-value settings consumed by the platform runtime."), bundle: Si.optional().describe("Bundle configuration: NPM packages, transitive dependency overrides."), observe: $i.optional().describe("Observability configuration: public web connect pair, managed-telemetry level and sample.") }).meta({ id: "FlowConfig", title: "Flow.Config", description: "Per-flow configuration block: platform identity, optional public URL, settings, bundle, observe." }).describe("Per-flow configuration block");
|
|
2635
|
+
zi = n3.object({ config: Ai.optional().describe("Per-flow configuration: platform, url, settings, bundle."), sources: n3.record(n3.string(), Di).optional().describe("Source configurations (data capture) keyed by unique identifier"), destinations: n3.record(n3.string(), Oi).optional().describe("Destination configurations (data output) keyed by unique identifier"), transformers: n3.record(n3.string(), Ei).optional().describe("Transformer configurations (event transformation) keyed by unique identifier"), stores: n3.record(n3.string(), Ii).optional().describe("Store configurations (key-value storage) keyed by unique identifier"), collector: n3.unknown().meta({ id: "FlowCollector", title: "Collector.InitConfig", description: "Collector configuration for event processing (Collector.InitConfig)." }).optional().describe("Collector configuration for event processing (uses Collector.InitConfig)"), variables: gi.optional().describe("Flow-level variables (override root variables, overridden by source/destination variables)") }).meta({ id: "Flow", title: "Flow", description: "Single flow definition (one deployment target): config, sources, destinations, transformers, stores, collector." }).describe("Single flow definition for one deployment target");
|
|
2636
|
+
Li = n3.object({ version: n3.literal(4).describe("Configuration schema version (v4, current)."), $schema: n3.string().url("Schema URL must be a valid URL").optional().describe('JSON Schema reference for IDE validation (e.g., "https://walkeros.io/schema/flow/v4.json")'), include: n3.array(n3.string()).optional().describe("Folders to include in the bundle output"), variables: gi.optional().describe("Shared variables for interpolation across all flows (use $var.name syntax, deep paths supported)"), contract: Fi.optional().describe("Named contracts with extend inheritance and dot-path references"), flows: n3.record(n3.string(), zi).refine((e4) => Object.keys(e4).length > 0, { message: "At least one flow is required" }).describe("Named flow configurations (e.g., production, staging, development)") }).meta({ id: "FlowJson", title: "Flow.Json", description: "walkerOS root configuration (walkeros.config.json) v4: version, variables, contract, named flows." }).describe("walkerOS root configuration (walkeros.config.json)");
|
|
2637
|
+
Ui = n3.toJSONSchema(Li, { target: "draft-7" });
|
|
2638
|
+
_i = o2(zi);
|
|
2639
|
+
Hi = o2(Ai);
|
|
2640
|
+
Vi = o2(Di);
|
|
2641
|
+
Zi = o2(Oi);
|
|
2642
|
+
Gi = o2(Ei);
|
|
2643
|
+
Ki = o2(Ii);
|
|
2644
|
+
Qi = o2(Ti);
|
|
2645
|
+
Xi = o2(Fi);
|
|
2646
|
+
Yi = o2(ji);
|
|
2647
|
+
tn2 = en.object({ lang: en.string().optional().describe("Language identifier (e.g. json, sql, bash, typescript)"), code: en.string().describe("Code snippet") });
|
|
2648
|
+
nn2 = en.object({ text: en.string().describe("Short actionable hint text focused on walkerOS usage"), code: en.array(tn2).optional().describe("Optional code snippets") });
|
|
2649
|
+
on2 = en.record(en.string(), nn2).describe("Keyed hints for AI consumption \u2014 lightweight context beyond schemas and examples");
|
|
2650
|
+
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).") });
|
|
2651
|
+
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");
|
|
2652
|
+
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");
|
|
2653
|
+
cn = o2(sn2);
|
|
2654
|
+
dn = /* @__PURE__ */ new Set(["description", "examples", "title", "$comment"]);
|
|
2655
|
+
bn3 = /\$store\.([a-zA-Z_][a-zA-Z0-9_]*)/g;
|
|
2656
|
+
hn2 = /\$env\.([A-Za-z_]\w*)(=[^"}\s]*)?/g;
|
|
2657
|
+
vn3 = /\$flow\.([a-zA-Z_][a-zA-Z0-9_]*)(?:\.([a-zA-Z0-9_.]+))?/g;
|
|
2658
|
+
Sn2 = /\$(var|store|flow|secret):([a-zA-Z_][a-zA-Z0-9_]*)/g;
|
|
2659
|
+
yn3 = /\$secret\.([A-Z0-9_]+)/g;
|
|
2660
|
+
wn3 = ["@walkeros/server-store-fs", "@walkeros/server-store-s3", "@walkeros/server-store-gcs"];
|
|
2661
|
+
kn3 = "@walkeros/server-transformer-file";
|
|
2662
|
+
Cn3 = /^\$store\.([a-zA-Z_][a-zA-Z0-9_]*)$/;
|
|
2663
|
+
Wn = { source: Ut.configJsonSchema, destination: Me.configJsonSchema, store: li.configJsonSchema };
|
|
2656
2664
|
}
|
|
2657
2665
|
});
|
|
2658
2666
|
|
|
@@ -3094,7 +3102,7 @@ function hasCodeReference(code) {
|
|
|
3094
3102
|
}
|
|
3095
3103
|
function validateReference(type, name, ref) {
|
|
3096
3104
|
if (type === "Transformer") {
|
|
3097
|
-
const r6 =
|
|
3105
|
+
const r6 = ur({ ...ref }, "Transformer");
|
|
3098
3106
|
if (!r6.ok) {
|
|
3099
3107
|
throw new Error(`Transformer "${name}": ${r6.reason ?? "invalid entry."}`);
|
|
3100
3108
|
}
|
|
@@ -3271,7 +3279,7 @@ function describeError(error) {
|
|
|
3271
3279
|
function withSignal(opts, signal) {
|
|
3272
3280
|
return { ...opts, signal };
|
|
3273
3281
|
}
|
|
3274
|
-
async function withPacoteRetry(
|
|
3282
|
+
async function withPacoteRetry(fn2, label, options = {}) {
|
|
3275
3283
|
const attempts = options.attempts ?? PACOTE_RETRY_ATTEMPTS;
|
|
3276
3284
|
const perAttemptTimeoutMs = options.perAttemptTimeoutMs ?? PACOTE_PER_ATTEMPT_TIMEOUT_MS;
|
|
3277
3285
|
const maxTotalMs = options.maxTotalMs ?? PACOTE_MAX_TOTAL_MS;
|
|
@@ -3286,7 +3294,7 @@ async function withPacoteRetry(fn3, label, options = {}) {
|
|
|
3286
3294
|
const controller = new AbortController();
|
|
3287
3295
|
const timeoutId = setTimeout(() => controller.abort(), attemptTimeoutMs);
|
|
3288
3296
|
try {
|
|
3289
|
-
return await
|
|
3297
|
+
return await fn2(controller.signal);
|
|
3290
3298
|
} catch (error) {
|
|
3291
3299
|
lastError = error;
|
|
3292
3300
|
if (isPermanentError(error)) throw error;
|
|
@@ -4378,7 +4386,8 @@ ${dataDeclaration}`;
|
|
|
4378
4386
|
const stage2Entry = (buildOptions.platform || "node") === "browser" ? generateWebEntry(stage1Path, dataPayload, {
|
|
4379
4387
|
windowCollector: buildOptions.windowCollector,
|
|
4380
4388
|
windowElb: buildOptions.windowElb,
|
|
4381
|
-
platform: buildOptions.platform
|
|
4389
|
+
platform: buildOptions.platform,
|
|
4390
|
+
observe: readObserveConnect(flowSettings, logger)
|
|
4382
4391
|
}) : generateServerEntry(stage1Path, dataPayload);
|
|
4383
4392
|
const stage2EntryPath = path12.join(TEMP_DIR, "stage2.mjs");
|
|
4384
4393
|
await fs11.writeFile(stage2EntryPath, stage2Entry);
|
|
@@ -4991,12 +5000,12 @@ function buildSplitConfigObject(flowSettings, namedImports) {
|
|
|
4991
5000
|
return buildSplitStepEntry("destinations", key, dest);
|
|
4992
5001
|
});
|
|
4993
5002
|
const transformersEntries = Object.entries(transformers).filter(
|
|
4994
|
-
([, transformer]) => transformer.package || hasCodeReference2(transformer.code) ||
|
|
5003
|
+
([, transformer]) => transformer.package || hasCodeReference2(transformer.code) || fr({ ...transformer }, "Transformer")
|
|
4995
5004
|
).map(([key, transformer]) => {
|
|
4996
5005
|
if (isInlineCode2(transformer.code)) {
|
|
4997
5006
|
return ` ${key}: ${generateInlineCode(transformer.code, transformer.config || {}, transformer.env, { before: transformer.before, next: transformer.next })}`;
|
|
4998
5007
|
}
|
|
4999
|
-
if (
|
|
5008
|
+
if (fr({ ...transformer }, "Transformer")) {
|
|
5000
5009
|
const chainLines = [];
|
|
5001
5010
|
if (transformer.before !== void 0) {
|
|
5002
5011
|
chainLines.push(`before: ${JSON.stringify(transformer.before)}`);
|
|
@@ -5134,7 +5143,42 @@ export default async function(context = {}) {
|
|
|
5134
5143
|
return { ...result, httpHandler: httpSource ? httpSource.httpHandler : undefined };
|
|
5135
5144
|
}`;
|
|
5136
5145
|
}
|
|
5146
|
+
function readObserveConnect(flowSettings, logger) {
|
|
5147
|
+
const observe = flowSettings.config?.observe;
|
|
5148
|
+
if (!observe) return void 0;
|
|
5149
|
+
const { url, binding } = observe;
|
|
5150
|
+
if (url === void 0 && binding === void 0) return void 0;
|
|
5151
|
+
const trimmedUrl = typeof url === "string" ? url.trim() : "";
|
|
5152
|
+
const trimmedBinding = typeof binding === "string" ? binding.trim() : "";
|
|
5153
|
+
if (trimmedUrl !== "" && trimmedBinding !== "") {
|
|
5154
|
+
return { url: trimmedUrl, binding: trimmedBinding };
|
|
5155
|
+
}
|
|
5156
|
+
const missing = [
|
|
5157
|
+
...trimmedUrl === "" ? ["url"] : [],
|
|
5158
|
+
...trimmedBinding === "" ? ["binding"] : []
|
|
5159
|
+
].join(" and ");
|
|
5160
|
+
logger?.warn(
|
|
5161
|
+
`config.observe has no effect: missing or empty ${missing}. Observe connect wiring was skipped; set both config.observe.url and config.observe.binding to non-empty public values.`
|
|
5162
|
+
);
|
|
5163
|
+
return void 0;
|
|
5164
|
+
}
|
|
5165
|
+
function emitObserveAssignment(observe) {
|
|
5166
|
+
const literal = {
|
|
5167
|
+
url: observe.url,
|
|
5168
|
+
binding: observe.binding,
|
|
5169
|
+
...observe.flowId !== void 0 ? { flowId: observe.flowId } : {},
|
|
5170
|
+
...observe.level !== void 0 ? { level: observe.level } : {},
|
|
5171
|
+
...observe.sample !== void 0 ? { sample: observe.sample } : {}
|
|
5172
|
+
};
|
|
5173
|
+
return `
|
|
5174
|
+
config.observe = ${JSON.stringify(literal)};`;
|
|
5175
|
+
}
|
|
5137
5176
|
function generateWebEntry(stage1Path, dataPayload, options = {}) {
|
|
5177
|
+
if (options.observe !== void 0 && options.telemetry !== void 0) {
|
|
5178
|
+
throw new Error(
|
|
5179
|
+
"generateWebEntry: `observe` (bake-nothing connect module) and `telemetry` (baked ingest token) are mutually exclusive observer wirings. Pass `observe` alone; the per-session credential arrives out-of-band at boot instead of being baked."
|
|
5180
|
+
);
|
|
5181
|
+
}
|
|
5138
5182
|
const assignments = [];
|
|
5139
5183
|
if (options.windowCollector) {
|
|
5140
5184
|
assignments.push(
|
|
@@ -5154,6 +5198,7 @@ function generateWebEntry(stage1Path, dataPayload, options = {}) {
|
|
|
5154
5198
|
}
|
|
5155
5199
|
}` : "";
|
|
5156
5200
|
const stage1Specifier = toFileImportSpecifier(stage1Path);
|
|
5201
|
+
const observeBlock = options.observe ? emitObserveAssignment(options.observe) : "";
|
|
5157
5202
|
const telemetryImport = options.telemetry ? `
|
|
5158
5203
|
import { createBatchedPoster as __cbp, createTelemetryObserver as __cto } from '@walkeros/core';` : "";
|
|
5159
5204
|
const telemetryBlock = options.telemetry ? `
|
|
@@ -5176,7 +5221,7 @@ import { createBatchedPoster as __cbp, createTelemetryObserver as __cto } from '
|
|
|
5176
5221
|
const __configData = ${dataPayload};
|
|
5177
5222
|
|
|
5178
5223
|
(async () => {
|
|
5179
|
-
const config = wireConfig(__configData);${envBlock}
|
|
5224
|
+
const config = wireConfig(__configData);${envBlock}${observeBlock}
|
|
5180
5225
|
const { collector, elb } = await startFlow(config);${telemetryBlock}${assignmentCode}
|
|
5181
5226
|
})();`;
|
|
5182
5227
|
}
|
|
@@ -5921,9 +5966,9 @@ async function deleteProject(options = {}) {
|
|
|
5921
5966
|
if (getDefaultProject() === id) clearDefaultProject();
|
|
5922
5967
|
return data ?? { success: true };
|
|
5923
5968
|
}
|
|
5924
|
-
async function handleResult(
|
|
5969
|
+
async function handleResult(fn2, options) {
|
|
5925
5970
|
try {
|
|
5926
|
-
const result = await
|
|
5971
|
+
const result = await fn2();
|
|
5927
5972
|
await writeResult(JSON.stringify(result, null, 2), options);
|
|
5928
5973
|
} catch (error) {
|
|
5929
5974
|
handleCliError(error);
|
|
@@ -6064,9 +6109,9 @@ async function duplicateFlow(options) {
|
|
|
6064
6109
|
if (error) throwApiError(error, "Failed to duplicate flow");
|
|
6065
6110
|
return data;
|
|
6066
6111
|
}
|
|
6067
|
-
async function handleResult2(
|
|
6112
|
+
async function handleResult2(fn2, options) {
|
|
6068
6113
|
try {
|
|
6069
|
-
const result = await
|
|
6114
|
+
const result = await fn2();
|
|
6070
6115
|
await writeResult(JSON.stringify(result, null, 2), options);
|
|
6071
6116
|
} catch (error) {
|
|
6072
6117
|
handleCliError(error);
|
|
@@ -6315,6 +6360,193 @@ var init_output2 = __esm({
|
|
|
6315
6360
|
}
|
|
6316
6361
|
});
|
|
6317
6362
|
|
|
6363
|
+
// src/commands/observe/index.ts
|
|
6364
|
+
var observe_exports = {};
|
|
6365
|
+
__export(observe_exports, {
|
|
6366
|
+
formatObserveSession: () => formatObserveSession,
|
|
6367
|
+
getObserveSession: () => getObserveSession,
|
|
6368
|
+
observeStartCommand: () => observeStartCommand,
|
|
6369
|
+
startObserveSession: () => startObserveSession,
|
|
6370
|
+
waitForObserveSessionSettled: () => waitForObserveSessionSettled
|
|
6371
|
+
});
|
|
6372
|
+
async function startObserveSession(options) {
|
|
6373
|
+
const pid = options.projectId ?? requireProjectId();
|
|
6374
|
+
const body = {
|
|
6375
|
+
settingsName: options.settingsName,
|
|
6376
|
+
...options.force ? { force: true } : {}
|
|
6377
|
+
};
|
|
6378
|
+
const response = await apiFetch(
|
|
6379
|
+
`/api/projects/${pid}/flows/${options.flowId}/observe-sessions`,
|
|
6380
|
+
{
|
|
6381
|
+
method: "POST",
|
|
6382
|
+
headers: { "Content-Type": "application/json" },
|
|
6383
|
+
body: JSON.stringify(body)
|
|
6384
|
+
}
|
|
6385
|
+
);
|
|
6386
|
+
if (!response.ok) {
|
|
6387
|
+
const errorBody = await response.json().catch(() => ({}));
|
|
6388
|
+
throwApiResponseError(
|
|
6389
|
+
response,
|
|
6390
|
+
errorBody,
|
|
6391
|
+
"Failed to start observe session"
|
|
6392
|
+
);
|
|
6393
|
+
}
|
|
6394
|
+
return response.json();
|
|
6395
|
+
}
|
|
6396
|
+
async function getObserveSession(options) {
|
|
6397
|
+
const pid = options.projectId ?? requireProjectId();
|
|
6398
|
+
const response = await apiFetch(
|
|
6399
|
+
`/api/projects/${pid}/flows/${options.flowId}/observe-sessions/${options.sessionId}`
|
|
6400
|
+
);
|
|
6401
|
+
if (!response.ok) {
|
|
6402
|
+
const errorBody = await response.json().catch(() => ({}));
|
|
6403
|
+
throwApiResponseError(response, errorBody, "Failed to get observe session");
|
|
6404
|
+
}
|
|
6405
|
+
return response.json();
|
|
6406
|
+
}
|
|
6407
|
+
async function waitForObserveSessionSettled(options) {
|
|
6408
|
+
const deadline = Date.now() + options.timeoutMs;
|
|
6409
|
+
for (; ; ) {
|
|
6410
|
+
const session = await getObserveSession(options);
|
|
6411
|
+
if (session.status !== "arming" || Date.now() >= deadline) return session;
|
|
6412
|
+
await new Promise((resolve4) => setTimeout(resolve4, options.pollIntervalMs));
|
|
6413
|
+
}
|
|
6414
|
+
}
|
|
6415
|
+
function formatObserveSession(session) {
|
|
6416
|
+
const arming = session.status === "arming";
|
|
6417
|
+
const lines = [`Observe session ${session.id} (${session.status})`];
|
|
6418
|
+
if (session.errorMessage) lines.push(` Error: ${session.errorMessage}`);
|
|
6419
|
+
lines.push("");
|
|
6420
|
+
if (session.web) {
|
|
6421
|
+
lines.push(" Web");
|
|
6422
|
+
lines.push(` Preview: ${session.web.previewId}`);
|
|
6423
|
+
lines.push(` Token: ${session.web.token}`);
|
|
6424
|
+
lines.push(` Bundle URL: ${session.web.bundleUrl}`);
|
|
6425
|
+
lines.push(
|
|
6426
|
+
session.web.previewEnabled ? " Activate: open the Observe window in the app to mint the activation link (app-signed; the CLI cannot build it from the token)" : " Activate: not available: the deployed web bundle cannot verify activation grants (redeploy the web flow first)"
|
|
6427
|
+
);
|
|
6428
|
+
} else {
|
|
6429
|
+
lines.push(` Web: no web part${arming ? " yet (still arming)" : ""}`);
|
|
6430
|
+
}
|
|
6431
|
+
lines.push("");
|
|
6432
|
+
if (session.serverEndpoint) {
|
|
6433
|
+
lines.push(" Server");
|
|
6434
|
+
if (session.serverFlowName) {
|
|
6435
|
+
lines.push(` Flow: ${session.serverFlowName}`);
|
|
6436
|
+
}
|
|
6437
|
+
lines.push(` Endpoint: ${session.serverEndpoint}`);
|
|
6438
|
+
} else {
|
|
6439
|
+
lines.push(
|
|
6440
|
+
` Server: no live endpoint${arming ? " yet (still arming)" : ""}`
|
|
6441
|
+
);
|
|
6442
|
+
}
|
|
6443
|
+
lines.push("");
|
|
6444
|
+
lines.push(
|
|
6445
|
+
" The session lives server-side; closing this terminal does not end it."
|
|
6446
|
+
);
|
|
6447
|
+
return {
|
|
6448
|
+
stdoutLast: session.serverEndpoint ?? null,
|
|
6449
|
+
stderr: lines.join("\n")
|
|
6450
|
+
};
|
|
6451
|
+
}
|
|
6452
|
+
function printLoginCta() {
|
|
6453
|
+
process.stderr.write(
|
|
6454
|
+
[
|
|
6455
|
+
"Not logged in.",
|
|
6456
|
+
"",
|
|
6457
|
+
"Starting an observe session needs a walkerOS account.",
|
|
6458
|
+
" 1. Run: walkeros auth login (opens the browser; creates your account if you do not have one)",
|
|
6459
|
+
" 2. Re-run: walkeros observe start <flowId>",
|
|
6460
|
+
""
|
|
6461
|
+
].join("\n") + "\n"
|
|
6462
|
+
);
|
|
6463
|
+
}
|
|
6464
|
+
async function resolveSingleSettingsName(options) {
|
|
6465
|
+
const flow = await getFlow(options);
|
|
6466
|
+
const settings = flow.settings ?? [];
|
|
6467
|
+
const only = settings[0];
|
|
6468
|
+
if (!only) throw new Error("Flow has no settings.");
|
|
6469
|
+
if (settings.length > 1) {
|
|
6470
|
+
throw new Error(
|
|
6471
|
+
`This flow has multiple settings. Use --flow <name> to specify one.
|
|
6472
|
+
Available: ${settings.map((entry) => entry.name).join(", ")}`
|
|
6473
|
+
);
|
|
6474
|
+
}
|
|
6475
|
+
return only.name;
|
|
6476
|
+
}
|
|
6477
|
+
async function observeStartCommand(flowId, options) {
|
|
6478
|
+
try {
|
|
6479
|
+
if (!resolveToken()?.token) {
|
|
6480
|
+
printLoginCta();
|
|
6481
|
+
return;
|
|
6482
|
+
}
|
|
6483
|
+
if (options.level !== void 0) {
|
|
6484
|
+
process.stderr.write(
|
|
6485
|
+
"Note: --level is not supported by the current API contract; starting without it.\n"
|
|
6486
|
+
);
|
|
6487
|
+
}
|
|
6488
|
+
let timeoutSeconds = DEFAULT_WAIT_SECONDS;
|
|
6489
|
+
if (options.timeout !== void 0) {
|
|
6490
|
+
timeoutSeconds = parseInt(options.timeout, 10);
|
|
6491
|
+
if (Number.isNaN(timeoutSeconds) || timeoutSeconds < 0) {
|
|
6492
|
+
throw new Error(
|
|
6493
|
+
`Invalid --timeout value: ${options.timeout} (expected a non-negative number of seconds)`
|
|
6494
|
+
);
|
|
6495
|
+
}
|
|
6496
|
+
}
|
|
6497
|
+
const projectId = options.project ?? requireProjectId();
|
|
6498
|
+
const settingsName = options.flow ?? await resolveSingleSettingsName({ projectId, flowId });
|
|
6499
|
+
let session = await startObserveSession({
|
|
6500
|
+
projectId,
|
|
6501
|
+
flowId,
|
|
6502
|
+
settingsName,
|
|
6503
|
+
force: options.replace === true
|
|
6504
|
+
});
|
|
6505
|
+
let timedOut = false;
|
|
6506
|
+
if (options.wait !== false) {
|
|
6507
|
+
session = await waitForObserveSessionSettled({
|
|
6508
|
+
projectId,
|
|
6509
|
+
flowId,
|
|
6510
|
+
sessionId: session.id,
|
|
6511
|
+
timeoutMs: timeoutSeconds * 1e3,
|
|
6512
|
+
pollIntervalMs: options.pollIntervalMs ?? DEFAULT_POLL_INTERVAL_MS2
|
|
6513
|
+
});
|
|
6514
|
+
timedOut = session.status === "arming";
|
|
6515
|
+
}
|
|
6516
|
+
if (options.json) {
|
|
6517
|
+
await writeResult(JSON.stringify(session, null, 2), {});
|
|
6518
|
+
} else {
|
|
6519
|
+
const { stdoutLast, stderr } = formatObserveSession(session);
|
|
6520
|
+
process.stderr.write(stderr + "\n");
|
|
6521
|
+
if (stdoutLast) process.stdout.write(stdoutLast + "\n");
|
|
6522
|
+
}
|
|
6523
|
+
if (timedOut) {
|
|
6524
|
+
process.stderr.write(
|
|
6525
|
+
`Timed out after ${timeoutSeconds}s: the session is still arming. It keeps arming server-side; check it in the app or re-run walkeros observe start.
|
|
6526
|
+
`
|
|
6527
|
+
);
|
|
6528
|
+
process.exitCode = 1;
|
|
6529
|
+
}
|
|
6530
|
+
if (session.status === "failed") process.exitCode = 1;
|
|
6531
|
+
} catch (error) {
|
|
6532
|
+
handleCliError(error);
|
|
6533
|
+
}
|
|
6534
|
+
}
|
|
6535
|
+
var DEFAULT_WAIT_SECONDS, DEFAULT_POLL_INTERVAL_MS2;
|
|
6536
|
+
var init_observe = __esm({
|
|
6537
|
+
"src/commands/observe/index.ts"() {
|
|
6538
|
+
"use strict";
|
|
6539
|
+
init_auth();
|
|
6540
|
+
init_http();
|
|
6541
|
+
init_api_error();
|
|
6542
|
+
init_output();
|
|
6543
|
+
init_config_file();
|
|
6544
|
+
init_flows();
|
|
6545
|
+
DEFAULT_WAIT_SECONDS = 300;
|
|
6546
|
+
DEFAULT_POLL_INTERVAL_MS2 = 3e3;
|
|
6547
|
+
}
|
|
6548
|
+
});
|
|
6549
|
+
|
|
6318
6550
|
// src/cli.ts
|
|
6319
6551
|
import { Command } from "commander";
|
|
6320
6552
|
|
|
@@ -6373,6 +6605,7 @@ init_dist();
|
|
|
6373
6605
|
init_dist();
|
|
6374
6606
|
init_dist();
|
|
6375
6607
|
init_dist();
|
|
6608
|
+
init_dist();
|
|
6376
6609
|
var t2 = { Action: "action", Actions: "actions", Config: "config", Consent: "consent", Context: "context", Custom: "custom", Destination: "destination", Elb: "elb", Globals: "globals", Hook: "hook", Init: "init", Link: "link", On: "on", Prefix: "data-elb", Ready: "ready", Run: "run", Scoped: "_", Session: "session", Shutdown: "shutdown", User: "user", Walker: "walker" };
|
|
6377
6610
|
var n = { Commands: t2, Utils: { Storage: { Cookie: "cookie", Local: "local", Session: "session" } } };
|
|
6378
6611
|
function r2(e4, t4) {
|
|
@@ -6381,17 +6614,17 @@ function r2(e4, t4) {
|
|
|
6381
6614
|
n5[e5] = !!t5;
|
|
6382
6615
|
}), e4.consent = oe(e4.consent, n5), { update: n5 };
|
|
6383
6616
|
}
|
|
6384
|
-
function
|
|
6617
|
+
function T2(e4, t4, n5) {
|
|
6385
6618
|
return { traceId: e4.source?.trace ?? t4?._meta.trace ?? n5.trace, sourceId: t4?._meta.path[0], parentEventId: t4?._meta.parentEventId };
|
|
6386
6619
|
}
|
|
6387
|
-
function
|
|
6620
|
+
function _(e4, t4) {
|
|
6388
6621
|
const n5 = e4.status.startedAt, o4 = { flowId: e4.name ?? "default", stepId: t4.stepId, stepType: t4.stepType, phase: t4.phase, eventId: t4.eventId, timestamp: new Date(t4.now).toISOString(), elapsedMs: t4.now - n5 };
|
|
6389
6622
|
return t4.traceId && (o4.traceId = t4.traceId), t4.sourceId && (o4.sourceId = t4.sourceId), t4.parentEventId && (o4.parentEventId = t4.parentEventId), o4;
|
|
6390
6623
|
}
|
|
6391
|
-
function
|
|
6624
|
+
function z2(e4) {
|
|
6392
6625
|
return "object" == typeof e4 && null !== e4;
|
|
6393
6626
|
}
|
|
6394
|
-
function
|
|
6627
|
+
function U2(e4, t4, n5) {
|
|
6395
6628
|
if (null === e4 || "object" != typeof e4) return e4;
|
|
6396
6629
|
if (n5 >= 8) return e4;
|
|
6397
6630
|
const o4 = t4.get(e4);
|
|
@@ -6399,18 +6632,18 @@ function T2(e4, t4, n5) {
|
|
|
6399
6632
|
if (Array.isArray(e4)) {
|
|
6400
6633
|
const o5 = [];
|
|
6401
6634
|
t4.set(e4, o5);
|
|
6402
|
-
for (const r7 of e4) o5.push(
|
|
6635
|
+
for (const r7 of e4) o5.push(U2(r7, t4, n5 + 1));
|
|
6403
6636
|
return o5;
|
|
6404
6637
|
}
|
|
6405
6638
|
const r6 = {};
|
|
6406
6639
|
t4.set(e4, r6);
|
|
6407
|
-
for (const [o5, s4] of Object.entries(e4)) r6[o5] = "function" == typeof s4 ? s4 :
|
|
6640
|
+
for (const [o5, s4] of Object.entries(e4)) r6[o5] = "function" == typeof s4 ? s4 : U2(s4, t4, n5 + 1);
|
|
6408
6641
|
return r6;
|
|
6409
6642
|
}
|
|
6410
|
-
function
|
|
6411
|
-
const t4 = [], n5 = [], { simulation: o4, ...r6 } = e4, s4 =
|
|
6643
|
+
function K2(e4) {
|
|
6644
|
+
const t4 = [], n5 = [], { simulation: o4, ...r6 } = e4, s4 = U2(r6, /* @__PURE__ */ new WeakMap(), 0);
|
|
6412
6645
|
for (const e5 of o4) {
|
|
6413
|
-
const o5 =
|
|
6646
|
+
const o5 = Sn(e5);
|
|
6414
6647
|
if (0 === o5.length) continue;
|
|
6415
6648
|
const r7 = o5.join(".");
|
|
6416
6649
|
if (o5.length - 1 >= 8) {
|
|
@@ -6420,7 +6653,7 @@ function _(e4) {
|
|
|
6420
6653
|
let a4 = s4, i5 = true;
|
|
6421
6654
|
for (let e6 = 0; e6 < o5.length - 1; e6++) {
|
|
6422
6655
|
const t5 = a4[o5[e6]];
|
|
6423
|
-
if (!
|
|
6656
|
+
if (!z2(t5)) {
|
|
6424
6657
|
i5 = false;
|
|
6425
6658
|
break;
|
|
6426
6659
|
}
|
|
@@ -6438,14 +6671,14 @@ function _(e4) {
|
|
|
6438
6671
|
}
|
|
6439
6672
|
return { wrappedEnv: s4, calls: t4, unresolved: n5 };
|
|
6440
6673
|
}
|
|
6441
|
-
function
|
|
6674
|
+
function B(e4, t4) {
|
|
6442
6675
|
try {
|
|
6443
6676
|
return e4[t4];
|
|
6444
6677
|
} catch {
|
|
6445
6678
|
return "[unreadable]";
|
|
6446
6679
|
}
|
|
6447
6680
|
}
|
|
6448
|
-
function
|
|
6681
|
+
function F2(e4) {
|
|
6449
6682
|
const t4 = /* @__PURE__ */ new WeakSet(), n5 = (e5, o4) => {
|
|
6450
6683
|
if (null === e5) return null;
|
|
6451
6684
|
if ("function" == typeof e5) return "[function]";
|
|
@@ -6465,7 +6698,7 @@ function z2(e4) {
|
|
|
6465
6698
|
return t5 === Object.prototype || null === t5;
|
|
6466
6699
|
})(r6)) {
|
|
6467
6700
|
const e6 = {};
|
|
6468
|
-
for (const t5 of Object.keys(r6)) e6[t5] = n5(
|
|
6701
|
+
for (const t5 of Object.keys(r6)) e6[t5] = n5(B(r6, t5), o4 + 1);
|
|
6469
6702
|
s4 = e6;
|
|
6470
6703
|
} else s4 = (function(e6) {
|
|
6471
6704
|
try {
|
|
@@ -6481,60 +6714,60 @@ function z2(e4) {
|
|
|
6481
6714
|
};
|
|
6482
6715
|
return e4.map((e5) => n5(e5, 0));
|
|
6483
6716
|
}
|
|
6484
|
-
function
|
|
6485
|
-
return e4.map((e5) => ({ fn: e5.fn, args:
|
|
6717
|
+
function R2(e4) {
|
|
6718
|
+
return e4.map((e5) => ({ fn: e5.fn, args: F2(e5.args), ts: e5.ts }));
|
|
6486
6719
|
}
|
|
6487
|
-
function
|
|
6720
|
+
function N(e4, t4, n5, o4) {
|
|
6488
6721
|
if (!Number.isFinite(n5.max) || n5.max <= 0) throw new Error(`pushBounded: max must be > 0 (got ${n5.max})`);
|
|
6489
6722
|
if ("dropNewest" === (n5.onOverflow ?? "dropOldest")) return e4.length >= n5.max ? (o4 && o4([t4]), { appended: false, dropped: 1 }) : (e4.push(t4), { appended: true, dropped: 0 });
|
|
6490
6723
|
const r6 = [];
|
|
6491
6724
|
for (; e4.length >= n5.max; ) r6.push(e4.shift());
|
|
6492
6725
|
return e4.push(t4), r6.length > 0 && o4 && o4(r6), { appended: true, dropped: r6.length };
|
|
6493
6726
|
}
|
|
6494
|
-
var
|
|
6495
|
-
function
|
|
6496
|
-
|
|
6727
|
+
var Y2 = /* @__PURE__ */ new WeakMap();
|
|
6728
|
+
function J2(e4, t4, n5, o4) {
|
|
6729
|
+
Y2.get(e4) || (Y2.set(e4, true), t4.warn(n5, o4));
|
|
6497
6730
|
}
|
|
6498
|
-
function
|
|
6499
|
-
|
|
6731
|
+
function X2(e4) {
|
|
6732
|
+
Y2.delete(e4);
|
|
6500
6733
|
}
|
|
6501
|
-
var
|
|
6502
|
-
var
|
|
6503
|
-
function
|
|
6504
|
-
if (void 0 !== e4) return "number" == typeof e4 ? { threshold: e4, cooldown:
|
|
6734
|
+
var Z = 3e4;
|
|
6735
|
+
var ee2 = () => Date.now();
|
|
6736
|
+
function te2(e4) {
|
|
6737
|
+
if (void 0 !== e4) return "number" == typeof e4 ? { threshold: e4, cooldown: Z } : { threshold: e4.threshold ?? 5, cooldown: e4.cooldown ?? Z };
|
|
6505
6738
|
}
|
|
6506
|
-
function
|
|
6739
|
+
function ne2(e4, t4, n5, o4, r6) {
|
|
6507
6740
|
if ("partial" === n5) return;
|
|
6508
6741
|
const s4 = (function(e5, t5) {
|
|
6509
6742
|
return e5[t5] || (e5[t5] = { state: "closed", consecutiveFailures: 0 }), e5[t5];
|
|
6510
6743
|
})(e4, t4);
|
|
6511
|
-
return "success" === n5 ? (s4.consecutiveFailures = 0, s4.state = "closed", s4.probing = false, void (s4.openUntil = void 0)) : (s4.consecutiveFailures += 1, "half-open" === s4.state ? (s4.state = "open", s4.probing = false, void (s4.openUntil =
|
|
6744
|
+
return "success" === n5 ? (s4.consecutiveFailures = 0, s4.state = "closed", s4.probing = false, void (s4.openUntil = void 0)) : (s4.consecutiveFailures += 1, "half-open" === s4.state ? (s4.state = "open", s4.probing = false, void (s4.openUntil = ee2() + r6)) : void (s4.consecutiveFailures >= o4 && (s4.state = "open", s4.probing = false, s4.openUntil = ee2() + r6)));
|
|
6512
6745
|
}
|
|
6513
|
-
var
|
|
6514
|
-
function
|
|
6746
|
+
var re2 = 100;
|
|
6747
|
+
function se(e4, t4) {
|
|
6515
6748
|
return e4.status.destinations[t4] || (e4.status.destinations[t4] = { count: 0, failed: 0, duration: 0, queuePushSize: 0, dlqSize: 0 }), e4.status.destinations[t4];
|
|
6516
6749
|
}
|
|
6517
|
-
function
|
|
6750
|
+
function ae2(e4, t4, n5, o4) {
|
|
6518
6751
|
e4.dropped[t4] || (e4.dropped[t4] = {});
|
|
6519
6752
|
const r6 = e4.dropped[t4];
|
|
6520
6753
|
return r6[n5] = (r6[n5] ?? 0) + o4, r6[n5];
|
|
6521
6754
|
}
|
|
6522
|
-
function
|
|
6755
|
+
function ie2(e4, t4, n5, o4, r6) {
|
|
6523
6756
|
const s4 = o(t4, n5);
|
|
6524
6757
|
return (t5, a4) => {
|
|
6525
6758
|
try {
|
|
6526
6759
|
if (a4) return r6 ? (function(e5, t6, n6, o5, r7, s5) {
|
|
6527
|
-
const a5 = t6.dlq = t6.dlq || [], i5 = { max: t6.config.dlqMax ??
|
|
6760
|
+
const a5 = t6.dlq = t6.dlq || [], i5 = { max: t6.config.dlqMax ?? re2 }, c2 = N(a5, [o5, r7], i5);
|
|
6528
6761
|
if (c2.dropped > 0) {
|
|
6529
|
-
const t7 =
|
|
6530
|
-
|
|
6531
|
-
} else a5.length < i5.max &&
|
|
6532
|
-
const u2 =
|
|
6762
|
+
const t7 = ae2(e5.status, o("destination", n6), "dlq", c2.dropped);
|
|
6763
|
+
J2(a5, s5, "destination.dlq overflow; oldest entries dropped", { buffer: "dlq", destination: n6, cap: i5.max, droppedCount: t7 });
|
|
6764
|
+
} else a5.length < i5.max && X2(a5);
|
|
6765
|
+
const u2 = se(e5, n6);
|
|
6533
6766
|
u2.failed++, u2.dlqSize = a5.length, e5.status.failed++;
|
|
6534
|
-
const d2 =
|
|
6767
|
+
const d2 = te2(t6.config.breaker);
|
|
6535
6768
|
if (d2) {
|
|
6536
6769
|
const o6 = t6.config.id || n6;
|
|
6537
|
-
|
|
6770
|
+
ne2(e5.status.breakers, o("destination", o6), "transport-failure", d2.threshold, d2.cooldown);
|
|
6538
6771
|
}
|
|
6539
6772
|
})(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 });
|
|
6540
6773
|
e4.status.connectionErrors[s4] = (e4.status.connectionErrors[s4] ?? 0) + 1, o4.error("connection error", { error: t5 instanceof Error ? t5.message : String(t5) });
|
|
@@ -6542,13 +6775,13 @@ function oe2(e4, t4, n5, o4, r6) {
|
|
|
6542
6775
|
}
|
|
6543
6776
|
};
|
|
6544
6777
|
}
|
|
6545
|
-
function
|
|
6778
|
+
function ze(e4, t4) {
|
|
6546
6779
|
return e4.storeId && t4.stores[e4.storeId] ? t4.stores[e4.storeId] : t4.stores.__cache;
|
|
6547
6780
|
}
|
|
6548
|
-
function
|
|
6781
|
+
function Ue2(e4, t4) {
|
|
6549
6782
|
return e4 ? t4.stores[e4] : t4.stores.__cache;
|
|
6550
6783
|
}
|
|
6551
|
-
function
|
|
6784
|
+
function Ke2(e4) {
|
|
6552
6785
|
const t4 = {};
|
|
6553
6786
|
for (const [n5, o4] of Object.entries(e4)) {
|
|
6554
6787
|
const e5 = o4.config?.next;
|
|
@@ -6556,11 +6789,11 @@ function _e2(e4) {
|
|
|
6556
6789
|
}
|
|
6557
6790
|
return t4;
|
|
6558
6791
|
}
|
|
6559
|
-
function
|
|
6792
|
+
function Be2(e4, t4) {
|
|
6560
6793
|
const n5 = e4.config || {}, o4 = e4[t4];
|
|
6561
6794
|
return void 0 !== o4 ? { config: { ...n5, [t4]: o4 }, chainValue: o4 } : { config: n5, chainValue: void 0 };
|
|
6562
6795
|
}
|
|
6563
|
-
function
|
|
6796
|
+
function Fe2(e4, t4 = {}) {
|
|
6564
6797
|
if (!e4) return [];
|
|
6565
6798
|
if (Array.isArray(e4)) return e4;
|
|
6566
6799
|
const n5 = [], o4 = /* @__PURE__ */ new Set();
|
|
@@ -6576,9 +6809,9 @@ function ze2(e4, t4 = {}) {
|
|
|
6576
6809
|
}
|
|
6577
6810
|
return n5;
|
|
6578
6811
|
}
|
|
6579
|
-
async function
|
|
6812
|
+
async function Re2(e4, t4, n5) {
|
|
6580
6813
|
if (t4.init && !t4.config.init) {
|
|
6581
|
-
const o4 = t4.type || "unknown", r6 = e4.logger.scope(`transformer:${o4}`), s4 = { collector: e4, logger: r6, id: n5, ingest:
|
|
6814
|
+
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) };
|
|
6582
6815
|
r6.debug("init");
|
|
6583
6816
|
const a4 = await gt(t4.init, "TransformerInit", e4.hooks, e4.logger)(s4);
|
|
6584
6817
|
if (false === a4) return false;
|
|
@@ -6586,24 +6819,24 @@ async function Ke2(e4, t4, n5) {
|
|
|
6586
6819
|
}
|
|
6587
6820
|
return true;
|
|
6588
6821
|
}
|
|
6589
|
-
async function
|
|
6590
|
-
const a4 = t4.type || "unknown", i5 = e4.logger.scope(`transformer:${a4}`), c2 = { collector: e4, logger: i5, id: n5, ingest: r6, config: t4.config, env: { ...
|
|
6822
|
+
async function He(e4, t4, n5, o4, r6, s4) {
|
|
6823
|
+
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) };
|
|
6591
6824
|
i5.debug("push", { event: o4.name });
|
|
6592
|
-
const u2 = "string" == typeof o4.id ? o4.id : "", { traceId: d2, sourceId: l3, parentEventId: f3 } =
|
|
6593
|
-
g3.inEvent = o4,
|
|
6825
|
+
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 });
|
|
6826
|
+
g3.inEvent = o4, on(e4, g3);
|
|
6594
6827
|
try {
|
|
6595
|
-
const r7 = await gt(t4.push, "TransformerPush", e4.hooks, e4.logger)(o4, c2), s5 = Date.now(), a5 =
|
|
6596
|
-
return a5.durationMs = s5 - p3, a5.outEvent = r7,
|
|
6828
|
+
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 });
|
|
6829
|
+
return a5.durationMs = s5 - p3, a5.outEvent = r7, on(e4, a5), i5.debug("push done"), r7;
|
|
6597
6830
|
} catch (t5) {
|
|
6598
|
-
const o5 = Date.now(), r7 =
|
|
6599
|
-
throw r7.durationMs = o5 - p3, r7.error = t5 instanceof Error ? { name: t5.name, message: t5.message } : { message: String(t5) },
|
|
6831
|
+
const o5 = Date.now(), r7 = _(e4, { stepId: o("transformer", n5), stepType: "transformer", phase: "error", eventId: u2, now: o5, traceId: d2, sourceId: l3, parentEventId: f3 });
|
|
6832
|
+
throw r7.durationMs = o5 - p3, r7.error = t5 instanceof Error ? { name: t5.name, message: t5.message } : { message: String(t5) }, on(e4, r7), t5;
|
|
6600
6833
|
}
|
|
6601
6834
|
}
|
|
6602
|
-
function
|
|
6603
|
-
return e4 ? { ...e4, _meta: { ...e4._meta, path: [...e4._meta.path] } } :
|
|
6835
|
+
function Ge2(e4, t4) {
|
|
6836
|
+
return e4 ? { ...e4, _meta: { ...e4._meta, path: [...e4._meta.path] } } : I(t4);
|
|
6604
6837
|
}
|
|
6605
|
-
async function
|
|
6606
|
-
r6 || (r6 =
|
|
6838
|
+
async function We2(e4, t4, n5, o4, r6, s4, a4) {
|
|
6839
|
+
r6 || (r6 = I(n5[0] ?? "chain")), a4 && r6._meta && (r6._meta.chainPath = a4);
|
|
6607
6840
|
let i5 = o4, c2 = s4;
|
|
6608
6841
|
for (const o5 of n5) {
|
|
6609
6842
|
const s5 = t4[o5];
|
|
@@ -6613,8 +6846,8 @@ async function Be2(e4, t4, n5, o4, r6, s4, a4) {
|
|
|
6613
6846
|
}
|
|
6614
6847
|
if (r6 && r6._meta && r6._meta.path.length > 256) return e4.logger.error(`Max path length exceeded at ${o5}`), { event: null, respond: c2 };
|
|
6615
6848
|
r6 && r6._meta && (r6._meta.hops++, r6._meta.path.push(o5));
|
|
6616
|
-
if (!await
|
|
6617
|
-
if (t5 instanceof
|
|
6849
|
+
if (!await Ye(Re2, (t5) => {
|
|
6850
|
+
if (t5 instanceof Xe) throw t5;
|
|
6618
6851
|
return e4.status.failed++, e4.logger.scope(`transformer:${s5.type || "unknown"}`).error("transformer init failed", { transformer: o5, error: t5 }), false;
|
|
6619
6852
|
})(e4, s5, o5)) return { event: null, respond: c2 };
|
|
6620
6853
|
if (a4 && void 0 !== s5.config?.chainMocks?.[a4]) {
|
|
@@ -6627,10 +6860,10 @@ async function Be2(e4, t4, n5, o4, r6, s4, a4) {
|
|
|
6627
6860
|
continue;
|
|
6628
6861
|
}
|
|
6629
6862
|
if (s5.config?.disabled) continue;
|
|
6630
|
-
const u2 = s5.config?.cache, d2 = u2 ?
|
|
6863
|
+
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;
|
|
6631
6864
|
let h2;
|
|
6632
6865
|
if (d2 && l3) {
|
|
6633
|
-
const e5 =
|
|
6866
|
+
const e5 = Xn(r6, i5), t5 = await er(d2, l3, e5);
|
|
6634
6867
|
if ("HIT" === t5?.status && t5.value) {
|
|
6635
6868
|
if (i5 = t5.value, d2.stop) return { event: i5, respond: c2, stopped: true };
|
|
6636
6869
|
continue;
|
|
@@ -6639,33 +6872,33 @@ async function Be2(e4, t4, n5, o4, r6, s4, a4) {
|
|
|
6639
6872
|
}
|
|
6640
6873
|
const v3 = s5.config.before;
|
|
6641
6874
|
if (v3) {
|
|
6642
|
-
const n6 =
|
|
6875
|
+
const n6 = zn(v3, Xn(r6, i5));
|
|
6643
6876
|
if (1 === n6.length) {
|
|
6644
|
-
const o6 =
|
|
6877
|
+
const o6 = Fe2(n6[0], Ke2(t4));
|
|
6645
6878
|
if (o6.length > 0) {
|
|
6646
|
-
const n7 = await
|
|
6879
|
+
const n7 = await We2(e4, t4, o6, i5, r6, c2, a4);
|
|
6647
6880
|
if (null === n7.event) return { event: null, respond: n7.respond ?? c2 };
|
|
6648
6881
|
if (n7.stopped) return { event: Array.isArray(n7.event) ? n7.event[0] : n7.event, respond: n7.respond ?? c2, stopped: true };
|
|
6649
6882
|
n7.respond && (c2 = n7.respond), i5 = Array.isArray(n7.event) ? n7.event[0] : n7.event;
|
|
6650
6883
|
}
|
|
6651
|
-
} else n6.length > 1 && await Promise.all(n6.map((n7) =>
|
|
6884
|
+
} 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)));
|
|
6652
6885
|
}
|
|
6653
|
-
p3 && p3.length > 0 && (i5 = await
|
|
6654
|
-
const y3 = await
|
|
6886
|
+
p3 && p3.length > 0 && (i5 = await or(p3, (t5) => Ue2(t5, e4), i5, e4));
|
|
6887
|
+
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);
|
|
6655
6888
|
if (false === y3) return { event: null, respond: c2, droppedBy: o5 };
|
|
6656
6889
|
if (Array.isArray(y3)) {
|
|
6657
6890
|
const s6 = n5.slice(n5.indexOf(o5) + 1), u3 = await Promise.all(y3.map(async (n6) => {
|
|
6658
|
-
const o6 = await m3(n6.event || i5), u4 =
|
|
6891
|
+
const o6 = await m3(n6.event || i5), u4 = Ge2(r6, "unknown");
|
|
6659
6892
|
if (n6.next) {
|
|
6660
|
-
const r7 =
|
|
6893
|
+
const r7 = zn(n6.next, Xn(u4, o6));
|
|
6661
6894
|
if (0 === r7.length) return { event: o6, respond: c2 };
|
|
6662
6895
|
if (1 === r7.length) {
|
|
6663
|
-
const n7 =
|
|
6664
|
-
return n7.length > 0 ?
|
|
6896
|
+
const n7 = Fe2(r7[0], Ke2(t4));
|
|
6897
|
+
return n7.length > 0 ? We2(e4, t4, n7, o6, u4, c2, a4) : { event: o6, respond: c2 };
|
|
6665
6898
|
}
|
|
6666
|
-
return (await Promise.all(r7.map((n7) =>
|
|
6899
|
+
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 }));
|
|
6667
6900
|
}
|
|
6668
|
-
return s6.length > 0 ?
|
|
6901
|
+
return s6.length > 0 ? We2(e4, t4, s6, o6, u4, c2, a4) : { event: o6, respond: c2 };
|
|
6669
6902
|
}));
|
|
6670
6903
|
let d3 = c2;
|
|
6671
6904
|
const l4 = [];
|
|
@@ -6679,104 +6912,104 @@ async function Be2(e4, t4, n5, o4, r6, s4, a4) {
|
|
|
6679
6912
|
if (y3 && "object" == typeof y3) {
|
|
6680
6913
|
const { event: n6, respond: o6, next: s6 } = y3;
|
|
6681
6914
|
if (o6 && (c2 = o6), void 0 !== s6) {
|
|
6682
|
-
const o7 = await m3(n6 || i5), u3 =
|
|
6915
|
+
const o7 = await m3(n6 || i5), u3 = zn(s6, Xn(r6, o7));
|
|
6683
6916
|
if (0 === u3.length) {
|
|
6684
6917
|
i5 = o7;
|
|
6685
6918
|
continue;
|
|
6686
6919
|
}
|
|
6687
6920
|
if (1 === u3.length) {
|
|
6688
|
-
const n7 =
|
|
6689
|
-
return n7.length > 0 ?
|
|
6921
|
+
const n7 = Fe2(u3[0], Ke2(t4));
|
|
6922
|
+
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 });
|
|
6690
6923
|
}
|
|
6691
|
-
return await Promise.all(u3.map((n7) =>
|
|
6924
|
+
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 };
|
|
6692
6925
|
}
|
|
6693
6926
|
n6 && (i5 = n6);
|
|
6694
6927
|
}
|
|
6695
|
-
g3 && g3.length > 0 && (i5 = await
|
|
6928
|
+
g3 && g3.length > 0 && (i5 = await or(g3, (t5) => Ue2(t5, e4), i5, e4)), h2 && l3 && tr(l3, h2.key, i5, h2.ttl);
|
|
6696
6929
|
const w3 = s5.config.next, b3 = "string" == typeof w3 || Array.isArray(w3) && w3.every((e5) => "string" == typeof e5), k3 = void 0 !== w3 && !b3;
|
|
6697
6930
|
if ((!y3 || "object" == typeof y3 && !y3.next) && k3) {
|
|
6698
|
-
const n6 =
|
|
6931
|
+
const n6 = zn(s5.config.next, Xn(r6, i5));
|
|
6699
6932
|
if (1 === n6.length) {
|
|
6700
|
-
const o6 =
|
|
6701
|
-
return o6.length > 0 ?
|
|
6933
|
+
const o6 = Fe2(n6[0], Ke2(t4));
|
|
6934
|
+
return o6.length > 0 ? We2(e4, t4, o6, i5, r6, c2, a4) : { event: i5, respond: c2 };
|
|
6702
6935
|
}
|
|
6703
|
-
return n6.length > 1 ? (await Promise.all(n6.map((n7) =>
|
|
6936
|
+
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 };
|
|
6704
6937
|
}
|
|
6705
6938
|
}
|
|
6706
6939
|
return { event: i5, respond: c2 };
|
|
6707
6940
|
}
|
|
6708
|
-
function
|
|
6941
|
+
function Le(e4) {
|
|
6709
6942
|
return e4 && de(e4) ? e4 : {};
|
|
6710
6943
|
}
|
|
6711
|
-
function
|
|
6944
|
+
function Ve2(e4) {
|
|
6712
6945
|
return "string" == typeof e4 || !(!Array.isArray(e4) || !e4.every((e5) => "string" == typeof e5));
|
|
6713
6946
|
}
|
|
6714
|
-
async function
|
|
6947
|
+
async function Ne2(e4, t4, n5) {
|
|
6715
6948
|
if (!t4.on || !t4.queueOn?.length) return;
|
|
6716
6949
|
const o4 = t4.queueOn;
|
|
6717
6950
|
t4.queueOn = [];
|
|
6718
6951
|
const r6 = n5 || t4.config?.id || "unknown";
|
|
6719
|
-
for (const { type: n6, data: s4 } of o4)
|
|
6720
|
-
if (t5 instanceof
|
|
6952
|
+
for (const { type: n6, data: s4 } of o4) st(n6) && !dt(e4, t4, n6) || (await Ye(t4.on, (t5) => {
|
|
6953
|
+
if (t5 instanceof Xe) throw t5;
|
|
6721
6954
|
e4.status.failed++, e4.logger.scope("source").error("source on flush failed", { sourceId: r6, type: n6, error: t5 });
|
|
6722
|
-
})(n6, s4),
|
|
6955
|
+
})(n6, s4), st(n6) && ut(e4, t4, n6));
|
|
6723
6956
|
}
|
|
6724
|
-
function
|
|
6957
|
+
function Ye2(e4) {
|
|
6725
6958
|
return Boolean(e4.config.init) && !e4.config.require?.length;
|
|
6726
6959
|
}
|
|
6727
|
-
function
|
|
6960
|
+
function Je2(e4) {
|
|
6728
6961
|
return "object" == typeof e4 && null !== e4;
|
|
6729
6962
|
}
|
|
6730
|
-
async function
|
|
6731
|
-
const { code: o4, config: r6 = {}, env: s4 = {}, primary: a4, next: i5, before: c2, cache: u2 } = n5, d2 = r6.state ?? n5.state, l3 = d2 ?
|
|
6963
|
+
async function Xe2(e4, t4, n5) {
|
|
6964
|
+
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) => {
|
|
6732
6965
|
let a5;
|
|
6733
6966
|
const u3 = m3 ?? (void 0 !== c2 ? (() => {
|
|
6734
|
-
const t5 =
|
|
6967
|
+
const t5 = zn(c2, Xn(s5.ingest));
|
|
6735
6968
|
if (0 === t5.length) return [];
|
|
6736
|
-
return
|
|
6969
|
+
return Fe2(1 === t5.length ? t5[0] : t5, Ke2(e4.transformers));
|
|
6737
6970
|
})() : []);
|
|
6738
6971
|
let d3 = [n6];
|
|
6739
6972
|
if (u3.length > 0 && e4.transformers && Object.keys(e4.transformers).length > 0) {
|
|
6740
|
-
const o6 = await
|
|
6973
|
+
const o6 = await We2(e4, e4.transformers, u3, n6, s5.ingest, s5.respond, `source.${t4}.before`);
|
|
6741
6974
|
if (null === o6.event) return { ok: true };
|
|
6742
6975
|
if (o6.stopped) return o6.respond && (s5.respond = o6.respond), { ok: true };
|
|
6743
6976
|
o6.respond && (s5.respond = o6.respond), d3 = Array.isArray(o6.event) ? o6.event : [o6.event];
|
|
6744
6977
|
}
|
|
6745
6978
|
if (p3) {
|
|
6746
|
-
const t5 =
|
|
6979
|
+
const t5 = ze(p3, e4);
|
|
6747
6980
|
if (t5) {
|
|
6748
|
-
const n7 =
|
|
6981
|
+
const n7 = Xn(s5.ingest), o6 = await er(p3, t5, n7);
|
|
6749
6982
|
if (o6) {
|
|
6750
6983
|
if ("HIT" === o6.status && void 0 !== o6.value && p3.stop) {
|
|
6751
6984
|
let t6 = o6.value;
|
|
6752
|
-
return o6.rule.update && (t6 = await
|
|
6985
|
+
return o6.rule.update && (t6 = await nr(t6, o6.rule.update, { ...n7, cache: { status: "HIT" } }, e4)), s5.respond?.(t6), { ok: true };
|
|
6753
6986
|
}
|
|
6754
6987
|
if ("MISS" === o6.status && p3.stop && s5.respond) {
|
|
6755
6988
|
const r7 = s5.respond, i6 = o6.rule.update, c3 = { ...n7, cache: { status: "MISS" } }, u4 = o6.key, d4 = o6.rule.ttl, l4 = (n8) => {
|
|
6756
|
-
|
|
6757
|
-
const t6 = await
|
|
6989
|
+
tr(t5, u4, n8, d4), i6 ? a5 = (async () => {
|
|
6990
|
+
const t6 = await nr(n8, i6, c3, e4);
|
|
6758
6991
|
r7(t6);
|
|
6759
6992
|
})() : r7(n8);
|
|
6760
6993
|
};
|
|
6761
6994
|
s5.respond = l4;
|
|
6762
6995
|
}
|
|
6763
|
-
"MISS" !== o6.status || p3.stop ||
|
|
6996
|
+
"MISS" !== o6.status || p3.stop || tr(t5, o6.key, true, o6.rule.ttl);
|
|
6764
6997
|
}
|
|
6765
6998
|
}
|
|
6766
6999
|
}
|
|
6767
7000
|
const f4 = g3 ? { kind: "single", preChain: g3 } : void 0 !== i5 ? (() => {
|
|
6768
|
-
const t5 =
|
|
6769
|
-
return 0 === t5.length ? { kind: "single", preChain: [] } : 1 === t5.length ? { kind: "single", preChain:
|
|
7001
|
+
const t5 = zn(i5, Xn(s5.ingest));
|
|
7002
|
+
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))) };
|
|
6770
7003
|
})() : { kind: "single", preChain: [] };
|
|
6771
|
-
!y3 && l3 && l3.length > 0 && (d3 = await Promise.all(d3.map((t5) =>
|
|
7004
|
+
!y3 && l3 && l3.length > 0 && (d3 = await Promise.all(d3.map((t5) => or(l3, (t6) => Ue2(t6, e4), t5, e4))));
|
|
6772
7005
|
let h3 = { ok: true };
|
|
6773
|
-
for (const n7 of d3) "many" === f4.kind ? (await Promise.all(f4.branches.map((a6, i6) =>
|
|
7006
|
+
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 });
|
|
6774
7007
|
return a5 && await a5, h3;
|
|
6775
7008
|
}, b3 = async (n6) => {
|
|
6776
|
-
const o5 =
|
|
6777
|
-
if (!
|
|
7009
|
+
const o5 = I(t4), s5 = Re((function(e5) {
|
|
7010
|
+
if (!Je2(e5)) return;
|
|
6778
7011
|
const t5 = e5.headers;
|
|
6779
|
-
if (
|
|
7012
|
+
if (Je2(t5)) {
|
|
6780
7013
|
if ((function(e6) {
|
|
6781
7014
|
return "get" in e6 && "function" == typeof e6.get;
|
|
6782
7015
|
})(t5)) return t5.get("traceparent") ?? void 0;
|
|
@@ -6787,24 +7020,24 @@ async function Le2(e4, t4, n5) {
|
|
|
6787
7020
|
if (s5 && (o5._meta.trace = s5.trace, o5._meta.parentEventId = s5.parentSpan), !r6.ingest || void 0 === n6) return o5;
|
|
6788
7021
|
const a5 = await et(n6, r6.ingest, { collector: e4 });
|
|
6789
7022
|
return { ...o5, ...a5, _meta: o5._meta };
|
|
6790
|
-
}, k3 = e4.logger.scope("source").scope(t4),
|
|
6791
|
-
const o5 = { ingest:
|
|
7023
|
+
}, k3 = e4.logger.scope("source").scope(t4), I3 = { command: e4.command, sources: e4.sources, elb: e4.elb, logger: k3, ...s4, push: async (e5, n6 = {}) => {
|
|
7024
|
+
const o5 = { ingest: I(t4), respond: void 0 };
|
|
6792
7025
|
return w3(e5, n6, o5);
|
|
6793
|
-
} }, C3 = { collector: e4, logger: k3, id: t4, config: r6, env:
|
|
7026
|
+
} }, C3 = { collector: e4, logger: k3, id: t4, config: r6, env: I3, withScope: async (e5, t5, n6) => {
|
|
6794
7027
|
const o5 = { ingest: await b3(e5), respond: t5 };
|
|
6795
|
-
return n6({ ...
|
|
6796
|
-
}, reportError:
|
|
6797
|
-
if (n6 instanceof
|
|
7028
|
+
return n6({ ...I3, push: (e6, t6 = {}) => w3(e6, t6, o5), ingest: o5.ingest, respond: o5.respond });
|
|
7029
|
+
}, reportError: ie2(e4, "source", t4, k3) }, E2 = await Ye(o4, (n6) => {
|
|
7030
|
+
if (n6 instanceof Xe) throw n6;
|
|
6798
7031
|
e4.status.failed++, e4.logger.scope("source").error("source factory failed", { sourceId: t4, error: n6 });
|
|
6799
7032
|
})(C3);
|
|
6800
|
-
if (!
|
|
6801
|
-
const
|
|
6802
|
-
return
|
|
7033
|
+
if (!E2) return;
|
|
7034
|
+
const S2 = E2.type || "unknown", q3 = e4.logger.scope(S2).scope(t4);
|
|
7035
|
+
return I3.logger = q3, a4 && (E2.config = { ...E2.config, primary: a4 }), E2;
|
|
6803
7036
|
}
|
|
6804
|
-
async function
|
|
7037
|
+
async function Qe2(e4, t4 = {}) {
|
|
6805
7038
|
const n5 = {};
|
|
6806
7039
|
for (const [o4, r6] of Object.entries(t4)) {
|
|
6807
|
-
const t5 = await
|
|
7040
|
+
const t5 = await Xe2(e4, o4, r6);
|
|
6808
7041
|
if (!t5) continue;
|
|
6809
7042
|
const s4 = r6.config?.require;
|
|
6810
7043
|
t5.config = { ...t5.config, init: false, ...s4 ? { require: [...s4] } : {} }, n5[o4] = t5;
|
|
@@ -6813,51 +7046,51 @@ async function Ne2(e4, t4 = {}) {
|
|
|
6813
7046
|
for (const t5 of Object.keys(n5)) {
|
|
6814
7047
|
const n6 = e4.sources[t5];
|
|
6815
7048
|
let o4 = false;
|
|
6816
|
-
n6.init && await
|
|
6817
|
-
if (n7 instanceof
|
|
7049
|
+
n6.init && await Ye(n6.init.bind(n6), (n7) => {
|
|
7050
|
+
if (n7 instanceof Xe) throw n7;
|
|
6818
7051
|
o4 = true, e4.status.failed++, e4.logger.scope("source").error("source init failed", { sourceId: t5, error: n7 });
|
|
6819
|
-
})(), o4 || (n6.config.init = true,
|
|
7052
|
+
})(), o4 || (n6.config.init = true, Ye2(n6) && await Ne2(e4, n6, t5));
|
|
6820
7053
|
}
|
|
6821
|
-
return await
|
|
7054
|
+
return await Ze2(e4), n5;
|
|
6822
7055
|
}
|
|
6823
|
-
async function
|
|
7056
|
+
async function Ze2(e4) {
|
|
6824
7057
|
for (const [t4, n5] of Object.entries(e4.sources)) {
|
|
6825
|
-
if (
|
|
7058
|
+
if (Ye2(n5)) continue;
|
|
6826
7059
|
const o4 = n5.config.require;
|
|
6827
7060
|
if (!o4?.length) continue;
|
|
6828
|
-
const r6 = o4.filter((t5) => !
|
|
6829
|
-
r6.length !== o4.length && (n5.config.require = r6,
|
|
7061
|
+
const r6 = o4.filter((t5) => !it(e4, t5));
|
|
7062
|
+
r6.length !== o4.length && (n5.config.require = r6, Ye2(n5) && await Ne2(e4, n5, t4));
|
|
6830
7063
|
}
|
|
6831
7064
|
for (const [t4, n5] of Object.entries(e4.pending.destinations)) {
|
|
6832
7065
|
if (!e4.pending.destinations[t4] || e4.destinations[t4]) continue;
|
|
6833
7066
|
const o4 = n5.config?.require;
|
|
6834
7067
|
if (!o4) continue;
|
|
6835
|
-
const r6 = o4.filter((t5) => !
|
|
7068
|
+
const r6 = o4.filter((t5) => !it(e4, t5));
|
|
6836
7069
|
if (n5.config && (n5.config.require = r6), r6.length > 0) continue;
|
|
6837
7070
|
delete e4.pending.destinations[t4];
|
|
6838
|
-
const s4 =
|
|
7071
|
+
const s4 = Mt(n5);
|
|
6839
7072
|
false !== s4.config.queue && (s4.queuePush = [...e4.queue]), e4.destinations[t4] = s4;
|
|
6840
7073
|
}
|
|
6841
7074
|
}
|
|
6842
|
-
function
|
|
7075
|
+
function et2(e4) {
|
|
6843
7076
|
if ("object" != typeof e4 || null === e4) return false;
|
|
6844
7077
|
if (!("logger" in e4)) return false;
|
|
6845
7078
|
const t4 = e4.logger;
|
|
6846
7079
|
return "object" == typeof t4 && null !== t4 && ("scope" in t4 && "function" == typeof t4.scope);
|
|
6847
7080
|
}
|
|
6848
|
-
var
|
|
6849
|
-
function
|
|
6850
|
-
|
|
7081
|
+
var tt2 = false;
|
|
7082
|
+
function nt2() {
|
|
7083
|
+
tt2 || (tt2 = true, "undefined" != typeof console && "function" == typeof console.warn && console.warn("walkerOS: ignored an on-dispatch call with a non-collector argument"));
|
|
6851
7084
|
}
|
|
6852
|
-
function
|
|
6853
|
-
if (n5 instanceof
|
|
7085
|
+
function ot(e4, t4, n5, o4) {
|
|
7086
|
+
if (n5 instanceof Xe) throw n5;
|
|
6854
7087
|
e4.logger.scope("on").error("on callback failed", { kind: t4, ...o4, error: n5 });
|
|
6855
7088
|
}
|
|
6856
|
-
var
|
|
6857
|
-
function
|
|
6858
|
-
return
|
|
7089
|
+
var rt = [n.Commands.Consent, n.Commands.User, n.Commands.Globals, n.Commands.Custom];
|
|
7090
|
+
function st(e4) {
|
|
7091
|
+
return rt.includes(e4);
|
|
6859
7092
|
}
|
|
6860
|
-
function
|
|
7093
|
+
function at(e4, t4) {
|
|
6861
7094
|
switch (t4) {
|
|
6862
7095
|
case n.Commands.Consent:
|
|
6863
7096
|
return Object.keys(e4.consent).length > 0;
|
|
@@ -6871,13 +7104,13 @@ function nt2(e4, t4) {
|
|
|
6871
7104
|
return false;
|
|
6872
7105
|
}
|
|
6873
7106
|
}
|
|
6874
|
-
function
|
|
7107
|
+
function it(e4, t4) {
|
|
6875
7108
|
switch (t4) {
|
|
6876
7109
|
case n.Commands.Consent:
|
|
6877
7110
|
case n.Commands.User:
|
|
6878
7111
|
case n.Commands.Globals:
|
|
6879
7112
|
case n.Commands.Custom:
|
|
6880
|
-
return
|
|
7113
|
+
return at(e4, t4);
|
|
6881
7114
|
case n.Commands.Run:
|
|
6882
7115
|
case n.Commands.Ready:
|
|
6883
7116
|
return true === e4.allowed;
|
|
@@ -6885,26 +7118,26 @@ function ot(e4, t4) {
|
|
|
6885
7118
|
return e4.seenEvents.has(String(t4));
|
|
6886
7119
|
}
|
|
6887
7120
|
}
|
|
6888
|
-
function
|
|
7121
|
+
function ct(e4, t4) {
|
|
6889
7122
|
return e4.cellVersion[String(t4)] ?? 0;
|
|
6890
7123
|
}
|
|
6891
|
-
function
|
|
7124
|
+
function ut(e4, t4, n5) {
|
|
6892
7125
|
let o4 = e4.delivery.get(t4);
|
|
6893
|
-
o4 || (o4 = {}, e4.delivery.set(t4, o4)), o4[String(n5)] =
|
|
7126
|
+
o4 || (o4 = {}, e4.delivery.set(t4, o4)), o4[String(n5)] = ct(e4, n5);
|
|
6894
7127
|
}
|
|
6895
|
-
function
|
|
6896
|
-
return e4.allowed &&
|
|
7128
|
+
function dt(e4, t4, n5) {
|
|
7129
|
+
return e4.allowed && ct(e4, n5) > (function(e5, t5, n6) {
|
|
6897
7130
|
const o4 = e5.delivery.get(t5), r6 = o4?.[String(n6)];
|
|
6898
7131
|
return void 0 === r6 ? -1 : r6;
|
|
6899
7132
|
})(e4, t4, n5);
|
|
6900
7133
|
}
|
|
6901
|
-
function
|
|
7134
|
+
function lt2(e4) {
|
|
6902
7135
|
return e4.cascade ? () => {
|
|
6903
7136
|
} : (e4.cascade = { counts: /* @__PURE__ */ new WeakMap() }, () => {
|
|
6904
7137
|
e4.cascade = void 0;
|
|
6905
7138
|
});
|
|
6906
7139
|
}
|
|
6907
|
-
function
|
|
7140
|
+
function ft(e4, t4, n5) {
|
|
6908
7141
|
const o4 = e4.cascade;
|
|
6909
7142
|
if (!o4) return true;
|
|
6910
7143
|
let r6 = o4.counts.get(t4);
|
|
@@ -6912,72 +7145,72 @@ function ct(e4, t4, n5) {
|
|
|
6912
7145
|
const s4 = String(n5), a4 = (r6[s4] || 0) + 1;
|
|
6913
7146
|
return r6[s4] = a4, a4 <= 8 || (9 === a4 && e4.logger.error("state delivery did not converge", { type: s4 }), false);
|
|
6914
7147
|
}
|
|
6915
|
-
function
|
|
7148
|
+
function pt2(e4, t4) {
|
|
6916
7149
|
return { collector: e4, logger: e4.logger.scope("on").scope(String(t4)) };
|
|
6917
7150
|
}
|
|
6918
|
-
async function
|
|
6919
|
-
if (!
|
|
7151
|
+
async function gt2(e4, t4, n5) {
|
|
7152
|
+
if (!et2(e4)) return void nt2();
|
|
6920
7153
|
const o4 = e4.on, r6 = o4[t4] || [], s4 = ie(n5) ? n5 : [n5];
|
|
6921
7154
|
s4.forEach((e5) => {
|
|
6922
7155
|
r6.push(e5);
|
|
6923
|
-
}), o4[t4] = r6,
|
|
7156
|
+
}), o4[t4] = r6, ht2(e4, t4, s4);
|
|
6924
7157
|
}
|
|
6925
|
-
function
|
|
7158
|
+
function mt(e4, t4, n5, o4, r6) {
|
|
6926
7159
|
if (!t4.on) return;
|
|
6927
|
-
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:
|
|
6928
|
-
Ge(t4.on, (t5) =>
|
|
7160
|
+
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) };
|
|
7161
|
+
Ge(t4.on, (t5) => ot(e4, "destination", t5, { destId: n5, type: o4 }))(o4, i5);
|
|
6929
7162
|
}
|
|
6930
|
-
function
|
|
6931
|
-
if (!
|
|
6932
|
-
const s4 =
|
|
7163
|
+
function ht2(e4, t4, o4, r6) {
|
|
7164
|
+
if (!et2(e4)) return void nt2();
|
|
7165
|
+
const s4 = vt2(e4, t4, r6);
|
|
6933
7166
|
if (o4.length) switch (t4) {
|
|
6934
7167
|
case n.Commands.Consent:
|
|
6935
7168
|
!(function(e5, t5, o5) {
|
|
6936
|
-
const r7 = o5 || e5.consent, s5 =
|
|
7169
|
+
const r7 = o5 || e5.consent, s5 = pt2(e5, n.Commands.Consent);
|
|
6937
7170
|
t5.forEach((t6) => {
|
|
6938
|
-
|
|
6939
|
-
Ge(t6[n5], (t7) =>
|
|
6940
|
-
}),
|
|
7171
|
+
dt(e5, t6, n.Commands.Consent) && ft(e5, t6, n.Commands.Consent) && (Object.keys(r7).filter((e6) => e6 in t6).forEach((n5) => {
|
|
7172
|
+
Ge(t6[n5], (t7) => ot(e5, "consent", t7, { key: n5 }))(r7, s5);
|
|
7173
|
+
}), ut(e5, t6, n.Commands.Consent));
|
|
6941
7174
|
});
|
|
6942
7175
|
})(e4, o4, r6);
|
|
6943
7176
|
break;
|
|
6944
7177
|
case n.Commands.Ready:
|
|
6945
7178
|
!(function(e5, t5) {
|
|
6946
7179
|
if (!e5.allowed) return;
|
|
6947
|
-
const o5 =
|
|
7180
|
+
const o5 = pt2(e5, n.Commands.Ready);
|
|
6948
7181
|
t5.forEach((t6) => {
|
|
6949
|
-
Ge(t6, (t7) =>
|
|
7182
|
+
Ge(t6, (t7) => ot(e5, "ready", t7))(void 0, o5);
|
|
6950
7183
|
});
|
|
6951
7184
|
})(e4, o4);
|
|
6952
7185
|
break;
|
|
6953
7186
|
case n.Commands.Run:
|
|
6954
7187
|
!(function(e5, t5) {
|
|
6955
7188
|
if (!e5.allowed) return;
|
|
6956
|
-
const o5 =
|
|
7189
|
+
const o5 = pt2(e5, n.Commands.Run);
|
|
6957
7190
|
t5.forEach((t6) => {
|
|
6958
|
-
Ge(t6, (t7) =>
|
|
7191
|
+
Ge(t6, (t7) => ot(e5, "run", t7))(void 0, o5);
|
|
6959
7192
|
});
|
|
6960
7193
|
})(e4, o4);
|
|
6961
7194
|
break;
|
|
6962
7195
|
case n.Commands.Session:
|
|
6963
7196
|
!(function(e5, t5) {
|
|
6964
7197
|
if (!e5.session) return;
|
|
6965
|
-
const o5 =
|
|
7198
|
+
const o5 = pt2(e5, n.Commands.Session);
|
|
6966
7199
|
t5.forEach((t6) => {
|
|
6967
|
-
Ge(t6, (t7) =>
|
|
7200
|
+
Ge(t6, (t7) => ot(e5, "session", t7))(e5.session, o5);
|
|
6968
7201
|
});
|
|
6969
7202
|
})(e4, o4);
|
|
6970
7203
|
break;
|
|
6971
7204
|
default: {
|
|
6972
|
-
const n5 =
|
|
7205
|
+
const n5 = pt2(e4, t4), r7 = st(t4);
|
|
6973
7206
|
o4.forEach((o5) => {
|
|
6974
|
-
"function" == typeof o5 && (r7 && !
|
|
7207
|
+
"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)));
|
|
6975
7208
|
});
|
|
6976
7209
|
break;
|
|
6977
7210
|
}
|
|
6978
7211
|
}
|
|
6979
7212
|
}
|
|
6980
|
-
function
|
|
7213
|
+
function vt2(e4, t4, o4) {
|
|
6981
7214
|
switch (t4) {
|
|
6982
7215
|
case n.Commands.Consent:
|
|
6983
7216
|
return o4 || e4.consent;
|
|
@@ -6995,364 +7228,364 @@ function pt2(e4, t4, o4) {
|
|
|
6995
7228
|
return;
|
|
6996
7229
|
}
|
|
6997
7230
|
}
|
|
6998
|
-
async function
|
|
7231
|
+
async function yt(e4, t4, n5, o4, r6) {
|
|
6999
7232
|
if (!t4.on) return false;
|
|
7000
|
-
if (
|
|
7001
|
-
if (
|
|
7002
|
-
const s4 = await
|
|
7003
|
-
return
|
|
7004
|
-
}
|
|
7005
|
-
async function
|
|
7006
|
-
if (
|
|
7007
|
-
if (!
|
|
7008
|
-
const n5 =
|
|
7009
|
-
|
|
7010
|
-
for (const [o4, r6] of Object.entries(e4.sources))
|
|
7011
|
-
}
|
|
7012
|
-
else
|
|
7013
|
-
}
|
|
7014
|
-
async function
|
|
7015
|
-
if (!
|
|
7233
|
+
if (st(o4) && !dt(e4, t4, o4)) return false;
|
|
7234
|
+
if (st(o4) && !ft(e4, t4, o4)) return false;
|
|
7235
|
+
const s4 = await Ye(t4.on, (t5) => ot(e4, "source", t5, { sourceId: n5, type: o4 }))(o4, r6);
|
|
7236
|
+
return st(o4) && ut(e4, t4, o4), false === s4;
|
|
7237
|
+
}
|
|
7238
|
+
async function wt2(e4) {
|
|
7239
|
+
if (et2(e4)) for (const t4 of rt) {
|
|
7240
|
+
if (!at(e4, t4)) continue;
|
|
7241
|
+
const n5 = vt2(e4, t4);
|
|
7242
|
+
ht2(e4, t4, e4.on[t4] || []);
|
|
7243
|
+
for (const [o4, r6] of Object.entries(e4.sources)) Ye2(r6) && await yt(e4, r6, o4, t4, n5);
|
|
7244
|
+
}
|
|
7245
|
+
else nt2();
|
|
7246
|
+
}
|
|
7247
|
+
async function bt2(e4, t4, n5, o4) {
|
|
7248
|
+
if (!et2(e4)) return nt2(), true;
|
|
7016
7249
|
e4.seenEvents.add(String(t4));
|
|
7017
7250
|
let r6 = n5 || [];
|
|
7018
7251
|
n5 || (r6 = e4.on[t4] || []);
|
|
7019
|
-
const s4 =
|
|
7252
|
+
const s4 = vt2(e4, t4, o4);
|
|
7020
7253
|
let a4 = false;
|
|
7021
7254
|
for (const [n6, o5] of Object.entries(e4.sources)) {
|
|
7022
7255
|
if (o5.config.require?.length) {
|
|
7023
7256
|
const e5 = o5.config.require.indexOf(t4);
|
|
7024
7257
|
-1 !== e5 && o5.config.require.splice(e5, 1);
|
|
7025
7258
|
}
|
|
7026
|
-
if (o5.on) if (
|
|
7027
|
-
await
|
|
7259
|
+
if (o5.on) if (Ye2(o5)) {
|
|
7260
|
+
await yt(e4, o5, n6, t4, s4) && (a4 = true);
|
|
7028
7261
|
} else o5.queueOn = o5.queueOn || [], o5.queueOn.push({ type: t4, data: s4 });
|
|
7029
7262
|
}
|
|
7030
7263
|
Object.entries(e4.destinations).forEach(([n6, o5]) => {
|
|
7031
7264
|
if (o5.on) {
|
|
7032
7265
|
if (!o5.config.init) return o5.queueOn = o5.queueOn || [], void o5.queueOn.push({ type: t4, data: s4 });
|
|
7033
|
-
|
|
7266
|
+
mt(e4, o5, n6, t4, s4);
|
|
7034
7267
|
}
|
|
7035
7268
|
});
|
|
7036
|
-
for (const [t5, n6] of Object.entries(e4.sources))
|
|
7037
|
-
const i5 = Object.values(e4.sources).some((e5) => !
|
|
7038
|
-
return (Object.keys(e4.pending.destinations).length > 0 || i5) && await
|
|
7269
|
+
for (const [t5, n6] of Object.entries(e4.sources)) Ye2(n6) && n6.queueOn?.length && await Ne2(e4, n6, t5);
|
|
7270
|
+
const i5 = Object.values(e4.sources).some((e5) => !Ye2(e5) && e5.config.require?.length);
|
|
7271
|
+
return (Object.keys(e4.pending.destinations).length > 0 || i5) && await Ze2(e4), ht2(e4, t4, r6, o4), !a4;
|
|
7039
7272
|
}
|
|
7040
|
-
function
|
|
7273
|
+
function kt2(e4) {
|
|
7041
7274
|
return "number" == typeof e4 && e4 > 0 ? e4 : 1e4;
|
|
7042
7275
|
}
|
|
7043
|
-
var
|
|
7276
|
+
var It2 = class extends Error {
|
|
7044
7277
|
constructor(e4) {
|
|
7045
7278
|
super(e4), this.name = "DestinationTimeoutError";
|
|
7046
7279
|
}
|
|
7047
7280
|
};
|
|
7048
|
-
function
|
|
7281
|
+
function Ct(e4, t4, n5) {
|
|
7049
7282
|
let o4;
|
|
7050
7283
|
const r6 = new Promise((e5, r7) => {
|
|
7051
|
-
o4 = setTimeout(() => r7(new
|
|
7284
|
+
o4 = setTimeout(() => r7(new It2(n5)), t4);
|
|
7052
7285
|
});
|
|
7053
7286
|
return Promise.race([e4, r6]).finally(() => {
|
|
7054
7287
|
o4 && clearTimeout(o4);
|
|
7055
7288
|
});
|
|
7056
7289
|
}
|
|
7057
|
-
var
|
|
7058
|
-
function
|
|
7059
|
-
return e4 ===
|
|
7290
|
+
var Et = Object.freeze({ batched: true });
|
|
7291
|
+
function St2(e4) {
|
|
7292
|
+
return e4 === Et;
|
|
7060
7293
|
}
|
|
7061
|
-
function
|
|
7294
|
+
function qt(e4) {
|
|
7062
7295
|
return void 0 === e4 ? {} : "number" == typeof e4 ? { wait: e4 } : { wait: e4.wait, size: e4.size, age: e4.age };
|
|
7063
7296
|
}
|
|
7064
|
-
function
|
|
7297
|
+
function xt2(e4, t4, n5) {
|
|
7065
7298
|
if (!e4) return [];
|
|
7066
|
-
if (Array.isArray(e4) && e4.every((e5) => "string" == typeof e5)) return
|
|
7067
|
-
if ("string" == typeof e4) return
|
|
7068
|
-
const o4 =
|
|
7069
|
-
return 0 === o4.length ? [] : 1 === o4.length ?
|
|
7299
|
+
if (Array.isArray(e4) && e4.every((e5) => "string" == typeof e5)) return Fe2(e4, t4);
|
|
7300
|
+
if ("string" == typeof e4) return Fe2(e4, t4);
|
|
7301
|
+
const o4 = zn(e4, Xn(n5));
|
|
7302
|
+
return 0 === o4.length ? [] : 1 === o4.length ? Fe2(o4[0], t4) : Fe2(o4, t4);
|
|
7070
7303
|
}
|
|
7071
|
-
async function
|
|
7304
|
+
async function Ot2(e4, t4) {
|
|
7072
7305
|
const { code: n5, config: o4 = {}, env: r6 = {}, before: s4, next: a4, cache: i5, state: c2 } = t4;
|
|
7073
|
-
if (!le(n5.push)) return
|
|
7306
|
+
if (!le(n5.push)) return Dt({ ok: false, failed: { invalid: { type: "invalid", error: "Destination code must have a push method" } } });
|
|
7074
7307
|
const u2 = o4 || { init: false };
|
|
7075
7308
|
let d2 = s4 ? { ...u2, before: s4 } : { ...u2 };
|
|
7076
7309
|
a4 && (d2 = { ...d2, next: a4 }), i5 && (d2 = { ...d2, cache: i5 }), void 0 !== c2 && void 0 === d2.state && (d2 = { ...d2, state: c2 });
|
|
7077
7310
|
let l3 = d2.id;
|
|
7078
7311
|
if (!l3) do {
|
|
7079
|
-
l3 =
|
|
7312
|
+
l3 = Ee(5, "abcdefghijklmnopqrstuvwxyz");
|
|
7080
7313
|
} while (e4.destinations[l3] || e4.pending.destinations[l3]);
|
|
7081
7314
|
if (d2.require?.length) {
|
|
7082
|
-
e4.pending.destinations[l3] = t4, await
|
|
7315
|
+
e4.pending.destinations[l3] = t4, await Ze2(e4);
|
|
7083
7316
|
const n6 = e4.destinations[l3];
|
|
7084
|
-
return n6 ?
|
|
7317
|
+
return n6 ? jt2(e4, void 0, {}, { [l3]: n6 }) : Dt({ ok: true });
|
|
7085
7318
|
}
|
|
7086
|
-
const f3 = { ...n5, config: d2, env:
|
|
7087
|
-
return e4.destinations[l3] = f3, false !== f3.config.queue && (f3.queuePush = [...e4.queue]),
|
|
7319
|
+
const f3 = { ...n5, config: d2, env: _t(n5.env, r6) };
|
|
7320
|
+
return e4.destinations[l3] = f3, false !== f3.config.queue && (f3.queuePush = [...e4.queue]), jt2(e4, void 0, {}, { [l3]: f3 });
|
|
7088
7321
|
}
|
|
7089
|
-
async function
|
|
7090
|
-
const { allowed: r6, consent: s4, globals: a4, user:
|
|
7091
|
-
if (!r6) return
|
|
7322
|
+
async function jt2(e4, t4, n5 = {}, o4) {
|
|
7323
|
+
const { allowed: r6, consent: s4, globals: a4, user: i5 } = e4;
|
|
7324
|
+
if (!r6) return Dt({ ok: false });
|
|
7092
7325
|
if (t4) {
|
|
7093
7326
|
const n6 = e4.config.queueMax;
|
|
7094
7327
|
if (void 0 === n6) throw new Error("Collector.Config.queueMax is undefined; defaults must be seeded by collector()");
|
|
7095
|
-
const o5 =
|
|
7328
|
+
const o5 = N(e4.queue, t4, { max: n6 });
|
|
7096
7329
|
if (o5.dropped > 0) {
|
|
7097
|
-
const t5 =
|
|
7098
|
-
|
|
7099
|
-
} else e4.queue.length < n6 &&
|
|
7330
|
+
const t5 = ae2(e4.status, o("collector"), "queue", o5.dropped);
|
|
7331
|
+
J2(e4.queue, e4.logger, "collector.queue overflow; oldest events dropped", { buffer: "queue", cap: n6, droppedCount: t5 });
|
|
7332
|
+
} else e4.queue.length < n6 && X2(e4.queue);
|
|
7100
7333
|
e4.status.in++;
|
|
7101
7334
|
}
|
|
7102
7335
|
o4 || (o4 = e4.destinations);
|
|
7103
|
-
const
|
|
7336
|
+
const c2 = e4.transformers ? Ke2(e4.transformers) : {}, u2 = await Promise.all(Object.entries(o4 || {}).map(async ([o5, r7]) => {
|
|
7104
7337
|
if (r7.config.disabled) return { id: o5, destination: r7, skipped: true };
|
|
7105
|
-
const
|
|
7106
|
-
if (
|
|
7338
|
+
const u3 = r7.config.id || o5, d3 = o("destination", u3), y4 = te2(r7.config.breaker);
|
|
7339
|
+
if (y4 && (function(e5, t5, n6) {
|
|
7107
7340
|
const o6 = e5[t5];
|
|
7108
7341
|
if (!o6 || "closed" === o6.state) return false;
|
|
7109
7342
|
if ("half-open" === o6.state) return true === o6.probing;
|
|
7110
|
-
const r8 =
|
|
7343
|
+
const r8 = ee2();
|
|
7111
7344
|
return void 0 !== o6.openUntil && r8 < o6.openUntil || (o6.state = "half-open", o6.probing = true, o6.openUntil = r8 + n6, false);
|
|
7112
|
-
})(e4.status.breakers,
|
|
7113
|
-
const
|
|
7114
|
-
|
|
7115
|
-
},
|
|
7116
|
-
|
|
7345
|
+
})(e4.status.breakers, d3, y4.cooldown)) return { id: o5, destination: r7, skipped: true };
|
|
7346
|
+
const b4 = (t5) => {
|
|
7347
|
+
y4 && ne2(e4.status.breakers, d3, t5, y4.threshold, y4.cooldown);
|
|
7348
|
+
}, I3 = () => {
|
|
7349
|
+
y4 && (function(e5, t5) {
|
|
7117
7350
|
const n6 = e5[t5];
|
|
7118
7351
|
n6 && "half-open" === n6.state && true === n6.probing && (n6.state = "open", n6.probing = false);
|
|
7119
|
-
})(e4.status.breakers,
|
|
7352
|
+
})(e4.status.breakers, d3);
|
|
7120
7353
|
};
|
|
7121
7354
|
let C3 = (r7.queuePush || []).map((e5) => ({ ...e5, consent: s4 }));
|
|
7122
7355
|
r7.queuePush = [], t4 && C3.push(he(t4));
|
|
7123
|
-
const
|
|
7124
|
-
if (!C3.length && !r7.queueOn?.length) return
|
|
7356
|
+
const E2 = n5.ingest ? { ...n5.ingest, _meta: { ...n5.ingest._meta, path: [...n5.ingest._meta.path] } } : I("unknown");
|
|
7357
|
+
if (!C3.length && !r7.queueOn?.length) return I3(), { id: o5, destination: r7, skipped: true };
|
|
7125
7358
|
if (!C3.length && r7.queueOn?.length) {
|
|
7126
|
-
if (!
|
|
7359
|
+
if (!Se(r7.config.consent, s4)) return I3(), { id: o5, destination: r7, skipped: true };
|
|
7127
7360
|
let t5 = false;
|
|
7128
7361
|
try {
|
|
7129
|
-
t5 = await
|
|
7362
|
+
t5 = await $t2(e4, r7, o5, true);
|
|
7130
7363
|
} catch (t6) {
|
|
7131
7364
|
e4.status.failed++;
|
|
7132
7365
|
const n6 = r7.type || "unknown";
|
|
7133
|
-
e4.logger.scope(n6).error("destination init failed", { error: t6 instanceof Error ? t6.message : String(t6) }),
|
|
7366
|
+
e4.logger.scope(n6).error("destination init failed", { error: t6 instanceof Error ? t6.message : String(t6) }), b4("transport-failure");
|
|
7134
7367
|
}
|
|
7135
|
-
return
|
|
7368
|
+
return I3(), { id: o5, destination: r7, skipped: !t5 };
|
|
7136
7369
|
}
|
|
7137
|
-
const
|
|
7138
|
-
const n6 =
|
|
7139
|
-
if (n6) return t5.consent = n6,
|
|
7140
|
-
const a5 =
|
|
7141
|
-
return a5.skipReason = "consent", s4 && (a5.consent = { ...s4 }), r7.config.consent && (a5.meta = { required: { ...r7.config.consent } }),
|
|
7370
|
+
const S2 = [], q3 = C3.filter((t5) => {
|
|
7371
|
+
const n6 = Se(r7.config.consent, s4, t5.consent);
|
|
7372
|
+
if (n6) return t5.consent = n6, S2.push(t5), false;
|
|
7373
|
+
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) });
|
|
7374
|
+
return a5.skipReason = "consent", s4 && (a5.consent = { ...s4 }), r7.config.consent && (a5.meta = { required: { ...r7.config.consent } }), on(e4, a5), true;
|
|
7142
7375
|
});
|
|
7143
|
-
if (
|
|
7376
|
+
if (q3.length > 0) {
|
|
7144
7377
|
const t5 = r7.queuePush, n6 = r7.config.id || o5, s5 = { max: r7.config.queueMax ?? 1e3 };
|
|
7145
7378
|
let a5 = 0;
|
|
7146
|
-
for (const e5 of
|
|
7147
|
-
a5 +=
|
|
7379
|
+
for (const e5 of q3) {
|
|
7380
|
+
a5 += N(t5, e5, s5).dropped;
|
|
7148
7381
|
}
|
|
7149
7382
|
if (a5 > 0) {
|
|
7150
|
-
|
|
7151
|
-
const o6 =
|
|
7152
|
-
|
|
7153
|
-
} else t5.length < s5.max &&
|
|
7383
|
+
se(e4, n6);
|
|
7384
|
+
const o6 = ae2(e4.status, o("destination", n6), "queue", a5);
|
|
7385
|
+
J2(t5, e4.logger.scope(r7.type || "unknown"), "destination.queuePush overflow; oldest events dropped", { buffer: "queuePush", destination: n6, cap: s5.max, droppedCount: o6 });
|
|
7386
|
+
} else t5.length < s5.max && X2(t5);
|
|
7154
7387
|
}
|
|
7155
|
-
if (!
|
|
7156
|
-
let
|
|
7388
|
+
if (!S2.length) return I3(), { id: o5, destination: r7, queue: C3 };
|
|
7389
|
+
let x2, $2, M3 = false;
|
|
7157
7390
|
try {
|
|
7158
|
-
|
|
7391
|
+
M3 = await $t2(e4, r7, o5, true);
|
|
7159
7392
|
} catch (t5) {
|
|
7160
7393
|
e4.status.failed++;
|
|
7161
7394
|
const n6 = r7.type || "unknown";
|
|
7162
|
-
e4.logger.scope(n6).error("destination init failed", { error: t5 instanceof Error ? t5.message : String(t5) }),
|
|
7395
|
+
e4.logger.scope(n6).error("destination init failed", { error: t5 instanceof Error ? t5.message : String(t5) }), b4("transport-failure");
|
|
7163
7396
|
}
|
|
7164
|
-
if (!
|
|
7397
|
+
if (!M3) return I3(), { id: o5, destination: r7, queue: C3 };
|
|
7165
7398
|
r7.dlq || (r7.dlq = []);
|
|
7166
|
-
const
|
|
7167
|
-
let
|
|
7168
|
-
return await Promise.all(
|
|
7399
|
+
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);
|
|
7400
|
+
let G3 = 0, W2 = 0;
|
|
7401
|
+
return await Promise.all(S2.map(async (t5) => {
|
|
7169
7402
|
let s5;
|
|
7170
|
-
if (t5.globals = oe(a4, t5.globals), t5.user = oe(
|
|
7171
|
-
const e5 =
|
|
7403
|
+
if (t5.globals = oe(a4, t5.globals), t5.user = oe(i5, t5.user), K4?.stop && B3) {
|
|
7404
|
+
const e5 = Xn(E2, t5), n6 = await er(K4, B3, e5);
|
|
7172
7405
|
if ("HIT" === n6?.status) return t5;
|
|
7173
7406
|
"MISS" === n6?.status && (s5 = { key: n6.key, ttl: n6.rule.ttl });
|
|
7174
7407
|
}
|
|
7175
|
-
let
|
|
7176
|
-
if (
|
|
7177
|
-
const r8 = await
|
|
7408
|
+
let u4 = t5, d4 = n5.respond;
|
|
7409
|
+
if (P3.length > 0 && e4.transformers && Object.keys(e4.transformers).length > 0) {
|
|
7410
|
+
const r8 = await We2(e4, e4.transformers, P3, t5, E2, n5.respond, `destination.${o5}.before`);
|
|
7178
7411
|
if (null === r8.event) return t5;
|
|
7179
|
-
r8.respond && (
|
|
7412
|
+
r8.respond && (d4 = r8.respond), u4 = Array.isArray(r8.event) ? r8.event[0] : r8.event;
|
|
7180
7413
|
}
|
|
7181
|
-
if (
|
|
7182
|
-
const e5 =
|
|
7414
|
+
if (K4 && !K4.stop && B3) {
|
|
7415
|
+
const e5 = Xn(E2, u4), n6 = await er(K4, B3, e5);
|
|
7183
7416
|
if ("HIT" === n6?.status) return t5;
|
|
7184
7417
|
"MISS" === n6?.status && (s5 = { key: n6.key, ttl: n6.rule.ttl });
|
|
7185
7418
|
}
|
|
7186
|
-
|
|
7419
|
+
R4 && R4.length > 0 && u4 && (u4 = await or(R4, (t6) => Ue2(t6, e4), u4, e4));
|
|
7187
7420
|
const p3 = Date.now();
|
|
7188
|
-
let
|
|
7189
|
-
const v3 = await
|
|
7421
|
+
let g3 = false;
|
|
7422
|
+
const v3 = await Ye(At2, (t6) => {
|
|
7190
7423
|
const n6 = r7.type || "unknown";
|
|
7191
|
-
e4.logger.scope(n6).error("Push failed", { error: t6, event:
|
|
7192
|
-
const s6 = r7.dlq, a5 = r7.config.id || o5,
|
|
7193
|
-
if (
|
|
7194
|
-
|
|
7195
|
-
const t7 =
|
|
7196
|
-
|
|
7197
|
-
} else s6.length <
|
|
7198
|
-
})(e4, r7, o5,
|
|
7199
|
-
if (
|
|
7200
|
-
void 0 !== v3 && (
|
|
7201
|
-
const t6 =
|
|
7424
|
+
e4.logger.scope(n6).error("Push failed", { error: t6, event: u4.name }), x2 = t6, g3 = true;
|
|
7425
|
+
const s6 = r7.dlq, a5 = r7.config.id || o5, i6 = { max: r7.config.dlqMax ?? re2 }, c3 = N(s6, [u4, t6], i6);
|
|
7426
|
+
if (c3.dropped > 0) {
|
|
7427
|
+
se(e4, a5);
|
|
7428
|
+
const t7 = ae2(e4.status, o("destination", a5), "dlq", c3.dropped);
|
|
7429
|
+
J2(s6, e4.logger.scope(r7.type || "unknown"), "destination.dlq overflow; oldest entries dropped", { buffer: "dlq", destination: a5, cap: i6.max, droppedCount: t7 });
|
|
7430
|
+
} else s6.length < i6.max && X2(s6);
|
|
7431
|
+
})(e4, r7, o5, u4, E2, d4);
|
|
7432
|
+
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) {
|
|
7433
|
+
void 0 !== v3 && (E2._response = v3);
|
|
7434
|
+
const t6 = xt2(z5, c2, E2);
|
|
7202
7435
|
if (t6.length > 0 && e4.transformers && Object.keys(e4.transformers).length > 0) {
|
|
7203
|
-
const n6 = await
|
|
7204
|
-
n6.respond && (
|
|
7436
|
+
const n6 = await We2(e4, e4.transformers, t6, u4, E2, d4, `destination.${o5}.next`);
|
|
7437
|
+
n6.respond && (d4 = n6.respond);
|
|
7205
7438
|
}
|
|
7206
7439
|
}
|
|
7207
7440
|
return t5;
|
|
7208
|
-
})), { id: o5, destination: r7, error:
|
|
7209
|
-
})),
|
|
7210
|
-
for (const t5 of
|
|
7441
|
+
})), { id: o5, destination: r7, error: x2, response: $2, totalDuration: G3, batchedCount: W2, allowedCount: S2.length, canonicalId: u3, breakerConfig: y4 };
|
|
7442
|
+
})), d2 = {}, y3 = {}, b3 = {};
|
|
7443
|
+
for (const t5 of u2) {
|
|
7211
7444
|
if (t5.skipped) continue;
|
|
7212
7445
|
const n6 = t5.destination, o5 = { type: n6.type || "unknown", data: t5.response };
|
|
7213
|
-
|
|
7446
|
+
se(e4, t5.id);
|
|
7214
7447
|
const r7 = e4.status.destinations[t5.id], s5 = Date.now();
|
|
7215
7448
|
r7.queuePushSize = n6.queuePush?.length ?? 0, r7.dlqSize = n6.dlq?.length ?? 0;
|
|
7216
|
-
const a5 = t5.breakerConfig,
|
|
7217
|
-
a5 &&
|
|
7449
|
+
const a5 = t5.breakerConfig, i6 = t5.canonicalId ? o("destination", t5.canonicalId) : void 0, c3 = (t6) => {
|
|
7450
|
+
a5 && i6 && ne2(e4.status.breakers, i6, t6, a5.threshold, a5.cooldown);
|
|
7218
7451
|
};
|
|
7219
|
-
if (t5.error) o5.error = t5.error,
|
|
7220
|
-
else if (t5.queue && t5.queue.length)
|
|
7452
|
+
if (t5.error) o5.error = t5.error, b3[t5.id] = o5, r7.failed++, r7.lastAt = s5, r7.duration += t5.totalDuration || 0, e4.status.failed++, c3("transport-failure");
|
|
7453
|
+
else if (t5.queue && t5.queue.length) y3[t5.id] = o5;
|
|
7221
7454
|
else {
|
|
7222
7455
|
const n7 = t5.batchedCount ?? 0, a6 = t5.allowedCount ?? 0;
|
|
7223
|
-
(Math.max(0, a6 - n7) > 0 || 0 === a6) && (
|
|
7456
|
+
(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"));
|
|
7224
7457
|
}
|
|
7225
7458
|
}
|
|
7226
|
-
return
|
|
7459
|
+
return Dt({ event: t4, ...Object.keys(d2).length && { done: d2 }, ...Object.keys(y3).length && { queued: y3 }, ...Object.keys(b3).length && { failed: b3 } });
|
|
7227
7460
|
}
|
|
7228
|
-
async function
|
|
7461
|
+
async function $t2(e4, t4, n5, o4 = false) {
|
|
7229
7462
|
if (t4.init && !t4.config.init) {
|
|
7230
7463
|
if (!o4 && (function(e5) {
|
|
7231
7464
|
const t5 = e5.config.consent;
|
|
7232
7465
|
return !!t5 && Object.keys(t5).length > 0;
|
|
7233
7466
|
})(t4)) return e4.logger.scope(t4.type || "unknown").debug("init blocked: consent gate not cleared"), false;
|
|
7234
|
-
const r6 = t4.type || "unknown", s4 = e4.logger.scope(r6), a4 = { collector: e4, logger: s4, id: n5, config: t4.config, env:
|
|
7467
|
+
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) };
|
|
7235
7468
|
s4.debug("init");
|
|
7236
7469
|
const i5 = Date.now();
|
|
7237
7470
|
let c2;
|
|
7238
|
-
|
|
7471
|
+
on(e4, _(e4, { stepId: o("destination", n5), stepType: "destination", phase: "init", eventId: "", now: i5 }));
|
|
7239
7472
|
try {
|
|
7240
7473
|
c2 = await gt(t4.init, "DestinationInit", e4.hooks, e4.logger)(a4);
|
|
7241
7474
|
} catch (t5) {
|
|
7242
|
-
const o5 = Date.now(), r7 =
|
|
7243
|
-
throw r7.durationMs = o5 - i5, r7.error = t5 instanceof Error ? { name: t5.name, message: t5.message } : { message: String(t5) },
|
|
7475
|
+
const o5 = Date.now(), r7 = _(e4, { stepId: o("destination", n5), stepType: "destination", phase: "error", eventId: "", now: o5 });
|
|
7476
|
+
throw r7.durationMs = o5 - i5, r7.error = t5 instanceof Error ? { name: t5.name, message: t5.message } : { message: String(t5) }, on(e4, r7), t5;
|
|
7244
7477
|
}
|
|
7245
7478
|
if (false === c2) return c2;
|
|
7246
7479
|
if (t4.config = { ...c2 || t4.config, init: true }, t4.queueOn?.length) {
|
|
7247
7480
|
const o5 = t4.queueOn;
|
|
7248
7481
|
t4.queueOn = [];
|
|
7249
|
-
for (const { type: r7, data: s5 } of o5)
|
|
7482
|
+
for (const { type: r7, data: s5 } of o5) mt(e4, t4, n5, r7, s5);
|
|
7250
7483
|
}
|
|
7251
7484
|
s4.debug("init done");
|
|
7252
7485
|
}
|
|
7253
7486
|
return true;
|
|
7254
7487
|
}
|
|
7255
|
-
async function
|
|
7488
|
+
async function At2(e4, t4, n5, o4, r6, s4) {
|
|
7256
7489
|
const { config: a4 } = t4, i5 = await nt(o4, a4, e4);
|
|
7257
7490
|
if (i5.ignore) return false;
|
|
7258
|
-
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: { ...
|
|
7491
|
+
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) };
|
|
7259
7492
|
if (void 0 !== a4.mock) return u2.debug("mock", { event: i5.event.name }), a4.mock;
|
|
7260
7493
|
const l3 = i5.mapping, f3 = void 0 !== l3?.batch, p3 = f3 ? i5.mappingKey || "* *" : " batch-all";
|
|
7261
7494
|
if ((f3 || void 0 !== a4.batch) && t4.pushBatch && void 0 === a4.mock) {
|
|
7262
7495
|
if (t4.batches = t4.batches || {}, !t4.batches[p3]) {
|
|
7263
|
-
const o5 = { key: p3, entries: [], events: [], data: [] }, r7 =
|
|
7496
|
+
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 () => {
|
|
7264
7497
|
const o6 = t4.batches[p3], r8 = o6.batched;
|
|
7265
7498
|
if (0 === r8.entries.length) return;
|
|
7266
7499
|
const s6 = { key: r8.key, entries: r8.entries, events: r8.events, data: r8.data };
|
|
7267
7500
|
r8.entries = [], r8.events = [], r8.data = [];
|
|
7268
|
-
const i7 = s6.entries[0], { traceId: c5, sourceId: d5, parentEventId: l4 } =
|
|
7501
|
+
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) };
|
|
7269
7502
|
u2.debug("push batch", { events: s6.entries.length });
|
|
7270
|
-
const
|
|
7271
|
-
|
|
7272
|
-
},
|
|
7273
|
-
|
|
7274
|
-
const
|
|
7275
|
-
const o7 = t4.dlq = t4.dlq || [], r9 = { max: t4.config.dlqMax ??
|
|
7503
|
+
const m5 = t4.config.id || n5, h3 = se(e4, m5), v4 = te2(t4.config.breaker), y3 = o("destination", m5), b4 = (t5) => {
|
|
7504
|
+
v4 && ne2(e4.status.breakers, y3, t5, v4.threshold, v4.cooldown);
|
|
7505
|
+
}, k4 = Date.now(), I3 = _(e4, { stepId: o("destination", n5), stepType: "destination", phase: "flush", eventId: "", now: k4, traceId: c5, sourceId: d5, parentEventId: l4 });
|
|
7506
|
+
I3.batch = { size: s6.entries.length, index: 0 }, on(e4, I3);
|
|
7507
|
+
const C3 = (n6) => {
|
|
7508
|
+
const o7 = t4.dlq = t4.dlq || [], r9 = { max: t4.config.dlqMax ?? re2 };
|
|
7276
7509
|
let s7 = 0;
|
|
7277
7510
|
for (const e5 of n6) {
|
|
7278
|
-
s7 +=
|
|
7511
|
+
s7 += N(o7, e5, r9).dropped;
|
|
7279
7512
|
}
|
|
7280
7513
|
if (s7 > 0) {
|
|
7281
|
-
const t5 =
|
|
7282
|
-
|
|
7283
|
-
} else o7.length < r9.max &&
|
|
7284
|
-
|
|
7514
|
+
const t5 = ae2(e4.status, o("destination", m5), "dlq", s7);
|
|
7515
|
+
J2(o7, u2, "destination.dlq overflow; oldest entries dropped", { buffer: "dlq", destination: m5, cap: r9.max, droppedCount: t5 });
|
|
7516
|
+
} else o7.length < r9.max && X2(o7);
|
|
7517
|
+
h3.failed += n6.length, h3.dlqSize = o7.length, e4.status.failed += n6.length;
|
|
7285
7518
|
};
|
|
7286
|
-
let
|
|
7287
|
-
const
|
|
7288
|
-
|
|
7289
|
-
const o7 = Date.now(), r9 =
|
|
7290
|
-
r9.durationMs = o7 -
|
|
7519
|
+
let E2 = s6.entries.length;
|
|
7520
|
+
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) => {
|
|
7521
|
+
E2 = 0;
|
|
7522
|
+
const o7 = Date.now(), r9 = _(e4, { stepId: o("destination", n5), stepType: "destination", phase: "error", eventId: "", now: o7, traceId: c5, sourceId: d5, parentEventId: l4 });
|
|
7523
|
+
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 });
|
|
7291
7524
|
})(s6, f4);
|
|
7292
|
-
if (de(
|
|
7525
|
+
if (de(A2 = x2) && Array.isArray(A2.failed) && x2.failed.length > 0) {
|
|
7293
7526
|
const e5 = [], t5 = /* @__PURE__ */ new Set();
|
|
7294
|
-
for (const n6 of
|
|
7527
|
+
for (const n6 of x2.failed) {
|
|
7295
7528
|
const o7 = s6.entries[n6.index];
|
|
7296
7529
|
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)`)]));
|
|
7297
7530
|
}
|
|
7298
|
-
e5.length > 0 && (
|
|
7531
|
+
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 }));
|
|
7299
7532
|
}
|
|
7300
|
-
var
|
|
7301
|
-
u2.debug("push batch done"),
|
|
7533
|
+
var A2;
|
|
7534
|
+
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"));
|
|
7302
7535
|
}, { wait: i6, size: c4, age: d4 });
|
|
7303
7536
|
t4.batches[p3] = { batched: o5, isDefault: !f3, batchFn: () => {
|
|
7304
|
-
|
|
7537
|
+
m4();
|
|
7305
7538
|
}, flush: async () => {
|
|
7306
|
-
await
|
|
7539
|
+
await m4.flush();
|
|
7307
7540
|
} };
|
|
7308
7541
|
}
|
|
7309
7542
|
const c3 = t4.batches[p3];
|
|
7310
7543
|
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);
|
|
7311
|
-
const d3 = "string" == typeof i5.event.id ? i5.event.id : "",
|
|
7312
|
-
i5.mappingKey && (
|
|
7313
|
-
const
|
|
7314
|
-
i5.mappingKey && (
|
|
7315
|
-
const
|
|
7316
|
-
return
|
|
7544
|
+
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 });
|
|
7545
|
+
i5.mappingKey && (h2.mappingKey = i5.mappingKey), i5.event.consent && (h2.consent = { ...i5.event.consent }), h2.inEvent = i5.event, on(e4, h2);
|
|
7546
|
+
const v3 = _(e4, { stepId: o("destination", n5), stepType: "destination", phase: "out", eventId: d3, now: m3, traceId: g3.traceId, sourceId: g3.sourceId, parentEventId: g3.parentEventId });
|
|
7547
|
+
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);
|
|
7548
|
+
const b3 = t4.config.id || n5, k3 = se(e4, b3);
|
|
7549
|
+
return k3.inFlightBatch = (k3.inFlightBatch ?? 0) + 1, c3.batchFn(), Et;
|
|
7317
7550
|
}
|
|
7318
7551
|
{
|
|
7319
7552
|
let s5;
|
|
7320
7553
|
if (u2.debug("push", { event: i5.event.name }), "trace" === e4.observeLevel?.() && Array.isArray(t4.calls) && t4.calls.length > 0) {
|
|
7321
|
-
const e5 =
|
|
7322
|
-
d2.env = e5.wrappedEnv, s5 = e5.calls, e5.unresolved.length > 0 && (e5.wrappedEnv[
|
|
7554
|
+
const e5 = K2({ ...d2.env, simulation: t4.calls });
|
|
7555
|
+
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() }) });
|
|
7323
7556
|
}
|
|
7324
|
-
const c3 = "string" == typeof i5.event.id ? i5.event.id : "", { traceId: l4, sourceId: f4, parentEventId: p4 } =
|
|
7325
|
-
i5.mappingKey && (
|
|
7557
|
+
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 });
|
|
7558
|
+
i5.mappingKey && (m3.mappingKey = i5.mappingKey), i5.event.consent && (m3.consent = { ...i5.event.consent }), m3.inEvent = i5.event, on(e4, m3);
|
|
7326
7559
|
try {
|
|
7327
|
-
const o5 =
|
|
7328
|
-
return
|
|
7560
|
+
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 });
|
|
7561
|
+
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;
|
|
7329
7562
|
} catch (t5) {
|
|
7330
|
-
const o5 = Date.now(), r7 =
|
|
7331
|
-
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 =
|
|
7563
|
+
const o5 = Date.now(), r7 = _(e4, { stepId: o("destination", n5), stepType: "destination", phase: "error", eventId: c3, now: o5, traceId: l4, sourceId: f4, parentEventId: p4 });
|
|
7564
|
+
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;
|
|
7332
7565
|
}
|
|
7333
7566
|
}
|
|
7334
7567
|
}
|
|
7335
|
-
function
|
|
7568
|
+
function Dt(e4) {
|
|
7336
7569
|
return { ok: !e4?.failed, ...e4 };
|
|
7337
7570
|
}
|
|
7338
|
-
function
|
|
7339
|
-
const { code: t4, config: n5 = {}, env: o4 = {}, cache: r6, state: s4 } = e4, { config: a4 } =
|
|
7571
|
+
function Mt(e4) {
|
|
7572
|
+
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 };
|
|
7340
7573
|
r6 && (c2.cache = r6), void 0 !== s4 && void 0 === c2.state && (c2.state = s4);
|
|
7341
|
-
const u2 =
|
|
7574
|
+
const u2 = _t(t4.env, o4);
|
|
7342
7575
|
return { ...t4, config: c2, env: u2 };
|
|
7343
7576
|
}
|
|
7344
|
-
async function
|
|
7577
|
+
async function Tt(e4, t4 = {}) {
|
|
7345
7578
|
const n5 = {};
|
|
7346
|
-
for (const [o4, r6] of Object.entries(t4)) r6.config?.require?.length ? e4.pending.destinations[o4] = r6 : n5[o4] =
|
|
7579
|
+
for (const [o4, r6] of Object.entries(t4)) r6.config?.require?.length ? e4.pending.destinations[o4] = r6 : n5[o4] = Mt(r6);
|
|
7347
7580
|
return n5;
|
|
7348
7581
|
}
|
|
7349
|
-
function
|
|
7582
|
+
function _t(e4, t4) {
|
|
7350
7583
|
return e4 || t4 ? t4 ? e4 && de(e4) && de(t4) ? { ...e4, ...t4 } : t4 : e4 : {};
|
|
7351
7584
|
}
|
|
7352
|
-
var
|
|
7353
|
-
async function
|
|
7585
|
+
var Rt = 5e3;
|
|
7586
|
+
async function Ht(e4) {
|
|
7354
7587
|
const t4 = e4.logger;
|
|
7355
|
-
await
|
|
7588
|
+
await Gt(e4.sources, "source", t4), await (async function(e5, t5) {
|
|
7356
7589
|
const n5 = Object.entries(e5).flatMap(([e6, n6]) => {
|
|
7357
7590
|
const o4 = n6.batches;
|
|
7358
7591
|
if (!o4) return [];
|
|
@@ -7361,7 +7594,7 @@ async function Ft(e4) {
|
|
|
7361
7594
|
let n7;
|
|
7362
7595
|
try {
|
|
7363
7596
|
await Promise.race([t6.flush(), new Promise((t7, o5) => {
|
|
7364
|
-
n7 = setTimeout(() => o5(new Error(`destination '${e6}' batch flush timed out`)),
|
|
7597
|
+
n7 = setTimeout(() => o5(new Error(`destination '${e6}' batch flush timed out`)), Rt);
|
|
7365
7598
|
})]);
|
|
7366
7599
|
} catch (t7) {
|
|
7367
7600
|
r6.error(`destination '${e6}' batch flush failed: ${t7}`);
|
|
@@ -7371,9 +7604,9 @@ async function Ft(e4) {
|
|
|
7371
7604
|
});
|
|
7372
7605
|
});
|
|
7373
7606
|
await Promise.allSettled(n5);
|
|
7374
|
-
})(e4.destinations, t4), await
|
|
7607
|
+
})(e4.destinations, t4), await Gt(e4.destinations, "destination", t4), await Gt(e4.transformers, "transformer", t4), await Gt(e4.stores, "store", t4);
|
|
7375
7608
|
}
|
|
7376
|
-
async function
|
|
7609
|
+
async function Gt(e4, t4, n5) {
|
|
7377
7610
|
const o4 = Object.entries(e4).map(async ([e5, o5]) => {
|
|
7378
7611
|
const r6 = o5.destroy;
|
|
7379
7612
|
if (!r6) return;
|
|
@@ -7381,7 +7614,7 @@ async function Ut(e4, t4, n5) {
|
|
|
7381
7614
|
let c2;
|
|
7382
7615
|
try {
|
|
7383
7616
|
await Promise.race([r6(i5), new Promise((n6, o6) => {
|
|
7384
|
-
c2 = setTimeout(() => o6(new Error(`${t4} '${e5}' destroy timed out`)),
|
|
7617
|
+
c2 = setTimeout(() => o6(new Error(`${t4} '${e5}' destroy timed out`)), Rt);
|
|
7385
7618
|
})]);
|
|
7386
7619
|
} catch (n6) {
|
|
7387
7620
|
a4.error(`${t4} '${e5}' destroy failed: ${n6}`);
|
|
@@ -7391,12 +7624,12 @@ async function Ut(e4, t4, n5) {
|
|
|
7391
7624
|
});
|
|
7392
7625
|
await Promise.allSettled(o4);
|
|
7393
7626
|
}
|
|
7394
|
-
function
|
|
7627
|
+
function Wt(e4, t4) {
|
|
7395
7628
|
e4.stateVersion++, e4.cellVersion[t4] = e4.stateVersion;
|
|
7396
7629
|
}
|
|
7397
|
-
async function
|
|
7630
|
+
async function Lt(e4, t4, o4) {
|
|
7398
7631
|
let s4, a4, i5 = false;
|
|
7399
|
-
const c2 =
|
|
7632
|
+
const c2 = lt2(e4);
|
|
7400
7633
|
try {
|
|
7401
7634
|
return await (async function() {
|
|
7402
7635
|
switch (t4) {
|
|
@@ -7406,17 +7639,17 @@ async function Ht(e4, t4, o4) {
|
|
|
7406
7639
|
case n.Commands.Consent:
|
|
7407
7640
|
if (de(o4)) {
|
|
7408
7641
|
const { update: t5 } = r2(e4, o4);
|
|
7409
|
-
|
|
7642
|
+
Wt(e4, n.Commands.Consent), a4 = t5, i5 = true;
|
|
7410
7643
|
}
|
|
7411
7644
|
break;
|
|
7412
7645
|
case n.Commands.Custom:
|
|
7413
|
-
de(o4) && (e4.custom = oe(e4.custom, o4),
|
|
7646
|
+
de(o4) && (e4.custom = oe(e4.custom, o4), Wt(e4, n.Commands.Custom), a4 = o4, i5 = true);
|
|
7414
7647
|
break;
|
|
7415
7648
|
case n.Commands.Destination:
|
|
7416
|
-
de(o4) && "code" in o4 && de(o4.code) && (s4 = await
|
|
7649
|
+
de(o4) && "code" in o4 && de(o4.code) && (s4 = await Ot2(e4, o4));
|
|
7417
7650
|
break;
|
|
7418
7651
|
case n.Commands.Globals:
|
|
7419
|
-
de(o4) && (e4.globals = oe(e4.globals, o4),
|
|
7652
|
+
de(o4) && (e4.globals = oe(e4.globals, o4), Wt(e4, n.Commands.Globals), a4 = o4, i5 = true);
|
|
7420
7653
|
break;
|
|
7421
7654
|
case n.Commands.Hook:
|
|
7422
7655
|
if (de(o4) && ge(o4.name) && le(o4.fn)) {
|
|
@@ -7427,90 +7660,90 @@ async function Ht(e4, t4, o4) {
|
|
|
7427
7660
|
case n.Commands.On:
|
|
7428
7661
|
if (de(o4) && ge(o4.type)) {
|
|
7429
7662
|
const { type: t5, rules: n5 } = o4;
|
|
7430
|
-
await
|
|
7663
|
+
await gt2(e4, t5, n5);
|
|
7431
7664
|
}
|
|
7432
7665
|
break;
|
|
7433
7666
|
case n.Commands.Ready:
|
|
7434
7667
|
i5 = true;
|
|
7435
7668
|
break;
|
|
7436
7669
|
case n.Commands.Run:
|
|
7437
|
-
s4 = await
|
|
7670
|
+
s4 = await Jt(e4, o4), i5 = true;
|
|
7438
7671
|
break;
|
|
7439
7672
|
case n.Commands.Session:
|
|
7440
7673
|
i5 = true;
|
|
7441
7674
|
break;
|
|
7442
7675
|
case n.Commands.Shutdown:
|
|
7443
|
-
e4.hasShutdown || (e4.hasShutdown = true, await
|
|
7676
|
+
e4.hasShutdown || (e4.hasShutdown = true, await Ht(e4));
|
|
7444
7677
|
break;
|
|
7445
7678
|
case n.Commands.User:
|
|
7446
|
-
de(o4) && (oe(e4.user, o4, { shallow: false }),
|
|
7679
|
+
de(o4) && (oe(e4.user, o4, { shallow: false }), Wt(e4, n.Commands.User), a4 = o4, i5 = true);
|
|
7447
7680
|
break;
|
|
7448
7681
|
default:
|
|
7449
|
-
return e4.logger.warn("unknown command", { command: t4 }),
|
|
7682
|
+
return e4.logger.warn("unknown command", { command: t4 }), Dt({ ok: false });
|
|
7450
7683
|
}
|
|
7451
|
-
i5 && (await
|
|
7452
|
-
return s4 ||
|
|
7684
|
+
i5 && (await bt2(e4, t4, void 0, a4), s4 = await jt2(e4));
|
|
7685
|
+
return s4 || Dt({ ok: true });
|
|
7453
7686
|
})();
|
|
7454
7687
|
} finally {
|
|
7455
7688
|
c2();
|
|
7456
7689
|
}
|
|
7457
7690
|
}
|
|
7458
|
-
function
|
|
7691
|
+
function Vt(e4, t4) {
|
|
7459
7692
|
return { timing: Math.round((Date.now() - e4.timing) / 10) / 100, source: { type: "collector", schema: "4" }, ...t4 };
|
|
7460
7693
|
}
|
|
7461
|
-
function
|
|
7694
|
+
function Nt2(e4, t4, n5) {
|
|
7462
7695
|
if (!t4.name) throw new Error("Event name is required");
|
|
7463
7696
|
const [o4, r6] = t4.name.split(" ");
|
|
7464
7697
|
if (!o4 || !r6) throw new Error("Event name is invalid");
|
|
7465
|
-
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,
|
|
7466
|
-
void 0 !== k3 && (
|
|
7467
|
-
const C3 = e4.name ?? w3.platform ?? "default",
|
|
7468
|
-
return
|
|
7698
|
+
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 };
|
|
7699
|
+
void 0 !== k3 && (I3.trace = k3);
|
|
7700
|
+
const C3 = e4.name ?? w3.platform ?? "default", E2 = e4.release ?? "4.3.1-next-1784373088875";
|
|
7701
|
+
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 };
|
|
7469
7702
|
}
|
|
7470
|
-
function
|
|
7471
|
-
return
|
|
7703
|
+
function Yt(e4, t4, n5) {
|
|
7704
|
+
return Nt2(e4, Vt(e4, t4), n5);
|
|
7472
7705
|
}
|
|
7473
|
-
async function
|
|
7474
|
-
e4.allowed = true, e4.timing = Date.now(), e4.trace = Ce(), e4.count = 0, t4 && (t4.consent && (e4.consent = oe(e4.consent, t4.consent),
|
|
7706
|
+
async function Jt(e4, t4) {
|
|
7707
|
+
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) => {
|
|
7475
7708
|
e5.queuePush = [];
|
|
7476
|
-
}), e4.queue = [], e4.round++, await
|
|
7477
|
-
return await
|
|
7709
|
+
}), e4.queue = [], e4.round++, await Ze2(e4), await wt2(e4);
|
|
7710
|
+
return await jt2(e4);
|
|
7478
7711
|
}
|
|
7479
|
-
function
|
|
7480
|
-
const n5 = gt(async (n6, o4 = {}) => await
|
|
7712
|
+
function rn2(e4, t4) {
|
|
7713
|
+
const n5 = gt(async (n6, o4 = {}) => await Ye(async () => {
|
|
7481
7714
|
const r6 = Date.now(), { id: s4, ingest: a4, respond: i5, mapping: c2, preChain: u2, include: d2, exclude: l3 } = o4;
|
|
7482
7715
|
let f3 = i5, p3 = n6;
|
|
7483
7716
|
const g3 = d2 || l3 ? (function(e5, t5, n7) {
|
|
7484
7717
|
let o5 = e5;
|
|
7485
7718
|
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;
|
|
7486
|
-
})(e4.destinations, d2, l3) : void 0, m3 = a4 ??
|
|
7719
|
+
})(e4.destinations, d2, l3) : void 0, m3 = a4 ?? I(s4 || "unknown");
|
|
7487
7720
|
if (c2) {
|
|
7488
7721
|
const t5 = await nt(p3, c2, e4);
|
|
7489
|
-
if (t5.ignore) return
|
|
7722
|
+
if (t5.ignore) return Dt({ ok: true });
|
|
7490
7723
|
if (c2.consent) {
|
|
7491
|
-
if (!
|
|
7724
|
+
if (!Se(c2.consent, e4.consent, t5.event.consent)) return Dt({ ok: true });
|
|
7492
7725
|
}
|
|
7493
7726
|
p3 = t5.event;
|
|
7494
7727
|
}
|
|
7495
7728
|
if (u2?.length && e4.transformers && Object.keys(e4.transformers).length > 0) {
|
|
7496
|
-
const n7 = await
|
|
7497
|
-
if (null === n7.event) return e4.logger.debug("Event dropped by transformer chain" + (n7.droppedBy ? ` (${n7.droppedBy})` : "")),
|
|
7498
|
-
if (n7.stopped) return n7.respond && (f3 = n7.respond),
|
|
7729
|
+
const n7 = await We2(e4, e4.transformers, u2, p3, m3, f3, s4 ? `source.${s4}.next` : void 0);
|
|
7730
|
+
if (null === n7.event) return e4.logger.debug("Event dropped by transformer chain" + (n7.droppedBy ? ` (${n7.droppedBy})` : "")), Dt({ ok: true, dropped: true });
|
|
7731
|
+
if (n7.stopped) return n7.respond && (f3 = n7.respond), Dt({ ok: true });
|
|
7499
7732
|
if (n7.respond && (f3 = n7.respond), Array.isArray(n7.event)) {
|
|
7500
7733
|
const o5 = await Promise.all(n7.event.map(async (n8) => {
|
|
7501
|
-
const o6 = t4(n8), r7 =
|
|
7502
|
-
return
|
|
7734
|
+
const o6 = t4(n8), r7 = Nt2(e4, o6, m3);
|
|
7735
|
+
return jt2(e4, r7, { id: s4, ingest: m3, respond: f3 }, g3);
|
|
7503
7736
|
}));
|
|
7504
7737
|
if (s4) {
|
|
7505
7738
|
e4.status.sources[s4] || (e4.status.sources[s4] = { count: 0, duration: 0 });
|
|
7506
7739
|
const t5 = e4.status.sources[s4];
|
|
7507
7740
|
t5.count += n7.event.length, t5.lastAt = Date.now(), t5.duration += Date.now() - r6;
|
|
7508
7741
|
}
|
|
7509
|
-
return o5[0] ??
|
|
7742
|
+
return o5[0] ?? Dt({ ok: true });
|
|
7510
7743
|
}
|
|
7511
7744
|
p3 = n7.event;
|
|
7512
7745
|
}
|
|
7513
|
-
const h2 =
|
|
7746
|
+
const h2 = Yt(e4, p3, m3), v3 = await jt2(e4, h2, { id: s4, ingest: m3, respond: f3 }, g3);
|
|
7514
7747
|
if (s4) {
|
|
7515
7748
|
e4.status.sources[s4] || (e4.status.sources[s4] = { count: 0, duration: 0 });
|
|
7516
7749
|
const t5 = e4.status.sources[s4];
|
|
@@ -7518,22 +7751,22 @@ function en2(e4, t4) {
|
|
|
7518
7751
|
}
|
|
7519
7752
|
return v3;
|
|
7520
7753
|
}, (t5) => {
|
|
7521
|
-
if (t5 instanceof
|
|
7522
|
-
return e4.status.failed++, e4.logger.error("push failed", { event: n6, ingest: o4.ingest, error: t5 }),
|
|
7754
|
+
if (t5 instanceof Xe) throw t5;
|
|
7755
|
+
return e4.status.failed++, e4.logger.error("push failed", { event: n6, ingest: o4.ingest, error: t5 }), Dt({ ok: false });
|
|
7523
7756
|
})(), "Push", e4.hooks, e4.logger);
|
|
7524
7757
|
return async (t5, o4) => {
|
|
7525
|
-
const r6 = "string" == typeof t5.id ? t5.id : "", { traceId: s4, sourceId: a4, parentEventId: i5 } =
|
|
7526
|
-
u2.inEvent = t5,
|
|
7758
|
+
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 });
|
|
7759
|
+
u2.inEvent = t5, on(e4, u2);
|
|
7527
7760
|
try {
|
|
7528
|
-
const u3 = await n5(t5, o4), d2 = Date.now(), l3 =
|
|
7529
|
-
return l3.durationMs = d2 - c2, l3.outEvent = u3,
|
|
7761
|
+
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 });
|
|
7762
|
+
return l3.durationMs = d2 - c2, l3.outEvent = u3, on(e4, l3), u3;
|
|
7530
7763
|
} catch (t6) {
|
|
7531
|
-
const n6 = Date.now(), o5 =
|
|
7532
|
-
throw o5.durationMs = n6 - c2, o5.error = t6 instanceof Error ? { name: t6.name, message: t6.message } : { message: String(t6) },
|
|
7764
|
+
const n6 = Date.now(), o5 = _(e4, { stepId: "collector.push", stepType: "collector", phase: "error", eventId: r6, now: n6, traceId: s4, sourceId: a4, parentEventId: i5 });
|
|
7765
|
+
throw o5.durationMs = n6 - c2, o5.error = t6 instanceof Error ? { name: t6.name, message: t6.message } : { message: String(t6) }, on(e4, o5), t6;
|
|
7533
7766
|
}
|
|
7534
7767
|
};
|
|
7535
7768
|
}
|
|
7536
|
-
function
|
|
7769
|
+
function ln(e4 = {}) {
|
|
7537
7770
|
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 };
|
|
7538
7771
|
let i5;
|
|
7539
7772
|
o4 > 0 && (i5 = setInterval(function() {
|
|
@@ -7566,12 +7799,12 @@ function an(e4 = {}) {
|
|
|
7566
7799
|
void 0 !== i5 && (clearInterval(i5), i5 = void 0), s4.clear();
|
|
7567
7800
|
} };
|
|
7568
7801
|
}
|
|
7569
|
-
function
|
|
7802
|
+
function hn(e4, t4) {
|
|
7570
7803
|
const { cacheConfig: n5, cacheStore: o4, namespace: r6, logger: s4, storeId: a4, collector: i5 } = t4, c2 = (e5, t5) => {
|
|
7571
7804
|
if (!i5) return;
|
|
7572
|
-
const n6 =
|
|
7573
|
-
n6.meta = { op: "cache", cached: "hit" === t5, status: t5, key: e5 },
|
|
7574
|
-
}, u2 = { hits: 0, misses: 0, populates: 0, writes: 0, deletes: 0, inflight_dedups: 0 }, d2 = n5.rules.map((e5) => ({ match: e5.match ?
|
|
7805
|
+
const n6 = _(i5, { stepId: `store.${a4}`, stepType: "store", phase: "in", eventId: "", now: Date.now() });
|
|
7806
|
+
n6.meta = { op: "cache", cached: "hit" === t5, status: t5, key: e5 }, on(i5, n6);
|
|
7807
|
+
}, 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}`;
|
|
7575
7808
|
function f3(e5, t5) {
|
|
7576
7809
|
const n6 = void 0 === t5 ? { key: e5 } : { key: e5, value: t5 };
|
|
7577
7810
|
return d2.find((e6) => e6.match(n6));
|
|
@@ -7580,7 +7813,7 @@ function fn(e4, t4) {
|
|
|
7580
7813
|
return { type: e4.type, config: e4.config, setup: e4.setup, get counters() {
|
|
7581
7814
|
return { ...u2 };
|
|
7582
7815
|
}, async get(t5) {
|
|
7583
|
-
const n6 = l3(t5), r7 = await o4.get(n6), s5 =
|
|
7816
|
+
const n6 = l3(t5), r7 = await o4.get(n6), s5 = Kn(r7);
|
|
7584
7817
|
if (void 0 !== s5) {
|
|
7585
7818
|
if (!("expired" in s5)) return u2.hits++, c2(t5, "hit"), s5.value;
|
|
7586
7819
|
try {
|
|
@@ -7599,7 +7832,7 @@ function fn(e4, t4) {
|
|
|
7599
7832
|
const s6 = f3(t5, r8);
|
|
7600
7833
|
if (s6) try {
|
|
7601
7834
|
const e5 = 1e3 * s6.ttl;
|
|
7602
|
-
await o4.set(n6,
|
|
7835
|
+
await o4.set(n6, Ln(r8, e5), e5), u2.populates++;
|
|
7603
7836
|
} catch (e5) {
|
|
7604
7837
|
g3("set", t5, e5);
|
|
7605
7838
|
}
|
|
@@ -7614,7 +7847,7 @@ function fn(e4, t4) {
|
|
|
7614
7847
|
const s5 = f3(t5, n6);
|
|
7615
7848
|
if (s5) try {
|
|
7616
7849
|
const e5 = 1e3 * s5.ttl;
|
|
7617
|
-
await o4.set(l3(t5),
|
|
7850
|
+
await o4.set(l3(t5), Ln(n6, e5), e5);
|
|
7618
7851
|
} catch (e5) {
|
|
7619
7852
|
g3("set", t5, e5);
|
|
7620
7853
|
}
|
|
@@ -7631,46 +7864,46 @@ function fn(e4, t4) {
|
|
|
7631
7864
|
s4 ? s4.warn(o5, { error: n6 }) : console.warn(o5, n6);
|
|
7632
7865
|
}
|
|
7633
7866
|
}
|
|
7634
|
-
function
|
|
7867
|
+
function vn2(e4, t4, n5) {
|
|
7635
7868
|
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);
|
|
7636
7869
|
t4.get = async (t5) => {
|
|
7637
|
-
const n6 = Date.now(), s5 =
|
|
7638
|
-
s5.meta = { op: "get", key: t5 },
|
|
7870
|
+
const n6 = Date.now(), s5 = _(e4, { stepId: o4, stepType: "store", phase: "in", eventId: "", now: n6 });
|
|
7871
|
+
s5.meta = { op: "get", key: t5 }, on(e4, s5);
|
|
7639
7872
|
try {
|
|
7640
|
-
const s6 = await r6(t5), a5 = Date.now(), i5 =
|
|
7641
|
-
return i5.durationMs = a5 - n6, i5.meta = { op: "get", key: t5 },
|
|
7873
|
+
const s6 = await r6(t5), a5 = Date.now(), i5 = _(e4, { stepId: o4, stepType: "store", phase: "out", eventId: "", now: a5 });
|
|
7874
|
+
return i5.durationMs = a5 - n6, i5.meta = { op: "get", key: t5 }, on(e4, i5), s6;
|
|
7642
7875
|
} catch (r7) {
|
|
7643
|
-
const s6 = Date.now(), a5 =
|
|
7644
|
-
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) },
|
|
7876
|
+
const s6 = Date.now(), a5 = _(e4, { stepId: o4, stepType: "store", phase: "error", eventId: "", now: s6 });
|
|
7877
|
+
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;
|
|
7645
7878
|
}
|
|
7646
7879
|
}, t4.set = async (t5, n6, r7) => {
|
|
7647
|
-
const a5 = Date.now(), i5 =
|
|
7648
|
-
i5.meta = { op: "set", key: t5 },
|
|
7880
|
+
const a5 = Date.now(), i5 = _(e4, { stepId: o4, stepType: "store", phase: "in", eventId: "", now: a5 });
|
|
7881
|
+
i5.meta = { op: "set", key: t5 }, on(e4, i5);
|
|
7649
7882
|
try {
|
|
7650
7883
|
await s4(t5, n6, r7);
|
|
7651
|
-
const i6 = Date.now(), c2 =
|
|
7652
|
-
c2.durationMs = i6 - a5, c2.meta = { op: "set", key: t5 },
|
|
7884
|
+
const i6 = Date.now(), c2 = _(e4, { stepId: o4, stepType: "store", phase: "out", eventId: "", now: i6 });
|
|
7885
|
+
c2.durationMs = i6 - a5, c2.meta = { op: "set", key: t5 }, on(e4, c2);
|
|
7653
7886
|
} catch (n7) {
|
|
7654
|
-
const r8 = Date.now(), s5 =
|
|
7655
|
-
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) },
|
|
7887
|
+
const r8 = Date.now(), s5 = _(e4, { stepId: o4, stepType: "store", phase: "error", eventId: "", now: r8 });
|
|
7888
|
+
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;
|
|
7656
7889
|
}
|
|
7657
7890
|
}, t4.delete = async (t5) => {
|
|
7658
|
-
const n6 = Date.now(), r7 =
|
|
7659
|
-
r7.meta = { op: "delete", key: t5 },
|
|
7891
|
+
const n6 = Date.now(), r7 = _(e4, { stepId: o4, stepType: "store", phase: "in", eventId: "", now: n6 });
|
|
7892
|
+
r7.meta = { op: "delete", key: t5 }, on(e4, r7);
|
|
7660
7893
|
try {
|
|
7661
7894
|
await a4(t5);
|
|
7662
|
-
const r8 = Date.now(), s5 =
|
|
7663
|
-
s5.durationMs = r8 - n6, s5.meta = { op: "delete", key: t5 },
|
|
7895
|
+
const r8 = Date.now(), s5 = _(e4, { stepId: o4, stepType: "store", phase: "out", eventId: "", now: r8 });
|
|
7896
|
+
s5.durationMs = r8 - n6, s5.meta = { op: "delete", key: t5 }, on(e4, s5);
|
|
7664
7897
|
} catch (r8) {
|
|
7665
|
-
const s5 = Date.now(), a5 =
|
|
7666
|
-
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) },
|
|
7898
|
+
const s5 = Date.now(), a5 = _(e4, { stepId: o4, stepType: "store", phase: "error", eventId: "", now: s5 });
|
|
7899
|
+
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;
|
|
7667
7900
|
}
|
|
7668
7901
|
};
|
|
7669
7902
|
}
|
|
7670
|
-
async function
|
|
7903
|
+
async function yn2(e4, t4 = {}) {
|
|
7671
7904
|
const n5 = {};
|
|
7672
7905
|
for (const [o5, r7] of Object.entries(t4)) {
|
|
7673
|
-
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:
|
|
7906
|
+
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);
|
|
7674
7907
|
n5[o5] = u2;
|
|
7675
7908
|
}
|
|
7676
7909
|
const o4 = t4, r6 = (function(e5) {
|
|
@@ -7699,37 +7932,37 @@ async function gn(e4, t4 = {}) {
|
|
|
7699
7932
|
const r7 = o4[t5].cache;
|
|
7700
7933
|
if (!r7) continue;
|
|
7701
7934
|
let s4, a4;
|
|
7702
|
-
void 0 !== r7.store ? (s4 = n5[r7.store], a4 = r7.store) : (n5.__cache || (n5.__cache =
|
|
7935
|
+
void 0 !== r7.store ? (s4 = n5[r7.store], a4 = r7.store) : (n5.__cache || (n5.__cache = ln()), s4 = n5.__cache, a4 = "__cache");
|
|
7703
7936
|
const i5 = r7.namespace ?? t5;
|
|
7704
|
-
e4.logger.scope("store-cache").scope(t5).info(`store "${t5}" caches with namespace "${i5}:" via ${a4}`), n5[t5] =
|
|
7937
|
+
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 });
|
|
7705
7938
|
}
|
|
7706
|
-
for (const [t5, o5] of Object.entries(n5)) "__cache" !== t5 &&
|
|
7939
|
+
for (const [t5, o5] of Object.entries(n5)) "__cache" !== t5 && vn2(e4, o5, t5);
|
|
7707
7940
|
return n5;
|
|
7708
7941
|
}
|
|
7709
|
-
async function
|
|
7710
|
-
const t4 = oe({ globalsStatic: {}, sessionStatic: {}, run: true, queueMax: 1e3 }, e4, { merge: false, extend: false }), n5 = { level: e4.logger?.level, handler: e4.logger?.handler }, o4 =
|
|
7711
|
-
void 0 !== e4.name && (
|
|
7712
|
-
return gt(async (n6, o5, r7) => await
|
|
7713
|
-
if (t6 instanceof
|
|
7714
|
-
return e5.status.failed++, e5.logger.error("command failed", { command: n6, data: o5, error: t6 }),
|
|
7942
|
+
async function wn2(e4) {
|
|
7943
|
+
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 };
|
|
7944
|
+
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) {
|
|
7945
|
+
return gt(async (n6, o5, r7) => await Ye(async () => await t5(e5, n6, o5, r7), (t6) => {
|
|
7946
|
+
if (t6 instanceof Xe) throw t6;
|
|
7947
|
+
return e5.status.failed++, e5.logger.error("command failed", { command: n6, data: o5, error: t6 }), Dt({ ok: false });
|
|
7715
7948
|
})(), "Command", e5.hooks, e5.logger);
|
|
7716
|
-
})(
|
|
7717
|
-
return async (t5, n6, o5, r7,
|
|
7949
|
+
})(s4, Lt), s4.elb = /* @__PURE__ */ (function(e5) {
|
|
7950
|
+
return async (t5, n6, o5, r7, s5) => {
|
|
7718
7951
|
if ("string" == typeof t5 && t5.startsWith("walker ")) {
|
|
7719
7952
|
const o6 = t5.replace("walker ", "");
|
|
7720
7953
|
return e5.command(o6, n6);
|
|
7721
7954
|
}
|
|
7722
|
-
let
|
|
7723
|
-
if ("string" == typeof t5)
|
|
7955
|
+
let a5;
|
|
7956
|
+
if ("string" == typeof t5) a5 = { name: t5 }, n6 && "object" == typeof n6 && !Array.isArray(n6) && (a5.data = n6);
|
|
7724
7957
|
else {
|
|
7725
|
-
if (!t5 || "object" != typeof t5 || Array.isArray(t5)) return
|
|
7726
|
-
|
|
7958
|
+
if (!t5 || "object" != typeof t5 || Array.isArray(t5)) return Dt({ ok: false });
|
|
7959
|
+
a5 = { ...t5 }, n6 && "object" == typeof n6 && !Array.isArray(n6) && (a5.data = { ...a5.data || {}, ...n6 });
|
|
7727
7960
|
}
|
|
7728
|
-
return o5 && "object" == typeof o5 && (
|
|
7961
|
+
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);
|
|
7729
7962
|
};
|
|
7730
|
-
})(
|
|
7731
|
-
const
|
|
7732
|
-
return
|
|
7963
|
+
})(s4);
|
|
7964
|
+
const a4 = e4.stores || {};
|
|
7965
|
+
return s4.stores = await yn2(s4, a4), (function(e5, t5, n6) {
|
|
7733
7966
|
const o5 = /* @__PURE__ */ new Map();
|
|
7734
7967
|
for (const [n7, r8] of Object.entries(e5)) t5[n7] && o5.set(r8, t5[n7]);
|
|
7735
7968
|
if (0 !== o5.size) {
|
|
@@ -7743,15 +7976,15 @@ async function mn(e4) {
|
|
|
7743
7976
|
}
|
|
7744
7977
|
}
|
|
7745
7978
|
}
|
|
7746
|
-
})(
|
|
7979
|
+
})(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 = {}) {
|
|
7747
7980
|
const n6 = {};
|
|
7748
7981
|
for (const [o5, r7] of Object.entries(t5)) {
|
|
7749
|
-
const { code: t6, env:
|
|
7750
|
-
if (!
|
|
7751
|
-
e5.logger.warn(`Transformer ${o5} invalid (${
|
|
7982
|
+
const { code: t6, env: s5 = {} } = r7, a5 = ur(r7, "Transformer");
|
|
7983
|
+
if (!a5.ok) {
|
|
7984
|
+
e5.logger.warn(`Transformer ${o5} invalid (${a5.code}): ${a5.reason}. Skipping.`);
|
|
7752
7985
|
continue;
|
|
7753
7986
|
}
|
|
7754
|
-
const { config:
|
|
7987
|
+
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) => {
|
|
7755
7988
|
const t7 = r7.mapping;
|
|
7756
7989
|
if (t7) {
|
|
7757
7990
|
const n7 = [];
|
|
@@ -7772,12 +8005,77 @@ async function mn(e4) {
|
|
|
7772
8005
|
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;
|
|
7773
8006
|
}
|
|
7774
8007
|
return n6;
|
|
7775
|
-
})(
|
|
8008
|
+
})(s4, e4.transformers || {}), s4;
|
|
8009
|
+
}
|
|
8010
|
+
var bn2 = globalThis;
|
|
8011
|
+
function kn2(e4) {
|
|
8012
|
+
try {
|
|
8013
|
+
const t4 = bn2.window;
|
|
8014
|
+
if (!t4) return;
|
|
8015
|
+
t4.localStorage.getItem(Nt) === e4 && t4.localStorage.removeItem(Nt);
|
|
8016
|
+
} catch {
|
|
8017
|
+
}
|
|
8018
|
+
}
|
|
8019
|
+
function In(e4, t4) {
|
|
8020
|
+
return void 0 === t4 ? e4 : (n5) => e4({ ...n5, release: t4 });
|
|
7776
8021
|
}
|
|
7777
|
-
|
|
8022
|
+
function Cn2(e4, t4) {
|
|
8023
|
+
if (t4.observers) for (const n6 of t4.observers) e4.observers.add(n6);
|
|
8024
|
+
const n5 = t4.observe;
|
|
8025
|
+
if (!n5) return;
|
|
8026
|
+
const o4 = e4.name ?? "default";
|
|
8027
|
+
if ("binding" in n5) {
|
|
8028
|
+
const t5 = (function() {
|
|
8029
|
+
const e5 = bn2.window, t6 = bn2.URLSearchParams;
|
|
8030
|
+
if (!e5 || !t6) return null;
|
|
8031
|
+
try {
|
|
8032
|
+
const n6 = new t6(e5.location.search.replace(/^\?/, "")).getAll(Nt);
|
|
8033
|
+
return n6.length > 0 ? n6[n6.length - 1] ?? null : null;
|
|
8034
|
+
} catch {
|
|
8035
|
+
return null;
|
|
8036
|
+
}
|
|
8037
|
+
})(), r6 = t5 ?? (function() {
|
|
8038
|
+
try {
|
|
8039
|
+
return bn2.window?.localStorage.getItem(Nt) ?? null;
|
|
8040
|
+
} catch {
|
|
8041
|
+
return null;
|
|
8042
|
+
}
|
|
8043
|
+
})();
|
|
8044
|
+
if (!r6) return;
|
|
8045
|
+
const u2 = xn(r6);
|
|
8046
|
+
if (!u2) return void (null === t5 ? (e4.logger.warn("observe: malformed stored credential cleared"), kn2(r6)) : e4.logger.warn("observe: malformed credential ignored"));
|
|
8047
|
+
if (u2.pb !== n5.binding) return void e4.logger.warn("observe: credential binding mismatch, credential ignored");
|
|
8048
|
+
let d2;
|
|
8049
|
+
!(function(e5) {
|
|
8050
|
+
try {
|
|
8051
|
+
bn2.window?.localStorage.setItem(Nt, e5);
|
|
8052
|
+
} catch {
|
|
8053
|
+
}
|
|
8054
|
+
})(r6), null !== t5 && (function() {
|
|
8055
|
+
const e5 = bn2.window, t6 = bn2.URLSearchParams;
|
|
8056
|
+
if (e5 && t6) try {
|
|
8057
|
+
const n6 = e5.location.href, o5 = n6.indexOf("#"), r7 = 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) : "");
|
|
8058
|
+
u3.delete(Nt);
|
|
8059
|
+
const d3 = u3.toString();
|
|
8060
|
+
e5.history.replaceState({}, "", `${c2}${d3 ? `?${d3}` : ""}${r7}`);
|
|
8061
|
+
} catch {
|
|
8062
|
+
}
|
|
8063
|
+
})();
|
|
8064
|
+
const l3 = sn({ url: `${n5.url}/ingest/${u2.ses}`, token: u2.secret, headers: { "X-Walkeros-Binding": n5.binding }, onStatus: (t6) => {
|
|
8065
|
+
401 === t6 && (kn2(r6), d2 && e4.observers.delete(d2));
|
|
8066
|
+
} });
|
|
8067
|
+
d2 = vt(/* @__PURE__ */ (function(e5, t6) {
|
|
8068
|
+
return void 0 === t6 ? e5 : (n6) => e5({ ...n6, flowId: t6 });
|
|
8069
|
+
})(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);
|
|
8070
|
+
const f3 = n5.level;
|
|
8071
|
+
return void (void 0 !== f3 && (e4.observeLevel = () => f3));
|
|
8072
|
+
}
|
|
8073
|
+
"off" !== n5.level && 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 }));
|
|
8074
|
+
}
|
|
8075
|
+
async function En(e4) {
|
|
7778
8076
|
e4 = e4 || {};
|
|
7779
|
-
const t4 = await
|
|
7780
|
-
await
|
|
8077
|
+
const t4 = await wn2(e4);
|
|
8078
|
+
Cn2(t4, e4), await Qe2(t4, e4.sources || {});
|
|
7781
8079
|
const { consent: n5, user: o4, globals: r6, custom: s4 } = e4;
|
|
7782
8080
|
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");
|
|
7783
8081
|
let a4 = t4.elb;
|
|
@@ -7927,7 +8225,7 @@ async function createEmitter(opts) {
|
|
|
7927
8225
|
}
|
|
7928
8226
|
}
|
|
7929
8227
|
};
|
|
7930
|
-
const { elb } = await
|
|
8228
|
+
const { elb } = await En(collectorConfig);
|
|
7931
8229
|
elbFn = elb;
|
|
7932
8230
|
return elbFn;
|
|
7933
8231
|
}
|
|
@@ -8339,7 +8637,7 @@ function defaultPushError(error, startTime) {
|
|
|
8339
8637
|
error: getErrorMessage(error)
|
|
8340
8638
|
};
|
|
8341
8639
|
}
|
|
8342
|
-
async function withFlowContext(options,
|
|
8640
|
+
async function withFlowContext(options, fn2, onError) {
|
|
8343
8641
|
const {
|
|
8344
8642
|
esmPath,
|
|
8345
8643
|
platform,
|
|
@@ -8414,7 +8712,7 @@ async function withFlowContext(options, fn3, onError) {
|
|
|
8414
8712
|
const stopPump = drainPump ? startDrainPump(timerControl.pending) : null;
|
|
8415
8713
|
let result;
|
|
8416
8714
|
try {
|
|
8417
|
-
result = await
|
|
8715
|
+
result = await fn2(flowModule);
|
|
8418
8716
|
} finally {
|
|
8419
8717
|
if (stopPump) stopPump();
|
|
8420
8718
|
}
|
|
@@ -8427,9 +8725,9 @@ async function withFlowContext(options, fn3, onError) {
|
|
|
8427
8725
|
timeout
|
|
8428
8726
|
);
|
|
8429
8727
|
});
|
|
8430
|
-
return await Promise.race([
|
|
8728
|
+
return await Promise.race([fn2(flowModule), timeoutPromise]);
|
|
8431
8729
|
}
|
|
8432
|
-
return await
|
|
8730
|
+
return await fn2(flowModule);
|
|
8433
8731
|
} catch (error) {
|
|
8434
8732
|
return (onError ?? defaultPushError)(error, startTime);
|
|
8435
8733
|
} finally {
|
|
@@ -8799,7 +9097,7 @@ function resolveBeforeChain(before, transformers, ingest, event) {
|
|
|
8799
9097
|
if (Array.isArray(before) && before.every(isString)) {
|
|
8800
9098
|
return before;
|
|
8801
9099
|
}
|
|
8802
|
-
const ids =
|
|
9100
|
+
const ids = zn(before, Xn(ingest, event));
|
|
8803
9101
|
if (ids.length === 0) return [];
|
|
8804
9102
|
if (ids.length === 1) return walkStaticChain(ids[0], transformers);
|
|
8805
9103
|
return ids;
|
|
@@ -9112,7 +9410,7 @@ async function simulateSource(configOrPath, input, options) {
|
|
|
9112
9410
|
const captured = [];
|
|
9113
9411
|
flowConfig.hooks = {
|
|
9114
9412
|
...flowConfig.hooks || {},
|
|
9115
|
-
prePush: ({ fn:
|
|
9413
|
+
prePush: ({ fn: fn2 }, event) => {
|
|
9116
9414
|
captured.push({ event, timestamp: Date.now() });
|
|
9117
9415
|
return { ok: true };
|
|
9118
9416
|
}
|
|
@@ -9228,7 +9526,7 @@ async function simulateTransformer(configOrPath, event, options) {
|
|
|
9228
9526
|
`Transformer "${options.transformerId}" not found in collector. Available: ${Object.keys(collector.transformers || {}).join(", ") || "none"}`
|
|
9229
9527
|
);
|
|
9230
9528
|
}
|
|
9231
|
-
const initialized = await
|
|
9529
|
+
const initialized = await Re2(
|
|
9232
9530
|
collector,
|
|
9233
9531
|
transformer,
|
|
9234
9532
|
options.transformerId
|
|
@@ -9240,7 +9538,7 @@ async function simulateTransformer(configOrPath, event, options) {
|
|
|
9240
9538
|
}
|
|
9241
9539
|
const inputEvent = event;
|
|
9242
9540
|
const ingest = {
|
|
9243
|
-
...
|
|
9541
|
+
...I(options.transformerId),
|
|
9244
9542
|
...options.ingest
|
|
9245
9543
|
};
|
|
9246
9544
|
const captured = [];
|
|
@@ -9255,7 +9553,7 @@ async function simulateTransformer(configOrPath, event, options) {
|
|
|
9255
9553
|
processedEvent
|
|
9256
9554
|
);
|
|
9257
9555
|
if (beforeChainIds.length > 0) {
|
|
9258
|
-
const beforeResult = await
|
|
9556
|
+
const beforeResult = await We2(
|
|
9259
9557
|
collector,
|
|
9260
9558
|
collector.transformers,
|
|
9261
9559
|
beforeChainIds,
|
|
@@ -9277,7 +9575,7 @@ async function simulateTransformer(configOrPath, event, options) {
|
|
|
9277
9575
|
processedEvent = Array.isArray(beforeResult) ? beforeResult[0] : beforeResult;
|
|
9278
9576
|
}
|
|
9279
9577
|
}
|
|
9280
|
-
const pushResult = await
|
|
9578
|
+
const pushResult = await He(
|
|
9281
9579
|
collector,
|
|
9282
9580
|
transformer,
|
|
9283
9581
|
options.transformerId,
|
|
@@ -9400,7 +9698,7 @@ async function simulateCollector(configOrPath, event, options) {
|
|
|
9400
9698
|
if (options.state.timing !== void 0)
|
|
9401
9699
|
collector.timing = options.state.timing;
|
|
9402
9700
|
}
|
|
9403
|
-
const enriched =
|
|
9701
|
+
const enriched = Yt(collector, event);
|
|
9404
9702
|
const captured = [{ event: enriched, timestamp: Date.now() }];
|
|
9405
9703
|
await collector.command("shutdown");
|
|
9406
9704
|
return buildSimulationResult({
|
|
@@ -9506,7 +9804,7 @@ async function simulateDestination(configOrPath, event, options) {
|
|
|
9506
9804
|
...devEnv.push,
|
|
9507
9805
|
simulation: devEnv.simulation
|
|
9508
9806
|
};
|
|
9509
|
-
const { wrappedEnv, calls } =
|
|
9807
|
+
const { wrappedEnv, calls } = K2(combined);
|
|
9510
9808
|
if (destConfig) destConfig.env = wrappedEnv;
|
|
9511
9809
|
trackedCalls = calls;
|
|
9512
9810
|
}
|
|
@@ -10250,7 +10548,7 @@ function readGrantHeader(req) {
|
|
|
10250
10548
|
return "";
|
|
10251
10549
|
}
|
|
10252
10550
|
function guardPreviewIntake(req, res, gate, logger, onPass) {
|
|
10253
|
-
|
|
10551
|
+
It(readGrantHeader(req), {
|
|
10254
10552
|
keyring: gate.keyring,
|
|
10255
10553
|
iss: gate.iss,
|
|
10256
10554
|
pb: gate.pb,
|
|
@@ -10672,9 +10970,9 @@ function createTracePoller(config, logger) {
|
|
|
10672
10970
|
if (!("traceUntil" in parsed)) return;
|
|
10673
10971
|
const value = parsed.traceUntil;
|
|
10674
10972
|
if (typeof value === "string" && value.length > 0) {
|
|
10675
|
-
|
|
10973
|
+
rn(value);
|
|
10676
10974
|
} else if (value === null) {
|
|
10677
|
-
|
|
10975
|
+
rn(null);
|
|
10678
10976
|
}
|
|
10679
10977
|
} finally {
|
|
10680
10978
|
inFlight = false;
|
|
@@ -11101,12 +11399,12 @@ function buildTelemetryObservers(flowId, observeLevel) {
|
|
|
11101
11399
|
const deploymentId = process.env.WALKEROS_DEPLOYMENT_ID;
|
|
11102
11400
|
if (!base || !token || !deploymentId) return void 0;
|
|
11103
11401
|
const url = `${base}/ingest/${deploymentId}`;
|
|
11104
|
-
const emit =
|
|
11402
|
+
const emit = sn({ url, token });
|
|
11105
11403
|
const observe = observeLevel !== void 0 ? { level: observeLevel } : void 0;
|
|
11106
11404
|
return [
|
|
11107
11405
|
vt(
|
|
11108
11406
|
emit,
|
|
11109
|
-
() => bt({ flowId, observe, traceUntil:
|
|
11407
|
+
() => bt({ flowId, observe, traceUntil: nn() })
|
|
11110
11408
|
)
|
|
11111
11409
|
];
|
|
11112
11410
|
}
|
|
@@ -11116,7 +11414,7 @@ function buildObserveLevelSupplier(flowId, observeLevel) {
|
|
|
11116
11414
|
const opts = bt({
|
|
11117
11415
|
flowId,
|
|
11118
11416
|
observe,
|
|
11119
|
-
traceUntil:
|
|
11417
|
+
traceUntil: nn()
|
|
11120
11418
|
});
|
|
11121
11419
|
return opts ? opts.level ?? "standard" : "off";
|
|
11122
11420
|
};
|
|
@@ -11479,11 +11777,11 @@ function resolveEnvMarkers(value) {
|
|
|
11479
11777
|
function resolveEnvMarkersInString(input) {
|
|
11480
11778
|
if (!input.includes(J)) return input;
|
|
11481
11779
|
const esc = J.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
11482
|
-
const
|
|
11780
|
+
const re4 = new RegExp(
|
|
11483
11781
|
esc + "([a-zA-Z_][a-zA-Z0-9_]*)(?::((?:(?!" + esc + `)[^\\s"'])*))?`,
|
|
11484
11782
|
"g"
|
|
11485
11783
|
);
|
|
11486
|
-
return input.replace(
|
|
11784
|
+
return input.replace(re4, (match, name, defaultValue) => {
|
|
11487
11785
|
if (typeof process !== "undefined" && process.env?.[name] !== void 0) {
|
|
11488
11786
|
return process.env[name];
|
|
11489
11787
|
}
|
|
@@ -12991,7 +13289,7 @@ function validateFlow(input, options = {}) {
|
|
|
12991
13289
|
transformersValue
|
|
12992
13290
|
)) {
|
|
12993
13291
|
if (!de(transformerValue)) continue;
|
|
12994
|
-
const result =
|
|
13292
|
+
const result = ur(transformerValue, "Transformer");
|
|
12995
13293
|
if (!result.ok) {
|
|
12996
13294
|
errors.push({
|
|
12997
13295
|
path: `flows.${flowName}.transformers.${name}`,
|
|
@@ -13452,7 +13750,7 @@ function validateMapping(input) {
|
|
|
13452
13750
|
// src/commands/validate/validators/entry.ts
|
|
13453
13751
|
init_dist();
|
|
13454
13752
|
import Ajv from "ajv";
|
|
13455
|
-
var CLIENT_HEADER = "walkeros-cli/4.3.
|
|
13753
|
+
var CLIENT_HEADER = "walkeros-cli/4.3.1-next-1784373088875";
|
|
13456
13754
|
var SECTIONS = ["destinations", "sources", "transformers"];
|
|
13457
13755
|
function resolveEntry(path19, flowConfig) {
|
|
13458
13756
|
const flows = flowConfig.flows;
|
|
@@ -13528,7 +13826,7 @@ async function validateEntry(path19, flowConfig) {
|
|
|
13528
13826
|
}
|
|
13529
13827
|
let schemas;
|
|
13530
13828
|
try {
|
|
13531
|
-
const info = await
|
|
13829
|
+
const info = await wn(packageName, {
|
|
13532
13830
|
client: CLIENT_HEADER
|
|
13533
13831
|
});
|
|
13534
13832
|
schemas = info.schemas;
|
|
@@ -14363,9 +14661,9 @@ async function deleteDeployment(options) {
|
|
|
14363
14661
|
const data = await response.json().catch(() => null);
|
|
14364
14662
|
return data ?? { success: true };
|
|
14365
14663
|
}
|
|
14366
|
-
async function handleResult3(
|
|
14664
|
+
async function handleResult3(fn2, options) {
|
|
14367
14665
|
try {
|
|
14368
|
-
const result = await
|
|
14666
|
+
const result = await fn2();
|
|
14369
14667
|
await writeResult(JSON.stringify(result, null, 2), options);
|
|
14370
14668
|
} catch (error) {
|
|
14371
14669
|
handleCliError(error);
|
|
@@ -14855,6 +15153,30 @@ previewsCmd.command("delete <flowId> <previewId>").description("Delete a preview
|
|
|
14855
15153
|
handleCliError(err);
|
|
14856
15154
|
}
|
|
14857
15155
|
});
|
|
15156
|
+
var observeCmd = program.command("observe").description("Observe live events flowing through a flow");
|
|
15157
|
+
observeCmd.command("start <flowId>").description(
|
|
15158
|
+
"Start an observe session: mints it via the app and prints the web and server attach info"
|
|
15159
|
+
).option(
|
|
15160
|
+
"-f, --flow <name>",
|
|
15161
|
+
"Flow settings name (auto-resolved when the flow has exactly one)"
|
|
15162
|
+
).option("--project <projectId>", "Project ID (overrides default)").option(
|
|
15163
|
+
"--level <level>",
|
|
15164
|
+
"Observation detail level (reserved; not yet supported by the API)"
|
|
15165
|
+
).option("--replace", "Replace an existing active session for this flow").option("--no-wait", "Do not wait for the session to settle").option(
|
|
15166
|
+
"--timeout <seconds>",
|
|
15167
|
+
"Seconds to wait for the session to settle (default: 300)"
|
|
15168
|
+
).option("--json", "Output the session as JSON").action(async (flowId, options) => {
|
|
15169
|
+
const { observeStartCommand: observeStartCommand2 } = await Promise.resolve().then(() => (init_observe(), observe_exports));
|
|
15170
|
+
await observeStartCommand2(flowId, {
|
|
15171
|
+
project: options.project,
|
|
15172
|
+
flow: options.flow,
|
|
15173
|
+
level: options.level,
|
|
15174
|
+
replace: options.replace,
|
|
15175
|
+
wait: options.wait,
|
|
15176
|
+
timeout: options.timeout,
|
|
15177
|
+
json: options.json
|
|
15178
|
+
});
|
|
15179
|
+
});
|
|
14858
15180
|
program.command("run [file]").description("Run a walkerOS flow").option("-f, --flow <name>", "flow name for multi-flow configs").option("--flow-id <id>", "API flow ID (enables heartbeat, polling, secrets)").option("--project <id>", "project ID (defaults to WALKEROS_PROJECT_ID)").option("-p, --port <number>", "port to listen on (default: 8080)", parseInt).option(
|
|
14859
15181
|
"--env-file <path>",
|
|
14860
15182
|
"load environment variables from a dotenv file (opt-in; existing env wins; refuses group/other-readable files)"
|